/* Layout: full-bleed canvas; HUD pinned to the four corners plus a pace-note strip
   across the top; overlays are co-driver notebook cards on a warm haze. */
:root {
  --paper: #fbf0dc;
  --paper-2: #f2dfbf;
  --ink: #3a2a1f;
  --ink-soft: #7a6450;
  --ember: #d95f2b;
  --moss: #4c8546;
  --brick: #b63f2a;
  --glass: rgba(251, 240, 220, 0.9);
  --haze: rgba(92, 58, 34, 0.38);
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f0d2a6; color: var(--ink); font-family: var(--body); }
[hidden] { display: none !important; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

kbd {
  font-family: var(--body);
  font-weight: 800;
  font-size: 0.72em;
  display: inline-block;
  min-width: 1.7em;
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--paper);
  border: 1.5px solid var(--ink-soft);
  border-bottom-width: 3px;
  color: var(--ink);
  text-align: center;
  line-height: 1.3;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.panel {
  background: var(--glass);
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(58, 42, 31, 0.18), 0 8px 24px rgba(58, 42, 31, 0.12);
}
.timing {
  position: absolute;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: var(--gutter);
  padding: 10px 14px 10px;
  min-width: 168px;
}
.stage-tag { display: flex; gap: 8px; align-items: baseline; font-size: 12px; font-weight: 800; color: var(--ink-soft); letter-spacing: 0.04em; }
.stage-tag .ss { color: var(--ember); }
.clock {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 46px;
  line-height: 1;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.splits { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; font-weight: 700; display: grid; gap: 2px; }
.splits li { display: flex; gap: 8px; font-variant-numeric: tabular-nums; }
.splits .k { color: var(--ink-soft); width: 20px; }
.good { color: var(--moss); }
.bad { color: var(--brick); }

.progress {
  position: absolute;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  padding: 12px 14px 10px;
  width: 200px;
}
.rail { position: relative; height: 8px; border-radius: 4px; background: var(--paper-2); overflow: visible; }
.rail .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--ember); }
.rail .tick { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); border-radius: 1px; }
.dist { margin-top: 7px; font-size: 13px; font-weight: 800; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }

