/* ============================================================
   显存选型台 — 仪表盘配色，纯系统字体（国内网络无外部字体请求）
   ============================================================ */

:root {
  --bg: #0B0E14;
  --panel: #121724;
  --panel-2: #171E2E;
  --line: #232C41;
  --line-soft: #1A2233;

  --fg: #E7ECF6;
  --fg-dim: #8B96AE;
  --fg-faint: #5B657E;

  --a: #4FC3E8;          /* 机型 A */
  --b: #A98BFB;          /* 机型 B */
  --ok: #57D6A0;
  --warn: #F0A741;
  --bad: #FF6B7F;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --r: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #10151F 0%, var(--bg) 100%);
}
.masthead-inner {
  padding: 34px 24px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.masthead h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .04em;
}
.masthead-lede {
  margin: 0;
  max-width: 42ch;
  color: var(--fg-dim);
  font-size: 14px;
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 328px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 56px;
}
.controls { position: sticky; top: 20px; display: grid; gap: 14px; }
.results { display: grid; gap: 18px; min-width: 0; }

/* ---------- control blocks ---------- */
.ctl-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.ctl-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 500;
}
.ctl-title.as-summary { cursor: pointer; margin: 0; list-style: none; }
.ctl-title.as-summary::-webkit-details-marker { display: none; }
.ctl-title.as-summary::before {
  content: "▸"; display: inline-block; margin-right: 8px;
  color: var(--fg-faint); transition: transform .15s ease;
}
details[open] > .ctl-title.as-summary::before { transform: rotate(90deg); }
details[open] > .ctl-title.as-summary { margin-bottom: 12px; }

.field { display: block; margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--fg-dim); margin-bottom: 6px;
}
.field-label em {
  font-style: normal; font-family: var(--mono);
  font-size: 11px; color: var(--fg-faint);
}

.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
}
select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%),
                    linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.input:focus-visible, .range:focus-visible, .btn-ghost:focus-visible,
.preset:focus-visible, summary:focus-visible, th.sortable:focus-visible {
  outline: 2px solid var(--a); outline-offset: 2px;
}
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .input { flex: 1; }
.unit { font-size: 11px; color: var(--fg-faint); font-family: var(--mono); }

.presets { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.preset {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--fg-dim); border-radius: 5px;
  padding: 4px 9px; font-size: 11.5px; font-family: var(--mono);
  cursor: pointer;
}
.preset:hover:not(:disabled) { color: var(--fg); border-color: var(--fg-faint); }
.preset[aria-pressed="true"] { background: var(--a); border-color: var(--a); color: #061018; }
.preset:disabled { opacity: .32; cursor: not-allowed; }

.range { width: 100%; accent-color: var(--b); }

.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--fg-dim);
  border-radius: 5px; padding: 5px 10px; font-size: 12px;
  cursor: pointer; font-family: inherit; margin-top: 10px;
}
.btn-ghost:hover { color: var(--fg); border-color: var(--fg-faint); }

.specs { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; }
.specs dt { color: var(--fg-faint); }
.specs dd { margin: 0; font-family: var(--mono); color: var(--fg); text-align: right; }

.note { margin: 10px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--fg-faint); }

.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; color: var(--fg-faint); text-transform: none;
}

.arch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.arch-row label { flex: 1; font-size: 12px; color: var(--fg-dim); }
.arch-row input { width: 88px; }

