/* ═══════════════════════════════════════════════════════════════════════════
   Riyadh Metro Navigator — design system & page styles
   ─────────────────────────────────────────────────────────────────────────
   One stylesheet, two consumers:
     · body.landing     → the marketing/journey page (hero, network, guide, data)
     · body.app-shell   → web/google-maps.html (full-height map application)

   Design language «خط المدينة — the city line»
     · Deep ink canvas; the six official line colours are the only saturated hues.
     · Octilinear geometry (90°/45°) echoed in notched corners and hairline tracks.
     · Arabic-first: every rule uses logical properties, so RTL is the default and
       LTR (English, Filipino, French, Russian…) needs no overrides.
     · Data in tabular figures; motion is short, eased and always optional.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────── 1. tokens */
:root {
  color-scheme: dark;
  --bg: #07100d;
  --bg-2: #0a1713;
  --panel: #0d1a15;
  --panel-2: #12241d;
  --panel-3: #173026;
  --ink: #e9f4ee;
  --ink-2: #cfe0d6;
  --muted: #8ba396;
  --border: rgba(233, 246, 238, .10);
  --border-2: rgba(233, 246, 238, .20);
  --accent: #d3f17b;
  --accent-2: #bce45c;
  --accent-ink: #0b1a10;
  --accent-soft: rgba(211, 241, 123, .12);
  --ok: #22c07a;
  --danger: #ef5350;
  --warn: #f0b429;
  --shadow: 0 24px 60px rgba(0, 0, 0, .50);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .30);

  /* official line colours — data, never decoration */
  --line-1: #00ADE5; --line-2: #F0493A; --line-3: #F68D39;
  --line-4: #FFD105; --line-5: #43B649; --line-6: #984C9D;

  /* Riyadh Bus service tiers — data, never decoration (transport.html) */
  --bus-brt: #E8552D; --bus-main: #2D7DD2; --bus-sector: #2FA37C; --bus-feeder: #7C8794;
  --bus-stop: #0f766e;

  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;

  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --radius: 14px;                 /* legacy alias used by web/google-maps.html */
  --topbar-h: 68px;
  --panel-w: 400px;
  --shell: 1280px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 72px; --sp-9: 104px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4ee;
  --bg-2: #e9ebe3;
  --panel: #fffefb;
  --panel-2: #f4f6f0;
  --panel-3: #e8efe5;
  --ink: #0f1f18;
  --ink-2: #2b3d34;
  --muted: #5f7268;
  --border: rgba(15, 31, 24, .12);
  --border-2: rgba(15, 31, 24, .24);
  --accent: #1c6b48;
  --accent-2: #14543a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(28, 107, 72, .10);
  --ok: #15803d;
  --danger: #c62828;
  --warn: #b26a00;
  --shadow: 0 20px 44px rgba(15, 31, 24, .12);
  --shadow-sm: 0 6px 18px rgba(15, 31, 24, .08);

  /* bus tiers + park & ride keep their data colours in both themes */
  --bus-brt: #E8552D; --bus-main: #2D7DD2; --bus-sector: #2FA37C; --bus-feeder: #7C8794;
  --bus-stop: #0f766e;
}

/* ──────────────────────────────────────────────────────────── 2. base */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* the topbar is sticky, so anchored sections need the offset back */
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
body.landing { overflow-x: hidden; }
body.app-shell { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 8px; inset-inline-start: 8px; z-index: 2000;
  transform: translateY(-160%);
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: none; }
.hide-sm { display: initial; }

.shell { width: min(var(--shell), 100% - 2 * clamp(16px, 4vw, 48px)); margin-inline: auto; }

/* numeric/latin runs inside Arabic text keep a stable, technical look */
.num, .metric-value, .stat-value, time { font-variant-numeric: tabular-nums lining-nums; }

/* ──────────────────────────────────────────────────── 3. components */

/* buttons */
.btn {
  --btn-bg: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--btn-bg); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease), color .18s var(--ease);
}
.btn:hover { background: var(--panel-3); border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--border-2); color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none;
  color: var(--accent); font-size: 13.5px; font-weight: 700; padding: 0;
}
[data-theme="light"] .link-btn { color: var(--accent-2); }
.link-btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.ghost-link {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none;
  color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 2px;
}
.ghost-link:hover { color: var(--accent); }
.ghost-link-mark { color: var(--accent); }
.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 15px; flex-shrink: 0; transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }

