/* Cards: the stage card (with its tabs), the garage, pause, results and
   Settings. Co-driver notebook pages on a warm haze, all built from the same
   parts: eyebrow, title and meta at the top; one big ember button (.go) for
   the thing you most likely want; quieter buttons with icons in a .row; chips
   for switches; a dashed rule before the foot. */

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  /* The foot leaves room for the legend bar. */
  padding: max(var(--gutter), env(safe-area-inset-top, 0px)) var(--gutter) calc(64px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(ellipse at center, rgba(92, 58, 34, 0.12), var(--haze));
  overflow-y: auto;
}
#loading { background: #f0d2a6; }
.loading-note { font-family: var(--display); font-style: italic; font-weight: 700; font-size: 28px; color: var(--ink-soft); animation: breathe 1.4s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: 0.45; } to { opacity: 1; } }

.brand {
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  left: calc(var(--gutter) + 4px);
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 30px;
  color: var(--paper);
  text-shadow: 0 2px 0 var(--ink);
  letter-spacing: 0.01em;
}

/* ---------- The focus and the legend bar (src/ui/focus.js) ---------- */
/* One focus for keys, pad and mouse: an ink ring with paper between, lifted a little. */
.focus { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink) !important; transform: translateY(-2px); position: relative; z-index: 1; }
label.switch.focus, select.focus, input.focus { border-radius: 8px; }
/* The confirm key, only on the focused control. */
.ok-glyph { margin-left: 2px; font-style: normal; text-transform: none; letter-spacing: 0; font-size: 13px; }
button.go .ok-glyph { background: var(--paper); color: var(--ink); border-color: var(--paper); border-bottom-width: 1.5px; }
/* Controller buttons are round, keys are keycaps. */
body.using-pad kbd { border-radius: 999px; border-bottom-width: 1.5px; padding-inline: 0.5em; }
.keybar {
  position: fixed;
  z-index: 4;
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 2 * var(--gutter));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 16px;
  padding: 8px 16px;
  border-radius: 22px;
  background: rgba(58, 42, 31, 0.84);
  color: var(--paper);
  font-weight: 800;
  font-size: 13px;
  pointer-events: none;
}
.keybar span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.keybar kbd { font-size: 12px; background: var(--paper); color: var(--ink); border-color: var(--paper); border-bottom-width: 1.5px; }
.keybar kbd + kbd { margin-left: -2px; }
.arw { width: 0.85em; height: 0.85em; fill: currentColor; vertical-align: -0.08em; }

