/* DEADBOLT — app.css (shell). Build width 1920 (LUAT 50): 1 u = 100vw/1920, so at 1920×1080 the page equals the mockup ×1.148.
   Tokens from mockup/v1/DESIGN.md §0–§5. Borders: ONLY the .rule-* classes below (LUAT 56) — route files never write border/outline.
   Page frame (LUAT 53): fixed left rail 230u · content 241u → 1909u (right gutter 11u) · violet ground + §3b atmosphere on every route. */

:root {
  --u: calc(100vw / 1920);

  /* colour tokens (DESIGN §3) */
  --paper: #3C1C66;
  --ground-deep: #2C1243;
  --surface: #D1D7E6;
  --surface-container: #DFE4F2;
  --frost: #ECF2FD;
  --ink: #3E0267;
  --ink-soft: #5A4A86;
  --ink-shadow: #2E2457;
  --lime: #B9EE5E;
  --lime-deep: #8FC23A;
  --lime-glow: #C7FCCA;
  --lavender: #CCB9FD;
  --lavender-deep: #9F8BDB;
  --alarm: #FF5A68;
  --alarm-chip: #F8B4BE;
  --alarm-cell: #ECBED3;
  --plate: #46193E;
  --plate-down: #531633;
  --footer: #26134C;
  --brass: #B67A16;
  --outline-steel: #AEB7C9;
  --disabled: #C3C9D6;
  --disabled-ink: #7A7F95;
  --chain: #97FCE4;

  /* fonts (DESIGN §2) */
  --f-display: 'Fira Sans Condensed', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --f-ui: 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --f-code: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* type scale @1920 (DESIGN §2); text never below 12px */
  --fs-hero: calc(61 * var(--u));
  --fs-title: calc(48 * var(--u));
  --fs-panel: calc(34 * var(--u));
  --fs-status: calc(63 * var(--u));
  --fs-num: max(14px, calc(32 * var(--u)));
  --fs-sub: max(13px, calc(24 * var(--u)));
  --fs-btn: max(13px, calc(24 * var(--u)));
  --fs-nav: max(13px, calc(19 * var(--u)));
  --fs-ticker: max(12px, calc(21 * var(--u)));
  --fs-body: max(12px, calc(17 * var(--u)));
  --fs-label: max(12px, calc(17 * var(--u)));
  --fs-small: max(12px, calc(14 * var(--u)));
  --fs-code: max(12px, calc(16 * var(--u)));

  /* geometry (DESIGN §0, §4) */
  --rail-w: calc(230 * var(--u));
  --gut-l: calc(241 * var(--u));
  --gut-r: calc(11 * var(--u));
  --gap: calc(16 * var(--u));
  --sec-gap: calc(18 * var(--u));
  --r-panel: calc(16 * var(--u));
  --r-ctl: calc(10 * var(--u));
  --r-chip: calc(8 * var(--u));
  --r-rail: calc(18 * var(--u));
  --h-btn: calc(64 * var(--u));
  --h-ctl: calc(56 * var(--u));

  /* shadows + faces */
  --sh-panel: 0 calc(6 * var(--u)) 0 rgba(46, 36, 87, .55), 0 calc(14 * var(--u)) calc(30 * var(--u)) rgba(20, 6, 40, .45);
  --face-steel: linear-gradient(135deg, #E3E8F3 0%, #D5DBE9 55%, #C9D0E0 100%);
  --face-dark: linear-gradient(180deg, #2C1452 0%, #26134C 100%);
  --rv-s: calc(15 * var(--u));
  --rv-o: calc(11 * var(--u));
  --rivet: radial-gradient(circle at 38% 34%, #FFF0B8 0 10%, #E0A93E 24%, #B67A16 46%, #7A4B0C 64%, rgba(40, 18, 0, .45) 70%, transparent 76%);

  /* BORDER TOKENS (DESIGN §4b — widths/colours measured, @1920; hairlines never below 1px) */
  --rule-panel: max(1px, calc(5 * var(--u))) solid #F2F7FD;
  --rule-plate-outer: max(1px, calc(3.6 * var(--u))) solid #B7BBCC;
  --rule-plate-inner: #22152E;
  --rule-input: max(1px, calc(2 * var(--u))) solid #9A9FCD;
  --rule-value: max(1px, calc(2 * var(--u))) solid #B2B2E0;
  --rule-btn-primary: max(1px, calc(3 * var(--u))) solid #E7FBAA;
  --rule-btn-secondary: max(1px, calc(3 * var(--u))) solid #C8C7EA;
  --rule-btn-alarm: max(1px, calc(3 * var(--u))) solid #FED2DC;
  --rule-rail-active: max(1px, calc(3 * var(--u))) solid #E9FEB1;
  --rule-rail-wallet: max(1px, calc(3 * var(--u))) solid #C5D5C2;
  --rule-seg: max(1px, calc(3 * var(--u))) solid #D4DAEE;
  --rule-toggle-card: max(1px, calc(3.4 * var(--u))) solid #D7E3DA;
  --rule-select: max(1px, calc(1 * var(--u))) solid #BFC6E0;
  --rule-code: max(1px, calc(2.5 * var(--u))) solid #C6BCE3;
  --rule-ticket: max(1px, calc(4 * var(--u))) solid #C6BAD4;
  --rule-chip: max(1px, calc(2.5 * var(--u))) solid #C5CAE2;
  --rule-row: max(1px, calc(1.5 * var(--u))) solid #BCC3DC;
  --rule-rail-divider: max(1px, calc(1 * var(--u))) solid #A0ACC6;
  --rule-footer: max(1px, calc(3 * var(--u))) solid #8E6AA8;
  --rule-focus: max(2px, calc(3 * var(--u))) solid #B9EE5E;

  /* MOTION (DESIGN §10) — one family: "bolt throw" spring + heartbeat */
  --beat: 1.2s;
  --t-throw: 420ms;
  --t-quick: 160ms;
  --ease-throw: cubic-bezier(.3, 1.45, .55, 1);
  --rt-nudge: 24px;
  --rt-dur: 260ms;

  --native-accent: #B9EE5E;
  --native-scroll-thumb: #9F8BDB;
  --native-scroll-track: #2C1243;
  color-scheme: dark;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --ease-throw: linear(0, .22 8%, .62 18%, .9 27%, 1.06 36%, 1.1 42%, 1.06 52%, .99 64%, 1.005 78%, 1); }
}
html[data-rt-dir=back] { --rt-nudge: -24px; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
:where(button, input, select, textarea) { border: 0; font: inherit; color: inherit; background: none; }
:where(button) { cursor: pointer; }
:where(a) { color: inherit; }
:where(h1, h2, h3, h4, p, ul, ol, figure, dl, dd) { margin: 0; }
:where(ul, ol) { padding: 0; list-style: none; }
:where(img, svg, video) { display: block; max-width: 100%; }
:focus-visible { outline: var(--rule-focus); outline-offset: 2px; }
::selection { background: var(--lime); color: var(--ink); }
[hidden] { display: none !important; }

html { background: var(--ground-deep); scrollbar-gutter: stable; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  font: 400 var(--fs-body)/1.35 var(--f-ui); color: var(--frost);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  /* §3b atmosphere (scrolling layers): coral glows left/right, violet mist, ground gradient */
  background:
    radial-gradient(calc(360 * var(--u)) calc(700 * var(--u)) at 0 calc(1650 * var(--u)), rgba(176, 80, 80, .38), rgba(124, 52, 96, .22) 45%, transparent 75%),
    radial-gradient(calc(300 * var(--u)) calc(600 * var(--u)) at 100% calc(1150 * var(--u)), rgba(124, 52, 96, .45), transparent 72%),
    radial-gradient(calc(520 * var(--u)) calc(340 * var(--u)) at 18% 62%, rgba(95, 40, 97, .25), transparent 70%),
    radial-gradient(calc(640 * var(--u)) calc(380 * var(--u)) at 72% 30%, rgba(95, 40, 97, .22), transparent 70%),
    radial-gradient(calc(560 * var(--u)) calc(420 * var(--u)) at 55% 88%, rgba(95, 40, 97, .25), transparent 70%),
    linear-gradient(180deg, #2C1243 0%, #3C1C66 35%, #501E67 55%, #37195A 100%);
  background-color: var(--paper);
}
/* fixed layers: storm-lantern glow (flickers) + grain */
.atm-lantern {
  position: fixed; z-index: 0; pointer-events: none;
  top: calc(-250 * var(--u)); right: calc(-350 * var(--u));
  width: calc(700 * var(--u)); height: calc(500 * var(--u));
  background: radial-gradient(closest-side, rgba(248, 132, 53, .7), rgba(166, 75, 59, .35) 45%, transparent 100%);
  animation: lantern 3.6s ease-in-out infinite;
}
@keyframes lantern { 0%, 100% { opacity: 1; } 22% { opacity: .88; } 30% { opacity: .97; } 58% { opacity: .85; } 70% { opacity: .95; } }
.atm-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- ONE PAGE FRAME ---------- */
.page { position: relative; z-index: 1; padding: 0 var(--gut-r) calc(14 * var(--u)) var(--gut-l); }
main { display: block; min-height: 60vh; }
main:focus { outline: none; }
/* route sections stack with one shared gap; routes never set max-width / side padding / background */
main > * + * { margin-top: var(--sec-gap); }
main > :first-child { margin-top: 0; }
.frame-top { padding-top: calc(20 * var(--u)); }

/* ---------- RAIL (N8) — fixed, full height: nothing scrolls under it ---------- */
.chrome-nav { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: var(--rail-w); }
.rail {
  z-index: 20; left: calc(6 * var(--u)); top: calc(6 * var(--u)); bottom: calc(6 * var(--u)); right: calc(6 * var(--u));
  display: flex; flex-direction: column; align-items: stretch;
  padding: calc(34 * var(--u)) calc(16 * var(--u)) calc(40 * var(--u));
  border-radius: var(--r-rail);
  overflow-y: auto; scrollbar-width: none;
  color: var(--ink);
}
.rail::-webkit-scrollbar { display: none; }
.rail-brand { display: grid; justify-items: center; gap: calc(8 * var(--u)); text-decoration: none; margin-bottom: calc(44 * var(--u)); }
.brand-mark { width: auto; height: calc(150 * var(--u)); min-height: 40px; object-fit: contain;
  /* the mockup draws the mark with a dark violet edge on the steel rail: ink outline + hard shadow (keeps ΔL ≥ 60 vs the rail) */
  --mk: max(1.5px, calc(3 * var(--u)));
  filter: drop-shadow(var(--mk) 0 0 #2E0A52) drop-shadow(calc(-1 * var(--mk)) 0 0 #2E0A52) drop-shadow(0 var(--mk) 0 #2E0A52) drop-shadow(0 calc(-1 * var(--mk)) 0 #2E0A52) drop-shadow(0 calc(4 * var(--u)) 0 rgba(46, 36, 87, .6)); }
.brand-word { font: 700 calc(38 * var(--u))/1 var(--f-display); letter-spacing: .01em; color: var(--ink); }
.rail-links { display: grid; gap: calc(8 * var(--u)); }
.rail-links a, .rail-soc {
  display: flex; align-items: center; gap: calc(18 * var(--u));
  min-height: var(--h-ctl); padding: 0 calc(22 * var(--u));
  border-radius: var(--r-ctl); text-decoration: none;
  font: 500 var(--fs-nav)/1 var(--f-ui); color: var(--ink);
  transition: transform var(--t-throw) var(--ease-throw), background-color var(--t-quick);
}
.rail-links a { border: max(1px, calc(3 * var(--u))) solid transparent; }
.rail-links a:hover { background: rgba(204, 185, 253, .45); transform: translateX(calc(4 * var(--u))); }
.rail-links a.is-active { background: var(--lime); border: var(--rule-rail-active); box-shadow: 0 calc(4 * var(--u)) 0 rgba(46, 36, 87, .35); font-weight: 600; }
.rail-links a.is-active:hover { transform: none; }
.ico { width: calc(26 * var(--u)); height: calc(26 * var(--u)); min-width: 18px; min-height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico-fill { fill: currentColor; stroke: none; }
.rail-fill { flex: 1 1 auto; min-height: calc(40 * var(--u)); }
.rail-social { display: grid; gap: calc(4 * var(--u)); padding-top: calc(22 * var(--u)); margin-bottom: calc(26 * var(--u)); }
.rail-soc { min-height: calc(50 * var(--u)); }
.rail-soc.is-soon { opacity: .72; cursor: default; }
.rail-soc.is-soon::after { content: "soon"; margin-left: auto; font: 500 var(--fs-small)/1 var(--f-ui); color: var(--ink-soft); }
.btn.rail-wallet { width: 100%; justify-content: center; gap: calc(10 * var(--u)); font-size: max(12px, calc(19 * var(--u))); min-height: calc(62 * var(--u)); padding: 0 calc(8 * var(--u)); }
.rail-wallet .ico { width: calc(22 * var(--u)); height: calc(22 * var(--u)); }
.rail-wallet.is-connected { background: var(--lavender); }

/* ---------- FOOTER (F6) ---------- */
.chrome-footer { margin-top: var(--sec-gap); }
.ticker {
  position: relative; display: flex; align-items: center; gap: calc(22 * var(--u));
  min-height: calc(86 * var(--u)); padding: calc(10 * var(--u)) calc(34 * var(--u));
  border-radius: calc(14 * var(--u)); color: var(--frost);
}
.foot-mark { height: calc(46 * var(--u)); min-height: 36px; width: auto; flex: none; }
.ecg-slot { display: block; width: calc(110 * var(--u)); height: calc(44 * var(--u)); flex: none; }
.ticker-line { display: flex; align-items: baseline; gap: calc(14 * var(--u)); flex: 1 1 auto; justify-content: center; font: 500 var(--fs-ticker)/1.2 var(--f-ui); white-space: nowrap; }
.ticker-line .num { font-weight: 500; }
.ticker .dot, .ticker-links i { font-style: normal; opacity: .7; }
.state-word { font: 700 calc(25 * var(--u))/1 var(--f-display); letter-spacing: .02em; color: var(--lime); text-shadow: 0 0 calc(10 * var(--u)) rgba(185, 238, 94, .55); }
.state-word[data-state="DUE"] { color: #FFC56B; text-shadow: 0 0 calc(10 * var(--u)) rgba(255, 197, 107, .55); }
.state-word[data-state="DOWN"] { color: var(--alarm); text-shadow: 0 0 calc(10 * var(--u)) rgba(255, 90, 104, .6); }
.state-word[data-state="DISARMED"] { color: var(--lavender); text-shadow: none; }
.ticker-div { align-self: stretch; margin: calc(8 * var(--u)) 0; }
.ticker-links { display: flex; align-items: center; gap: calc(12 * var(--u)); font: 500 var(--fs-body)/1 var(--f-ui); white-space: nowrap; }
.ticker-links a { text-decoration: none; }
.ticker-links a:hover { color: var(--lime); }
.ticker-links a.is-soon { opacity: .7; cursor: default; }

/* ---------- SURFACES ---------- */
.panel {
  position: relative; color: var(--ink); border-radius: var(--r-panel);
  background-color: var(--surface);
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), var(--face-steel);
  background-size: var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), 100% 100%;
  background-position: left var(--rv-o) top var(--rv-o), right var(--rv-o) top var(--rv-o), left var(--rv-o) bottom var(--rv-o), right var(--rv-o) bottom var(--rv-o), 0 0;
  background-repeat: no-repeat;
  box-shadow: var(--sh-panel), inset 0 max(1px, calc(2 * var(--u))) 0 #F8FCFF;
}
.panel.rail { position: absolute; }
.panel.no-rivets { background-image: var(--face-steel); background-size: 100% 100%; background-position: 0 0; }
.panel-pad { padding: calc(30 * var(--u)) calc(34 * var(--u)); }
.panel-dark {
  background-color: var(--footer);
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), var(--face-dark);
  background-size: var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), 100% 100%;
  background-position: left var(--rv-o) top var(--rv-o), right var(--rv-o) top var(--rv-o), left var(--rv-o) bottom var(--rv-o), right var(--rv-o) bottom var(--rv-o), 0 0;
  background-repeat: no-repeat;
  box-shadow: 0 0 calc(18 * var(--u)) rgba(255, 90, 95, .18), 0 calc(6 * var(--u)) 0 rgba(20, 6, 40, .6);
}
.well { background: var(--surface-container); border-radius: var(--r-ctl); }

/* ---------- TYPE ---------- */
.t-hero { font: 700 var(--fs-hero)/1 var(--f-display); letter-spacing: .015em; text-transform: uppercase; color: var(--frost); }
.t-hero em { font-style: normal; color: var(--lime); }
.t-sub { font: 400 var(--fs-sub)/1.3 var(--f-ui); color: var(--frost); }
.t-title { font: 700 var(--fs-title)/1.05 var(--f-display); letter-spacing: .01em; text-transform: uppercase; }
.t-panel { font: 700 var(--fs-panel)/1.1 var(--f-display); text-transform: uppercase; color: var(--ink); }
.t-label { font: 500 var(--fs-label)/1.2 var(--f-ui); color: var(--ink-soft); }
.t-num { font: 600 var(--fs-num)/1 var(--f-ui); letter-spacing: .01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.t-body { font: 400 var(--fs-body)/1.35 var(--f-ui); }
.t-small { font: 400 var(--fs-small)/1.3 var(--f-ui); }
.t-code, code, pre { font-family: var(--f-code); font-size: var(--fs-code); }
.on-steel { color: var(--ink); }
.tw-pretty, p { text-wrap: pretty; }

/* ---------- CONTROLS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(10 * var(--u));
  min-height: var(--h-btn); padding: 0 calc(28 * var(--u)); border-radius: var(--r-ctl);
  font: 600 var(--fs-btn)/1 var(--f-display); color: var(--ink); text-decoration: none; white-space: nowrap;
  transition: transform var(--t-throw) var(--ease-throw), filter var(--t-quick);
}
.btn:hover { transform: translateY(calc(-2 * var(--u))); filter: brightness(1.04); }
.btn:active { transform: translateY(calc(3 * var(--u))); transition-duration: 80ms; }
.btn-lime { background: linear-gradient(180deg, #CBF57F, var(--lime) 60%, #A9DE4D); box-shadow: 0 calc(4 * var(--u)) 0 var(--lime-deep), 0 calc(8 * var(--u)) calc(16 * var(--u)) rgba(20, 6, 40, .25); }
.btn-lav { background: linear-gradient(180deg, #DCCDFF, var(--lavender) 60%, #BCA6F7); box-shadow: 0 calc(4 * var(--u)) 0 var(--lavender-deep), 0 calc(8 * var(--u)) calc(16 * var(--u)) rgba(20, 6, 40, .25); }
.btn-alarm { background: var(--alarm-chip); box-shadow: 0 calc(4 * var(--u)) 0 #D9808E; }
.btn-sm { min-height: calc(46 * var(--u)); padding: 0 calc(18 * var(--u)); font-size: max(12px, calc(19 * var(--u))); }
.btn:disabled, .btn.is-soon, .btn[aria-disabled="true"] {
  background: var(--disabled); color: var(--disabled-ink); box-shadow: inset 0 calc(2 * var(--u)) 0 rgba(255, 255, 255, .5); cursor: not-allowed; transform: none; filter: none;
}
.tba { display: inline-flex; align-items: center; min-height: calc(30 * var(--u)); padding: 0 calc(12 * var(--u)); border-radius: var(--r-chip); background: rgba(122, 127, 149, .35); font: 600 var(--fs-small)/1 var(--f-ui); font-style: normal; color: #F4F6FB; }
[data-launch-done] .tba { display: none; }
.btn.btn-lime[data-launch-done] { cursor: pointer; }

.field { display: flex; align-items: center; min-height: var(--h-ctl); padding: 0 calc(16 * var(--u)); background: var(--frost); border-radius: var(--r-ctl); }
.field > input, .field > select { flex: 1 1 auto; min-width: 0; height: 100%; min-height: calc(var(--h-ctl) - 6 * var(--u)); font: 400 var(--fs-body)/1 var(--f-ui); color: var(--ink); }
.field > input::placeholder { color: #8B90B5; }
.field:focus-within { box-shadow: 0 0 0 max(2px, calc(3 * var(--u))) rgba(185, 238, 94, .8); }
.field > input:focus-visible, .field > select:focus-visible { outline: none; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; overflow: hidden; border-radius: var(--r-ctl); background: var(--surface-container); }
.seg > button { display: inline-flex; align-items: center; justify-content: center; gap: calc(8 * var(--u)); min-height: var(--h-ctl); padding: 0 calc(18 * var(--u)); font: 600 max(13px, calc(20 * var(--u)))/1 var(--f-display); color: var(--ink); transition: background-color var(--t-quick); }
.seg > button + button { border-left: var(--rule-row); }
.seg > button[aria-pressed="true"], .seg > button.is-on { background: var(--lime); }
.seg > button:hover:not([aria-pressed="true"]):not(.is-on) { background: rgba(204, 185, 253, .4); }

.chip { display: inline-flex; align-items: center; gap: calc(8 * var(--u)); min-height: calc(40 * var(--u)); padding: 0 calc(16 * var(--u)); border-radius: var(--r-chip); background: var(--surface-container); font: 600 var(--fs-small)/1 var(--f-display); color: var(--ink); white-space: nowrap; }
.chip-lime { background: var(--lime); }
.chip-lav { background: var(--lavender); }
.chip-alarm { background: var(--alarm-chip); color: #8E1730; }
.chip-chain { background: var(--chain); color: #0F4A40; }

/* ---------- BOLT PLATE (ARMED / DUE / DOWN / DISARMED) ---------- */
.plate {
  position: relative; display: flex; align-items: center; gap: calc(26 * var(--u));
  min-height: calc(126 * var(--u)); padding: 0 calc(34 * var(--u));
  border-radius: calc(12 * var(--u)); color: var(--lime-glow);
  background-color: var(--plate);
  background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), linear-gradient(180deg, #2A1030, #46193E 55%, #2E1029);
  background-size: var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), 100% 100%;
  background-position: left var(--rv-o) top var(--rv-o), right var(--rv-o) top var(--rv-o), left var(--rv-o) bottom var(--rv-o), right var(--rv-o) bottom var(--rv-o), 0 0;
  background-repeat: no-repeat;
}
.plate-word { font: 700 var(--fs-status)/1 var(--f-display); letter-spacing: .02em; text-shadow: 0 0 calc(12 * var(--u)) rgba(199, 252, 202, .65); }
.plate[data-state="DUE"] { color: #FFD48A; }
.plate[data-state="DOWN"] { color: #FF6B7A; background-image: var(--rivet), var(--rivet), var(--rivet), var(--rivet), linear-gradient(180deg, #6A1B3E, var(--plate-down)); }
.plate[data-state="DOWN"] .plate-word { text-shadow: 0 0 calc(12 * var(--u)) rgba(255, 90, 104, .7); }
.plate[data-state="DISARMED"] { color: var(--lavender); }

/* ---------- ECG (heartbeat trace) — SVG stamped by app.js into [data-ecg] ---------- */
.ecg { display: block; width: 100%; height: 100%; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 30%, #000 85%, transparent); }
.ecg path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ecg .ecg-run { animation: ecg-run var(--beat) linear infinite; }
.ecg .ecg-flat { opacity: 0; }
@keyframes ecg-run { from { transform: translateX(0); } to { transform: translateX(-100px); } }
[data-ecg="lime"] { color: #7CF08A; filter: drop-shadow(0 0 calc(5 * var(--u)) rgba(124, 240, 138, .8)); }
[data-ecg="red"] { color: #FF3B5C; filter: drop-shadow(0 0 calc(6 * var(--u)) rgba(255, 59, 92, .85)); }
[data-ecg].is-flat .ecg-run { opacity: 0; animation: none; }
[data-ecg].is-flat .ecg-flat { opacity: 1; }
[data-ecg].is-fast .ecg-run { animation-duration: .5s; }

/* ---------- BOUNDARY BAND + TOKEN STRIP (shared components) ---------- */
.band { display: flex; align-items: center; justify-content: center; min-height: calc(58 * var(--u)); padding: 0 calc(48 * var(--u)); border-radius: calc(12 * var(--u));
  background-color: #C8CBF4; background-image: var(--rivet), var(--rivet), linear-gradient(180deg, #D6D4FA, #C1C3F0);
  background-size: var(--rv-s) var(--rv-s), var(--rv-s) var(--rv-s), 100% 100%; background-position: left calc(14 * var(--u)) center, right calc(14 * var(--u)) center, 0 0; background-repeat: no-repeat;
  box-shadow: 0 calc(5 * var(--u)) 0 rgba(46, 36, 87, .45);
  font: italic 600 max(13px, calc(22 * var(--u)))/1.2 var(--f-display); color: var(--ink); text-align: center; }
.token-strip { display: grid; gap: calc(16 * var(--u)); padding: calc(26 * var(--u)) calc(52 * var(--u)) calc(30 * var(--u)); }
.token-row { display: flex; align-items: center; gap: calc(26 * var(--u)); flex-wrap: wrap; }
.token-name { font: 700 calc(36 * var(--u))/1 var(--f-display); color: var(--ink); white-space: nowrap; }
.token-name .sep { margin: 0 calc(10 * var(--u)); }
.token-ca { display: inline-flex; align-items: center; gap: calc(12 * var(--u)); font: 600 max(13px, calc(22 * var(--u)))/1 var(--f-display); }
.ca-val { display: inline-flex; align-items: center; min-height: calc(46 * var(--u)); padding: 0 calc(24 * var(--u)); border-radius: var(--r-ctl); background: var(--frost); font: 600 max(13px, calc(19 * var(--u)))/1 var(--f-ui); color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-vr { align-self: stretch; }
.token-social { display: inline-flex; gap: calc(22 * var(--u)); color: var(--ink); }
.token-social .ico { width: calc(34 * var(--u)); height: calc(34 * var(--u)); }
.token-social a.is-soon { opacity: .6; cursor: default; }
.token-meta { display: flex; align-items: center; gap: calc(26 * var(--u)); flex-wrap: wrap; font: 400 var(--fs-body)/1.3 var(--f-ui); color: var(--ink); }
.howto summary { cursor: pointer; font: 600 var(--fs-body)/1.3 var(--f-display); color: var(--ink); }
.howto p { margin-top: calc(8 * var(--u)); font: 400 var(--fs-body)/1.45 var(--f-ui); color: var(--ink); max-width: none; }

/* ---------- TOAST ---------- */
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(28 * var(--u)); translate: -50% 0; padding: calc(14 * var(--u)) calc(24 * var(--u)); border-radius: var(--r-ctl); background: var(--footer); color: var(--frost); font: 600 var(--fs-body)/1.2 var(--f-display); box-shadow: 0 calc(6 * var(--u)) 0 rgba(20, 6, 40, .6); }

/* ================= BORDER CLASSES (the ONLY border/outline declarations of the site) ================= */
.rule-panel { border: var(--rule-panel); }
.rule-panel-shadow-edge { box-shadow: var(--sh-panel), 0 0 0 max(1px, calc(4 * var(--u))) #2D0852; }  /* outer dark edge = shadow, never a 2nd border */
.rule-plate { border: var(--rule-plate-outer); box-shadow: inset 0 0 0 max(1px, calc(3.6 * var(--u))) var(--rule-plate-inner), 0 calc(5 * var(--u)) 0 rgba(20, 6, 40, .55); }
.rule-input { border: var(--rule-input); }
.rule-value { border: var(--rule-value); }
.rule-btn-primary { border: var(--rule-btn-primary); }
.rule-btn-secondary { border: var(--rule-btn-secondary); }
.rule-btn-alarm { border: var(--rule-btn-alarm); }
.rule-rail-active { border: var(--rule-rail-active); }
.rule-rail-wallet { border: var(--rule-rail-wallet); }
.rule-seg { border: var(--rule-seg); }
.rule-toggle-card { border: var(--rule-toggle-card); }
.rule-select { border: var(--rule-select); }
.rule-code { border: var(--rule-code); }
.rule-ticket { border: var(--rule-ticket); }
.rule-chip { border: var(--rule-chip); }
.rule-footer { border: var(--rule-footer); }
.rule-row { border-bottom: var(--rule-row); }
.rule-row-top { border-top: var(--rule-row); }
.rule-row-v { border-left: var(--rule-row); }
.rule-rail-divider { border-top: var(--rule-rail-divider); }
/* stacked rows / tickets: only the lower item draws the shared edge (never doubled) */
.rule-rows > * + * { border-top: var(--rule-row); }
.rule-cols > * + * { border-left: var(--rule-row); }
.rule-stack > * + * { border-top: 0; }
/* button classes carry their measured frame */
.btn-lime { border: var(--rule-btn-primary); }
.btn-lav { border: var(--rule-btn-secondary); }
.btn-alarm { border: var(--rule-btn-alarm); }
.btn:disabled, .btn.is-soon, .btn[aria-disabled="true"] { border: max(1px, calc(3 * var(--u))) solid #D6DBE6; }
.rail.panel { border: var(--rule-panel); }
.rail-links a.is-active { border: var(--rule-rail-active); }

/* ================= MOTION helpers (DESIGN §10) ================= */
/* reveal = "latch in": slides in from the left like a bolt and settles on the spring */
.rv-pre { opacity: 0; transform: translateX(calc(-22 * var(--u))); }
.rv-in { opacity: 1; transform: none; transition: opacity 240ms linear, transform var(--t-throw) var(--ease-throw); }
/* live tick = a short lime glow over the cell */
.tick { position: relative; }
.tick::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(185, 238, 94, .55); opacity: 0; pointer-events: none; }
.tick.is-ticked::after { animation: tick 700ms ease-out; }
@keyframes tick { 0% { opacity: .9; } 100% { opacity: 0; } }
/* bolt throw (state change): the element jumps a short stroke and lands with the spring */
.throw { animation: throw var(--t-throw) var(--ease-throw); }
@keyframes throw { from { transform: translateX(calc(-18 * var(--u))); } to { transform: none; } }
/* route change: kit router v3 View Transition, tuned by --rt-nudge / --rt-dur above */

@supports ((animation-timeline: view()) and (animation-range: entry)) {
  .art-drift { animation: art-drift linear both; animation-timeline: view(); animation-range: cover; }
  @keyframes art-drift { from { transform: translateY(calc(-12 * var(--u))); } to { transform: translateY(calc(12 * var(--u))); } }
}

@media (prefers-reduced-motion: reduce) {
  .atm-lantern, .ecg .ecg-run, .throw, .tick.is-ticked::after, .art-drift { animation: none !important; }
  .rv-pre { opacity: 1; transform: none; }
  .btn, .rail-links a { transition: none; }
}

/* ================= 1024–1279: rail stays, things re-flow ================= */
@media (max-width: 1279px) and (min-width: 1024px) {
  :root { --fs-sub: max(14px, calc(24 * var(--u))); }
}

/* ================= < 1024: top strip + bottom tab bar ================= */
@media (max-width: 1023px) {
  :root { --u: clamp(.5px, calc(100vw / 760), 1.2px); --gut-l: 12px; --gut-r: 12px; --sec-gap: 14px; --fs-hero: 34px; --fs-title: 28px; --fs-panel: 22px; --fs-status: 40px; }
  .chrome-nav { position: sticky; top: 0; bottom: auto; width: auto; }
  .panel.rail { position: relative; }
  .rail {
    top: 0; left: auto; bottom: auto; right: auto; width: auto; margin: 0;
    flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px;
    border-radius: 0 0 14px 14px; overflow: visible;
  }
  .rail.panel { background-image: var(--face-steel); background-size: 100% 100%; background-position: 0 0; }
  .rail-brand { grid-auto-flow: column; align-items: center; gap: 8px; margin: 0; }
  .brand-mark { height: 40px; min-height: 0; }
  .brand-word { font-size: 22px; }
  .rail-fill { flex: 1; min-height: 0; }
  .rail-social { display: flex; padding: 0; margin: 0; gap: 2px; }
  .rail-social.rule-rail-divider { border-top: 0; }
  .rail-soc { min-height: 40px; padding: 0 8px; gap: 6px; }
  .rail-soc span, .rail-soc.is-soon::after { display: none; }
  .btn.rail-wallet { width: auto; min-height: 40px; font-size: 14px; padding: 0 12px; }
  .rail-wallet span { display: none; }
  .rail-links {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    grid-template-columns: repeat(5, 1fr); gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #E3E8F3, #C9D0E0); box-shadow: 0 -4px 0 rgba(46, 36, 87, .55);
  }
  .rail-links a { flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 0 2px; font-size: 12px; }
  .rail-links a:hover { transform: none; }
  .page { padding: 12px var(--gut-r) 84px var(--gut-l); }
  .ticker { flex-wrap: wrap; justify-content: center; gap: 10px; padding: 14px 16px; }
  .ticker-line { flex-wrap: wrap; white-space: normal; gap: 6px; font-size: 14px; }
  .ticker-div, .ecg-slot[data-ecg="red"] { display: none; }
  .ticker-links { flex-wrap: wrap; justify-content: center; }
  .foot-mark { height: 36px; }
  .state-word { font-size: 16px; }
  .token-strip { padding: 18px; }
  .token-name { font-size: 20px; white-space: normal; }
  .token-vr { display: none; }
  .btn { min-height: 44px; }
}