/* line badge — the atomic piece of the whole product */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 4px; border-radius: 999px; color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16);
}
.badge .num {
  display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255, 255, 255, .26); font-size: 10.5px; font-weight: 800;
}
.badge.dark { color: #1a1a00; }
.badge.dark .num { background: rgba(0, 0, 0, .16); }
.badge.solo { padding: 2px; }

/* A/B markers — one motif, reused everywhere */
.abm {
  display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 800; font-family: Arial, sans-serif; flex-shrink: 0;
}
.abm.a { background: var(--ok); }
.abm.b { background: var(--danger); }
.field label .abm { width: 17px; height: 17px; font-size: 9.5px; margin-inline-end: 4px; }

/* fields */
.field { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  display: flex; align-items: center; font-size: 12px; font-weight: 700;
  color: var(--muted); letter-spacing: .01em;
}
.field input {
  width: 100%; padding: 13px 46px 13px 14px; min-width: 0;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color .18s, background .18s, box-shadow .18s;
}
[dir="rtl"] .field input { padding: 13px 14px 13px 46px; }
.field input::placeholder { color: var(--muted); opacity: .8; }
.field input:focus { outline: none; border-color: var(--accent); background: var(--panel-3); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.field .icon-btn { position: absolute; bottom: 6px; inset-inline-end: 6px; }

/* suggestions */
.suggest {
  position: absolute; top: 100%; inset-inline: 0; z-index: 60; margin-top: 6px;
  max-height: min(52vh, 340px); overflow-y: auto; display: none;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 6px;
}
.suggest.open { display: block; }
.suggest > div {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--r-xs);
  cursor: pointer; font-size: 14px; flex-wrap: wrap;
}
.suggest > div:hover, .suggest > div.active { background: var(--panel-3); }
.suggest > div > span { flex: 1; min-width: 0; }
.suggest small { color: var(--muted); font-size: 11.5px; width: 100%; }
.suggest .pico { font-size: 16px; }
.suggest .sub { display: block; }

/* departure + mode */
.depart { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.depart select, select {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 8px 10px; font-size: 13px; max-width: 100%;
}
.mode-picker, .options { display: flex; gap: 6px; border: 0; margin: 0; padding: 0; }
.mode-picker { background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.mode-picker label { position: relative; }
.mode-picker input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.mode-picker span {
  display: block; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); white-space: nowrap; transition: background .18s, color .18s;
}
.mode-picker input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.mode-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; text-align: start;
  transition: border-color .16s, background .16s, transform .16s;
}
.chip-btn:hover { border-color: var(--accent); background: var(--panel-3); transform: translateY(-1px); }
.chip-btn small { color: var(--muted); font-size: 11px; }
.chip-btn .badge { padding: 0 5px; font-size: 10px; line-height: 1.5; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel-3); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px; color: var(--ink-2);
}
.chip.x { border-color: var(--border-2); font-weight: 700; }

/* cards, notices, misc text */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px; margin-top: 12px; box-shadow: var(--shadow-sm);
}
.card h2, .card h3 { font-size: 16px; margin-bottom: 8px; }
.section-title { font-size: 13px; font-weight: 800; color: var(--muted); margin: 16px 0 6px; letter-spacing: .02em; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.muted { color: var(--muted); }
.soft { opacity: .85; }
.error {
  background: color-mix(in srgb, var(--danger) 14%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--ink); border-radius: var(--r-sm); padding: 11px 13px; font-size: 13.5px; margin-top: 10px;
}
.notice {
  background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: var(--r-sm); padding: 11px 13px; font-size: 13px; margin-top: 10px;
}
.notice.soft { background: var(--panel-2); border-color: var(--border); color: var(--muted); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; }
.tbl th { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
.tbl .num, .tbl td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }

/* itinerary timeline */
.res-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.res-head h2 { font-size: 17px; }
.res-od { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; margin: 10px 0 4px; font-size: 15px; }
.res-od .arrow { color: var(--muted); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.summary div { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; text-align: center; }
.summary b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.summary small { color: var(--muted); font-size: 11.5px; }
.alts { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.alts button {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--ink-2);
  border-radius: 999px; padding: 7px 12px; font-size: 12px;
}
.alts button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.times { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.times .tm { font-size: 14px; }
.times b { font-variant-numeric: tabular-nums; }
.times small { color: var(--muted); font-size: 12px; }
.fare { font-size: 13px; margin-top: 8px; }
.arrow { font-family: var(--mono); }

.timeline { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.leg { position: relative; padding: 0 0 18px 0; padding-inline-start: 30px; }
.leg::before {
  content: ""; position: absolute; inset-inline-start: 9px; top: 6px; bottom: -2px; width: 3px;
  background: var(--leg-color, var(--border-2)); border-radius: 2px;
}
.leg.last::before { display: none; }
.leg .pin {
  position: absolute; inset-inline-start: 3px; top: 4px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--panel); border: 3px solid var(--leg-color, var(--muted));
}
.leg .pin.start { border-color: var(--ok); background: var(--ok); }
.leg .pin.end { border-color: var(--danger); background: var(--danger); }
.leg .pin.transfer { background: var(--panel); border-color: var(--ink); }
.leg .pin.walk { border-style: dashed; border-color: var(--muted); }
.leg .where { font-weight: 700; font-size: 14.5px; }
.leg .where small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.leg .what { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.leg .transfer-note {
  background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: var(--r-xs); padding: 7px 10px; font-size: 12.5px; margin: 6px 0;
}
.leg details { margin-top: 6px; font-size: 12.5px; }
.leg summary { cursor: pointer; color: var(--muted); }
.leg details ol { margin: 6px 0 0; padding-inline-start: 20px; color: var(--ink-2); }
.leg.walk .what { color: var(--muted); }

/* station card */
.station-card .name { font-size: 18px; font-weight: 800; }
.station-card .name small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.station-card .meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.station-card .coord { font-family: var(--mono); font-size: 12px; }
.neigh { display: flex; gap: 8px; margin-top: 8px; }
.neigh a {
  flex: 1; min-width: 0; text-decoration: none; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--r-xs); padding: 8px 10px;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.neigh a:hover { border-color: var(--accent); }
.neigh a span { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.neigh a i { color: var(--muted); font-style: normal; font-weight: 400; font-size: 12px; }
.pname { font-weight: 800; font-size: 15px; }
.pname small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

/* lines list (panel tab) */
.line-item { border: 1px solid var(--border); border-radius: var(--r-md); margin-top: 10px; overflow: hidden; background: var(--panel-2); }
.line-item header { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; }
.line-item header:hover { background: var(--panel-3); }
.line-item .t { flex: 1; min-width: 0; }
.line-item .t b { display: block; font-size: 14px; }
.line-item .t small { display: block; color: var(--muted); font-size: 11.5px; }
.line-item ol { list-style: none; margin: 0; padding: 0 13px 12px; display: none; }
.line-item.open ol { display: block; }
.line-item li { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.line-item li:hover { color: var(--accent); }
.line-item li .n {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--c, var(--accent)); color: #fff; font-size: 11px; font-weight: 800;
}
.line-item li .n.x { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--ink); }
.line-item li .xs { color: var(--muted); font-size: 11.5px; }
.line-item li .en { margin-inline-start: auto; color: var(--muted); font-size: 11.5px; }

/* export / downloads */
.dl {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 13px; margin-top: 8px; color: var(--ink);
  transition: border-color .16s, transform .16s, background .16s;
}
.dl:hover { border-color: var(--accent); transform: translateY(-1px); background: var(--panel-3); }
.dl .ic { font-size: 20px; }
.dl b { display: block; font-family: var(--mono); font-size: 12.5px; }
.dl small { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.steps { padding-inline-start: 20px; font-size: 12.5px; color: var(--ink-2); margin: 8px 0; }
.steps li { margin-bottom: 6px; }
.tips { padding-inline-start: 18px; font-size: 13px; margin: 6px 0; }
.dest-group { margin-top: 10px; }
.dest-cat { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }

/* guide */
.guide-sec { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; margin-bottom: 10px; }
.guide-sec h3 { font-size: 14.5px; margin-bottom: 6px; }
.gbody { font-size: 13.5px; color: var(--ink-2); }
.gbody ul { padding-inline-start: 18px; margin: 6px 0; }
.gbody li { margin-bottom: 4px; }

/* live GPS */
.live-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.live-row .walk { color: var(--muted); font-size: 12px; }
.live-banner {
  position: absolute; top: 12px; inset-inline: 12px; z-index: 950;
  border-radius: var(--r-sm); padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-2); background: var(--panel);
}
.live-banner.info { border-inline-start: 4px solid var(--line-1); }
.live-banner.prep { border-inline-start: 4px solid var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--panel)); }
.live-banner.ok { border-inline-start: 4px solid var(--ok); background: color-mix(in srgb, var(--ok) 16%, var(--panel)); }

/* toast */
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; z-index: 3000;
  transform: translate(50%, 140%); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow);
  transition: transform .3s var(--ease-out), opacity .3s;
}
[dir="rtl"] .toast { transform: translate(-50%, 140%); }
.toast.show { opacity: 1; transform: translate(50%, 0); }
[dir="rtl"] .toast.show { transform: translate(-50%, 0); }

