/* ============================================================
   EV Charging Cost Calculator — design system
   ------------------------------------------------------------
   Direction: Editorial / precision instrument.
   The page reads like a printed spec sheet that happens to be
   alive: warm paper, hairline rules, square corners, one deep
   forest accent — and light that travels along the rules.

   Deliberately NOT: centered hero, rounded card stacks, default
   blue, puffy soft shadows, rainbow gradient borders.

   Layers, in order:
     1 tokens  →  2 base & typography  →  3 atmosphere
     4 beam    →  5 orb               →  6 components
     7 motion orchestration (reduced-motion safe throughout)
   ============================================================ */

/* ============================================================
   1. TOKENS
   Primitives first, then semantic aliases. Nothing below this
   block hard-codes a colour, a duration or a spacing value.
   ============================================================ */

:root {
  /* -- Air Slate Canvas & Pristine Glass Surfaces -- */
  --paper:        #f8fafc;   /* Slate-50 clean canvas */
  --paper-2:      #ffffff;   /* Crisp white card surface */
  --paper-3:      #f1f5f9;   /* Slate-100 raised / secondary */
  --ink:          #0f172a;   /* Slate-900 high contrast */
  --ink-2:        #334155;   /* Slate-700 body text */
  --ink-3:        #64748b;   /* Slate-500 secondary / meta */
  --ink-4:        #94a3b8;   /* Slate-400 subtle */
  --rule:         #e2e8f0;   /* Slate-200 delicate rule */
  --rule-strong:  #cbd5e1;   /* Slate-300 input border */

  /* -- Electric Emerald & Cyber Cyan Energy Accents -- */
  --accent:       #10b981;   /* Electric emerald */
  --accent-ink:   #059669;   /* Deep emerald hover */
  --signal:       #06b6d4;   /* Cyan-500 beam arc */
  --signal-hot:   #34d399;   /* Mint-400 hot core */
  --signal-white: #ffffff;   /* Pure white beam peak */
  --brass:        #38bdf8;   /* Sky-400 beam tail */

  /* -- Semantic State -- */
  --warn:         #d97706;
  --warn-bg:      #fffbeb;
  --err:          #ef4444;

  /* -- Modern Tech Typography (Apple / Tesla / Linear stack) -- */
  --font-serif: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:  ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  --fs-2xs:  .72rem;
  --fs-xs:   .80rem;
  --fs-sm:   .875rem;
  --fs-base: 1rem;
  --fs-md:   1.125rem;
  --fs-lg:   1.35rem;
  --fs-xl:   1.65rem;
  --fs-2xl:  clamp(1.85rem, 3.4vw, 2.3rem);
  --fs-3xl:  clamp(2.1rem, 4.4vw, 2.85rem);
  --fs-figure: clamp(2.5rem, 5.8vw, 3.6rem);

  --lh-tight: 1.15;
  --lh-snug:  1.32;
  --lh-body:  1.62;
  --track-tight: -.028em;
  --track-wide:  .08em;

  /* -- Space: 4pt system -- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  /* -- Modern Radii & Elevation Shadows -- */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 36px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 24px -4px rgba(16, 185, 129, 0.35);

  /* -- Motion -- */
  --dur-instant: 120ms;
  --dur-fast:    180ms;
  --dur-base:    280ms;
  --dur-slow:    450ms;
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-in:     cubic-bezier(.7, 0, .84, 0);
  --ease-inout:  cubic-bezier(.65, 0, .35, 1);

  /* -- Beam geometry -- */
  --beam-w: 2px;
  --beam-idle: 24s;
  --beam-live:  6s;
  --beam-glow: none;
  --beam-glow-on: drop-shadow(0 0 6px rgba(16, 185, 129, 0.45));

  /* -- Layout & depth -- */
  --measure: 68ch;
  --shell:   76rem;
  --z-sticky: 30;
  --z-cookie: 60;
  --z-skip:  100;

  --halo: 0 0 0 1px rgba(16, 185, 129, 0.35), 0 0 20px -4px rgba(16, 185, 129, 0.25);

  /* -- Semantic aliases -- */
  --color-bg:      var(--paper);
  --color-surface: var(--paper-2);
  --color-raised:  var(--paper-3);
  --color-text:    var(--ink);
  --color-muted:   var(--ink-3);
  --color-border:  var(--rule);
  --color-accent:  var(--accent);

  /* -- Atmosphere washes -- */
  --atmo-a:      rgba(16, 185, 129, 0.06);
  --atmo-b:      rgba(6, 182, 212, 0.05);
  --panel-wash:  rgba(241, 245, 249, 0.65);
  --beam-arc-0:  rgba(16, 185, 129, 0);
  --beam-arc-95: rgba(16, 185, 129, 0.95);
  --beam-tail:   rgba(6, 182, 212, 0.85);
  --sel-tint:    rgba(16, 185, 129, 0.22);
}

