/**
 * 国际服科技计算器 — 样式
 *
 * 只做布局与状态色，配色沿用主题的 footer-card / table-dark。
 */

/* ---------- 页面骨架：桌面端主操作区 + 汇总侧栏 ---------- */

/* 科技计算器自己提供右栏，本站通用的 Tips / 下载 / 社媒侧栏在此页不再重复展示。 */
#research-calculator-app + .col-md-6.col-lg-4 {
    display: none;
}

body:has(#research-calculator-app) .container-md {
    max-width: 1440px;
}

body:has(#research-calculator-app) {
    background-color: #10162b !important;
    background-image: none !important;
}

#research-calculator-app {
    --research-page-bg: #10162b;
    --research-panel-bg: #262d50;
    --research-panel-deep: #171e3a;
    --research-border: #46547e;
    --research-muted: #aeb7d2;
    --research-accent: #38aef0;
    text-align: left;
}

.research-calculator-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    align-items: start;
    gap: 18px;
    margin-bottom: 16px;
}

.research-calculator-main {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.research-summary-sidebar {
    position: sticky;
    top: 16px;
    min-width: 0;
}

#research-calculator-app .research-panel {
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 1px solid var(--research-border);
    border-radius: 8px;
    background: var(--research-panel-bg);
}

.research-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--research-border);
    background: var(--research-panel-deep);
}

.research-panel-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.16rem;
    line-height: 1.25;
}

.research-panel-header p {
    margin: 3px 0 0;
    color: var(--research-muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

.research-panel-badge {
    flex: 0 0 auto;
    margin-top: 2px;
    padding: 3px 9px;
    border: 1px solid #61719f;
    border-radius: 999px;
    background: #303a63;
    color: #dce5ff;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
}

.research-total-bonus {
    border-color: #079864;
    background: #073f36;
    color: #57efb8;
}

.research-panel-body {
    padding: 12px 14px;
}

.research-panel-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--research-border);
    background: var(--research-panel-deep);
    color: #c3d7ff;
    font-size: 0.78rem;
}

/* ---------- 研究加成 ---------- */

.research-buff-body {
    display: grid;
    gap: 10px;
}

.research-buff-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 48px minmax(160px, 190px);
    align-items: center;
    min-height: 43px;
    padding: 7px 10px;
    border-radius: 6px;
    background: var(--research-panel-deep);
}

.research-buff-row label {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.research-buff-row .form-switch {
    display: flex;
    justify-content: center;
    padding-left: 0;
}

.research-buff-row .form-switch .form-check-input {
    float: none;
    width: 2.4em;
    height: 1.3em;
    margin: 0;
    cursor: pointer;
}

.research-buff-row-primary {
    grid-template-columns: minmax(220px, 1fr) 28px minmax(160px, 190px);
    min-height: 52px;
}

.research-buff-sign {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
}

.research-buff-input {
    width: 100%;
}

.research-buff-input .form-control,
.research-buff-input .input-group-text {
    min-height: 36px;
    border-color: #60709e;
    background: #3c466f !important;
}

.research-buff-input .form-control::placeholder,
#research-search-input::placeholder {
    color: #929bb6;
    opacity: 1;
}

.research-fixed-bonus {
    padding-right: 26px;
    text-align: center;
    font-size: 1.08rem;
}

.research-buff-warning {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #a87512;
    border-radius: 6px;
    background: #50391f;
    color: #ffd24a;
    font-size: 0.76rem;
    line-height: 1.4;
}

/* ---------- 科技筛选 ---------- */

.research-tech-body {
    position: relative;
    padding: 0;
}

.research-tech-body.is-loading > :not(.research-loading-state) {
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
}

.research-loading-state {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 445px;
    background: rgba(23, 30, 58, 0.86);
    color: #dce5ff;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.research-loading-state.d-none {
    display: none !important;
}

.research-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(101, 169, 255, 0.28);
    border-top-color: #65a9ff;
    border-radius: 50%;
    animation: research-loading-spin 0.8s linear infinite;
}

