/* WSRM - Wireless Signal Range Mapper
   Instrument-panel frame: left tool palette, centre sheet with rulers, right readout panel.
   Single light scheme. All text pairs verified at or above WCAG AA. */

:root {
  color-scheme: light;

  --lab: #F8F9FB;
  --paper: #FFFFFF;
  --panel: #EDF0F4;
  --panel-2: #E2E6EC;
  --ink: #1E2329;
  --ink-2: #4B5563;
  --ink-soft: #2C343D;
  --teal: #007C80;
  --teal-deep: #005F63;
  --teal-bright: #5FD6DA;
  --edge: #6B7683;
  --rule: #C3CAD4;
  --grid: #DDE1E7;
  --on-dark: #E8ECF1;
  --on-dark-2: #AEB8C4;

  --indigo: #3B2F9E;
  --magenta: #C0267A;
  --orange: #F28C28;
  --yellow: #FFE45C;
  --ramp: linear-gradient(90deg, #3B2F9E 0%, #C0267A 38%, #F28C28 70%, #FFE45C 100%);
  --ramp-v: linear-gradient(0deg, #3B2F9E 0%, #C0267A 38%, #F28C28 70%, #FFE45C 100%);

  --focus: #3B2F9E;
  --focus-dark: #FFE45C;
  --danger: #A3123D;
  --ok: #0B6B3A;

  --f-label: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
  --f-head: Verdana, Geneva, "DejaVu Sans", Tahoma, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r: 8px;

  --sh-raise: 0 1px 0 #fff inset, 0 0 0 1px var(--rule), 0 1px 2px rgba(30,35,41,.12), 0 8px 16px -10px rgba(30,35,41,.35);
  --sh-press: 0 2px 4px rgba(30,35,41,.35) inset, 0 0 0 1px var(--ink);
  --sh-sheet: 0 0 0 1px var(--rule), 0 2px 3px rgba(30,35,41,.08), 0 18px 32px -22px rgba(30,35,41,.45);

  --fs-0: clamp(.9rem, .87rem + .15vw, 1rem);
  --fs-1: clamp(1rem, .96rem + .2vw, 1.0625rem);
  --fs-2: clamp(1.15rem, 1.05rem + .5vw, 1.35rem);
  --fs-3: clamp(1.35rem, 1.15rem + 1vw, 1.8rem);
  --fs-h1: clamp(1.6rem, 1.05rem + 2.6vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-width: 320px;
  font-family: var(--f-label);
  font-size: var(--fs-1);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--lab);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--teal-deep); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 var(--s4); }
ul, ol { margin: 0 0 var(--s4); padding-left: 1.25rem; }
li { margin-bottom: var(--s2); }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
code, kbd, samp, .mono { font-family: var(--f-mono); }
code { background: var(--panel); padding: .05em .35em; border-radius: 4px; font-size: .92em; overflow-wrap: anywhere; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .4em; text-align: center;
  font-size: .82em; line-height: 1.55; background: var(--paper);
  border: 1px solid var(--edge); border-bottom-width: 2px; border-radius: 4px; color: var(--ink);
}
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--f-head);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: .035em;
  line-height: 1.18;
  margin: 0 0 var(--s3);
  color: var(--ink);
  overflow-wrap: break-word;
}
h1 { font-size: var(--fs-h1); letter-spacing: .02em; }
h2 { font-size: var(--fs-3); }
h3 { font-size: var(--fs-2); }
h4 { font-size: var(--fs-1); }

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

/* ---------- focus ---------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
  border-radius: 4px;
}
.topbar :focus-visible, .footer-dark :focus-visible, .lcd :focus-visible, .dark :focus-visible {
  outline-color: var(--focus-dark);
  box-shadow: 0 0 0 5px var(--ink);
}
.skip {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  background: var(--ink); color: var(--yellow); padding: .75rem 1rem; border-radius: 0 0 8px 8px;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 0; }

/* ---------- frame ---------- */
.frame {
  max-width: 1680px;
  margin: 0 auto;
  background: var(--lab);
  box-shadow: 0 0 0 1px var(--rule), 0 40px 80px -50px rgba(30,35,41,.55);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  position: relative;
  background: var(--ink);
  color: var(--on-dark);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  padding: var(--s3) clamp(14px, 2vw, 28px) calc(var(--s3) + 3px);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ramp);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s3);
  color: var(--on-dark); text-decoration: none; min-height: 44px;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name {
  font-family: var(--f-head); font-weight: 700; font-variant: small-caps;
  font-size: 1.45rem; letter-spacing: .12em; line-height: 1; display: block; color: #fff;
}
.brand-sub { display: block; font-size: .72rem; letter-spacing: .08em; color: var(--on-dark-2); text-transform: uppercase; margin-top: 3px; }

