/* MyRideWeather · "The Almanac" v2
 * Editorial / instrument-panel aesthetic.
 * - Instrument Serif (display) + Geist (UI) + JetBrains Mono (data)
 * - Atmospheric palette: ink, parchment, payne's grey, single amber accent
 * - Subtle paper grain in light mode; matte slate in dark mode
 * - Section labels small-caps; numbers tabular and oversized
 */

:root, [data-theme="light"] {
  /* surfaces — parchment, not pure white */
  --bg:           #f3efe7;       /* warm paper */
  --bg-grain:     1;             /* enable grain overlay */
  --surface:      #faf7f0;
  --surface-2:   #ede8dd;
  --surface-deep:#1a1c20;        /* deep panel even in light mode (used sparingly) */
  --border:      rgba(26, 28, 32, 0.10);
  --border-strong: rgba(26, 28, 32, 0.18);
  --ink:         #1a1c20;        /* warm black */
  --ink-2:       #3a3e46;
  --ink-3:       #6e7280;
  --ink-4:       #9aa0a8;
  --rule:        rgba(26, 28, 32, 0.22);   /* almanac rules */

  --shadow-sm:   0 1px 0 rgba(26,28,32,.04);
  --shadow-md:   0 1px 0 rgba(26,28,32,.04), 0 10px 30px -14px rgba(26,28,32,.20);
  --shadow-lg:   0 1px 0 rgba(26,28,32,.04), 0 30px 60px -24px rgba(26,28,32,.28);

  /* data colors — atmospheric, not candy */
  --temp:        #c5613f;        /* terracotta */
  --temp-soft:   rgba(197, 97, 63, 0.18);
  --precip:      #3d4f6e;        /* payne's grey-blue */
  --precip-soft: rgba(61, 79, 110, 0.20);
  --cloud:       #8a8d96;        /* warm grey */
  --cloud-soft:  rgba(138, 141, 150, 0.22);
  /* UV is a *data* color (next to --cloud / --precip), NOT a second accent.
     Amber (--accent) stays the only brand accent. Muted violet, conventional
     for UV scales — tuned slightly muted to sit alongside the existing
     atmospheric palette without competing with terracotta. */
  --uv:          #7b5ea7;        /* muted violet (curve / line) */
  --uv-soft:     rgba(123, 94, 167, 0.18);
  /* WHO UV band tokens — used by the uvChart's banded fill + by the almanac
     /mobile UV tile when it wants to colour by tier. Same editorial,
     desaturated palette as the wind tiers (no neon greens or yellows). */
  --uv-low:       #6b8a6a;       /* moss, ≤2 */
  --uv-moderate:  #b8932f;       /* muted amber, 3–5 (relates to --wind-3) */
  --uv-high:      #c97a3a;       /* burnt orange, 6–7 */
  --uv-veryhigh:  #9b3a2a;       /* oxide red, 8–10 (relates to --wind-4) */
  --uv-extreme:   #7b5ea7;       /* muted violet, 11+ (relates to --uv) */

  /* wind tiers — calm grey → atmospheric blue → amber → oxide red */
  --wind-1: #8a8d96;
  --wind-2: #3d4f6e;
  --wind-3: #c8902f;
  --wind-4: #9b3a2a;

  /* THE accent — a confident amber, used like a drop cap */
  --accent:        #c8902f;
  --accent-hover:  #a87618;
  --accent-fg:     #1a1c20;
  --accent-deep:   #80581a;

  --warn:    #c8902f;
  --warn-bg: rgba(200, 144, 47, 0.10);
  --err:     #9b3a2a;
  --ok:      #5a7a4a;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  --pad: 16px;
  --pad-tight: 12px;
  --gap: 18px;
}

[data-theme="dark"] {
  --bg:           #14161a;
  --bg-grain:     0;
  --surface:      #1a1d22;
  --surface-2:   #20242b;
  --surface-deep:#0c0d11;
  --border:      rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.18);
  --ink:         #ece8de;
  --ink-2:       #b8b4a9;
  --ink-3:       #807d75;
  --ink-4:       #555149;
  --rule:        rgba(236, 232, 222, 0.20);

  --shadow-sm:   0 1px 0 rgba(0,0,0,.4);
  --shadow-md:   0 1px 0 rgba(0,0,0,.4), 0 12px 30px -12px rgba(0,0,0,.55);
  --shadow-lg:   0 1px 0 rgba(0,0,0,.4), 0 30px 60px -24px rgba(0,0,0,.7);

  --temp:        #e08560;
  --temp-soft:   rgba(224, 133, 96, 0.24);
  --precip:      #7e93b6;
  --precip-soft: rgba(126, 147, 182, 0.24);
  --cloud:       #6b6e78;
  --cloud-soft:  rgba(180, 184, 196, 0.20);
  /* UV data color (dark theme) — lifted muted violet for legibility on the
     dark background, paralleling how --temp / --precip / --cloud shift. */
  --uv:          #9d83c6;
  --uv-soft:     rgba(157, 131, 198, 0.22);
  /* WHO UV band tokens — dark theme variants. Each lifts toward the
     equivalent light-mode hue while staying in the desaturated, editorial
     register the chart tokens use. */
  --uv-low:       #88a087;       /* lifted moss */
  --uv-moderate:  #d9a64d;       /* lifted amber (matches dark --wind-3) */
  --uv-high:      #e09060;       /* lifted burnt orange */
  --uv-veryhigh:  #c66a55;       /* lifted oxide red (matches dark --wind-4) */
  --uv-extreme:   #9d83c6;       /* lifted violet (matches dark --uv) */

  --wind-1: #6b6e78;
  --wind-2: #7e93b6;
  --wind-3: #d9a64d;
  --wind-4: #c66a55;

  --accent:        #e0b35a;
  --accent-hover:  #f0c66d;
  --accent-fg:     #14161a;
  --accent-deep:   #b08938;

  --warn:    #d9a64d;
  --warn-bg: rgba(217, 166, 77, 0.12);
  --err:     #c66a55;
  --ok:      #7a9a6a;
}

[data-density="compact"] { --pad: 12px; --pad-tight: 8px; --gap: 12px; }
[data-density="comfy"]   { --pad: 22px; --pad-tight: 16px; --gap: 24px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font: 14px/1.55 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
  position: relative;
}
/* Paper grain — subtle, only in light mode. SVG noise via data URI */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  opacity: calc(var(--bg-grain) * 0.45);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

button { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.01em; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
.serif{ font-family: 'Instrument Serif', 'Times New Roman', Georgia, serif; }
.italic{ font-style: italic; }

/* Almanac small-caps label — used everywhere */
.label-sc {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── App shell ──────────────────────────────────────────────────────── */
.app-frame { min-height: 100%; display: flex; flex-direction: column; }

.app-toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--rule);
}
.app-toolbar .grow { flex: 1; }

.tool-tabs { display: flex; gap: 0; }
.tool-tabs button {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-3); font-weight: 500; font-size: 12px;
  letter-spacing: 0.10em; text-transform: uppercase;
  padding: 8px 14px; cursor: pointer; position: relative;
}
.tool-tabs button + button { border-left: 1px solid var(--rule); }
.tool-tabs button:hover { color: var(--ink); }
.tool-tabs button[data-on="1"] { color: var(--ink); }
.tool-tabs button[data-on="1"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; background: var(--ink);
}

.icon-btn {
  appearance: none; border: 1px solid var(--border);
  background: transparent; color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); }

/* ── Brand mark + lockup ───────────────────────────────────────────── */
.monogram { display: block; color: var(--ink); }
.monogram .mono-north { transform-origin: 0 0; animation: mono-pulse 4.5s ease-in-out infinite; }
@keyframes mono-pulse {
  0%, 88%, 100% { opacity: 1; }
  92% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) { .monogram .mono-north { animation: none; } }

