/* ClearLane styles — v2, "calm confidence".
 *
 * Design brief (from the product spec's cognitive-accessibility section):
 *   - Calm, low-arousal. NO red alarms, no flashing, no auto-playing motion.
 *   - Warnings read as "here is what to do," never "danger." Amber/blue/slate.
 *   - Stable, predictable layout. One purpose per screen.
 *   - Everything adjustable: text size, contrast, density, motion (COGA obj. 8).
 *
 * "Calm" is not the same as "plain." This version keeps every low-arousal rule
 * and adds craft: a confident type scale, a warm layered palette, generous
 * rhythm, a hero that states the mission, and gentle hazard iconography — so it
 * reads as a considered product, not a wireframe. Any transition here is short,
 * opacity/transform only, and fully disabled under reduced-motion.
 *
 * Theme: default light; prefers-color-scheme flips to dark; an explicit
 * data-theme on <html> (settings-init.js) overrides both.
 */

:root {
  /* Cozy, warm canvas: cream + oat neutrals so it feels like a comfortable
     room, not a clinic — while keeping the calm teal + sand and AA contrast. */
  --bg: #f6f2ea;
  --bg-tint: #efe6d5;
  --surface: #fffdf8;
  --surface-2: #f1ece1;
  --text: #22201b;
  --muted: #6a6154;
  --primary: #1a6a67;
  --primary-strong: #14524f;
  --primary-ink: #ffffff;
  --accent: #8f5417;        /* warm terracotta/sand — cozy secondary (AA as text on accent-soft) */
  --accent-soft: #f4e6cf;
  --border: #e6ddcd;
  --border-strong: #cbbfa6;
  --focus: #14524f;

  /* Hazard accents — all deliberately calm. */
  --merge: #8a5a12;  --merge-bg: #fbf2df;
  --trap: #8a4b2a;   --trap-bg: #f7ece4;
  --cross: #1f5673;  --cross-bg: #e7eff5;
  --crash: #4f5d63;  --crash-bg: #eceff0;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --maxw: 46rem;
  --shadow-sm: 0 1px 2px rgba(17, 40, 43, .05), 0 2px 8px rgba(17, 40, 43, .05);
  --shadow: 0 2px 6px rgba(17, 40, 43, .06), 0 12px 30px rgba(17, 40, 43, .07);
  --shadow-lg: 0 8px 20px rgba(17, 40, 43, .08), 0 24px 60px rgba(17, 40, 43, .10);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --step-scale: 1;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101a1c; --bg-tint: #14231f; --surface: #1a2528; --surface-2: #212f32;
    --text: #e8f0f0; --muted: #a3b4b5; --primary: #56cabf; --primary-strong: #7bd8ce;
    --primary-ink: #062421; --accent: #e0a25a; --accent-soft: #2a2013;
    --border: #2f3f42; --border-strong: #3f5257; --focus: #7bd8ce;
    --merge: #e6b566; --merge-bg: #2a2417; --trap: #e0a382; --trap-bg: #2a1f18;
    --cross: #8fc2de; --cross-bg: #17242c; --crash: #aebac0; --crash-bg: #212a2e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 4px 14px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 36px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #101a1c; --bg-tint: #14231f; --surface: #1a2528; --surface-2: #212f32;
  --text: #e8f0f0; --muted: #a3b4b5; --primary: #56cabf; --primary-strong: #7bd8ce;
  --primary-ink: #062421; --accent: #e0a25a; --accent-soft: #2a2013;
  --border: #2f3f42; --border-strong: #3f5257; --focus: #7bd8ce;
  --merge: #e6b566; --merge-bg: #2a2417; --trap: #e0a382; --trap-bg: #2a1f18;
  --cross: #8fc2de; --cross-bg: #17242c; --crash: #aebac0; --crash-bg: #212a2e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 4px 14px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.4);
}

