:root {
  --paper: #f3eee3;
  --ink: #2b2b2b;
  --grey: #8c8a85;
  --chip: rgba(243, 238, 227, 0.88);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* Clears the dry-brush frame (2.5 percent of the short side plus its fray) with 14 px to spare, on every side. */
  --inset: calc(min(100vw, 100vh) * 0.045 + 14px);
  --iT: max(var(--inset), env(safe-area-inset-top));
  --iR: max(var(--inset), env(safe-area-inset-right));
  --iB: max(var(--inset), env(safe-area-inset-bottom));
  --iL: max(var(--inset), env(safe-area-inset-left));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10141a; font-family: var(--font); color: var(--ink); -webkit-tap-highlight-color: transparent; }
body[data-style='painted'] { background: var(--paper); }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
canvas#gl:active { cursor: grabbing; }

.brand { position: fixed; top: var(--iT); left: var(--iL); pointer-events: none; }
.wordmark { font-family: var(--cap-title-font, var(--font)); font-weight: 700; font-size: 13px; letter-spacing: 0.22em; color: #fff; text-shadow: 0 1px 6px rgba(20, 40, 80, 0.45); }
body[data-style='painted'] .wordmark, body[data-style='painted'] .sceneryName, body[data-style='painted'] .hintText { color: var(--ink); text-shadow: 0 0 5px var(--paper), 0 0 10px var(--paper), 0 0 14px var(--paper); }
.sceneryName { margin-top: 3px; font-size: 12px; color: #fff; opacity: 0.9; text-shadow: 0 1px 6px rgba(20, 40, 80, 0.45); }

.pills { position: fixed; top: calc(var(--iT) - 4px); right: var(--iR); display: flex; gap: 6px; }
.pill, .chip { font: 600 12px/1 var(--font); color: var(--ink); background: var(--chip); border: 1px solid rgba(43, 43, 43, 0.12); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.pill[aria-pressed='true'], .chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill:hover, .chip:hover { border-color: rgba(43, 43, 43, 0.4); }
.tools { position: fixed; top: calc(var(--iT) + 34px); right: var(--iR); display: flex; gap: 6px; z-index: 3; }
.menuWrap { position: relative; }
.menuWrap[hidden] { display: none; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px; background: var(--chip); border: 1px solid rgba(43, 43, 43, 0.14); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; box-shadow: 0 6px 20px rgba(20, 30, 50, 0.22); }
.menu[hidden] { display: none; }
.menuItem { font: 500 13px/1.2 var(--font); text-align: left; color: var(--ink); background: none; border: 0; border-radius: 7px; padding: 7px 10px; cursor: pointer; white-space: nowrap; }
.menuItem:hover { background: rgba(43, 43, 43, 0.08); }
.menuItem[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.chip.round { width: 28px; height: 28px; padding: 0; font-family: var(--mono); font-weight: 400; }

.controls { position: fixed; right: var(--iR); bottom: calc(var(--iB) + 40px); display: flex; gap: 6px; align-items: center; }
.speeds { display: flex; gap: 4px; }
.speeds .chip { padding: 8px 10px; }

.hint { position: fixed; left: var(--iL); bottom: calc(var(--iB) + 40px); display: flex; align-items: center; gap: 10px; }
.hintText { font-size: 12px; color: #fff; text-shadow: 0 1px 6px rgba(20, 40, 80, 0.55); }

.credits { position: fixed; left: var(--iL); bottom: calc(var(--iB) + 86px); z-index: 6; max-width: min(420px, calc(100vw - 2 * var(--inset))); background: var(--chip); border-radius: 10px; padding: 12px 14px; font-size: 11px; line-height: 1.45; color: var(--ink); }
.credits p { margin: 0 0 6px; }
.credits p:last-child { margin: 0; }

.caption { position: fixed; left: 50%; bottom: var(--iB); transform: translate(-50%, calc(-1 * var(--tl-shift, 0px))); transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1); text-align: center; background: rgba(243, 238, 227, 0.82); padding: 9px 22px 8px; border-radius: 10px; pointer-events: none; width: max-content; min-width: 220px; max-width: calc(100vw - 2 * var(--inset)); }
.capTitle { font-family: var(--cap-title-font, var(--font)); font-weight: 700; font-size: 14px; color: var(--ink); transition: opacity 0.25s; }
.capLocal { margin-top: 1px; font: 600 13px/1.25 var(--cap-local-font, 'Annapurna SIL', 'Mukta', sans-serif); color: var(--ink); opacity: 0.85; transition: opacity 0.25s; }
.capLocal[hidden] { display: none; }
.capSub { margin-top: 2px; font-family: var(--cap-sub-font, var(--font)); font-size: 11.5px; color: var(--grey); transition: opacity 0.25s; }
.capMono { margin-top: 3px; font: 400 9.5px/1.2 var(--mono); color: var(--capMono, #5e5b55); letter-spacing: 0.02em; }
.caption { transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.2s ease-out; }
.caption.dim { opacity: 0.2; }
.caption.fading .capTitle, .caption.fading .capSub, .caption.fading .capLocal { opacity: 0; }
body.shot .capTitle, body.shot .capSub { transition: none; }

.stats { position: fixed; top: calc(var(--iT) + 44px); left: var(--iL); font: 400 11px/1.4 var(--mono); color: #fff; background: rgba(0, 0, 0, 0.55); padding: 6px 9px; border-radius: 6px; white-space: pre; pointer-events: none; }

.loading { position: fixed; inset: 0; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 10; transition: opacity 0.25s ease-out; }
/* The card is fully opaque: nothing of the world shows through. It lifts when the painterly reveal begins. */
.loading.soft { pointer-events: none; }
.loading.done { opacity: 0; pointer-events: none; }
body.shot .loading { transition: none; }
.loadWord { font-weight: 700; font-size: 15px; letter-spacing: 0.3em; }
.loadBar { --ld-track: color-mix(in srgb, var(--ink) 12%, var(--paper)); --bar-w: min(320px, 70vw); width: var(--bar-w); height: 20px; border-radius: 999px; background: var(--ld-track); overflow: hidden; }
/* A flat strip of colour swatches (the scenery's own palette, set from JS as --ld-strip) under a growing clip:
   the strip is as wide as the whole bar, so progress uncovers it left to right and a swatch shows partly while it fills. */
.loadCanvas { display: none; width: var(--bar-w); height: 100%; }
.loadFill.clips { background: none; }
.loadFill.clips .loadCanvas { display: block; }
.loadFill { overflow: hidden; height: 100%; width: 0; background: var(--ld-strip, none) 0 0 / var(--bar-w) 100% no-repeat; transition: width 0.4s ease-out; }
.loadRow { display: flex; align-items: baseline; gap: 10px; }
.loadPct { font: 500 11px/1 var(--mono); color: var(--ink); opacity: 0.7; min-width: 3ch; text-align: right; }
@media (prefers-reduced-motion: reduce) { .loadFill { transition: none; } .loading { transition-duration: 0.3s; } }
.loadMsg { font: 400 11px/1 var(--mono); color: var(--grey); }
.loadMsg.error { color: #b23a3a; }

/* Edit mode: the default view is a clean player. ?mode=edit shows every control. */
body[data-mode='play'] .edit-only { display: none !important; }
body[data-mode='edit'] .play-only { display: none !important; }
.copyright { position: fixed; left: var(--iL); bottom: var(--iB); z-index: 3; width: 20px; height: 20px; padding: 0; font: 500 11px/20px var(--font); text-align: center; color: var(--ink); background: var(--chip); border: 0; border-radius: 50%; opacity: 0.55; cursor: pointer; }
.copyright:hover { opacity: 1; }

/* Route timeline (src/timeline.js): the closed loop from arc 0 to L, a thumb at the current position, a marker per waypoint. */
:root { --tl-bg: rgba(243, 238, 227, 0.78); --tl-track: rgba(43, 43, 43, 0.22); --tl-fill: #e4572e; --tl-thumb: #2b2b2b; --tl-thumb-ring: #f3eee3; --tl-mark: #2b2b2b; --tl-mark-ring: #f3eee3; --tl-tip-bg: #f3eee3; --tl-tip-ink: #2b2b2b; --tl-font: var(--font); --tl-radius: 999px; }
.timeline { position: fixed; left: var(--iL); right: var(--iR); bottom: var(--iB); height: 28px; z-index: 3; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.2s cubic-bezier(0.23, 1, 0.32, 1), transform 0.2s cubic-bezier(0.23, 1, 0.32, 1); background: var(--tl-bg); border-radius: var(--tl-radius); touch-action: none; cursor: pointer; outline: none; }
.timeline.show { opacity: 1; transform: none; pointer-events: auto; }
body.tl-show { --tl-shift: 40px; }
@media (prefers-reduced-motion: reduce) { .timeline, .caption { transition: none; } .timeline { transform: none; } }
.timeline:focus-visible { box-shadow: 0 0 0 2px var(--tl-thumb); }
.tlTrack { position: absolute; left: 14px; right: 14px; top: 12px; height: 4px; background: var(--tl-track); border-radius: 2px; overflow: hidden; pointer-events: none; }
.tlFill { position: absolute; inset: 0; background: var(--tl-fill); transform-origin: 0 50%; transform: scaleX(0); will-change: transform; }
/* The current position is a tiny trike seen from above, pointing right, above the marker dots and a little above the track. */
.tlThumb { position: absolute; left: 14px; top: -7px; width: 26px; height: 18px; margin-left: -13px; z-index: 2; will-change: transform; pointer-events: none; }
/* A tiny sticker of the trike, side view, facing right: a white outline from stacked drop shadows, then a soft shadow. */
.tlThumb svg { display: block; width: 26px; height: 18px; overflow: visible; transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 60%; filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 2px 2.5px rgba(20, 30, 50, 0.35)); }
.tlProp { transform-box: fill-box; transform-origin: 50% 50%; }
.timeline.flying .tlThumb svg { animation: tlBob 1.6s ease-in-out infinite; }
.timeline.flying .tlProp { animation: tlSpin 0.12s linear infinite; }
@keyframes tlBob { 0%, 100% { translate: 0 -1px; } 50% { translate: 0 1px; } }
@keyframes tlSpin { 0% { transform: scaleY(1); } 50% { transform: scaleY(0.25); } 100% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .timeline.flying .tlThumb svg, .timeline.flying .tlProp { animation: none; } .tlThumb svg { transform: none; } }
.tlMarks { position: absolute; left: 14px; right: 14px; top: 0; bottom: 0; pointer-events: none; }
.tlMark { position: absolute; top: 8px; width: 12px; height: 12px; margin-left: -6px; padding: 0; border: 2px solid var(--tl-mark-ring); border-radius: 50%; background: var(--tl-mark); cursor: pointer; pointer-events: auto; box-sizing: border-box; }
.tlMark:hover, .tlMark:focus-visible { transform: scale(1.4); }
.tlTip { position: absolute; bottom: 36px; left: 0; z-index: 4; white-space: nowrap; font: 600 12px/1.2 var(--tl-font); color: var(--tl-tip-ink); background: var(--tl-tip-bg); padding: 6px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(20, 30, 50, 0.25); pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateX(calc(var(--x, 0px) - 50%)) translateY(6px) scale(0.96);
  transition: opacity 0.12s ease-in, transform 0.12s ease-in, visibility 0s linear 0.12s; }
.tlTip.on { opacity: 1; visibility: visible; transform: translateX(calc(var(--x, 0px) - 50%)) translateY(0) scale(1);
  transition: opacity 0.16s cubic-bezier(0.23, 1, 0.32, 1), transform 0.14s cubic-bezier(0.23, 1, 0.32, 1), visibility 0s; }
.tlMark { transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
@media (prefers-reduced-motion: reduce) { .tlTip, .tlTip.on, .tlMark { transition: none; } .tlTip { transform: translateX(calc(var(--x, 0px) - 50%)); } }
.tlTip .tlLocal { font-family: var(--cap-local-font, 'Annapurna SIL', 'Mukta', sans-serif); font-weight: 600; }
.tlTip .tlAlt { opacity: 0.7; font-weight: 500; }
canvas#gl { transition: opacity 0.125s; }
canvas#gl.cut { opacity: 0; }

/* Caption highlight (src/highlight.js). Colours and fonts come from variables so each style can theme it. */
:root { --hl: #ffffff; --hl-halo: rgba(20, 40, 80, 0.45); --hl-label-bg: rgba(243, 238, 227, 0.92); --hl-label-ink: #2b2b2b; --hl-label-sub: #6d6a64; --hl-font: var(--font); }
.hl { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: hidden; }
.hlRingUnused { fill: none; stroke: var(--hl); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hlRingHalo { fill: none; stroke: var(--hl-halo); stroke-width: 6; }
@keyframes hlDrop { 0% { transform: translateY(-8px); opacity: 0; } 55% { transform: translateY(1.5px); opacity: 1; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes hlRise { 0% { transform: translateY(6px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.hlIn .hlDot, .hlIn .hlLeader { animation: hlDrop 0.34s cubic-bezier(0.23, 1, 0.32, 1) both; }
.hlIn .hlLabelIn { animation: hlRise 0.26s cubic-bezier(0.23, 1, 0.32, 1) 0.08s both; }
@media (prefers-reduced-motion: reduce) { .hlIn .hlDot, .hlIn .hlLeader, .hlIn .hlLabelIn { animation: none; } }
.hlLeader { stroke: var(--hl); stroke-width: 2; }
.hlDot { fill: var(--hl); stroke: var(--hl-halo); stroke-width: 2; }
.hlLabelBg { fill: var(--hl-label-bg); stroke: var(--hl-halo); stroke-width: 1; }
.hlTitle { font: 700 12.5px var(--hl-font); fill: var(--hl-label-ink); text-anchor: middle; }
.hlLocal { font: 500 12px var(--cap-local-font, 'Annapurna SIL', 'Mukta', sans-serif); fill: var(--hl-label-sub); text-anchor: middle; }
.hlArrowShape { fill: var(--hl); stroke: var(--hl-halo); stroke-width: 1.5; }
.hlArrowTitle { font: 700 11px var(--hl-font); fill: var(--hl); text-anchor: middle; paint-order: stroke; stroke: var(--hl-halo); stroke-width: 3px; }
body[data-style='painted'] { --hl: #fffdf6; --hl-halo: rgba(40, 70, 110, 0.55); }
body[data-style='ascii'] { --hl: #ffd400; --hl-halo: #0b0d10; --hl-label-bg: #0b0d10; --hl-label-ink: #eef2f6; --hl-label-sub: #9fb0c0; --hl-font: 'JetBrains Mono', monospace; }
body[data-style='retro'] { --hl: #feae34; --hl-halo: #181425; --hl-label-bg: #181425; --hl-label-ink: #fee761; --hl-label-sub: #c0cbdc; --hl-font: 'Departure Mono', monospace; }
body[data-style='brutalist'] { --hl: #ff3d8b; --hl-halo: #121212; --hl-label-bg: #ffd400; --hl-label-ink: #121212; --hl-label-sub: #3b3a37; --hl-font: 'Sporting Grotesque', sans-serif; }
body[data-style='semantic'] { --hl: #ffe14a; --hl-halo: rgba(0, 0, 0, 0.6); }

/* ---- Style themes. Each block sets variables first, then the few rules that variables cannot reach. */

/* ASCII: monospace, light on near-black. */
body[data-style='ascii'] {
  --paper: #0b0d10; --ink: #d7dde3; --grey: #8d98a3; --chip: rgba(14, 17, 21, 0.92);
  --font: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --capMono: #9fb0c0;
  background: #0b0d10;
}
body[data-style='ascii'] .pill, body[data-style='ascii'] .chip { border: 1px solid #3a424b; border-radius: 0; font-weight: 400; color: #d7dde3; }
body[data-style='ascii'] .pill[aria-pressed='true'], body[data-style='ascii'] .chip[aria-pressed='true'] { background: #d7dde3; color: #0b0d10; border-color: #d7dde3; }
body[data-style='ascii'] .chip.round { border-radius: 0; }
body[data-style='ascii'] .wordmark { font-weight: 400; color: #d7dde3; text-shadow: 0 0 6px #0b0d10; }
body[data-style='ascii'] .sceneryName, body[data-style='ascii'] .hintText { color: #b5c0ca; text-shadow: 0 0 6px #0b0d10; }
body[data-style='ascii'] .caption, body[data-style='ascii'] .credits { background: rgba(11, 13, 16, 0.9); border: 1px solid #3a424b; border-radius: 0; }
body[data-style='ascii'] .capTitle { color: #eef2f6; font-weight: 700; }
body[data-style='ascii'] .capSub { color: #9aa6b2; }
body[data-style='ascii'] .loading { background: #0b0d10; }

body[data-style='ascii'] { --tl-bg: rgba(11, 13, 16, 0.9); --tl-track: #3a424b; --tl-fill: #e4572e; --tl-thumb: #ffd400; --tl-thumb-ring: #0b0d10; --tl-mark: #d7dde3; --tl-mark-ring: #0b0d10; --tl-tip-bg: #0b0d10; --tl-tip-ink: #eef2f6; --tl-font: 'JetBrains Mono', monospace; --tl-radius: 0; }
body[data-style='ascii'] .timeline, body[data-style='ascii'] .tlTip { border: 1px solid #3a424b; border-radius: 0; }
body[data-style='ascii'] .tlMark, body[data-style='ascii'] .tlTrack { border-radius: 0; }

/* Retro: Departure Mono, palette colours, square corners. Palette is Endesga 32. */
body[data-style='retro'] {
  --paper: #181425; --ink: #ffffff; --grey: #c0cbdc; --chip: #262b44;
  --font: 'Departure Mono', 'Courier New', monospace;
  --capMono: #8b9bb4;
  background: #181425;
}
body[data-style='retro'] .pill, body[data-style='retro'] .chip { font-family: 'Departure Mono', monospace; font-weight: 400; font-size: 11px; letter-spacing: 0.04em; border: 2px solid #ffffff; border-radius: 0; color: #ffffff; background: #262b44; box-shadow: 2px 2px 0 #181425; }
body[data-style='retro'] .pill[aria-pressed='true'], body[data-style='retro'] .chip[aria-pressed='true'] { background: #feae34; color: #181425; border-color: #181425; box-shadow: 2px 2px 0 #ffffff; }
body[data-style='retro'] .pill:hover, body[data-style='retro'] .chip:hover { border-color: #feae34; }
body[data-style='retro'] .chip.round { border-radius: 0; font-family: 'Departure Mono', monospace; }
body[data-style='retro'] .wordmark { font-family: 'Departure Mono', monospace; font-weight: 700; color: #ffffff; text-shadow: 2px 2px 0 #181425; }
body[data-style='retro'] .sceneryName, body[data-style='retro'] .hintText { font-family: 'Departure Mono', monospace; color: #ffffff; text-shadow: 1px 1px 0 #181425, -1px -1px 0 #181425, 1px -1px 0 #181425, -1px 1px 0 #181425; }
body[data-style='retro'] .caption, body[data-style='retro'] .credits { background: #181425; border: 2px solid #ffffff; border-radius: 0; box-shadow: 3px 3px 0 #3a4466; }
body[data-style='retro'] .capTitle { font-family: 'Departure Mono', monospace; font-weight: 700; color: #fee761; font-size: 15px; }
body[data-style='retro'] .capSub { font-family: 'Departure Mono', monospace; color: #c0cbdc; font-size: 10px; }
body[data-style='retro'] .loading { background: #181425; color: #ffffff; }

body[data-style='retro'] { --tl-bg: #181425; --tl-track: #3a4466; --tl-fill: #feae34; --tl-thumb: #fee761; --tl-thumb-ring: #181425; --tl-mark: #ffffff; --tl-mark-ring: #181425; --tl-tip-bg: #181425; --tl-tip-ink: #fee761; --tl-font: 'Departure Mono', monospace; --tl-radius: 0; }
body[data-style='retro'] .timeline { border: 2px solid #ffffff; box-shadow: 3px 3px 0 #3a4466; }
body[data-style='retro'] .tlTip { border: 2px solid #ffffff; border-radius: 0; font-weight: 400; font-size: 10px; }
body[data-style='retro'] .tlMark, body[data-style='retro'] .tlTrack { border-radius: 0; }

/* Brutalist: Sporting Grotesque, uppercase, 2 px ink borders, 4 px hard shadows. */
body[data-style='brutalist'] {
  --paper: #f2efe8; --ink: #121212; --grey: #3b3a37; --chip: #f2efe8;
  --font: 'Sporting Grotesque', 'Inter', system-ui, sans-serif;
  --capMono: #3b3a37;
  background: #f2efe8;
}
body[data-style='brutalist'] .pill, body[data-style='brutalist'] .chip { font-family: 'Sporting Grotesque', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border: 2px solid #121212; border-radius: 0; color: #121212; background: #f2efe8; box-shadow: 4px 4px 0 #121212; }
body[data-style='brutalist'] .pill[aria-pressed='true'], body[data-style='brutalist'] .chip[aria-pressed='true'] { background: #ffd400; color: #121212; border-color: #121212; }
body[data-style='brutalist'] .pill:hover, body[data-style='brutalist'] .chip:hover { background: #ff6fae; border-color: #121212; }
body[data-style='brutalist'] .pill:active, body[data-style='brutalist'] .chip:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #121212; }
body[data-style='brutalist'] .chip.round { border-radius: 0; font-family: 'Sporting Grotesque', sans-serif; }
body[data-style='brutalist'] .wordmark { font-weight: 700; color: #121212; background: #f2efe8; border: 2px solid #121212; box-shadow: 4px 4px 0 #121212; padding: 4px 8px; display: inline-block; text-shadow: none; }
body[data-style='brutalist'] .sceneryName { margin-top: 10px; display: inline-block; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #121212; background: #ffd400; border: 2px solid #121212; padding: 2px 6px; text-shadow: none; }
body[data-style='brutalist'] .hintText { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #121212; background: #f2efe8; border: 2px solid #121212; padding: 3px 6px; text-shadow: none; }
body[data-style='brutalist'] .caption, body[data-style='brutalist'] .credits { background: #f2efe8; border: 2px solid #121212; border-radius: 0; box-shadow: 4px 4px 0 #121212; }
body[data-style='brutalist'] .capTitle { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #121212; font-size: 15px; }
body[data-style='brutalist'] .capSub { text-transform: uppercase; letter-spacing: 0.04em; color: #3b3a37; font-weight: 500; font-size: 10.5px; }
body[data-style='brutalist'] .loading { background: #f2efe8; }

.joystick { position: fixed; left: var(--iL); bottom: calc(var(--iB) + 84px); z-index: 4; display: none; touch-action: none; }
@media (pointer: coarse) { body.flying .joystick { display: block; } }
.joyBase { width: 116px; height: 116px; border-radius: 50%; background: rgba(243, 238, 227, 0.35); border: 2px solid rgba(255, 255, 255, 0.7); touch-action: none; display: flex; align-items: center; justify-content: center; }
.joyKnob { width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 8px rgba(20, 30, 50, 0.3); }
.loadPill { position: fixed; left: var(--iL); top: calc(var(--iT) + 38px); z-index: 5; font: 500 11px/1 var(--mono); color: var(--ink); background: var(--chip); border: 1px solid rgba(43, 43, 43, 0.14); border-radius: 999px; padding: 6px 11px; pointer-events: none; }
.loadPill[hidden] { display: none; }
.loadPill.retry { pointer-events: auto; cursor: pointer; }
.reload { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(16, 20, 26, 0.72); color: #fff; font: 600 14px var(--font); letter-spacing: 0.08em; }
.reload[hidden] { display: none; }

body[data-style='brutalist'] { --tl-bg: #f2efe8; --tl-track: #bdb8ac; --tl-fill: #e4572e; --tl-thumb: #ffd400; --tl-thumb-ring: #121212; --tl-mark: #ff6fae; --tl-mark-ring: #121212; --tl-tip-bg: #ffd400; --tl-tip-ink: #121212; --tl-font: 'Sporting Grotesque', sans-serif; --tl-radius: 0; }
body[data-style='brutalist'] .timeline { border: 2px solid #121212; box-shadow: 4px 4px 0 #121212; }
body[data-style='brutalist'] .tlTip { border: 2px solid #121212; border-radius: 0; text-transform: uppercase; box-shadow: 3px 3px 0 #121212; }
body[data-style='brutalist'] .tlMark, body[data-style='brutalist'] .tlTrack { border-radius: 0; }

/* Compact menu (body.mmenu): style, time and speed chips collapse into one round button and a sheet. */
.menuBtn, .sheet { display: none; }
body.mmenu .menuBtn { display: flex; align-items: center; justify-content: center; position: fixed; top: var(--iT); right: var(--iR); z-index: 7; width: 36px; height: 36px; padding: 0; color: var(--ink); background: var(--chip); border: 1px solid rgba(43, 43, 43, 0.14); border-radius: 50%; cursor: pointer; }
body.mmenu .sheet:not([hidden]) { display: block; position: fixed; top: calc(var(--iT) + 44px); right: var(--iR); z-index: 7; width: min(280px, calc(100vw - 2 * var(--inset))); max-height: 60vh; overflow: auto; background: var(--chip); border: 1px solid rgba(43, 43, 43, 0.14); border-radius: 12px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(20, 30, 50, 0.22); }
.sheetTitle { font: 600 10px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); opacity: 0.6; margin: 6px 0; }
.sheetRow { display: flex; flex-wrap: wrap; gap: 5px; }
body.mmenu .pills, body.mmenu .tools, body.mmenu .speeds { display: none; }
@media (max-width: 640px), (max-aspect-ratio: 1/1) {
  .joystick { bottom: calc(var(--iB) + 164px); }
  .tools { top: calc(var(--iT) + 72px); left: var(--iL); right: auto; }
  .menu { right: auto; left: 0; }
  .pills { left: var(--iL); right: var(--iR); top: calc(var(--iT) + 34px); flex-wrap: wrap; justify-content: flex-start; gap: 5px; }
  .pill { padding: 7px 10px; font-size: 11px; }
  .hintText { display: none; }
  .wordmark { font-size: 11px; }
  .sceneryName { font-size: 11px; }
  .controls { right: var(--iR); left: var(--iL); bottom: calc(var(--iB) + 112px); flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .chip { padding: 6px 9px; font-size: 11px; }
  .hint { left: var(--iL); bottom: calc(var(--iB) + 112px); }
  .credits { bottom: calc(var(--iB) + 86px); }
}