/* ------------------------------------------------------------
   Dark theme: Cyber Obsidian Cockpit
   ------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #090d16;   /* Deep space canvas */
    --paper-2:      #111827;   /* Glass card surface */
    --paper-3:      #1e293b;   /* Raised telemetry surface */
    --ink:          #f8fafc;   /* Pure radiant white */
    --ink-2:        #cbd5e1;   /* Slate-300 */
    --ink-3:        #94a3b8;   /* Slate-400 */
    --ink-4:        #64748b;   /* Slate-500 */
    --rule:         rgba(255, 255, 255, 0.08);
    --rule-strong:  rgba(255, 255, 255, 0.16);

    --accent:       #10b981;   /* Neon mint emerald */
    --accent-ink:   #34d399;   /* Luminous hover */
    --signal:       #06b6d4;   /* Cyan beam */
    --signal-hot:   #38bdf8;   /* Hot sky beam */
    --brass:        #34d399;

    --warn:         #f59e0b;
    --warn-bg:      rgba(245, 158, 11, 0.12);
    --err:          #f87171;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 28px -4px rgba(16, 185, 129, 0.45);

    --atmo-a:      rgba(16, 185, 129, 0.12);
    --atmo-b:      rgba(6, 182, 212, 0.08);
    --panel-wash:  rgba(17, 24, 39, 0.85);
    --beam-arc-0:  rgba(16, 185, 129, 0);
    --beam-arc-95: rgba(16, 185, 129, 0.95);
    --beam-tail:   rgba(56, 189, 248, 0.85);
    --sel-tint:    rgba(16, 185, 129, 0.35);

    --halo: 0 0 0 1px rgba(16, 185, 129, 0.4), 0 0 24px -4px rgba(16, 185, 129, 0.35);
  }
}

:root { color-scheme: light dark; }

/* ============================================================
   2. BASE & TYPOGRAPHY
   ============================================================ */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* No-JS users never see the calculator's preparing state. */
.calc__boot { display: none; }
.js .calc__boot { display: flex; }

/* ---------- skip link ---------- */
.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: var(--sp-3) var(--sp-4); z-index: var(--z-skip);
  border-radius: var(--r-sm);
}
.skip:focus { left: var(--sp-4); top: var(--sp-4); }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0;
  border-bottom: 1px solid var(--rule);
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: var(--z-sticky);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
@media (prefers-color-scheme: dark) {
  .masthead {
    background: rgba(9, 13, 22, 0.82);
  }
}

.masthead__inner {
  max-width: var(--shell); margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap;
}

.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
}
.wordmark::before {
  content: ""; display: inline-block; width: 22px; height: 22px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2' fill='%2310b981' fill-opacity='0.2'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}
.wordmark span { color: var(--accent); }

.masthead nav { margin-left: auto; display: flex; gap: var(--sp-1); flex-wrap: wrap; }

.masthead nav a {
  position: relative;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em;
  color: var(--ink-2); text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--r-full);
  transition: all var(--dur-fast) var(--ease-out);
}
.masthead nav a:hover {
  color: var(--accent-ink);
  background: rgba(16, 185, 129, 0.08);
}
.masthead nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.wrap { max-width: var(--shell); margin: 0 auto; padding: 0 var(--sp-5); }
main { padding: var(--sp-7) 0 var(--sp-8); }
.measure { max-width: var(--measure); }

.doc { max-width: var(--shell); }
.doc > :is(h1, h2, p, .lede, .eyebrow, .rates, .notice, .sources, .faq, .result-grid, .table-scroll) {
  max-width: var(--measure);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--track-wide);
  text-transform: uppercase; color: var(--accent);
  background: rgba(16, 185, 129, 0.08);
  padding: 4px 12px; border-radius: var(--r-full);
  margin: 0 0 var(--sp-3);
}

/* ---------- headings ---------- */
h1 {
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight); font-weight: 800;
  letter-spacing: var(--track-tight);
  color: var(--ink);
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}

h2 {
  position: relative;
  font-size: var(--fs-xl); line-height: var(--lh-snug); font-weight: 700;
  letter-spacing: -.02em; color: var(--ink);
  margin: var(--sp-7) 0 var(--sp-3);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
  text-wrap: balance;
}
h2::before {
  content: ""; position: absolute; top: -1px; left: 0;
  width: 36px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--signal));
}

