/* Car Park Golf 2000: one arcade theme. Neon on midnight purple, chrome logo, CRT overlay. */
/* Self-hosted fonts (Latin subset, SIL Open Font License; see fonts/LICENSE.md), so the game works offline. */
@font-face { font-family: "Bungee"; font-weight: 400; font-display: swap; src: url(../fonts/bungee.woff2) format("woff2"); }
@font-face { font-family: "Bungee Shade"; font-weight: 400; font-display: swap; src: url(../fonts/bungee-shade.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url(../fonts/chakra-petch-500.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url(../fonts/chakra-petch-700.woff2) format("woff2"); }
@font-face { font-family: "Press Start 2P"; font-weight: 400; font-display: swap; src: url(../fonts/press-start-2p.woff2) format("woff2"); }
:root {
  --bg: #0d0221;
  --bg2: #1a0b3d;
  --surface: #160a33;
  --surface2: #22104a;
  --line: #3d2a72;
  --ink: #f5f3ff;
  --muted: #a99bd6;
  --hot: #ff2e88;      /* magenta */
  --cyan: #22e4ff;
  --yel: #ffd23a;      /* arcade yellow */
  --grn: #39ff88;
  --org: #ff9a1f;
  --red: #ff3b3b;
  --f-display: "Bungee", "Impact", system-ui, sans-serif;
  --f-pixel: "Press Start 2P", ui-monospace, monospace;
  --f-body: "Chakra Petch", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overscroll-behavior: none; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.4; overflow-x: hidden; }
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* CRT: scanlines and a vignette over everything. Purely visual. */
.crt { position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
              radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.55) 100%); }