/* first-ride modal */
.fv-overlay {
  position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.fv-overlay[hidden] { display: none; }
.fv-modal {
  position: relative; width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  padding: 26px; box-shadow: var(--shadow); animation: pop .28s var(--ease-out);
}
.fv-modal h2 { font-size: 19px; margin-bottom: 6px; }
.fv-modal > p { color: var(--muted); font-size: 13.5px; }
.modal-close {
  position: absolute; top: 12px; inset-inline-end: 12px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2);
  font-size: 18px; line-height: 1; color: var(--muted);
}
.modal-close:hover { color: var(--ink); border-color: var(--accent); }
.fv-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 10px; }
.fv-list li { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; font-size: 13.5px; background: var(--panel-2); }
.fv-list .ic { font-size: 18px; flex-shrink: 0; }
.fv-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────────────────────────────────────── 4. landing chrome */
.scroll-rail { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 1500; background: transparent; }
.scroll-rail-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--line-1), var(--line-4) 45%, var(--line-2));
  box-shadow: 0 0 12px rgba(211, 241, 123, .35);
}
.scroll-rail-train {
  position: absolute; top: -3px; inset-inline-start: 0; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateX(-50%); opacity: 0; transition: opacity .2s;
}
[dir="rtl"] .scroll-rail-train { transform: translateX(50%); }
.scroll-rail-train.on { opacity: 1; }

