/* ============================================================
   Timepass · shared.css
   Paper arcade: paper-cream + ink + pixel type, flat surfaces,
   thin 1px borders. No gradients, no shadows, no accent bars.
   ============================================================ */

/* ---------- Font ---------- */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/press-start-2p.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --canvas: #f3e5df;
  --ink: #111;
  --card: #faf7f0;
  --card-border: #111;
  --card-ink: #111;
  --muted: #737373;
  --muted-surface: #e7d8d1;
  --accent: #111;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --canvas: #0d0d0d;
  --ink: #f3e5df;
  --card: #f3e5df;
  --card-border: #111;
  --card-ink: #111;
  --muted: #737373;
  --muted-surface: #333;
  --accent: #f3e5df;
}

/* ---------- Reset + fixed shell ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ---------- Pixel type ---------- */
.px {
  font-family: 'Press Start 2P', system-ui, sans-serif;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ---------- Header ---------- */
header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  user-select: none;
  -webkit-user-select: none;
}

header .brand {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

header .wordmark {
  font-size: 16px;
  color: var(--ink);
}

header .subtitle {
  font-size: 12px;
  color: var(--muted);
}

header .toggles {
  display: flex;
  gap: 8px;
}

/* ---------- Icon buttons (theme / sound) ---------- */
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--card-ink);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 140ms ease, opacity 140ms ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.is-off {
  opacity: 0.45;
}

/* Back arrow inside #stage (result screen + game screens) */
.back-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  z-index: 2;
}

/* Core-owned restart control (core.js appends it on every game
   mount): the top-right mirror of the back arrow. */
.restart-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 2;
}

/* ---------- Hub grid (also the scroll area) ---------- */
#grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  /* Centered composition; `safe` keeps short viewports scrollable from
     the start. If a browser rejects the keyword the declaration drops
     and align-content stays `normal`, which behaves the same here. */
  align-content: safe center;
  gap: 9px;
  padding: 10px 16px 20px;
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
}

/* Themed scrollbar (the default UA bar clashes with the paper canvas).
   Chrome/Safari take the ::-webkit-* pseudos; the standard
   scrollbar-* properties are scoped to browsers WITHOUT the webkit
   pseudos (Firefox), because in Chrome setting scrollbar-color
   silently disables the pseudo styling. */
#grid::-webkit-scrollbar {
  width: 10px;
}

#grid::-webkit-scrollbar-track {
  background: transparent;
}

#grid::-webkit-scrollbar-thumb {
  background: var(--muted);
  border: 3px solid var(--canvas);
  border-radius: 8px;
}

#grid::-webkit-scrollbar-thumb:hover {
  background: var(--ink);
}

@supports not selector(::-webkit-scrollbar) {
  #grid {
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
  }
}

/* display:grid above would otherwise beat the UA [hidden] rule, leaving
   invisible cards focusable under the stage while a game is mounted. */
#grid[hidden] {
  display: none;
}

/* Narrow tablets / landscape phones: 3 columns (4 x minmax(170px)
   would overflow under ~760px). */
@media (min-width: 641px) {
  #grid {
    grid-template-columns: repeat(3, minmax(162px, 198px));
    justify-content: center;
    gap: 13px;
    padding-top: 16px;
  }
}

/* Desktop: 12 games = a clean 4 x 3, no vertical scroll at 1280x800. */
@media (min-width: 760px) {
  #grid {
    grid-template-columns: repeat(4, minmax(153px, 198px));
  }
}

/* ---------- Card (a <button>: the whole card is the tap target) ---------- */
.card {
  appearance: none;
  font-family: inherit;
  background: var(--card);
  color: var(--card-ink);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 140ms ease;
}

.card:active {
  transform: scale(0.97);
}

.card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Framed pixel-art tile: every drawIcon paints its own flat
   background edge to edge, so the 1px ink frame is what makes each
   preview read as a deliberate cartridge in both themes. */