h3 {
  font-size: var(--fs-md); font-weight: 700; letter-spacing: -.01em;
  margin: var(--sp-6) 0 var(--sp-2);
}
h4 { font-size: .95rem; font-weight: 700; margin: var(--sp-5) 0 var(--sp-1); }

p { margin: 0 0 var(--sp-4); }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--sel-tint); }

ul, ol { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); }
li { margin: var(--sp-1) 0; }
li > ul, li > ol { margin: var(--sp-1) 0; }

strong { font-weight: 700; color: var(--ink); }

blockquote {
  margin: var(--sp-5) 0; padding: var(--sp-2) 0 var(--sp-2) var(--sp-4);
  border-left: 3px solid var(--accent);
  color: var(--ink-2); font-size: .97rem;
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--paper-3); padding: .14em .42em;
  border: 1px solid var(--rule); border-radius: var(--r-xs);
}
pre {
  background: var(--paper-2); border: 1px solid var(--rule);
  padding: var(--sp-4); overflow-x: auto; border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: .85rem; line-height: 1.55;
  box-shadow: var(--shadow-sm);
}
pre code { background: none; border: 0; padding: 0; }

/* Tabular figures for aligned data */
.result-lead, .result-cell dd, .compare td, .range-val, .savings strong,
.meta b, .rates b, .card-grid .c-meta {
  font-variant-numeric: tabular-nums;
}

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin: 0 0 var(--sp-5); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td {
  text-align: left; vertical-align: top;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) 0;
  border-bottom: 1px solid var(--rule);
}
th {
  font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
}
td:last-child, th:last-child { padding-right: 0; }

/* ---------- meta strip ---------- */
.meta {
  display: flex; gap: var(--sp-5); flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--ink-3);
  padding: var(--sp-3) var(--sp-4); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
}
.meta b { color: var(--ink-2); font-weight: 600; }

/* ---------- notice ---------- */
.notice {
  position: relative;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  background: var(--warn-bg);
  color: var(--ink);
  padding: var(--sp-3) var(--sp-4); margin: var(--sp-5) 0;
  font-size: .93rem;
}
.notice::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--warn);
}
.notice--plain { background: var(--paper-2); }
.notice--plain::before { background: var(--rule-strong); }
.notice p:last-child { margin-bottom: 0; }

/* ---------- affiliate disclosure ---------- */
.affiliate-disclosure {
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper-2);
  padding: var(--sp-3) var(--sp-4); margin: var(--sp-5) 0;
  font-size: .86rem; color: var(--ink-2);
}
.affiliate-disclosure[hidden] { display: none; }

/* ---------- trademark notice ---------- */
.tm-notice {
  font-size: var(--fs-xs); color: var(--ink-3);
  border-left: 3px solid var(--rule-strong);
  padding-left: var(--sp-4); margin: var(--sp-6) 0;
}

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  margin-top: var(--sp-8); padding: var(--sp-7) 0 var(--sp-8);
  font-size: var(--fs-sm); color: var(--ink-2);
}
footer.site .cols {
  display: grid; gap: var(--sp-6) var(--sp-6);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
footer.site h4 {
  font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 var(--sp-3);
}
.legal-links { list-style: none; margin: 0; padding: 0; }
.legal-links li { margin: var(--sp-2) 0; }
.legal-links a {
  color: var(--ink-2); text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.legal-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.legal-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.footer-legal {
  margin-top: var(--sp-7); padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-xs); color: var(--ink-3);
  display: grid; gap: var(--sp-2);
}
.footer-legal p { margin: 0; }

/* ---------- 404 ---------- */
.notfound { padding: var(--sp-7) 0 var(--sp-8); }
.notfound ul { margin-top: var(--sp-5); }

/* ============================================================
   3. ATMOSPHERE
   ============================================================ */

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(55rem 32rem at 50% -12%, var(--atmo-a), transparent 70%),
    radial-gradient(45rem 28rem at 95% 10%, var(--atmo-b), transparent 60%);
}

.masthead, main, footer.site { position: relative; z-index: 2; }

/* ============================================================
   4. BEAM — light travelling along a border
   ------------------------------------------------------------
   The reference effect is a rainbow glow riding a border. A
   rainbow would collide head-on with this site's palette, so the
   mechanism is kept and the material is swapped: a short arc of
   the site's own accent → signal → brass, sweeping the perimeter.

   Corners stay square — a beam tracing a rectangle reads as a
   scanning instrument, where a glow around a pill reads as a
   generic "AI card".

   Implementation: conic-gradient + mask cut to a 1px ring, with
   @property making the gradient angle interpolable. Where
   @property is unsupported the beam simply does not rotate — it
   degrades to a static gradient rather than breaking.
   ============================================================ */