.brand-lockup {
  display: inline-flex; align-items: center; gap: 14px;
}
.brand-lockup .brand-words { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.brand-lockup .brand-name {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; font-weight: 400; letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-lockup .brand-name em { font-style: italic; }
.brand-lockup .brand-strap {
  font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
  white-space: nowrap;
}
.brand-lockup.lg .brand-name { font-size: 38px; }
.brand-lockup.lg .brand-name .dot { color: var(--ink-3); margin: 0 4px; }
.brand-lockup.lg .brand-strap { font-size: 10.5px; margin-top: 8px; }

/* ── Primitives ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-hd { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.card-hd h3 {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
}
.card-hd .meta { color: var(--ink-3); font-size: 11.5px; }
.card-body { padding: 20px; }

.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  padding: 0 22px; height: 46px; border-radius: 0;
  font-weight: 500; font-size: 13px;
  letter-spacing: 0.18em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .12s, color .12s, border-color .12s;
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
}
.btn-primary {
  background: var(--ink); color: var(--surface);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #faf7f0; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--ink-2);
  height: 36px; padding: 0 12px; font-size: 11px;
}
.btn-ghost:hover { color: var(--ink); }
.btn-secondary {
  background: transparent; color: var(--ink); border-color: var(--rule);
  height: 38px; padding: 0 16px; font-size: 11px;
}
.btn-secondary:hover { border-color: var(--ink); }

/* underline link — editorial */
.link-u {
  color: var(--ink); border-bottom: 1px solid currentColor;
  text-decoration: none; transition: color .12s;
  padding-bottom: 1px;
}
.link-u:hover { color: var(--accent-deep); }

.input {
  appearance: none; border: 0; border-bottom: 1.5px solid var(--rule);
  background: transparent; color: var(--ink);
  height: 44px; padding: 0 4px; border-radius: 0;
  font: inherit; font-weight: 500; outline: none; width: 100%;
  transition: border-color .12s;
  font-feature-settings: 'tnum';
}
.input:focus { border-color: var(--ink); }
.input:hover { border-color: var(--ink-3); }

.input-group { display: flex; align-items: flex-end; gap: 14px; }
.input-group .unit-toggle {
  padding-bottom: 6px;
  display: flex; gap: 0;
  border-bottom: 1.5px solid var(--rule);
}
.unit-toggle button {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-3); font-weight: 500; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0 8px; cursor: pointer;
}
.unit-toggle button + button { border-left: 1px solid var(--rule); }
.unit-toggle button[data-on="1"] { color: var(--ink); }

.field-label {
  display: block;
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

/* ── Departure control (I.8) — day-rail + time-presets + stepper ────── */

.departure-control {
  position: relative;    /* contains the visually-hidden a11y inputs */
}

/* ── Day rail ─────────────────────────────────────────────────────────── */
.day-rail {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;              /* leave room for scrollbar on small screens */
  scrollbar-width: none;            /* Firefox: hide thin scrollbar */
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}
.day-rail::-webkit-scrollbar { display: none; }

.day-chip {
  appearance: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 56px;                 /* tall enough for two lines + 44px touch area */
  padding: 0 8px;
  gap: 2px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  flex-shrink: 0;
  white-space: nowrap;
}
.day-chip-name {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.day-chip-num {
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  font-feature-settings: 'tnum';
}
.day-chip[data-on="1"] {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.day-chip[data-on="1"] .day-chip-name {
  color: color-mix(in oklab, var(--surface), transparent 30%);
}
.day-chip:hover:not([data-on="1"]) {
  background: var(--surface-2, var(--surface));
  border-color: var(--rule);
  color: var(--ink);
}
.day-chip:hover:not([data-on="1"]) .day-chip-name {
  color: var(--ink-2);
}
.day-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Time presets row ─────────────────────────────────────────────────── */
.time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.time-preset-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 13px;
  background: var(--surface-2, var(--surface));
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.07em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.time-preset-chip:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink-3);
}
.time-preset-chip:active {
  color: var(--ink);
  border-color: var(--ink);
}
.time-preset-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Fine time stepper: ◀ HH:MM ▶ ──────────────────────────────────── */
.time-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
  margin-bottom: 14px;
}

.time-stepper-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 14px;
  border: 0;
  cursor: pointer;
  transition: background .10s, color .10s;
}
.time-stepper-btn:hover {
  background: var(--surface-2, var(--surface));
  color: var(--ink);
}
.time-stepper-btn:active {
  background: var(--rule);
  color: var(--ink);
}
.time-stepper-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.time-stepper-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  font-size: 15px;
  font-weight: 600;
  font-feature-settings: 'tnum';
  color: var(--ink);
  letter-spacing: 0.04em;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 0 10px;
  height: 44px;
  user-select: none;
}

/* ── Summary line ───────────────────────────────────────────────────── */
.departure-summary {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-2);
  line-height: 1.2;
}