@keyframes research-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.research-category-tabs {
    min-height: 52px;
    padding: 13px 14px 8px;
}

.research-category-tabs .btn,
.research-tier-rail .btn {
    color: #fff;
    font-weight: 700;
}

.research-category-tabs .btn {
    padding: 5px 11px;
    font-size: 0.98rem;
}

.research-category-tabs .btn-primary,
.research-tier-rail .btn-primary {
    border-color: #65a9ff;
    background: #121a32;
    box-shadow: none;
}

.research-search-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 10px;
    padding: 0 14px 12px;
    border-bottom: 1px solid var(--research-border);
}

.research-search-row .form-control {
    min-width: 0;
    border-color: #60709e;
    background: #3c466f !important;
}

.research-search-row .btn {
    border-color: #60709e;
    background: #30395f;
    color: #fff;
    white-space: nowrap;
}

#research-search-scope {
    margin: 0 !important;
    padding: 0 14px 10px;
}

.research-browse {
    min-height: 340px;
    gap: 0;
}

.research-tier-rail {
    align-self: stretch;
    min-width: 104px;
    max-height: 560px;
    padding: 12px 10px;
    border-right: 1px solid var(--research-border);
    border-radius: 0;
    background: var(--research-panel-deep);
}

.research-tier-rail .research-tier-btn {
    padding: 4px 8px;
    font-size: 1rem;
}

.research-tech-list {
    grid-template-columns: repeat(auto-fill, 128px);
    align-content: start;
    justify-content: start;
    min-height: 340px;
    max-height: 560px;
    padding: 14px;
}

.research-tech-card {
    align-self: start;
    border: 2px solid #d8e9ff;
    border-radius: 7px;
    background: #e6f2ff;
    color: #0d1831;
}

.research-tech-card:hover {
    border-color: #55b9f2;
    background: #edf8ff;
}

.research-tech-card.is-selected {
    border-color: #6fd0ff;
    background: #dff4ff;
}

.research-tech-thumb-box,
.research-tech-card.is-selected .research-tech-thumb-box {
    aspect-ratio: 1 / 0.92;
    background: linear-gradient(180deg, #45bae9 0%, #1999dc 100%);
}

.research-tech-band,
.research-tech-card.is-selected .research-tech-band {
    min-height: 42px;
    padding: 5px;
    background: #e8f4ff;
}

.research-tech-name {
    font-size: 0.72rem;
}

.research-tech-sub {
    color: #65708b !important;
    font-size: 0.64rem;
}

/* ---------- 右侧汇总 ---------- */

.research-summary-panel {
    min-height: 520px;
}

.research-summary-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.research-selected-container {
    min-height: 84px;
    max-height: 350px;
    overflow-y: auto;
    padding: 26px 12px;
    border: 1px dashed #7484b2;
    border-radius: 7px;
    color: #c0c9e4;
    text-align: center;
}

.research-selected-container:has(.research-selected-card) {
    padding: 0;
    border: 0;
    text-align: left;
}

.research-selected-container .research-selected-card {
    margin-bottom: 10px !important;
    text-align: left;
}

.research-summary-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.research-summary-stat {
    min-height: 76px;
    padding: 12px;
    border: 1px solid var(--research-border);
    border-radius: 7px;
    background: var(--research-panel-deep);
}

.research-summary-stat span,
.research-summary-stat strong {
    display: block;
}

.research-summary-stat span {
    color: #bdc5dc;
    font-size: 0.74rem;
    line-height: 1.35;
}

.research-summary-stat strong {
    margin-top: 7px;
    color: #fff;
    font-size: 1.16rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.research-summary-stat:nth-child(4) strong {
    color: #ffca3a;
}

.research-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--research-border);
}

.research-summary-actions .btn {
    font-weight: 700;
}

.research-summary-actions .btn-outline-danger {
    background: #6a2b3a;
    color: #fff;
}