@property --beam-a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes beam-sweep { to { --beam-a: 360deg; } }

.beam { position: relative; }

.beam::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: var(--beam-w);
  background: conic-gradient(
    from var(--beam-a),
    transparent             0turn,
    transparent           .50turn,
    var(--beam-arc-0)     .58turn,
    var(--beam-arc-95)    .68turn,
    var(--signal)         .77turn,
    var(--signal-hot)     .84turn,
    var(--signal-white)   .865turn,
    var(--beam-tail)      .90turn,
    transparent           .96turn,
    transparent           1turn
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  filter: var(--beam-glow);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}

/* Mono variant: one hue only, for dense or repeated elements. */
.beam--mono::before {
  background: conic-gradient(
    from var(--beam-a),
    transparent          0turn,
    transparent        .60turn,
    var(--signal)       .78turn,
    var(--signal-hot)   .85turn,
    var(--signal-white) .88turn,
    transparent        .93turn,
    transparent         1turn
  );
}

/* -- intensity steps: idle → on → live -- */
.beam--idle::before { opacity: .75; animation: beam-sweep var(--beam-idle) linear infinite; }
.beam--on::before   { opacity: .9;  animation: beam-sweep var(--beam-idle) linear infinite; }
.beam--live::before { opacity: 1;   animation: beam-sweep var(--beam-live) linear infinite; }

/* -- beam on the main instrument: always faintly alive, sharpens
      when the visitor is actually working inside it -- */
.calc.beam { --beam-glow: var(--beam-glow-on); }
.calc.beam::before { opacity: .9; animation: beam-sweep var(--beam-idle) linear infinite; }
.calc.beam:hover::before { opacity: 1; }
.calc.beam:focus-within::before { opacity: 1; animation-duration: var(--beam-live); }
.calc.beam:focus-within { box-shadow: var(--halo); }

/* -- buttons: the beam is the hover state -- */
.btn.beam::before, .btn-sm.beam::before {
  background: conic-gradient(
    from var(--beam-a),
    transparent      0turn,
    transparent    .55turn,
    var(--signal)    .74turn,
    var(--signal-hot) .82turn,
    transparent    .92turn,
    transparent     1turn
  );
  mix-blend-mode: screen;
}
.btn.beam:hover,
.btn.beam:focus-visible,
.btn-sm.beam:hover,
.btn-sm.beam:focus-visible { --beam-glow: var(--beam-glow-on); }
.btn.beam:hover::before,
.btn.beam:focus-visible::before,
.btn-sm.beam:hover::before,
.btn-sm.beam:focus-visible::before {
  opacity: 1; animation: beam-sweep var(--beam-live) linear infinite;
}

/* -- inputs: the beam marks the field that currently has focus, so at
      most one light is ever running in the form. Text and number
      controls only — range sliders and selects already signal state. -- */
.field--beam { position: relative; --beam-glow: none; }
.field--beam::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  padding: var(--beam-w);
  background: conic-gradient(
    from var(--beam-a),
    transparent       0turn,
    transparent     .6turn,
    var(--signal)     .78turn,
    var(--signal-hot) .84turn,
    transparent      .92turn,
    transparent       1turn
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  filter: var(--beam-glow);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.field--beam:focus-within { --beam-glow: var(--beam-glow-on); }
.field--beam:focus-within::before {
  opacity: 1;
  animation: beam-sweep var(--beam-live) linear infinite;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
  border-color: var(--accent);
  box-shadow: var(--halo);
}

/* -- cards, FAQ panels, converter -- */
.card-grid a.beam::before { opacity: 0; }
.card-grid a.beam:hover,
.card-grid a.beam:focus-visible { --beam-glow: var(--beam-glow-on); }
.card-grid a.beam:hover::before,
.card-grid a.beam:focus-visible::before {
  opacity: 1; animation: beam-sweep var(--beam-idle) linear infinite;
}
.converter.beam { --beam-glow: var(--beam-glow-on); }
.converter.beam::before { opacity: .8; animation: beam-sweep var(--beam-idle) linear infinite; }
.converter.beam:focus-within::before { opacity: 1; animation-duration: var(--beam-live); }
.faq details[open].beam { --beam-glow: var(--beam-glow-on); }
.faq details[open].beam::before { opacity: .85; animation: beam-sweep var(--beam-idle) linear infinite; }

/* -- recompute flash: motion tied to a state change, not decoration.
      Fires when the engine repaints a result block. -- */
@keyframes beam-flash {
  0%   { opacity: 0;   transform: scaleX(0); transform-origin: left; }
  35%  { opacity: 1; }
  100% { opacity: 0;   transform: scaleX(1); transform-origin: left; }
}
.calc__results.is-updated::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0;
  height: 1px; background: linear-gradient(90deg, var(--accent), var(--signal-hot), transparent);
  animation: beam-flash var(--dur-slow) var(--ease-out);
}
.calc__results { position: relative; }