/* ── Reduced-motion overrides ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .day-chip,
  .time-preset-chip,
  .time-stepper-btn {
    transition: none;
  }
}

/* Chip — pared back almanac-style */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; height: 26px; border-radius: 999px;
  background: transparent; color: var(--ink-2);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip.tone-ok   { color: #4a7c59; border-color: color-mix(in oklab, #4a7c59, transparent 60%); }
.chip.tone-warn { color: var(--accent-deep); border-color: color-mix(in oklab, var(--accent-deep), transparent 60%); }
.chip.tone-info { color: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .chip.tone-ok   { color: #88c397; }
[data-theme="dark"] .chip.tone-warn { color: var(--accent); }

/* ── Dropzone — instrument-panel feel ──────────────────────────────── */
.dropzone {
  border: 1px dashed var(--border-strong);
  background: transparent;
  border-radius: 0;
  padding: 44px 24px;
  text-align: center;
  transition: border-color .14s, background .14s;
  cursor: pointer;
  position: relative;
}
.dropzone::before, .dropzone::after {
  content: ""; position: absolute; width: 12px; height: 12px;
  border: 1.5px solid var(--ink);
}
.dropzone::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.dropzone::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.dropzone:hover { border-color: var(--ink); background: color-mix(in oklab, var(--ink), transparent 96%); }
.dropzone[data-active="1"] {
  border-color: var(--ink); background: color-mix(in oklab, var(--accent), transparent 90%);
}
.dropzone .gpx-icon {
  width: 44px; height: 44px; margin: 0 auto 16px;
  display: grid; place-items: center;
  color: var(--ink);
}
.dropzone .dz-title {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; font-style: italic; font-weight: 400;
  letter-spacing: -0.01em;
}
.dropzone .dz-sub {
  font-size: 11px; color: var(--ink-3); margin-top: 8px;
  letter-spacing: 0.10em; text-transform: uppercase;
}

.file-pill {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--ink);
  background: transparent;
  position: relative;
}
.file-pill::before, .file-pill::after {
  content: ""; position: absolute; width: 10px; height: 10px;
  border: 1.5px solid var(--ink);
}
.file-pill::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.file-pill::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.file-pill .pill-name { font-weight: 500; font-size: 14px; }
.file-pill .pill-sub  {
  font-size: 10.5px; color: var(--ink-3); margin-top: 2px;
  letter-spacing: 0.10em; text-transform: uppercase;
}
.file-pill .grow { flex: 1; }
.file-pill .pill-icon { color: var(--ink); }

/* ── The Almanac strip — replaces summary cards ─────────────────────── */
.almanac {
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  padding: 18px 0;
  display: grid;
  grid-template-columns: 1.4fr repeat(6, 1fr);
  gap: 28px;
  align-items: end;
}
.almanac .lead {
  padding-right: 14px; border-right: 1px solid var(--rule);
}
.almanac .lead-num {
  font-family: 'Instrument Serif', serif;
  font-size: 76px; line-height: 0.9; font-weight: 400; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums lining-nums;
}
.almanac .lead-num .unit {
  font-size: 22px; font-style: italic; color: var(--ink-3); margin-left: 4px;
}
.almanac .lead-cap { margin-top: 8px; }

.almanac-stat .label { /* small caps label */
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
.almanac-stat .value {
  font-family: 'Instrument Serif', serif;
  font-size: 28px; line-height: 1; font-weight: 400; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.almanac-stat .value .unit {
  font-size: 14px; font-style: italic; color: var(--ink-3); margin-left: 2px;
}
.almanac-stat .sub {
  font-size: 11.5px; color: var(--ink-3); margin-top: 6px;
}
/* §2.4 power-aware ETA sub — italic Instrument Serif to signal it's modeled,
   not measured. Sits inside .almanac-stat .sub via a span override. */
.almanac-eta-sub {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

/* ── Post-Verdict 2-column band: Best times | Air & sky ────────────── */
.results-band-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  margin-top: 8px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.results-band-2col > .strip-section { margin-top: 0; }
.results-band-2col > .airsky-section { margin-top: 0; }
/* Event mode: stripHost is absent, so airsky is the band's only child.
   Force it into column 2 (right) to match its consumer-mode position. */
.results-band-2col > .airsky-section:only-child { grid-column: 2; }
@media (max-width: 980px) {
  .results-band-2col { grid-template-columns: 1fr; gap: 18px; }
}

/* ── Section I 2×2 charts grid ─────────────────────────────────────── */
.charts-grid-2x2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
}
@media (max-width: 980px) {
  .charts-grid-2x2 { grid-template-columns: 1fr; }
}

/* ─── Air & sky overlay (opt-in) ─────────────────────────────────────────
   Reuses almanac vocabulary so the section reads as an almanac extension.
   No new colors — sub-text uses --ink-3, toggle matches the per-km detail
   toggle affordance. Header is always visible; readout renders only when on. */
.airsky-section { margin-top: 18px; padding-bottom: 4px; }
.airsky-header { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.airsky-header .grow { flex: 1; }
.airsky-toggle {
  appearance: none; background: transparent; border: 0;
  padding: 4px 0; font: inherit; font-size: 11.5px;
  color: var(--ink-3); cursor: pointer; letter-spacing: 0.02em;
  min-height: 44px;
}
.airsky-toggle:hover { color: var(--ink-2); text-decoration: underline; }
.airsky-toggle:focus-visible { outline-offset: 2px; }
.airsky-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px; margin-top: 12px; padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.airsky-stat-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.airsky-stat-value {
  font-family: 'Instrument Serif', serif;
  font-size: 24px; line-height: 1; font-weight: 400; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.airsky-stat-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.airsky-empty { font-size: 12px; color: var(--ink-3); padding: 10px 0; }
.cams-attribution { color: var(--ink-3); }

/* Verdict — editorial pull quote */
.verdict-block {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 28px 0;
}
.verdict-quote {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.18; letter-spacing: -0.015em;
  color: var(--ink);
  position: relative;
  padding-left: 28px;
}
.verdict-quote::before {
  content: "“"; position: absolute; left: -8px; top: -18px;
  font-size: 96px; color: var(--accent); line-height: 1;
}
.verdict-clothing {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.45;
  color: var(--ink-2);
  margin-top: 18px;
  padding-left: 28px;
}
.watchout .label-sc { margin-bottom: 12px; }
.watchout .items { display: flex; flex-direction: column; gap: 10px; }
.watchout .row {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; border-bottom: 1px dotted var(--rule);
  font-size: 13px;
}
.watchout .row .dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.watchout .row .where {
  flex: 1; color: var(--ink-3); font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.watchout-empty {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-3);
}

/* ── Chart card — pared back ───────────────────────────────────────── */
.chart-host { position: relative; }
.chart-host .hover-tooltip {
  position: absolute; pointer-events: none;
  background: var(--ink); color: var(--surface);
  padding: 7px 11px; border-radius: 0;
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .12s;
  font-feature-settings: 'tnum';
}
[data-theme="dark"] .chart-host .hover-tooltip { background: var(--surface); color: var(--ink); }
.chart-host[data-hover="1"] .hover-tooltip { opacity: 1; }

/* ── Map ───────────────────────────────────────────────────────────── */
.map-host {
  position: relative;
  height: 480px;
  overflow: hidden;
}
.leaflet-container { height: 100%; font: inherit; background: var(--surface-2); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,0.7) !important; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(20,22,26,0.7) !important; color: var(--ink-3) !important; }

.wind-marker { pointer-events: none; }
.wind-marker.sel { z-index: 1000 !important; }
.wind-marker svg { display: block; overflow: visible; }

/* K.2 — direction-of-travel polyline. Dashes flow start→finish via animated
   stroke-dashoffset. Reduced-motion keeps the dashed line static so direction
   reads from the labeled endpoints without optical noise. */
@keyframes mrw-route-flow {
  to { stroke-dashoffset: -16; }
}
.leaflet-overlay-pane .route-poly {
  animation: mrw-route-flow 2.4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .leaflet-overlay-pane .route-poly { animation: none; }
}

/* Endpoint word-labels next to the START / FINISH discs. */
.route-endpoint-tag {
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 10px/1 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255,255,255,0.9);
  padding: 3px 6px;
  border: 1px solid var(--rule);
  white-space: nowrap;
  pointer-events: none;
}
:root[data-theme='dark'] .route-endpoint-tag {
  color: #fff;
  background: rgba(14,20,34,0.85);
  border-color: rgba(255,255,255,0.25);
}

.map-legend {
  position: absolute; bottom: 16px; right: 16px; z-index: 400;
  background: var(--surface);
  border: 1px solid var(--ink);
  padding: 12px 14px;
  font-size: 10.5px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 140px;
}
.map-legend .title {
  font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 4px; font-size: 10px;
}
.map-legend .row { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.map-legend .sw { width: 22px; height: 3px; flex-shrink: 0; }
.map-legend .num { color: var(--ink-2); font-feature-settings: 'tnum'; }

/* ── Roadworks layer ──────────────────────────────────────────────────────
   Severity-styled markers + lines via inline SVG inside divIcons (see
   public/js/roadworks.js). The wrapper class lets us add CSS hooks per
   tier without duplicating styles per marker — `.roadworks-marker.roadworks-high`
   etc. Per-tier color is set inline on the SVG fill so it tracks any
   future custom-tenant token override. */
.roadworks-marker {
  display: block;
  line-height: 0;
}
.roadworks-marker svg { display: block; }

/* Roadworks popup — editorial layout: heavy title, secondary road label,
   description, time window, restriction chips, attribution. Uses the same
   surface/ink tokens as the rest of the editorial map cards so light/dark
   and tenant overrides flow naturally. */
.roadworks-popup {
  font-family: 'Geist', Inter, sans-serif;
  color: var(--ink);
  max-width: 300px;
}
.roadworks-popup-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.roadworks-popup-road {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.roadworks-popup-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 6px 0;
  white-space: pre-wrap;
}
.roadworks-popup-window {
  font-size: 11px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dotted var(--rule);
}
.roadworks-popup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.roadworks-popup-chip {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 10px;
  color: var(--ink-2);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.roadworks-popup-source {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dotted var(--rule);
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Warning summary line ("⚠ N roadworks on your route — M likely affect
   cyclists") — sits below the map host. Editorial restraint: amber accent
   border-left + tabular numerals. Suppressed entirely (not display:none —
   the element is removed from DOM) when no roadworks match. */
.roadworks-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--warn-bg);
  border-left: 2px solid var(--warn);
  font-family: 'Geist', Inter, sans-serif;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.roadworks-summary-icon {
  color: var(--warn);
  font-size: 14px;
  line-height: 1;
}
.roadworks-summary-text {
  flex: 1;
}

.map-tooltip {
  position: absolute; z-index: 600;
  pointer-events: none;
  background: var(--ink); color: var(--surface);
  padding: 10px 12px; border-radius: 0;
  font-size: 11.5px; white-space: nowrap;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-100% - 14px));
  border-left: 2px solid var(--accent);
}

.map-debug-badge {
  position: absolute; top: 8px; right: 8px; z-index: 800;
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; line-height: 1.6;
  color: var(--ink);
  white-space: pre;
  pointer-events: auto;
}
[data-theme="dark"] .map-debug-badge {
  background: rgba(14,20,34,0.88);
  color: var(--ink);
}
.map-debug-badge .copy-btn {
  display: block; margin-top: 4px;
  background: none; border: none; padding: 0;
  font-family: inherit; font-size: 9px;
  color: var(--ink-2); cursor: pointer;
  text-decoration: underline;
}
.map-debug-badge .copy-btn:hover { color: var(--ink); }
[data-theme="dark"] .map-tooltip { background: var(--surface); color: var(--ink); border-left-color: var(--accent); }
.map-tooltip .ttl-row { display: flex; gap: 14px; justify-content: space-between; }
.map-tooltip .ttl-row span:first-child { opacity: .55; letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }

/* ── Skeleton ──────────────────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%,
    color-mix(in oklab, var(--surface-2), var(--surface) 50%) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ── Phone frame ───────────────────────────────────────────────────── */
.phone-shell {
  width: 390px; height: 844px;
  border-radius: 48px;
  background: #1a1c20;
  padding: 12px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.35), 0 2px 0 rgba(255,255,255,.05) inset;
  position: relative; flex-shrink: 0;
}
.phone-screen {
  width: 100%; height: 100%;
  border-radius: 36px; overflow: hidden;
  background: var(--bg);
  position: relative; isolation: isolate;
}
.phone-notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 32px; border-radius: 20px;
  background: #1a1c20; z-index: 100;
}
.scroll-area { height: 100%; overflow-y: auto; }
.scroll-area::-webkit-scrollbar { width: 0; }

/* ── Warn / error banners ──────────────────────────────────────────── */
.warn-banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: var(--warn-bg);
  border-left: 2px solid var(--accent);
}
.warn-banner .ico { color: var(--accent-deep); flex-shrink: 0; margin-top: 2px; }
.warn-banner .title { font-weight: 600; letter-spacing: 0.04em; }
.warn-banner .sub { color: var(--ink-2); font-size: 13px; margin-top: 3px; }

.error-banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: transparent;
  border-left: 2px solid var(--err);
}
.error-banner .ico { color: var(--err); flex-shrink: 0; margin-top: 2px; }

/* ── Organizer broadcast banner (§4.11) ─────────────────────────────── */
/* Shown above the issue stamp on Results when a tenant has an active
   broadcast. Dismissible per device via localStorage. */
.broadcast-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: color-mix(in oklab, var(--accent), transparent 90%);
  /* BUILD-SPEC §4.11 specifies a 1px accent left border (editorial restraint). */
  border-left: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.5;
}
.broadcast-banner .broadcast-body { flex: 1; color: var(--ink-2); }
.broadcast-banner .broadcast-body strong { color: var(--ink); }
.broadcast-banner .broadcast-body a {
  color: var(--accent-deep);
  text-underline-offset: 2px;
}
.broadcast-banner .broadcast-dismiss {
  flex-shrink: 0;
  appearance: none; background: none; border: none;
  cursor: pointer; padding: 0; margin: 0;
  color: var(--ink-3); font-size: 16px; line-height: 1;
}
.broadcast-banner .broadcast-dismiss:hover { color: var(--ink); }

/* ── Sponsors (§4.7) ────────────────────────────────────────────────── */
/* Editorial restraint: 1px rule above the strip, opacity 0.85, never
   animates, never blocks first paint. rel="sponsored noopener" applied
   server/client-side.
   Migration 0027 introduced tier-driven sizing — the per-row height is
   passed in as a custom property (--spo-h) set inline by
   public/js/sponsors.js from the (placement × tier) policy table in
   sponsor-layout.js, so each row sizes to its tier without one CSS rule
   per cell. max-width is still capped to keep wide lockups from running
   off the row; for strip placements a clean mark_logo_url uploaded by
   the organizer is the recommended path. */
.spo-strip {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  opacity: 0.85;
}
.spo-strip.spo-header { margin: 12px 0 18px; }
.spo-strip.spo-inline_between_charts { margin: 16px 0; }
.spo-strip.spo-footer { margin-top: 36px; }

/* Block layout — a "Presented by" moment. Used by header (tier ∈
   {title, presenting}) and is the only shape the share-card SVG renders.
   Column-stack the label above the logo, center the whole thing, and
   give it generous whitespace so it doesn't read as another strip. */
