/*
  Direction: a silicon wafer and chip package. Cool grey page, graphite header and
  chart panel with a thin die grid, copper as the single accent for the visitor's own cards.
*/

:root {
  color-scheme: light;
  --bg: #eceef0;
  --surface: #f8f9fa;
  --field: #ffffff;
  --ink: #16191d;
  --muted: #535b64;
  --rule: #d3d7dc;
  --rule-strong: #9aa2ab;
  --tint: #dde1e6;
  --tint-ink: #16191d;
  --band: #1b1e22;
  --band-ink: #eef0f2;
  --band-line: #6c747d;
  --accent: #a4551f;
  --accent-ink: #ffffff;
  --accent-soft: #f2e2d5;
  --pcb: #1b1e22;
  --pcb-ink: #e6e9ec;
  --pcb-edge: #1b1e22;
  --copper: #d98a4e;
  --err: #a3200f;
  --focus: #a4551f;
  --sans: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Avenir Next", "Helvetica Neue", ui-sans-serif, system-ui, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14171b;
    --surface: #1c2026;
    --field: #12151a;
    --ink: #e6e9ec;
    --muted: #a0a8b1;
    --rule: #2c323a;
    --rule-strong: #56606b;
    --tint: #232931;
    --tint-ink: #e6e9ec;
    --band: #0c0e11;
    --band-ink: #e6e9ec;
    --band-line: #56606b;
    --accent: #e09458;
    --accent-ink: #1a0f06;
    --accent-soft: #35271b;
    --pcb: #0c0e11;
    --pcb-ink: #e6e9ec;
    --pcb-edge: #2c323a;
    --copper: #e09458;
    --err: #ff9c8c;
    --focus: #e09458;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171b;
  --surface: #1c2026;
  --field: #12151a;
  --ink: #e6e9ec;
  --muted: #a0a8b1;
  --rule: #2c323a;
  --rule-strong: #56606b;
  --tint: #232931;
  --tint-ink: #e6e9ec;
  --band: #0c0e11;
  --band-ink: #e6e9ec;
  --band-line: #56606b;
  --accent: #e09458;
  --accent-ink: #1a0f06;
  --accent-soft: #35271b;
  --pcb: #0c0e11;
  --pcb-ink: #e6e9ec;
  --pcb-edge: #2c323a;
  --copper: #e09458;
  --err: #ff9c8c;
  --focus: #e09458;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; scroll-padding-bottom: 12px; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 4px;
}
.skip:focus { top: 8px; }

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

a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 1500px) {
  .wrap, .band-in { max-width: 1360px; }
  .bench { grid-template-columns: 480px minmax(0, 1fr) !important; column-gap: 56px !important; }
  .lead { grid-template-columns: minmax(0, 1fr) 280px; }
  .wafer { max-width: 270px; }
}