.nav-toggle {
  display: none; align-items: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  background: var(--ink-soft); color: var(--on-dark);
  border: 1px solid #56616E; border-radius: var(--r); cursor: pointer; font-weight: 700;
}
.nav-toggle svg { width: 18px; height: 18px; }
.nav { display: block; }
.nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1); margin: 0; padding: 4px; background: #14181C; border-radius: 10px; box-shadow: 0 1px 0 rgba(255,255,255,.08), inset 0 2px 4px rgba(0,0,0,.5); }
.nav li { margin: 0; }
.nav a {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  color: var(--on-dark); text-decoration: none; border-radius: 7px;
  font-size: .95rem; letter-spacing: .02em;
}
.nav a:hover { background: #333D48; }
.nav a[aria-current="page"] {
  background: var(--lab); color: var(--ink); font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--teal), 0 1px 0 rgba(255,255,255,.3);
}
.nav a .led { width: 8px; height: 8px; border-radius: 50%; background: #56616E; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.nav a[aria-current="page"] .led { background: var(--teal); box-shadow: 0 0 0 2px rgba(0,124,128,.25); }

.statusbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5);
  padding: var(--s2) clamp(14px, 2vw, 28px);
  background: var(--panel); border-bottom: 1px solid var(--rule);
  font-family: var(--f-mono); font-size: .78rem; letter-spacing: .02em; color: var(--ink);
}
.statusbar span { display: inline-flex; align-items: center; gap: var(--s2); min-height: 24px; }
.led-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; box-shadow: inset 0 0 0 1px rgba(30,35,41,.6); }
.led-dot.amber { background: var(--orange); }
.led-dot.teal { background: var(--teal); }
.led-dot.ink { background: var(--ink); }