.topbar {
  position: sticky; top: 0; z-index: 1200;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.topbar.stuck { border-bottom-color: var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
body.app-shell .topbar { position: relative; background: var(--ink); color: #fff; flex-shrink: 0; }
.topbar-inner { display: flex; align-items: center; gap: 18px; height: var(--topbar-h); }
body.app-shell .topbar { padding: 0 14px; height: 58px; }

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.brand-mark svg { width: 100%; height: 100%; }
.bm-plate { fill: var(--panel-2); stroke: var(--border-2); stroke-width: 1.5; }
.bm-track { stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-overline { font-size: 9.5px; letter-spacing: .28em; color: var(--muted); font-weight: 700; }
.brand-name { font-size: 15px; font-weight: 700; white-space: nowrap; }

.mainnav { display: flex; gap: 4px; margin-inline-start: auto; }
.mainnav a {
  position: relative; text-decoration: none; font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-radius: var(--r-xs); transition: color .18s, background .18s;
}
.mainnav a:hover { color: var(--ink); background: var(--panel-2); }
.mainnav a.active { color: var(--ink); }
.mainnav a.active::after {
  content: ""; position: absolute; bottom: 2px; inset-inline: 12px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.mainnav + .top-actions { margin-inline-start: 0; }
.top-actions > a, .top-actions > button, .top-actions select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--ink);
  border-radius: 999px; padding: 8px 13px; font-size: 12.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background .18s, border-color .18s, color .18s;
}
.top-actions > a:hover, .top-actions > button:hover, .top-actions select:hover { background: var(--panel-3); border-color: var(--border-2); }
.top-actions #btn-theme { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 15px; }
.top-cta { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; font-weight: 700 !important; }
.top-cta:hover { background: var(--accent-2) !important; }

.status-chip { display: inline-flex; align-items: center; gap: 7px; }
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status-chip.open::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); animation: breathe 2.6s infinite; }
.status-chip.closed::before { background: var(--danger); }

.to-top {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 1100;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-2);
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); font-size: 16px;
  transition: opacity .2s, transform .2s;
}
.to-top:hover { border-color: var(--accent); transform: translateY(-2px); }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); margin-top: var(--sp-9); }
.footer-grid { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 32px 0; }
.footer-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.footer-mark { width: 34px; height: 34px; }
.footer-brand b { display: block; font-size: 14px; }
.footer-brand small { display: block; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin-inline-start: auto; }
.footer-links a { text-decoration: none; font-size: 13px; color: var(--muted); }
.footer-links a:hover { color: var(--accent); }
.footer-meta { display: flex; align-items: center; gap: 12px; }
.footer-lines { display: flex; gap: 3px; }
.footer-lines i { width: 16px; height: 3px; border-radius: 2px; }
.footer-lines i:nth-child(1) { background: var(--line-1); }
.footer-lines i:nth-child(2) { background: var(--line-2); }
.footer-lines i:nth-child(3) { background: var(--line-3); }
.footer-lines i:nth-child(4) { background: var(--line-4); }
.footer-lines i:nth-child(5) { background: var(--line-5); }
.footer-lines i:nth-child(6) { background: var(--line-6); }
.footer-license { font-size: 11.5px; color: var(--muted); }

/* section headings */
.section-head { max-width: 62ch; margin-bottom: var(--sp-6); }
.section-eyebrow { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--accent); margin-bottom: 14px; }
[data-theme="light"] .section-eyebrow { color: var(--accent-2); }
.section-eyebrow-line { width: 34px; height: 1px; background: currentColor; opacity: .6; }
.section-title-h { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.15; letter-spacing: -.02em; }
.section-title-h em { font-style: normal; color: var(--muted); }
.section-desc { margin-top: 14px; color: var(--muted); font-size: clamp(.95rem, 1.1vw, 1.05rem); line-height: 1.9; }

/* ────────────────────────────────────────────────────────── 5. hero */
.hero { position: relative; padding: clamp(32px, 6vw, 68px) 0 clamp(56px, 8vw, 96px); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.hero-glow-a { width: 46vw; height: 46vw; top: -14vw; inset-inline-start: -8vw; background: radial-gradient(circle, rgba(0, 173, 229, .30), transparent 68%); }
.hero-glow-b { width: 40vw; height: 40vw; bottom: -12vw; inset-inline-end: -6vw; background: radial-gradient(circle, rgba(211, 241, 123, .22), transparent 68%); }
[data-theme="light"] .hero-glow { opacity: .35; }
.hero-mesh {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 78%);
  opacity: .7;
}

.hero-grid {
  position: relative; display: grid; gap: clamp(28px, 4vw, 60px);
  grid-template-columns: minmax(0, 1.03fr) minmax(0, .97fr); align-items: center;
}
.hero-copy { min-width: 0; }

.eyebrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 18px; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: breathe 2.8s infinite; }
.eyebrow-rule { width: 26px; height: 1px; background: var(--border-2); }
.eyebrow-clock { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--ink-2); }

.display { font-size: clamp(2.7rem, 7vw, 5.3rem); line-height: 1.02; font-weight: 700; letter-spacing: -.03em; }
.display .line { display: block; overflow: hidden; padding-block: .06em .16em; margin-block: -.06em -.16em; }
.display .line > * { display: block; font-style: normal; animation: rise .95s var(--ease-out) both; }
.display .line:nth-child(2) > * { animation-delay: .1s; color: var(--accent); }
[data-theme="light"] .display .line:nth-child(2) > * { color: var(--accent-2); }
.lede { margin-top: 20px; max-width: 54ch; color: var(--muted); font-size: clamp(1rem, 1.15vw, 1.12rem); line-height: 1.95; animation: fade .8s var(--ease-out) .28s both; }