/* ---------- header band ---------- */
.band {
  position: relative; color: var(--band-ink); padding-bottom: 7px;
  background-color: var(--band);
  /* die grid etched into the package top */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M24 0H0V24' fill='none' stroke='%23ffffff' stroke-opacity='.06'/%3E%3C/svg%3E");
}
/* lead frame: a row of copper pins along the package edge */
.band::after, .foot::before {
  content: ""; position: absolute; left: 0; right: 0; height: 7px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='7'%3E%3Crect x='3' y='0' width='8' height='7' rx='1' fill='%23c8733a'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
}
.band::after { bottom: 0; }
.band-in {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 44px; }
.logo-pin { fill: var(--copper); }
.logo-body { fill: var(--band-ink); }
.logo-mark { fill: none; stroke: var(--band); stroke-width: 2.2; stroke-linecap: round; }
.wordmark { font-family: var(--display); font-size: 1.3rem; font-weight: 400; letter-spacing: -0.02em; }
.wordmark b { font-weight: 700; }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-left: auto; }
.nav a { white-space: nowrap; color: var(--band-ink); text-decoration: none; font-size: 1rem; padding: 10px 2px; border-bottom: 2px solid transparent; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.nav a:hover { border-bottom-color: var(--copper); }
.theme-btn {
  font: inherit; font-size: .95rem; color: var(--band-ink); background: transparent;
  border: 1.5px solid var(--band-line); border-radius: 4px; min-height: 44px; min-width: 44px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.theme-btn:hover { border-color: var(--copper); }

/* ---------- lead ---------- */
.lead { padding: 32px 0 28px; display: grid; gap: 24px; align-items: center; }
.lead-text { max-width: 52rem; }
.free-note { margin-top: 10px; font-size: .95rem; color: var(--muted); }
.wafer-fig { display: none; margin: 0; text-align: center; }
.wafer { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto; }
.wafer-disc { fill: var(--surface); stroke: var(--copper); stroke-opacity: .7; stroke-width: 2; }
.die { fill: var(--tint); stroke: var(--rule); stroke-width: .8; transition: fill .2s; }
.die-on { fill: var(--copper); stroke: var(--accent); }
.wafer-cap { margin-top: 8px; font-size: .9rem; color: var(--muted); }
@media (min-width: 900px) {
  .lead { grid-template-columns: minmax(0, 1fr) 240px; }
  .wafer-fig { display: block; }
}
h1 { font-size: clamp(2rem, 3.6vw + .6rem, 2.75rem); font-weight: 700; letter-spacing: -0.025em; }
.intro { margin-top: 12px; font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.notice { margin-top: 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: 4px; }

/* ---------- bench layout ---------- */
.bench { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); }
.results { order: -1; }
.results, .inputs, .ranking { min-width: 0; }
.inputs { display: grid; gap: 24px; align-content: start; }

@media (min-width: 1100px) {
  .bench {
    grid-template-columns: 470px minmax(0, 1fr);
    grid-template-areas: "inputs results" "inputs ranking";
    column-gap: 40px;
  }
  .results { grid-area: results; order: 0; }
  .ranking { grid-area: ranking; }
  .inputs { grid-area: inputs; align-self: start; }
}

h2 { font-size: 1.45rem; font-weight: 700; }
.sub { color: var(--muted); font-size: 1rem; margin-top: 6px; max-width: 44rem; }

/* ---------- panels and forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 20px; }
#add-card { border-top: 4px solid var(--accent); }
.inputs .panel:not(#add-card) { border-top: 4px solid var(--band); }
.panel form { margin-top: 16px; display: grid; gap: 14px; }
.field { min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
label { display: block; font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type="text"], input[type="number"], select {
  width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; font-size: 1rem;
  color: var(--ink); background: var(--field); border: 1.5px solid var(--rule-strong); border-radius: 4px;
  transition: border-color .15s;
}
input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input::placeholder { color: var(--muted); opacity: .75; font-family: var(--sans); font-size: .92rem; }
input:hover, select:hover { border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--err); }
.with-unit { display: flex; align-items: stretch; border: 1.5px solid var(--rule-strong); border-radius: 4px; background: var(--field); transition: border-color .15s; }
.with-unit:hover { border-color: var(--ink); }
.with-unit:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.with-unit:has(input[aria-invalid="true"]) { border-color: var(--err); }
.with-unit input { border: 0; background: transparent; min-width: 0; flex: 1; outline: none; }
.with-unit .unit { display: flex; align-items: center; padding: 0 10px; color: var(--muted); font-size: .92rem; white-space: nowrap; }
.with-unit .unit:first-child { padding-right: 0; }
.with-unit .unit:last-child { padding-left: 0; }
.err { color: var(--err); font-size: .9rem; margin-top: 4px; }
.help { color: var(--muted); font-size: .9rem; margin-top: -6px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-status { font-size: .95rem; color: var(--tint-ink); min-height: 1.4em; }

.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 18px; border-radius: 4px; cursor: pointer;
  border: 1.5px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); flex: 1; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-plain { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: var(--tint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn {
  min-height: 44px;
  font: inherit; font-size: .95rem; color: var(--accent); background: none; border: 0; padding: 10px 0;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: start; text-align: left;
}
.link-btn.quiet { color: var(--muted); }

/* ---------- result panel ---------- */
.result-panel { background: var(--tint); color: var(--tint-ink); border-radius: 6px; padding: 20px 24px; border-left: 6px solid var(--band); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 32px; }
.stat-label { font-size: 1rem; font-weight: 600; }
.stat-num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(2rem, 3vw + 1rem, 2.7rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; }
.stat-unit { font-family: var(--sans); font-size: 1rem; font-weight: 400; letter-spacing: 0; }
.stat-name { font-size: 1rem; min-height: 1.5em; overflow-wrap: anywhere; }
.sum-line { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule-strong); font-size: 1rem; min-height: 3.4em; }
.how { margin-top: 8px; }
.how summary { cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: "+"; font-family: var(--mono); font-size: 1.2rem; width: 1ch; }
.how[open] summary::before { content: "\2212"; }
.how-body { display: grid; gap: 6px; padding-bottom: 6px; }
.formula { font-family: var(--mono); font-size: .92rem; overflow-wrap: anywhere; }
.worked { margin-top: 8px; font-size: .98rem; }
.worked:empty { display: none; }

/* ---------- chart ---------- */
.chart-fig { margin: 28px 0 0; }
.chart-box {
  margin-top: 14px; background: var(--pcb); border: 1px solid var(--pcb-edge); border-radius: 6px; width: 100%;
  aspect-ratio: 5 / 3; min-height: 260px; max-height: 420px; overflow: hidden;
}
.chart { display: block; width: 100%; height: 100%; }
.pin1 { fill: var(--copper); }
.die-line { fill: none; stroke: var(--pcb-ink); stroke-opacity: .07; stroke-width: 1; }
.pcb-grid { stroke: var(--pcb-ink); stroke-opacity: .3; stroke-width: 1; stroke-dasharray: 2 6; }
.pcb-axis { fill: none; stroke: var(--pcb-ink); stroke-opacity: .75; stroke-width: 1.5; }
.pcb-tick { fill: var(--pcb-ink); fill-opacity: .82; font-family: var(--mono); font-size: 12px; }
.pcb-title { fill: var(--pcb-ink); font-family: var(--sans); font-size: 13px; font-weight: 600; }
.pcb-better { fill: none; stroke: var(--pcb-ink); stroke-opacity: .75; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.trace { fill: none; stroke: var(--copper); stroke-opacity: .6; stroke-width: 1.5; }
.trace-end { fill: var(--copper); }
.via { fill: var(--copper); stroke: var(--pcb); stroke-width: 2; }
.via-hole { fill: var(--pcb); }
.pad { fill: var(--pcb); stroke: var(--pcb-ink); stroke-opacity: .8; stroke-width: 1.5; }
.pt-best { fill: none; stroke: var(--pcb-ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.lbl-mine { fill: #fff; font-family: var(--sans); font-size: 13px; font-weight: 700; paint-order: stroke; stroke: var(--pcb); stroke-width: 3px; }
.lbl-ex { fill: var(--pcb-ink); fill-opacity: .85; font-family: var(--mono); font-size: 12px; }
.legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .95rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { background: var(--pcb); border-radius: 3px; }
.lg-mine { fill: var(--copper); }
.lg-hole { fill: var(--pcb); }
.lg-ex { fill: none; stroke: var(--pcb-ink); stroke-width: 1.5; }
.lg-best { fill: none; stroke: var(--pcb-ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pick-line { margin-top: 8px; font-size: .95rem; }

/* ---------- ranking ---------- */
.rank-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; }
.tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; }
.tool label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.tool select { min-width: 13rem; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 4px; margin: 0; font-weight: 600; cursor: pointer; }
.check input, .pick input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.undo-line { margin-top: 12px; padding: 4px 12px; background: var(--accent-soft); border-radius: 4px; }
.table-wrap { margin-top: 16px; overflow-x: auto; min-height: 320px; }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
thead th { text-align: right; vertical-align: bottom; border-bottom: 2px solid var(--ink); padding: 0 6px 6px; font-weight: 600; white-space: nowrap; }
thead th.name, thead th.col-pick { text-align: left; }
thead th button { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 8px 0; cursor: pointer; min-height: 44px; min-width: 44px; }
thead th button:hover { color: var(--accent); }
thead th[aria-sort="ascending"] button, thead th[aria-sort="descending"] button { color: var(--accent); }
.th-plain { font-size: .8rem; color: var(--muted); font-weight: 400; }
tbody td, tbody th { padding: 12px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; text-align: right; font-weight: 400; }
tbody th.name { text-align: left; min-width: 215px; }
.numcol { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .93rem; }
thead .numcol { font-family: var(--sans); }
.numcol small { display: block; font-size: .8rem; color: var(--muted); font-family: var(--sans); }
.numcol.strong > span { font-weight: 700; }
.numcol small.best { color: var(--accent); font-weight: 600; }
.none { color: var(--muted); font-family: var(--sans); font-size: .9rem; }
.col-pick { width: 40px; text-align: left; }
thead th.col-pick { white-space: normal; line-height: 1.1; padding-bottom: 10px; }
.pick { display: flex; align-items: center; min-height: 44px; min-width: 44px; margin: 0; cursor: pointer; }
.pick-text { display: none; }
.name-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rank { font-family: var(--mono); font-size: .85rem; color: var(--muted); min-width: 1.4em; }
.name-text { font-weight: 600; overflow-wrap: anywhere; }
.specs { display: block; font-size: .85rem; color: var(--muted); padding-left: calc(1.4em + 8px); }
.tag { font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.tag-mine { background: var(--accent); color: var(--accent-ink); }
.tag-ex { border: 1px solid var(--rule-strong); color: var(--muted); }
.row-mine { background: var(--accent-soft); }
.row-mine th.name { box-shadow: inset 0 0 0 0 transparent; }
.row-ex .name-text { font-weight: 500; }
.row-actions { display: flex; gap: 8px; margin-top: 8px; padding-left: calc(1.4em + 8px); }
.btn-row { font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 4px; min-height: 44px; min-width: 64px; padding: 3px 14px; cursor: pointer; }
.btn-row:hover { border-color: var(--ink); }
.empty { padding: 28px 0; color: var(--muted); }
.rank-foot { min-height: 44px; }
@keyframes flash { from { box-shadow: inset 0 0 0 3px var(--accent); } to { box-shadow: inset 0 0 0 3px transparent; } }
tr.flash { animation: flash 1.6s ease-out; }

/* rows become cards on narrow screens */
@media (max-width: 760px) {
  .table-wrap { overflow: visible; }
  #spd-table, #spd-table tbody, #spd-table tr, #spd-table tbody td, #spd-table tbody th { display: block; width: auto; }
  #spd-table thead { display: none; }
  #spd-table tbody tr { border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 12px; padding: 12px 14px; background: var(--surface); display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  #spd-table tbody tr.row-mine { background: var(--accent-soft); border-color: var(--accent); }
  #spd-table tbody td, tbody th { border: 0; padding: 6px 0; text-align: left; }
  #spd-table tbody th.name { grid-column: 1 / -1; order: -2; font-size: 1.05rem; }
  #spd-table tbody td[data-label]::before { content: attr(data-label); display: block; font-family: var(--sans); font-size: .8rem; color: var(--muted); font-weight: 400; }
  #spd-table tbody td.col-pick { grid-column: 1 / -1; order: 9; width: auto; border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 4px; }
  .pick { min-height: 44px; gap: 8px; }
  .pick-text { display: inline; font-size: .92rem; }
  .row-actions { padding-left: 0; }
  .specs { padding-left: 0; }
  .btn-row { min-height: 44px; padding: 8px 18px; }
  .tools { width: 100%; }
  .tool { flex: 1 1 100%; }
  .tool select { width: 100%; }
}

/* ---------- guide ---------- */
.guide, .faq { max-width: 44rem; margin-top: 72px; }
.guide > h2, .faq > h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.1rem); padding-top: 20px; border-top: 4px solid var(--band); }
.guide h3 { font-size: 1.25rem; margin-top: 32px; }
.guide p, .guide ul, .guide dl { margin-top: 12px; }
.guide ul { padding-left: 1.2em; }
.guide li { margin-top: 6px; }
.guide .formula { background: var(--tint); color: var(--tint-ink); padding: 12px 14px; border-radius: 4px; border-left: 4px solid var(--band); }
.glossary { display: grid; grid-template-columns: minmax(5.5rem, max-content) 1fr; gap: 8px 20px; }
.glossary dt { font-weight: 700; font-family: var(--mono); font-size: .95rem; padding-top: 2px; }
.glossary dd { margin: 0; }
.faq details { border-bottom: 1px solid var(--rule-strong); }
.faq details:first-of-type { margin-top: 16px; border-top: 1px solid var(--rule-strong); }
.faq summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.1rem; padding: 14px 28px 14px 0; min-height: 44px; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-family: var(--mono); font-size: 1.3rem; color: var(--accent); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { padding: 0 0 16px; }

/* ---------- footer ---------- */
.foot { position: relative; margin-top: 0; background: var(--band); color: var(--band-ink); padding: 36px 0 32px; font-size: .95rem; }
.foot::before { top: 0; }
.foot a { color: var(--band-ink); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 0 24px; margin-bottom: 14px; }
.foot-nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--copper); text-underline-offset: 4px; }
.foot p { max-width: 46rem; }
.foot p + p { margin-top: 8px; opacity: .88; }

/* ---------- result bar ---------- */
.dock {
  display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--band); color: var(--band-ink); padding: 6px 16px; padding-bottom: calc(6px + env(safe-area-inset-bottom));
  border-top: 3px solid var(--copper); min-height: 60px; max-height: calc(64px + env(safe-area-inset-bottom));
  transform: translateY(0); transition: transform .2s ease, visibility .2s;
}
.dock.is-off { transform: translateY(110%); visibility: hidden; }
.dock-line { flex: 1; min-width: 0; margin: 0; line-height: 1.2; }
.dock-label { display: block; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .78rem; line-height: 1.2; opacity: .92; }
.dock-main { display: block; white-space: nowrap; font-size: .95rem; line-height: 1.15; }
.dock-fig { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
.dock-sub { opacity: .9; }
.dock-prompt { font-size: 1rem; font-weight: 600; white-space: normal; }
.dock a { color: var(--band); background: var(--copper); font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 4px; white-space: nowrap; }
/* on touch screens the bar moves to the top while a field has focus, above the keyboard */
body.typing-top .dock { top: 0; bottom: auto; border-top: 0; border-bottom: 3px solid var(--copper); padding-bottom: 6px; padding-top: calc(6px + env(safe-area-inset-top)); }
body.typing-top .dock.is-off { transform: none; }
body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
html.typing-top { scroll-padding-top: 84px; }
#result-panel { scroll-margin-top: 16px; }
@media (max-width: 959px) {
  .lead { padding: 28px 0 20px; }
}
/* the second figure only where it fits in full */
@media (max-width: 599px) {
  .dock { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); gap: 10px; }
  .dock-sub { display: none; }
  .dock-fig { font-size: 1.25rem; }
  .dock a { padding: 0 12px; }
}
@media (max-width: 400px) {
  .tb-x { display: none; }
  .wordmark { font-size: 1.15rem; }
  .logo { width: 30px; height: 30px; }
}
@media (max-width: 520px) {
  .nav { margin-left: 0; order: 3; width: 100%; gap: 0 12px; flex-wrap: nowrap; justify-content: space-between; }
  .band-in { gap: 0 12px; }
  .theme-btn { margin-left: auto; }
  .result-panel { padding: 16px; }
  .panel { padding: 16px; }
  .chart-box { aspect-ratio: 4 / 3.4; }
}

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

.hit { fill: transparent; cursor: pointer; }
.pt-on { fill: none; stroke: var(--copper); stroke-width: 2; }
.readout { margin-top: 10px; font-size: .98rem; color: var(--muted); min-height: 3em; }
.readout.is-set { color: var(--ink); font-weight: 600; }
.more-line { display: none; margin-top: 4px; }
.to-top { margin-top: 24px; }
.to-top a { display: inline-block; padding: 11px 0; }
#top, #add-card, #ranking, #guide, #faq { scroll-margin-top: 16px; }

@media (max-width: 600px) {
  .more-line { display: block; }
  .more-line .btn { width: 100%; }
  tbody.collapsed tr.fold { display: none; }
  .theme-btn { min-height: 44px; }
  .nav a { padding: 10px 4px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .nav { gap: 0 14px; }
  .link-btn { min-height: 44px; }
  .check { min-width: 44px; }
  .btn-row { min-width: 64px; }
  input[type="text"], input[type="number"], select { font-size: 16px; }
}

@media print {
  .band .nav, .theme-btn, .skip, .dock, .ad-slot, .more-tools, .foot-nav, .wafer-fig, .band::after, .foot::before, .inputs, .tools, .more-line, .readout, .to-top, .col-pick, .row-actions, .rank-foot, .undo-line, .pick-line { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .band { border-bottom: 2px solid #000; background: none; color: #000; }
  .logo-body { fill: #000; } .logo-mark { stroke: #fff; }
  .bench { display: block; }
  .chart-box, .legend svg, .result-panel, .row-mine, .tag-mine { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .chart-fig, tbody tr, .faq details, .guide h3 { break-inside: avoid; }
  .guide h3 { break-after: avoid; }
  .ranking { margin-top: 24px; }
  .guide, .faq { margin-top: 32px; }
  .foot { background: none; color: #000; border-top: 1px solid #000; margin-top: 24px; padding: 12px 0; }
}

/* ---------- shortlist grouping, spec picker ---------- */
.spec-src a { color: var(--accent); }
.spec-link { display: inline-flex; align-items: center; min-height: 44px; padding-left: calc(1.4em + 8px); font-size: .85rem; color: var(--accent); }
tr.row-group td { padding: 22px 6px 8px; text-align: left; font-weight: 700; font-size: .95rem; border-bottom: 2px solid var(--rule-strong); color: var(--muted); }
tr.row-empty td { padding: 18px 16px; text-align: left; background: var(--surface); border: 1.5px dashed var(--copper); color: var(--ink); }
.result-panel { position: relative; }
.result-panel::after { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--copper); }

/* ---------- ads (hidden until ads.js fills them) ---------- */
.ad-slot { margin: 48px 0 0; max-width: 100%; }
.ad-label { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.ad-box { min-height: 120px; overflow: hidden; }
@media (max-width: 600px) { .ad-box { min-height: 280px; } }

/* ---------- more tools ---------- */
.more-tools { margin-top: 72px; padding: 28px 0 32px; background: var(--tint); border-top: 1px solid var(--rule); }
.more-tools h2 { font-size: 1.2rem; }
.more-tools ul { margin: 10px 0 0; padding: 0; list-style: none; max-width: 46rem; }
.more-tools li { padding: 6px 0; }
.more-tools a { font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.tool-desc { display: block; color: var(--muted); }

/* ---------- text pages ---------- */
.page { padding-top: 32px; }
.prose { max-width: 44rem; }
.prose h1 { margin-bottom: 12px; }
.prose h2 { font-size: 1.4rem; margin-top: 36px; }
.prose h3 { font-size: 1.15rem; margin-top: 24px; }
.prose p, .prose ul, .prose ol, .prose dl, .prose table { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-top: 6px; }
.prose .formula { background: var(--tint); color: var(--tint-ink); padding: 12px 14px; border-radius: 4px; border-left: 4px solid var(--copper); }
.prose .meta { color: var(--muted); font-size: .95rem; }
.prose .lede { font-size: 1.12rem; color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose td.n { font-family: var(--mono); text-align: right; white-space: nowrap; }
.prose .table-scroll { overflow-x: auto; }
.callout { margin-top: 20px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--copper); border-radius: 6px; }
.btn-link { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.wipe-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.wipe-row p { flex-basis: 100%; }
@media (max-width: 600px) { .prose td.n { white-space: normal; } }
.spec-src { margin-top: 6px !important; }
.toc { display: none; }
@media (min-width: 1100px) {
  .article-grid { display: grid; grid-template-columns: minmax(0, 44rem) 260px; gap: 64px; align-items: start; }
  .toc { display: block; position: sticky; top: 24px; margin-top: 8px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--copper); border-radius: 6px; }
  .toc-h { font-weight: 700; font-family: var(--display); }
  .toc ol { margin: 8px 0 16px; padding-left: 1.3em; }
  .toc li { margin: 2px 0; }
  .toc ol a { display: inline-flex; align-items: center; min-height: 44px; }
}
.prose h2[id] { scroll-margin-top: 16px; }

/* Long URLs in running text must wrap on narrow phones. */
main p a, main li a, main dd a { overflow-wrap: anywhere; }

/* chart key: the visitor's cards by number */
.chart-key { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: .95rem; }
.chart-key li { display: flex; gap: 10px; align-items: baseline; }
.key-n { flex: none; display: inline-flex; justify-content: center; min-width: 1.6em; font-family: var(--mono); font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 3px; padding: 0 4px; }
.lbl-sm { display: block; font-size: .85rem; color: var(--muted); font-family: var(--sans); font-weight: 400; }
.spec-table td.n { white-space: normal; }
.prose table a { display: inline-flex; align-items: center; min-height: 44px; }
.spec-table { min-width: 700px; }
.spec-table td.d { white-space: nowrap; font-family: var(--mono); }
.prose table:not(.spec-table) { table-layout: fixed; }
.prose table:not(.spec-table) td.n { white-space: normal; overflow-wrap: anywhere; }
.scroll-cue { display: none; font-size: .9rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 700px) { .scroll-cue { display: block; } }
.table-scroll:focus-visible { outline: 3px solid var(--focus); }
.prose thead th { white-space: normal; text-align: left; }