.spo-strip.spo-block {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.spo-strip.spo-block.spo-header { margin: 18px 0 28px; }

.spo-link {
  display: inline-flex; align-items: center;
  text-decoration: none;
}
.spo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Logo sizing — height comes from the inline --spo-h custom property set
   by the renderer; fallback to today's 32 px for any sponsor that
   somehow lacks the property (defence-in-depth). max-width scales with
   the resolved height so a 2.5:1 lockup at 80 px tall gets up to 320 px
   wide — wide enough that the wordmark stays readable. */
.spo-logo {
  height: var(--spo-h, 32px);
  width: auto;
  max-width: calc(var(--spo-h, 32px) * 4.5);
  display: block;
}

/* Editorial small-caps prefix label — "Presented by", "Coffee partner",
   organizer-typed copy, etc. Reuses the .label-sc tokens deliberately so
   it lands in the same typographic family as the rest of the site. */
.spo-label {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
/* In strips, the label hugs the leftmost logo with a thin bullet
   separator. In blocks it sits above, centered. */
.spo-strip[data-layout="strip"] .spo-label::after {
  content: " ·";
  margin-left: 6px;
  opacity: 0.6;
}
.spo-strip.spo-block .spo-label {
  text-align: center;
}

/* ── Layout helpers ─────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row   { display: flex; gap: var(--gap); }
.center{ display: grid; place-items: center; }
.grow  { flex: 1; }

.screen-wrap {
  padding: 36px 36px 96px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Issue stamp — sits above editorial headers */
.issue-stamp {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0;
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.issue-stamp .dot { width: 4px; height: 4px; background: var(--ink-3); border-radius: 50%; flex-shrink: 0; }
.issue-stamp .vol { color: var(--ink); font-weight: 600; }
.issue-stamp .grow { flex: 1; }

/* Editorial display heading */
.display-h {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(56px, 7vw, 96px);
  line-height: 1; font-weight: 400; letter-spacing: -0.04em;
  margin: 24px 0 12px;
}
.display-h .it { font-style: italic; color: var(--accent-deep); }
[data-theme="dark"] .display-h .it { color: var(--accent); }

/* Tenant tagline epigraph — italic serif line under the route-page stamp,
   in the brand color. Rendered only when the tenant sets a tagline. */
.route-tagline {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.1; letter-spacing: -0.01em;
  color: var(--accent-deep);
  margin: 14px 0 0;
}
[data-theme="dark"] .route-tagline { color: var(--accent); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .almanac { grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
  .almanac .lead { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--rule); padding-bottom: 16px; padding-right: 0; }
  .verdict-block { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .almanac { grid-template-columns: 1fr 1fr; }
  .screen-wrap { padding: 20px 16px 60px; }
  /* 44px minimum tap targets on mobile */
  .icon-btn { width: 44px; height: 44px; }
  .unit-toggle button { padding: 12px 14px; }
  .chip { height: 36px; padding: 8px 12px; }
}

/* Style guide */
.sg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.sg-swatch { display: flex; flex-direction: column; gap: 8px; }
.sg-swatch .chip-color { height: 64px; border: 1px solid var(--border); }
.sg-swatch .name { font-size: 12px; font-weight: 600; }
.sg-swatch .mono { font-size: 11px; color: var(--ink-3); }
.type-row { display: flex; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.type-row .label { width: 110px; }
.type-row .demo { flex: 1; }
.type-row .specs { color: var(--ink-3); font-size: 11px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.001s !important; }
}

/* Accessibility — focus-visible ring per TOKENS.md
   (added in Phase 0.1 prod port; the prototype documented the rule but
   did not ship the rule itself.) */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:focus-visible,
.icon-btn:focus-visible,
.chip:focus-visible {
  outline-offset: 1px;
}
.input:focus-visible {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}
.dropzone:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent);
}

/* ── Per-km table (Section III) ─────────────────────────────────────── */
.per-km-headerbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 36px; padding-top: 24px;
  border-top: 1px solid var(--rule);
  margin-bottom: 14px;
}
.per-km-headerbar .grow { flex: 1; }
.per-km-density {
  display: inline-flex; align-items: center; gap: 0;
  border: 1px solid var(--rule);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
}
.per-km-density button {
  appearance: none; background: transparent; border: 0;
  padding: 6px 10px; font: inherit; color: inherit; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.per-km-density button[data-on="1"] { color: var(--ink); background: var(--surface-2); }
.per-km-density button + button { border-left: 1px solid var(--rule); }
.per-km-density-unit { padding: 0 8px; color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.08em; }

.per-km-csv { padding: 6px 10px; font-size: 11.5px; }

/* Detail toggle button — sits between density toggle and CSV button */
.per-km-detail-toggle {
  appearance: none; background: transparent; border: 1px solid var(--rule);
  padding: 6px 10px; font: inherit; font-size: 11px; letter-spacing: 0.06em;
  text-transform: none; color: var(--ink-3); cursor: pointer;
  white-space: nowrap;
}
.per-km-detail-toggle:hover { color: var(--ink); border-color: var(--ink-3); }

.per-km-tablewrap {
  border: 1px solid var(--rule);
  max-height: 540px;
  overflow-y: auto;
}
.per-km-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px;
  table-layout: auto;
}
.per-km-table thead {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
}
.per-km-table th {
  font-weight: 500; text-align: left;
  padding: 10px 12px;
  font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.per-km-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px dotted var(--rule);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}
.per-km-table .unit {
  margin-left: 2px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-3);
}
.per-km-table .eta-cell { display: flex; align-items: center; gap: 6px; }
.per-km-table .eta-cell .eta-time { color: var(--ink); }
.per-km-table .wind-cell {
  display: inline-flex; align-items: center; gap: 6px;
}
.per-km-table .wind-cell .wind-chev { color: var(--wind-2); }
.per-km-table tr.tint-wind .wind-cell .wind-chev { color: var(--wind-3); }
.per-km-table .sun-cell {
  color: var(--ink-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.per-km-table tr.tint-wind { background: var(--warn-bg); }
.per-km-table tr.tint-rain { background: var(--precip-soft); }
.per-km-table tr.hovered { box-shadow: inset 4px 0 0 var(--accent); }

@media (max-width: 560px) {
  .per-km-table th, .per-km-table td { padding: 6px 8px; font-size: 11.5px; }
  .per-km-table .cloud-cell, .per-km-table th:nth-child(6) { display: none; }
}

/* ── Best departure time strip (Section: Best times to leave) ─────── */
.strip-section { margin-top: 8px; }
.strip-top-labels {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 8px; padding: 10px 0 8px;
  font-size: 14px; color: var(--ink-2);
  font-family: 'Instrument Serif', serif;
}
.strip-top-labels .strip-top-label { font-style: italic; }
.strip-top-labels .strip-top-label em {
  font-style: italic; color: var(--ink-3);
  font-family: 'Geist', system-ui, sans-serif; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; margin-right: 4px;
}
.strip-top-labels .sep { color: var(--ink-3); }

.strip-svghost { position: relative; }
.strip-svg { display: block; }
.strip-tick { transition: opacity 120ms ease; }
.strip-tick:hover { opacity: 0.8; }
.strip-current { pointer-events: none; }
.strip-hover-guide { pointer-events: none; }
.strip-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  white-space: nowrap;
  z-index: 10;
}

.strip-panel { margin-top: 10px; }
.strip-panel-summary {
  display: flex; align-items: baseline; gap: 6px;
  width: 100%;
  appearance: none; background: transparent;
  border: 1px solid var(--rule);
  padding: 8px 12px; cursor: pointer;
  font: inherit; color: var(--ink-3);
  font-size: 12px; letter-spacing: 0.04em;
}
.strip-panel-summary .grow { flex: 1; }
.strip-panel-summary .edit {
  color: var(--accent-deep);
  font-style: italic;
  font-family: 'Instrument Serif', serif;
  font-size: 13px;
  letter-spacing: 0;
}
.strip-panel-summary .sep { color: var(--ink-4); }
.strip-panel-summary .unit {
  margin-left: 2px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--ink-3);
}

.strip-panel-body[data-open="0"] { display: none; }
.strip-panel-body[data-open="1"] {
  display: grid; grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px 12px;
  border: 1px solid var(--rule);
  border-top: 0;
  background: var(--surface-2);
}
.strip-slider-row {
  display: grid; grid-template-columns: 80px 1fr 56px;
  align-items: center; gap: 12px;
  font-size: 12px;
}
.strip-slider-row .lbl {
  color: var(--ink-3);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.strip-slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.strip-slider-row .val { color: var(--ink-2); text-align: right; }
.strip-panel-reset {
  appearance: none; background: transparent; border: 0;
  padding: 4px 0; cursor: pointer;
  font: inherit; color: var(--accent-deep);
  font-style: italic; font-family: 'Instrument Serif', serif;
  font-size: 13px;
  align-self: start;
}
.strip-panel-reset:hover { color: var(--accent); }

@media (max-width: 560px) {
  .strip-top-labels { font-size: 13px; gap: 6px; }
  .strip-svg { height: 48px; }
  .strip-slider-row { grid-template-columns: 60px 1fr 48px; gap: 8px; }
  .strip-panel-summary {
    flex-wrap: wrap;
    font-size: 11px;
  }
}

/* ── Phase 1.5: Save / My rides ─────────────────────────────────────── */
.topbar {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 16px;
}
.topbar .issue-stamp { flex: 1; min-width: 0; }

/* Tenant logo in the masthead. Sits to the left of the issue-stamp when the
   active tenant has theme.logoUrl set. Height matches the brand-lockup small
   variant (36px) per design_handoff/SCREENS.md §"Both lockup variants"; the
   image is centered against the baseline-aligned stamp text so the visual
   weight balances. width:auto preserves the uploader's aspect ratio. */
.topbar-tenant-logo {
  height: 36px;
  width: auto;
  display: block;
  align-self: center;
  flex-shrink: 0;
}

/* Masthead → Landing home button. Wraps the issue-stamp on Results / My
   rides so clicking the brand mark returns to start, per the web
   convention. Stripped of native button chrome; the stamp's existing
   typography does all the visual work. The flex layout keeps the optional
   tenant logo and the issue-stamp on one row when both are present. */
.topbar-home {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  flex: 1;
  min-width: 0;
  display: flex;
  /* center cross-axis so a 36px logo and ~14px issue-stamp text sit visually
     balanced. baseline-aligns inside the stamp itself stay intact because the
     stamp is its own flex container. */
  align-items: center;
  gap: 12px;
  transition: opacity 120ms ease;
}
.topbar-home:hover { opacity: 0.85; }
.topbar-home:focus-visible { outline-offset: 2px; }

.my-rides-link {
  appearance: none; background: transparent; border: 0;
  padding: 4px 0; cursor: pointer;
  font: inherit; color: var(--accent-deep);
  font-family: 'Instrument Serif', serif;
  font-style: italic; font-size: 15px;
}
.my-rides-link:hover { color: var(--accent); }

.save-route-btn.saved {
  color: var(--ok);
  border-color: var(--ok);
}
.save-route-btn.save-failed {
  color: var(--err);
  border-color: var(--err);
}

/* J.4 — speed-source segmented toggle. Sits in the Results action row next
   to Save / Copy link. Editorial: thin rules, no rounded corners, no
   accent fill. Active option flips ink/surface. */
.speed-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  font-size: 12px;
}
.speed-mode-opt {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font: inherit;
  color: var(--ink-3);
  cursor: pointer;
  border-right: 1px solid var(--rule);
}
.speed-mode-opt:last-child { border-right: 0; }
.speed-mode-opt:hover { color: var(--ink); }
.speed-mode-opt[data-active="1"] {
  color: var(--surface);
  background: var(--ink);
}

