/*
 * LocalLLMBench. Identity: a memory module. Circuit-board green carries the
 * header and the module drawing, contact-finger gold marks the weights and the
 * primary action, and the neutrals are tinted green rather than grey.
 */
:root {
  color-scheme: light;
  --bg: #e6f0ea;
  --surface: #f6faf7;
  --sunk: #d7e5dc;
  --field: #ffffff;
  --ink: #16261f;
  --muted: #45584e;
  --rule: #bccfc3;
  --band: #0d4f3a;
  --band-ink: #eef6f1;
  --band-muted: #b9d4c6;
  --accent: #0b6b4b;
  --accent-ink: #ffffff;
  --gold: #d9a441;
  --gold-deep: #8a5d08;
  --pcb: #0b6b4b;
  --well: #06241a;
  --silk: #cfe6da;
  --seg-w: #d9a441;
  --seg-c: #6cc3b5;
  --seg-r: #a9bfd0;
  --seg-ink: #10221b;
  --fit: #17693c;
  --fit-bg: #cdeccf;
  --fit-on-band: #9ff0bd;
  --tight-on-band: #f6cf6e;
  --no-on-band: #ffb3a3;
  --tight: #8a5600;
  --tight-bg: #f8e7bd;
  --no: #a52f1a;
  --no-bg: #f7d9d0;
  --focus: #0b6b4b;
  --head: "Avenir Next", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c211a;
    --surface: #132e25;
    --sunk: #0a1612;
    --field: #0a1612;
    --ink: #e3efe6;
    --muted: #a0b8ab;
    --rule: #2b4d40;
    --band: #0a2e22;
    --band-ink: #e3efe6;
    --band-muted: #9fc0b0;
    --accent: #54d3a0;
    --accent-ink: #052018;
    --gold: #e2b04c;
    --gold-deep: #e2b04c;
    --pcb: #14694c;
    --well: #04140f;
    --silk: #cfe6da;
    --fit: #7fe0a6;
    --fit-bg: #123c29;
    --tight: #f2c463;
    --tight-bg: #3d3112;
    --no: #ffa390;
    --no-bg: #47211a;
    --focus: #54d3a0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c211a;
  --surface: #132e25;
  --sunk: #0a1612;
  --field: #0a1612;
  --ink: #e3efe6;
  --muted: #a0b8ab;
  --rule: #2b4d40;
  --band: #0a2e22;
  --band-ink: #e3efe6;
  --band-muted: #9fc0b0;
  --accent: #54d3a0;
  --accent-ink: #052018;
  --gold: #e2b04c;
  --gold-deep: #e2b04c;
  --pcb: #14694c;
  --well: #04140f;
  --silk: #cfe6da;
  --fit: #7fe0a6;
  --fit-bg: #123c29;
  --tight: #f2c463;
  --tight-bg: #3d3112;
  --no: #ffa390;
  --no-bg: #47211a;
  --focus: #54d3a0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--body);
}
[hidden] { display: none !important; }
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1 0 auto; width: 100%; min-width: 0; }
body > aside.wrap { width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 16px; }
a { color: var(--accent); text-underline-offset: 3px; }
b, strong { font-weight: 650; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.band :focus-visible { outline-color: var(--gold); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--gold); color: #10221b; padding: 10px 14px; z-index: 20; font-weight: 600; border-radius: 4px; }
.skip:focus { top: 8px; }

/* ---- header band ---- */
.band { background: var(--band); color: var(--band-ink); border-bottom: 4px solid var(--gold); }
.band-in { display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--band-ink); text-decoration: none; min-height: 44px; }
.wordmark { font: 600 1.3rem/1 var(--head); letter-spacing: -0.02em; }
.wordmark b { font-weight: 700; color: var(--gold); }
.mk-body { fill: var(--band-ink); }
.mk-pin { fill: var(--gold); }
.mk-well { fill: #06241a; }
.mk-a { fill: #d9a441; }
.mk-b { fill: #6cc3b5; }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--band-ink); text-decoration: none; font-size: 0.95rem; padding: 0 2px; min-height: 44px; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--gold); }
.theme-btn { background: transparent; color: var(--band-muted); border: 1px solid #ffffff40; border-radius: 4px; font: inherit; font-size: 0.85rem; min-height: 44px; padding: 4px 12px; cursor: pointer; }
.theme-btn:hover { color: var(--band-ink); border-color: var(--gold); }
@media (max-width: 719px) {
  .nav { order: 3; width: 100%; margin-left: 0; gap: 0 14px; justify-content: space-between; }
  .nav a { font-size: 0.9rem; }
  .band-in { padding-bottom: 4px; }
  .theme-btn { margin-left: auto; }
}

/* ---- hero ---- */
.hero { padding-top: 40px; padding-bottom: 24px; }
.lede { font-size: 1.12rem; max-width: 68ch; margin: 16px 0 0; color: var(--muted); }
@media (max-width: 719px) { .hero { padding-top: 24px; padding-bottom: 16px; } .lede { font-size: 1.02rem; } }

/* ---- calculator layout ---- */
.calc { display: grid; gap: 24px; align-items: start; padding-bottom: 56px; }
@media (min-width: 940px) {
  .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 40px; }
  .result { position: sticky; top: 16px; }
}
.inputs { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 24px; }
.inputs h2 { margin-bottom: 20px; font-size: 1.35rem; }
@media (max-width: 719px) { .inputs { padding: 16px; } }

.field { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; }
label, legend { display: block; font-weight: 600; font-size: 0.98rem; margin-bottom: 6px; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
input[type="number"], input[type="text"], input[type="date"], select {
  width: 100%; min-height: 46px; padding: 8px 12px;
  background: var(--field); color: var(--ink);
  border: 1.5px solid var(--rule); border-radius: 4px;
  font: inherit; font-size: 1rem;
}
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input:hover, select:hover { border-color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--no); }
.unit-input { display: flex; align-items: stretch; }
.unit-input input { border-radius: 4px 0 0 4px; min-width: 0; flex: 1 1 96px; }
.unit-input .unit { display: flex; align-items: center; padding: 0 12px; background: var(--sunk); border: 1.5px solid var(--rule); border-left: 0; border-radius: 0 4px 4px 0; color: var(--muted); font-size: 0.88rem; line-height: 1.2; }
.unit-input.narrow { max-width: 150px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.two .wide { grid-column: 1 / -1; }
.three { display: grid; gap: 14px 16px; }
.four { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (min-width: 560px) { .four { grid-template-columns: repeat(4, 1fr); } }
.three label, .four label { font-weight: 500; font-size: 0.92rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { min-width: 46px; min-height: 44px; padding: 4px 10px; background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; font: 0.9rem var(--mono); cursor: pointer; transition: background-color .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.seg { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 10px; border: 1.5px solid var(--rule); border-radius: 4px; overflow: hidden; }
.seg label { margin: 0; font-weight: 500; font-size: 0.92rem; cursor: pointer; position: relative; display: flex; }
.seg label span { flex: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px; padding: 6px 8px; line-height: 1.2; }
.seg label + label span { border-left: 1.5px solid var(--rule); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.help { font-size: 0.9rem; color: var(--muted); margin: 8px 0 0; }
.err { font-size: 0.9rem; color: var(--no); margin: 6px 0 0; min-height: 0; font-weight: 500; }
.err:empty { display: none; }
.note { font-size: 0.92rem; color: var(--muted); max-width: 75ch; }

.allow { border-top: 1px solid var(--rule); padding-top: 20px; margin-bottom: 12px; }
.allow > .help { margin: 0 0 14px; }
.kv { margin-top: 18px; border: 1px solid var(--rule); border-radius: 4px; padding: 0 14px; background: var(--bg); }
.kv[open] { padding-bottom: 14px; }
summary { cursor: pointer; font-weight: 600; padding: 12px 0; font-size: 0.95rem; min-height: 44px; }
.kv .help { margin: 0 0 12px; }
.kv-out { margin: 14px 0 0; font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.kv-out span { font-family: var(--mono); font-size: 0.9rem; }
.form-foot { margin: 0; font-size: 0.9rem; }

.btn { min-height: 44px; padding: 8px 16px; background: var(--surface); color: var(--ink); border: 1.5px solid var(--rule); border-radius: 4px; font: inherit; font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 0.9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; min-width: 44px; }
.link.quiet { color: var(--muted); }
.link.quiet:hover { color: var(--no); }

/* ---- result ---- */
.result { min-width: 0; }
.verdict { border-radius: 6px 6px 0 0; padding: 20px 24px; border-left: 10px solid; transition: background-color .2s, border-color .2s; min-height: 168px; }
.v-fit { background: var(--fit-bg); border-color: var(--fit); }
.v-tight { background: var(--tight-bg); border-color: var(--tight); }
.v-no { background: var(--no-bg); border-color: var(--no); }
.v-kicker { margin: 0 0 4px; font-size: 0.92rem; color: var(--muted); }
.v-word { margin: 0; font: 700 clamp(2.2rem, 6vw, 3.1rem)/1.05 var(--head); letter-spacing: -0.02em; }
.v-fit .v-word { color: var(--fit); }
.v-tight .v-word { color: var(--tight); }
.v-no .v-word { color: var(--no); }
.v-line { margin: 10px 0 0; font-size: 1.05rem; }
.v-line b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.v-line b:first-of-type { font-size: 2rem; font-weight: 700; }
@media (max-width: 719px) { .verdict { padding: 16px; min-height: 0; } }

.module { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-top: 0; padding: 16px 16px 12px; }
#membar { display: block; width: 100%; height: 150px; }
.pcb { fill: var(--pcb); }
.well { fill: var(--well); }
.pins-static, .pin { fill: var(--gold); }
.cut { fill: var(--surface); }
.s-w { fill: var(--seg-w); background: var(--seg-w); }
.s-c { fill: var(--seg-c); background: var(--seg-c); }
.s-r { fill: var(--seg-r); background: var(--seg-r); }
.s-res { fill: #6f8579; background: #6f8579; }
.s-over { fill: var(--no); fill-opacity: .28; stroke: var(--no); stroke-width: 2; stroke-dasharray: 5 4; }
#membar rect { transition: width .2s ease, x .2s ease; }
.seg-t { font: 600 12px var(--body); fill: var(--seg-ink); text-anchor: middle; pointer-events: none; }
.seg-t.lt { fill: #f2f6ee; }
.silk { font: 600 12px var(--mono); fill: var(--silk); letter-spacing: .08em; }
.ax { font: 12px var(--mono); fill: var(--muted); text-anchor: middle; }
.ax-strong { font: 700 12px var(--mono); fill: var(--ink); text-anchor: middle; }
.ax-over { font: 700 12px var(--mono); fill: var(--no); text-anchor: end; }
.tick { stroke: var(--muted); stroke-width: 1; }
.tightline { stroke: var(--gold); stroke-width: 2; stroke-dasharray: 4 3; }

.legend, .key, .hints { list-style: none; margin: 0; padding: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.92rem; margin-top: 4px; }
.legend b { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }

.sums { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-top: 0; }
.sums th, .sums td { padding: 10px 16px; border-top: 1px solid var(--rule); text-align: left; font-weight: 400; }
.sums td { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.sums tr:first-child th, .sums tr:first-child td { border-top: 0; }
.sums .neg { color: var(--no); }

.hints { background: var(--surface); border: 1px solid var(--rule); border-top: 0; padding: 14px 16px; font-size: 0.97rem; min-height: 84px; }
.hints li { padding-left: 16px; position: relative; margin-bottom: 6px; }
.hints li:last-child { margin-bottom: 0; }
.hints li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; background: var(--gold); }
.hints b { font-family: var(--mono); font-weight: 600; }

.how { background: var(--surface); border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 6px 6px; padding: 0 16px; }
.how[open] { padding-bottom: 16px; }
.how p { margin: 0 0 12px; }
.f { font-family: var(--mono); font-size: 0.9rem; }
.f + br + .f { color: var(--accent); font-weight: 600; }

/* ---- sections ---- */
.block { padding-top: 56px; padding-bottom: 56px; border-top: 1px solid var(--rule); }
.block-head { margin-bottom: 20px; }
.block-head .sub { color: var(--muted); max-width: 72ch; margin: 10px 0 0; }

/* ---- matrix ---- */
.mx-tools { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.inline-field label { font-size: 0.9rem; font-weight: 500; }
.key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.92rem; }
.k-fit { background: var(--fit); } .k-tight { background: var(--tight); } .k-no { background: var(--no); }
.scroller { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.mx { width: 100%; min-width: 600px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.mx th { font: 600 0.9rem var(--mono); padding: 12px 8px; text-align: center; background: var(--sunk); }
.mx thead th { border-bottom: 1px solid var(--rule); }
.mx thead th small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }
.mx tbody th small { display: block; font: 400 0.76rem var(--body); color: var(--muted); }
.mx tbody th { position: sticky; left: 0; z-index: 1; width: 84px; border-right: 1px solid var(--rule); font-family: var(--head); font-size: 1rem; }
.mx thead th:first-child { width: 84px; position: sticky; left: 0; z-index: 2; border-right: 1px solid var(--rule); }
.mx td { padding: 3px; height: 64px; }
.mx-wait { background: var(--sunk); opacity: .5; }
.cell { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 58px; border: 2px solid transparent; border-radius: 3px; cursor: pointer; font: 600 1.02rem var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); transition: background-color .2s, border-color .15s; }
.cell small { font: 500 0.78rem var(--body); margin-top: 1px; }
.cell.c-fit { background: var(--fit-bg); } .cell.c-fit small { color: var(--fit); }
.cell.c-tight { background: var(--tight-bg); } .cell.c-tight small { color: var(--tight); }
.cell.c-no { background: var(--no-bg); } .cell.c-no small { color: var(--no); }
.cell:hover { border-color: var(--muted); }
.cell[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.scroll-cue { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.mx-tools + .err { margin: 0 0 8px; }
#matrix .note { margin: 12px 0 0; }

/* ---- log ---- */
.logform { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 20px 24px; margin-bottom: 28px; }
.logform h3 { margin-bottom: 14px; }
.lg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; align-items: end; }
.lg-grid .g-wide, .lg-grid .g-full { grid-column: 1 / -1; }
.lg-grid label { font-size: 0.92rem; }
@media (min-width: 860px) {
  .lg-grid { grid-template-columns: repeat(5, 1fr); }
  .lg-grid .g-wide { grid-column: span 2; }
  .lg-grid .g-wide + .g-wide { grid-column: span 3; }
  .lg-grid .g-full { grid-column: 1 / -1; }
}
@media (max-width: 719px) { .logform { padding: 16px; } }
.lg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.log-bar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.count { margin: 0; font-weight: 600; }
.io { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.io .link { margin-left: 8px; }
.sort-mobile { display: none; }
.sort-mobile select { min-height: 44px; width: auto; }
.status { min-height: 28px; margin: 0 0 8px; font-size: 0.95rem; color: var(--muted); }
.status .link { margin-left: 8px; font-weight: 600; }
.status.bad { color: var(--no); }
.log { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.log th, .log td { padding: 12px; text-align: left; border-top: 1px solid var(--rule); vertical-align: top; }
.log thead th { background: var(--sunk); border-top: 0; font-size: 0.88rem; white-space: nowrap; position: sticky; top: 0; padding: 4px 12px; vertical-align: middle; }
.log .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.log td.num { white-space: nowrap; }
.log td.big { font-weight: 700; font-size: 1.02rem; }
.log td { overflow-wrap: anywhere; }
.log td:first-child, .log td:nth-child(4), .log td:last-child { white-space: nowrap; overflow-wrap: normal; }
.sort { background: none; border: 0; padding: 0; min-height: 44px; min-width: 44px; text-align: left; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.sort::after { content: " ↕"; color: var(--muted); font-weight: 400; }
th[aria-sort="ascending"] .sort::after { content: " ↑"; color: var(--accent); }
th[aria-sort="descending"] .sort::after { content: " ↓"; color: var(--accent); }
.rowact { display: flex; gap: 12px; white-space: nowrap; }
.example td { color: var(--muted); font-style: italic; }
.tag { display: inline-block; white-space: nowrap; font-style: normal; font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border: 1px solid var(--gold-deep); color: var(--gold-deep); border-radius: 3px; }
.editing td { background: var(--tight-bg); }
#log-example-note { margin-top: 10px; }

@media (max-width: 759px) {
  .sort-mobile { display: block; }
  .log-scroll { border: 0; background: none; overflow: visible; }
  .log thead .sort { visibility: hidden; }
  .log thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .log, .log tbody, .log tr, .log td { display: block; }
  .log tr { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 14px; margin-bottom: 12px; }
  .log td { border: 0; padding: 5px 0; display: grid; grid-template-columns: 118px 1fr; gap: 10px; text-align: left; }
  .log td.num { text-align: left; }
  .log td::before { content: attr(data-label); color: var(--muted); font: 400 0.85rem var(--body); font-style: normal; }
  .log td:last-child { display: block; padding-top: 8px; }
  .log td:last-child::before { content: none; }
  .log td:empty { display: none; }
}

/* ---- guide ---- */
.guide h2 { margin-bottom: 8px; }
@media (min-width: 1040px) {
  .guide { display: grid; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 56px; align-items: start; }
  .guide h2 { grid-column: 1 / -1; }
  .guide .faq { margin-top: 36px; position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--gold); border-radius: 6px; padding: 20px 24px 8px; }
  .guide .faq details:last-child { border-bottom: 0; }
}
.prose { max-width: 70ch; }
.prose h3 { margin: 36px 0 10px; font-size: 1.3rem; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.formula { font-family: var(--mono); font-size: 0.95rem; background: var(--surface); border-left: 4px solid var(--gold); padding: 12px 16px; overflow-wrap: anywhere; }
.gloss { display: grid; grid-template-columns: 1fr; gap: 2px 20px; margin: 0; }
.gloss dt { font-weight: 650; font-family: var(--head); }
.gloss dd { margin: 0 0 10px; color: var(--muted); }
@media (min-width: 620px) { .gloss { grid-template-columns: 170px 1fr; } .gloss dd { margin-bottom: 8px; } }
.faq { max-width: 70ch; margin-top: 44px; }
.faq h3 { font-size: 1.3rem; margin-bottom: 12px; }
.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { padding: 14px 0; font-size: 1.02rem; }
.faq p { margin: 0 0 16px; color: var(--muted); }

/* ---- result bar ---- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 12px; min-height: 56px; max-height: 64px; padding: 6px 16px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--band); color: var(--band-ink); border-top: 4px solid var(--gold); }
.dock-text { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; min-width: 0; line-height: 1.2; }
.dock-word { font: 700 1.05rem var(--head); color: var(--fit-on-band); white-space: nowrap; }
.dock.d-tight .dock-word { color: var(--tight-on-band); }
.dock.d-no .dock-word { color: var(--no-on-band); }
.dock-line { font-size: 0.95rem; white-space: nowrap; }
.dock-line b { font: 700 1.3rem var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--band-ink); }
.dock-go { margin-left: auto; flex: none; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 4px; color: var(--band-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 0.95rem; }
.dock[data-typing] { top: 0; bottom: auto; border-top: 0; border-bottom: 4px solid var(--gold); padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
body.has-dock { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 360px) { .dock { gap: 8px; padding-left: 12px; padding-right: 12px; } .dock-line { font-size: 0.85rem; } .dock-line b { font-size: 1.25rem; } }

/* ---- footer ---- */
.foot { background: var(--band); color: var(--band-muted); padding: 32px 0; font-size: 0.92rem; }
.foot p { max-width: 80ch; margin: 0 0 10px; }
.foot b { color: var(--band-ink); }
.totop { color: var(--band-ink); display: inline-block; padding: 12px 0; }
.guide-more, .log-more { margin: 0; }
section[id], article[id] { scroll-margin-top: 12px; }

/* ---- model picker, memory groups, sizes table ---- */
.sub-label { margin-top: 14px; font-weight: 500; font-size: 0.92rem; }
#in-model-help a { white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; }
#model-note { color: var(--ink); }
.chip-label { display: inline-flex; align-items: center; min-width: 52px; font-size: 0.88rem; color: var(--muted); }
.guide-lead { margin: 10px 0 0; color: var(--muted); }
.msizes-wrap { margin: 0 0 16px; }
.msizes { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.msizes th, .msizes td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--rule); vertical-align: top; }
.msizes thead th { background: var(--sunk); border-top: 0; font-size: 0.88rem; }
.msizes .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mnote { display: block; color: var(--muted); font-size: 0.85rem; }
.more-tools { padding-top: 8px; padding-bottom: 40px; }
.more-tools h2 { border-top: 1px solid var(--rule); padding-top: 28px; }
.more-tools h2 { font-size: 1.2rem; margin-bottom: 10px; }
.more-tools ul { list-style: none; margin: 0; padding: 0; max-width: 72ch; }
.more-tools li { padding: 6px 0; }
.more-tools a { font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }
.more-tools li span { display: block; color: var(--muted); }
.article .prose { max-width: 70ch; }
.article .byline { color: var(--muted); font-size: 0.92rem; margin: 8px 0 0; }
.worked { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 8px 0 16px; }
.worked th, .worked td { padding: 8px 10px; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
.worked th.num { text-align: right; }
.worked td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.worked tfoot th, .worked tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
@media (max-width: 600px) {
  .worked { font-size: 0.9rem; }
  .worked th, .worked td { padding: 8px 6px; }
  .worked td.num { white-space: normal; overflow-wrap: anywhere; }
}
.answer { background: var(--surface); border-left: 6px solid var(--gold); padding: 14px 18px; margin: 20px 0; border-radius: 0 4px 4px 0; }
.answer p:last-child { margin-bottom: 0; }

/* ---- text pages, footer links, ad slots ---- */
.page { padding-top: 40px; padding-bottom: 64px; }
.page .lede { margin-bottom: 8px; }
.prose a, .page a { overflow-wrap: anywhere; }
.page .prose h2 { font-size: 1.35rem; margin: 36px 0 10px; }
.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
.wipe { margin: 20px 0 8px; padding: 16px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: 4px; }
.wipe-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.wipe-confirm > span { flex: 1 1 100%; }
.wipe .status { margin: 8px 0 0; min-height: 0; }
.wipe .status:empty { display: none; }
.foot a { color: var(--band-ink); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 6px 0 2px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
.copy { margin: 0; }
.ad { margin-top: 8px; margin-bottom: 40px; }
.ad-label { margin: 0 0 6px; font-size: 0.78rem; color: var(--muted); }
.ad-box { min-height: 120px; overflow: hidden; background: var(--sunk); border: 1px solid var(--rule); border-radius: 4px; }
@media (max-width: 600px) { .ad-box { min-height: 280px; } }

/* ---- phones: touch targets, type and length ---- */
@media (max-width: 600px) {
  .chip { min-width: 44px; min-height: 44px; }
  .theme-btn, .btn.small, .sort-mobile select { min-height: 44px; }
  .nav { gap: 0 8px; }
  .nav a { min-height: 44px; min-width: 44px; justify-content: center; display: inline-flex; align-items: center; padding: 0 2px; }
  summary { min-height: 44px; display: list-item; padding: 11px 0; }
  .link { min-height: 44px; min-width: 44px; }
  .help .link, .status .link, .form-foot .link { padding: 0 4px; }
  .rowact { gap: 20px; }
  .io { gap: 8px; }
  .io .link { margin-left: 4px; }
  .faq details + details { margin-top: 0; }

  /* fit matrix: fits a 375px screen without sideways scroll */
  .mx { min-width: 340px; }
  .mx thead th:first-child, .mx tbody th { width: 46px; padding: 8px 2px; }
  .mx th { padding: 8px 0; font-size: 0.75rem; letter-spacing: -0.03em; }
  .mx tbody th { font-size: 0.95rem; letter-spacing: 0; }
  .mx thead th small, .mx tbody th small, .cell small { font-size: 0.75rem; letter-spacing: 0; }
  .mx .bits-word { display: none; }
  .mx td { padding: 2px; height: 60px; }
  .cell { height: 56px; font-size: 0.8rem; letter-spacing: -0.03em; border-width: 2px; padding: 0; }
  .cell small { letter-spacing: 0; }

  .guide-more { margin-top: 8px; }
  .prose.clamp > *:nth-child(n+3) { display: none; }
  .log tr.more { display: none; }
  .log-more { margin: 4px 0 12px; }
  .block { padding-top: 40px; padding-bottom: 40px; }
  .calc { padding-bottom: 40px; }
}
@media (min-width: 601px) { #guide-toggle, #log-more, .guide-more, .log-more { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #e6f0ea;
    --surface: #f6faf7;
    --sunk: #d7e5dc;
    --field: #ffffff;
    --ink: #16261f;
    --muted: #45584e;
    --rule: #bccfc3;
    --band: #0d4f3a;
    --band-ink: #eef6f1;
    --band-muted: #b9d4c6;
    --accent: #0b6b4b;
    --accent-ink: #ffffff;
    --gold: #d9a441;
    --gold-deep: #8a5d08;
    --pcb: #0b6b4b;
    --well: #06241a;
    --silk: #cfe6da;
    --seg-w: #d9a441;
    --seg-c: #6cc3b5;
    --seg-r: #a9bfd0;
    --seg-ink: #10221b;
    --fit: #17693c;
    --fit-bg: #cdeccf;
    --tight: #8a5600;
    --tight-bg: #f8e7bd;
    --no: #a52f1a;
    --no-bg: #f7d9d0;
    --focus: #0b6b4b;
  }
  #membar { height: auto; }
  .prose.clamp > * { display: revert !important; }
  .log tr.more { display: revert !important; }
  #guide-toggle, #log-more, .totop { display: none !important; }
  .band .nav, .theme-btn, .dock, .skip, .ad, .foot-links, .wipe, .more-tools, .chips, .form-foot, .logform, .io, .sort-mobile, .rowact, .scroll-cue, .kv, #log-status { display: none !important; }
  body { background: #fff; color: #000; padding-bottom: 0; font-size: 11pt; display: block; min-height: 0; }
  .band, .foot { background: #fff; color: #000; border-color: #000; }
  .band *, .foot * { color: #000 !important; }
  .calc { display: block; }
  .result { position: static; margin-top: 16px; }
  .block { padding-top: 20px; padding-bottom: 20px; }
  .scroller { overflow: visible; }
  .mx { min-width: 0; }
  .guide { display: block; }
  .guide .faq { position: static; }
  details > *:not(summary) { display: block; }
  .verdict, .cell, .module, .mx th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .verdict, .module, .mx tr, .log tr, .faq details { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
}