/* ============================================================
   5. ORB — the thinking indicator
   ------------------------------------------------------------
   Replaces the spinner/skeleton. Used only where the wait is
   real, never to disguise a fast operation:
     · calculator hydrating before app.js mounts
     · the ZIP → state lookup (first-party fetch)
     · clipboard write
   Styling here; drawing lives in assets/orb.js (canvas 2D).
   ============================================================ */

.orb {
  display: inline-block;
  flex: none;
  position: relative;
  width: var(--orb, 20px);
  height: var(--orb, 20px);
  vertical-align: -.18em;
}
.orb canvas { display: block; width: 100%; height: 100%; }
.orb[data-orb-size="64"] { --orb: 64px; }
.orb[data-orb-size="20"] { --orb: 20px; }

/* Reduced motion: the orb keeps its visual identity as a static
   ring, so the affordance survives without the movement. */
@media (prefers-reduced-motion: reduce) {
  .orb::after {
    content: ""; position: absolute; inset: 22%;
    border: 1.5px solid var(--accent); border-radius: 50%;
    opacity: .55;
  }
}

/* -- inline status chip -- */
.status {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--ink-3);
}
.status[hidden] { display: none; }
.status__text { font-variant-numeric: tabular-nums; }
.status--busy .status__text { color: var(--accent); }
.status--done .status__text { color: var(--accent-ink); }
.status--fail .status__text { color: var(--err); }

/* -- block-level preparing state -- */
.calc__boot {
  flex: 1;
  flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-6) var(--sp-4);
  color: var(--ink-3); font-size: var(--fs-sm); text-align: center;
}
.calc__boot p { margin: 0; }

/* ============================================================
   6. COMPONENTS
   ============================================================ */

/* ---------- calculator shell ---------- */
/* ---------- calculator shell ---------- */
.calc {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper-2);
  box-shadow: var(--shadow-lg);
  margin: var(--sp-6) 0 var(--sp-6);
  overflow: hidden;
}

.calc__head {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-3);
  padding: 14px 24px;
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}

.calc__head h2 {
  margin: 0; padding: 0; border: 0;
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 8px;
}
.calc__head h2::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.calc__head .status { margin-left: auto; }

.calc__body {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr) minmax(0, 18rem);
  grid-template-areas: "inputs results aside";
  gap: 0;
}
.calc__inputs { grid-area: inputs; }
.calc__results { grid-area: results; }
.calc__aside { grid-area: aside; }

@media (max-width: 1100px) {
  .calc__body {
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
    grid-template-areas: "inputs results" "aside aside";
  }
}
@media (max-width: 860px) {
  .calc__body {
    grid-template-columns: 1fr;
    grid-template-areas: "inputs" "results" "aside";
  }
}