.card .card-preview {
  width: 64px;
  height: 64px;
  display: block;
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

.card .card-title {
  margin-top: 12px;
  font-size: 10px;
  line-height: 1.45;
}

.card .card-tagline {
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
  /* One line, ellipsized: keeps every card the same height, which is
     what buys the 4 x 3 no-scroll fit at 1280x800. */
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Phones: denser cards (grid-density pass 2026-07-21). The 56px
   preview is mirrored in core.js previewSize(); the 10px pixel title
   is already the floor and stays. */
@media (max-width: 640px) {
  .card {
    padding: 12px 9px 11px;
  }

  .card .card-preview {
    width: 50px;
    height: 50px;
  }

  .card .card-title {
    margin-top: 10px;
  }

  .card .card-tagline {
    margin-bottom: 9px;
    font-size: 12px;
  }
}

/* Pinned to the card's bottom edge so best chips align across a row
   even when a neighbour's tagline wraps to two lines. */
.card .chip {
  align-self: center;
  margin-top: auto;
  font-size: 11px;
}

/* ---------- Chip (best score etc.) ---------- */
.chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 8px;
  background: transparent;
  color: var(--card-ink);
}

.chip[hidden] {
  display: none;
}

/* ---------- Big button (START / TRY AGAIN) ---------- */
.big-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 18px 24px;
  background: var(--accent);
  color: var(--accent-ink, var(--canvas));
  border: 1px solid var(--card-border);
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 140ms ease;
}

.big-btn:active {
  transform: scale(0.96);
}

/* ---------- Stage (game container) ---------- */
#stage {
  position: absolute;
  inset: 0;
  background: var(--canvas);
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

#stage[hidden] {
  display: none;
}

/* ---------- Result screen (shared pattern) ---------- */
.result-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.result-screen .result-score {
  font-size: 40px;
  color: var(--ink); /* scores in ink, accents on fills */
}

/* Optional derived-numbers line (stop10 target reconciliation). */
.result-screen .result-detail {
  font-size: 14px;
  color: var(--muted);
}

.result-screen .result-verdict {
  font-size: 16px;
  color: var(--ink);
}

.result-screen .result-percentile {
  font-size: 14px;
  color: var(--muted);
}

/* Quiet top-3 + this-run strip under the percentile line. */
.result-screen .result-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.result-screen .result-history[hidden] {
  display: none;
}

.result-screen .chip {
  align-self: center;
  font-size: 10px;
  padding: 6px 10px;
  color: var(--ink);
  border-color: var(--ink);
}

/* Explicit controls only (owner call 2026-07-29): TRY AGAIN with a
   full-size BACK TO GAMES under it; the stage is never a tap target. */
.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.big-btn.ghost {
  background: var(--card);
  color: var(--card-ink);
}

/* ---------- Help: core-owned how-to overlay ---------- */

/* The ? mirrors the ↻ and sits just left of it (40px btn + 8px gap). */
.help-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(60px + env(safe-area-inset-right, 0px));
  z-index: 2;
}

/* Covers the stage completely; every pointer stops here while open. */
.help-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--canvas);
}

.help-panel {
  width: min(100%, 360px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden; /* rounded parent clips; .help-body scrolls inside */
}

.help-body {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.help-preview {
  width: 112px;
  height: 112px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.help-title {
  font-size: 14px;
  color: var(--card-ink);
}

.help-line {
  font-size: 14px;
  line-height: 1.6;
  color: var(--card-ink);
}

/* ---------- Footer ---------- */
footer {
  flex: 0 0 auto;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Game: stop10 ---------- */
#stage[data-game='stop10'] .s10-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

#stage[data-game='stop10'] .s10-title {
  font-size: clamp(16px, 4.6vw, 24px);
  line-height: 1.5;
}

/* The round's target, announced BIG on the idle screen (the
   counting screen never shows numbers, so this is the one place
   the player learns the target). */
#stage[data-game='stop10'] .s10-target {
  font-size: clamp(22px, 7vw, 34px);
  line-height: 1.4;
}

#stage[data-game='stop10'] .s10-how {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

#stage[data-game='stop10'] .s10-dot {
  width: 22px;
  height: 22px;
  background: var(--accent);
  will-change: transform;
}

#stage[data-game='stop10'] .s10-count-label {
  font-size: 13px;
}

#stage[data-game='stop10'] .s10-fail {
  font-size: clamp(18px, 5.5vw, 26px);
  line-height: 1.5;
}

#stage[data-game='stop10'] .s10-fail-sub {
  font-size: 15px;
  line-height: 1.5;
  max-width: 320px;
}

#stage[data-game='stop10'] .s10-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Game: reaction ---------- */
#stage[data-game='reaction'] .rx-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