/* ---------- deck: rails + stage ---------- */
.deck {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(216px, 262px) minmax(0, 1fr) minmax(260px, 328px);
  align-items: stretch;
}
.rail {
  background:
    linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,0) 120px),
    var(--panel);
  padding: var(--s4);
  display: flex; flex-direction: column; gap: var(--s4);
  min-width: 0;
}
.rail-left { border-right: 1px solid var(--rule); box-shadow: -1px 0 0 #fff inset; }
.rail-right { border-left: 1px solid var(--rule); box-shadow: 1px 0 0 #fff inset; }
.rail-sticky { position: sticky; top: 12px; display: flex; flex-direction: column; gap: var(--s4); }

.stage {
  position: relative;
  min-width: 0;
  padding: calc(22px + clamp(14px, 2vw, 28px)) clamp(14px, 2.2vw, 32px) clamp(24px, 3vw, 48px) calc(28px + clamp(14px, 2vw, 28px));
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: var(--lab);
}
.stage::before, .stage::after { content: ""; position: absolute; background-color: var(--panel); pointer-events: none; }
.stage::before {
  left: 0; right: 0; top: 0; height: 22px; border-bottom: 1px solid var(--edge);
  background-image:
    linear-gradient(90deg, var(--ink) 1px, transparent 1px),
    linear-gradient(90deg, var(--edge) 1px, transparent 1px);
  background-size: 48px 12px, 8px 6px;
  background-position: 28px 100%, 28px 100%;
  background-repeat: repeat-x;
}
.stage::after {
  left: 0; top: 22px; bottom: 0; width: 28px; border-right: 1px solid var(--edge);
  background-image:
    linear-gradient(180deg, var(--ink) 1px, transparent 1px),
    linear-gradient(180deg, var(--edge) 1px, transparent 1px);
  background-size: 12px 48px, 6px 8px;
  background-position: 100% 0, 100% 0;
  background-repeat: repeat-y;
}
.stage--bare { padding: clamp(14px, 2vw, 28px); }
.stage--bare::before, .stage--bare::after { display: none; }

.sheet {
  position: relative;
  background: var(--paper);
  border-radius: 10px;
  box-shadow: var(--sh-sheet);
  padding: clamp(18px, 2.6vw, 40px);
  margin: 0 0 var(--s5);
  min-width: 0;
}
.sheet > :last-child { margin-bottom: 0; }
.sheet--ruled::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-radial-gradient(circle at 100% 0, transparent 0 26px, rgba(0,124,128,.14) 26px 27px);
  mask-image: linear-gradient(225deg, #000 0%, transparent 55%);
  -webkit-mask-image: linear-gradient(225deg, #000 0%, transparent 55%);
}
.sheet > * { position: relative; }
.sheet-tag {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--f-mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink); background: var(--panel); border: 1px solid var(--rule);
  padding: 2px 10px; border-radius: 99px; margin-bottom: var(--s3);
}
.lead { font-size: var(--fs-2); line-height: 1.5; color: var(--ink); max-width: 62ch; }
.measure { max-width: 68ch; }
.muted { color: var(--ink-2); }
.ramp-rule { height: 6px; border-radius: 3px; background: var(--ramp); margin: var(--s4) 0; border: 0; box-shadow: 0 0 0 1px rgba(30,35,41,.25); }

/* ---------- modules in rails ---------- */
.module {
  background: var(--lab);
  border-radius: 10px;
  box-shadow: var(--sh-raise);
  padding: var(--s3) var(--s3) var(--s4);
  min-width: 0;
}
.module > :last-child { margin-bottom: 0; }
.mod-title {
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--f-head); font-weight: 700; font-variant: small-caps;
  font-size: .95rem; letter-spacing: .1em; color: var(--ink);
  margin: 0 0 var(--s3); padding-bottom: var(--s2); border-bottom: 1px solid var(--rule);
}
.mod-title::before, .mod-title::after { content: ""; }
.mod-title::before { width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #8D97A3 60%, #5C6672); box-shadow: 0 0 0 1px var(--edge); flex: none; }
.small { font-size: .875rem; }
.fine { font-size: .8125rem; color: var(--ink-2); line-height: 1.5; }

.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.toc li { margin: 0; }
.toc a {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 44px; padding: 0 var(--s3);
  text-decoration: none; color: var(--ink); font-size: .95rem;
  background: linear-gradient(180deg, #fff, var(--panel));
  border-radius: 8px; box-shadow: var(--sh-raise);
}
.toc a:hover { background: #fff; box-shadow: 0 0 0 2px var(--teal), 0 6px 12px -8px rgba(30,35,41,.5); }
.toc a .num { font-family: var(--f-mono); font-size: .8rem; color: var(--teal-deep); font-weight: 700; min-width: 1.6em; }
.toc a[aria-current="true"] { background: var(--ink); color: var(--on-dark); box-shadow: var(--sh-press); }
.toc a[aria-current="true"] .num { color: var(--yellow); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  font-family: var(--f-label); font-weight: 700; font-size: .95rem; letter-spacing: .02em;
  text-decoration: none; cursor: pointer; border-radius: var(--r);
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 6px 14px -8px rgba(0,60,62,.9); border-color: var(--teal-deep); }
.btn-primary:hover { background: var(--teal-deep); text-decoration: none; }
.btn-ink { background: var(--ink); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset; border-color: #000; }
.btn-ink:hover { background: var(--ink-soft); text-decoration: none; }
.btn-ghost { background: linear-gradient(180deg, #fff, var(--panel)); color: var(--ink); box-shadow: var(--sh-raise); border-color: transparent; }
.btn-ghost:hover { background: #fff; box-shadow: 0 0 0 2px var(--teal), 0 6px 12px -8px rgba(30,35,41,.5); text-decoration: none; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--panel-2); color: #3F4752; box-shadow: none; border-color: var(--rule); cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); }
.btn-sm { min-height: 40px; padding: 0 var(--s3); font-size: .875rem; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: var(--s3); }
.field > label, .field > .label, legend {
  font-size: .8125rem; font-weight: 700; letter-spacing: .03em; color: var(--ink);
}
fieldset { border: 0; margin: 0 0 var(--s3); padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
input[type="number"], input[type="text"], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--edge); border-radius: 6px;
  box-shadow: 0 2px 3px rgba(30,35,41,.1) inset;
}
input[type="number"], .mono-in { font-family: var(--f-mono); }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
::placeholder { color: #5B6471; opacity: 1; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; background-color: #fff;
}
input[type="range"] { width: 100%; min-height: 40px; accent-color: var(--teal); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal); width: 20px; height: 20px; flex: none; margin: 0; }
.check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; font-size: .95rem; }
.field-err { color: var(--danger); font-size: .8125rem; font-weight: 700; min-height: 1.2em; margin: 0; }
.field-err:empty { display: none; }
.field-hint { color: var(--ink-2); font-size: .8125rem; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }

/* ---------- legend ---------- */
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legend li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: var(--s3); margin: 0; min-height: 30px; font-size: .875rem; }
.legend .chip { width: 30px; height: 18px; border-radius: 3px; box-shadow: 0 0 0 1px var(--ink); display: block; }
.legend .dbm { font-family: var(--f-mono); font-size: .8rem; text-align: right; color: var(--ink); white-space: nowrap; }
.legend .q { font-weight: 700; }
.c1 { background: #FFE45C; }
.c2 { background: #F5A235; }
.c3 { background: #DB5D4E; }
.c4 { background: #B7277C; }
.c5 { background: #672C92; }
.c6 { background: repeating-linear-gradient(135deg, #3B2F9E 0 4px, #fff 4px 7px); }
.c7 { background: #fff; box-shadow: 0 0 0 1px var(--ink), inset 0 0 0 2px #fff; border: 1px dashed var(--ink); }
.ramp-bar { height: 14px; border-radius: 3px; background: linear-gradient(90deg, #3B2F9E 10%, #C0267A 40%, #F28C28 66%, #FFE45C 90%); box-shadow: 0 0 0 1px var(--ink); margin: 0 0 4px; }
.ramp-ticks { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: .72rem; color: var(--ink); margin-bottom: var(--s3); }
.contour-key { display: grid; gap: 6px; margin-top: var(--s3); font-size: .8125rem; }
.contour-key div { display: flex; align-items: center; gap: var(--s3); }
.contour-key svg { width: 38px; height: 8px; flex: none; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); margin: 0; font-size: .875rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--f-mono); font-size: .84rem; text-align: right; overflow-wrap: anywhere; }

/* ---------- HOME ---------- */
.hero h1 { max-width: 15em; margin-bottom: var(--s4); }
.hero .btn-row { margin-top: var(--s5); }
.titleblock {
  margin-top: var(--s6);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border: 1.5px solid var(--ink); font-size: .8125rem;
}
.titleblock > div { padding: var(--s2) var(--s3); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-right: -1px; margin-bottom: -1px; }
.titleblock b { display: block; font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }
.demo-card { padding: var(--s3); background: var(--panel-2); border-radius: 12px; box-shadow: var(--sh-raise); }
.demo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.demo-head h2 { margin: 0; font-size: 1.1rem; }
.canvas-wrap { position: relative; background: var(--lab); border-radius: 6px; box-shadow: 0 2px 6px rgba(30,35,41,.25) inset, 0 0 0 1px var(--edge); padding: 0; overflow: hidden; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.canvas-wrap canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; box-shadow: none; border-radius: 0; }
.demo-out {
  margin: var(--s3) 0 0; padding: var(--s3) var(--s4); border-radius: 8px;
  background: var(--ink); color: var(--on-dark); font-family: var(--f-mono); font-size: .86rem; line-height: 1.5;
  min-height: 3.2em; overflow-wrap: anywhere;
}
.demo-out b { color: var(--teal-bright); font-weight: 700; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); counter-reset: step; list-style: none; padding: 0; margin: var(--s5) 0 0; }
.step { margin: 0; position: relative; padding-top: var(--s2); counter-increment: step; }
.step::before {
  content: "Entry 0" counter(step);
  display: block; font-family: var(--f-mono); font-size: .76rem; color: var(--teal-deep); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: var(--s2);
}
.step svg { width: 100%; height: auto; display: block; margin-bottom: var(--s3); border-radius: 8px; background: var(--lab); box-shadow: 0 0 0 1px var(--rule); }
.step h3 { margin-bottom: var(--s2); }
.spec { border: 1px solid var(--ink); margin: var(--s4) 0 0; }
.spec div { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; border-bottom: 1px solid var(--rule); }
.spec div:last-child { border-bottom: 0; }
.spec dt { padding: var(--s3); background: var(--panel); font-family: var(--f-mono); font-size: .8rem; font-weight: 700; border-right: 1px solid var(--rule); }
.spec dd { margin: 0; padding: var(--s3); }
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); list-style: none; margin: var(--s4) 0 0; padding: 0; }
.cases li { margin: 0; padding: var(--s4); background: var(--lab); border-radius: 8px; box-shadow: 0 0 0 1px var(--rule); border-left: 5px solid var(--teal); }
.cases li strong { display: block; margin-bottom: 4px; font-family: var(--f-head); font-variant: small-caps; font-weight: 700; letter-spacing: .04em; }
.notice {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: start;
  padding: var(--s4); border-radius: 8px; background: #FFF6D6; border: 1.5px solid var(--ink);
  color: var(--ink);
}
.notice svg { width: 30px; height: 30px; flex: none; }
.notice > div > :last-child { margin-bottom: 0; }
.limits-list { columns: 2; column-gap: var(--s6); }
.limits-list li { break-inside: avoid; }
.cta-band { background: var(--ink); color: var(--on-dark); border-radius: 10px; padding: clamp(20px, 3vw, 40px); position: relative; overflow: hidden; }
.cta-band::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--ramp); }
.cta-band h2 { color: #fff; }
.cta-band p { max-width: 56ch; }
.cta-band a:not(.btn) { color: var(--teal-bright); }

/* ---------- MAPPER ---------- */
.mapper-title { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s4); }
.mapper-title h1 { margin: 0; font-size: clamp(1.4rem, 1rem + 1.8vw, 2.2rem); }
.approx-badge {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 6px 12px; border-radius: 99px;
  background: #FFF6D6; border: 1.5px solid var(--ink); font-size: .8rem; font-weight: 700; color: var(--ink);
}
.stage-frame { background: var(--panel-2); border-radius: 12px; padding: var(--s3); box-shadow: var(--sh-raise); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); align-items: center; }
.toolbar .grow { flex: 1 1 auto; }
.statusline { margin: var(--s3) 0 0; padding: var(--s2) var(--s3); min-height: 44px; display: flex; align-items: center; border-radius: 6px; background: var(--ink); color: var(--on-dark); font-family: var(--f-mono); font-size: .84rem; overflow-wrap: anywhere; }

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); border: 0; padding: 0; margin: 0; }
.tool { position: relative; }
.tool input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.tool label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 74px; padding: var(--s2);
  background: linear-gradient(180deg, #fff, var(--panel)); border-radius: 8px; box-shadow: var(--sh-raise);
  font-size: .8rem; font-weight: 700; text-align: center; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool label svg { width: 26px; height: 26px; }
.tool label small { font-family: var(--f-mono); font-weight: 400; font-size: .7rem; color: var(--ink-2); }
.tool input:checked + label { background: var(--ink); color: #fff; box-shadow: var(--sh-press); transform: translateY(1px); }
.tool input:checked + label small { color: var(--on-dark-2); }
.tool input:checked + label svg { color: var(--yellow); }
.tool input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }
.tool input:checked:focus-visible + label { outline-color: var(--focus); }
.tool input:hover + label { box-shadow: 0 0 0 2px var(--teal), 0 6px 12px -8px rgba(30,35,41,.5); }
.tool input:checked:hover + label { box-shadow: var(--sh-press); }

.mats { display: grid; gap: 4px; border: 0; padding: 0; margin: 0 0 var(--s3); }
.mat { position: relative; }
.mat input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.mat label {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: var(--s3);
  min-height: 42px; padding: 0 var(--s3); border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--rule); font-size: .875rem;
}
.mat label svg { width: 52px; height: 14px; display: block; }
.mat label .db { font-family: var(--f-mono); font-size: .78rem; color: var(--ink); }
.mat input:checked + label { background: var(--ink); color: #fff; box-shadow: var(--sh-press); }
.mat input:checked + label .db { color: var(--yellow); }
.mat input:checked + label svg { background: #fff; border-radius: 3px; padding: 0 2px; }
.mat input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }
.mat input:hover + label { box-shadow: 0 0 0 2px var(--teal); }
.mat input:checked:hover + label { box-shadow: var(--sh-press); }

.lcd {
  background: var(--ink); color: var(--on-dark); border-radius: 10px; padding: var(--s4);
  box-shadow: 0 3px 8px rgba(0,0,0,.55) inset, 0 1px 0 #fff, 0 0 0 1px #000;
}
.lcd-label { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--on-dark-2); margin: 0 0 4px; }
.lcd-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2) var(--s3); }
.lcd-num { font-family: var(--f-mono); font-weight: 700; font-size: clamp(2.1rem, 1.6rem + 1.2vw, 2.8rem); line-height: 1; color: var(--teal-bright); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.lcd-unit { font-family: var(--f-mono); color: var(--on-dark-2); font-size: 1rem; }
.lcd-row { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); flex-wrap: wrap; }
.q-chip { display: inline-flex; align-items: center; gap: var(--s2); padding: 3px 10px 3px 4px; border-radius: 99px; background: #313a45; font-weight: 700; font-size: .9rem; color: #fff; }
.q-chip i { width: 20px; height: 20px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px #fff; background: #fff; }
.bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.bars i { display: block; width: 6px; background: transparent; border: 1.5px solid var(--on-dark-2); border-radius: 1px; }
.bars i:nth-child(1) { height: 6px; } .bars i:nth-child(2) { height: 10px; } .bars i:nth-child(3) { height: 14px; } .bars i:nth-child(4) { height: 18px; } .bars i:nth-child(5) { height: 22px; }
.bars i.on { background: var(--teal-bright); border-color: var(--teal-bright); }
.lcd .kv dt { color: var(--on-dark-2); }
.lcd .kv dd { color: var(--on-dark); }
.cov { display: grid; gap: var(--s3); margin: 0; }
.cov-row { display: grid; gap: 4px; font-size: .84rem; }
.cov-row .top { display: flex; justify-content: space-between; gap: var(--s3); }
.cov-row .top b { font-family: var(--f-mono); }
.meter { height: 10px; border-radius: 5px; background: var(--panel-2); box-shadow: 0 0 0 1px var(--edge) inset; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ink); background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,.35) 6px 7px); transition: width .25s ease; }
.ap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.ap-list li { margin: 0; padding: var(--s2) var(--s3); background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px var(--rule); display: grid; gap: 6px; }
.ap-list li.sel { box-shadow: 0 0 0 2px var(--ink); }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.ap-badge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--f-mono); font-weight: 700; font-size: .8rem; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--ink); }
.ap-xy { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.ap-xy label { display: grid; gap: 2px; font-size: .72rem; font-weight: 700; }
.ap-xy input { min-height: 40px; padding: 4px 8px; font-size: .86rem; }
.empty-state { margin: 0; padding: var(--s4); border: 1.5px dashed var(--edge); border-radius: 8px; background: #fff; font-size: .875rem; color: var(--ink); }
.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); margin-top: var(--s4); }
.keys { width: 100%; font-size: .875rem; }
.keys th, .keys td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.keys th { width: 38%; font-weight: 400; white-space: normal; }
.keys tr:last-child th, .keys tr:last-child td { border-bottom: 0; }
.opt-grid { display: grid; gap: 0; }