.calc__inputs {
  position: relative;
  display: flex; flex-direction: column;
  padding: 24px;
  border-right: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--panel-wash), transparent 180px);
}
@media (max-width: 860px) {
  .calc__inputs { border-right: 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- reference panel ---------- */
.calc__aside {
  border-left: 1px solid var(--rule);
  background: var(--paper-3);
  padding: 24px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  overflow: auto;
}
@media (max-width: 1100px) {
  .calc__aside { border-left: 0; border-top: 1px solid var(--rule); }
}
.calc__aside h3 {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.aside-legend { margin: 0 0 var(--sp-4); }
.aside-legend dt {
  font-weight: 700; color: var(--ink); font-size: .84rem;
  margin-top: var(--sp-2);
}
.aside-legend dt:first-child { margin-top: 0; }
.aside-legend dd { margin: 0; color: var(--ink-3); font-size: .82rem; line-height: 1.5; }

.aside-tip {
  border: 1px solid var(--rule); border-left: 4px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 14px 16px; background: var(--paper-2);
  font-size: .84rem; line-height: 1.55; color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.aside-tip strong { color: var(--ink); }

/* ---------- fields ---------- */
.field { margin-bottom: var(--sp-4); }
.field > label, .field__label {
  display: block;
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .03em; color: var(--ink-2);
  margin-bottom: 6px;
}

.field input[type=number], .field input[type=text], .field select {
  width: 100%; font: inherit; font-size: .95rem; font-weight: 500;
  padding: .55rem .75rem; min-height: 44px;
  border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink);
  transition: all var(--dur-fast) var(--ease-out);
}
.field input:hover, .field select:hover { border-color: var(--ink-4); }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.field select {
  -webkit-appearance: none; appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  background-size: 11px 7px;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

.field--row { display: flex; gap: var(--sp-3); }
.field--row > * { flex: 1; }

/* Vehicle picker enhancements: search input & custom entry drawer */
.vehicle-field__search {
  margin-bottom: var(--sp-2) !important;
  padding-left: 2.2rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left .75rem center;
  background-size: 14px 14px;
}
@media (prefers-color-scheme: dark) {
  .vehicle-field__search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  }
}

.vehicle-field__custom {
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: var(--paper-3);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-sm);
  display: grid;
  gap: var(--sp-3);
}
.vehicle-field__custom[hidden] { display: none; }
.vehicle-field__cf { margin-bottom: 0; }

/* Sleek range sliders */
.field input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 28px;
  background: transparent; cursor: pointer;
}
.field input[type=range]::-webkit-slider-runnable-track {
  height: 6px; background: var(--rule-strong); border-radius: 3px;
}
.field input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ffffff; border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  margin-top: -6px;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.field input[type=range]:hover::-webkit-slider-thumb {
  transform: scale(1.18);
}
.field input[type=range]:focus-visible { outline: none; }
.field input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--halo); }

.field input[type=range]::-moz-range-track {
  height: 6px; background: var(--rule-strong); border-radius: 3px;
}
.field input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #ffffff; border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.range-val { font-weight: 700; color: var(--accent-ink); }

.check {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  font-size: .9rem; font-weight: 500; color: var(--ink-2); margin-bottom: var(--sp-3);
  cursor: pointer;
}
.check input {
  width: 18px; height: 18px; margin-top: .15rem;
  accent-color: var(--accent); flex: none; cursor: pointer;
}
.check:hover { color: var(--ink); }

.field__hint { font-size: var(--fs-xs); color: var(--ink-3); margin: 6px 0 0; }

.calc__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-5); }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .65rem 1.35rem; min-height: 44px;
  border: 0; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  transition: all var(--dur-fast) var(--ease-out);
}
.btn:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--link {
  background: none; border: 0; color: var(--accent);
  padding: .62rem .3rem; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.btn--link:hover { color: var(--accent-ink); }

.btn-sm {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font: inherit; font-size: var(--fs-xs); font-weight: 600;
  padding: .5rem .95rem; min-height: 40px;
  border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease-out);
}
.btn-sm:hover {
  border-color: var(--accent); color: var(--accent-ink);
  background: rgba(16, 185, 129, 0.06); transform: translateY(-1px);
}
.btn-sm[aria-busy="true"] { opacity: .75; cursor: progress; }

/* ---------- results ---------- */
.calc__results { padding: 28px 28px 24px; }

.result-lead {
  font-size: var(--fs-figure); line-height: 1.05;
  font-weight: 800; letter-spacing: -.035em;
  color: var(--ink);
  margin: 0 0 6px;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
}
.result-lead small {
  font-size: .95rem; font-weight: 600;
  color: var(--accent); background: rgba(16, 185, 129, 0.1);
  padding: 4px 12px; border-radius: var(--r-full);
  letter-spacing: .02em; text-transform: uppercase;
}

.result-sub {
  font-size: var(--fs-sm); color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 20px;
}

.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 12px; border-top: none; margin: 18px 0;
}
.result-cell {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-out);
}
.result-cell:hover { transform: translateY(-2px); }
.result-cell dt {
  font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; margin-bottom: 4px;
}
.result-cell dd { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); }

.compare {
  border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 20px;
}
.compare table { font-size: var(--fs-sm); }
.compare td:last-child, .compare th:last-child { text-align: right; }
.compare tr:hover td { background: var(--paper-3); }
.compare .win { font-weight: 700; color: var(--accent); }

.savings {
  margin-top: 16px; padding: 14px 18px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: .92rem; font-weight: 500; color: var(--ink);
}
.savings strong { color: var(--accent-ink); font-weight: 700; }