/* L.2 — speed-mode toggle on Landing sits below the field label. */
.landing-speed-toggle { margin-bottom: 10px; }

/* Task 2 — event/tenant route-page avg-speed control. Reuses .speed-mode-opt
   for the segmented buttons; larger tap targets for one-thumb start-line use. */
.event-speed-control { margin: 14px 0 4px; }
.event-speed-toggle { flex-wrap: wrap; max-width: 100%; }
.event-speed-toggle .speed-mode-opt { padding: 10px 14px; min-height: 44px; }
.event-speed-toggle .speed-mode-opt[aria-disabled="true"] { cursor: not-allowed; }
.event-speed-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.event-speed-customlabel { letter-spacing: 0.02em; }
.event-speed-input {
  appearance: none;
  width: 84px;
  padding: 8px 10px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
}
.event-speed-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.event-speed-setup {
  border: 1px solid var(--rule);
  padding: 12px;
  margin-top: 4px;
  max-width: 340px;
}
.event-speed-setuphint { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; }
.event-speed-setup-fields { display: flex; gap: 8px; margin-bottom: 10px; }
.event-speed-setup-fields .event-speed-input { width: 50%; }

/* Phase 3 — posture row in the mini-profile sheet. Three chips, the rider
   picks one before "Use power" can be confirmed. */
.event-speed-posture-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.event-speed-posture-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.event-speed-posture-chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  text-transform: lowercase;
}
.event-speed-posture-chip:hover { color: var(--ink); border-color: var(--ink); }
.event-speed-posture-chip[data-active="1"] {
  color: var(--surface);
  background: var(--ink);
  border-color: var(--ink);
}
.event-speed-posture-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Phase 2 — two-mode text switch ("By speed / By power") above the value.
   Lighter than the boxed segmented .speed-mode-toggle: small mono-feel text
   buttons with a thin underline on the active one, separated by a hairline. */
