:root {
  --ink: #193c49;
  --muted: #637b83;
  --paper: #f7f3e9;
  --coral: #c85f45;
  --gold: #e8bc7d;
  --line: #193c4926;
  --night: #14313feb;
  --snow: #f7f5ed;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Arial, Helvetica, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { background: #cbdce5; color: var(--ink); font-family: var(--sans); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; border: 0; }
button:disabled { cursor: default; }
a { color: inherit; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid var(--coral); outline-offset: 5px; }
button[hidden], [hidden] { display: none !important; }
.mountain { position: relative; isolation: isolate; height: 100svh; min-height: 0; overflow: hidden; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline-offset: -6px; }
#snow-webgl { pointer-events: none; }
#snow-canvas { --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px); -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.home-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, #f0f2eefa, #edf1eee6 30%, #eef1ed5c 53%, transparent 72%); z-index: 1; }
.masthead { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 26px 42px; z-index: 6; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font: 22px var(--serif); }
.brand > span > span { font-style: italic; }
.brand small { display: block; letter-spacing: 3px; font: 8px var(--sans); margin-top: 4px; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.quiet, .text-button { background: transparent; color: inherit; font: 12px var(--sans); padding: 10px 0; text-decoration: none; letter-spacing: .2px; }
.quiet span { margin-left: 12px; }
.home { position: absolute; top: 50%; left: 7.8%; transform: translateY(-45%); z-index: 3; max-width: 575px; }
.eyebrow { font: 600 9px/1.6 var(--sans); letter-spacing: 2.3px; display: block; color: var(--muted); }
.tiny-star { color: var(--coral); font-size: 16px; vertical-align: -2px; margin-right: 9px; }
h1 { font: normal clamp(68px, 7.9vw, 112px)/.95 var(--serif); letter-spacing: -5px; margin: 22px 0 24px; }
h1 > span { display: block; font-size: .48em; letter-spacing: -2px; line-height: 1.3; margin-top: 14px; }
h1 em { font-weight: normal; color: var(--coral); }
.home-copy { font: 14px/1.85 var(--sans); color: #506c76; margin-bottom: 25px; }
.expedition-facts { display: flex; gap: 26px; padding: 17px 0; margin: 0 0 24px; width: max-content; max-width: 100%; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.expedition-facts > div { display: flex; gap: 10px; align-items: center; }
.expedition-facts b { font: normal 30px var(--serif); }
.expedition-facts span { font: 7px/1.7 var(--sans); letter-spacing: 1.2px; max-width: 105px; color: #536f79; }
.home-actions { display: flex; align-items: center; gap: 23px; flex-wrap: wrap; }
.primary { background: var(--ink); color: #fff9ec; padding: 18px 23px; border-radius: 3px; display: flex; align-items: center; justify-content: space-between; gap: 35px; min-height: 54px; font: 600 12px var(--sans); letter-spacing: .3px; box-shadow: 0 6px 24px #18364615; transition: background .2s, transform .2s; }
.primary:hover { background: #2e5261; transform: translateY(-2px); }
.primary > span:last-child { font-size: 20px; font-weight: normal; }
.home .text-button { border-bottom: 1px solid var(--line); font-size: 11px; }
.home-note { margin: 21px 0 0; font: 10px/1.9 var(--sans); color: #607985; }
.home-note > span { color: var(--ink); font-weight: 600; }
.landscape-caption { position: absolute; right: 5%; bottom: 19%; z-index: 2; display: grid; gap: 10px; color: var(--ink); font: 9px var(--sans); letter-spacing: 2px; }
.landscape-caption small { font-size: 7px; letter-spacing: 1.4px; color: #49636f; }
.caption-line { height: 1px; width: 44px; background: var(--ink); margin-bottom: 3px; }
.home-footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 26px 42px; display: flex; justify-content: space-between; align-items: center; z-index: 3; }
.home-footer > span { font: 8px var(--sans); letter-spacing: 2px; color: #536b76; }
body:not([data-screen="home"]) .masthead, body:not([data-screen="home"]) .home-shade { display: none; }

/* Small, opaque edge instruments stay readable over every mountain light. */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; padding: 23px 26px; color: var(--snow); }
.ride-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.trail-hud { width: 292px; max-width: calc(100vw - 52px); padding: 15px 17px 11px; border: 1px solid #ffffff26; border-radius: 5px; background: var(--night); box-shadow: 0 4px 20px #0d283222; backdrop-filter: blur(8px); }
.chapter-label { min-width: 0; }
.chapter-label > span { font: 7px var(--sans); letter-spacing: 2px; color: #c1d4d8; }
.chapter-label h2 { font: 25px/1.1 var(--serif); margin: 6px 0 12px; }
.ride-objective { display: flex; justify-content: space-between; gap: 10px; align-items: center; font: 9px/1.4 var(--sans); color: #f2d5a4; }
.ride-objective strong { font-weight: 400; color: #eff2ed; white-space: nowrap; font-variant-numeric: tabular-nums; }
.route-progress { display: flex; gap: 7px; align-items: center; margin-top: 5px; width: 100%; }
progress { appearance: none; -webkit-appearance: none; border: 0; height: 3px; width: 100%; overflow: hidden; border-radius: 3px; background: #f7f3e92b; }
progress::-webkit-progress-bar { background: #f7f3e92b; }
progress::-webkit-progress-value { background: var(--gold); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 3px; }
.beacon-icon { font-size: 13px; color: var(--gold); }
.trail-conditions { display: flex; gap: 9px; margin-top: 5px; color: #c8d8db; font: 8px/1.5 var(--sans); }
.trail-conditions > span + span { border-left: 1px solid #ffffff2b; padding-left: 9px; }
#par-counter { color: #f2d5a4; font-variant-numeric: tabular-nums; white-space: nowrap; }
#par-counter[data-passed="true"] { color: #c8d8db; }
#surface-label[data-surface="ice"] { color: #b2e1f4; }
#surface-label[data-surface="powder"] { color: #f4e9cd; }
#missed-counter { color: #c8d8db; }
#missed-counter[data-missed="true"] { color: #f0a58a; }
.next-challenge { display: flex; align-items: center; gap: 9px; border-top: 1px solid #ffffff25; margin-top: 10px; padding-top: 9px; }
.challenge-mark { color: var(--gold); font: 27px var(--serif); }
.next-challenge > span:nth-child(2) { flex: 1; min-width: 0; }
.next-challenge small { display: block; color: #b8ced3; font: 6px var(--sans); letter-spacing: 1.3px; margin-bottom: 4px; }
.next-challenge b { display: block; font: 10px/1.4 var(--sans); color: #fff8e8; }
.next-challenge strong { font: 15px var(--serif); white-space: nowrap; color: var(--gold); }
.next-challenge[data-urgent="true"] { border-top-color: #eea88888; }
.next-challenge[data-urgent="true"] .challenge-mark, .next-challenge[data-urgent="true"] strong { color: #ffb493; }
.ride-status { flex-shrink: 0; display: flex; align-items: center; gap: 16px; background: var(--night); border: 1px solid #ffffff26; border-radius: 5px; padding: 10px 12px 10px 16px; box-shadow: 0 4px 20px #0d283222; backdrop-filter: blur(8px); }
.gate-count { display: flex; gap: 5px; align-items: center; }
.gate-count > span { font-size: 22px; color: var(--gold); }
.gate-count b { font: 24px var(--serif); font-variant-numeric: tabular-nums; }
.gate-count small { font: 10px var(--sans); color: #c1d4d8; }
.hearts { font-size: 10px; letter-spacing: 3px; color: #f1a285; white-space: nowrap; }
.circle { border: 1px solid var(--line); background: #fbf7ef; color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; display: grid; place-items: center; pointer-events: auto; }
.ride-status .circle { border-color: #ffffff38; color: var(--snow); background: #ffffff0e; width: 32px; height: 32px; font-size: 15px; }
.ride-status .circle:hover { background: #ffffff25; }
#ride-sound[data-muted="true"] { opacity: .7; text-decoration: line-through; }
.ride-bottom { position: absolute; bottom: 26px; left: 26px; right: 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.speed { display: flex; align-items: flex-end; gap: 16px; padding: 11px 14px; background: var(--night); border: 1px solid #ffffff26; border-radius: 5px; }
.speed-reading b { font: 31px var(--serif); font-variant-numeric: tabular-nums; }
.speed-reading > span { font: 7px var(--sans); letter-spacing: 1px; margin-left: 4px; color: #d5e0e0; }
.speed-reading > small { display: block; font: 8px var(--sans); margin-top: 4px; color: #c8d8db; }
.look-controls { display: flex; gap: 5px; }
#look-down, #look-back { pointer-events: auto; display: flex; align-items: center; gap: 5px; padding: 6px 7px; border-radius: 3px; background: #ffffff14; color: #f4f1e7; font: 8px var(--sans); border: 1px solid #ffffff30; touch-action: none; user-select: none; }
#look-down kbd, #look-back kbd { font-size: 7px; margin: 0; padding: 1px 3px; background: #f4f1e7; color: var(--ink); }
#look-down[data-active="true"], #look-back[data-active="true"] { background: var(--coral); }
.ride-energy { display: grid; gap: 9px; justify-items: end; }
/* The rear window carries the visual warning; retain a spoken lane and range. */
.coach[data-kind="rear"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.trick-picker { position: absolute; left: 0; bottom: calc(100% + 8px); display: grid; gap: 5px; width: 154px; padding: 8px 10px; background: var(--night); border: 1px solid #ffffff26; border-radius: 5px; pointer-events: auto; }
.trick-picker > span { font: 7px var(--sans); letter-spacing: 1.2px; color: #d5e0e0; }
.trick-picker select { width: 100%; min-height: 34px; border: 1px solid #ffffff38; border-radius: 3px; padding: 4px 6px; font: 12px var(--sans); background: #233f4d; color: #fff8e8; cursor: pointer; }
.trick-picker select:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (pointer: coarse), (max-width: 600px) { .trick-picker select { font-size: 16px; } }
.tuck-state { display: flex; align-items: center; justify-content: center; width: 160px; background: var(--night); padding: 11px 12px; border: 1px solid #ffffff26; border-radius: 4px; }
.tuck-state > span { font: 8px var(--sans); letter-spacing: 1.2px; }
.chase-status { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; width: 178px; border: 1px solid #ffffff35; border-radius: 5px; padding: 10px 11px; background: var(--night); color: #f8f4ea; }
.chase-status > span { font: 7px/1.5 var(--sans); letter-spacing: .7px; align-self: center; }
.chase-status strong { font: 17px var(--serif); white-space: nowrap; }
.chase-status progress { grid-column: 1/-1; }
.chase-status[data-danger="near"] { background: #604b36f0; }
.chase-status[data-danger="high"] { background: #8b3e32f2; }
.chase-status[data-danger="high"] strong { color: #ffe3c1; }
body[data-boosting="true"] .speed-reading b { color: #ffc28e; }
body[data-boosting="true"] .tuck-state { color: #ffc28e; border-color: #ffc28e80; }
body[data-pushing="true"] .speed-reading b { color: #9fe0c9; }
body[data-pushing="true"] .tuck-state { color: #9fe0c9; border-color: #9fe0c980; }
.touch-controls .push-button[data-active="true"] { background: #9fe0c933; border-color: #9fe0c9; }
.coach { position: absolute; top: 238px; left: 26px; z-index: 4; max-width: 292px; padding: 11px 14px; background: #f7f3e9f2; color: var(--ink); border-left: 3px solid var(--coral); border-radius: 0 4px 4px 0; box-shadow: 0 4px 25px #163a491c; font: 10px/1.7 var(--sans); pointer-events: none; }
.trick-toast { position: absolute; top: 42%; left: 50%; transform: translateX(-50%); font: italic 31px var(--serif); color: #fff3cd; text-shadow: 0 2px 12px #153543; z-index: 4; pointer-events: none; }
.desktop-keys { position: absolute; bottom: 27px; left: 50%; transform: translateX(-50%); z-index: 3; margin: 0; padding: 9px 12px; border-radius: 4px; background: #14313fdc; font: 8px var(--sans); color: #f3f3e9; white-space: nowrap; pointer-events: none; }
kbd { font: 10px var(--sans); background: #fff9eddb; color: var(--ink); border: 1px solid #18364620; border-radius: 3px; padding: 3px 5px; margin-right: 3px; }
.desktop-keys kbd { font-size: 8px; }
.desktop-keys kbd:not(:first-child) { margin-left: 9px; }
#impact-shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(#edf3f5, #e1edf1); }
/* Slow motion: cinematic bars slide in and a soft cold vignette gathers. */
.cinema-bars { position: absolute; inset: 0; z-index: 2; pointer-events: none; --letterbox: 0; }
.cinema-bars span { position: absolute; left: 0; right: 0; height: 9vh; background: #0b1c25; opacity: .88; transform: scaleY(var(--letterbox)); }
.cinema-bars span:first-child { top: 0; transform-origin: top; }
.cinema-bars span:last-child { bottom: 0; transform-origin: bottom; }
.cinema-bars::after { content: ''; position: absolute; inset: 0; opacity: calc(var(--letterbox) * .8); background: radial-gradient(ellipse at center, transparent 55%, #0f2a3826 80%, #0b1c2566 100%); }
body[data-cinematic="true"] .hud .ride-top, body[data-cinematic="true"] .next-challenge { opacity: .55; transition: opacity .3s; }
#slowmo[aria-pressed="false"], #pause-slowmo[aria-pressed="false"] { opacity: .7; }

/* Field notes open only before a descent, at rest, or after the beacon. */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 7; background: #1336464d; backdrop-filter: blur(6px); }
.story-card { background: #faf6edf7; border: 1px solid #fff9ed; box-shadow: 0 20px 90px #132d4040; border-radius: 5px; padding: 32px 38px; width: 460px; max-width: 100%; max-height: calc(100svh - 44px); overflow: auto; }
.story-card h2, dialog h2 { font: normal 44px/1.05 var(--serif); letter-spacing: -1.6px; margin: 17px 0; }
.story-subtitle { font: italic 16px var(--serif); color: #a95f3f; margin: 0 0 21px; }
.story-copy { font: 12px/1.85 var(--sans); color: #536d77; margin: 20px 0; }
.briefing-card { width: 574px; border-top: 4px solid var(--coral); display: flex; flex-direction: column; overflow: hidden; }
.briefing-heading { flex-shrink: 0; }
.briefing-content { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #8c9c9c #e8e9e0; padding-right: 8px; margin-right: -8px; }
.briefing-content:focus-visible { outline: 2px solid var(--coral); outline-offset: -2px; }
.briefing-actions { flex-shrink: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.briefing-card .briefing-actions .primary { margin-top: 0; }
.briefing-actions .text-button { display: block; margin: 7px auto 0; font-size: 10px; }
.briefing-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.difficulty, .trail-difficulty { border: 1px solid #6a887e5c; background: #e4ebe3; color: #3f6659; font: 8px var(--sans); padding: 5px 8px; border-radius: 2px; white-space: nowrap; }
.difficulty[data-difficulty="hard"], button[data-difficulty="hard"] .trail-difficulty { background: #eee3d0; color: #8e6135; border-color: #ad885f5c; }
.difficulty[data-difficulty="expert"], button[data-difficulty="expert"] .trail-difficulty { background: #f1ddd4; color: #a04f38; border-color: #c66a4e5c; }
.route-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.route-facts span { display: block; font: 7px var(--sans); color: var(--muted); letter-spacing: 1.3px; margin-bottom: 7px; }
.route-facts b { font: 14px var(--serif); }
.lesson { display: flex; align-items: center; gap: 13px; padding: 14px 16px; background: #e9ebe3; border-radius: 3px; }
.lesson > span { font: 30px var(--serif); color: var(--coral); }
.lesson strong { display: block; font: 600 10px/1.5 var(--sans); margin-bottom: 4px; }
.lesson p { font: 10px/1.7 var(--sans); margin: 0; color: #49636f; }
.mission { margin: 18px 0; padding-left: 12px; border-left: 2px solid var(--coral); }
.mission > span { font: 7px var(--sans); letter-spacing: 1.4px; color: #a65d3e; }
.mission p { font: 10px/1.7 var(--sans); margin: 6px 0 0; color: #455f69; }
.story-card .primary { width: 100%; margin-top: 21px; }
.story-card > .text-button { display: block; margin: 10px auto 0; font-size: 10px; }
.touch-guide { display: none; font: 10px/1.8 var(--sans); color: var(--ink); margin: 14px 0 0; }
.secondary { width: 100%; padding: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 3px; font: 11px var(--sans); margin-top: 12px; }
.secondary:hover { background: #193c4908; }
.compact { width: 390px; }
.result-route { font: italic 14px var(--serif); color: #9d6544; margin: 13px 0 0; }
.result-stars { display: block; font-size: 25px; letter-spacing: 8px; color: #b37a3c; margin-top: 20px; }
.result-card h2 { font-size: 38px; }
.result-stats { display: flex; justify-content: space-between; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-stats b { display: block; font: 28px var(--serif); margin-bottom: 7px; }
.result-stats span { font: 7px var(--sans); letter-spacing: 1.5px; }
.result-bonus { font: 10px/1.7 var(--sans); color: var(--muted); margin: 14px 0 0; }

/* A numbered trail atlas, with the character of a mountain field guide. */
dialog { border: 1px solid #fff9ed; border-radius: 5px; color: var(--ink); background: var(--paper); width: min(590px, calc(100vw - 30px)); padding: 29px 34px; max-height: calc(100svh - 30px); box-shadow: 0 20px 80px #142d4140; }
dialog::backdrop { background: #1336467a; backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.dialog-copy { font: 12px/1.8 var(--sans); color: var(--muted); }
.trail-atlas { width: min(960px, calc(100vw - 40px)); padding: 27px 36px; }
.atlas-intro { display: flex; justify-content: space-between; align-items: center; gap: 25px; }
.atlas-intro h2 { font-size: 43px; }
.atlas-intro .dialog-copy { max-width: 430px; margin-bottom: 0; }
.atlas-progress { flex-shrink: 0; border-left: 1px solid var(--line); padding: 13px 0 13px 30px; }
.atlas-progress strong { display: block; font: normal 32px var(--serif); }
.atlas-progress span { display: block; font: 7px var(--sans); letter-spacing: 1.8px; color: var(--muted); margin-top: 8px; }
.chapter-list { list-style: none; margin: 27px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 27px; }
.chapter-list li { display: contents; }
.atlas-leg { grid-column: 1 / -1; margin: 24px 0 9px; font: 9px/1.5 var(--sans); letter-spacing: 1.4px; text-transform: uppercase; color: #8b6548; }
.chapter-list li:first-child .atlas-leg { margin-top: 0; }
.chapter-list button { position: relative; display: grid; grid-template-columns: 30px 1fr 30px; align-items: start; column-gap: 9px; width: 100%; min-width: 0; min-height: 130px; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; padding: 18px 0 16px; }
.chapter-list button:hover:not(:disabled) { background: #193c4905; }
.chapter-list button:disabled { color: #6d7e81; }
.chapter-list button:disabled .chapter-index, .chapter-list button:disabled .chapter-stars { color: #8b9798; }
.chapter-list button:disabled .trail-difficulty { opacity: .7; }
.chapter-index { font: italic 25px var(--serif); color: var(--coral); grid-row: 1 / 3; padding-top: 1px; }
.chapter-copy { grid-column: 2; grid-row: 1 / 3; min-width: 0; }
.chapter-copy b { display: block; font: 20px/1.12 var(--serif); padding-right: 2px; }
.chapter-copy small { display: block; margin-top: 8px; font: 9px/1.5 var(--sans); color: #526f78; }
.chapter-detail { display: block; margin-top: 3px; font: 8px/1.5 var(--sans); color: var(--muted); }
.chapter-access { display: block; margin-top: 9px; font: 7px/1.5 var(--sans); color: #8b6548; letter-spacing: .2px; }
.chapter-list button:disabled .chapter-access { color: #7b888b; }
.trail-difficulty { grid-row: 1; grid-column: 3; justify-self: end; font-size: 6px; padding: 4px 5px; margin-left: -20px; }
.chapter-stars { grid-column: 3; grid-row: 2; justify-self: end; align-self: end; font: 9px var(--sans); color: #b37b43; letter-spacing: 1px; padding-top: 15px; }
.map-note { font: 10px/1.8 var(--sans); color: var(--muted); margin-top: 23px; border-top: 1px solid var(--line); padding-top: 15px; }
.control-guide { margin-top: 25px; }
.control-guide > div { display: flex; align-items: start; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.control-guide kbd { min-width: 91px; text-align: center; margin-top: 4px; font-size: 10px; }
.control-guide p { margin: 0; font: 11px/1.75 var(--sans); color: var(--muted); }
.control-guide b { color: var(--ink); }
.storage-note { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); background: var(--paper); padding: 10px 15px; z-index: 15; font-size: 11px; border-radius: 4px; max-width: 90%; text-align: center; }
.no-script { position: fixed; inset: 20%; z-index: 30; padding: 30px; background: var(--paper); }

@media (max-width: 1100px) {
  .desktop-keys { font-size: 7px; bottom: 34px; padding: 8px; }
  .desktop-keys kbd { font-size: 7px; padding: 2px 3px; }
  .desktop-keys kbd:not(:first-child) { margin-left: 4px; }
  .speed { gap: 9px; }
}
@media (max-width: 900px) {
  .masthead { padding: 23px 25px; }
  .home { left: 7%; }
  h1 { font-size: 84px; }
  .home-copy { font-size: 13px; }
  .landscape-caption { right: 5%; bottom: 16%; }
  .home-footer { padding: 24px; }
  .desktop-keys { display: none !important; }
  .hud { padding: 20px; }
  .ride-bottom { left: 20px; right: 20px; }
  .ride-status { gap: 11px; }
  .coach { left: 20px; }
  .trail-atlas { padding: 25px 28px; }
  .chapter-list { column-gap: 20px; }
  .chapter-list button { grid-template-columns: 26px 1fr 25px; column-gap: 7px; }
  .chapter-copy b { font-size: 18px; }
}
@media (pointer: coarse) {
  .touch-controls:not([hidden]) { display: flex; }
  .desktop-keys { display: none !important; }
  .touch-guide { display: block; }
}
.touch-controls { position: absolute; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); justify-content: space-between; align-items: flex-end; z-index: 5; display: none; pointer-events: none; }
.touch-controls > div { display: flex; gap: 7px; align-items: flex-end; }
.touch-controls button { width: 48px; height: 51px; border-radius: 6px; color: #f9f4e8; background: #183b49e8; border: 1px solid #fff9ee66; box-shadow: 0 3px 14px #16354325; font: 22px var(--sans); touch-action: none; pointer-events: auto; user-select: none; -webkit-user-select: none; }
.touch-controls button small { display: block; font: 6px var(--sans); letter-spacing: .6px; margin-top: 4px; }
.touch-controls .jump-button { height: 64px; background: #f3eee0; color: var(--ink); }
.touch-controls button[data-active="true"] { background: var(--coral); color: #fff9ee; }
.touch-controls .boost-button { width: 44px; font-size: 18px; }
@media (max-width: 600px) {
  .masthead { padding: max(20px, env(safe-area-inset-top)) 21px 20px; }
  .brand { font-size: 20px; }
  .brand img { width: 29px; height: 29px; }
  .header-actions { gap: 18px; }
  .quiet { font-size: 10px; }
  .home-shade { background: linear-gradient(180deg, #edf2ef33, #eef2eef2 18%, #edf1edeb 56%, #eaf0ec00 91%); }
  .home { left: 25px; right: 25px; top: 17%; transform: none; }
  .eyebrow { font-size: 7px; letter-spacing: 1.6px; }
  .tiny-star { font-size: 12px; margin-right: 6px; }
  h1 { font-size: clamp(48px, 14.8vw, 72px); letter-spacing: -3px; margin: 17px 0 18px; }
  h1 > span { font-size: .46em; letter-spacing: -1.4px; margin-top: 9px; }
  .home-copy { font-size: 11px; line-height: 1.8; margin-bottom: 19px; }
  .expedition-facts { padding: 12px 0; margin-bottom: 20px; gap: 22px; }
  .expedition-facts b { font-size: 25px; }
  .expedition-facts span { font-size: 6px; letter-spacing: .9px; max-width: 84px; }
  .home-actions { gap: 16px; }
  .primary { padding: 15px 18px; min-height: 48px; font-size: 11px; gap: 19px; }
  .home .text-button { font-size: 10px; }
  .home-note { font-size: 9px; margin-top: 17px; }
  .landscape-caption { bottom: 12%; right: 23px; font-size: 7px; gap: 6px; }
  .landscape-caption small { font-size: 5px; letter-spacing: 1.1px; }
  .home-footer { padding: 17px 23px max(17px, env(safe-area-inset-bottom)); }
  .home-footer > span { font-size: 6px; letter-spacing: 1px; }
  .home-footer .text-button { font-size: 10px; }
  .touch-controls:not([hidden]) { display: flex; }
  .touch-controls { left: max(13px, env(safe-area-inset-left)); right: max(13px, env(safe-area-inset-right)); }
  .touch-controls > div { gap: 4px; }
  .touch-controls button { width: 44px; }
  .touch-controls .boost-button { width: 44px; }
  .story-card { padding: 24px; max-height: calc(100svh - 28px); }
  .story-card h2, dialog h2 { font-size: 35px; }
  .story-copy { font-size: 11px; line-height: 1.8; margin: 17px 0; }
  .story-subtitle { font-size: 14px; margin-bottom: 17px; }
  .story-card .primary { margin-top: 17px; }
  .briefing-actions { padding-top: 12px; }
  .briefing-card .briefing-actions .primary { margin-top: 0; }
  .briefing-actions .text-button { margin-top: 5px; font-size: 9px; }
  .route-facts { gap: 13px 15px; padding: 14px 0; }
  .route-facts span { font-size: 6px; letter-spacing: 1px; }
  .route-facts b { font-size: 13px; }
  .lesson { padding: 11px 12px; gap: 10px; }
  .lesson p { font-size: 9px; }
  .lesson strong { font-size: 9px; }
  .mission { margin: 15px 0; }
  .mission p { font-size: 9px; }
  .touch-guide { display: block; font-size: 9px; }
  .overlay { padding: 14px; }
  .result-card h2 { font-size: 32px; }
  dialog { padding: 23px; }
  .trail-atlas { width: calc(100vw - 24px); padding: 22px; }
  .atlas-intro { gap: 15px; }
  .atlas-intro h2 { font-size: 32px; }
  .atlas-intro .dialog-copy { font-size: 10px; }
  .atlas-progress { padding: 10px 0 10px 15px; }
  .atlas-progress strong { font-size: 23px; }
  .atlas-progress span { font-size: 6px; letter-spacing: 1px; }
  .chapter-list { grid-template-columns: 1fr; margin-top: 23px; }
  .chapter-list button { min-height: 122px; grid-template-columns: 29px 1fr 45px; padding: 17px 0; column-gap: 10px; }
  .chapter-copy b { font-size: 21px; }
  .trail-difficulty { font-size: 7px; padding: 5px 6px; margin-left: 0; }
  .chapter-stars { font-size: 10px; }
  .control-guide > div { gap: 10px; }
  .control-guide kbd { min-width: 80px; font-size: 9px; }
  .control-guide p { font-size: 10px; }
}
@media (max-width: 375px) {
  .home { left: 22px; right: 22px; top: 16%; }
  .home-actions { gap: 11px; }
  .home .primary { padding: 14px; font-size: 10px; gap: 11px; }
  .home .text-button { font-size: 9px; }
  .chapter-label { max-width: calc(100% - 129px); }
  .chapter-label h2 { font-size: 17px; }
  .ride-status { gap: 5px; }
  .ride-status .circle { width: 26px; height: 26px; }
  .hearts { right: 60px; }
  .gate-count b { font-size: 17px; }
  .touch-controls > div { gap: 4px; }
  .touch-controls button { width: 44px; }
  .touch-controls .boost-button { width: 44px; }
}
@media (max-height: 700px) and (min-width: 601px) {
  .home { transform: translateY(-45%); }
  h1 { font-size: 82px; margin: 15px 0 18px; }
  .home-copy { font-size: 12px; margin-bottom: 18px; }
  .expedition-facts { padding: 12px 0; margin-bottom: 19px; }
  .home-note { font-size: 9px; margin-top: 15px; }
  .briefing-card { padding: 23px 32px; }
  .briefing-card h2 { font-size: 36px; margin: 13px 0; }
  .briefing-card .story-subtitle { margin-bottom: 16px; }
  .briefing-card .route-facts { gap: 11px 15px; padding: 13px 0; }
  .briefing-card .story-copy { font-size: 11px; margin: 15px 0; }
  .briefing-card .mission { margin: 14px 0; }
  .briefing-card .primary { margin-top: 0; min-height: 46px; padding: 13px 18px; }
}
@media (max-height: 700px) and (max-width: 600px) {
  .home { top: 16%; }
  h1 { font-size: clamp(48px, 14vw, 64px); margin: 13px 0 15px; }
  .home-copy { margin-bottom: 15px; }
  .expedition-facts { padding: 10px 0; margin-bottom: 17px; }
  .home-note { margin-top: 13px; font-size: 8px; }
  .landscape-caption { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .masthead { padding: 13px 26px; }
  .home { left: 7%; top: 50%; transform: translateY(-42%); }
  h1 { font-size: 52px; margin: 10px 0; }
  .home-copy { font-size: 10px; line-height: 1.6; margin-bottom: 12px; }
  .home .eyebrow { font-size: 6px; }
  .home-note, .expedition-facts, .landscape-caption { display: none; }
  .home-footer { padding: 5px 26px; }
  .home .primary { min-height: 42px; padding: 10px 15px; }
  .touch-guide { display: block; }
  .touch-controls:not([hidden]) { display: flex; }
  .desktop-keys { display: none !important; }
  .story-card { padding: 21px 28px; }
  .story-card h2 { font-size: 33px; margin: 12px 0; }
  .story-copy { font-size: 11px; margin: 13px 0; }
  .story-card .primary { margin-top: 15px; min-height: 44px; padding: 12px 18px; }
  .briefing-card { width: 610px; }
  .briefing-actions { padding-top: 10px; }
  .briefing-card .briefing-actions .primary { margin-top: 0; }
  .briefing-actions .text-button { margin-top: 3px; padding: 7px 0; }
  .briefing-card h2 { font-size: 29px; margin: 10px 0; }
  .briefing-card .story-subtitle { font-size: 13px; margin-bottom: 12px; }
  .briefing-card .route-facts { grid-template-columns: 1fr 1fr 1.2fr 1.2fr; }
}
.pause-ride-details { margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 12px/1.5 var(--sans); }
.pause-ride-details summary { min-height: 44px; padding: 12px 0; cursor: pointer; font-weight: 600; }
.pause-ride-details summary:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.pause-route { font: 19px var(--serif); margin: 8px 0 16px; }
.pause-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 12px 0; }
.pause-stats dt { color: var(--muted); font-size: 10px; }
.pause-stats dd { margin: 3px 0 0; font-variant-numeric: tabular-nums; }
.pause-progress, .pause-goal { font-size: 11px; color: #49636f; }
.pause-trick-picker { display: grid; gap: 7px; margin: 17px 0 8px; font-size: 11px; }
.pause-trick-picker select { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: #fffaf0; color: var(--ink); font: 16px var(--sans); }
.pause-ride-details .secondary { margin-bottom: 16px; }

/* On phones and touch screens the slope comes first: one status strip,
   contextual danger, and thumb controls. Ride details live in Pause. */
@media (max-width: 600px), (pointer: coarse), (max-height: 500px) and (orientation: landscape) {
  .hud { --mobile-hud-width: min(360px, calc(100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)))); padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .ride-top { display: block; position: relative; width: var(--mobile-hud-width); min-height: 48px; }
  .ride-status { position: relative; top: auto; right: auto; width: 100%; height: 46px; padding: 0 0 0 12px; gap: 12px; border: 1px solid #ffffff26; border-radius: 6px; background: var(--night); box-shadow: none; backdrop-filter: none; }
  .gate-count { gap: 4px; }
  .gate-count > span { font-size: 19px; }
  .gate-count b { font-size: 23px; }
  .gate-count small { font-size: 11px; }
  .hearts { position: static; margin-left: auto; font-size: 10px; letter-spacing: 3px; }
  .ride-status .circle { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-left: 1px solid #ffffff26; border-radius: 0 5px 5px 0; font-size: 19px; background: transparent; }
  #ride-sound { display: none; }
  .trail-hud { position: absolute; inset: 0; width: 100%; max-width: none; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
  .chapter-label, .ride-objective, .trail-conditions, .beacon-icon { display: none; }
  .route-progress { position: absolute; top: 48px; left: 0; right: 0; width: auto; margin: 0; gap: 0; }
  .route-progress progress { height: 2px; }
  .next-challenge { position: absolute; top: 58px; left: 0; max-width: min(360px, 100%); margin: 0; padding: 7px 10px; gap: 10px; border: 1px solid #ffffff26; border-radius: 4px; background: var(--night); }
  .next-challenge:not([data-near="true"]), .hud[data-cue="avalanche"] .next-challenge, .hud[data-cue="none"] .next-challenge { display: none; }
  .next-challenge small, .challenge-mark { display: none; }
  .next-challenge b { font: 11px/1.4 var(--sans); }
  .next-challenge strong { font-size: 15px; }
  .ride-bottom { position: static; inset: auto; display: block; }
  .speed, .ride-energy { display: contents; }
  .speed-reading, #look-down, .trick-picker { display: none; }
  .look-controls { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 58px); left: calc(max(12px, env(safe-area-inset-left)) + var(--mobile-hud-width) - 60px); display: block; }
  .hud[data-cue="challenge"] .look-controls, .hud[data-cue="none"] .look-controls { display: none; }
  #look-back { min-width: 60px; min-height: 44px; padding: 8px; justify-content: center; border: 1px solid #ffffff55; border-radius: 4px; background: var(--night); font-size: 10px; }
  #look-back kbd { display: none; }
  .chase-status { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 58px); left: max(12px, env(safe-area-inset-left)); width: auto; max-width: calc(var(--mobile-hud-width) - 70px); min-height: 44px; padding: 7px 10px; gap: 3px 10px; }
  .chase-status { display: flex; align-items: center; }
  .chase-status > span { font: 8px/1.4 var(--sans); letter-spacing: .5px; }
  .chase-status strong { font-size: 16px; }
  .chase-status progress { display: none; }
  .hud[data-cue="challenge"] .chase-status, .hud[data-cue="none"] .chase-status { display: none; }
  .tuck-state { display: none; }
  .coach:not([data-kind="impact"]) { display: none; }
  .coach[data-kind="impact"] { top: calc(max(8px, env(safe-area-inset-top)) + 114px); left: max(12px, env(safe-area-inset-left)); max-width: calc(100% - 24px); padding: 8px 10px; font-size: 0; }
  .coach[data-kind="impact"]::after { content: attr(data-short); font: 11px/1.4 var(--sans); }
  .trick-toast { top: calc(max(8px, env(safe-area-inset-top)) + 118px); font-size: 21px; white-space: nowrap; }
  .desktop-keys { display: none !important; }
  .touch-controls:not([hidden]) { display: flex; }
  .touch-controls { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .touch-controls > div { gap: 4px; }
  .touch-controls button, .touch-controls .boost-button { width: 44px; height: 48px; }
  .touch-controls .jump-button { height: 52px; }
  .cinema-bars span { height: 3vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