.flag {
  margin-top: 16px; padding: 14px 18px;
  border-radius: 12px;
  background: var(--warn-bg); border: 1px solid rgba(217, 119, 6, 0.25);
  font-size: var(--fs-sm); color: var(--ink);
}

.formula {
  margin-top: 22px; border-radius: 12px;
  background: var(--paper-3); border: 1px solid var(--rule);
  padding: 16px; font-size: var(--fs-xs); color: var(--ink-3);
}
.formula code {
  display: block; white-space: pre-wrap; margin-top: var(--sp-2);
  background: transparent; border: 0; padding: 0;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.6;
  color: var(--ink-2);
}

/* ---------- rates strip ---------- */
.rates {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--ink-3);
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: 10px; padding: 10px 16px;
  margin-top: 20px;
}
.rates b { color: var(--ink-2); font-weight: 600; }

/* ---------- index grids ---------- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 14px; margin: 24px 0; border-top: none;
}
.card-grid a {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 20px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease-out);
}
.card-grid a:hover {
  background: var(--paper-2);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-grid a:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--halo);
}
.card-grid .c-name { font-weight: 600; font-size: .98rem; display: block; margin-bottom: 6px; }
.card-grid .c-meta {
  display: inline-block; width: fit-content;
  font-size: .82rem; font-weight: 600;
  color: var(--accent-ink); background: rgba(16, 185, 129, 0.08);
  padding: 2px 8px; border-radius: var(--r-xs);
}

/* ---------- FAQ ---------- */
.faq { margin-top: var(--sp-7); }
.faq details {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 20px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease-out);
}
.faq details[open] { border-color: var(--accent); }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 1rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+"; color: var(--accent); font-weight: 700; font-size: 1.2rem;
  order: 2; transition: transform var(--dur-fast) var(--ease-out);
}
.faq summary:hover { color: var(--accent-ink); }
.faq details[open] summary::before { content: "\2212"; transform: rotate(180deg); }
.faq details p {
  margin: var(--sp-3) 0 0; font-size: .93rem; color: var(--ink-2); line-height: 1.6;
  animation: reveal-in var(--dur-base) var(--ease-out) both;
}

.sources { font-size: .82rem; color: var(--ink-3); margin-top: var(--sp-6); line-height: 1.6; }
.sources a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.sources a:hover { color: var(--accent); }

/* ---------- unit converter ---------- */
.converter {
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--paper-2); box-shadow: var(--shadow-md);
  padding: var(--sp-5); margin: var(--sp-5) 0;
}

/* ---------- lede ---------- */
.lede {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 0 0 var(--sp-5);
}
.lede strong { color: var(--ink); }

/* ---------- cookie banner ---------- */
.cc-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-cookie);
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.cc-banner[hidden] { display: none; }
.cc-banner__inner {
  max-width: var(--shell); margin: 0 auto; padding: var(--sp-4) var(--sp-5);
  display: grid; gap: var(--sp-4);
}
.cc-banner__title {
  font-size: 1.05rem; font-weight: 700;
  margin: 0 0 var(--sp-1);
}
.cc-banner__text { margin: 0; font-size: .9rem; color: var(--ink-2); max-width: 62ch; line-height: 1.55; }
.cc-banner__text a { color: var(--accent); }
.cc-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* Equal-choice: Accept and Reject are visually identical (H group / §25 TDDDG) */
.cc-manage { border-top: 1px solid var(--rule); padding-top: var(--sp-4); }
.cc-manage[hidden] { display: none; }
.cc-cat {
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--rule);
  align-items: start;
}
.cc-cat:last-of-type { border-bottom: 0; }
.cc-cat input { width: 18px; height: 18px; margin-top: .22rem; accent-color: var(--accent); }
.cc-cat label { font-weight: 600; font-size: .92rem; }
.cc-cat .cc-cat__desc { grid-column: 2; font-size: var(--fs-xs); color: var(--ink-3); margin: 0; }