/* ---------- verdict ---------- */
.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.v-card {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); padding: 14px 16px;
  border-left-width: 3px;
}
.v-card.a { border-left-color: var(--a); }
.v-card.b { border-left-color: var(--b); }
.v-name { font-size: 12px; color: var(--fg-dim); margin: 0 0 6px; }
.v-line { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.v-state { font-size: 19px; font-weight: 600; letter-spacing: .03em; }
.v-state.ok { color: var(--ok); }
.v-state.tight { color: var(--warn); }
.v-state.bad { color: var(--bad); }
.v-delta { font-family: var(--mono); font-size: 12.5px; color: var(--fg-dim); }

/* ---------- demand ---------- */
.demand {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px;
}
.demand-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.demand-total { margin: 0; display: flex; align-items: baseline; gap: 6px; }
#total-val { font-size: 42px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.gib { font-family: var(--mono); font-size: 13px; color: var(--fg-faint); }

.split { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin: 16px 0 12px; background: var(--line-soft); }
.split-w { background: var(--fg); }
.split-kv {
  background-color: #39435C;
  background-image: repeating-linear-gradient(-45deg, rgba(231,236,246,.35) 0 3px, transparent 3px 7px);
}

.breakdown { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.bd-item { border-left: 2px solid var(--line); padding-left: 10px; }
.bd-item dt { font-size: 11px; color: var(--fg-faint); font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.bd-item dd { margin: 2px 0 0; font-family: var(--mono); font-size: 15px; }
.bd-item dd small { font-size: 11px; color: var(--fg-faint); margin-left: 3px; }
.bd-item.w { border-left-color: var(--fg); }
.bd-item.kv { border-left-color: #39435C; }

/* ---------- rig（签名元件：显存槽位阵列） ---------- */
.rig {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px;
}
.rig-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rig-id { display: flex; align-items: center; gap: 10px; }
.rig-badge {
  width: 24px; height: 24px; border-radius: 5px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: #08101A;
}
.rig-a .rig-badge { background: var(--a); }
.rig-b .rig-badge { background: var(--b); }
.rig-name { margin: 0; font-size: 15.5px; font-weight: 600; }
.rig-sub { margin: 1px 0 0; font-size: 11.5px; color: var(--fg-faint); font-family: var(--mono); }
.rig-cap { text-align: right; font-family: var(--mono); }
.rig-cap b { font-size: 21px; font-weight: 600; }
.rig-cap span { display: block; font-size: 11px; color: var(--fg-faint); }

.slots { display: flex; gap: 5px; margin: 18px 0 10px; align-items: flex-end; }
.slot { flex: 1 1 0; min-width: 0; }
.slot-bar {
  position: relative; height: 74px; border-radius: 3px;
  background: var(--line-soft); border: 1px solid var(--line);
  overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
}
.slot-w { width: 100%; }
.slot-kv { width: 100%; }
.rig-a .slot-w { background: var(--a); }
.rig-b .slot-w { background: var(--b); }
.slot-kv { background-color: rgba(255,255,255,.14); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.22) 0 2px, transparent 2px 6px); }
.slot.over .slot-bar { border-color: var(--bad); }
.slot.over .slot-w, .slot.over .slot-kv { background: var(--bad); background-image: none; }
.slot-cap {
  margin: 5px 0 0; font-family: var(--mono); font-size: 10px;
  color: var(--fg-faint); text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.slot.builtin .slot-cap { color: var(--fg-dim); }

.rig-stats { display: flex; flex-wrap: wrap; gap: 18px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.rig-stat { font-size: 11.5px; color: var(--fg-faint); }
.rig-stat b { display: block; font-family: var(--mono); font-size: 14px; color: var(--fg); font-weight: 500; }
.rig-warn { margin: 10px 0 0; font-size: 11.5px; color: var(--warn); }

/* ---------- matrix ---------- */
.matrix, .method {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 20px;
}
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-faint); font-weight: 500;
  border-bottom-color: var(--line);
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--fg); }
th.num, td.num { text-align: right; font-family: var(--mono); }
tbody tr:hover { background: var(--panel-2); }
tr.current { background: rgba(79,195,232,.08); }
tr.current td:first-child { box-shadow: inset 2px 0 0 var(--a); }
.pill {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  padding: 1px 6px; border-radius: 4px; border: 1px solid;
}
.pill.ok { color: var(--ok); border-color: rgba(87,214,160,.4); }
.pill.tight { color: var(--warn); border-color: rgba(240,167,65,.4); }
.pill.bad { color: var(--bad); border-color: rgba(255,107,127,.4); }
.tier-mark { font-family: var(--mono); color: var(--fg-faint); }

/* ---------- method ---------- */
.method-body h3 { margin: 16px 0 4px; font-size: 12.5px; color: var(--fg); font-weight: 600; }
.method-body h3:first-child { margin-top: 0; }
.method-body p { margin: 0 0 6px; font-size: 12.5px; color: var(--fg-dim); line-height: 1.65; }
code { font-family: var(--mono); font-size: 11.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--fg); }

/* ---------- foot ---------- */
.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; }
.foot p { margin: 0; font-size: 11.5px; color: var(--fg-faint); }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .controls { position: static; }
  .verdict { grid-template-columns: 1fr; }
  .slot-bar { height: 60px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .masthead-inner { padding: 24px 16px 20px; }
  .masthead h1 { font-size: 24px; }
  #total-val { font-size: 34px; }
  .slots { gap: 3px; }
  .slot-cap { font-size: 9px; }
}

/* ---------- model picker ---------- */
.model-picker-trigger {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.model-picker-trigger:hover { border-color: var(--fg-faint); }
.selected-model-name { font-weight: 500; }
.selected-model-params {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}

.model-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0;
  max-width: 880px;
  width: calc(100vw - 48px);
  max-height: 85vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.model-dialog::backdrop {
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.model-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.model-dialog-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.dialog-close {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
}
.dialog-close:hover { background: var(--line-soft); color: var(--fg); }

.model-dialog-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 70px);
}

.model-tier-group {
  margin-bottom: 24px;
}
.model-tier-group:last-child { margin-bottom: 0; }
.model-tier-header {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 500;
}

.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.model-card {
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.model-card:hover {
  border-color: var(--fg-faint);
  transform: translateY(-2px);
}
.model-card.selected {
  border-color: var(--a);
  background: rgba(79,195,232,.06);
}

.model-card-name {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
}
.model-card-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.model-card-params {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.model-card-tier {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
}
.model-card-score {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--warn);
}

.model-card-specs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  font-size: 11px;
  margin-bottom: 10px;
}
.model-card-specs dt {
  color: var(--fg-faint);
}
.model-card-specs dd {
  margin: 0;
  font-family: var(--mono);
  color: var(--fg-dim);
  text-align: right;
}

.model-card-vram {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.model-card-vram-label {
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 4px;
}
.model-card-vram-val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--a);
}
.model-card-vram-val small {
  font-size: 11px;
  font-weight: 400;
  color: var(--fg-faint);
  margin-left: 3px;
}

@media (max-width: 560px) {
  .model-cards {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