:root[data-contrast="high"] { --text: #0a1416; --muted: #2c4145; --border: #6f8388; --border-strong: #52686c; --primary: #0f4a47; }
:root[data-theme="dark"][data-contrast="high"] { --text: #ffffff; --muted: #d3dede; --border: #8ea3ab; --primary: #86efe3; }

:root[data-textsize="large"]  { --step-scale: 1.15; }
:root[data-textsize="xlarge"] { --step-scale: 1.32; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: calc(1rem * var(--step-scale));
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 100% 0%, var(--bg-tint) 0%, rgba(0,0,0,0) 60%),
    radial-gradient(90% 50% at 0% 0%, var(--accent-soft) 0%, rgba(0,0,0,0) 45%),
    var(--bg);
  background-attachment: fixed;
}

/* Motion is opt-in only, and always short + gentle. */
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
:root[data-reduce-motion="on"] * { animation: none !important; transition: none !important; }

.skip-link {
  position: absolute; left: .5rem; top: -3.5rem;
  background: var(--primary); color: var(--primary-ink);
  padding: .7rem 1rem; border-radius: var(--radius-sm); z-index: 30; font-weight: 600;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: .6rem; }

:where(a) { color: var(--primary-strong); }
:where(button, select, input, textarea, a):focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs);
}
/* On screen change we move focus to the heading so screen-reader users land on
   the new title. Headings are not interactive, so suppress the visible ring
   when focus arrives programmatically or by pointer — keep it for real keyboard
   navigation (:focus-visible). */
#screen h1[tabindex="-1"]:focus { outline: none; }

/* ---- Header ---- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.app-header__brand { display: flex; align-items: center; gap: .6rem; min-height: 44px; text-decoration: none; color: var(--text); }
.badge__icon { display: inline-flex; align-items: center; }
.badge__icon svg { width: 13px; height: 13px; }
.app-logo { width: 2rem; height: 2rem; display: block; flex: none; }
.app-title { font-weight: 800; font-size: calc(1.2rem * var(--step-scale)); letter-spacing: -.01em; }
.app-title b { color: var(--primary-strong); font-weight: 800; }

.icon-btn {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: .5rem 1rem; min-height: 44px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .15s var(--ease), transform .1s var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn:active { transform: translateY(1px); }

/* ---- Footer ---- */
.app-footer {
  margin-top: auto; padding: 1.5rem clamp(1rem,4vw,2rem) 2.5rem;
  border-top: 1px solid var(--border); color: var(--muted);
  font-size: calc(.85rem * var(--step-scale));
}
.app-footer p { max-width: var(--maxw); margin: .3rem auto; }
.app-footer__credit { font-weight: 600; }
.app-footer__credit b { color: var(--primary-strong); }

main { flex: 1 0 auto; width: 100%; }
#screen { max-width: var(--maxw); margin: 0 auto; padding: clamp(1rem,3vw,1.75rem) clamp(1rem,4vw,1.5rem) 2.5rem; }