.research-detail-panel {
    border: 1px solid var(--research-border);
    background: var(--research-panel-bg);
}

#research-calculator-app > .footer-card {
    border: 1px solid var(--research-border);
    border-radius: 9px;
    background: var(--research-panel-bg);
}

.research-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.research-section-heading h2,
.research-inventory-panel h2,
.research-status-panel h2 {
    color: #fff;
    font-size: 1.45rem;
    line-height: 1.3;
}

.research-inventory-panel h2,
.research-status-panel h2 {
    margin: 0 0 8px;
}

.research-section-note {
    margin-bottom: 16px;
    color: #b9c3df;
    font-size: 0.86rem;
    line-height: 1.55;
}

/* ---------- 图标 ---------- */

/* 页面标题旁的计算器图标 */
.research-calc-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

/* 资源 / 加速道具图标（表头、库存输入、需求状态共用一套尺寸） */
.research-res-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

/* ---------- 浏览区：左侧阶数竖排 + 右侧科技网格 ---------- */

/* 搜索态：分类 tab 与阶数竖排暂时失效，压暗提示「现在看的是全范围结果」 */
.research-category-tabs.is-muted,
.research-tier-rail.is-muted {
    opacity: 0.5;
}

.research-browse {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.research-tier-rail {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 104px;
    max-height: 560px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 8px;
}

.research-tier-rail .research-tier-btn {
    width: 100%;
    white-space: nowrap;
    text-align: center;
}

/* 未选中的分类 / 阶数在截图里是纯文字，不带描边，选中的才是实心块 */
.research-category-tabs .research-category-btn.btn-outline-light,
.research-tier-rail .research-tier-btn.btn-outline-light {
    border-color: transparent;
}

.research-category-tabs .research-category-btn.btn-outline-light:hover,
.research-tier-rail .research-tier-btn.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: transparent;
    color: #fff;
}

/* ---------- 科技列表 ---------- */

.research-tech-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 12px;
    flex: 1;
    min-width: 0;
    max-height: 560px;
    overflow-y: auto;
    padding-right: 4px;
}

/* 深色主题下默认滚动条太扎眼，压成细窄条 */
.research-tech-list,
.research-tier-rail {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.research-tech-list::-webkit-scrollbar,
.research-tier-rail::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.research-tech-list::-webkit-scrollbar-thumb,
.research-tier-rail::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.research-tech-list::-webkit-scrollbar-track,
.research-tier-rail::-webkit-scrollbar-track {
    background: transparent;
}

.research-tech-card {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.research-tech-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* 键盘操作：勾选框拿到焦点时整卡描边，不然看不出焦点在哪张卡上 */
.research-tech-card:focus-within {
    outline: 2px solid rgba(94, 168, 255, 0.9);
    outline-offset: 1px;
}

/* 选中态用蓝色高亮，对齐需求截图（截图里选中卡片是整块浅蓝） */
.research-tech-card.is-selected {
    border-color: rgba(94, 168, 255, 0.9);
    background: rgba(94, 168, 255, 0.18);
}

.research-tech-card.is-selected .research-tech-band {
    background: rgba(94, 168, 255, 0.25);
}

/* 同系列已选其它项 → 打叉置灰不可点 */
.research-tech-card.is-blocked {
    opacity: 0.5;
    filter: grayscale(1);
    border-color: rgba(220, 53, 69, 0.5);
}

.research-tech-card.is-blocked:hover {
    transform: none;
    border-color: rgba(220, 53, 69, 0.5);
}

.research-tech-card.is-blocked:hover .research-tech-thumb {
    transform: none;
}

.research-tech-card.is-blocked .research-tech-label {
    cursor: not-allowed;
}

.research-tech-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    text-align: center;
}

/* 勾选框固定在卡片右上角，尺寸放大到手指能点（截图里勾选框也是明显的一块） */
.research-tech-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.55);
    z-index: 2;
}

