/* mentalmath/style.css — matches the lab's root palette, system fonts only */

:root {
  color-scheme: light dark;
  --bg: #f4f4f1;
  --card: #fff;
  --ink: #1c1c1c;
  --muted: #8a8a82;
  --line: #e6e6e0;
  --accent: #5566aa;
  --accent-soft: #eef0f8;
  /* exact answers stay blue (--accent); ballpark (≈) answers get this orange —
     picked distinct from --warn's amber so the ⋯ remainder key never reads as
     an estimate cue */
  --accent-est: #c2410c;
  --accent-est-soft: #fdece2;
  --good: #38915b;
  --bad: #c4504f;
  --key: #ececea;
  --key-fn: #dededa;
  --warn: #e07b18;
  --bronze: #a5642f;   /* badge tier 1 (defeated) */
  --silver: #9098a4;   /* badge tier 2 (swift) */
  --gold: #cf9b34;     /* badge tier 3 (flawless) */
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --card: #202027;
    --ink: #ececec;
    --muted: #9a9aa2;
    --line: #2d2d36;
    --accent: #8b9bd9;
    --accent-soft: #262633;
    --accent-est: #ff7a45;
    --accent-est-soft: #33231a;
    --good: #55b97e;
    --bad: #d97070;
    --key: #2a2a33;
    --key-fn: #34343f;
    --warn: #e8893a;
    --bronze: #c58449;
    --silver: #aab2c0;
    --gold: #e0b155;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* keep the hidden attribute working on elements whose class sets display */
[hidden] { display: none !important; }
/* keyboard focus ring only (matches the root grid, #54) — pointer focus stays bare */
/* suppress the native ring for pointer focus — but NEVER on our own keyboard
   cursor (.kbd). The :not(.kbd) is load-bearing: plain `button:focus` (0,1,1)
   outranks `.kbd` (0,1,0), so without it the class loses and the ring vanishes
   exactly when focus-visible isn't matching (a key press after a tap). */
button:focus:not(.kbd) { outline: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the menu's keyboard cursor owns its ring (see focusNav in app.js) so it never
   depends on the browser's focus-visible heuristic, which dropped the ring after
   a programmatic focus that followed a tap */
.kbd { outline: 2px solid var(--accent); outline-offset: 2px; }
.rack-row.kbd, .lesson-row.kbd { outline-offset: -2px; } /* full-width rows: inset so it doesn't clip */
html { height: 100%; overscroll-behavior: none; }
body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: max(env(safe-area-inset-top), .75rem) 1rem max(env(safe-area-inset-bottom), 1.25rem);
}
#app { max-width: 26rem; margin: 0 auto; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; border: 0; }
button:disabled { cursor: default; }
.rep { text-decoration: overline; }

/* ── shared chrome ─────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .75rem; min-height: 2rem;
}
.back { background: none; padding: .3rem .4rem .3rem 0; color: var(--muted); font-size: .9rem; }
.back:hover { color: var(--ink); }
.ghost { background: none; color: var(--muted); font-size: .82rem; padding: .3rem .5rem; border-radius: 999px; }
.ghost:hover { color: var(--ink); }

.btn {
  display: block; width: 100%;
  padding: .8rem 1rem; border-radius: 12px;
  background: var(--key-fn); color: var(--ink);
  font-weight: 600; font-size: .95rem;
  transition: transform .1s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; }

/* ── menu ──────────────────────────────────────────────────────────────── */

.hero { text-align: center; margin: 1.25rem 0 1.25rem; }
.hero h1 { margin: 0; font-size: clamp(28px, 8vw, 40px); letter-spacing: -.02em; }

/* tab bar: Check-up | Practice | Learn (#48 buckets, redesigned as tabs) */
.tabs {
  display: flex; gap: .25rem;
  background: var(--key); border-radius: 12px; padding: .25rem;
  margin-bottom: 1.1rem;
}
.tabs .tab {
  flex: 1; padding: .5rem .25rem; border-radius: 9px;
  background: none; color: var(--muted);
  font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.tabs .tab[aria-selected="true"] {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
/* a whisper of motion on tab switch, so swipes read as movement */
#menu-panel.flip > .bucket { animation: rise .18s ease; }
@media (prefers-reduced-motion: reduce) { #menu-panel.flip > .bucket { animation: none; } }

/* first-run calibration offer (#46) */
.calib-banner {
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem; margin-bottom: 1.5rem;
}
.cb-copy { margin: 0 0 .8rem; font-size: .9rem; line-height: 1.5; }
.cb-actions { display: flex; align-items: center; gap: .6rem; }
.cb-actions .btn { width: auto; padding: .6rem 1.1rem; }
.cb-actions .btn.primary { flex: 1; }

/* subject/category groups inside a bucket */
.group { margin-bottom: 1.1rem; }
.group:last-child { margin-bottom: 0; }
.group-h {
  margin: 0 0 .5rem; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.mode-grid--ops { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.mode {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; min-height: 3.4rem; padding: .5rem .25rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
}
.mode:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.mode:active { transform: scale(.97); }
/* a card is one compact row: symbol beside a text column (icons don't get
   their own row) — a tab's worth of drills fits without scrolling */
.mode--op {
  flex-direction: row; align-items: center; justify-content: flex-start;
  text-align: left; gap: .6rem; min-height: 0; padding: .55rem .7rem;
}
.mode--survival { grid-column: 1 / -1; }
.mode--wide { grid-column: 1 / -1; }
.m-sym { font-size: 1.2rem; line-height: 1; color: var(--accent); flex: none; }
.m-name { font-weight: 600; font-size: .92rem; }
.m-text { display: flex; flex-direction: column; align-items: flex-start; gap: .18rem; min-width: 0; }
.m-label { font-family: var(--mono); font-weight: 700; font-size: 1rem; }
.m-sub { font-size: .72rem; color: var(--muted); }
.m-best { font-size: .66rem; color: var(--accent); background: var(--accent-soft); padding: .05rem .45rem; border-radius: 999px; }
/* survival cards: the best-record pill rides at the right edge */
.mode--survival .m-best { margin-left: auto; }
/* ballpark (≈) ops get the orange accent instead of blue — see --accent-est */
.mode.est .m-sym { color: var(--accent-est); }
.mode.est .m-best { color: var(--accent-est); background: var(--accent-est-soft); }
.mode-sym.est { color: var(--accent-est); }

.learn-sub { margin: .1rem 0 .8rem; font-size: .8rem; color: var(--muted); }
.lesson-row {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  text-align: left; padding: .7rem .9rem; margin-bottom: .5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  transition: transform .1s ease, border-color .15s ease;
}
.lesson-row:hover { border-color: var(--accent); }
.lesson-row:active { transform: scale(.98); }
.lr-sym { font-size: 1.1rem; width: 1.5rem; text-align: center; color: var(--accent); flex: none; }
/* ballpark (≈) lessons carry the answer-contract orange, like their drills */
.lesson-row.est .lr-sym { color: var(--accent-est); }
.lr-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.lr-title { font-weight: 600; font-size: .92rem; }
.lr-blurb { font-size: .78rem; color: var(--muted); }
.lr-go { margin-left: auto; color: var(--muted); }

.foot {
  margin-top: 2.25rem; display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .78rem;
}

/* ── lesson ────────────────────────────────────────────────────────────── */

.l-title { margin: .25rem 0 .5rem; font-size: 1.5rem; letter-spacing: -.01em; }
.intro { margin: 0 0 1.25rem; color: var(--muted); line-height: 1.5; }
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .9rem 1rem; margin-bottom: .6rem;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.step-m { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; margin-bottom: .3rem; }
.step-n { font-size: .88rem; color: var(--muted); line-height: 1.5; }
#l-next, #l-end { margin-top: 1rem; }
.tip {
  margin: 0 0 1rem; padding: .8rem 1rem; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink);
  font-size: .88rem; line-height: 1.5;
  animation: rise .25s ease;
}
.tip::before { content: "💡 "; }

/* ── play ──────────────────────────────────────────────────────────────── */

/* fill the viewport so the keypad sits at the bottom, in thumb reach;
   app.js puts .playing on <body> so the page gutters shrink too and the
   pad hugs the safe-area edge */
body.playing {
  padding-top: max(env(safe-area-inset-top), .6rem);
  padding-bottom: max(env(safe-area-inset-bottom), .6rem);
  /* gameplay-only hardening: rapid taps between keys must not select text,
     pop the callout menu, or double-tap zoom. Menu/lesson screens keep their
     defaults so lesson text stays selectable and pages stay zoomable. */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#scr-play:not([hidden]) {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 1.25rem);
  /* the 56rem cap keeps tall desktop windows sane… */
  min-height: min(calc(100dvh - max(env(safe-area-inset-top), .6rem) - max(env(safe-area-inset-bottom), .6rem)), 56rem);
}
/* …but on touch devices always use the full height, however tall the phone */
@media (pointer: coarse) {
  #scr-play:not([hidden]) {
    min-height: calc(100dvh - max(env(safe-area-inset-top), .6rem) - max(env(safe-area-inset-bottom), .6rem));
  }
}
.problem-card { flex: 1; }

.mode-name { font-size: .85rem; font-weight: 600; color: var(--muted); }
.mode-sym { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.progress { font-family: var(--mono); font-size: .85rem; color: var(--muted); min-width: 3.2rem; text-align: right; }
/* the heart you'd lose next pulses during the free-retry window (a soft breath,
   not a blink) so "one more chance" reads without stealing focus from the sum */
.progress .heart { display: inline-block; }
.progress .heart.at-risk { animation: heart-pulse .8s ease-in-out infinite; }
@keyframes heart-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.82); }
}
@media (prefers-reduced-motion: reduce) {
  .progress .heart.at-risk { animation: none; opacity: .5; } /* static risk cue */
}

.stats {
  display: flex; justify-content: space-around;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .35rem .5rem; margin-bottom: .75rem;
  font-size: .82rem; color: var(--muted);
}
.stats b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.problem-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.25rem 1rem 1rem;
  min-height: 12.5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin-bottom: .9rem;
  overflow: hidden;
}
.problem {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(2.1rem, 12vw, 3.2rem);
  letter-spacing: .01em;
  white-space: nowrap;
}
.problem.long { font-size: clamp(1.7rem, 9.5vw, 2.5rem); }
.answer {
  font-family: var(--mono); font-weight: 700;
  font-size: clamp(2.1rem, 12vw, 3.2rem);
  color: var(--accent);
  min-height: 1.25em;
  margin-top: .25rem;
  white-space: nowrap;
}
/* guesstimation: the tolerance contract, always visible under the problem */
.tol { margin-top: .3rem; font-size: .78rem; color: var(--muted); }

.hint-btn { margin-top: .4rem; }
/* The hint floats over the lower part of the card (like the feedback overlay)
   rather than sitting in the flow, so revealing it never resizes the problem
   card — the card's height stays put for a given screen size. Long hints
   scroll inside the panel instead of pushing the keypad. */
.hint {
  position: absolute; left: .7rem; right: .7rem; bottom: .7rem;
  max-height: calc(100% - 1.4rem); overflow-y: auto;
  margin: 0; padding: .5rem .75rem;
  background: var(--accent-soft); border-radius: 10px;
  font-size: .82rem; color: var(--ink);
  text-align: center; line-height: 1.45;
}
.h-line { animation: rise .2s ease; }
.h-line + .h-line { margin-top: .15rem; }

.feedback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; border-radius: 15px;
  background: color-mix(in srgb, var(--bad) 88%, transparent);
  color: #fff;
  animation: rise .15s ease;
}
.feedback.good { background: color-mix(in srgb, var(--good) 88%, transparent); }
.f-glyph { font-size: 4rem; line-height: 1; }
.f-answer { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; min-height: 1.2em; }
.f-answer .f-err { font-size: .95rem; opacity: .85; }