/* Gentle screen-entrance (disabled under reduced-motion). */
.screen-enter { animation: fadeup .28s var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Buttons ---- */
.btn {
  font: inherit; font-weight: 700; letter-spacing: -.005em;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: var(--primary-ink); border: 0; border-radius: 999px;
  padding: .8rem 1.35rem; min-height: 48px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .1s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn:hover { box-shadow: var(--shadow); filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn--quiet { background: var(--surface); color: var(--primary-strong); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); }
.btn--ghost { background: transparent; color: var(--primary-strong); border: 0; box-shadow: none; padding-left: .4rem; padding-right: .4rem; }
.btn--danger { background: var(--surface); color: var(--trap); border: 1px solid var(--trap); box-shadow: none; }
.btn--block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.25rem; }

/* ---- Hero ---- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, var(--primary-strong), var(--primary) 65%, #2a8079);
  color: #fff; border-radius: var(--radius); padding: clamp(1.4rem, 4vw, 2.2rem);
  box-shadow: var(--shadow-lg); margin-bottom: 1.5rem;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 90% at 100% 0%, rgba(255,255,255,.16), transparent 60%),
    radial-gradient(50% 80% at 0% 100%, rgba(0,0,0,.14), transparent 55%);
}
.hero > * { position: relative; }
.hero__eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: calc(.72rem * var(--step-scale)); font-weight: 700; opacity: .9; margin: 0 0 .5rem; }
.hero__title { font-size: calc(1.9rem * var(--step-scale)); line-height: 1.12; letter-spacing: -.02em; font-weight: 800; margin: 0 0 .6rem; }
.hero__title .accent { color: #ffdca6; }
.hero__lead { font-size: calc(1.02rem * var(--step-scale)); margin: 0 0 1.1rem; max-width: 34ch; color: rgba(255,255,255,.92); }
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; }
.hero .btn { background: #fff; color: var(--primary-strong); }
.hero .btn:hover { filter: brightness(1); box-shadow: var(--shadow); }
.hero .btn--onhero { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; border: 1px solid rgba(255,255,255,.4); }

/* Dark mode: keep the hero a deep, calm teal instead of a glowing block, and
   dial back its inner highlight. "Calm" has to hold up in dark, too. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero { background: linear-gradient(155deg, #0f3a37, #144b47 58%, #195650); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
  :root:not([data-theme="light"]) .hero::after { background: radial-gradient(60% 90% at 100% 0%, rgba(255,255,255,.07), transparent 62%), radial-gradient(50% 80% at 0% 100%, rgba(0,0,0,.25), transparent 55%); }
  :root:not([data-theme="light"]) .hero__title .accent { color: #f2cf97; }
  :root:not([data-theme="light"]) .hero .btn:not(.btn--onhero) { background: #eaf6f4; }
  :root:not([data-theme="light"]) .stat__num, :root:not([data-theme="light"]) .app-title b { color: #74cabf; }
}
:root[data-theme="dark"] .hero { background: linear-gradient(155deg, #0f3a37, #144b47 58%, #195650); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
:root[data-theme="dark"] .hero::after { background: radial-gradient(60% 90% at 100% 0%, rgba(255,255,255,.07), transparent 62%), radial-gradient(50% 80% at 0% 100%, rgba(0,0,0,.25), transparent 55%); }
:root[data-theme="dark"] .hero__title .accent { color: #f2cf97; }
:root[data-theme="dark"] .hero .btn:not(.btn--onhero) { background: #eaf6f4; }
:root[data-theme="dark"] .stat__num, :root[data-theme="dark"] .app-title b { color: #74cabf; }

/* Stat strip (the market framing for a demo audience). */
.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin: 1.4rem 0 .3rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem .8rem; box-shadow: var(--shadow-sm); }
.stat__num { font-size: calc(1.5rem * var(--step-scale)); font-weight: 800; color: var(--primary-strong); letter-spacing: -.02em; line-height: 1; }
.stat__label { color: var(--muted); font-size: calc(.78rem * var(--step-scale)); margin-top: .3rem; display: block; }
.stat__srcline { margin-top: .45rem; }
.stat__src { display: inline; font-size: calc(.72rem * var(--step-scale)); font-weight: 700; color: var(--primary-strong); text-decoration: underline; text-underline-offset: 2px; }
.stat-source { color: var(--muted); font-size: calc(.74rem * var(--step-scale)); margin: .6rem 0 0; }

/* "New version ready" prompt — appears only after a fresh deploy. */
.sw-update {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: space-between;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .8rem 1rem;
  z-index: 50; max-width: min(30rem, 94vw); width: max-content;
}
.sw-update__text { font-weight: 600; }
.sw-update__actions { display: flex; gap: .5rem; }
.sw-update__btn { font: inherit; font-weight: 700; background: var(--primary); color: var(--primary-ink); border: 0; border-radius: 999px; padding: .5rem 1rem; min-height: 44px; cursor: pointer; }
.sw-update__dismiss { font: inherit; font-weight: 600; background: none; color: var(--muted); border: 0; padding: .5rem .7rem; min-height: 44px; cursor: pointer; }
@media (max-width: 30rem) { .stat-strip { grid-template-columns: 1fr; } }

