/* LAST DROP UI
   Type: Big Shoulders Display (numbers, titles, labels) + Schibsted Grotesk (reading text). Both SIL OFL 1.1.
   Look: a field instrument at golden hour. Cream ink on the scene, one amber accent, hairlines with ruler ticks,
   square corners, left-anchored layouts. The HUD has no boxes and no blur: the scene stays the star. */

@font-face { font-family: 'Big Shoulders Display'; src: url('../fonts/big-shoulders-display-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Big Shoulders Display'; src: url('../fonts/big-shoulders-display-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Big Shoulders Display'; src: url('../fonts/big-shoulders-display-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url('../fonts/schibsted-grotesk-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Schibsted Grotesk'; src: url('../fonts/schibsted-grotesk-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --ink: #f7efe3;
  --ink-2: rgba(247, 239, 227, 0.76);
  --ink-3: rgba(247, 239, 227, 0.52);
  --hair: rgba(247, 239, 227, 0.2);
  --hair-2: rgba(247, 239, 227, 0.34);
  --sun: #f1b562;
  --sun-2: #f7cf8c;
  --clay: #ee7d50;
  --clay-2: #ffb08a;
  --water: #ade0ec;
  --bloom: #eaa3b6;
  --umber: #1b110a;
  --on-ink: #25170c;
  --panel: rgba(25, 16, 10, 0.8);
  --display: 'Big Shoulders Display', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --text: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* legibility over bright sand without a box: one tight shadow, one soft */
  --ts: 0 1px 2px rgba(22, 11, 4, 0.55), 0 0 18px rgba(22, 11, 4, 0.3);
  /* small text needs a firmer halo */
  --ts-sm: 0 1px 2px rgba(22, 11, 4, 0.75), 0 0 8px rgba(22, 11, 4, 0.5);
  --g: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--umber); overflow: hidden; color: var(--ink); font-family: var(--text); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
body.clean #screens, body.clean #veil, body.clean #hud, body.clean #transit { display: none !important; }
.ico { width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
[data-icon] { display: inline-flex; }

/* ---------- shared pieces ---------- */

/* a measuring hairline: long ticks every 5th, the motif of a run measured in metres */
.ruler { position: relative; height: 9px; margin: 0; color: var(--hair-2);
  background:
    linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 40px) left bottom / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 8px) left bottom / 100% 4px no-repeat; }

.kicker { font: 600 15px/1.1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--sun); }
.kicker:empty { display: none; }
.wordmark { font: 800 clamp(64px, 9vw, 132px)/0.82 var(--display); text-transform: uppercase; letter-spacing: -0.005em; margin: 10px 0 14px; text-shadow: 0 2px 30px rgba(30, 14, 4, 0.35); }
.title { font: 800 clamp(40px, 5vw, 56px)/0.9 var(--display); text-transform: uppercase; letter-spacing: 0.005em; margin: 0; font-variant-numeric: tabular-nums; }
.lede { font: 400 17px/1.5 var(--text); color: var(--ink); margin: 16px 0 20px; max-width: 34em; text-shadow: 0 1px 12px rgba(22, 11, 4, 0.4); }
.quiet { font: 400 13px/1.5 var(--text); color: var(--ink-3); margin: 14px 0 0; }
.quiet:empty { display: none; }

/* buttons: square-cornered, condensed caps */
button { font: 700 18px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); cursor: pointer; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0; -webkit-appearance: none; appearance: none; }
button .ico { font-size: 18px; stroke-width: 2; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--water); outline-offset: 3px; }
.primary { min-height: 52px; padding: 0 28px; background: var(--ink); color: var(--on-ink); border-radius: 3px; font-size: 21px; box-shadow: 0 8px 28px rgba(22, 11, 4, 0.3); transition: background 0.18s ease, transform 0.12s ease; }
.primary .ico { stroke-width: 2.25; }
.primary [data-icon="play"] .ico { fill: currentColor; stroke-width: 0; font-size: 15px; }
.primary:hover { background: var(--sun-2); }
.primary:active { transform: translateY(1px); }
.ghost { min-height: 48px; padding: 0 20px; border-radius: 3px; border: 1px solid var(--hair-2); background: rgba(27, 17, 10, 0.32); color: var(--ink); transition: border-color 0.18s, background 0.18s; }
.ghost .ico { color: var(--sun); }
.ghost:hover { border-color: var(--ink-2); background: rgba(247, 239, 227, 0.08); }
.ghost:active { background: rgba(247, 239, 227, 0.14); }
.chip { min-height: 36px; padding: 0 12px; white-space: nowrap; font: 600 13px/1 var(--text); letter-spacing: 0; text-transform: none; color: var(--ink-2); border-radius: 3px; border: 1px solid var(--hair); background: rgba(27, 17, 10, 0.28); gap: 7px; transition: color 0.18s, border-color 0.18s; }
.chip .ico { font-size: 15px; stroke-width: 1.75; }
.chip:hover { color: var(--ink); border-color: var(--hair-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.actions.col { flex-direction: column; align-items: stretch; }

/* ---------- veil + screens ---------- */

#veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.6s ease;
  background: linear-gradient(90deg, rgba(20, 12, 7, 0.72) 0%, rgba(20, 12, 7, 0.42) 34%, rgba(20, 12, 7, 0.08) 62%, rgba(20, 12, 7, 0) 78%); }
#veil.on { opacity: 1; }
#veil.full { background: linear-gradient(90deg, rgba(20, 12, 7, 0.7) 0%, rgba(20, 12, 7, 0.46) 45%, rgba(20, 12, 7, 0.3) 100%); }

#screens { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.center { width: 100%; max-width: 480px; margin: auto auto auto max(0px, calc(6vw - 16px)); }
.panel { position: relative; padding: 30px 30px 26px; background: var(--panel); border: 1px solid rgba(247, 239, 227, 0.09); border-radius: 4px;
  box-shadow: 0 30px 80px rgba(12, 6, 2, 0.4); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); }