#stage[data-game='reaction'] .rx-title {
  font-size: clamp(16px, 4.6vw, 24px);
  line-height: 1.5;
}

#stage[data-game='reaction'] .rx-tagline {
  font-size: 15px;
  color: var(--muted);
}

#stage[data-game='reaction'] .rx-how {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

/* Full-bleed signal wash. Fixed colors on purpose: red/green are
   signal states, not theme surfaces, and must read identically in
   light and dark. No background transition anywhere here, the
   red -> green flip must paint in a single frame. */
#stage[data-game='reaction'] .rx-wash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

#stage[data-game='reaction'] .rx-wash[data-phase='wait'],
#stage[data-game='reaction'] .rx-wash[data-phase='fail'] {
  background: #8e1a12;
}

#stage[data-game='reaction'] .rx-wash[data-phase='go'],
#stage[data-game='reaction'] .rx-wash[data-phase='hit'] {
  background: #128e44;
}

#stage[data-game='reaction'] .rx-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#stage[data-game='reaction'] .rx-label {
  color: #f3e5df;
}

#stage[data-game='reaction'] .rx-wash[data-phase='wait'] .rx-label {
  font-size: clamp(14px, 4.5vw, 20px);
  color: #f3c9c2;
}

#stage[data-game='reaction'] .rx-wash[data-phase='go'] .rx-label {
  font-size: clamp(30px, 10vw, 48px);
}

#stage[data-game='reaction'] .rx-wash[data-phase='hit'] .rx-label {
  font-size: clamp(24px, 8vw, 40px);
}

#stage[data-game='reaction'] .rx-wash[data-phase='fail'] .rx-label {
  font-size: clamp(18px, 6vw, 28px);
}

#stage[data-game='reaction'] .rx-sub {
  font-size: 15px;
  line-height: 1.5;
  max-width: 320px;
  color: #f3c9c2;
}

#stage[data-game='reaction'] .rx-wash[data-phase='hit'] .rx-sub {
  color: #f3e5df; /* full-opacity fixed ink on the green signal wash */
}

#stage[data-game='reaction'] .rx-rounds {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  gap: 8px;
}

#stage[data-game='reaction'] .rx-chip {
  min-width: 42px;
  padding: 5px 6px;
  border: 1px solid rgba(243, 229, 223, 0.5);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  color: rgba(243, 229, 223, 0.92);
  text-align: center;
}

/* Done chips carry the ms numbers: standard card-chip surface so
   they read on any wash (now/next markers stay decorative dots). */
#stage[data-game='reaction'] .rx-chip.is-done {
  background: var(--card);
  border-color: var(--card-border);
  color: var(--card-ink);
}

#stage[data-game='reaction'] .rx-chip.is-now {
  border-color: rgba(243, 229, 223, 0.95);
}

#stage[data-game='reaction'] .rx-chip.is-next {
  opacity: 0.45;
}

/* ---------- Game: line ---------- */
#stage[data-game='line'] .ln-screen {
  height: 100%;
}

/* The stage already sets touch-action: none; repeat it on the
   canvas so the stroke surface never scrolls or zooms on its own. */
#stage[data-game='line'] .ln-screen canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* Top slot: game title while idle, live straightness % mid-stroke.
   Inset past the back button; overlays never eat pointer events. */
#stage[data-game='line'] .ln-top {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 64px;
  right: 64px;
  text-align: center;
  pointer-events: none;
}

#stage[data-game='line'] .ln-title {
  font-size: 13px;
  line-height: 1.5;
}

#stage[data-game='line'] .ln-live {
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1.2;
  color: var(--ink); /* scores in ink, accents on fills */
}

#stage[data-game='line'] .ln-hint {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  pointer-events: none;
}

#stage[data-game='line'] .ln-hint.is-warn {
  color: var(--ink);
}

/* ---------- Game: circle ---------- */
#stage[data-game='circle'] .cr-screen {
  height: 100%;
}

/* The stage already sets touch-action: none; repeat it on the
   canvas so the stroke surface never scrolls or zooms on its own. */
#stage[data-game='circle'] .cr-screen canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* Top slot: game title while idle, live accuracy % mid-stroke.
   Inset past the back button; overlays never eat pointer events. */
#stage[data-game='circle'] .cr-top {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 64px;
  right: 64px;
  text-align: center;
  pointer-events: none;
}