.research-tech-check:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* 图标底板：铺满卡片上半部分、正方形（截图里图标就是卡片主体）。
   底板自带底色，所以图标缺失或加载失败时是一块中性色块，不会塌成空洞。 */
.research-tech-thumb-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.15s ease;
}

/* 游戏图标本身带留白，用 contain 不裁切；非正方的图也不会被拉歪 */
.research-tech-thumb {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.15s ease;
}

.research-tech-card:hover .research-tech-thumb {
    transform: scale(1.06);
}

.research-tech-card.is-selected .research-tech-thumb-box {
    background: rgba(94, 168, 255, 0.22);
}

/* 名称条：图标下方的独立色块 */
.research-tech-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
}

.research-tech-name {
    font-size: 0.82rem;
    line-height: 1.25;
    word-break: break-word;
}

.research-tech-sub {
    font-size: 0.7rem;
}

/* 同系列互斥的 ❌ 压在图标左上角 */
.research-tech-flag {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.9rem;
    z-index: 2;
}

/* ---------- 已选科技卡片 ---------- */

.research-selected-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
}

.research-selected-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* 已选卡片头部的小图标：与网格里铺满卡片的 .research-tech-thumb 不是同一个尺寸 */
.research-selected-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.research-selected-title {
    font-weight: 600;
}

.research-level-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.research-level-label {
    font-size: 0.85rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

.research-level-row .form-select {
    width: auto;
    min-width: 84px;
}

/* 加成 / 实力对比 */
.research-delta-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
}

.research-delta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    padding: 2px 0;
}

.research-delta-label {
    flex: 1;
    min-width: 140px;
    color: rgba(255, 255, 255, 0.75);
}

.research-delta-value {
    min-width: 64px;
    text-align: right;
}

.research-delta-arrow {
    color: rgba(255, 255, 255, 0.45);
}

/* ---------- 汇总表 ---------- */

.research-results-scroll {
    position: relative;
    overflow-x: auto;
    border: 1px solid #4e5e8b;
    border-radius: 8px;
    background: #171d31;
    scrollbar-color: #7787b2 #171d31;
    scrollbar-width: thin;
}

.research-results-scroll:focus-visible {
    outline: 2px solid var(--research-accent);
    outline-offset: 2px;
}

.research-results-scroll::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.research-results-scroll::-webkit-scrollbar-track {
    background: #171d31;
}

.research-results-scroll::-webkit-scrollbar-thumb {
    border: 2px solid #171d31;
    border-radius: 999px;
    background: #7787b2;
}

.research-results-table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    background: #202637;
}

.research-results-table th,
.research-results-table td {
    padding: 12px 14px;
    white-space: nowrap;
    vertical-align: middle;
    border-right: 1px solid rgba(132, 148, 190, 0.2);
    border-bottom: 1px solid rgba(132, 148, 190, 0.17);
    line-height: 1.35;
}

.research-results-table th:last-child,
.research-results-table td:last-child {
    border-right: 0;
}

.research-results-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #171d31;
    color: #f7f9ff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* 等宽数字，多行数值上下对齐好比对 */
.research-results-table td {
    background: #202637;
    color: #eef2ff;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.research-results-table tbody tr:nth-child(even):not(.research-total-row) td {
    background: #242b40;
}

.research-results-table tbody tr:not(.research-total-row):hover td {
    background: #2c3550;
}

.research-results-table .col-index,
.research-results-table .col-index-cell {
    left: 0;
    z-index: 4;
    width: 54px;
    min-width: 54px;
    text-align: center;
}

.research-results-table .col-tech,
.research-results-table .col-tech-cell {
    left: 54px;
    z-index: 4;
    width: 220px;
    min-width: 220px;
    max-width: 280px;
    text-align: left;
}

.research-results-table .col-index,
.research-results-table .col-tech {
    z-index: 5;
}

.research-results-table .col-index-cell,
.research-results-table .col-tech-cell {
    position: sticky;
    box-shadow: 1px 0 0 rgba(132, 148, 190, 0.23);
}