/* the amber tab on every panel */
.panel::before { content: ''; position: absolute; left: 30px; top: -1px; width: 44px; height: 3px; background: var(--sun); }
.panel.wide { max-width: 760px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }

/* loading */
#s-loading { background: radial-gradient(120% 90% at 70% 30%, #6e4a2f 0%, #36231a 48%, #1b110a 100%); }
.loading { margin: auto auto max(14vh, 64px) max(0px, calc(6vw - 16px)); width: min(100%, 520px); }
.loadline { margin-top: 6px; overflow: hidden; }
.loadline i { position: absolute; left: 0; bottom: 0; display: block; height: 3px; width: 0; background: var(--sun); transition: width 0.25s ease; }
#load-text { margin-top: 12px; color: var(--ink-2); }

/* menu: one column on the shaded side */
.menu { margin: auto auto auto max(0px, calc(6vw - 16px)); width: 100%; max-width: 520px; padding: 8px 0; }
.menu .ruler { max-width: 400px; }
.rules { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; max-width: 30em; }
.rules li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font: 400 14px/1.45 var(--text); color: var(--ink-2); text-shadow: 0 1px 10px rgba(22, 11, 4, 0.45); }
.rules li > span:first-child { font-size: 18px; color: var(--sun); padding-top: 1px; }
.rules b { color: var(--ink); font-weight: 600; }
.menu-stats { display: flex; align-items: stretch; margin: 0 0 4px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); max-width: 440px; }
.menu-stats div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 11px 14px 10px; }
.menu-stats div:first-child { padding-left: 0; }
.menu-stats div + div { border-left: 1px solid var(--hair); }
.menu-stats small { font: 600 13px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.menu-stats b { font: 700 27px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 440px; }
.menu-actions .primary { grid-column: 1 / -1; }
#menu-dunes { margin-top: 12px; }
.settings { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* pause */
.pause-panel { max-width: 320px; }
.pause-panel .actions { margin-top: 20px; }

/* end of a run */
.end-panel { max-width: 500px; }
#end-kicker { margin-bottom: 6px; line-height: 1.25; }
#end-title { font-size: clamp(88px, 11vw, 132px); line-height: 0.8; letter-spacing: -0.01em; }
#end-title small { font: 700 0.3em/1 var(--display); letter-spacing: 0.02em; color: var(--ink-2); margin-left: 6px; text-transform: none; }
.end-best { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; font: 700 18px/1.2 var(--display); letter-spacing: 0.04em; color: var(--ink-2); }
.end-best:empty { display: none; }
.end-best .ico { font-size: 16px; stroke-width: 2; }
.end-best.new { color: var(--on-ink); background: var(--sun); padding: 7px 11px 6px; border-radius: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 20px 0 0; border-top: 1px solid var(--hair); }
.stats div { min-width: 0; padding: 11px 0 10px; border-bottom: 1px solid var(--hair); }
.stats div:not(:nth-child(3n + 1)) { padding-left: 14px; border-left: 1px solid var(--hair); }
.stats dt { font: 600 12px/1.1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; white-space: nowrap; }
.stats dd { margin: 0; font: 700 26px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats dd small { font: 500 14px var(--display); color: var(--ink-3); margin-left: 3px; letter-spacing: 0.02em; }
.end-seeds { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 16px; row-gap: 6px; margin-top: 16px; }
.end-seeds .earned { grid-row: span 2; display: flex; align-items: baseline; gap: 6px; font: 600 14px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.end-seeds .earned .ico { font-size: 22px; color: var(--sun); align-self: center; }
.end-seeds .earned b { font: 800 40px/0.9 var(--display); letter-spacing: 0; color: var(--sun); font-variant-numeric: tabular-nums; }
.end-seeds .parts { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 400 13px/1.3 var(--text); color: var(--ink-3); }
.end-seeds .parts:empty { display: none; }
.end-seeds .parts b { font-weight: 600; color: var(--ink-2); }
.end-seeds .hint { font: 400 13px/1.3 var(--text); color: var(--ink-2); }
.end-seeds .hint.ready { color: var(--sun-2); font-weight: 600; }
.end-seeds .hint.ready::before { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 7px 1px 0; background: var(--sun); transform: rotate(45deg); }
#end-rank { margin-top: 12px; color: var(--ink-2); }
.end-actions { display: grid; gap: 8px; margin-top: 20px; }
.end-actions .primary { width: 100%; }
.actions-sub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions-sub .ghost { padding: 0 10px; font-size: 16px; gap: 8px; }

/* upgrades */
.wallet { display: flex; align-items: baseline; gap: 6px; color: var(--ink-2); font: 600 14px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.wallet .ico { font-size: 20px; color: var(--sun); align-self: center; }
.wallet b { font: 800 32px/0.9 var(--display); color: var(--sun); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.shop-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.shop-list li { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.up-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--hair-2); border-radius: 3px; color: var(--sun); font-size: 19px; }
.up-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.up-body b { font: 700 19px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.up-line { font: 400 13px/1.3 var(--text); color: var(--ink-2); }
.up-line small { font-size: 12px; color: var(--ink-3); }
.pips { display: flex; gap: 3px; margin-top: 2px; }
.pips i { width: 14px; height: 4px; background: rgba(247, 239, 227, 0.18); }
.pips i.on { background: var(--sun); }
.buy { min-width: 72px; min-height: 40px; padding: 0 12px; gap: 6px; border-radius: 3px; border: 1px solid var(--sun); background: rgba(241, 181, 98, 0.12); color: var(--sun-2); font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; transition: background 0.18s, color 0.18s; }
.buy .ico { font-size: 16px; stroke-width: 2.2; }
.buy:hover { background: var(--sun); color: var(--on-ink); }
.buy:disabled { background: transparent; color: var(--ink-3); border-color: var(--hair); cursor: default; }
.shop-list li.max .up-icon { background: var(--sun); color: var(--on-ink); border-color: var(--sun); }
.shop-list li.max .buy { border: 0; color: var(--sun); letter-spacing: 0.1em; }
#s-shop .actions, #s-board .actions { margin-top: 20px; }

/* leaderboards */
.tabs { display: flex; gap: 22px; margin: 6px 0 4px; border-bottom: 1px solid var(--hair); }
.tab { position: relative; min-height: 44px; font: 700 17px/1 var(--display); letter-spacing: 0.06em; color: var(--ink-3); transition: color 0.18s; }
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--sun); }
.board-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.board-list li { display: grid; grid-template-columns: 2.6em 1fr auto; align-items: baseline; gap: 10px; padding: 11px 10px 10px 0; border-bottom: 1px solid var(--hair); }
.board-list .rk { font: 700 19px/1 var(--display); color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; padding-right: 6px; }
.board-list li:nth-child(-n + 3) .rk { color: var(--sun); }
.board-list .nm { font: 400 15px/1.2 var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .ds { font: 700 21px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.board-list li.me { background: linear-gradient(90deg, rgba(241, 181, 98, 0.2), rgba(241, 181, 98, 0.04)); box-shadow: inset 3px 0 0 var(--sun); }
.board-list li.me .rk, .board-list li.me .ds { color: var(--sun-2); }
.board-list li.me .nm { font-weight: 600; }
.board-list li.gap { display: block; width: 26px; height: 16px; margin-left: 1.1em; padding: 0; border: 0; background: radial-gradient(circle, var(--ink-3) 1.3px, transparent 1.9px) 0 50% / 9px 16px repeat-x; }
#board-note { margin-top: 12px; }

/* name entry */
#name-input { display: block; width: 100%; margin: 18px 0 4px; padding: 6px 0 8px; font: 700 34px/1.1 var(--display); letter-spacing: 0.02em; color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--hair-2); border-radius: 0; outline: none; user-select: text; -webkit-user-select: text; }
#name-input:focus { border-bottom-color: var(--sun); }
#name-input::placeholder { color: var(--ink-3); }

/* ---------- HUD ---------- */

#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: var(--ts); }
#hud b { font-weight: inherit; }
.unit { font: 500 0.36em/1 var(--display); letter-spacing: 0.02em; color: var(--ink-2); margin-left: 0.12em; }

/* top left: the distance, the water under it */
.hud-tl { position: absolute; left: calc(var(--g) + var(--safe-l)); top: calc(14px + var(--safe-t)); }
.dist-read { display: flex; align-items: baseline; font: 700 80px/0.8 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
#dist-pb { margin-top: 7px; min-height: 15px; font: 700 15px/1 var(--display); text-shadow: var(--ts-sm); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-variant-numeric: tabular-nums; }
#dist-pb.new { color: var(--sun); }
#dist-pb.new::before { content: ''; display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 1px; background: var(--sun); transform: rotate(45deg); }

#hud-vol { margin-top: 14px; width: 176px; }
.vol-read { display: flex; align-items: baseline; font: 700 34px/0.9 var(--display); font-variant-numeric: tabular-nums; }
.vol-ico { font-size: 18px; color: var(--water); margin-right: 5px; align-self: center; }
.vol-ico .ico { stroke-width: 2.2; }
.vol-read .unit { font-size: 15px; }
#vol-num { display: inline-block; transition: color 0.3s ease, transform 0.25s ease; transform-origin: left 80%; }
#vol-num.pop { transform: scale(1.1); }
#vol-num.pop-gain { color: var(--water); }
#vol-num.pop-drain { color: var(--clay-2); }
/* the water bar: segmented like a gauge; the tick is what you started with */
.vol-bar { position: relative; height: 6px; margin-top: 8px; }
.vol-bar::before, .vol-bar i { -webkit-mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px); mask: repeating-linear-gradient(90deg, #000 0 5px, transparent 5px 7px); }
.vol-bar::before { content: ''; position: absolute; inset: 0; background: rgba(247, 239, 227, 0.24); }
.vol-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 59%; background: var(--water); transition: background 0.4s; }
.vol-bar em { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; left: 59%; background: var(--ink); box-shadow: 0 0 3px rgba(22, 11, 4, 0.5); }
#vol-rate { margin-top: 7px; min-height: 15px; font: 600 13px/1.25 var(--text); text-shadow: var(--ts-sm); color: var(--ink-2); white-space: nowrap; }
#vol-rate.drain { color: var(--clay-2); }
#vol-rate.gain { color: var(--water); }
#vol-left { margin-top: 4px; font: 700 17px/1 var(--display); letter-spacing: 0.04em; text-shadow: var(--ts-sm); color: var(--clay-2); white-space: nowrap; }
#vol-left::first-letter { text-transform: uppercase; }
#hud.low .vol-bar i { background: var(--clay); }
#hud.low #vol-num { color: var(--clay-2); animation: pulse 1.1s ease-in-out infinite; }
#hud.danger .vol-bar i { animation: pulse 0.8s ease-in-out infinite; }
#hud.danger .vol-ico { color: var(--clay-2); }
@keyframes pulse { 50% { opacity: 0.45; } }

/* top right: clock, pause, this run's tally */
.hud-tr { position: absolute; right: calc(var(--g) + var(--safe-r) - 4px); top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
#hud-right { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
#hud-time { font: 500 24px/1 var(--display); letter-spacing: 0.03em; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.round { width: 44px; height: 44px; border-radius: 3px; border: 1px solid var(--hair-2); background: rgba(27, 17, 10, 0.3); color: var(--ink); }
.round .ico { font-size: 18px; fill: currentColor; stroke-width: 0; }
#hud-goals { list-style: none; margin: 0; padding: 0 4px 0 0; display: flex; gap: 16px; }
#hud-goals li { display: flex; align-items: center; gap: 6px; font: 700 24px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); transition: color 0.4s, opacity 0.4s; }
#hud-goals li > span { font-size: 17px; color: var(--sun); }
#hud-goals li .ico { stroke-width: 2; }
#goal-flowers > span { color: var(--bloom); }
#hud-goals li.done, #hud-goals li.done b { color: var(--sun); }
#hud-goals li.ahead b { color: var(--water); }
#hud-goals li.missed { opacity: 0.45; }

/* top centre: this stretch, the oasis at the end of the line */
#hud-track { position: absolute; left: 50%; top: calc(20px + var(--safe-t)); width: min(32vw, 440px); transform: translateX(-50%); }
.track-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#track-leg { font: 700 18px/1 var(--display); letter-spacing: 0.07em; text-transform: uppercase; }
#track-left { font: 600 12px/1 var(--text); text-shadow: var(--ts-sm); color: var(--ink-2); white-space: nowrap; }
#hud-track .line { position: relative; height: 2px; margin: 10px 5px 0 0; background: rgba(247, 239, 227, 0.32); box-shadow: 0 1px 3px rgba(22, 11, 4, 0.35); }
/* ticks every tenth of the way, under the line */
#hud-track .line::after { content: ''; position: absolute; left: 0; right: 0; top: 4px; height: 4px; opacity: 0.55;
  background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 10%); }
/* the oasis: a ring at the end */
#hud-track .line::before { content: ''; position: absolute; right: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--water); box-sizing: border-box; }
#track-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); }
#track-dot { position: absolute; left: 0; top: -4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--water); box-shadow: 0 0 0 2px rgba(27, 17, 10, 0.55); }
#track-flowers i { position: absolute; top: -3px; width: 8px; height: 8px; margin-left: -4px; border: 1.5px solid var(--sun-2); transform: rotate(45deg); box-shadow: 0 0 3px rgba(22, 11, 4, 0.45); }
#track-flowers i.on { background: var(--bloom); border-color: var(--bloom); }
#track-flowers i.off { border-color: rgba(247, 239, 227, 0.32); box-shadow: none; }
#track-dry { position: absolute; top: -7px; width: 3px; height: 16px; margin-left: -1.5px; background: var(--clay); box-shadow: 0 0 6px rgba(238, 125, 80, 0.7); }

/* the start card: a title card on the left, away from the drop */
#hud-card { position: absolute; left: calc(var(--g) + var(--safe-l)); top: 44%; width: min(44vw, 520px); padding: 18px 26px 16px 0; transition: opacity 0.8s ease;
  background: linear-gradient(90deg, rgba(22, 13, 7, 0.5) 0%, rgba(22, 13, 7, 0.32) 70%, rgba(22, 13, 7, 0) 100%); box-shadow: -40px 0 0 rgba(22, 13, 7, 0.5); }
#hud-card.fade { opacity: 0; }
.card-title { font: 800 clamp(44px, 2.4vw + 24px, 68px)/0.88 var(--display); text-transform: uppercase; margin: 6px 0 14px; text-wrap: balance; }
.card-goals { list-style: none; padding: 12px 0 0; margin: 0; display: grid; gap: 8px; border-top: 1px solid var(--hair-2); font: 400 15px/1.35 var(--text); color: var(--ink); }
.card-goals li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.card-goals .ico { width: 18px; height: 18px; color: var(--sun); margin-top: 1px; stroke-width: 2; }

/* the big moment: new best, next stretch */
#hud-split { position: absolute; left: 50%; top: calc(94px + var(--safe-t)); transform: translate(-50%, 6px) scale(0.97); max-width: calc(100vw - 32px); text-align: center; font: 600 14px/1.35 var(--text); color: var(--ink-2); text-shadow: var(--ts-sm); opacity: 0; transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
#hud-split.show { opacity: 1; transform: translate(-50%, 0); }
#hud-split b { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; font: 800 clamp(34px, 2vw + 22px, 52px)/0.95 var(--display); text-transform: uppercase; letter-spacing: 0.01em; color: var(--sun-2); white-space: nowrap; }
#hud-split b .ico { font-size: 0.7em; stroke-width: 2.25; }
#hud-split .good { color: #c4e8c9; }
#hud-split .bad { color: var(--clay-2); }

/* what just happened, under the drop */
#hud-caption { position: absolute; left: 16px; right: 16px; bottom: calc(10vh + var(--safe-b)); text-align: center; font: 700 32px/1 var(--display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; opacity: 0; transform: translateY(6px); transition: opacity 0.3s ease, transform 0.3s ease; }
#hud-caption.show { opacity: 1; transform: none; }
#hud-caption .ico { font-size: 0.7em; }
#hud-caption small { display: block; margin-top: 6px; font: 600 14px/1.3 var(--text); text-shadow: var(--ts-sm); letter-spacing: 0; text-transform: none; color: var(--ink-2); }
#hud-hint { position: absolute; left: 16px; right: 16px; bottom: calc(24px + var(--safe-b)); text-align: center; font: 600 13px/1.35 var(--text); text-shadow: var(--ts-sm); color: var(--ink-2); transition: opacity 1s ease; }

/* ---------- between stretches ---------- */

#transit { position: fixed; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 24px calc(20px + var(--safe-r)) 24px calc(20px + var(--safe-l)); text-align: center; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 55%, rgba(176, 112, 52, 0.62) 0%, rgba(70, 38, 17, 0.86) 55%, rgba(24, 14, 7, 0.96) 100%);
  animation: transit-in 0.45s ease both; }
/* the HUD steps aside for the beat */
body:has(#transit:not(.hidden)) #hud { opacity: 0; transition: opacity 0.3s ease; }
.transit-inner { width: min(100%, 760px); }
#transit .kicker { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 24px; font-weight: 700; text-transform: none; letter-spacing: 0.04em; color: var(--sun-2); font-variant-numeric: tabular-nums; animation: rise 0.6s 0.1s ease both; }
#transit .kicker::before, #transit .kicker::after { content: ''; width: 40px; height: 1px; background: currentColor; opacity: 0.6; }
.transit-title { margin: 12px 0 18px; font: 800 clamp(80px, 13vw, 200px)/0.82 var(--display); text-transform: uppercase; letter-spacing: -0.005em; color: var(--ink); text-shadow: 0 4px 40px rgba(40, 18, 4, 0.45); animation: settle 0.8s 0.05s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#transit .ruler { width: min(70%, 420px); margin: 0 auto; color: rgba(247, 239, 227, 0.45); animation: grow 0.9s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; transform-origin: center; }
.transit-line { margin: 16px auto 0; max-width: 30em; font: 400 16px/1.45 var(--text); color: var(--ink-2); animation: rise 0.6s 0.3s ease both; }
.transit-line:empty { display: none; }
@keyframes transit-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes settle { from { opacity: 0; transform: scale(1.08); } }
@keyframes grow { from { transform: scaleX(0); } }

/* big desktop screens: scale the whole UI up rather than leave it tiny */
@media (min-width: 1600px) and (min-height: 900px) {
  #hud, #screens, #transit { zoom: 1.3; }
}

/* ---------- phones, portrait ---------- */
@media (max-width: 640px) {
  :root { --g: 16px; }
  #veil { background: linear-gradient(0deg, rgba(20, 12, 7, 0.86) 0%, rgba(20, 12, 7, 0.62) 50%, rgba(20, 12, 7, 0.1) 78%, rgba(20, 12, 7, 0) 90%); }
  #veil.full { background: rgba(20, 12, 7, 0.55); }
  .center, .menu, .loading { margin-left: auto; margin-right: auto; }
  .menu { margin-top: auto; margin-bottom: 0; padding-bottom: 4px; }
  .wordmark { font-size: clamp(56px, 17vw, 76px); margin: 8px 0 12px; }
  .lede { font-size: 15px; margin: 12px 0 14px; }
  .rules { gap: 7px; margin-bottom: 16px; }
  .rules li { font-size: 13px; grid-template-columns: 18px 1fr; gap: 9px; }
  .rules li > span:first-child { font-size: 16px; }
  .menu-stats b { font-size: 24px; }
  .menu-stats div { padding: 9px 10px 8px; }
  .menu-stats small { font-size: 12px; }
  .actions, .menu-actions { margin-top: 14px; }
  .panel { padding: 24px 18px 18px; }
  .panel::before { left: 18px; }
  .title { font-size: 40px; }
  #end-title { font-size: 88px; }
  .stats dd { font-size: 24px; }
  .stats div:not(:nth-child(3n + 1)) { padding-left: 10px; }
  .actions-sub .ghost { flex-direction: column; gap: 5px; min-height: 58px; font-size: 14px; letter-spacing: 0.05em; }
  .actions-sub .ghost .ico { font-size: 18px; }
  .shop-list { grid-template-columns: 1fr; }
  .shop-list li { grid-template-columns: 36px 1fr auto; gap: 10px; padding: 11px 0; }
  .up-icon { width: 36px; height: 36px; font-size: 17px; }
  .up-body b { font-size: 18px; }
  .tabs { gap: 18px; }
  .panel-head .title { font-size: 36px; }
  #s-shop .actions, #s-board .actions, #name-form .actions { display: grid; grid-template-columns: 1fr 1fr; }
  #s-board .actions { grid-template-columns: 1fr; }
  .end-seeds { grid-template-columns: 1fr; }
  .end-seeds .earned { grid-row: auto; }
  .chip { font-size: 12px; padding: 0 10px; min-height: 34px; }
  .settings { gap: 6px; }

  /* HUD: distance + water top left, clock top right, the oasis line along the bottom */
  .dist-read { font-size: 58px; }
  #dist-pb { font-size: 14px; margin-top: 6px; }
  #hud-vol { margin-top: 12px; width: 140px; }
  .vol-read { font-size: 28px; }
  .vol-ico { font-size: 16px; }
  #vol-left { font-size: 16px; }
  #hud-time { font-size: 21px; }
  #hud-goals li { font-size: 22px; }
  #hud-track { top: auto; left: calc(var(--g) + var(--safe-l)); right: calc(var(--g) + var(--safe-r)); bottom: calc(18px + var(--safe-b)); width: auto; transform: none; }
  #hud-track .line { margin-top: 9px; }
  #hud-hint { left: 10px; right: 10px; bottom: calc(68px + var(--safe-b)); font-size: 12px; }
  #hud-split { top: calc(196px + var(--safe-t)); }
  #hud-split b { font-size: 34px; }
  #hud-caption { bottom: calc(112px + var(--safe-b)); font-size: 26px; }
  /* in portrait the drop sits low: the card takes the sky under the readouts */
  #hud-card { top: calc(186px + var(--safe-t)); left: 0; right: 0; width: auto; padding: 18px var(--g) 18px calc(var(--g) + var(--safe-l)); box-shadow: none;
    background: linear-gradient(180deg, rgba(22, 13, 7, 0) 0%, rgba(22, 13, 7, 0.42) 22%, rgba(22, 13, 7, 0.42) 78%, rgba(22, 13, 7, 0) 100%); }
  .card-title { font-size: 44px; margin-bottom: 12px; }
  .card-goals { font-size: 14px; gap: 6px; }
  #transit .kicker { font-size: 18px; }
  #transit .kicker::before, #transit .kicker::after { width: 24px; }
  .transit-title { font-size: clamp(64px, 21vw, 96px); }
  .transit-line { font-size: 15px; }
}

/* very small phones (iPhone SE, 375 x 667) */
@media (max-width: 640px) and (max-height: 700px) {
  .lede { display: none; }
  .menu .ruler { margin-bottom: 14px; }
  .wordmark { font-size: 60px; }
  #end-title { font-size: 76px; }
  .stats { margin-top: 14px; }
  .stats div { padding: 8px 0 7px; }
  .end-seeds { margin-top: 12px; }
  /* the start card keeps clear of the drop: title only (the menu already listed the rules) */
  .card-title { font-size: 38px; margin-bottom: 0; }
  .card-goals { display: none; }
}

/* ---------- landscape phones: short screens ---------- */
@media (max-height: 500px) {
  :root { --g: 18px; }
  .screen { padding-top: calc(10px + var(--safe-t)); padding-bottom: calc(10px + var(--safe-b)); }
  .menu { max-width: 680px; padding: 4px 0; }
  .wordmark { font-size: 54px; margin: 4px 0 8px; }
  .menu .ruler { max-width: 300px; }
  .lede { display: none; }
  .rules { grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 10px 0 12px; max-width: none; }
  .rules li { font-size: 12px; line-height: 1.35; grid-template-columns: 16px 1fr; gap: 8px; }
  .rules li > span:first-child { font-size: 15px; }
  .menu-stats { max-width: 400px; }
  .menu-stats div { padding: 7px 12px 6px; }
  .menu-stats b { font-size: 22px; }
  .menu-actions { grid-template-columns: 1.3fr 1fr 1fr; max-width: 560px; margin-top: 12px; }
  .menu-actions .primary { grid-column: auto; }
  .primary { min-height: 46px; }
  .ghost { min-height: 44px; }
  #menu-dunes { margin-top: 8px; font-size: 12px; }
  .settings { margin-top: 8px; }
  .chip { min-height: 32px; }
  .center { margin-left: auto; margin-right: auto; }
  .panel { padding: 18px 22px 16px; }
  .panel::before { left: 22px; }
  .title { font-size: 36px; }
  .quiet { margin-top: 8px; }
  .actions { margin-top: 14px; }
  .pause-panel { max-width: 560px; }
  .pause-panel .actions.col { flex-direction: row; }
  .pause-panel .actions.col button { flex: 1 1 0; }
  /* the end screen in two columns */
  .end-panel { max-width: 780px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); column-gap: 28px; align-items: start; }
  .end-panel > * { grid-column: 1; }
  .end-panel > #end-stats, .end-panel > .end-actions { grid-column: 2; }
  .end-panel > #end-stats { grid-row: 1 / span 4; margin-top: 0; }
  .end-panel > .end-actions { grid-row: 5 / span 3; align-self: end; }
  #end-title { font-size: 76px; }
  .end-best { margin-top: 8px; font-size: 14px; }
  .stats div { padding: 8px 0 7px; }
  .stats dd { font-size: 22px; }
  .end-seeds { margin-top: 10px; }
  .end-seeds .earned b { font-size: 32px; }
  #end-rank { margin-top: 8px; }
  .end-actions { margin-top: 12px; }
  .shop-list li { padding: 8px 0; grid-template-columns: 34px 1fr auto; gap: 10px; }
  .up-icon { width: 34px; height: 34px; font-size: 16px; }
  .up-body b { font-size: 17px; }
  .up-line { font-size: 12px; }
  .buy { min-height: 36px; }
  .panel-head { padding-bottom: 8px; }
  .panel-head .title { font-size: 32px; }
  .end-best { justify-self: start; }
  .board-list li { padding: 8px 10px 7px 0; }

  /* HUD */
  .hud-tl { top: calc(10px + var(--safe-t)); }
  .dist-read { font-size: 50px; }
  #dist-pb { font-size: 13px; margin-top: 5px; }
  #hud-vol { margin-top: 10px; width: 140px; }
  .vol-read { font-size: 26px; }
  .hud-tr { top: calc(8px + var(--safe-t)); gap: 8px; }
  #hud-track { top: calc(14px + var(--safe-t)); width: min(34vw, 340px); }
  #hud-split { top: calc(64px + var(--safe-t)); }
  #hud-split b { font-size: 32px; }
  #hud-caption { bottom: calc(8px + var(--safe-b)); font-size: 24px; }
  #hud-caption small { font-size: 13px; margin-top: 4px; }
  #hud-hint { left: auto; right: calc(var(--g) + var(--safe-r)); bottom: calc(14px + var(--safe-b)); max-width: 30vw; text-align: right; }
  #hud-card { top: calc(150px + var(--safe-t)); width: min(36vw, 320px); padding: 10px 18px 10px 0; box-shadow: -30px 0 0 rgba(22, 13, 7, 0.5); }
  #hud-card .kicker { font-size: 13px; }
  .card-title { font-size: 32px; margin: 4px 0 8px; }
  .card-goals { font-size: 12px; gap: 4px; padding-top: 8px; }
  .card-goals li { grid-template-columns: 16px 1fr; gap: 7px; }
  .card-goals .ico { width: 15px; height: 15px; }
  .transit-title { font-size: clamp(64px, 22vh, 120px); margin: 8px 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  #hud.low #vol-num, #hud.danger .vol-bar i { animation: none; }
  #hud-caption, #hud-split { transition: opacity 0.3s ease; transform: none; }
  #hud-split.show { transform: translate(-50%, 0); }
  #hud-split { transform: translate(-50%, 0); }
  #transit, #transit *, #transit .kicker { animation: none !important; }
  .primary, .ghost { transition: none; }
}