/* ---- How it works ---- */
.how { margin: 1.6rem 0 .4rem; }
.how__title { font-size: calc(1.15rem * var(--step-scale)); margin: 0 0 .9rem; letter-spacing: -.01em; }
.how__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.how__step { display: flex; gap: .85rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem; box-shadow: var(--shadow-sm); }
.how__step strong { display: block; font-size: calc(1.02rem * var(--step-scale)); }
.how__step p { margin: .2rem 0 0; color: var(--muted); font-size: calc(.9rem * var(--step-scale)); }
.how__n { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--accent-soft); color: var(--primary-strong); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---- QR "open on your phone" card ---- */
.qr-card { display: flex; gap: 1.1rem; align-items: center; margin-top: 1.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.qr-card__img { flex: none; width: 132px; height: 132px; background: #fff; border-radius: var(--radius-sm); padding: 8px; border: 1px solid var(--border); }
.qr-card__img img { width: 100%; height: 100%; display: block; }
.qr-card__text strong { font-size: calc(1.05rem * var(--step-scale)); }
.qr-card__text p { margin: .3rem 0 .5rem; color: var(--muted); font-size: calc(.9rem * var(--step-scale)); }
.qr-card__url { font-weight: 800; color: var(--primary-strong); letter-spacing: -.01em; }
@media (max-width: 27rem) { .qr-card { flex-direction: column; text-align: center; } }

/* ---- Section headers ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 .9rem; }
.section-head h2 { font-size: calc(1.15rem * var(--step-scale)); margin: 0; letter-spacing: -.01em; }
.section-head .count { color: var(--muted); font-size: calc(.85rem * var(--step-scale)); }

/* ---- Route cards ---- */
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.route-card {
  display: grid; width: 100%; text-align: left; gap: .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; cursor: pointer; box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .12s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.route-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.route-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.route-card__name { font-weight: 800; font-size: calc(1.12rem * var(--step-scale)); letter-spacing: -.01em; }
.route-card__go { color: var(--primary-strong); font-weight: 800; flex: none; opacity: .5; transition: opacity .15s var(--ease), transform .15s var(--ease); }
.route-card:hover .route-card__go { opacity: 1; transform: translateX(2px); }
.route-card__od { color: var(--muted); font-size: calc(.92rem * var(--step-scale)); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.route-card__od .arrow { color: var(--primary); font-weight: 700; }
.route-card__meta { color: var(--muted); font-size: calc(.82rem * var(--step-scale)); }

/* Mini-strip preview: the route's hazard sequence at a glance. */
.mini-strip { display: flex; align-items: center; gap: .3rem; margin-top: .2rem; }
.mini-strip .track { flex: 1; height: 3px; border-radius: 2px; background: var(--surface-2); position: relative; }
.mini-dot { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--primary); background: var(--surface); flex: none; }
.mini-dot.merge { border-color: var(--merge); } .mini-dot.trap { border-color: var(--trap); }
.mini-dot.cross { border-color: var(--cross); } .mini-dot.crash { border-color: var(--crash); }

.route-card__tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .2rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: calc(.74rem * var(--step-scale)); font-weight: 700;
  padding: .25rem .6rem .25rem .5rem; border-radius: 999px; border: 1px solid;
}
.badge svg { width: 13px; height: 13px; }
.badge--merge { color: var(--merge); background: var(--merge-bg); border-color: color-mix(in srgb, var(--merge) 40%, transparent); }
.badge--trap  { color: var(--trap);  background: var(--trap-bg);  border-color: color-mix(in srgb, var(--trap) 40%, transparent); }
.badge--cross { color: var(--cross); background: var(--cross-bg); border-color: color-mix(in srgb, var(--cross) 40%, transparent); }
.badge--crash { color: var(--crash); background: var(--crash-bg); border-color: color-mix(in srgb, var(--crash) 40%, transparent); }

.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ---- Rehearse view ---- */
.back-link {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px;
  background: none; border: 0; color: var(--primary-strong); font: inherit; font-weight: 700;
  cursor: pointer; padding: .4rem .2rem; margin-bottom: .25rem;
}
.rehearse-head h1 { font-size: calc(1.6rem * var(--step-scale)); margin: .3rem 0 .15rem; letter-spacing: -.02em; }
.rehearse-head .od { color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.rehearse-head .od .arrow { color: var(--primary); font-weight: 700; }
.rehearse-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .75rem; font-size: calc(.82rem * var(--step-scale)); font-weight: 600; color: var(--muted); box-shadow: var(--shadow-sm); }
.chip--sample { background: var(--accent-soft); color: var(--primary-strong); border-color: color-mix(in srgb, var(--accent) 35%, transparent); font-weight: 700; }
.rehearse-summary { background: var(--accent-soft); color: var(--text); border-radius: var(--radius-sm); padding: .9rem 1rem; margin: 1.1rem 0; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.rehearse-summary b { color: var(--primary-strong); }

/* Route panel: strip-map + brief side by side on wide screens. */
.route-body { display: grid; gap: 1.25rem; }
@media (min-width: 40rem) { .route-body { grid-template-columns: minmax(9rem, 12rem) 1fr; align-items: start; } .stripmap-wrap { position: sticky; top: 5rem; } }

.stripmap-wrap { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin: 0; }
.stripmap-cap { color: var(--muted); font-size: calc(.78rem * var(--step-scale)); font-weight: 700; text-align: center; }
/* The abstract number-rail overview is a desktop sidebar aid. On phones it sat
   alone above the brief and read as a stray line — hide it there; the per-step
   lane diagrams carry the visual on mobile. */
@media (max-width: 40rem) { .stripmap-wrap { display: none; } }

/* Per-step lane diagrams: a small bird's-eye picture of the maneuver. */
.lane-diagram { margin: .1rem 0 .7rem; }
.lane-diagram .ld { width: 100%; max-width: 220px; height: auto; display: block; }
.lane-diagram .ld-road { fill: var(--surface-2); }
.lane-diagram .ld-line { stroke: var(--border-strong); stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round; fill: none; }
.lane-diagram .ld-car { fill: var(--primary); }
.lane-diagram .ld-close, .lane-diagram .ld-target, .lane-diagram .ld-arrowhead { fill: currentColor; }
.lane-diagram .ld-trap, .lane-diagram .ld-arrow, .lane-diagram .ld-gap { stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lane-diagram .ld-trap-band { stroke: currentColor; fill: none; opacity: .26; }
.hazard--merge .lane-diagram { color: var(--merge); }
.hazard--trap  .lane-diagram { color: var(--trap); }
.hazard--cross .lane-diagram { color: var(--cross); }
.hazard--crash .lane-diagram { color: var(--crash); }
.stripmap { width: 100%; max-width: 12rem; height: auto; }
.stripmap .rail { stroke: var(--border-strong); }
.stripmap .rail-fill { stroke: color-mix(in srgb, var(--primary) 35%, transparent); }
.stripmap .node { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }
.stripmap .node-merge { stroke: var(--merge); } .stripmap .node-trap { stroke: var(--trap); }
.stripmap .node-cross { stroke: var(--cross); } .stripmap .node-crash { stroke: var(--crash); }
.stripmap .node-plain { stroke: var(--border-strong); }
.stripmap .node-num { fill: var(--text); font: 700 11px var(--font); text-anchor: middle; dominant-baseline: central; }
.stripmap .cap { fill: var(--primary); }
.stripmap .cap-end { fill: var(--accent); }
.stripmap .cap-label { fill: var(--muted); font: 700 9px var(--font); }

/* Brief */
.brief { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem 1.1rem; box-shadow: var(--shadow-sm); }
.step__head { display: flex; align-items: baseline; gap: .6rem; }
.step__n { display: inline-flex; align-items: center; justify-content: center; width: 1.85rem; height: 1.85rem; flex: none; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: calc(.88rem * var(--step-scale)); }
.step__instruction { font-weight: 700; letter-spacing: -.005em; }
.step__lane { color: var(--muted); margin: .4rem 0 0 2.45rem; font-size: calc(.92rem * var(--step-scale)); }

.hazard { margin: .8rem 0 0 2.45rem; border-radius: var(--radius-sm); padding: .8rem .9rem; border: 1px solid; border-left-width: 4px; }
.hazard--merge { background: var(--merge-bg); border-color: color-mix(in srgb, var(--merge) 30%, transparent); border-left-color: var(--merge); }
.hazard--trap  { background: var(--trap-bg);  border-color: color-mix(in srgb, var(--trap) 30%, transparent);  border-left-color: var(--trap); }
.hazard--cross { background: var(--cross-bg); border-color: color-mix(in srgb, var(--cross) 30%, transparent); border-left-color: var(--cross); }
.hazard--crash { background: var(--crash-bg); border-color: color-mix(in srgb, var(--crash) 30%, transparent); border-left-color: var(--crash); }
.hazard__headline { font-weight: 800; margin: 0 0 .25rem; display: flex; align-items: center; gap: .45rem; }
.hazard__icon { width: 1.5rem; height: 1.5rem; flex: none; display: inline-flex; }
.hazard__icon svg { width: 100%; height: 100%; }
.hazard--merge .hazard__icon { color: var(--merge); } .hazard--trap .hazard__icon { color: var(--trap); }
.hazard--cross .hazard__icon { color: var(--cross); } .hazard--crash .hazard__icon { color: var(--crash); }
.hazard__kind { font-size: calc(.68rem * var(--step-scale)); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: .12rem .45rem; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); }
.hazard--merge .hazard__kind { color: var(--merge); } .hazard--trap .hazard__kind { color: var(--trap); }
.hazard--cross .hazard__kind { color: var(--cross); } .hazard--crash .hazard__kind { color: var(--crash); }
.hazard__title { font-weight: 800; }
.hazard__detail { margin: 0; }
.hazard__hold { margin: .5rem 0 0; font-weight: 700; display: flex; align-items: center; gap: .35rem; }
.hazard__hold::before { content: "→"; color: var(--primary-strong); font-weight: 800; }
.hazard__tight { margin: .6rem 0 0; padding: .6rem .7rem; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--cross) 12%, transparent); font-size: calc(.92rem * var(--step-scale)); }
.hazard__tight-tag { display: inline-block; font-weight: 800; font-size: calc(.68rem * var(--step-scale)); text-transform: uppercase; letter-spacing: .05em; color: var(--cross); border: 1px solid color-mix(in srgb, var(--cross) 45%, transparent); border-radius: 999px; padding: .1rem .45rem; margin-right: .3rem; }

/* "Prefer another way?" — alternate routes to the same destination. */
.alt-routes { margin: 1.75rem 0 0; padding: 1.1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.alt-routes__title { font-size: calc(1.1rem * var(--step-scale)); margin: 0 0 .35rem; letter-spacing: -.01em; }
.alt-routes__lead { color: var(--muted); margin: 0 0 .9rem; font-size: calc(.92rem * var(--step-scale)); }
.alt-routes__sub { font-weight: 700; margin: 0 0 .6rem; font-size: calc(.9rem * var(--step-scale)); }
.alt-routes .route-list { gap: .7rem; }

:root[data-detail="simple"] .step__lane,
:root[data-detail="simple"] .hazard__detail,
:root[data-detail="simple"] .rehearse-summary { display: none; }

/* ---- Why / About (the pitch page) ---- */
.why h1 { font-size: calc(1.7rem * var(--step-scale)); letter-spacing: -.02em; margin: .3rem 0 .2rem; }
.why__lead { color: var(--muted); font-size: calc(1.05rem * var(--step-scale)); margin: 0 0 1.5rem; }
.why__section { margin: 1.6rem 0; }
.why__section h2 { font-size: calc(1.1rem * var(--step-scale)); margin: 0 0 .5rem; }
.why__grid { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; margin: 1rem 0; }
@media (max-width: 32rem) { .why__grid { grid-template-columns: 1fr; } }
.why__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; box-shadow: var(--shadow-sm); }
.why__card .k { display: flex; align-items: center; gap: .5rem; font-weight: 800; margin-bottom: .3rem; }
.why__card .k .dot { width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.why__card p { margin: 0; color: var(--muted); font-size: calc(.92rem * var(--step-scale)); }
.why__list { margin: .2rem 0 0; padding-left: 1.05rem; }
.why__list li { color: var(--muted); font-size: calc(.9rem * var(--step-scale)); margin: .3rem 0; }
.tag { display: inline-block; font-weight: 800; font-size: calc(.74rem * var(--step-scale)); text-transform: uppercase; letter-spacing: .05em; padding: .2rem .6rem; border-radius: 999px; }
.tag--now { color: var(--primary-ink); background: var(--primary); }
.tag--next { color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.founder-note { margin: 1.1rem 0 0; padding: 1rem 1.15rem; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); }
.founder-note p { margin: 0; font-size: calc(1.02rem * var(--step-scale)); }
.founder-note__cite { display: block; margin-top: .65rem; font-style: normal; font-weight: 700; color: var(--primary-strong); font-size: calc(.9rem * var(--step-scale)); }

/* ---- Forms ---- */
.form-grid { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .35rem; }
.field > span { font-weight: 700; }
.field input, .field textarea, .field select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .7rem .8rem; min-height: 46px; width: 100%;
}
.field textarea { min-height: 4.5rem; resize: vertical; }
.field__hint { color: var(--muted); font-size: calc(.85rem * var(--step-scale)); }
.form-title { font-size: calc(1.5rem * var(--step-scale)); margin: .3rem 0 .2rem; letter-spacing: -.02em; }

.maneuver-editor { display: grid; gap: 1rem; }
.maneuver-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; display: grid; gap: .75rem; }
.maneuver-card__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.maneuver-card__head strong { font-size: calc(.98rem * var(--step-scale)); }
.mc-controls { display: flex; align-items: center; gap: .35rem; }
.mc-btn { font: inherit; font-weight: 800; min-width: 44px; min-height: 40px; padding: .25rem .5rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text); cursor: pointer; line-height: 1; }
.mc-btn:disabled { opacity: .35; cursor: default; }
.form-note { margin: 0; padding: .6rem .85rem; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--radius-sm); color: var(--text); font-size: calc(.85rem * var(--step-scale)); }

/* ---- Dialog / toast ---- */
.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; max-width: min(32rem, 94vw); width: 100%; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 22, 24, .5); backdrop-filter: blur(2px); }
.dialog__body { padding: 1.35rem; display: grid; gap: 1.1rem; margin: 0; }
.dialog__body h2 { margin: 0; font-size: calc(1.3rem * var(--step-scale)); }
.dialog__footer { display: flex; justify-content: flex-end; }
.setting { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem; margin: 0; display: grid; gap: .65rem; }
.setting legend { font-weight: 800; padding: 0 .3rem; }
.setting__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.setting__row select { min-height: 42px; font: inherit; padding: .35rem .55rem; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.setting__row--switch input { width: 1.35rem; height: 1.35rem; }
.setting__note { color: var(--muted); font-size: calc(.85rem * var(--step-scale)); margin: 0; }
.setting__actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.toast { position: fixed; left: 50%; bottom: 1.35rem; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .75rem 1.15rem; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 40; max-width: 90vw; font-weight: 600; }