.research-results-table .col-tech-cell {
    overflow: hidden;
    text-overflow: ellipsis;
}

.research-results-table .col-level,
.research-results-table .col-level-cell {
    min-width: 108px;
    text-align: center;
}

.research-results-table .col-resource {
    min-width: 142px;
    text-align: right;
}

.research-results-table thead .col-resource {
    text-align: left;
}

.research-results-table .col-refined {
    min-width: 185px;
}

.research-results-table .col-advanced {
    min-width: 175px;
}

.research-resource-heading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.research-resource-heading .research-res-icon {
    flex: 0 0 auto;
}

.research-results-table .col-time,
.research-results-table .col-time-cell {
    min-width: 154px;
    text-align: right;
}

.research-results-table .col-power,
.research-results-table .col-power-cell {
    min-width: 142px;
    text-align: right;
}

.research-results-table .col-points,
.research-results-table .col-points-cell {
    min-width: 190px;
    text-align: right;
}

.research-results-table .research-total-row td {
    border-top: 2px solid #7d8fbe;
    border-bottom: 0;
    background: #18213a;
    color: #fff;
}

.research-empty-summary {
    height: 92px;
    padding: 24px !important;
    color: #b9c3df !important;
    text-align: center;
}

/* ---------- 库存输入 ---------- */

.research-inventory-grid {
    margin-top: 2px;
}

.research-inventory-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.research-inventory-item .form-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 24px;
    color: #eef2ff;
    font-size: 0.86rem;
    font-weight: 600;
}

.research-inventory-item .form-control {
    min-height: 42px;
    border-color: #596a97;
    border-radius: 7px;
    background: #171d31 !important;
}

.research-inventory-item .form-control:focus {
    border-color: var(--research-accent);
    box-shadow: 0 0 0 0.18rem rgba(56, 174, 240, 0.2);
}

/* ---------- 资源需求状态 ---------- */

.research-status-row {
    display: grid;
    grid-template-columns: 24px minmax(130px, 1fr) minmax(130px, auto) minmax(130px, auto) minmax(110px, auto);
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
}

.research-status-row:last-child {
    border-bottom: none;
}

.research-status-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.research-status-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.research-status-label {
    min-width: 0;
    font-weight: 600;
}

.research-status-need,
.research-status-have {
    min-width: 0;
    color: #c5cee5;
}

.research-status-state {
    min-width: 84px;
    text-align: right;
}

.research-status-shortage {
    grid-column: 3 / -1;
    margin-top: -6px;
    text-align: right;
}

/* 入口页样式不在这里：入口页 slug 不匹配注册表关键词，本文件不会被加载，
   .research-entry-card 的样式写在 single-wos-calculator-research-calculators.php 里 */

/* ---------- 窄屏 ---------- */

@media (max-width: 991.98px) {
    .research-calculator-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .research-summary-sidebar {
        position: static;
    }

    .research-summary-panel {
        min-height: 0;
    }
}