/* ---------- misc ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   7. MOTION ORCHESTRATION
   One staged entrance for the page body beats scattered
   micro-interactions. Everything here is opt-in: with
   prefers-reduced-motion the elements keep their natural
   (visible) state and nothing moves.
   ============================================================ */

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {

  /* Staged page entrance. `backwards` fill means the element is
     only hidden for the duration of its own delay — if the
     animation is unavailable, content stays visible. */
  @keyframes enter-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
  .measure > * {
    animation: enter-up var(--dur-slow) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
  .measure > *:nth-child(1) { --i: 0; }
  .measure > *:nth-child(2) { --i: 1; }
  .measure > *:nth-child(3) { --i: 2; }
  .measure > *:nth-child(4) { --i: 3; }
  .measure > *:nth-child(5) { --i: 4; }
  .measure > *:nth-child(n+6) { --i: 5; }  /* cap total stagger at ~350ms */
}

/* Reduced motion: freeze the beam on a fixed angle, keep the
   halo (a state cue), drop every travel and stagger. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .beam::before,
  .field--beam::before { animation: none !important; opacity: .9 !important; }
  .field--beam:focus-within::before { opacity: 1 !important; }
  .calc.beam:hover::before,
  .calc.beam:focus-within::before { opacity: .8 !important; }
  .btn.beam:hover::before, .btn.beam:focus-visible::before,
  .btn-sm.beam:hover::before, .btn-sm.beam:focus-visible::before { opacity: .7 !important; }
  .calc__results.is-updated::after { animation: none; opacity: 0; }
  .measure > * { animation: none !important; }
  .masthead nav a::after { transition: none; }
  .field--signal::after { transition: none; }
  .faq details p { animation: none; }
  *, *::before, *::after { transition-duration: 1ms !important; }
}

/* ---------- visual cost comparison chart ---------- */
.cost-chart {
  margin: var(--sp-4) 0 var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.cost-chart__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-wide);
  color: var(--ink-3);
  margin-bottom: var(--sp-3);
}
.cost-bar {
  margin-bottom: var(--sp-3);
}
.cost-bar:last-child {
  margin-bottom: 0;
}
.cost-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-1);
}
.cost-bar__name {
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.cost-bar__badge {
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-wide);
  padding: 2px 6px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-ink);
  border-radius: var(--r-xs);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.cost-bar__val {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-2);
}
.cost-bar.is-winner .cost-bar__val {
  color: var(--accent-ink);
}
.cost-bar__track {
  height: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.cost-bar__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, #94a3b8, #64748b);
  transition: width var(--dur-slow) var(--ease-out);
}
.cost-bar.is-winner .cost-bar__fill {
  background: linear-gradient(90deg, var(--accent), var(--signal-hot));
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.btn--reddit {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: rgba(255, 69, 0, 0.08);
  color: #ff4500;
  border: 1px solid rgba(255, 69, 0, 0.25);
  transition: all var(--dur-fast) var(--ease-out);
}
.btn--reddit:hover {
  background: rgba(255, 69, 0, 0.16);
  border-color: #ff4500;
  color: #d03700;
}

/* ---------- 50-state leaderboard & tables ---------- */
.leaderboard-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-6);
}
.leaderboard-stat {
  padding: var(--sp-4);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.leaderboard-stat__label {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--track-wide);
  margin-bottom: var(--sp-1);
}
.leaderboard-stat__value {
  font-size: var(--fs-xl);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink);
}
.leaderboard-stat__sub {
  font-size: var(--fs-xs);
  color: var(--ink-4);
  margin-top: var(--sp-1);
}
.leaderboard-stat.is-highlight {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), transparent);
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 var(--sp-5);
}
.table-state-rank {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
}
.table-state-rank th,
.table-state-rank td {
  white-space: nowrap;
  padding: var(--sp-3) var(--sp-3);
}
.table-state-rank th {
  position: sticky;
  top: 0;
  background: var(--paper-3);
  z-index: 2;
}
.table-state-rank tr:hover td {
  background: rgba(16, 185, 129, 0.04);
}
.rank-badge {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.rank-badge.top-3 {
  color: var(--accent-ink);
}

.calc__actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .field input[type=number], .field input[type=text], .field select {
    font-size: 16px; /* Prevents iOS auto-zoom on input focus */
  }
  .masthead__inner { padding: var(--sp-2) var(--sp-4); gap: var(--sp-2); }
  .masthead nav {
    margin-left: 0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .masthead nav::-webkit-scrollbar { display: none; }
  .masthead nav a {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 5px 11px;
    font-size: var(--fs-xs);
  }
  .cc-actions .btn { flex: 1 1 auto; }
  .calc__actions .btn-sm { flex: 1 1 auto; text-align: center; justify-content: center; }
  .calc__results { padding: var(--sp-4); }
  .result-lead { font-size: 2.1rem; }
  .leaderboard-summary { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .masthead__inner { padding: var(--sp-2) var(--sp-3); }
  .wrap { padding: 0 var(--sp-3); }
}

@media print {
  .cc-banner, .masthead nav, .skip, .orb, .status { display: none !important; }
  body { background: #fff; }
  body::before, body::after { display: none; }
  .beam::before { display: none; }
}