/* ---------- MODEL ---------- */
.notebook { counter-reset: entry; }
.entry { position: relative; margin: 0 0 var(--s5); padding-left: clamp(0px, 5vw, 72px); }
.entry-no {
  position: absolute; left: 0; top: 4px; width: 56px; font-family: var(--f-mono); font-size: .8rem; font-weight: 700; color: var(--teal-deep);
  letter-spacing: .06em; display: block;
}
.formula {
  margin: var(--s4) 0; padding: var(--s4); background: var(--ink); color: var(--on-dark); border-radius: 8px;
  font-family: var(--f-mono); font-size: clamp(.82rem, .75rem + .35vw, 1rem); line-height: 1.8; overflow-x: auto; max-width: 100%;
  box-shadow: 0 3px 8px rgba(0,0,0,.5) inset;
}
.formula b { color: var(--yellow); font-weight: 700; }
.formula .cm { color: var(--on-dark-2); }
.data { margin: var(--s4) 0; font-size: .9rem; display: block; overflow-x: auto; }
.data table { min-width: 460px; }
.data th, .data td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
.data thead th { background: var(--ink); color: #fff; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; border-bottom: 0; }
.data tbody th { font-weight: 700; }
.data td.n { font-family: var(--f-mono); text-align: right; }
.data tbody tr:nth-child(even) { background: var(--lab); }
.bench { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.bench-controls { background: var(--panel); border-radius: 10px; padding: var(--s4); box-shadow: var(--sh-raise); }
.bench-plot { min-width: 0; }
.plot { width: 100%; height: auto; display: block; background: var(--lab); border-radius: 8px; box-shadow: 0 0 0 1px var(--rule); }
.plot text { font-family: var(--f-mono); fill: var(--ink); }
.range-out { margin-top: var(--s4); display: grid; gap: var(--s2); }
.range-out div { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 12px; background: var(--lab); border-radius: 6px; box-shadow: 0 0 0 1px var(--rule); font-size: .9rem; }
.range-out b { font-family: var(--f-mono); }
.callout { padding: var(--s4); border-left: 6px solid var(--magenta); background: var(--lab); border-radius: 0 8px 8px 0; margin: var(--s4) 0; }
.callout > :last-child { margin-bottom: 0; }

/* ---------- GUIDE ---------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s5); list-style: none; padding: 0; margin: var(--s5) 0 0; counter-reset: rule; }
.rule { margin: 0; background: var(--paper); border-radius: 10px; box-shadow: var(--sh-sheet); padding: var(--s4); counter-increment: rule; display: flex; flex-direction: column; gap: var(--s3); }
.rule h3 { margin: 0; display: flex; gap: var(--s3); align-items: baseline; }
.rule h3::before { content: counter(rule, decimal-leading-zero); font-family: var(--f-mono); font-variant: normal; color: var(--teal-deep); font-size: .95rem; }
.rule svg { width: 100%; height: auto; border-radius: 6px; background: var(--lab); box-shadow: 0 0 0 1px var(--rule); }
.rule p { margin: 0; font-size: .95rem; }
.chooser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--s5); align-items: start; }
.choice { position: relative; display: block; margin-bottom: var(--s2); }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.choice span { display: block; padding: var(--s3) var(--s4); border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--edge); min-height: 44px; }
.choice span b { display: block; }
.choice span small { color: var(--ink-2); font-size: .84rem; }
.choice input:checked + span { background: var(--ink); color: #fff; box-shadow: var(--sh-press); }
.choice input:checked + span small { color: var(--on-dark-2); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }
.choice input:hover + span { box-shadow: 0 0 0 2px var(--teal); }
.choice input:checked:hover + span { box-shadow: var(--sh-press); }
.verdict { padding: var(--s5); border-radius: 10px; background: var(--ink); color: var(--on-dark); position: relative; overflow: hidden; }
.verdict::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--ramp); }
.verdict h3 { color: #fff; }
.verdict .big { font-family: var(--f-mono); font-size: 2rem; color: var(--yellow); font-weight: 700; line-height: 1; margin: 0 0 var(--s3); }
.verdict a { color: var(--teal-bright); }
.verdict p:last-child { margin-bottom: 0; }
.checklist { list-style: none; padding: 0; margin: var(--s4) 0; }
.checklist li { margin: 0; border-bottom: 1px dashed var(--edge); }
.checklist label { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) 0; cursor: pointer; min-height: 44px; }
.checklist input { margin-top: 3px; }
.checklist input:checked + span { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.progress { display: flex; align-items: center; gap: var(--s4); margin: var(--s3) 0; flex-wrap: wrap; }
.progress .meter { flex: 1 1 200px; height: 14px; }
.progress b { font-family: var(--f-mono); }

/* ---------- CONTACT ---------- */
.slip { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.slip-form { background: #fff; border-radius: 10px; padding: clamp(16px, 2.4vw, 32px); box-shadow: var(--sh-sheet); border-top: 8px solid var(--teal); position: relative; }
.slip-form::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; border-bottom: 2px dashed var(--edge); }
.draft { font-family: var(--f-mono); font-size: .84rem; min-height: 180px; background: var(--lab); }
.mail-big { font-family: var(--f-mono); font-size: clamp(1rem, .8rem + 1vw, 1.5rem); font-weight: 700; word-break: break-word; }

/* ---------- footer ---------- */
.footer-dark { background: var(--ink); color: var(--on-dark); padding: var(--s6) clamp(14px, 2vw, 28px) var(--s5); position: relative; }
.footer-dark::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ramp); }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--s6); }
.footer-dark h2 { font-size: .9rem; letter-spacing: .14em; color: var(--on-dark-2); margin-bottom: var(--s3); }
.footer-dark ul { list-style: none; margin: 0; padding: 0; }
.footer-dark li { margin: 0; }
.footer-dark a { color: var(--on-dark); display: inline-flex; align-items: center; min-height: 40px; }
.footer-dark a:hover { color: var(--yellow); }
.footer-dark .brand-name { font-size: 1.2rem; }
.footer-dark p { color: var(--on-dark); font-size: .9rem; max-width: 52ch; }
.footer-dark .legal { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid #3F4A56; color: var(--on-dark-2); font-size: .82rem; }
.footer-dark .legal p { color: var(--on-dark-2); max-width: none; margin-bottom: var(--s2); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .deck { grid-template-columns: minmax(200px, 232px) minmax(0, 1fr); }
  .rail-right { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .step { display: grid; grid-template-columns: minmax(0, 260px) 1fr; column-gap: var(--s5); }
  .step::before { grid-column: 1 / -1; }
  .step svg { grid-row: 2 / 4; }
}
@media (max-width: 900px) {
  .deck { display: flex; flex-direction: column; }
  .rail-left { border-right: 0; border-bottom: 1px solid var(--rule); box-shadow: none; }
  .rail-sticky { position: static; }
  .toc { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .rail-right { order: 5; }
  .mapper-page .palette { display: contents; }
  .mapper-page .g-tools { order: 1; margin: var(--s4) var(--s4) 0; }
  .mapper-page .stage { order: 2; }
  .mapper-page .rail-right { order: 3; }
  .mapper-page .g-settings { order: 4; margin: 0 var(--s4); }
  .mapper-page .g-materials { order: 4; margin: 0 var(--s4); }
  .mapper-page .g-last { margin-bottom: var(--s4); }
  .mapper-page .rail-left { padding: 0; background: none; border: 0; }
  .tools { grid-template-columns: repeat(4, 1fr); }
  .tool label { min-height: 70px; }
  .nav-toggle { display: inline-flex; }
  .js .nav { display: none; width: 100%; }
  .js .nav.open { display: block; }
  .nav ul { flex-direction: column; }
  .nav a { width: 100%; }
  .topbar { align-items: center; }
  .bench, .chooser, .slip { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stage::after { display: none; }
  .stage { padding-left: clamp(14px, 2.2vw, 32px); }
  .stage::before { background-position: 0 100%, 0 100%; }
}
@media (max-width: 640px) {
  .stage--bare { padding: 10px; }
  .help-grid, .cases, .row2 { grid-template-columns: 1fr; }
  .limits-list { columns: 1; }
  .step { display: block; }
  .spec div { grid-template-columns: 1fr; }
  .spec dt { border-right: 0; border-bottom: 1px solid var(--rule); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--s5); }
  .tools { grid-template-columns: repeat(2, 1fr); }
  .entry { padding-left: 0; }
  .entry-no { position: static; display: block; margin-bottom: 4px; }
  .rail-right { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (max-width: 400px) {
  .sheet { padding: 16px; }
  .btn { padding: 0 var(--s4); }
  .titleblock { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1500px) {
  .stage { padding-right: 40px; }
}

/* ---------- print ---------- */
@media print {
  :root { --lab: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .frame { box-shadow: none; max-width: none; }
  .topbar, .statusbar, .rail, .footer-dark, .skip, .btn-row, .toolbar, .no-print, .stage::before, .stage::after, .statusline, .nav-toggle { display: none !important; }
  .deck { display: block; }
  .stage, .stage--bare { padding: 0; background: #fff; }
  .sheet { box-shadow: none; border: 1px solid #000; break-inside: avoid; margin-bottom: 12pt; padding: 12pt; }
  .sheet.no-print { display: none !important; }
  .print-only { display: block !important; }
  a { color: #000; text-decoration: none; }
  .checklist li { break-inside: avoid; }
  .checklist input:checked + span { text-decoration: line-through; color: #000; }
  .formula { background: #fff; color: #000; box-shadow: none; border: 1px solid #000; }
  .formula b { color: #000; }
  .canvas-wrap { box-shadow: none; border: 1px solid #000; }
  .mapper-page .stage-frame { background: #fff; box-shadow: none; padding: 0; }
}
.print-only { display: none; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition: none !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  .btn:active, .tool input:checked + label { transform: none; }
}

.lcd .kv { margin-top: var(--s3); }
.slip .sheet { margin-bottom: var(--s5); }