@media (max-width: 575.98px) {
    #research-calculator-app {
        padding-right: 4px;
        padding-left: 4px;
    }

    #research-calculator-app > .footer-card {
        padding: 16px !important;
    }

    .research-section-heading {
        align-items: flex-start;
    }

    .research-section-heading h2,
    .research-inventory-panel h2,
    .research-status-panel h2 {
        font-size: 1.2rem;
    }

    .research-results-table th,
    .research-results-table td {
        padding: 10px 12px;
    }

    .research-panel-header {
        min-height: 64px;
        padding: 12px;
    }

    .research-buff-row,
    .research-buff-row-primary {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .research-buff-row label {
        grid-column: 1 / -1;
    }

    .research-buff-row .form-switch,
    .research-buff-sign {
        justify-self: start;
    }

    .research-buff-input,
    .research-fixed-bonus {
        justify-self: end;
        width: min(190px, 100%);
        padding-right: 0;
    }

    .research-search-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .research-search-row .form-control {
        grid-column: 1 / -1;
    }

    /* 窄屏阶数改成横向滚动条，网格让位给内容 */
    .research-browse {
        flex-direction: column;
    }

    .research-tier-rail {
        flex-direction: row;
        width: 100%;
        min-width: 0;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--research-border);
    }

    .research-tech-list {
        width: 100%;
        grid-template-columns: repeat(auto-fill, minmax(104px, 128px));
        max-height: 420px;
        padding: 10px;
    }

    .research-delta-label {
        min-width: 100%;
    }

    .research-status-label,
    .research-status-need,
    .research-status-have {
        min-width: auto;
    }

    .research-status-row {
        grid-template-columns: 24px minmax(0, 1fr) auto;
        gap: 8px 10px;
    }

    .research-status-need,
    .research-status-have {
        grid-column: 2 / -1;
    }

    .research-status-state {
        grid-column: 3;
        grid-row: 1;
    }

    .research-status-shortage {
        grid-column: 2 / -1;
        margin-top: 0;
    }
}

/* 系统里关了动效就别动 */
@media (prefers-reduced-motion: reduce) {
    .research-tech-card,
    .research-tech-thumb,
    .research-tech-thumb-box {
        transition: none;
    }

    .research-tech-card:hover,
    .research-tech-card:hover .research-tech-thumb {
        transform: none;
    }
}

/* RTL */
[dir="rtl"] .research-tech-check {
    right: auto;
    left: 6px;
}

[dir="rtl"] .research-tech-flag {
    left: auto;
    right: 6px;
}

[dir="rtl"] .research-results-table .col-resource {
    text-align: left;
}

[dir="rtl"] .research-results-table .col-index,
[dir="rtl"] .research-results-table .col-index-cell {
    right: 0;
    left: auto;
}

[dir="rtl"] .research-results-table .col-tech,
[dir="rtl"] .research-results-table .col-tech-cell {
    right: 54px;
    left: auto;
    text-align: right;
}

[dir="rtl"] .research-delta-value {
    text-align: left;
}

/* ---------- 最终卡片皮肤 ----------
 * 这些规则刻意放在文件末尾：上方保留了计算器原有的结构规则，末尾只收口参考图的视觉皮肤，
 * 避免旧规则在加载顺序上把浅色名称条和蓝色图标底板覆盖掉。
 */

#research-calculator-app .research-tech-list {
    grid-template-columns: repeat(auto-fill, 128px);
    align-content: start;
    justify-content: start;
    min-height: 340px;
    padding: 14px;
}

#research-calculator-app .research-tech-card,
#research-calculator-app .research-tech-card:hover,
#research-calculator-app .research-tech-card.is-selected {
    align-self: start;
    border-width: 2px;
    border-color: #d8e9ff;
    border-radius: 7px;
    background: #e6f2ff;
    color: #0d1831;
}

#research-calculator-app .research-tech-card:hover,
#research-calculator-app .research-tech-card.is-selected {
    border-color: #67c9ff;
    background: #e9f8ff;
}

#research-calculator-app .research-tech-thumb-box,
#research-calculator-app .research-tech-card.is-selected .research-tech-thumb-box {
    aspect-ratio: 1 / 0.92;
    background: linear-gradient(180deg, #45bae9 0%, #1999dc 100%);
}

#research-calculator-app .research-tech-band,
#research-calculator-app .research-tech-card.is-selected .research-tech-band {
    min-height: 42px;
    padding: 5px;
    background: #e8f4ff;
    color: #0d1831;
}

#research-calculator-app .research-tech-name {
    color: #0d1831;
    font-size: 0.72rem;
}

#research-calculator-app .research-tech-sub {
    color: #65708b !important;
    font-size: 0.64rem;
}

@media (max-width: 575.98px) {
    #research-calculator-app .research-tech-list {
        grid-template-columns: repeat(auto-fill, minmax(104px, 128px));
        padding: 10px;
    }
}