/* planner console */
.planner-console {
  position: relative; margin-top: 28px; padding: 20px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade .8s var(--ease-out) .38s both;
}
.planner-console::before {
  content: ""; position: absolute; inset-inline: 20px; top: -1px; height: 2px;
  background: linear-gradient(90deg, var(--line-1), var(--line-2) 20%, var(--line-3) 40%, var(--line-4) 60%, var(--line-5) 80%, var(--line-6));
  border-radius: 2px; opacity: .9;
}
.console-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.console-step {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-xs);
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800;
  font-family: var(--mono);
}
.console-heading { display: flex; flex-direction: column; line-height: 1.3; }
.console-heading small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.console-heading b { font-size: 15.5px; }
.console-sparks { display: flex; gap: 3px; margin-inline-start: auto; }
.console-sparks i { width: 14px; height: 4px; border-radius: 2px; }
.console-sparks i:nth-child(1) { background: var(--line-1); }
.console-sparks i:nth-child(2) { background: var(--line-2); }
.console-sparks i:nth-child(3) { background: var(--line-3); }
.console-sparks i:nth-child(4) { background: var(--line-4); }
.console-sparks i:nth-child(5) { background: var(--line-5); }
.console-sparks i:nth-child(6) { background: var(--line-6); }

.od { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.od-field { min-width: 0; }
.od-link { position: relative; display: grid; place-items: center; align-self: end; min-width: 46px; padding-bottom: 14px; }
.od-track { position: absolute; inset-inline: -6px; top: 50%; height: 2px; border-radius: 2px; background: var(--border-2); }
.od-track i { position: absolute; top: -2px; inset-inline-start: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: shuttle 3.6s var(--ease) infinite; }
.od-swap {
  position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--panel-3); color: var(--ink-2);
  display: grid; place-items: center;
  transition: transform .35s var(--ease), color .2s, border-color .2s;
}
.od-swap svg { width: 17px; height: 17px; }
.od-swap:hover { color: var(--accent); border-color: var(--accent); transform: rotate(180deg); }