/* Round icon buttons, top right of the screen: settings, fullscreen. */
.corner {
  position: fixed;
  top: calc(var(--gutter) + env(safe-area-inset-top, 0px));
  right: var(--gutter);
  z-index: 3;
  display: flex;
  gap: 8px;
}
.icon-btn { width: 42px; height: 42px; padding: 0; flex: none; }
.corner .icon-btn { background: var(--glass); }
/* The paddock's credit line, bottom right (the legend has the left): who made it, feedback, tips. */
.credit { position: fixed; z-index: 3; right: var(--gutter); bottom: calc(var(--gutter) + 4px + env(safe-area-inset-bottom, 0px)); margin: 0; font-size: 12px; font-weight: 800; color: var(--paper); opacity: 0.8; text-shadow: 0 1px 3px rgba(40, 26, 16, 0.7); }
.credit a { color: inherit; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.credit { display: flex; align-items: center; gap: 0 5px; opacity: 1; }
.credit > :not(.tip) { opacity: 0.8; }
/* The tip jar: a small ember pill, so it reads as a button and not one more word in the line. */
.tip { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--ember); color: var(--paper) !important; font: italic 800 15px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none !important; text-shadow: none; box-shadow: 0 3px 0 #a9461f; white-space: nowrap; transition: transform 0.12s var(--ease, ease); }
.tip:hover { background: #c95324; transform: translateY(-1px); }
.tip:active { transform: translateY(2px); box-shadow: 0 1px 0 #a9461f; }
.tip .ico { width: 17px; height: 17px; }
.tip-corner { display: none; margin: 0; align-self: flex-start; height: 42px; padding: 0 14px 0 12px; font-size: 16px; }
/* The pause card keeps its fullscreen button inside (the HUD has the screen's corners). */
.card-corner { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; }
.card-corner svg { width: 20px; height: 20px; }
.icon-btn svg, .ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ico { width: 18px; height: 18px; }
svg .pip { fill: currentColor; stroke: none; }

/* ---------- The card ---------- */
.card {
  position: relative;
  width: min(680px, 100%);
  padding: 26px 28px 22px;
  background: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 27px, rgba(122, 100, 80, 0.1) 27px 28px);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(58, 42, 31, 0.25), 0 24px 60px rgba(58, 42, 31, 0.3);
  border-left: 10px solid var(--ember);
}
.card.narrow { width: min(440px, 100%); }
.brand .early { display: block; font-family: var(--body, inherit); font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; text-shadow: none; color: var(--paper); opacity: 0.85; margin-top: 2px; }
/* Gamepad recommended, until a controller has been used this session (menu.js: pad-seen). */
.brand .pad-rec .ico { width: 15px; height: 15px; margin: -3px 4px 0 0; vertical-align: middle; stroke-width: 2.2; }
body.pad-seen .brand .pad-rec { display: none; }
.pad-note a { color: var(--ember); }
.pad-note b { color: var(--ink); font-weight: 800; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ember); }
.card h1 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(40px, 8vw, 62px);
  line-height: 0.95;
  margin: 0;
  text-wrap: balance;
}
.card .title { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 36px; line-height: 1; margin: 4px 0 6px; text-wrap: balance; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-weight: 800; font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.meta:empty { display: none; }

/* The big ember button: start, resume, retry, done. */
button.go {
  font: italic 800 23px/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ember);
  padding: 14px 22px 13px;
  border-radius: 12px;
  box-shadow: 0 4px 0 #a9461f;
  gap: 12px;
}
button.go:hover { background: #c95324; }button.go:active { transform: translateY(3px); box-shadow: 0 1px 0 #a9461f; }
button.go kbd { font-style: normal; text-transform: none; letter-spacing: 0; font-size: 13px; background: rgba(251, 240, 220, 0.2); color: var(--paper); border-color: rgba(251, 240, 220, 0.6); }
button.go.small { font-size: 18px; padding: 10px 16px 9px; }

/* Under the big button: the quieter ones, side by side. */

/* The foot of a card, after a dashed rule. */
.card-foot {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px dashed var(--paper-2);
}
.card-foot .go { min-width: 230px; }

/* Switches: dark when on. */
.chip { font-size: 13px; padding: 6px 11px; border-radius: 999px; gap: 7px; box-shadow: 0 2px 0 rgba(58, 42, 31, 0.2); color: var(--ink-soft); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.chip[aria-pressed='true']:hover { background: #4d3a2c; }
.chip[aria-pressed='true'] kbd { background: transparent; color: var(--paper); border-color: rgba(251, 240, 220, 0.6); }
/* A row of switches after a dashed rule (the pause card's quick switches). */
.toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--paper-2); }
.toggles-title { width: 100%; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- Side screens: a back button, then the card's own parts ---------- */
.side-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.side-head .title { margin: 0; }
.back-btn { flex: none; padding: 8px 14px 8px 9px; border-radius: 999px; font-size: 14px; gap: 4px; }
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Lists of actions (pause, results): a row each, the focused one ember. */
.items { display: grid; gap: 4px; margin-top: 16px; }
.item { width: 100%; height: 50px; justify-content: flex-start; gap: 14px; padding: 0 16px; font-size: 17px; text-align: left; background: transparent; box-shadow: none; border-radius: 12px; }
.item:hover { background: var(--paper-2); }
.item .ico { width: 22px; height: 22px; }
.ico.fill { fill: currentColor; stroke: none; }
.item > span { flex: 1; }
.item kbd { flex: none; }
.item.focus { background: #c2501f; color: #fff8ec; }
.item.focus kbd:not(.ok-glyph) { display: none; }
.item small { flex: none; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.item.focus small { color: #ffe9d4; }
.item.focus small + .ok-glyph { margin-left: 4px; }
/* What Share result copies, under it. */
/* The first action is the way on: a touch bigger. Share sits apart, under a rule. */
.item.lead { height: 56px; font-size: 18px; }
.items-aside { display: grid; gap: 4px; margin-top: 6px; padding-top: 8px; border-top: 2px dashed var(--paper-2); }
.share-line { margin: 0 0 4px 52px; padding: 7px 11px; border-radius: 8px; background: var(--paper-2); font: 700 12.5px/1.4 ui-monospace, Consolas, monospace; color: var(--ink-soft); user-select: all; }
.item .ok-glyph { background: var(--paper); color: var(--ink); border-color: var(--paper); border-bottom-width: 1.5px; }

/* ---------- The hub: one panel, always in the same place ----------
   The panel sits left of centre at a fixed size; Home and every mode's entry fill it with the
   same parts, so the press that opens and the button that drives are always where you expect.
   The garage, logbook and Settings open in the same frame (same left edge, same height). */
:root {
  --panel-w: min(440px, calc(100vw - 2 * var(--gutter)));
  --panel-h: min(600px, calc(100vh - 150px));
  --panel-x: calc(var(--gutter) + 16px);
}
#menu.hub, #garage, #logbook, #settings {
  place-items: center start;
  padding-left: var(--panel-x);
  padding-top: calc(var(--gutter) + 46px + env(safe-area-inset-top, 0px)); /* room for the brand above the panel */
  background: linear-gradient(90deg, rgba(40, 26, 16, 0.38), rgba(40, 26, 16, 0.1) 40%, transparent 60%);
}
.frame { position: relative; }
.frame .brand { position: absolute; top: auto; left: 4px; bottom: calc(100% + 10px); }
.sheet { width: var(--panel-w); height: var(--panel-h); box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; padding: 20px 22px 18px; }
.page { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.page[hidden] { display: none; }
.page.turn.fwd { animation: page-fwd 0.26s var(--ease, ease-out) backwards; }
.page.turn.back { animation: page-back 0.26s var(--ease, ease-out) backwards; }
@keyframes page-fwd { from { opacity: 0; transform: translateX(16px); } }
@keyframes page-back { from { opacity: 0; transform: translateX(-16px); } }
/* Home: where you can go, one entry per row, each a title, a line, a chevron. */
.mi-group { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.mi { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 8px 44px 8px 16px; border-radius: 12px; background: transparent; box-shadow: none; text-align: left; color: var(--ink); }
.mi::after { content: '\203A'; position: absolute; right: 16px; top: 50%; transform: translateY(-52%); font: 800 30px/1 var(--display); color: #c9ad88; }
.mi:hover { background: rgba(242, 223, 191, 0.55); }
.mi-title { display: flex; align-items: center; gap: 8px; font: italic 800 28px/1 var(--display); }
.mi-sub { min-height: 1.3em; font-size: 13px; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mi-sub b { color: var(--ember); }
.mi .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ember); }
.mi.focus { background: var(--paper-2); box-shadow: inset 5px 0 0 var(--ember) !important; transform: none; }
.mi.focus::after { border-color: var(--ember); }
.mi .ok-glyph { position: absolute; right: 44px; top: 50%; margin: -11px 0 0; }
.mi-group.minor { margin-top: auto; padding-top: 10px; border-top: 2px dashed var(--paper-2); gap: 0; }
.minor .mi { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.minor .mi-title { font-size: 21px; }
.minor .mi-sub { display: flex; align-items: center; gap: 6px; min-height: 0; font-size: 12px; white-space: nowrap; overflow: hidden; }
.mi .mini-swatch { width: 18px; height: 11px; border-radius: 3px; border-width: 1.5px; flex: none; }
/* An entry: back, the title and its map, one selector, what you've done here, the big button. */
.crumb { align-self: flex-start; margin: -4px 0 8px -8px; padding: 6px 10px 6px 6px; border-radius: 8px; background: transparent; box-shadow: none; font-size: 13px; font-weight: 800; letter-spacing: 0.02em; color: var(--ink-soft); }
.crumb:hover { background: var(--paper-2); color: var(--ink); }
.crumb.focus { background: var(--paper-2); color: var(--ink); box-shadow: inset 4px 0 0 var(--ember) !important; transform: none; }
.crumb .ok-glyph { display: none; }
.detail-head { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 14px; align-items: start; }
.detail-title { min-width: 0; }
.detail-title .eyebrow { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-title h1 { margin: 4px 0 6px; font-size: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: nowrap; }
.detail-head .stage-map svg { width: 118px; height: 83px; }
.selector { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; margin-top: 14px; padding: 6px; border-radius: 14px; background: var(--paper-2); }
.selector.fixed .sel-arrow { visibility: hidden; }
.sel-arrow { width: 44px; height: 44px; padding: 0; border-radius: 10px; background: var(--paper); }
.sel-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.sel-arrow .ok-glyph { display: none; }
.sel-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.sel-mid b { font: italic 800 22px/1.05 var(--display); }
.sel-mid small { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; font-weight: 800; color: var(--ink-soft); }
/* 4 px of room all round inside the clip, so focus rings (the current stage's pip) aren't cut;
   it scrolls (no bar) when a short window makes the panel shorter than what's in it. */
.info { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; margin: 2px -4px 0; padding: 4px; }
.info::-webkit-scrollbar { display: none; }
.info .best-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 2px; border-bottom: 1px solid var(--paper-2); }
.info .best-line b { margin: 0; font-size: 21px; }
.info .medals, .info .daily-line { margin: 0; padding: 8px 2px; border-bottom: 1px solid var(--paper-2); }
.info .blurb { margin: 8px 2px 0; }
.pips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.pips[hidden] { display: none; }
#m-board:not([hidden]) ~ .pips { margin-top: 8px; }
.spip { width: 17px; height: 17px; box-sizing: border-box; border-radius: 50%; border: 2.5px solid #c9ad88; cursor: pointer; }
.spip.driven { background: #e6cfa8; }
.spip.platinum { background: #8fc3cf; border-color: #8fc3cf; }
.spip.gold { background: #d9a521; border-color: #d9a521; }
.spip.silver { background: #a3a3a8; border-color: #a3a3a8; }
.spip.bronze { background: #b8733d; border-color: #b8733d; }
.spip.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.seed-row { display: flex; gap: 8px; margin-top: 12px; }
.seed-row[hidden] { display: none; }
.seed-row input { flex: 1; min-width: 0; font: 700 14px var(--body); padding: 8px 10px; border-radius: 8px; border: 2px solid var(--paper-2); background: #fffaf1; color: var(--ink); }
.hub-go { display: flex; width: 100%; justify-content: center; margin-top: 12px; }
.entry-foot { display: flex; gap: 8px; min-height: 40px; margin-top: 10px; }
.entry-foot button { flex: 1; font-size: 14px; padding: 9px 12px; gap: 8px; }
.entry-foot button[hidden] { display: none; }
.ico.dice { width: 20px; height: 20px; }
/* Rivals' card: the field as a row of chips, and a hairline that fills as it drives the stage
   (ember, then moss when ready). */
.rv-field { position: relative; list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 2px dashed var(--paper-2); display: flex; flex-wrap: wrap; gap: 6px; }
.rv-field::before { content: ''; position: absolute; left: 0; right: 0; top: -2px; height: 2px; background: var(--ember); transform-origin: left center; transform: scaleX(var(--ready, 0)); transition: transform 0.4s linear, background 0.3s; }
.rv-field.ready::before { background: var(--moss); }
.rv-field li { display: flex; align-items: center; gap: 4px; padding: 3px 7px 3px 6px; border-radius: 999px; background: var(--paper-2); font-size: 12px; }
.rv-field { gap: 5px; }
.rv-field li b { font-weight: 800; }
/* A mode loading under its card: the card stays, its details fade. */
#hub-detail > * { transition: opacity 0.25s; }
#menu.busy #hub-detail > :not(.crumb):not(.hub-go):not(.selector) { opacity: 0.4; transition-duration: 0.1s; }

.blurb { margin: 10px 0 0; font-weight: 700; font-size: 14px; color: var(--ink-soft); max-width: 34em; }
.stage-map { margin: 0; display: grid; gap: 6px; justify-items: center; }
.stage-map svg { width: 200px; height: 140px; display: block; background: #fffaf1; border-radius: 10px; border: 2px solid var(--paper-2); }
.stage-map .route-shadow { fill: none; stroke: rgba(58, 42, 31, 0.15); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.stage-map .route { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.stage-map .split { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.stage-map .start { fill: var(--moss); stroke: var(--paper); stroke-width: 2; }
.stage-map .finish { fill: var(--ember); stroke: var(--paper); stroke-width: 2; }
.stage-map .crowd { fill: var(--ember); opacity: 0.55; }
.share { font-size: 12.5px; padding: 6px 12px; }
.best-line { margin-top: 12px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.best-line b { font-family: var(--display); font-style: italic; font-size: 24px; color: var(--ink); margin-left: 6px; font-variant-numeric: tabular-nums; }
.daily-line { margin-top: 6px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.daily-line b { color: var(--ember); }
/* Medal times: a ring per medal, filled once your best has won it. */
.medals { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-weight: 800; font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.medal { display: inline-flex; align-items: center; gap: 6px; }
.medal i { width: 13px; height: 13px; box-sizing: border-box; border-radius: 50%; border: 2.5px solid var(--medal); }
.medal.won { color: var(--ink); }
.medal.won i { background: var(--medal); box-shadow: inset 0 -2px 0 rgba(58, 42, 31, 0.22); }
.medal.platinum { --medal: #8fc3cf; }
.medal.gold { --medal: #d9a521; }
.medal.silver { --medal: #a3a3a8; }
.medal.bronze { --medal: #b8733d; }

.mini-swatch { width: 46px; height: 30px; border-radius: 8px; border: 2px solid rgba(58, 42, 31, 0.3); flex: none; }

/* ---------- Garage: the car up close on the left, its paint card on the right ---------- */
.garage-card { width: var(--panel-w); height: var(--panel-h); box-sizing: border-box; overflow-y: auto; }
.car-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.car-pick { display: grid; justify-items: start; gap: 2px; padding: 9px 11px; border-radius: 12px; background: var(--paper); border: 2px solid var(--paper-2); text-align: left; box-shadow: 0 3px 0 rgba(58, 42, 31, 0.18); }
.car-pick:hover { background: #fffaf1; }
.car-pick[aria-checked='true'] { border-color: var(--ember); background: #f6e3c4; }
.car-pick .car-tag { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.car-pick[aria-checked='true'] .car-tag { color: var(--ember); }
.car-pick strong { font: italic 800 22px/1.05 var(--display); color: var(--ink); }
.car-blurb { margin: 8px 0 10px; padding-bottom: 10px; border-bottom: 2px dashed var(--paper-2); font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--ink-soft); }
.garage-name { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.garage-name .title { font-size: 40px; margin: 2px 0 10px; }
.num { font: italic 800 28px/1 var(--display); color: var(--ink-soft); }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.swatch { display: grid; justify-items: start; gap: 7px; padding: 9px; border-radius: 12px; background: var(--paper); border: 2px solid var(--paper-2); font-size: 12.5px; text-align: left; box-shadow: 0 3px 0 rgba(58, 42, 31, 0.18); }
.swatch:hover { background: #fffaf1; }
.swatch[aria-checked='true'] { border-color: var(--ember); background: #f6e3c4; }
.paint-chip { width: 100%; height: 34px; border-radius: 8px; border: 2px solid rgba(58, 42, 31, 0.25); }
.garage-note { margin: 14px 0 0; padding-top: 12px; border-top: 2px dashed var(--paper-2); font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.garage-note b { color: var(--ink); }
.garage-foot { display: flex; gap: 10px; margin-top: 14px; }
.garage-foot .go { flex: 1; }
.just-kept { animation: kept-pop 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes kept-pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.keys-line { margin: 14px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.keys-line kbd { font-size: 13px; }

/* ---------- Logbook: stages you've finished, totals beside them ---------- */
#logbook .card { width: var(--panel-w); height: var(--panel-h); box-sizing: border-box; overflow-y: auto; scrollbar-width: thin; }
#logbook .lb-body { grid-template-columns: minmax(0, 1fr); }
.lb-body { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 18px; margin-top: 10px; }
.lb-sorts { display: flex; gap: 6px; margin-bottom: 8px; }
.lb-list { list-style: none; margin: 0; padding: 0 4px 4px 0; max-height: min(52vh, 420px); overflow-y: auto; display: grid; gap: 6px; }
.lb-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-align: left; box-shadow: 0 2px 0 rgba(58, 42, 31, 0.18); }
.lb-row .medal i { width: 18px; height: 18px; border-width: 3px; }
.medal.none { --medal: rgba(58, 42, 31, 0.25); }
.lb-name, .lb-time { display: grid; line-height: 1.2; min-width: 0; }
.lb-name b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name small, .lb-time small { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.lb-time { text-align: right; font-variant-numeric: tabular-nums; }
.lb-time > b { font-family: var(--display); font-style: italic; font-size: 20px; }
.lb-time small b { color: var(--ink); }
.lb-empty { font-weight: 700; color: var(--ink-soft); padding: 18px 4px; }
.lb-stats { display: grid; align-content: start; gap: 12px; padding-left: 16px; border-left: 2px dashed var(--paper-2); }
.lb-stat { display: grid; gap: 2px; }
.lb-stat small { font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.lb-stat > b { font-family: var(--display); font-style: italic; font-size: 24px; font-variant-numeric: tabular-nums; }
.lb-stat > b small { font: 700 12px/1 var(--body, inherit); letter-spacing: 0; text-transform: none; }
.lb-medals { display: flex; flex-wrap: wrap; gap: 4px 12px; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }

/* The welcome card: keys beside the pace-note words. */
#welcome .card { width: min(780px, 100%); }
#welcome .cols { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); margin-top: 16px; }
.legend dt { font-weight: 800; color: var(--ember); }
/* What to do with the numbers, before what the words mean. */
/* The welcome card's pace-note key: the HUD's note cards (notesUI.js), smaller and all at full strength. */
.notekey .note { opacity: 1; scale: 1; gap: 6px; padding: 6px 11px 6px 8px; background-color: #fffaf1; color: var(--ink); box-shadow: 0 0 0 1px rgba(122, 100, 80, 0.16), 0 3px 0 rgba(58, 42, 31, 0.16); }
.notekey .note .glyph { width: 34px; height: 34px; }
.notekey .note .sev { font-size: 31px; }
.notekey .note-jump .sev { font-size: 20px; }
.notekey .note .dir { font-size: 9px; }
.notekey .note .mods { font-size: 10.5px; }
.notekey .note .link { font-size: 10px; right: -8px; bottom: -8px; }
.nk-sev { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.nk-sev figure { margin: 0; display: grid; justify-items: center; align-content: start; gap: 7px; }
.nk-sev figcaption { font-size: 12px; font-weight: 800; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.controls.notekey dl { gap: 20px 16px; }
.notekey dt { justify-self: start; }
.notekey dd { font-weight: 600; }
.notekey dd b, .notekey .pad-note b { color: var(--ember); }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--paper-2); }
.cols h2 { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px; }
.controls-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.controls-head h2 { margin: 0; }
.reset-binds { font-size: 11.5px; padding: 3px 9px; border-radius: 6px; box-shadow: 0 1px 0 rgba(58, 42, 31, 0.2); }
.bind-list { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 6px; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.bind-head { display: contents; }
.bind-head span { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); text-align: center; padding-bottom: 2px; }
.bind-btn { font-size: 12px; font-weight: 800; padding: 4px 8px; min-width: 58px; border-radius: 6px; background: #fffaf1; border: 1.5px solid var(--paper-2); box-shadow: 0 1px 0 rgba(58, 42, 31, 0.18); }
.bind-btn.pad { background: var(--paper-2); }
.bind-btn.listening { background: var(--ember); color: var(--paper); border-color: var(--ember); }
.controls dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; font-weight: 600; align-items: center; }
.controls dt { white-space: nowrap; }
.controls dd { margin: 0; min-width: 0; }
.pad-note { font-size: 13px; color: var(--ink-soft); margin: 12px 0 0; font-weight: 600; }
.seed-row { display: flex; gap: 8px; }

/* ---------- Settings: pages of rows, over the card it was opened from ---------- */
.settings-card { width: var(--panel-w); height: var(--panel-h); box-sizing: border-box; overflow-y: auto; scrollbar-width: thin; }
#settings .sbody { grid-template-columns: minmax(0, 1fr) !important; }
#settings .stabs { display: flex; flex-wrap: wrap; border-radius: 16px; }
.stabs { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow-x: auto; padding: 5px; border-radius: 26px; background: var(--paper-2); margin-bottom: 14px; }
.stabs > kbd { flex: none; margin: 0 6px; }
.stab { flex: none; height: 38px; padding: 0 16px; border-radius: 19px; background: transparent; box-shadow: none; font-size: 15px; color: var(--ink-soft); }
.stab:hover { background: rgba(251, 240, 220, 0.7); }
.stab[aria-selected='true'] { background: var(--ink); color: var(--paper); }
.sbody { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; align-items: start; }
#settings[data-page='controls'] .sbody, #settings[data-page='howto'] .sbody { grid-template-columns: minmax(0, 1fr); }
.spage .cols { margin-top: 0; padding-top: 0; border-top: 0; }
.srows { display: grid; gap: 2px; }
.srow { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 260px); align-items: center; gap: 12px; height: 46px; padding: 0 12px 0 16px; border-radius: 11px; background: transparent; box-shadow: none; font-size: 15px; font-weight: 800; text-align: left; cursor: pointer; }
.srow:hover { background: rgba(242, 223, 191, 0.55); }
.srow.action { grid-template-columns: minmax(0, 1fr); }
.srow.focus { background: #f6e3c4; }
.srow-val { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.srow-val .v { flex: 1; text-align: center; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .ar { flex: none; width: 18px; font-style: normal; font-size: 22px; line-height: 1; text-align: center; color: #c9ad88; cursor: pointer; }
.srow.focus .ar { color: var(--ember); }
.srow.fixed .ar { visibility: hidden; }
.bar { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--paper-2); cursor: pointer; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--ember); }
.pct { width: 38px; text-align: right; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.shelp { display: grid; gap: 8px; padding: 18px; border-radius: 14px; background: var(--paper-2); }
#shelp-value { font: italic 800 30px/1 var(--display); }
#shelp-value:empty { display: none; }
#shelp-text { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 700; color: var(--ink-soft); }
.settings-foot { margin-top: 14px; padding-top: 12px; border-top: 2px dashed var(--paper-2); }
.controls-head button { font-size: 13px; padding: 6px 11px; }

/* ---------- Results: the time and the actions on the left, the splits on the right ---------- */
.results-card { width: min(860px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; }
.results-splits { padding-left: 24px; border-left: 2px dashed var(--paper-2); }
#results.no-splits:not(.has-board) .results-card { grid-template-columns: minmax(0, 1fr); width: min(560px, 100%); }
#results.no-splits:not(.has-board) .results-splits { display: none; }
#results.has-board .results-card { grid-template-columns: minmax(0, 1fr) 290px; }
.r-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.r-tags > * { margin: 0; }
.final { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 76px; line-height: 1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stamp {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border: 2.5px solid var(--moss);
  color: var(--moss);
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}
.delta { font-weight: 800; font-size: 15px; margin-top: 8px; color: var(--ink-soft); }
.delta.good { color: var(--moss); }
.delta.bad { color: var(--brick); }
.medal-line { font-weight: 800; font-size: 15px; margin-top: 6px; color: var(--ink-soft); }
.medal-line .medal { text-transform: uppercase; letter-spacing: 0.1em; }
.medal-line b { color: var(--ink); }
.pen { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.r-splits { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.r-splits:empty { display: none; }
.r-splits li { display: grid; grid-template-columns: 1fr auto 64px; gap: 10px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.r-splits b { font-family: var(--display); font-style: italic; font-size: 19px; }
.r-splits i { font-style: normal; text-align: right; }
/* The leaderboard under the splits: a timing sheet of door plates, yours picked out. */
.r-board { margin-top: 18px; }
#r-splits-box[hidden] + .r-board { margin-top: 0; }
/* On the paddock's entry it has to fit beside the best time and medals: tighter rows, and
   your place and plate share a line. */
.m-board { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; margin: 4px 0 0; padding-top: 4px; border-top: 2px dashed var(--paper-2); }
.m-board > .board-title, .m-board > .r-board-rows, .m-board > .plate-edit { grid-column: 1 / -1; }
.m-board .r-board-rows { margin-top: 2px; gap: 1px; }
.m-board .r-board-rows li.gap { line-height: 0.6; }
.m-board .r-board-rows li { padding: 0 6px; font-size: 13px; line-height: 1.35; }
.m-board .r-board-rows b { font-size: 14px; }
.m-board .r-board-note { margin: 2px 0 0; }
.m-board .plate-btn { margin-top: 4px; padding: 4px 9px; }
/* A short window (itch.io's 720 px frame): the top three to aim for before you've a time, then
   the leader and your row; a very short one: just your place and plate. */
@media (max-height: 749px) {
  .m-board .r-board-rows:has(li.me) li:not(:first-child):not(.me):not(.gap) { display: none; }
}
@media (max-height: 599px) {
  .m-board .r-board-rows { display: none; }
}
.r-board-rows { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 3px; }
.r-board-rows li { display: grid; grid-template-columns: 22px 18px 1fr auto auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.r-board-rows li.me { background: var(--paper-2); box-shadow: inset 4px 0 0 var(--ember); }
.r-board-rows li.gap { display: block; padding: 0 6px; line-height: 0.8; color: var(--ink-soft); }
.r-board-rows .rk { text-align: right; color: var(--ink-soft); }
.r-board-rows .chip-paint { width: 18px; height: 12px; border-radius: 3px; border: 1.5px solid rgba(58, 42, 31, 0.3); }
.r-board-rows .pl { font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: 0.04em; }
.r-board-rows .cb { font-size: 11px; color: var(--ink-soft); }
.r-board-rows b { font-family: var(--display); font-style: italic; font-size: 16px; }
.r-board-note { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.r-board-note:empty { display: none; }
.plate-btn { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; padding: 6px 10px; border-radius: 8px; background: var(--paper); font-size: 13px; }
.plate { font: 800 15px/1 ui-monospace, Consolas, monospace; letter-spacing: 0.06em; color: var(--ink); }
.plate-btn small { color: var(--ink-soft); font-weight: 700; }
.plate-edit { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.plate-edit > .plate-hint, .plate-edit > .plate-msg { flex-basis: 100%; }
.pslots { display: flex; gap: 6px; }
.pslots { align-items: center; }
.pslot { box-sizing: border-box; width: 40px; height: 46px; padding: 0; border: 2px solid var(--paper-2); border-radius: 8px; background: var(--paper); font: 800 22px/1 ui-monospace, Consolas, monospace; color: var(--ink); text-align: center; text-transform: uppercase; caret-color: var(--ember); outline: none; }
.pslot.pnum { width: 52px; }
.pslot:focus { border-color: var(--ember); }
.pslot.focus { background: var(--ink); color: var(--paper); }
.phash { margin-left: 6px; font: 800 20px/1 ui-monospace, Consolas, monospace; color: var(--ink-soft); }
.plate-hint { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
body.using-pad .plate-hint { display: none; }
.pacts { display: flex; gap: 8px; }
.pacts .done { background: var(--ember); color: #fff8ec; }
/* No confirm badge inside the editor (the legend has it): it widened Roll or Done under the
   mouse and wrapped them onto the next line, away from the pointer. */
.plate-edit .ok-glyph { display: none; }
.plate-msg { margin: 0; font-size: 13px; font-weight: 700; color: var(--brick); }
.plate-msg:empty { display: none; }

@media (max-width: 620px) {
  .detail-head { grid-template-columns: 1fr; }
  .stage-map { justify-items: start; }
}
@media (max-width: 820px) {
  .cols, #welcome .cols { grid-template-columns: 1fr; }
  .nk-sev { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .sbody { grid-template-columns: minmax(0, 1fr); }
  .shelp { display: none; }
  .results-card, #results.has-board .results-card { grid-template-columns: minmax(0, 1fr); }
  .results-splits { padding-left: 0; border-left: 0; }
}
@media (max-height: 700px) {
  .final { font-size: 60px; }
  .item { height: 44px; }
  .srow { height: 40px; }
}
@media (max-width: 520px) {
  .card { padding: 20px 18px; }
  .card-foot { flex-direction: column; align-items: stretch; }
  .card-foot .go { min-width: 0; }
  .swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lb-body { grid-template-columns: 1fr; }
  .lb-stats { order: -1; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0 0 10px; border-left: 0; border-bottom: 2px dashed var(--paper-2); }
  .lb-stat > b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-note { animation: none; }
}

/* Rivals on the results card: your place is the headline, the time under it. */
.r-place { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; margin: 6px 0 2px; animation: r-stamp 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
.r-place .p { font: italic 800 72px/0.9 var(--display); color: var(--ink); }
.r-place .of { font: italic 800 26px/1 var(--display); color: var(--ink-soft); }
.r-place .w { display: flex; flex-direction: column; margin-left: 6px; font: italic 800 24px/1.1 var(--display); color: var(--ink); }
.r-place .w small { font: 700 14px/1.3 var(--body, inherit); font-style: normal; color: var(--ink-soft); }
.r-place .w small b { color: var(--ink); }
.r-place.podium .p { color: var(--ember); }
.r-place.won .p { color: var(--moss); }
#results.rivals .final { font-size: 34px; }
@keyframes r-stamp { from { transform: scale(1.18); opacity: 0; } }



/* ---------- Motion: one easing for every screen change ----------
   Cards rise in as their overlay opens, the rail's tiles follow one after another, the selected
   mode's card settles when the mode changes, the results line up in turn. Only 'backwards' fill,
   so the focus ring's own lift still applies once a card is in. */
:root { --ease: cubic-bezier(0.22, 1, 0.36, 1); }
.overlay.enter:not([hidden]) { animation: ov-in 0.24s ease-out backwards; }
.overlay.enter:not([hidden]) > .card { animation: card-in 0.36s var(--ease) backwards; }
#loading:not([hidden]) { animation: none; }
#results.enter:not([hidden]) .results-main > * { animation: rise 0.34s var(--ease) backwards; }
#results.enter:not([hidden]) .results-main > :nth-child(n + 4) { animation-delay: 0.06s; }
#results.enter:not([hidden]) .results-main > :nth-child(n + 6) { animation-delay: 0.12s; }
#results.enter:not([hidden]) .results-main > .items { animation-delay: 0.18s; }
#results.enter:not([hidden]) .results-splits { animation: rise 0.34s var(--ease) 0.1s backwards; }
@keyframes ov-in { from { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .overlay.enter:not([hidden]), .overlay.enter:not([hidden]) > .card, #results.enter:not([hidden]) .results-main > *, #results.enter:not([hidden]) .results-splits, .page.turn { animation: none; }
}

/* Narrow screens: the panel takes the width and sits at the foot, the car above it. */
@media (max-width: 760px) {
  #menu.hub, #garage, #logbook, #settings { place-items: end center; padding-left: var(--gutter); }
  .frame .brand { display: none; }
  .credit { display: none; }
  .tip-corner { display: inline-flex; }
}

/* On the hub, the garage, the logbook and Settings the legend sits under the panel, on its edge. */
body[data-card='menu'] .keybar, body[data-card='garage'] .keybar, body[data-card='logbook'] .keybar, body[data-card='settings'] .keybar { left: var(--panel-x); right: auto; justify-content: flex-start; }
/* The garage in the panel's frame: compact enough to fit without scrolling. */
.garage-card { scrollbar-width: thin; }
.garage-name .title { font-size: 32px; }
.car-pick strong { font-size: 16px; white-space: nowrap; }

/* The garage's, logbook's and Settings' back buttons read like the entry's crumb. */
#garage .back-btn, #logbook .back-btn, #settings .back-btn { padding: 6px 10px 6px 6px; border-radius: 8px; background: transparent; box-shadow: none; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
#garage .back-btn.focus, #logbook .back-btn.focus, #settings .back-btn.focus { background: var(--paper-2); color: var(--ink); box-shadow: inset 4px 0 0 var(--ember) !important; transform: none; }
/* Settings in the panel's width: the value column narrower, the focus like a hub row. */
#settings .srow { grid-template-columns: minmax(0, 1fr) 150px; }
#settings .srow.action { grid-template-columns: minmax(0, 1fr); }
#settings .srow > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow.focus { background: var(--paper-2); box-shadow: inset 5px 0 0 var(--ember) !important; transform: none; }
/* The garage fits the panel's height: a column with Done at the foot, as the hub's big button. */
.garage-card { display: flex; flex-direction: column; overflow-y: auto; }
.garage-card .side-head { margin-bottom: 4px; }
.garage-card .car-pick { padding: 7px 10px; }
.garage-card .car-pick .car-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.garage-card .car-blurb { margin: 6px 0 6px; padding-bottom: 6px; font-size: 12.5px; }
.garage-card .garage-name .title { margin: 0 0 6px; }
.garage-card .swatches { gap: 8px; }
.garage-card .swatch { gap: 5px; padding: 7px; font-size: 12px; }
.garage-card .garage-note { display: none; }
.garage-card .garage-foot { margin-top: auto; padding-top: 10px; }

/* Short screens: Home's rows tighten so all eight fit; any page that still runs long scrolls. */
#hub-home { overflow-y: auto; scrollbar-width: none; }
#hub-home::-webkit-scrollbar { display: none; }
@media (max-height: 700px) {
  .mi { padding-top: 5px; padding-bottom: 5px; }
  .mi-title { font-size: 24px; }
  .mi-sub { font-size: 12px; }
  .minor .mi { padding-top: 5px; padding-bottom: 5px; }
  .minor .mi-title { font-size: 19px; }
  .detail-title h1 { font-size: 36px; }
  .detail-head .stage-map svg { width: 100px; height: 70px; }
  .frame .brand { font-size: 24px; }
}

/* Watch mode's Begin card (watch.js): small, up in the sky, Kite3 already driving below it
   (the chase camera keeps the car low); the whole card starts it, so it all looks pressable. */
#watch { cursor: pointer; place-items: start center; padding-top: max(28px, env(safe-area-inset-top, 0px)); background: linear-gradient(to bottom, rgba(58, 42, 31, 0.3), transparent 50%); }
.watch-card { width: min(500px, 100%); text-align: center; padding-top: 18px; padding-bottom: 16px; }
.watch-card .title { font-size: clamp(24px, 4.6vw, 32px); line-height: 1.05; }
.watch-card .blurb { margin: 8px auto 14px; max-width: 40ch; }
.watch-card button.go { width: 100%; font-size: 22px; padding: 16px 20px; }
.watch-card button.go:disabled { opacity: 0.6; }
.watch-note { margin: 10px 0 0; font: 700 14px var(--body); color: var(--ink-soft); }

/* A share button making its short link (inside itch.io's frame), then ready to copy (share.js). */
#btn-share.making::after, #btn-share-result.making span::after { content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 8px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: share-spin 0.8s linear infinite; }
#btn-share.ready, #btn-share-result.ready { background: var(--ember); color: #fff8ec; }
#btn-share-result.ready small { color: #ffe9d4; }
@keyframes share-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #btn-share.making::after, #btn-share-result.making span::after { animation: none; border-right-color: currentColor; opacity: 0.5; }
}

/* ---------- Touch (body.using-touch, input.js): fingers, not keys ---------- */
body:not(.using-touch) .touch-only, body.using-touch .no-touch { display: none !important; }
/* No key glyphs, confirm badge or legend bar; [data-kbd] ones name the touch pad instead (menu.js). */
body.using-touch kbd:not([data-kbd]), body.using-touch .keybar { display: none !important; }
body.using-touch .focus:not(.mi):not(.srow):not(.crumb):not(.back-btn):not(.pslot) { box-shadow: 0 3px 0 rgba(58, 42, 31, 0.25) !important; transform: none; }
body.using-touch .overlay { padding-bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px)); }
body.using-touch .brand .pad-rec { display: none; }
.tkey { display: inline-block; padding: 1px 8px; border-radius: 8px; border: 1.5px solid var(--ink-soft); font: italic 800 13px/1.4 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }

/* Phone landscape and other short screens: the panel takes the height (no brand above it), the
   cards scroll inside rather than off the page. */
@media (max-height: 500px) {
  :root { --panel-h: calc(100dvh - 2 * var(--gutter) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); --panel-x: calc(max(var(--gutter), env(safe-area-inset-left, 0px)) + 8px); }
  #menu.hub, #garage, #logbook, #settings { padding-top: calc(var(--gutter) + env(safe-area-inset-top, 0px)); padding-bottom: calc(var(--gutter) + env(safe-area-inset-bottom, 0px)); }
  .frame .brand { display: none; }
  .sheet { padding: 12px 18px 12px; }
  .crumb { margin-bottom: 2px; }
  .detail-title h1 { font-size: 30px; margin: 2px 0 2px; }
  .detail-head .stage-map svg { width: 86px; height: 60px; }
  .detail-head { grid-template-columns: minmax(0, 1fr) 86px; }
  .selector { margin-top: 6px; padding: 4px; }
  .sel-arrow { width: 40px; height: 40px; }
  .mi { padding-top: 3px; padding-bottom: 3px; }
  .mi-title { font-size: 21px; }
  .minor .mi { padding-top: 3px; padding-bottom: 3px; }
  .minor .mi-title { font-size: 17px; }
  .card:not(.sheet) { padding: 16px 20px 14px; max-height: calc(100dvh - 2 * var(--gutter)); overflow-y: auto; }
  .card .title { font-size: 28px; }
  .card h1 { font-size: 40px; }
  .item { height: 40px; }
  .final { font-size: 48px; }
  /* The welcome card scrolls; its buttons stay in reach at the foot. */
  #welcome .card-foot { position: sticky; bottom: -14px; z-index: 2; margin: 0 -20px -14px; padding: 10px 20px 14px; background: var(--paper); }
}