/* quit confirmation (q → y/n): a stop-and-ask overlay on the problem card so a
   stray key never drops the sprint. Sits above the feedback overlay. */
.quit-prompt {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; border-radius: 15px;
  background: var(--card);
  animation: rise .15s ease;
}
.qp-text { font-weight: 700; font-size: 1.25rem; }
.qp-actions { display: flex; gap: .6rem; }
.qp-btn {
  padding: .6rem 1.15rem; border-radius: 12px;
  background: var(--bad); color: #fff; font-weight: 600; font-size: .92rem;
  transition: transform .1s ease, filter .15s ease;
}
.qp-btn:hover { filter: brightness(1.06); }
.qp-btn:active { transform: scale(.97); }
.qp-btn.qp-stay { background: var(--key-fn); color: var(--ink); }
/* the level change reads as its own event: a toast pill pinned to the top of
   the problem card, coloured by direction. It floats above the feedback
   overlay and the next problem alike, fading out on its own — it informs
   without ever holding up the sprint (pointer-events: none, no extra delay) */
.level-toast {
  position: absolute; top: .6rem; left: 50%; transform: translateX(-50%);
  z-index: 5; pointer-events: none; white-space: nowrap;
  font-weight: 700; font-size: .85rem;
  padding: .14rem .75rem; border-radius: 999px;
  animation: pop .22s ease, toast-fade 2s ease forwards;
}
.level-toast.up { background: #f5c518; color: #1c1c1c; }
.level-toast.down { background: rgba(0, 0, 0, .55); color: #fff; }
@keyframes pop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }
@keyframes toast-fade { 0%, 65% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .level-toast { animation: none; } /* app.js still hides it after 2s */
}

/* calculator-style keypad: big square keys, .numpad button.k-* overrides
   below must out-rank the base rule (plain .k-* would lose to it) */
.numpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.numpad button {
  aspect-ratio: 1; max-height: 6rem;
  border-radius: 16px;
  background: var(--key);
  font-family: var(--mono); font-size: 2rem; font-weight: 600;
  transition: transform .07s ease, filter .1s ease;
}
.numpad button:hover { filter: brightness(1.06); }
.numpad button:active { transform: scale(.94); }
.numpad button:disabled { opacity: .35; transform: none; filter: none; }
.numpad button.k-fn { background: var(--key-fn); font-size: 1.55rem; }
/* remainder mode: the ⋯ key is the odd one out, so colour it for attention */
.numpad button.k-rem { background: var(--warn); color: #fff; }
.numpad button.k-ok {
  grid-column: 4; grid-row: 3 / span 2; aspect-ratio: auto; max-height: none;
  background: var(--good); color: #fff;
}
.numpad button.k-ok:disabled { background: var(--key-fn); color: var(--muted); opacity: .6; }
.numpad button.k-zero { grid-column: 1 / span 2; aspect-ratio: auto; }

.daypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.daypad button {
  min-height: clamp(3.8rem, 10vh, 5.5rem);
  border-radius: 16px;
  background: var(--key);
  font-size: 1.15rem; font-weight: 600;
  transition: transform .07s ease, filter .1s ease;
}
.daypad button:hover { filter: brightness(1.06); }
.daypad button:active { transform: scale(.94); }
.daypad button:first-child { color: var(--bad); }
.daypad button:last-child { color: var(--accent); }

.key-hint { text-align: center; color: var(--muted); font-size: .72rem; margin: .7rem 0 0; }
/* on touch devices the hint is useless — remove it entirely so it doesn't
   hold the keypad half a key's height above the thumb */
@media (pointer: coarse) { .key-hint { display: none; } }

/* short screens (SE-class phones, landscape): give the fixed-height keypad
   priority and let the problem card shrink */
@media (max-height: 720px) {
  .problem-card { min-height: 8.5rem; }
  .key-hint { display: none; }
}

/* ── results ───────────────────────────────────────────────────────────── */

.r-emoji { text-align: center; font-size: 3rem; margin-top: 1rem; }
.r-title { text-align: center; margin: .25rem 0 .2rem; font-size: 1.6rem; }
.r-score { text-align: center; color: var(--muted); margin-bottom: 1rem; }
.r-perfect { text-align: center; color: var(--accent); font-weight: 600; font-size: .9rem; margin: -.6rem 0 1rem; }
.r-stats {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: .75rem 1rem; margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: .35rem;
}
.r-stats div { display: flex; justify-content: space-between; font-size: .88rem; }
.r-stats span { color: var(--muted); }
.r-stats b { font-family: var(--mono); font-weight: 600; }

.r-block { margin-bottom: 1.1rem; }
.r-block h3 { margin: 0 0 .5rem; font-size: .85rem; font-weight: 600; color: var(--muted); }

/* ── badge rack (Check-up tab, #47 redesigned) ────────────────────────── */
.rack { margin-top: 1.4rem; }
.rack-h { margin: 0 0 .1rem; font-size: 1rem; font-weight: 700; }
.rack-count { font-family: var(--mono); font-weight: 600; font-size: .8rem; color: var(--muted); margin-left: .3rem; }
.rack-sub { margin: 0 0 .9rem; font-size: .8rem; color: var(--muted); }
.rack .group-h { margin-top: .9rem; }

/* a rack row: skill name on the left, its medal slots right-aligned like a
   ribbon bar — the whole button opens the shelf with the levels' names */
.rack-row {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .45rem .6rem; margin-bottom: .35rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  text-align: left;
  transition: transform .1s ease, border-color .15s ease;
}
.rack-row:hover { border-color: var(--accent); }
.rack-row:active { transform: scale(.985); }
.rack-row.done { border-color: var(--accent); }
.rack-row.gold { border-color: var(--gold); }
.rr-sym { font-family: var(--mono); font-weight: 700; color: var(--accent); width: 1.7rem; flex: none; }
.rack-row.est .rr-sym { color: var(--accent-est); }
.rr-name {
  display: flex; align-items: center; gap: .1rem;
  font-family: var(--mono); font-size: .8rem; color: var(--muted); flex: none;
}
.rr-cells { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
/* a medal is a struck coin — bronze / silver ⚡ / gold ★. The metal gradients
   are theme-independent (metal is metal); only the ghost slots follow the
   theme. ::before is the gloss highlight, the inner span the embossed mark. */
.medal {
  position: relative; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .56rem; line-height: 1; flex: none;
}
.medal::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.8), rgba(255,255,255,.12) 36%, transparent 48%);
}
.medal > span { position: relative; font-weight: 700; text-shadow: 0 1px 0 rgba(255,255,255,.45); }
.medal.t1 {
  background: radial-gradient(circle at 50% 42%, #eab887 0 28%, #c58449 58%, #8f5a29 92%);
  box-shadow: inset 0 0 0 1.6px #7a4a20, inset 0 -2px 3px rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.28);
  color: #5f3a17;
}
.medal.t2 {
  background: radial-gradient(circle at 50% 42%, #f3f5f8 0 28%, #bcc4cf 58%, #848d9b 92%);
  box-shadow: inset 0 0 0 1.6px #6f7885, inset 0 -2px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.28);
  color: #454d58;
}
.medal.t3 {
  background: radial-gradient(circle at 50% 42%, #ffe9a3 0 28%, #e0af35 58%, #a3780e 92%);
  box-shadow: inset 0 0 0 1.6px #8f6a08, inset 0 -2px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.3), 0 0 7px rgba(224,175,53,.5);
  color: #6e5105;
}
.medal.ghost { background: none; border: 1.6px dashed var(--line); color: var(--muted); }
.medal.ghost::before { display: none; }
.medal.ghost > span { text-shadow: none; opacity: .7; }
.medal.m-num > span { font-family: var(--mono); font-size: .5rem; font-weight: 600; }

/* Survival milestones hang from a ribbon drape — mode rows read as their own
   kind of decoration. Drapes: royal purple/gold for Survival, teal for the ≈
   mix (echoing nothing but distinguishing them at a glance). */
.hang { display: flex; flex-direction: column; align-items: center; width: 1.25rem; flex: none; }
.hang .drape {
  width: .85rem; height: .5rem;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.hang-sv .drape { background: linear-gradient(90deg, #5a3f8a 0 30%, #d9b23a 30% 46%, #5a3f8a 46%); }
.hang-gm .drape { background: linear-gradient(90deg, #1e6f64 0 32%, #8fd0c5 32% 46%, #1e6f64 46%); }
.hang .medal { width: .95rem; height: .95rem; margin-top: -1px; }
.hang .medal.m-num > span { font-size: .44rem; }
.hang.ghost .drape { visibility: hidden; } /* unearned: just the silhouette */

/* the shelf: an op's ladder (or a mode's milestones) as a bottom sheet */
.shelf {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45); animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.shelf-panel {
  width: 100%; max-width: 26rem;
  background: var(--bg); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 1rem 1rem max(env(safe-area-inset-bottom), 1rem);
  animation: sheet-up .2s ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.shelf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.shelf-title { font-weight: 700; font-size: 1rem; }
.shelf-chips { display: flex; flex-wrap: wrap; gap: .5rem; }

/* badge chip — shared by the shelf and the results mint strip */
.bchip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .32rem .62rem; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line);
  font-size: .78rem;
}
.bc-sym { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.bc-label { font-family: var(--mono); }
.bchip.est .bc-sym { color: var(--accent-est); }
.bchip.ghost { opacity: .55; border-style: dashed; }
.bchip.ghost .bc-sym { color: var(--muted); }
.bchip.t1 { border-color: var(--bronze); } /* chips follow the coin metals */
.bchip.t2 { border-color: var(--silver); }
.bchip.t2 .bc-mark { color: var(--silver); }
.bchip.t3 { border-color: var(--gold); }
.bchip.t3 .bc-mark { color: var(--gold); }

.mint-strip { display: flex; flex-wrap: wrap; gap: .5rem; }
.prog-line { display: flex; align-items: center; gap: .4rem; font-size: .85rem; margin-bottom: .25rem; }
.pl-sym { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.prog-line.est .pl-sym { color: var(--accent-est); }

.r-miss {
  display: flex; align-items: baseline; gap: .6rem; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .5rem .75rem; margin-bottom: .4rem;
  font-size: .88rem; text-align: left;
  transition: border-color .15s ease;
}
.r-miss:hover { border-color: var(--accent); }
.rm-steps {
  margin: -.15rem 0 .5rem; padding: .6rem .85rem;
  background: var(--accent-soft); border-radius: 10px;
  font-size: .84rem; line-height: 1.5;
  animation: rise .2s ease;
}
.rm-line + .rm-line { margin-top: .15rem; }
.rm-prob, .rm-ans { font-family: var(--mono); font-weight: 600; }
.rm-ans { color: var(--good); }
.rm-given { margin-left: auto; color: var(--bad); font-size: .78rem; }

.r-bar-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; font-size: .78rem; }
.rb-label { width: 6.2rem; text-align: right; font-family: var(--mono); color: var(--muted); flex: none; }
.rb-track { flex: 1; height: 1.1rem; background: var(--key); border-radius: 999px; overflow: hidden; }
.rb-bar { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.r-bar-row.missed .rb-bar { background: var(--bad); }
.rb-time { width: 2.9rem; font-family: var(--mono); font-weight: 600; flex: none; }

.r-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.25rem; }