.console-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-plan { margin-inline-start: auto; padding: 13px 22px; font-size: 14.5px; }
.btn-plan svg { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.btn-plan:hover svg { transform: translateX(3px); }
[dir="rtl"] .btn-plan:hover svg { transform: translateX(-3px) scaleX(-1); }
[dir="rtl"] .btn-plan svg { transform: scaleX(-1); }

.console-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.popular { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.popular .section-title { margin: 0; font-size: 11.5px; }

/* hero stats */
.hero-stats { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 28px 0 0; padding: 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.hero-stats li { background: var(--bg); padding: 14px 16px; }
.stat-value { display: block; font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-value small { font-size: .55em; font-weight: 700; color: var(--muted); }
.stat-label { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hero-stats li:nth-child(1) .stat-value { color: var(--line-1); }
.hero-stats li:nth-child(2) .stat-value { color: var(--line-2); }
.hero-stats li:nth-child(3) .stat-value { color: var(--line-3); }
.hero-stats li:nth-child(4) .stat-value { color: var(--accent); }

/* hero stage — the live network */
.hero-stage { display: flex; flex-direction: column; gap: 14px; animation: fade .9s var(--ease-out) .2s both; }
.stage-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.stage-card-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.stage-card-head b { font-size: 14px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: breathe 2.2s infinite; }
.stage-open { margin-inline-start: auto; font-size: 12.5px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
[data-theme="light"] .stage-open { color: var(--accent-2); }
.stage-open:hover { text-decoration: underline; text-underline-offset: 4px; }
.stage-canvas { position: relative; aspect-ratio: 1 / 1.02; background: radial-gradient(ellipse at 50% 30%, var(--panel-2), var(--bg-2)); }
.stage-caption { margin: 0; padding: 11px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); min-height: 42px; }
.stage-caption b { color: var(--ink); }

/* the generated network */
.hn-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hn-bg { fill: transparent; }
.hn-gridline { stroke: var(--border); stroke-width: 1; }
.hn-gridrect { opacity: .55; }
.hn-districts text { fill: var(--muted); font-weight: 700; letter-spacing: .16em; opacity: .5; text-transform: uppercase; }
.hn-edge { fill: none; stroke: var(--line); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .92; transition: opacity .3s; }
.hn-centre { fill: none; stroke: none; }
.hn-line { transition: opacity .3s; }
.hn-dot { fill: var(--bg); stroke: #fff; stroke-width: 2.4; transition: r .2s var(--ease); }
.hn-ring { fill: none; stroke: #fff; stroke-width: 3.4; opacity: .95; }
.hn-st.x .hn-dot { stroke: #111; }
.hn-hit { fill: transparent; cursor: pointer; }
.hn-name { fill: var(--ink-2); font-weight: 600; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; opacity: .85; }
.hn-name.x { font-weight: 800; fill: var(--ink); opacity: 1; }
.hn-train-halo { fill: var(--line); opacity: .28; }
.hn-train-body { fill: #fff; stroke: var(--line); stroke-width: 3; }
.hn-train { transition: opacity .3s; }
.hn-ab { fill: #fff; font-weight: 800; text-anchor: middle; }
.hn-svg.is-focused .hn-line:not(.is-focus) { opacity: .12; }
.hn-svg.is-focused .hn-st:not(.is-focus) { opacity: .2; }
.hn-svg.is-focused .hn-train:not(.is-focus) { opacity: .1; }
.hn-svg.is-focused .hn-name { opacity: .18; }
.hn-svg.is-focused .hn-st.is-focus .hn-name, .hn-svg.is-focused .hn-name.x { opacity: 1; }
.hn-svg.has-route .hn-lines, .hn-svg.has-route .hn-trains { opacity: .16; }
.hn-svg .hn-route .line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 11; }
.hn-svg .hn-route .halo { stroke: var(--bg); stroke-width: 18; }
.hn-svg .hn-route .st { fill: var(--bg); stroke-width: 3; }
.hn-st:hover .hn-dot { r: 9; }

/* line rail under the stage */
.line-rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.line-chip {
  display: flex; align-items: center; gap: 9px; text-align: start;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink);
  border-radius: var(--r-sm); padding: 10px 11px; transition: border-color .18s, background .18s, transform .18s;
}
.line-chip:hover, .line-chip.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--panel)); transform: translateY(-2px); }
.line-chip .lc-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.line-chip.line-4 .lc-num { color: #1a1a00; }
.line-chip .lc-copy { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.line-chip .lc-copy b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-chip .lc-copy small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hero-scroll {
  position: absolute; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
[dir="rtl"] .hero-scroll { transform: translateX(50%); }
.hero-scroll i { font-style: normal; animation: bob 2.2s var(--ease) infinite; }
.hero-scroll:hover { color: var(--accent); }

/* ──────────────────────────────────────────── 6. workspace */
.workspace { padding: clamp(56px, 8vw, 104px) 0 clamp(40px, 6vw, 72px); position: relative; }
.workspace::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, transparent, var(--bg-2) 18%, var(--bg-2) 82%, transparent);
}
.workspace-shell {
  display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); gap: 18px;
  align-items: stretch; min-height: min(78vh, 760px);
}
.panel {
  position: relative; display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-toggle {
  position: absolute; top: 12px; inset-inline-end: 12px; z-index: 20;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); display: none; place-items: center;
}
.panel-toggle span { display: block; width: 14px; height: 2px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
.panel-heading { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.panel-heading-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
[data-theme="light"] .panel-heading-icon { color: var(--accent-2); }
.panel-heading-icon svg { width: 22px; height: 22px; }
.panel-heading-copy { display: flex; flex-direction: column; line-height: 1.3; }
.panel-heading-copy small { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.panel-heading-copy b { font-size: 15px; }
.panel-step { margin-inline-start: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.panel-step i { font-style: normal; opacity: .6; }

.tabs { display: flex; gap: 2px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; white-space: nowrap; border: 0; background: transparent; color: var(--muted);
  padding: 9px 12px; border-radius: var(--r-xs); font-size: 13px; font-weight: 600;
  transition: background .18s, color .18s;
}
.tabs button:hover { background: var(--panel-2); color: var(--ink); }
.tabs button.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.tab { padding: 14px 16px 20px; overflow-y: auto; display: none; }
.tab.active { display: block; }
.lines-intro { margin-bottom: 6px; }

.stage {
  position: relative; min-height: 0; overflow: hidden; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--panel-2); box-shadow: var(--shadow-sm);
}
.stage > #map, .stage > #diagram { position: absolute; inset: 0; }
#diagram { background: #fbfbf9; }
[data-theme="dark"] #diagram { background: #f5f4ef; } /* the schematic stays printed-paper white */
.stage-label {
  position: absolute; top: 12px; inset-inline-start: 12px; z-index: 900;
  display: flex; align-items: center; gap: 10px; padding: 8px 13px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.stage-label-icon { color: var(--accent); }
[data-theme="light"] .stage-label-icon { color: var(--accent-2); }
.stage-label small { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .06em; }
.stage-label b { display: block; font-size: 13px; line-height: 1.3; }

.view-switch {
  position: absolute; bottom: 14px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 905;
  display: flex; gap: 3px; padding: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--border-2); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
[dir="rtl"] .view-switch { transform: translateX(50%); }
.view-switch button {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px;
  padding: 8px 15px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.view-switch button:hover { color: var(--ink); }
.view-switch button.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.map-toolbar { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 905; display: flex; flex-direction: column; gap: 6px; }
.map-toolbar button {
  width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 94%, transparent); color: var(--ink); font-size: 15px;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.map-toolbar button:hover { border-color: var(--accent); }
.map-toolbar button.active-track { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.legend {
  position: absolute; bottom: 14px; inset-inline-end: 12px; z-index: 900;
  display: grid; gap: 4px; padding: 10px 12px; max-width: 220px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--border); border-radius: var(--r-md); font-size: 11.5px;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}
.legend > div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 16px; height: 4px; border-radius: 2px; flex-shrink: 0; }
.legend .x { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2.5px solid #111; }

.workspace-footnote { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.footnote-mark { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-2); font-size: 11px; flex-shrink: 0; margin-top: 3px; }

/* schematic chrome */
.sch-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.sch-viewport:active { cursor: grabbing; }
.sch-canvas { position: absolute; top: 0; inset-inline-start: 0; transform-origin: 0 0; will-change: transform; }
.sch-canvas.anim { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.sch .dim .lbl.on { opacity: 1; stroke: #fbfbf9; }
.sch .dim .s.on .st { opacity: 1; }
.sch-zoom { position: absolute; bottom: 74px; inset-inline-end: 12px; z-index: 900; display: flex; flex-direction: column; gap: 6px; }
.sch-zoom button { width: 38px; height: 38px; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 17px; line-height: 1; box-shadow: var(--shadow-sm); color: var(--ink); }
.sch-zoom button:hover { border-color: var(--accent); }
.sch-hint {
  position: absolute; top: 62px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 901;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px);
  background: var(--ink); color: var(--bg); padding: 8px 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-sm);
}
[dir="rtl"] .sch-hint { transform: translateX(50%); }
.sch-hint span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-hint button { border: 0; background: color-mix(in srgb, var(--bg) 22%, transparent); color: inherit; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; flex-shrink: 0; }

/* planner empty state */
.planner-empty { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px dashed var(--border-2); border-radius: var(--r-md); background: var(--panel-2); }
.planner-empty[hidden] { display: none; }
.empty-mark { display: flex; gap: 3px; padding-top: 6px; }
.empty-mark i { width: 4px; height: 22px; border-radius: 2px; }
.empty-mark i:nth-child(1) { background: var(--line-1); }
.empty-mark i:nth-child(2) { background: var(--line-4); transform: rotate(18deg); }
.empty-mark i:nth-child(3) { background: var(--line-2); }
.planner-empty b { display: block; font-size: 14.5px; }
.planner-empty p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.empty-return { display: inline-flex; gap: 6px; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--accent); text-decoration: none; }
[data-theme="light"] .empty-return { color: var(--accent-2); }

/* ────────────────────────────────────── 7. content sections */
.lines-section, .guide-section, .data-section, .about-section { padding: clamp(56px, 8vw, 104px) 0; }
.lines-section { border-top: 1px solid var(--border); }

.lines-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.line-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px;
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.line-card::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: var(--c); }
.line-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c) 55%, var(--border)); box-shadow: var(--shadow-sm); }
.line-card-head { display: flex; align-items: center; gap: 12px; }
.line-card-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--c); color: #fff; font-size: 17px; font-weight: 800; font-family: var(--mono); flex-shrink: 0; }
.line-card.line-4 .line-card-num { color: #1a1a00; }
.line-card-head b { display: block; font-size: 16px; }
.line-card-head small { display: block; color: var(--muted); font-size: 12px; }
.line-card-spark { width: 100%; height: 62px; }
.line-card-spark .spark-line { fill: none; stroke: var(--c); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.line-card-spark .spark-dot { fill: var(--panel); stroke: var(--c); stroke-width: 3; }
.line-card-spark .spark-x { fill: var(--panel); stroke: #111; stroke-width: 3.4; }
.line-card-ends { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.line-card-ends .arrow { color: var(--muted); }
.line-card-facts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--border); }
.line-card-facts b { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }

.guide-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.guide-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: mistake; }
.mistakes li {
  display: flex; gap: 14px; align-items: flex-start; counter-increment: mistake;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: 15px 16px;
  transition: border-color .2s, transform .2s;
}
.mistakes li:hover { border-color: var(--accent); transform: translateX(-3px); }
[dir="rtl"] .mistakes li:hover { transform: translateX(3px); }
.mistakes .m-num {
  display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%; background: var(--panel-3); color: var(--accent);
  font-family: var(--mono); font-size: 12px; font-weight: 800;
}
[data-theme="light"] .mistakes .m-num { color: var(--accent-2); }
.mistakes .m-ic { font-size: 17px; flex-shrink: 0; }
.mistakes .m-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.85; }
.mistakes .m-body b { color: var(--ink); }

.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.data-card {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px;
  transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.data-card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); }
.data-card-top { display: flex; align-items: center; gap: 10px; }
.data-card-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-xs); background: var(--panel-3); font-size: 16px; }
.data-card-top b { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.data-card p { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.data-card .tag { margin-top: auto; align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; }
[data-theme="light"] .data-card .tag { color: var(--accent-2); }

.about-section { background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.about-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.about-copy p { color: var(--muted); margin-top: 14px; line-height: 1.95; }
.about-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.about-cards { display: grid; gap: 12px; }
.about-card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; }
.about-card:hover { border-color: var(--border-2); }
.about-card-num { position: absolute; top: 16px; inset-inline-end: 18px; font-family: var(--mono); font-size: 12px; color: var(--muted); opacity: .7; }
.about-card h3 { font-size: 16px; margin-bottom: 6px; }
.about-card p { font-size: 13.5px; color: var(--muted); }
.about-card .link-btn { margin-top: 12px; }
.about-notice { display: flex; gap: 12px; align-items: flex-start; margin-top: var(--sp-6); padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel); }
.about-notice p { font-size: 12.5px; color: var(--muted); }
.notice-symbol { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); font-weight: 800; font-size: 13px; flex-shrink: 0; }

/* ──────────────────────────────── 8. map chrome (Leaflet + Google page) */
.leaflet-container { background: var(--bg-2); font: inherit; }
.leaflet-control-zoom a, .leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--border); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 80%, transparent) !important; color: var(--muted) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.station-label {
  background: color-mix(in srgb, var(--panel) 95%, transparent); color: var(--ink);
  border: 1px solid var(--border-2); border-radius: 8px; padding: 4px 9px;
  font-size: 12px; font-weight: 600; box-shadow: var(--shadow-sm); white-space: nowrap;
}
.station-label::before { display: none; }
.leaflet-tooltip.station-label { opacity: 1; }
.place-pin span {
  display: grid; place-items: center; width: 30px; height: 30px; font-size: 15px;
  background: var(--panel); border: 2px solid; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  box-shadow: var(--shadow-sm);
}
.place-pin span > * { transform: rotate(45deg); }
.userdot { position: relative; width: 18px; height: 18px; }
.userdot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; }
.userdot .pulse { position: absolute; inset: 0; border-radius: 50%; background: rgba(37, 99, 235, .35); animation: ping 2s infinite; }