#stage[data-game='circle'] .cr-title {
  font-size: 13px;
  line-height: 1.5;
}

#stage[data-game='circle'] .cr-live {
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1.2;
  color: var(--ink); /* scores in ink, accents on fills */
}

#stage[data-game='circle'] .cr-hint {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  pointer-events: none;
}

#stage[data-game='circle'] .cr-hint.is-warn {
  color: var(--ink);
}

/* ---------- Game: oddoneout ---------- */
#stage[data-game='oddoneout'] .oo-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

#stage[data-game='oddoneout'] .oo-title {
  font-size: clamp(16px, 4.6vw, 24px);
  line-height: 1.5;
}

#stage[data-game='oddoneout'] .oo-tagline {
  font-size: 15px;
  color: var(--muted);
}

#stage[data-game='oddoneout'] .oo-how {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

#stage[data-game='oddoneout'] .oo-level {
  font-size: 13px;
}

/* Square board, width-capped. At a 390px viewport the 6x6 board is
   (390 - 48 screen padding - 5 gaps x 6px) / 6 = 52px per tile,
   above the 44px touch floor; the 420px cap keeps desktop tiles
   sane. min-height 0 lets a short viewport flex-squash the board
   (tiles go slightly rectangular, never clipped). */
#stage[data-game='oddoneout'] .oo-grid {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 6px;
  width: min(100%, 420px);
  aspect-ratio: 1;
  min-height: 0;
}

#stage[data-game='oddoneout'] .oo-tile {
  appearance: none;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 140ms ease, opacity 200ms ease;
}

#stage[data-game='oddoneout'] .oo-tile:active {
  transform: scale(0.94);
}

/* Game over: everything dims except the odd tile, which gets an ink
   outline so the answer is unmissable in both themes. */
#stage[data-game='oddoneout'] .oo-grid.is-over .oo-tile {
  cursor: default;
}

#stage[data-game='oddoneout'] .oo-grid.is-over .oo-tile:not(.is-odd) {
  opacity: 0.3;
}

#stage[data-game='oddoneout'] .oo-grid.is-over .oo-tile.is-odd {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

#stage[data-game='oddoneout'] .oo-hint {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

/* ---------- Game: bar ---------- */
#stage[data-game='bar'] .br-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

#stage[data-game='bar'] .br-title {
  font-size: clamp(16px, 4.6vw, 24px);
  line-height: 1.5;
}

#stage[data-game='bar'] .br-tagline {
  font-size: 15px;
  color: var(--muted);
}

#stage[data-game='bar'] .br-how {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

#stage[data-game='bar'] .br-streak-label {
  font-size: 10px;
  color: var(--muted);
}

#stage[data-game='bar'] .br-streak {
  margin-top: -8px;
  font-size: clamp(34px, 10vw, 52px);
  line-height: 1.2;
  color: var(--ink); /* scores in ink, accents on fills */
  will-change: transform;
}

/* The bar. The wrapper stays unclipped so the marker can overhang
   the track; the rounded track clips the zone inside it
   (rounded-container law: the rounded parent does the clipping). */
#stage[data-game='bar'] .br-bar {
  position: relative;
  width: min(100%, 520px);
  margin-top: 10px;
}

#stage[data-game='bar'] .br-track {
  position: relative;
  height: 56px;
  background: var(--muted-surface);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  overflow: hidden;
}

#stage[data-game='bar'] .br-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--accent);
}

/* The perfect middle 20% of the zone, a flat darker aim mark. */
#stage[data-game='bar'] .br-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 40%;
  width: 20%;
  background: #8f2d05;
}

/* Full-track flash overlay for perfect hits (opacity only). */
#stage[data-game='bar'] .br-flash {
  position: absolute;
  inset: 0;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}

/* rAF-driven translateX; taller than the track so it reads as the
   needle, not a fill. */
#stage[data-game='bar'] .br-marker {
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  width: 5px;
  margin-left: -2.5px;
  will-change: transform;
  pointer-events: none;
}

#stage[data-game='bar'] .br-marker-core {
  width: 100%;
  height: 100%;
  background: var(--ink);
}

#stage[data-game='bar'] .br-callout {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  font-size: 12px;
  color: var(--ink); /* text on canvas: ink, never accent */
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

#stage[data-game='bar'] .br-callout.is-on {
  opacity: 1;
}

#stage[data-game='bar'] .br-hint {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 320px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