.dash {
  position: absolute;
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 10px 16px 12px 14px;
}
.gear-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-right: 14px; border-right: 2px dashed var(--paper-2); }
.lbl { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.gear { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 44px; line-height: 1; color: var(--ember); }
.speed { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 52px; line-height: 0.95; font-variant-numeric: tabular-nums; min-width: 128px; text-align: right; }
.speed small { font-family: var(--body); font-style: normal; font-size: 13px; font-weight: 800; color: var(--ink-soft); margin-left: 4px; }
.rpm { margin-top: 6px; height: 9px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.rpm div { height: 100%; width: 0; background: var(--ink); border-radius: 4px; }
.rpm div.hot { background: var(--ember); }
.rpm div.limiter { animation: limiter 0.12s steps(2) infinite; }
@keyframes limiter { 50% { background: var(--brick); opacity: 0.55; } }
.gear.shift { animation: gearpop 0.32s ease-out; }
@keyframes gearpop { 0% { transform: scale(1.45); color: var(--ink); } 100% { transform: scale(1); } }

/* Pace notes */
.notes {
  position: absolute;
  /* A little below the top edge, nearer where the eye rests on the road. */
  top: calc(var(--gutter) + clamp(24px, 6vh, 64px) + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: calc(100% - 460px);
}
.note {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 10px;
  background: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 15px, rgba(122, 100, 80, 0.12) 15px 16px);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(58, 42, 31, 0.2), 0 6px 18px rgba(58, 42, 31, 0.12);
  opacity: 0.85;
  /* scale = which card is current, translate = the FLIP glide (notesUI.js),
     transform = the in/out animations; three properties, so none fights another. */
  scale: 0.86;
  transform-origin: top center;
  transition: opacity 0.2s, scale 0.3s cubic-bezier(0.34, 1.5, 0.64, 1), translate 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.note.current { opacity: 1; scale: 1; box-shadow: 0 3px 0 var(--ember), 0 8px 22px rgba(58, 42, 31, 0.16); }
/* Corner severity scribbled with a highlighter behind the number (src/ui/scribble.js draws
   the strokes, heavier the tighter the corner): sage 6 through mustard and coral to red for
   a 1, pink-plum for a hairpin. Ink stays ink. */
.note.sev-6 { --sc: #a6cc86; }
.note.sev-5 { --sc: #cbd66f; }
.note.sev-4 { --sc: #f6cf55; }
.note.sev-3 { --sc: #f6a052; }
.note.sev-2 { --sc: #f07a54; }
.note.sev-1 { --sc: #ea4f3a; }
.note.sev-H { --sc: #cc4f8e; }
.note .sev { position: relative; isolation: isolate; align-self: flex-start; }
.note .scribble {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: var(--sc);
}
.note.drop { animation: note-drop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1); }
.note.join { animation: note-join 0.46s cubic-bezier(0.34, 1.56, 0.64, 1); }
.note.out { position: absolute; margin: 0; animation: note-out 0.3s ease-in forwards; }
.note .glyph { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); }
.note .glyph svg { width: 100%; height: 100%; }
.note .body { display: flex; flex-direction: column; line-height: 1; }
.note .dir { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.note .sev { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 40px; }
.note-crest .sev, .note-jump .sev, .note-finish .sev { font-size: 28px; }
.note .mods { font-size: 12px; font-weight: 800; color: var(--ember); margin-top: 2px; white-space: nowrap; }
.note .link {
  position: absolute;
  right: -10px;
  bottom: -9px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  z-index: 1;
}
.note .link.tap { animation: link-tap 0.36s ease-out; }
@keyframes note-drop { from { opacity: 0; transform: translateY(-22px) scale(0.7); } }
@keyframes note-join { from { opacity: 0; transform: translateX(-34px) scale(0.5); } }
@keyframes note-out { to { opacity: 0; transform: translateX(-30px) scale(0.75); } }
@keyframes link-tap { 40% { transform: scale(1.35); background: var(--ember); } }

.toast {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -6px);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast b { font-family: var(--display); font-style: italic; font-size: 19px; margin-left: 4px; }
.toast .good { color: #9fd793; }
.toast .bad { color: #f59a7e; }
.toast.warn { background: var(--brick); }

.countdown {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 140px;
  color: var(--paper);
  text-shadow: 0 4px 0 var(--ink), 0 12px 30px rgba(58, 42, 31, 0.4);
  opacity: 0;
}
.countdown.on { animation: pop 0.9s ease-out forwards; }
.countdown.go { color: var(--ember); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
}

.hint {
  position: absolute;
  left: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  max-width: 460px;
  opacity: 0;
  transition: opacity 0.6s;
}
.hint.on { opacity: 1; }

/* ---------- Buttons (the cards' own parts are in cards.css) ---------- */
button {
  font: 800 15px var(--body);
  color: var(--ink);
  background: var(--paper-2);
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 3px 0 rgba(58, 42, 31, 0.25);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}
button:hover { background: #ead2aa; }
/* Buttons are for the mouse (Tab is off, input.js): no focus frame. */
button:focus-visible { outline: none; }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(58, 42, 31, 0.25); }
input:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button.primary { background: var(--ember); color: var(--paper); }
button.primary:hover { background: #c95324; }
button.primary kbd { background: rgba(251, 240, 220, 0.2); color: var(--paper); border-color: rgba(251, 240, 220, 0.6); }

@media (max-width: 820px) {
  .notes { top: auto; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 32px); }
  .progress { width: 150px; }
}
@media (max-width: 520px) {
  .sky kbd { display: none; }
  .sky button { padding: 5px 8px; font-size: 12px; }
  .clock { font-size: 34px; }
  .timing { min-width: 0; }
  .speed { font-size: 40px; min-width: 96px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .note, .note.out, .note .link, .countdown.on { animation-duration: 0.01s; }
}

/* Sandbox: no stage timing, progress or pace notes. */
body.sandbox .timing, body.sandbox .progress, body.sandbox .notes { display: none; }
body.endless .progress { display: none; }
/* While driving (src/ui/cursor.js). */
body.no-cursor, body.no-cursor * { cursor: none !important; }
/* The endless road's sky chips sit where the progress bar would be. */
.sky {
  position: absolute;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  display: flex;
  gap: 6px;
  padding: 6px;
  pointer-events: auto;
}
.sky button { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 10px; box-shadow: none; }
.sky button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.sky button[aria-pressed='true'] kbd { background: transparent; color: var(--paper); border-color: rgba(251, 240, 220, 0.6); }
body:not(.endless):not(.sandbox) .sky { display: none; }
body.sandbox #auto-btn { display: none; }

/* Rivals (src/game/rivals/board.js): the gap box and the split board top right, name tags, the classification. */
.rv-box, .rv-split { position: absolute; right: var(--gutter); width: 200px; box-sizing: border-box; padding: 10px 14px; font-variant-numeric: tabular-nums; }
/* Under the progress panel (top right, about 55 px tall). */
.rv-box { top: calc(var(--gutter) + 66px + env(safe-area-inset-top, 0px)); }
.rv-split { top: calc(var(--gutter) + 178px + env(safe-area-inset-top, 0px)); animation: rv-in 0.25s ease-out; }
@keyframes rv-in { from { transform: translateY(-6px); opacity: 0; } }
.rv-place { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 34px; line-height: 1; }
.rv-place span { font-size: 20px; color: var(--ink-soft); margin-right: 1px; }
.rv-place small, .rv-head small { font-family: var(--body); font-style: normal; font-size: 13px; color: var(--ink-soft); margin-left: 5px; }
.rv-head { font-size: 12px; font-weight: 800; letter-spacing: 0.04em; color: var(--ink-soft); }
.rv-head b { font-family: var(--display); font-style: italic; font-size: 22px; color: var(--ink); margin-left: 4px; }
.rv-box ol, .rv-split ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; font-size: 14px; font-weight: 700; }
.rv-box li, .rv-split li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; }
.rv-split li { grid-template-columns: 12px 1fr auto 52px; }
.rv-split li.you { color: var(--ember); }
.rv-split em { font-style: normal; font-size: 12px; text-align: right; }
.rv-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px rgba(58, 42, 31, 0.35); }
.rv-dot.you { background: var(--ember); }
.rv-tags { position: absolute; inset: 0; overflow: hidden; }
.rv-tag { position: absolute; left: 0; top: 0; padding: 1px 7px; border-radius: 8px; font-size: 12px; font-weight: 800; color: #fff; background: var(--c); box-shadow: 0 1px 0 rgba(58, 42, 31, 0.3); white-space: nowrap; opacity: 0; will-change: transform; }
.rv-table { margin-bottom: 16px; }
.rv-table ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 5px; }
.rv-table li { display: grid; grid-template-columns: 18px 12px 1fr auto 56px; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rv-table li.you { color: var(--ember); }
.rv-table li b { font-family: var(--display); font-style: italic; font-size: 18px; }
.rv-table li.running b { font-family: var(--body); font-style: normal; font-size: 12px; color: var(--ink-soft); }
.rv-table li.out { opacity: 0.55; }
.rv-table em { font-style: normal; text-align: right; color: var(--ink-soft); font-size: 13px; }
.rv-pos { color: var(--ink-soft); text-align: right; }
.rv-skip { margin-top: 10px; }
#results:has(.rv-table:not([hidden])) .results-splits { display: block; }
.rv-warm { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.rv-warm b { color: var(--ink); }
/* The card while the rivals drive the stage (board.js loading). */
.rv-loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(58, 42, 31, 0.62); animation: rv-fade 0.3s ease-out; }
.rv-loading[hidden] { display: none; }
@keyframes rv-fade { from { opacity: 0; } }
.rv-loading .card { width: min(420px, calc(100vw - 32px)); box-sizing: border-box; }
.rv-sub { margin: 4px 0 14px; font-size: 14px; font-weight: 700; color: var(--ink-soft); min-height: 1.2em; }
.rv-bar { position: relative; display: block; height: 10px; border-radius: 5px; background: var(--paper-2); overflow: hidden; }
.rv-bar b { position: absolute; inset: 0; background: var(--ember); border-radius: 5px; transform-origin: left center; transform: scaleX(0); transition: transform 0.45s linear; will-change: transform; }
.rv-chips { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rv-chips li { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); font-size: 13px; font-weight: 800; color: var(--ink-soft); opacity: 0.55; transition: opacity 0.25s; }
.rv-chips li.busy { opacity: 0.85; }
.rv-chips li.done { opacity: 1; color: var(--ink); animation: rv-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.rv-chips li.done::after { content: '✓'; color: var(--moss); }
@keyframes rv-pop { 40% { transform: scale(1.12); } }
.rv-back { margin: 14px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }

/* The race HUD comes in from the edges as the countdown starts (one easing with the cards). */
#hud.enter:not([hidden]) > .panel { animation: hud-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
#hud.enter:not([hidden]) > .panel:nth-of-type(2) { animation-delay: 0.04s; }
#hud.enter:not([hidden]) > .panel:nth-of-type(3) { animation-delay: 0.08s; }
#hud.enter:not([hidden]) > .panel:nth-of-type(4) { animation-delay: 0.12s; }
@keyframes hud-in { from { opacity: 0; transform: scale(0.94); } }
@media (prefers-reduced-motion: reduce) { #hud.enter:not([hidden]) > .panel { animation: none; } }

/* ---------- Brain view (brainview.js: a brain driving, ?watch or rally.watchBrain) ---------- */
.brainview {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 25;
  padding: 8px 10px 8px;
  font: 700 11.5px var(--body);
  color: var(--ink);
  pointer-events: none;
}
.bv-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.bv-top span { flex: 1; color: var(--ink-soft); }
/* brainworld.js: what it draws in the world, each on or off */
.bv-chip {
  pointer-events: auto;
  font: 800 10px var(--body);
  letter-spacing: 0.04em;
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid rgba(58, 42, 31, 0.25);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.bv-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.brainview { width: min(620px, 50vw); }
.brainview canvas { display: block; width: 100%; aspect-ratio: 600 / 250; }
.bv-about { margin: 0 0 4px; font: 700 11px var(--body); color: var(--ink-soft); }
/* Over the canvas's three parts: radar 170, network 300 (+4), outputs 126 of its 600 px. */
.bv-caps { display: grid; grid-template-columns: 28.3% 50.7% 21%; font: 800 10.5px var(--body); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ember); }
.bv-caps[hidden] { display: none; }
/* A phone (watch mode): the brain view across the bottom. */
@media (max-width: 700px) {
  .brainview { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; }
  /* The radar shows the speed and gear, and a clock means nothing to a watcher. */
  body.watching #hud .dash, body.watching #hud .timing { display: none; }
}
/* Watch mode's hint (watchHint.js): once, under the HUD's "AI view" chip, which is ringed meanwhile. */
.wt-note {
  position: fixed;
  z-index: 26;
  top: calc(var(--gutter) + 58px + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  max-width: calc(100vw - 2 * var(--gutter));
  transform: translateY(-6px);
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font: 700 14.5px/1.35 var(--body);
  box-shadow: 0 6px 18px rgba(40, 26, 16, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
}
.wt-note.on { opacity: 1; transform: none; }
.wt-note b { color: #ffc28f; }
#brain-btn.nudge { box-shadow: 0 0 0 3px var(--ember); }
.bv-k-eye { color: #3fb8c8; }


/* ---------- Touch (src/game/touch.js): pads while a finger was the last thing used ---------- */
.touch { display: none; position: absolute; inset: 0; --tp: clamp(62px, 19vh, 92px); --tb: calc(max(var(--gutter), env(safe-area-inset-bottom, 0px)) + 6px); }
body.using-touch .touch { display: block; }
/* Kite3 driving (watch mode): the road clear; a tap on it takes over. */
body.watching .touch { display: none; }
.tz { position: absolute; bottom: 0; pointer-events: auto; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tz-steer { left: 0; width: 42%; height: 64%; }
.tz-pedals { right: 0; width: 40%; height: 72%; }
.tpad {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--tp);
  height: var(--tp);
  border-radius: 18px;
  background: rgba(251, 240, 220, 0.34);
  border: 2px solid rgba(251, 240, 220, 0.75);
  box-shadow: 0 3px 0 rgba(58, 42, 31, 0.22);
  color: var(--ink);
  font: italic 800 20px/1 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: background 0.08s, transform 0.08s;
}
.tpad svg { width: 46%; height: 46%; fill: var(--ink); }
.tpad.on { background: rgba(251, 240, 220, 0.9); transform: translateY(2px) scale(0.97); box-shadow: 0 1px 0 rgba(58, 42, 31, 0.22); }
.tpad.steer { bottom: var(--tb); width: calc(var(--tp) * 1.08); height: calc(var(--tp) * 1.08); }
.tpad[data-act='left'] { left: calc(max(var(--gutter), env(safe-area-inset-left, 0px)) + 6px); }
.tpad[data-act='right'] { left: calc(max(var(--gutter), env(safe-area-inset-left, 0px)) + 6px + var(--tp) * 1.08 + 16px); }
.tcol { position: absolute; right: calc(max(var(--gutter), env(safe-area-inset-right, 0px)) + 6px); bottom: var(--tb); display: flex; flex-direction: column; gap: 12px; }
.tcol .tpad { position: relative; }
.tpad.gas { height: calc(var(--tp) * 1.45); }
.tpad.hb { height: calc(var(--tp) * 0.62); font-size: 13px; }
.tpad.brake { right: calc(max(var(--gutter), env(safe-area-inset-right, 0px)) + 6px + var(--tp) + 16px); bottom: var(--tb); height: calc(var(--tp) * 1.1); font-size: 17px; }
.tbtns { position: absolute; top: calc(var(--gutter) + env(safe-area-inset-top, 0px)); right: calc(max(var(--gutter), env(safe-area-inset-right, 0px))); display: flex; gap: 8px; pointer-events: auto; }
.tbtns button { width: 44px; height: 44px; padding: 0; border-radius: 12px; background: var(--glass); touch-action: manipulation; }
.tbtns svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* The HUD around the pads: notes stay up top, the dash between the thumbs, the right-hand
   panels under the buttons, no key hints; notches kept clear on both sides. */
body.using-touch .hint { display: none; }
body.using-touch .timing { left: max(var(--gutter), env(safe-area-inset-left, 0px)); }
body.using-touch .notes { top: calc(var(--gutter) + clamp(24px, 6vh, 64px) + env(safe-area-inset-top, 0px)); bottom: auto; max-width: calc(100% - 420px); }
body.using-touch .progress, body.using-touch .sky { top: calc(var(--gutter) + 52px + env(safe-area-inset-top, 0px)); right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
body.using-touch .rv-box { top: calc(var(--gutter) + 118px + env(safe-area-inset-top, 0px)); }
body.using-touch .rv-split { top: calc(var(--gutter) + 230px + env(safe-area-inset-top, 0px)); }
body.using-touch .dash { right: auto; left: 50%; transform: translateX(-50%) scale(0.78); transform-origin: bottom center; }
body.using-touch .sky kbd { display: none; }
@media (max-height: 500px) {
  body.using-touch .clock { font-size: 34px; }
  body.using-touch .splits { display: none; }
  body.using-touch .rv-split { display: none; }
}
@media (max-width: 700px) {
  body.using-touch .dash { transform: translateX(-50%) scale(0.62); }
  body.using-touch .notes { max-width: calc(100% - 340px); }
}

/* A phone held upright: turn it (watch mode watches fine upright). */
#rotate { display: none; z-index: 900; background: rgba(58, 42, 31, 0.72); padding-bottom: var(--gutter); }
@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
  body:not(.watching) #rotate { display: grid; }
}