/* google-maps page pieces that live here so both pages share one system */
.gm-scroll { overflow-y: auto; padding: 14px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.keybox { background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius); padding: 14px; font-size: 13px; }
.keybox input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); margin: 8px 0; direction: ltr; font-size: 13px; background: var(--panel-2); color: var(--ink); }
.keybox .btn { width: 100%; }
.gm-stage { flex: 1; min-width: 0; position: relative; background: var(--bg-2); }
body.app-shell .layout { flex: 1; display: flex; min-height: 0; position: relative; }
body.app-shell .panel { width: var(--panel-w); flex-shrink: 0; border-radius: 0; border: 0; border-inline-end: 1px solid var(--border); box-shadow: none; z-index: 1000; }
body.app-shell .panel-toggle { display: grid; }
body.app-shell .topbar .brand-name, body.app-shell .topbar .brand-overline { color: #fff; }
body.app-shell .top-actions > a, body.app-shell .top-actions > button, body.app-shell .top-actions select { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
body.app-shell .top-actions .top-download { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.swap-row { display: flex; justify-content: center; margin: -4px 0 2px; }
.swap { border: 1px solid var(--border); background: var(--panel-2); border-radius: 50%; width: 32px; height: 32px; color: var(--muted); display: grid; place-items: center; }
.swap:hover { color: var(--ink); border-color: var(--accent); }
.sc-places div, .sc-links a { border-color: var(--border); }
.rm-lbl { background: color-mix(in srgb, var(--panel) 95%, transparent); color: var(--ink); border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 600; }

/* ─────────────────────────────────────────── 9. animation */
@keyframes rise { from { transform: translateY(115%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes shuttle { 0% { inset-inline-start: 0; } 50% { inset-inline-start: calc(100% - 6px); } 100% { inset-inline-start: 0; } }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .display .line > * { animation: none; }
}

/* ─────────────────────────────────────────── 10. responsive */
@media (max-width: 1180px) {
  :root { --panel-w: 360px; }
  .mainnav a { padding: 8px 9px; font-size: 13px; }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-stage { order: 2; }
  .stage-canvas { aspect-ratio: 4 / 3; }
  .guide-grid, .about-grid { grid-template-columns: 1fr; }
  .workspace-shell { grid-template-columns: 1fr; }
  .stage { min-height: 62vh; order: -1; }
  .mainnav { display: none; }
  .hero-scroll { display: none; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 60px; }
  .panel-toggle { display: grid; }
  .panel.collapsed .panel-heading, .panel.collapsed .tabs, .panel.collapsed .tab { display: none; }
  .panel.collapsed { min-height: 0; }
  .top-cta, .github-link { display: none; }
  .brand-name { display: none; }
  .status-chip { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; }
  .stage { min-height: 58vh; }
  .tab { max-height: none; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .od { grid-template-columns: 1fr; }
  .od-link { padding: 6px 0; min-width: 0; }
  .od-track { inset-inline: auto; inset-inline-start: 50%; top: -4px; bottom: -4px; width: 2px; height: auto; }
  .od-track i { inset-inline-start: -2px; top: 0; animation: shuttle-v 3.6s var(--ease) infinite; }
  .console-opts { align-items: stretch; }
  .btn-plan { margin-inline-start: 0; width: 100%; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .summary b { font-size: 18px; }
  .legend { display: none; }
  .view-switch { inset-inline: 12px; transform: none; justify-content: center; }
  [dir="rtl"] .view-switch { transform: none; }
  .stage-label small { display: none; }
  .footer-grid { flex-direction: column; align-items: flex-start; gap: 18px; }
  .footer-links { margin-inline-start: 0; }
}

@media (max-width: 420px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-rail { grid-template-columns: 1fr; }
  .top-actions #lang-select { max-width: 96px; }
}

@keyframes shuttle-v { 0% { top: 0; } 50% { top: calc(100% - 6px); } 100% { top: 0; } }

/* ─────────────────────────────────────────── 11. print */
@media print {
  .topbar, .scroll-rail, .hero-bg, .to-top, .map-toolbar, .view-switch, .sch-zoom, .panel-toggle, .hero-scroll { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .stage, .card { break-inside: avoid; box-shadow: none; border-color: #ccc; }
  .workspace-shell { display: block; }
  .tab { display: block !important; overflow: visible; }
}

/* ═════════════════════════════════════════ public transport teaser (home) */
.bus-teaser { padding: clamp(32px, 5vw, 64px) 0; background: var(--bg-2); border-block: 1px solid var(--border); }
.bus-teaser-inner {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: clamp(20px, 4vw, 48px); align-items: center;
}
.bus-teaser-copy .section-desc { margin: 0; }
.bus-teaser-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.bus-teaser-stats {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
}
.bus-teaser-stats li { background: var(--panel); padding: clamp(14px, 2.4vw, 22px); display: flex; flex-direction: column; gap: 2px; }
.bus-teaser-stats b {
  font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.bus-teaser-stats span { font-size: 12px; color: var(--muted); }
@media (max-width: 860px) { .bus-teaser-inner { grid-template-columns: 1fr; } }