.speed-mode-text-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.speed-mode-text-opt {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 10px;
  font: inherit;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
}
.speed-mode-text-opt + .speed-mode-text-opt { border-left: 1px solid var(--rule); }
.speed-mode-text-opt:hover { color: var(--ink); }
.speed-mode-text-opt[data-active="1"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.speed-mode-text-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Quiet sub-hint under the by-speed input ("Organiser suggests 25 km/h").
   Disappears the moment the rider touches the number. */
.event-speed-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* Phase 5 — small ghost text link sitting right below the almanac strip,
   right-aligned so it reads near the Departs / Arrives stats (the cells
   whose values most obviously flip when the rider reverses the route).
   Event mode only; consumer mode keeps Reverse in the header action row. */
.almanac-reverse-host {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.almanac-reverse {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  cursor: pointer;
}
.almanac-reverse:hover { color: var(--ink); }
.almanac-reverse:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.almanac-reverse[data-reversed="1"] {
  color: var(--ink);
}
.almanac-reverse[data-reversed="1"]::before {
  content: '↺ ';
  color: var(--accent);
}

/* Phase 5 — stat-flash. When a pace/wave/breaks change triggers a reforecast
   (caller sets flashStats: true on the next render), briefly outline the
   cells whose numbers moved so the rider sees what the control they touched
   did. The animation runs once on mount; the class is harmless to leave on
   the node — the next render rebuilds the DOM anyway. */
@keyframes mrw-stat-flash {
  0%   { outline: 2px solid var(--accent); outline-offset: 6px; }
  100% { outline: 2px solid transparent;   outline-offset: 6px; }
}
.mrw-stat-flash {
  animation: mrw-stat-flash 250ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .mrw-stat-flash { animation: none; }
}

/* Static-outline variant used only by the harness sign-off screenshot — the
   live 250ms keyframe can't be timed through a page-load snapshot, so we
   lock the outline on for the demo. Not used in the real app. */
.mrw-stat-flash-demo {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

/* "Plan your ride" panel — gathers the rider's elapsed-time modifiers under
   the almanac. Chrome echoes .almanac: 1.5px ink rules top + bottom, 1px
   --rule dividers between rows, small-caps row labels in a fixed left column,
   the rider's controls in the right column. The "PLAN YOUR RIDE" small-caps
   header sits above the rules. */
.plan-panel { margin: 28px 0 4px; }
.plan-panel-header {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.plan-panel-body {
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}
.plan-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.plan-row:last-child { border-bottom: 0; }
.plan-row-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 8px; /* baseline-align with the value's first line of text */
}
.plan-row-value {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
}

/* Reset margins on the pace control + wave dropdown once they're inside a
   plan-row-value cell — the row's padding owns the vertical spacing. */
.plan-row-value .event-speed-control { margin: 0; }
.plan-row-value .event-speed-body { margin-top: 4px !important; }
.plan-row-value .speed-mode-text-toggle { margin-bottom: 0; }
.plan-row-value .wave-selector-wrap { width: 100%; max-width: 280px; }
.plan-row-value .breaks-wrapper { width: auto; }

/* Mobile — labels stack above values. */
@media (max-width: 600px) {
  .plan-row { grid-template-columns: 1fr; gap: 8px; padding: 14px 0; }
  .plan-row-label { padding-top: 0; }
}

/* ─── Route pill bar (0029, multi-route display redesign) ──────────────────
   Mounts immediately under the masthead/topbar on multi-route event tenants,
   above the H1 — see brief docs/plans/2026-05-28-multi-route-tenant-display-
   redesign.md "Behaviour — Tier 1".  Class chrome follows the .wave-selector
   /.plan-panel pattern: tokens-only, no new colors, 44px min hit target. */
.route-pillbar { margin: 0 0 28px; }
.route-pillbar-label { margin-bottom: 10px; }
.route-pillbar-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.route-pill {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; min-height: 44px; padding: 8px 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r-md);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.route-pill:hover { border-color: var(--ink-3); }
.route-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.route-pill[data-selected="1"] {
  background: var(--ink); color: var(--surface); border-color: var(--ink);
}
.route-pill-primary { font-weight: 500; letter-spacing: 0; }
.route-pill-secondary {
  font-size: 11px; color: var(--ink-3); margin-top: 2px;
  font-variant-numeric: tabular-nums lining-nums;
}
.route-pill[data-selected="1"] .route-pill-secondary { color: var(--surface); opacity: 0.85; }

/* Mobile — pills become a horizontal scroll-snap container so the active
   pill can be centered via scrollIntoView({ inline: 'center' }). */
@media (max-width: 767px) {
  .route-pillbar-pills {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; padding-bottom: 4px;
  }
  .route-pill { scroll-snap-align: center; flex: 0 0 auto; }
}

/* "← All routes" link — appears on 6+ route tenants when the pill bar is
   the foreground UI but the picker landing is still reachable. */
.route-all-link {
  display: inline-block; margin-top: 10px; font-size: 12px;
  color: var(--ink-3); text-decoration: none;
  border-bottom: 1px dotted var(--rule);
}
.route-all-link:hover { color: var(--ink); border-color: var(--ink); }

/* Overflow popover — appears as the last pill on 6+ route tenants. Reuses
   the wave-selector popover chrome to keep the visual language consistent
   without forking a second positioning model. */
.route-pill-overflow-panel {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--ink);
  min-width: 200px; padding: 4px 0;
}
.route-pill-overflow-panel button {
  display: block; width: 100%; padding: 8px 14px; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.route-pill-overflow-panel button:hover { background: var(--surface-2); }

/* Screen-reader-only live region for "Now showing forecast for…" announces.
   Avoids any visual footprint while still triggering AT speech. */
.route-pillbar-live {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* L.2 — physics-mode card replaces the speed input when "From power" is on. */
.landing-physics-card {
  border: 1px solid var(--rule);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.landing-physics-headline {
  font: 600 13px/1.2 var(--font-body, inherit);
  color: var(--ink);
}
.landing-physics-inputs {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-2);
}
.landing-physics-hint {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
}
.landing-physics-setup {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.landing-physics-setup:hover { color: var(--ink-2); }

/* L.2 — persistent "Using:" readout, shown on Landing AND Results. */
.speed-source-readout {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.speed-source-using-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-3);
}
.speed-source-using-value { color: var(--ink-2); }
.speed-source-readout-results {
  margin-top: 4px;
  margin-bottom: 6px;
}

/* ── Accounts — topbar chip + avatar (Phase C) ───────────────────────── */
.topbar-account { display: inline-flex; align-items: center; }
.topbar-account-chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 4px 10px 4px 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
}
.topbar-account-chip:hover { border-color: var(--border-strong); }
.topbar-account-name { font-weight: 500; }
.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  flex-shrink: 0;
}
.topbar-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.topbar-avatar-initials {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

/* ── Continue-with-Google sheet (Phase C §5.2) ──────────────────────── */
.signin-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklch, var(--ink) 35%, transparent);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.signin-sheet {
  position: relative;
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--ink);
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  padding: 32px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.signin-close {
  position: absolute;
  top: 10px;
  right: 12px;
  appearance: none;
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-3);
  padding: 6px 10px;
}
.signin-close:hover { color: var(--ink); }
.signin-headline {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.signin-headline .it { font-style: italic; }
.signin-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
}
.signin-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  min-height: 48px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.signin-google-btn:hover { background: var(--ink); color: var(--surface); }
.signin-google-btn:hover svg path { /* keep Google brand colors on hover too */ }
.signin-google-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Email/password — "or" divider + form (Phase: account-creation-email). */
.signin-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
  text-transform: lowercase;
}
.signin-divider::before,
.signin-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--rule);
}
.signin-email {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signin-email-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.signin-input {
  min-height: 44px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  font: inherit;
  font-size: 14px;
}
.signin-input:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.signin-email-submit {
  appearance: none;
  min-height: 44px;
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 120ms ease;
}
.signin-email-submit:hover { opacity: 0.9; }
.signin-email-submit:disabled { opacity: 0.6; cursor: default; }
.signin-msg {
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
  color: var(--ink-2);
  min-height: 1em;
}
.signin-msg.is-err { color: #b42318; }
.signin-msg.is-ok { color: var(--accent-deep, #1a7f43); }
.signin-email-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.signin-email-links .link-u {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.signin-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.signin-foot-note { flex: 1; }
.signin-not-now {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
}
.signin-consent {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 4px;
}
@media (max-width: 480px) {
  .signin-sheet { padding: 24px 20px 18px; }
  .signin-headline { font-size: 24px; }
}

/* Merge prompt (Phase C §5.3) — same sheet chrome, different body. */
.merge-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.merge-radios {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 6px 0 8px;
}
.merge-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
}
.merge-radio[data-active="1"] {
  border-color: var(--ink);
  color: var(--ink);
}
.merge-radio input { accent-color: var(--ink); }
.merge-continue { align-self: stretch; }

/* ── Drawer Account section ─────────────────────────────────────────── */
.prefs-account .prefs-account-row {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 0;
}
.prefs-account-meta { display: flex; flex-direction: column; gap: 2px; }
.prefs-account-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.prefs-account-email { font-size: 12px; color: var(--ink-3); }
.prefs-account-sync { font-size: 12px; color: var(--ink-3); }
.prefs-account-sync-ok { color: var(--ok, #2e7d32); }
.prefs-account-links { display: flex; gap: 16px; padding-top: 4px; }
.prefs-account-links .link-u { font-size: 12px; }
.prefs-account-signout { color: var(--ink-3); }
.prefs-account-signout:hover { color: var(--err, #d03030); }

/* ── Account & privacy page ────────────────────────────────────────── */
.account-privacy {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.account-privacy .display-h { margin: 12px 0 8px; }
.account-section {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.account-section:first-of-type { border-top: 0; }
.account-section h2.label-sc { margin: 0; }
.account-row { display: flex; gap: 16px; align-items: center; }
.account-meta { display: flex; flex-direction: column; gap: 4px; }
.account-name { font-size: 18px; font-weight: 500; color: var(--ink); }
.account-email { font-size: 13px; color: var(--ink-2); }
.account-source {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.account-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-list-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
}
.account-list-item:last-child { border-bottom: 0; }
.account-list-secondary { font-size: 11.5px; color: var(--ink-3); }
.account-note { font-size: 13px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.account-empty {
  font-size: 12.5px;
  color: var(--ink-3);
  font-style: italic;
}
.account-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.account-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--ink);
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.account-btn:hover { background: var(--ink); color: var(--surface); }
.account-btn-danger {
  border-color: var(--err, #d03030);
  color: var(--err, #d03030);
}
.account-btn-danger:hover { background: var(--err, #d03030); color: var(--surface); }
.account-plan {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* Delete-confirm: proper label + input pair (E.2 a11y fix — was wrapped
   in a misleading .merge-radio div before). */
.delete-confirm-label {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 4px;
}
.delete-confirm-input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
}
.delete-confirm-input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Visible focus rings on every new account-UI affordance. The page-level
   :focus-visible default leaves these alone today; spelling them out so
   future CSS resets can't accidentally hide them. */
.signin-not-now:focus-visible,
.prefs-account-links .link-u:focus-visible,
.account-btn:focus-visible,
.topbar-account-chip:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .my-rides-link { font-size: 14px; }
}

/* ── Phase 1.5: My rides list ──────────────────────────────────────── */
.saved-routes-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--rule);
}
.saved-route-row {
  position: relative;
  display: flex; flex-direction: column;
  border-bottom: 1px dotted var(--rule);
  padding: 14px 0;
}
.saved-route-row.refreshing { opacity: 0.5; }
.saved-route-row.refresh-error { background: var(--temp-soft); }
.saved-route-tap {
  appearance: none; background: transparent; border: 0;
  display: flex; align-items: baseline; gap: 8px;
  cursor: pointer;
  font: inherit; color: var(--ink);
  text-align: left; padding: 0;
}
.saved-route-tap:hover .saved-route-name { color: var(--accent-deep); }
.saved-route-name {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  font-style: italic;
}
.saved-route-leader {
  flex: 1; border-bottom: 1px dotted var(--rule);
  align-self: center; margin: 0 8px; height: 0;
}
.saved-route-meta {
  font-size: 13px; color: var(--ink-3);
}
.saved-route-verdict {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-2);
  margin-top: 6px;
  padding-right: 32px;
}
.saved-row-delete {
  position: absolute; top: 12px; right: 0;
  appearance: none; background: transparent; border: 0;
  cursor: pointer; padding: 4px 8px;
  font: inherit; color: var(--ink-4);
  font-size: 16px;
}
.saved-row-delete:hover { color: var(--err); }
.saved-row-delete[data-armed="1"] {
  color: var(--err);
  font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.my-rides-back {
  appearance: none; background: transparent; border: 0;
  padding: 0; cursor: pointer;
  font: inherit; color: var(--accent-deep);
  font-style: italic;
  font-family: 'Instrument Serif', serif;
  font-size: 14px;
}
.my-rides-back:hover { color: var(--accent); }

.pull-to-refresh-hint {
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 0;
}

.refresh-stale-btn { font-size: 12px; padding: 6px 10px; }

@media (max-width: 560px) {
  .saved-route-name { font-size: 19px; }
  .saved-route-verdict { font-size: 14px; padding-right: 28px; }
}

/* ── Phase 1.4: Provider integrations ───────────────────────────────── */
.provider-section {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.provider-buttons {
  display: flex; flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}
.provider-dot {
  color: var(--accent);
  font-size: 14px;
  padding: 0 2px;
}
.provider-btn {
  appearance: none; background: transparent; border: 1px solid var(--rule);
  padding: 6px 12px;
  font: inherit; font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 0;
  /* Match the brand-mandated 48px height of .strava-connect-btn so paired
     ghost+brand buttons align on the same baseline. */
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.provider-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}
.provider-btn[data-configured="0"] {
  color: var(--ink-4);
  cursor: not-allowed;
}
.provider-btn[data-configured="0"]:hover {
  color: var(--ink-4);
  border-color: var(--rule);
}
.provider-btn[data-connected="1"] {
  color: var(--ok);
  border-color: var(--ok);
}

/* Strava brand-mandated connect button. The image IS the affordance — no own
   border, label, or icon (per "Never use any part of a Strava logo as the
   icon for your application"). 8px clear-space padding around the artwork
   honors the brand pack's clear-space rule. Minimum height = 48px @1x. */
.strava-connect-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  transition: opacity 120ms ease;
}
.strava-connect-btn img {
  height: 48px;
  width: auto;
  display: block;
  pointer-events: none;
}
.strava-connect-btn:hover { opacity: 0.92; }
.strava-connect-btn:active { opacity: 0.85; }
.strava-connect-btn:focus-visible { outline-offset: 2px; }

.provider-disconnect-link {
  appearance: none; background: transparent; border: 0;
  padding: 0; cursor: pointer;
  font: inherit; font-size: 11.5px;
  color: var(--ink-3);
  text-decoration: none;
  transition: color 120ms ease;
}
.provider-disconnect-link:hover {
  color: var(--ink-2);
  text-decoration: underline;
}
.provider-disconnect-link:focus-visible {
  outline-offset: 1px;
}

.provider-manual-note {
  font-family: 'Instrument Serif', serif;
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.provider-manual-note em { color: var(--ink-2); }

.provider-picker {
  border: 1px solid var(--rule);
  padding: 12px 14px;
}
.provider-picker-header {
  display: flex; align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.provider-picker-disconnect {
  appearance: none; background: transparent; border: 0;
  padding: 0; cursor: pointer;
  font: inherit; color: var(--accent-deep);
  font-family: 'Instrument Serif', serif;
  font-style: italic; font-size: 13px;
}
.provider-picker-disconnect:hover { color: var(--accent); }
.provider-picker-list {
  display: flex; flex-direction: column;
}
.provider-picker-row {
  appearance: none; background: transparent; border: 0;
  display: flex; align-items: baseline; gap: 8px;
  cursor: pointer;
  font: inherit; color: var(--ink);
  text-align: left; padding: 10px 0;
  border-bottom: 1px dotted var(--rule);
}
.provider-picker-row:hover .provider-picker-name { color: var(--accent-deep); }
.provider-picker-name {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  font-style: italic;
}
.provider-picker-leader {
  flex: 1; border-bottom: 1px dotted var(--rule);
  align-self: center; margin: 0 8px; height: 0;
}
.provider-picker-meta {
  font-size: 12.5px; color: var(--ink-3);
}
.provider-picker-empty,
.provider-picker-error {
  color: var(--ink-3);
  font-size: 13px;
  padding: 10px 0;
}
.provider-picker-error { color: var(--err); }

/* ── Provider browser: tabs (Strava routes/activities), search, lazy list ── */
.provider-browser-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.provider-browser-tab {
  appearance: none; background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 6px 10px;
  font: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.provider-browser-tab:hover { color: var(--ink-2); }
.provider-browser-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.provider-search {
  margin-bottom: 8px;
}
.provider-search-input {
  width: 100%;
  font-size: 14px;
}
.provider-browser-list {
  max-height: 320px;
  overflow-y: auto;
}
.provider-browser-sentinel { height: 1px; }
.provider-browser-status {
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 8px 0 2px;
  min-height: 1.2em;
}
.provider-browser-status.err { color: var(--err); }

/* Strava attribution row above the route list. The mark is fixed-height and
   sits alone, separate from the disconnect button and route rows. */
.strava-attribution {
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.strava-attribution img {
  height: 24px;
  width: auto;
  display: block;
}

/* Each route row pairs a load-button with a "View on Strava" external link.
   Wrapper exists because nesting <a> inside <button> is invalid HTML. */
.provider-picker-rowwrap {
  display: flex;
  align-items: stretch;
  gap: 12px;
  border-bottom: 1px dotted var(--rule);
}
.provider-picker-rowwrap > .provider-picker-row {
  flex: 1;
  border-bottom: 0;
}
/* Strava-mandated link styling: bold + Strava brand orange #FC5200. */
.strava-view-link {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #FC5200;
  text-decoration: none;
  white-space: nowrap;
  padding: 0 4px;
}
.strava-view-link:hover { text-decoration: underline; }
.strava-view-link:focus-visible { outline-offset: 2px; }

/* Athlete-limit waitlist panel — shown when the OAuth callback redirected
   with status=waitlist (Strava 403). Editorial; no error red, this is a
   "we're full" moment, not a failure. */
.provider-waitlist {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.provider-waitlist .label-sc { margin-bottom: 8px; }
.provider-waitlist-body {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0 0 14px;
  max-width: 56ch;
}
.provider-waitlist-form {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  max-width: 480px;
}
.provider-waitlist-form .input {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
}
.provider-waitlist-submit {
  padding: 0 18px;
  min-height: 44px;
}
.provider-waitlist-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-3);
  min-height: 1.4em;
}
.provider-waitlist-status.ok { color: var(--ok); }
.provider-waitlist-status.err { color: var(--err); }

/* ── Legal pages (Privacy, Terms) ──────────────────────────────────── */
.legal-page {
  padding: 36px 28px 64px;
}
.legal-wrap {
  max-width: 760px;
  margin: 0 auto;
}
.legal-nav {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 28px;
  font-size: 13px;
}
.legal-nav .grow { flex: 1; }
.legal-h1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-size: 48px;
  line-height: 1;
  margin: 0 0 36px;
}
.legal-page section {
  border-top: 1px solid var(--rule);
  padding: 18px 0;
}
.legal-page h2 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-style: italic;
  font-size: 20px;
  letter-spacing: -0.005em;
  margin: 0 0 8px;
  color: var(--ink);
}
.legal-page p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
  max-width: 64ch;
}
.legal-footer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 12.5px;
}

/* Landing footer privacy/terms links — quiet, beneath the "no signup" strip. */
.landing-legal-links {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.02em;
}
.landing-legal-links a { color: var(--ink-3); }
.landing-legal-links a:hover { color: var(--ink-2); }

@media (max-width: 560px) {
  .provider-buttons { gap: 6px; }
  .provider-btn { padding: 5px 9px; font-size: 11.5px; }
  .provider-picker-name { font-size: 16px; }
}

/* ── Phase 2.B Preferences drawer ───────────────────────────────────────── */
.prefs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
}
.prefs-drawer {
  width: min(360px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--rule);
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.prefs-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.prefs-header .grow { flex: 1; }
.prefs-close {
  appearance: none; background: transparent; border: 0;
  font-size: 22px; line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0 4px;
}
.prefs-close:hover { color: var(--ink); }

.prefs-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prefs-label {
  font-size: 12.5px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.prefs-segctrl {
  display: inline-flex;
  border: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--ink-2);
}
.prefs-segctrl button {
  appearance: none; background: transparent; border: 0;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.prefs-segctrl button[data-on="1"] {
  background: var(--surface-2);
  color: var(--ink);
}
.prefs-segctrl button + button {
  border-left: 1px solid var(--rule);
}

/* Inline km/h ↔ m/s toggle in the per-km table's WIND column header.
   Same shape as .prefs-segctrl but shrunk for inline use. */
.wind-unit-toggle {
  display: inline-flex;
  margin-left: 8px;
  border: 1px solid var(--rule);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-3);
  vertical-align: baseline;
}
.wind-unit-toggle button {
  appearance: none; background: transparent; border: 0;
  padding: 1px 6px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.wind-unit-toggle button[data-on="1"] {
  background: var(--surface-2);
  color: var(--ink);
}
.wind-unit-toggle button + button {
  border-left: 1px solid var(--rule);
}
.wind-unit-toggle button:focus-visible {
  outline-offset: 0;
}

@media (max-width: 560px) {
  .prefs-drawer {
    width: 100vw;
    border-left: 0;
    padding: 18px;
  }
}

.prefs-hint {
  font-size: 12px;
  color: var(--ink-3);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

/* Collapsible section (Rider profile). The .prefs-section base provides the
   vertical gap; this overrides to remove gap when closed so the header sits
   tight against the next section.
*/
.prefs-collapsible[data-open="0"] { gap: 0; }
.prefs-collapsible-header {
  appearance: none; background: transparent; border: 0;
  width: 100%;
  padding: 0;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  font: inherit; color: inherit;
}
.prefs-collapsible-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.prefs-collapsible-chev {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  color: var(--ink-3);
  transition: transform 120ms ease;
  transform: rotate(90deg);
}
.prefs-collapsible[data-open="1"] .prefs-collapsible-chev {
  transform: rotate(-90deg);
}
.prefs-collapsible-body {
  display: flex; flex-direction: column; gap: 14px;
  margin-top: 10px;
}

.prefs-field {
  display: flex; flex-direction: column; gap: 6px;
}
.prefs-sublabel {
  font-size: 12px;
  color: var(--ink-2);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}
.prefs-numrow {
  display: flex; align-items: baseline; gap: 8px;
}
.prefs-num {
  width: 88px;
  padding: 6px 10px;
  font-size: 14px;
}
.prefs-num-suffix {
  font-size: 12px;
  color: var(--ink-3);
}

/* L.3 — riding-posture picker. Four 2×2-ish cells (responsive: 4 wide on
   desktop, 2×2 on mobile). 44px min hit-target per spec. Stroke-only
   silhouettes pick up currentColor so light/dark themes don't need
   duplicated assets. */
.prefs-posture .posture-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
@media (max-width: 520px) {
  .prefs-posture .posture-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.posture-opt {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 10px 8px;
  min-height: 88px;          /* room for silhouette + label + CdA tag */
  font: inherit;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.posture-opt:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}
.posture-opt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.posture-opt[aria-checked="true"] {
  color: var(--surface);
  background: var(--ink);
  border-color: var(--ink);
}
.posture-opt[aria-checked="true"] .posture-cda {
  color: color-mix(in oklch, var(--surface) 80%, transparent);
}
.posture-opt svg {
  display: block;
}
.posture-label {
  font-size: 12px;
  font-weight: 500;
}
.posture-cda {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* Advanced expander — sits below the grid, collapsed by default. */
.posture-advanced-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 0 0;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.posture-advanced-toggle:hover { color: var(--ink); }
.posture-advanced-body {
  margin-top: 6px;
}

/* ── Event mode: wave selector (§2.4) ──────────────────────────────────── */
.wave-selector {
  margin-top: 20px;
}
.wave-selector-wrap {
  position: relative;
  display: inline-block;
  min-width: 280px;
  max-width: 100%;
}
.wave-selector-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font: inherit;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.wave-selector-btn:hover { border-color: var(--ink-3); }
.wave-selector-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wave-selector-btn-label { flex: 1; }
.wave-selector-chev {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--ink-3);
  transition: transform 120ms ease;
}
.wave-selector-wrap[data-open="1"] .wave-selector-chev { transform: rotate(180deg); }
.wave-selector-panel {
  position: absolute;
  top: calc(100% - 1px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 0;
  z-index: 20;
  max-height: 280px;
  overflow: auto;
}
.wave-selector-row {
  appearance: none;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 16px;
  color: var(--ink);
  font: inherit;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px dotted var(--rule);
}
.wave-selector-row:last-child { border-bottom: 0; }
.wave-selector-row:hover { background: var(--surface-2); }
.wave-selector-row[data-selected="1"] { color: var(--accent); }

@media (max-width: 560px) {
  .wave-selector-wrap { width: 100%; }
}

/* ── Model chip — weather source override (I.1) ─────────────────────────── */
.model-chip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.model-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.model-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.model-chip-action { color: var(--ink-3); }
.model-chip:hover .model-chip-action { color: var(--accent); }

.model-chip-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 200px;
  overflow: hidden;
}

.model-chip-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.model-chip-row:last-child { border-bottom: 0; }
.model-chip-row:hover { background: var(--surface-2); }
.model-chip-row[data-selected="1"] { color: var(--accent); font-weight: 600; }

/* §2.4 italic stamp shown when ?wave= preselected the wave */
.wave-stamp {
  margin-top: 10px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-2);
}

/* ── Breaks / rest-stop editor ─────────────────────────────────────────── */
.breaks-wrapper { position: relative; }

.btn.breaks-active {
  border-color: var(--accent);
  color: var(--accent);
}

.breaks-editor {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  min-width: 280px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breaks-editor-hd {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.breaks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.break-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule);
}

.break-row-label { flex: 1; color: var(--ink-2); }

.break-delete-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.break-delete-btn:hover { color: var(--err); }

.break-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.break-input {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 4px 6px;
}
.break-input-km  { width: 68px; }
.break-input-min { width: 52px; }

.break-add-btn {
  font-size: 12px;
  padding: 4px 10px;
  white-space: nowrap;
}

.break-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.break-preset-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  transition: border-color 80ms, color 80ms;
}
.break-preset-chip:hover { border-color: var(--accent); color: var(--accent); }

/* Break divider row in per-km table */
.break-divider-row { background: transparent !important; }
.break-divider-cell {
  padding: 6px 12px !important;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--accent);
  border-bottom: 1px dotted var(--rule);
  letter-spacing: 0.02em;
}
.break-divider-icon { margin-right: 6px; }

/* ── Mobile chrome (≤560px) — verdict-first Results redesign ──────── */

/* Collapsed ride header — hidden by default; visible only on mobile. */
.mobile-header { display: none; }
.mobile-header-titlerow {
  display: flex; align-items: flex-end; gap: 12px;
  margin-top: 12px;
}
.mobile-header-title {
  font-family: 'Instrument Serif', serif;
  font-size: 26px; font-weight: 400; line-height: 1.1; letter-spacing: -0.02em;
  margin: 0; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
.mobile-header-edit {
  appearance: none; border: 1px solid var(--border-strong);
  background: transparent; color: var(--ink-2);
  font: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 10px 14px;
  min-height: 44px; min-width: 56px;
  cursor: pointer;
}
.mobile-header-edit:active { background: var(--surface-2); }
.mobile-header-meta {
  margin-top: 6px;
  font-size: 12.5px; line-height: 1.45;
  color: var(--ink-3);
  display: block;
  word-spacing: 0.04em;
}
.mobile-header-meta-sep { color: var(--ink-4); }

@media (max-width: 560px) {
  .mobile-header { display: block; }
  .results-display-h-desktop { display: none; }
}

/* ── Verdict chips (mobile only) ──────────────────────────────────── */
.verdict-chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.verdict-chip {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: transparent;
  white-space: nowrap;
}
[data-theme="dark"] .verdict-chip { color: var(--accent); }

@media (max-width: 560px) {
  .verdict-chips { display: flex; }
}

/* ── Wind-impact tile (mobile only) ────────────────────────────────── */
.wind-impact-tile {
  display: none;
  border: 1px solid var(--rule);
  border-radius: var(--r-md, 6px);
  padding: 14px 16px;
  margin-top: 16px;
  gap: 14px;
  align-items: center;
  background: var(--surface);
}
.wind-impact-icon { color: var(--ink-3); flex: 0 0 auto; }
.wind-impact-body { flex: 1; min-width: 0; }
.wind-impact-label {
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3);
}
.wind-impact-headline {
  font-family: 'Instrument Serif', serif;
  font-size: 26px; line-height: 1.1; letter-spacing: -0.02em;
  color: var(--ink); margin-top: 2px;
}
.wind-impact-headline .it { font-style: italic; color: var(--accent-deep); }
[data-theme="dark"] .wind-impact-headline .it { color: var(--accent); }
.wind-impact-sub {
  font-size: 12px; color: var(--ink-3); margin-top: 4px;
}

/* ── Mobile metric tiles (TEMP · RAIN · WIND · UV) ───────────────────
   2×2 grid: row 1 → Temp · Rain, row 2 → Wind · UV. The 4th tile is
   appended unconditionally so the column count stays stable; UV value is
   tinted with var(--uv) via an inline style on the value node. Class
   name is still `mobile-3up` for backward-compat with selector queries —
   the file otherwise calls it the metric tiles row. */
.mobile-3up {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.mobile-tile {
  border: 1px solid var(--rule);
  border-radius: var(--r-sm, 4px);
  padding: 10px 12px;
  background: var(--surface);
}
.mobile-tile-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3);
}
.mobile-tile-value {
  font-family: 'Instrument Serif', serif;
  font-size: 22px; line-height: 1.1; letter-spacing: -0.02em;
  color: var(--ink); margin-top: 2px;
}
.mobile-tile-unit {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 14px; color: var(--ink-3); margin-left: 2px;
}
.mobile-tile-sub {
  font-size: 11px; color: var(--ink-3); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 560px) {
  .wind-impact-tile { display: flex; }
  .mobile-3up { display: grid; }
  /* Hide the desktop Almanac strip — wind-impact + 3-up tiles replace it. */
  .almanac { display: none; }
}

/* ── Sticky bottom action bar (mobile only) ───────────────────────── */
.mobile-action-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  /* Subtle shadow above the bar so it lifts off the page. */
  box-shadow: 0 -2px 8px -4px rgba(26, 28, 32, 0.10);
}
.mobile-action-btn {
  flex: 1; min-height: 44px;
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 12px; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; cursor: pointer;
}
.mobile-action-btn:active { background: var(--surface-2); }
.mobile-action-more { flex: 0 0 56px; font-size: 18px; letter-spacing: 0; }
.mobile-action-share { background: var(--accent); border-color: var(--accent); color: #fff; }
.mobile-action-share:active { background: var(--accent-hover); }

@media (max-width: 560px) {
  .mobile-action-bar { display: flex; }
  /* Reserve room below the footnote so it never tucks under the bar. */
  .screen-wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ── More sheet (modal bottom sheet) ──────────────────────────────── */
.mobile-more-sheet-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(26, 28, 32, 0.40);
  display: flex; align-items: flex-end; justify-content: center;
}
.mobile-more-sheet {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-top-left-radius: var(--r-lg, 10px);
  border-top-right-radius: var(--r-lg, 10px);
  padding: 12px 12px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  animation: mobile-more-sheet-in 180ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .mobile-more-sheet { animation: none; }
}
@keyframes mobile-more-sheet-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.mobile-more-sheet-handle {
  align-self: center;
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--ink-4);
  margin: 4px 0 12px;
}
.mobile-more-sheet-title {
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 0 14px 8px;
}
.mobile-more-row {
  appearance: none; border: 0; background: transparent;
  display: flex; align-items: center; gap: 14px;
  padding: 14px; min-height: 44px;
  font: inherit; font-size: 15px; color: var(--ink);
  text-align: left; cursor: pointer;
}
.mobile-more-row:active { background: var(--surface-2); }
.mobile-more-row-icon { color: var(--ink-3); flex: 0 0 22px; display: inline-flex; }
.mobile-more-row-label { flex: 1; }
.mobile-more-row-close { color: var(--ink-3); border-top: 1px solid var(--rule); margin-top: 4px; }

/* ── Tap-to-expand map (mobile only) ──────────────────────────────── */
.map-expand-trigger {
  display: none;
  position: absolute; inset: 0;
  appearance: none; background: transparent; border: 0;
  cursor: pointer;
  z-index: 5;
}
.map-card { position: relative; }
.map-expand-hint {
  position: absolute; bottom: 12px; right: 12px;
  background: var(--surface); color: var(--ink-2);
  padding: 6px 10px; border: 1px solid var(--rule);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
@media (max-width: 560px) {
  .map-expand-trigger { display: block; }
}

/* ── Fullscreen map overlay ───────────────────────────────────────── */
.map-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.map-fullscreen-close {
  position: absolute; top: 12px; right: 12px; z-index: 101;
  width: 44px; height: 44px;
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer;
  border-radius: var(--r-md, 6px);
}
.map-fullscreen-host { flex: 1; }

/* ── Hide desktop action chrome on mobile ─────────────────────────────
   The sticky bottom action bar + More sheet supplant these on mobile.
   Without these hides, riders see Save / GPX / Reverse / Copy link twice. */
@media (max-width: 560px) {
  .results-header-actions,
  .results-routecontrols { display: none; }
  /* Verdict watch-out list duplicates the new chip row on mobile. */
  .verdict-block .watchout { display: none; }
}

/* ── Preferences drawer groups ────────────────────────────────────────
   The drawer body splits into a visible Display group (theme/units/
   language) and a collapsible Rider profile group below. Group headers
   are small-caps editorial labels matching the rest of the system. */

.prefs-group {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  margin-top: 8px;
}
.prefs-group-header {
  /* The .label-sc utility already supplies small-caps editorial styling;
     this rule just locks the spacing inside the drawer. */
  margin-bottom: 12px;
  padding: 0 var(--prefs-section-x, 4px);
}
.prefs-group > .prefs-section {
  /* Sections inside a group share the group's left padding; reset their
     own top border so the group's border-top handles the boundary. */
  border-top: 0;
  padding-top: 8px;
}

/* ── Collapsible rationale sub-line (Rider profile group) ─────────── */

.prefs-collapsible-headerrow {
  display: flex; align-items: center; gap: 12px;
}
.prefs-collapsible-rationale {
  margin-top: 4px;
  font-size: 12px; color: var(--ink-3);
  text-transform: none;       /* override the small-caps inherited from .prefs-label */
  letter-spacing: 0;
  font-weight: 400;
}
.prefs-collapsible-header:has(.prefs-collapsible-headerrow) {
  /* The new header carries two children: the label-row and the rationale.
     Override the existing space-between flex on .prefs-collapsible-header
     so they stack vertically (rationale under label) instead of flowing
     to opposite ends of the row. Scoped via :has() so any older callers
     of .prefs-collapsible-header (single-child) keep their row layout. */
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

/* ── "Saved" pill in the drawer header ────────────────────────────── */

.prefs-saved-pill {
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: 8px;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--warn-bg, rgba(200, 144, 47, 0.10));
  color: var(--accent-deep);
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}
.prefs-saved-pill.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.prefs-saved-pill.is-leaving {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 200ms ease, transform 200ms ease;
}
[data-theme="dark"] .prefs-saved-pill { color: var(--accent); }
.prefs-saved-pill-check { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .prefs-saved-pill,
  .prefs-saved-pill.is-visible,
  .prefs-saved-pill.is-leaving {
    transition: none;
    transform: none;
  }
}