/* Buttons */
.btn { border: 0; border-radius: 6px; padding: 12px 22px 10px; cursor: pointer; font: 400 16px/1 var(--f-display); letter-spacing: .04em;
  background: linear-gradient(180deg, #ffe680, var(--yel) 55%, #e0a800); color: #2a1600;
  box-shadow: 0 4px 0 #8a5a00, 0 0 18px rgba(255,210,58,.25); transition: transform .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a5a00; }
.btn.big { font-size: 26px; padding: 16px 40px 13px; }
.btn.small { font-size: 13px; padding: 8px 12px 6px; box-shadow: 0 3px 0 #8a5a00; }
.btn.hot { background: linear-gradient(180deg, #ff7ab8, var(--hot) 55%, #c4005a); color: #fff; box-shadow: 0 4px 0 #6d0032, 0 0 18px rgba(255,46,136,.35); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { border: 0; background: none; color: var(--cyan); text-decoration: underline; cursor: pointer; padding: 0; }
.tog { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px 5px; cursor: pointer; font: 700 12px/1 var(--f-body); letter-spacing: .08em; color: var(--muted); }
.tog[aria-pressed="true"] { color: var(--ink); border-color: var(--grn); }
.tog[aria-pressed="true"]::before { content: "● "; color: var(--grn); }
.tog[aria-pressed="false"]::before { content: "○ "; }

/* Screens */
.screen { min-height: 100%; }

/* Title */
.title { position: relative; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 32px 16px; text-align: center; overflow: hidden; }
.sky { position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, #0d0221 0%, #2b0a4f 52%, #4a0d5e 60%, #0d0221 61%); overflow: hidden; }
.sun { position: absolute; left: 50%; top: 30%; width: min(420px, 70vw); aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%;
  background: repeating-linear-gradient(180deg, transparent 0 58%, #2b0a4f 58% 61%, transparent 61% 66%, #2b0a4f 66% 70%, transparent 70% 76%, #2b0a4f 76% 81%, transparent 81%),
              linear-gradient(180deg, var(--yel), var(--hot) 75%); opacity: .85; filter: drop-shadow(0 0 40px rgba(255,46,136,.6)); }
.grid { position: absolute; left: -50%; right: -50%; top: 61%; bottom: -10%; transform: perspective(300px) rotateX(62deg); transform-origin: top;
  background-image: linear-gradient(var(--hot) 2px, transparent 2px), linear-gradient(90deg, var(--hot) 2px, transparent 2px);
  background-size: 60px 60px; opacity: .55; animation: roll 1.2s linear infinite; }
@keyframes roll { to { background-position: 0 60px; } }
.logo { margin: 0; display: grid; justify-items: center; line-height: .9; transform: rotate(-6deg) skewX(-8deg); }
.logo span { display: block; }
.logo .l1, .logo .l2 { font: 400 clamp(44px, 11vw, 104px)/0.95 var(--f-display);
  background: linear-gradient(180deg, #ffffff 0%, #d5f6ff 40%, #3a6bd6 50%, #9ad8ff 62%, #ffffff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px #0d0221; filter: drop-shadow(4px 4px 0 var(--hot)) drop-shadow(0 0 20px rgba(34,228,255,.45)); }
.logo .l2 { font-size: clamp(64px, 17vw, 160px); }
.logo .l3 { font: 400 clamp(36px, 8vw, 72px)/1 "Bungee Shade", var(--f-display); color: var(--yel); text-shadow: 0 0 18px rgba(255,210,58,.6); margin-top: 4px; }
.tag { margin: 0; color: var(--ink); font-weight: 700; letter-spacing: .04em; text-shadow: 0 2px 0 #000; }
.menu { display: grid; gap: 14px; justify-items: stretch; min-width: min(280px, 100%); }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.blink { margin: 0; font: 12px/1 var(--f-pixel); color: var(--yel); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Menu screens */
.menu-screen { max-width: 1040px; margin: 0 auto; padding: 18px 16px 40px; display: grid; gap: 18px; align-content: start; }
.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bar h2 { margin: 0; font: 400 clamp(24px, 5vw, 40px)/1 var(--f-display); color: var(--yel); text-shadow: 3px 3px 0 var(--hot); }
.tour { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .tour { grid-template-columns: 1fr; } }
.worldmap { background: radial-gradient(ellipse at 50% 40%, #1d0f4a, var(--surface) 70%); border: 2px solid var(--line); border-radius: 12px; padding: 8px; }
.worldmap svg { display: block; width: 100%; height: auto; }
.worldmap .land { fill: #5a43a3; }
.worldmap .leg { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.worldmap .leg.flown { stroke: var(--yel); }
.worldmap .leg.next { stroke: var(--hot); stroke-dasharray: 6 5; animation: fly 0.8s linear infinite; }
.worldmap .leg.future { stroke: var(--line); stroke-dasharray: 2 6; }
@keyframes fly { to { stroke-dashoffset: -11; } }
.worldmap .pin { cursor: pointer; }
.worldmap .pin .ring { fill: none; stroke: transparent; stroke-width: 2; }
.worldmap .pin .disc { fill: var(--surface2); stroke: var(--muted); stroke-width: 1.6; }
.worldmap .pin text { font: 8px/1 var(--f-pixel); fill: var(--muted); text-anchor: middle; pointer-events: none; }
.worldmap .pin.cleared .disc { fill: var(--yel); stroke: #110d1c; }
.worldmap .pin.cleared text { fill: #110d1c; }
.worldmap .pin.open .disc { fill: var(--hot); stroke: #fff; }
.worldmap .pin.open text { fill: #fff; }
.worldmap .pin.open .ring { stroke: var(--hot); animation: ping 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.worldmap .pin.locked { opacity: 0.55; }
.worldmap .pin.sel .ring { stroke: var(--cyan); animation: none; }
.worldmap .pin.moon .disc { fill: #e5e7eb; stroke: #fff; }
.worldmap .pin.moon .crater { fill: #a1a1aa; }
.worldmap .pin.moon .glow { fill: rgba(229,231,235,.15); }
.worldmap .pin.moon.sel .glow { fill: rgba(34,228,255,.3); }
.worldmap.reveal .pin.moon .body { animation: rise 1.6s cubic-bezier(.2,1.4,.4,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes ping { from { transform: scale(0.8); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }
.stops { display: flex; gap: 8px; flex-wrap: wrap; }
.stops .stop { display: flex; gap: 8px; align-items: center; border: 2px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px 6px; cursor: pointer; font: 700 14px/1 var(--f-body); color: var(--muted); }
.stops .stop b { font: 400 10px/1 var(--f-pixel); }
.stops .stop b.star { font: 16px/0.6 system-ui, sans-serif; }
.stops .stop.cleared b { color: var(--yel); }
.stops .stop.open { color: var(--ink); border-color: var(--hot); }
.stops .stop.locked { opacity: 0.6; }
.stops .stop[aria-pressed="true"] { border-color: var(--cyan); color: var(--bg); background: var(--cyan); }
.stops .stop[aria-pressed="true"] b { color: var(--bg); }
.newcourse { margin: 0 0 10px; font: 12px/1.4 var(--f-pixel); color: var(--yel); text-align: center; animation: blink 1s steps(2) 4; }
.course.secret h3 { color: #e5e7eb; text-shadow: 0 0 12px rgba(34,228,255,.6); }
.course { position: relative; background: linear-gradient(160deg, var(--surface2), var(--surface)); border: 2px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 10px; overflow: hidden; }
.course::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.06) 50%, transparent 60%); }
.course h3 { margin: 0; font: 400 26px/1 var(--f-display); color: var(--cyan); }
.course .num { font: 11px/1 var(--f-pixel); color: var(--muted); }
.course p { margin: 0; color: var(--muted); }
.course .meta { display: flex; gap: 14px; flex-wrap: wrap; font: 11px/1.6 var(--f-pixel); color: var(--ink); }
.course .meta b { color: var(--yel); font-weight: 400; }
.course.locked h3 { color: var(--muted); }
.course .why { font-weight: 700; color: var(--org); }
.course .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.stamp { position: absolute; right: 14px; top: 14px; font: 400 14px/1 var(--f-display); color: var(--grn); border: 2px solid currentColor; border-radius: 6px; padding: 6px 8px 4px; transform: rotate(8deg); }
.restore { margin: 0; color: var(--muted); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs button { border: 2px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px 6px; cursor: pointer; font: 400 14px/1 var(--f-display); color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--bg); background: var(--cyan); border-color: var(--cyan); }
.board { background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 8px 4px; min-height: 120px; }
.board table, .lb { width: 100%; border-collapse: collapse; font: 12px/1.4 var(--f-pixel); }
.lb th { color: var(--muted); font-weight: 400; text-align: left; padding: 8px 10px; font-size: 10px; }
.lb td { padding: 8px 10px; border-top: 1px solid var(--line); }
.lb td.n, .lb th.n { text-align: right; font-variant-numeric: tabular-nums; }
.lb tr.me td { color: var(--yel); }
.lb tr:nth-child(2) td:first-child { color: var(--yel); }
.empty { padding: 20px; color: var(--muted); text-align: center; }

/* Play */
.play { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 10px 16px 12px; }
.hud, .ptools { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.hud-hole { display: grid; gap: 2px; min-width: 0; margin-right: auto; }
.hud-hole b { font: 400 20px/1 var(--f-display); color: var(--cyan); }
.hud-hole span { color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-cell { display: grid; justify-items: center; gap: 4px; min-width: 52px; }
.hud-cell small { font: 8px/1 var(--f-pixel); color: var(--muted); letter-spacing: .06em; }
.hud-cell b { font: 16px/1 var(--f-pixel); color: var(--ink); font-weight: 400; }
.hud-cell.big b { font-size: 24px; color: var(--yel); }
.hud-cell span { font: 8px/1 var(--f-pixel); color: var(--red); min-height: 8px; }
.hud-cell b.under { color: var(--grn); } .hud-cell b.over { color: var(--red); }
.hud-cell b.warn { color: var(--yel); } .hud-cell b.out { color: var(--red); animation: blink 1s steps(2) infinite; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button { border: 0; background: none; padding: 7px 11px 6px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--hot); color: #fff; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; min-height: 0; }
.stagewrap { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; min-height: 0; min-width: 0; }
.stage { position: relative; min-height: 0; border-radius: 10px; overflow: hidden; background: #110d1c; border: 2px solid var(--line); box-shadow: 0 0 30px rgba(255,46,136,.15); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.badge { position: absolute; left: 12px; top: 12px; background: rgba(13,2,33,.85); color: var(--ink); padding: 6px 10px 5px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.badge b { color: var(--yel); }

/* Announcer slam text */
.slam { position: absolute; z-index: 5; left: 0; right: 0; top: 18%; display: grid; justify-items: center; gap: 6px; pointer-events: none; opacity: 0; padding: 0 16px; text-align: center; }
.slam.go { animation: slam 1.9s cubic-bezier(.2,.9,.3,1.2) forwards; }
.slam-big { font: 400 clamp(26px, 6vw, 64px)/1 var(--f-display); color: var(--yel); -webkit-text-stroke: 2px #0d0221;
  text-shadow: 4px 4px 0 var(--hot), 0 0 24px rgba(255,210,58,.5); transform: rotate(-4deg) skewX(-8deg); }
.slam-sub { font: 14px/1 var(--f-pixel); color: #fff; text-shadow: 2px 2px 0 #000; }
.slam[data-tone="bad"] .slam-big { color: #fff; text-shadow: 4px 4px 0 var(--red), 0 0 24px rgba(255,59,59,.6); }
.slam[data-tone="warn"] .slam-big { color: var(--org); text-shadow: 4px 4px 0 #6d0032; }
.slam[data-tone="cool"] .slam-big { color: var(--cyan); text-shadow: 3px 3px 0 #0d0221; font-size: clamp(20px, 4vw, 40px); }
.slam[data-tone="fire"] .slam-big { color: var(--yel); text-shadow: 0 0 10px var(--org), 0 0 30px var(--red), 4px 4px 0 var(--red); }
@keyframes slam {
  0% { opacity: 0; transform: scale(3); }
  12% { opacity: 1; transform: scale(.92); }
  18% { transform: scale(1.04); }
  24%, 80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1) translateY(-20px); }
}

/* Overlay cards: hole intro, hole result, scorecard */
.overlay { position: absolute; inset: 0; display: grid; background: rgba(13,2,33,.6); padding: 16px; overflow: auto; }
.card { background: linear-gradient(170deg, var(--surface2), var(--surface)); border: 3px solid var(--hot); border-radius: 14px; padding: 22px 24px; width: min(440px, 100%); margin: auto;
  box-shadow: 0 0 0 3px #0d0221, 0 0 40px rgba(255,46,136,.45); display: grid; gap: 12px; text-align: center; }
.card.wide { width: min(640px, 100%); }
.card .fin { display: grid; gap: inherit; min-width: 0; }
.eyebrow { margin: 0; font: 10px/1.4 var(--f-pixel); letter-spacing: .08em; color: var(--muted); }
.eyebrow.fire-note { color: var(--org); }
.card h2 { margin: 0; font: 400 clamp(28px, 6vw, 44px)/1 var(--f-display); color: var(--yel); text-shadow: 3px 3px 0 var(--hot); }
.card h3 { margin: 0; font: 400 20px/1.1 var(--f-display); color: var(--cyan); }
.card p { margin: 0; }
.card .quip { color: var(--muted); font-weight: 700; }
.card .rule { color: var(--muted); font-size: 13px; }
.card .facts { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.card .facts div { display: grid; gap: 6px; }
.card .facts small { font: 9px/1 var(--f-pixel); color: var(--muted); }
.card .facts b { font: 20px/1 var(--f-pixel); font-weight: 400; }
.card .points { display: grid; justify-items: center; gap: 8px; margin: 4px 0 0; }
.card .points small { font: 10px/1 var(--f-pixel); color: var(--muted); }
.card .points b { font: 400 40px/1 var(--f-pixel); color: var(--yel); letter-spacing: 2px; text-shadow: 0 0 12px var(--yel); }
.card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.card li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.card li span:last-child { font: 12px/1.4 var(--f-pixel); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hint-key { font: 9px/1 var(--f-pixel); color: var(--muted); }
.verdict-pass { color: var(--grn) !important; text-shadow: 3px 3px 0 #0d0221 !important; }
.verdict-fail { color: var(--red) !important; text-shadow: 3px 3px 0 #0d0221 !important; }
.initials { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.initials input { width: 5.2em; text-align: center; font: 22px/1 var(--f-pixel); text-transform: uppercase; letter-spacing: .2em; padding: 10px 6px 8px 12px;
  background: var(--bg); color: var(--yel); border: 2px solid var(--cyan); border-radius: 8px; }
.msg { color: var(--muted); font-weight: 700; min-height: 1.4em; }
.msg.bad { color: var(--red); }

/* Scorecard table (panel and course result) */
.scard { width: 100%; border-collapse: collapse; font: 10px/1.2 var(--f-pixel); }
.scard th, .scard td { padding: 5px 3px; text-align: center; border: 1px solid var(--line); }
.scard th { color: var(--muted); font-weight: 400; }
.scard td.now { outline: 2px solid var(--cyan); outline-offset: -2px; }
.sc-ace, .sc-eagle { background: var(--yel); color: #2a1600; }
.sc-birdie { color: var(--grn); }
.sc-bogey { color: var(--org); }
.sc-awful, .sc-pickup { color: var(--red); }

/* Touch pad: a steering cluster for the left thumb, pedals for the right. Fingers can slide between buttons. */
.pad { display: none; justify-content: space-between; gap: 10px; }
.cluster { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(46%, 220px); touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad button { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0 4px; min-height: 52px; font: 400 15px/1 var(--f-display);
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad button.on { background: var(--hot); color: #fff; border-color: var(--hot); }
.steer [data-k="left"], .steer [data-k="right"] { font-size: 24px; min-height: 64px; }
.steer .ctr { grid-column: 1 / -1; grid-auto-flow: column; gap: 8px; font: 11px/1 var(--f-pixel); color: var(--muted); min-height: 44px; }
.steer .ctr svg { width: 36px; height: 36px; }
.steer .ctr.off { color: var(--yel); border-color: var(--yel); }
.ctr .rim { fill: none; stroke: var(--ink); stroke-width: 8; }
.ctr .spoke { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }
.ctr .mark { fill: var(--hot); }
.pedals .fwd { grid-column: 1 / -1; min-height: 64px; font-size: 18px; color: var(--grn); }
.pedals .rev { color: var(--org); } .pedals .brk { color: var(--red); }
.pad[data-g="D"] .fwd:not(.on) { border-color: var(--grn); box-shadow: 0 0 12px rgba(57,255,136,.25); }
.pad[data-g="R"] .rev:not(.on) { border-color: var(--org); box-shadow: 0 0 12px rgba(255,154,31,.25); }
.more-btn, .btn.fs { display: none; }
.only-touch { display: none; }
@media (hover: none), (pointer: coarse) {
  .pad { display: flex; }
  .only-keys { display: none !important; }
  .only-touch { display: revert; }
}

/* Side panel */
.panel { min-height: 0; min-width: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.panel section { background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.panel h2 { margin: 0 0 10px; font: 9px/1 var(--f-pixel); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.inst { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; }
.gearbox { display: grid; gap: 4px; justify-items: center; }
.gear { font: 400 36px/1 var(--f-display); width: 58px; height: 58px; display: grid; place-items: center; border-radius: 10px; border: 3px solid var(--line); padding-top: 4px; }
.gear[data-g="D"] { color: var(--grn); border-color: var(--grn); box-shadow: 0 0 12px rgba(57,255,136,.3); }
.gear[data-g="R"] { color: var(--org); border-color: var(--org); box-shadow: 0 0 12px rgba(255,154,31,.3); }
.gearbox small { font: 8px/1 var(--f-pixel); color: var(--muted); }
.wheel { display: flex; align-items: center; gap: 10px; }
.wheel svg { width: 64px; height: 64px; flex: none; }
.wheel .rim { fill: none; stroke: var(--ink); stroke-width: 7; }
.wheel .spoke { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.wheel .hub { fill: var(--ink); }
.wheel .mark { fill: var(--hot); }
.wheel div { display: grid; gap: 1px; }
.wheel strong { font: 700 15px/1.2 var(--f-body); }
.wheel span { color: var(--muted); font-size: 12px; }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.stats div { display: grid; gap: 4px; }
.stats dt { font: 7px/1 var(--f-pixel); color: var(--muted); text-transform: uppercase; }
.stats dd { margin: 0; font: 12px/1.2 var(--f-pixel); }
.stats dd.bad { color: var(--red); }

.coach ol { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 6px; }
.coach li { counter-increment: st; display: grid; grid-template-columns: 22px 1fr; gap: 8px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.coach li::before { content: counter(st); width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font: 8px/1 var(--f-pixel); }
.coach li.now { color: var(--ink); font-weight: 700; }
.coach li.now::before { background: var(--yel); border-color: var(--yel); color: #2a1600; }
.coach li.done { text-decoration: line-through; text-decoration-color: var(--line); }
.coach li.done::before { content: "✓"; color: var(--grn); border-color: var(--grn); }
.hint { margin: 10px 0 0; padding: 8px 10px; border-radius: 7px; background: rgba(255,210,58,.12); color: var(--yel); font-size: 13px; font-weight: 700; }
.hint:empty { display: none; }

.fit ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fit li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; }
.fit li b { font: 10px/1 var(--f-pixel); font-weight: 400; }
.chip { font: 8px/1 var(--f-pixel); text-transform: uppercase; padding: 4px 5px 3px; border-radius: 4px; border: 1px solid currentColor; }
.chip.ok { color: var(--grn); } .chip.warn { color: var(--org); } .chip.bad { color: var(--red); }
.sens { margin-top: 8px; display: flex; justify-content: space-between; font: 9px/1 var(--f-pixel); color: var(--muted); }

.custom .fields { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.fhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 700; }
.fhead b { font: 10px/1 var(--f-pixel); font-weight: 400; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.field input[type="range"] { width: 100%; margin: 0; accent-color: var(--hot); }
.seg.small { justify-self: start; }
.seg.small button { padding: 5px 10px; font-size: 12px; }
.verdict { margin: 12px 0 0; padding: 8px 10px; border-radius: 7px; border: 2px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); }
.verdict[data-s="ok"] { color: var(--grn); border-color: currentColor; }
.verdict[data-s="tight"] { color: var(--org); border-color: currentColor; }
.verdict[data-s="no"] { color: var(--red); border-color: currentColor; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: 13px; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.rules { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.rules b { color: var(--yel); }
kbd { font: 9px/1 var(--f-pixel); border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 4px; padding: 3px 5px 2px; background: var(--bg); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(13,2,33,.8); padding: 16px; overflow: auto; }
.mcard { position: relative; background: linear-gradient(170deg, var(--surface2), var(--surface)); border: 3px solid var(--cyan); border-radius: 14px; padding: 26px 22px 22px; width: min(520px, 100%);
  box-shadow: 0 0 40px rgba(34,228,255,.35); display: grid; gap: 14px; text-align: center; }
.mcard h2 { margin: 0; font: 400 30px/1.05 var(--f-display); color: var(--yel); text-shadow: 3px 3px 0 var(--hot); }
.mcard p { margin: 0; }
.mclose { position: absolute; right: 10px; top: 8px; border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 6px; }
.code { font: 18px/1.4 var(--f-pixel); color: var(--yel); background: var(--bg); border: 2px dashed var(--yel); border-radius: 8px; padding: 12px; user-select: all; }
#checkout:not(:empty) { background: #fff; border-radius: 10px; padding: 6px; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-weight: 700; }
.perks li::before { content: "★ "; color: var(--yel); }

@media (max-width: 900px) {
  .play { height: auto; }
  .main { grid-template-columns: minmax(0, 1fr); }
  .stage { height: clamp(280px, 64vw, 540px); }
  .pad { display: flex; }
  .keys dl { display: none; }
  .hud-cell { min-width: 44px; }
}
/* Phones: the play screen fills the viewport and never scrolls. The side panel is hidden;
   in practice MORE opens the toolbar's options and the panel as a sheet over the lot. */
@media (orientation: landscape) and (max-height: 520px), (orientation: portrait) and (max-width: 700px) {
  body.playing { overflow: hidden; }
  .play { height: 100vh; height: 100dvh; gap: 6px; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .main { position: relative; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .stage { height: auto; }
  .stagewrap { gap: 6px; }
  .panel { display: none; }
  .hud, .ptools { padding: 5px 8px; gap: 4px 10px; }
  .hud .btn.small, .ptools .btn.small { min-height: 40px; }
  .hud-hole span, .hud-cell.t { display: none; }
  .hud-hole b { font-size: 16px; }
  .hud-cell { min-width: 40px; }
  .hud-cell b { font-size: 13px; } .hud-cell.big b { font-size: 18px; }
  .hud-cell small { font-size: 7px; }
  .more-btn, .btn.fs { display: inline-block; }
  .ptools > .seg, .ptools > .tog { display: none; }
  .play.more .ptools > .seg, .play.more .ptools > .tog { display: inline-flex; }
  .play.more .ptools .tog { min-height: 36px; align-items: center; }
  .play.more .panel { display: flex; position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; max-height: 75%;
    padding: 8px; background: rgba(13,2,33,.92); border: 2px solid var(--cyan); border-radius: 10px; }
  .play.more .panel .keys, .play.more .panel .inst { display: none; }
  .card { padding: 14px 16px; gap: 8px; }
  .card h2 { font-size: 28px; }
  .card .btn.big { font-size: 20px; padding: 12px 28px 10px; }
  .slam { top: 10%; }
}
/* Landscape phone: steering at the left edge, pedals at the right, the lot in between. */
@media (orientation: landscape) and (max-height: 520px) {
  .title { grid-template-columns: auto auto; grid-template-rows: repeat(4, auto); align-content: center; justify-content: center; column-gap: 6vw; row-gap: 12px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
  .title .logo { grid-row: 1 / -1; }
  .logo .l1 { font-size: clamp(30px, 13vh, 64px); } .logo .l2 { font-size: clamp(44px, 20vh, 100px); } .logo .l3 { font-size: clamp(26px, 10vh, 52px); }
  .title .tag { font-size: 13px; max-width: 34ch; }
  .title .btn.big { font-size: 22px; padding: 12px 32px 10px; }
  .title .menu { gap: 10px; }
  .stagewrap { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); }
  .pad { display: contents; }
  .stage { grid-column: 2; grid-row: 1; }
  .cluster { width: clamp(118px, 17vw, 160px); align-self: end; }
  .steer { grid-column: 1; grid-row: 1; }
  .pedals { grid-column: 3; grid-row: 1; }
  .steer [data-k="left"], .steer [data-k="right"], .pedals .fwd { min-height: 76px; }
  .steer .ctr svg { width: 28px; height: 28px; }
  /* the lot can be under 250 px tall in Safari: compact cards, and the final one in two columns */
  .overlay { padding: 6px; }
  .card { width: min(520px, 100%); padding: 8px 14px; gap: 5px; }
  .card h2 { font-size: 24px; }
  .card .quip { font-size: 13px; }
  .card .facts { gap: 2px 18px; }
  .card .facts div { gap: 3px; }
  .card .facts small { font-size: 8px; }
  .card .facts b { font-size: 15px; }
  .card .btn.big { font-size: 18px; padding: 9px 26px 7px; }
  .card .rule, .card .hint-key { display: none; }
  .card .so-far { font-size: 8px; }
  .overlay:has(> .final) { position: fixed; z-index: 30; background: rgba(13,2,33,.9);
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .card.final { width: min(760px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); column-gap: 14px; align-items: center; }
  .card.final > .eyebrow { grid-column: 1 / -1; }
  .card .points b { font-size: 26px; }
  .card.final .facts { column-gap: 12px; }
  .card.final .initials { flex-wrap: nowrap; gap: 8px; }
  .card.final .initials input { font-size: 16px; padding: 7px 4px 5px 10px; }
  .card.final .btn { padding-top: 8px; padding-bottom: 6px; }
  .card.final .msg:empty, .card.final #subBoard:empty { display: none; }
}
/* Portrait phone: a two-row HUD (hole and buttons, then the numbers), the lot, the pad underneath. */
@media (orientation: portrait) and (max-width: 700px) {
  .hud::after { content: ""; flex-basis: 100%; order: 1; }
  .hud-cell { order: 2; flex: 1; }
  .pad { gap: 12px; }
  .cluster { width: auto; flex: 1; max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .grid, .blink, .worldmap .leg.next, .worldmap .pin .ring, .worldmap.reveal .pin.moon .body, .newcourse { animation: none; }
  .slam.go { animation: none; opacity: 1; }
}
