:root {
  --bg: #121614;
  --panel: #1b211e;
  --panel-2: #232b27;
  --line: #2e3833;
  --line-2: #3a4640;
  --nav: #171c19;
  --ink: #eef0ea;
  --ink-2: #9aa59f;
  --ink-3: #6f7a74;
  --win: #3fae76;
  --win-strong: #23734b;
  --win-soft: #1c2a22;
  --win-ink: #6fd49d;
  --ghost: #e07a3f;
  --ghost-strong: #9a4a1e;
  --ghost-soft: #2e2119;
  --ghost-ink: #f09a66;
  --brass: #e0b24f;
  --brass-soft: #3a3220;
  --brass-ink: #f5dca4;
  --cue: #f3efe3;
  --disabled: #2a302d;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
a { color: var(--brass); text-decoration: none; }
h1, h2, h3, p { margin: 0; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.screen {
  flex: 1;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screen.has-nav { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }

/* Type */
.display { font-family: var(--display); font-weight: 700; line-height: 1; }
.eyebrow { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.title { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: 0.01em; }
.title-sm { font-family: var(--display); font-weight: 700; font-size: 30px; }

/* Layout helpers */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.end { align-items: flex-end; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

/* Cards */
.card { background: var(--panel); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.bordered { border: 1px solid var(--line); border-radius: 20px; padding: 20px; gap: 16px; }
.tile { background: var(--panel); border-radius: 14px; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.tile .num { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.subtile { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.subtile .num { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1; }
.divider { height: 1px; background: var(--line); }

/* Buttons */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 16px; min-height: 56px; padding: 8px 16px;
  font-weight: 600; font-size: 17px; text-align: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 0.06s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.98); filter: brightness(1.1); }
.btn .big { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.05; }
.btn .sub { font-size: 13px; font-weight: 400; opacity: 0.85; }
.btn-win { background: var(--win-strong); color: #fff; }
.btn-win-outline { background: var(--win-soft); border: 2px solid var(--win); color: #fff; }
.btn-miss { background: var(--ghost-strong); color: #fff; }
.btn-quiet { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); }
.btn-brass { background: var(--brass-soft); border: 1px solid var(--brass); color: var(--brass-ink); min-height: 48px; font-size: 15px; flex-direction: row; gap: 8px; }
.btn-danger { background: transparent; border: 1px solid #6b2f25; color: #f0a08a; min-height: 48px; font-size: 15px; }
.btn[disabled] { background: var(--disabled); color: var(--ink-3); border-color: transparent; cursor: not-allowed; transform: none; filter: none; }
.btn[disabled] .sub { color: #8a948f; opacity: 1; }
.btn-lg { min-height: 76px; border-radius: 18px; }
.link-btn { appearance: none; background: none; border: 0; color: var(--brass); font-weight: 600; font-size: 14px; padding: 12px 0; cursor: pointer; }
.text-btn { appearance: none; background: none; border: 0; color: var(--ink-2); font-size: 14px; min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.icon-btn { appearance: none; background: none; border: 0; color: var(--ink); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 12px; }
.icon-btn.back { margin-left: -10px; }

/* Segmented + chips */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 600; min-height: 40px; border-radius: 9px; cursor: pointer; padding: 0 8px; }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--ink); }
.seg.small button { min-height: 36px; font-size: 13px; }
.seg.inline { display: inline-grid; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; }
.chip[aria-pressed="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--brass-ink); }
.chip.filter { min-height: 40px; background: var(--panel); border-color: var(--line); }
.chip.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

/* Option cards (setup) */
.option { appearance: none; width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); color: var(--ink); cursor: pointer; }
.option[aria-pressed="true"] { background: var(--win-soft); border-color: var(--win); }
.option .name { font-weight: 600; font-size: 16px; }
.option .desc { font-size: 13px; color: var(--ink-2); }
.bigpick { appearance: none; min-height: 64px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 28px; cursor: pointer; }
.bigpick[aria-pressed="true"] { background: var(--win-soft); border-color: var(--win); }

/* Stepper */
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-radius: 14px; padding: 8px; }
.stepper .step { appearance: none; border: 0; width: 56px; height: 56px; border-radius: 12px; background: var(--panel-2); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.stepper .val { display: flex; flex-direction: column; align-items: center; }
.stepper .val .display { font-size: 40px; }
.stepper input { width: 120px; height: 52px; border: 0; background: transparent; color: var(--ink); text-align: center; font-family: var(--display); font-weight: 700; font-size: 40px; outline: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input::placeholder { color: var(--ink-3); }

/* Scoreboard */
.score3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; }
.score3 > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lbl-you { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--win); }
.lbl-ghost { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--ghost); }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 5px; }
.dot.w { background: var(--win); }
.dot.l { background: var(--ghost); }
.dot.next { border: 2px solid var(--ink-2); }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--win); border-radius: 4px; }
.bar.thin { height: 4px; }

/* Balls */
.balls { display: grid; gap: 8px; }
.ball { appearance: none; border: 0; aspect-ratio: 1; border-radius: 999px; background: var(--cue); color: var(--bg); font-family: var(--display); font-weight: 700; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0; }
.ball.eight { background: #0c0f0d; color: var(--cue); box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.ball[aria-pressed="true"] { background: var(--brass); color: var(--bg); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--brass); }
.ball.static { cursor: default; width: 30px; height: 30px; font-size: 17px; flex-shrink: 0; }
.pickbtn { appearance: none; min-height: 46px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.pickbtn[aria-pressed="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--brass-ink); }

/* Lists */
.list-item { background: var(--panel); border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; appearance: none; border: 0; width: 100%; text-align: left; color: var(--ink); cursor: pointer; }
.stripe { width: 6px; height: 36px; border-radius: 3px; flex-shrink: 0; }
.badge { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 18px; flex-shrink: 0; }
.badge.w { background: #1c3a2a; color: var(--win-ink); }
.badge.l { background: #3a2419; color: var(--ghost-ink); }
.badge.n { background: var(--panel-2); color: var(--ink-2); }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--brass-soft); color: var(--brass-ink); white-space: nowrap; }
.section-h { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }

/* Bars (horizontal) */
.hbar { display: flex; align-items: center; gap: 10px; }
.hbar .lab { width: 88px; font-size: 13px; color: var(--ink-2); flex-shrink: 0; }
.hbar .track { flex: 1; height: 14px; }
.hbar .fill { height: 14px; border-radius: 4px; background: var(--ghost); min-width: 2px; }
.hbar .n { width: 24px; text-align: right; font-size: 13px; font-weight: 600; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .hits { position: absolute; inset: 0; display: grid; }
.chart .hits button { appearance: none; background: transparent; border: 0; cursor: pointer; padding: 0; }
.axis-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); }
.readout { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.legend .item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.legend .v { margin-left: auto; font-weight: 600; }
.empty { color: var(--ink-2); font-size: 14px; padding: 8px 0; }

/* Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--nav); border-top: 1px solid var(--line);
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
}
.nav .inner { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--brass); font-weight: 600; }

/* Banners */
.banner { background: var(--brass-soft); border: 1px solid #6b5a2e; color: var(--brass-ink); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.banner a, .banner button { margin-left: auto; }
.result-banner { border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.result-banner.w { background: var(--win-soft); border: 1px solid var(--win); }
.result-banner.l { background: var(--ghost-soft); border: 1px solid var(--ghost); }
.result-banner.n { background: var(--panel); border: 1px solid var(--line-2); }
.result-banner .head { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: 0.02em; }
.result-banner.w .head { color: var(--win-ink); }
.result-banner.l .head { color: var(--ghost-ink); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 100px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 20; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,0.4); }

.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* Confirm sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(6, 9, 7, 0.72); display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); }
.sheet { width: 100%; max-width: 448px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.sheet p { font-size: 16px; line-height: 1.45; margin-bottom: 6px; }
.ball.break { font-family: var(--body); font-size: 13px; font-weight: 600; background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.ball.break[aria-pressed="true"] { background: var(--brass); color: var(--bg); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--brass); }

/* Swipeable home summary */
.swipe { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.swipe::-webkit-scrollbar { display: none; }
.swipe > .card { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.swipe-dots { display: flex; justify-content: center; gap: 4px; margin-top: -8px; }
.swipe-dots button { appearance: none; border: 0; background: transparent; width: 28px; height: 20px; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.swipe-dots button::before { content: ''; width: 7px; height: 7px; border-radius: 4px; background: var(--line-2); transition: width 0.15s ease, background 0.15s ease; }
.swipe-dots button[aria-current="true"]::before { width: 18px; background: var(--ink-2); }
.dchart { flex: 1; min-height: 190px; display: grid; column-gap: 0; align-items: stretch; }
.dcol { display: flex; flex-direction: column; align-items: stretch; min-height: 190px; }
.dtrack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-2); padding: 0 4px; }
.dbar { width: 100%; max-width: 30px; border-radius: 4px 4px 0 0; background: var(--win); display: block; }
.dbar.today { background: var(--brass); }
.dbar.empty { height: 0; }
.dval { font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.dval.zero { color: var(--ink-3); font-weight: 400; }
.dlab { font-size: 11px; color: var(--ink-2); height: 22px; padding-top: 6px; display: flex; justify-content: center; white-space: nowrap; overflow: visible; }
.dlab.today { color: var(--brass); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .swipe { scroll-behavior: auto; } }

.dchart.dense .dtrack { padding: 0 1px; }
.dchart.dense .dbar { border-radius: 2px 2px 0 0; max-width: none; }
.range { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 2px; gap: 2px; flex-shrink: 0; }
.range button { appearance: none; border: 0; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; min-height: 30px; min-width: 38px; padding: 0 8px; border-radius: 7px; cursor: pointer; font-variant-numeric: tabular-nums; }
.range button[aria-pressed="true"] { background: var(--line-2); color: var(--ink); }
.pip { width: 12px; height: 12px; border-radius: 6px; border: 2px solid var(--brass); display: inline-block; }
.pip.on { background: var(--brass); }
.btn-brass[disabled] { background: var(--disabled); border-color: transparent; color: var(--ink-3); }

/* Grading */
.grade-card { color: var(--ink); border: 1px solid var(--line); }
.lvl { width: 48px; height: 48px; border-radius: 24px; background: var(--brass-soft); border: 2px solid var(--brass); color: var(--brass-ink); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 26px; flex-shrink: 0; }
.lvl.pending { border-style: dashed; color: var(--ink-2); background: transparent; border-color: var(--line-2); }
.bigpick.rec { background: var(--brass-soft); border-color: rgba(224,178,79,.55); color: var(--brass-ink); }
.bigpick.rec[aria-pressed="true"] { background: var(--win-soft); border-color: var(--win); color: var(--ink); box-shadow: inset 0 -4px 0 var(--brass); }
.rec-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--brass-ink); }
.rec-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--brass-soft); border: 2px solid rgba(224,178,79,.55); flex: none; }
.rec-key { color: var(--brass); font-weight: 600; letter-spacing: 0.02em; text-transform: none; margin-left: 6px; font-size: 12px; }
.fit { border: 1px solid var(--line-2); }
.fit.on { border-color: var(--win); }
.fit.easy { border-color: #6b5a2e; }
.fit.stretch { border-color: var(--ghost); }

/* Bowlliards scorecard */
.bcard { display: flex; flex-direction: column; gap: 6px; }
.brow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.bframe { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; }
.bframe.cur { border-color: var(--brass); }
.bnum { font-size: 10px; color: var(--ink-3); text-align: left; padding-left: 2px; }
.bboxes { display: flex; justify-content: flex-end; gap: 2px; }
.bbox { width: 20px; height: 20px; border: 1px solid var(--line-2); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bframe.tenth .bbox { width: 16px; }
.bcum { font-family: var(--display); font-weight: 700; font-size: 18px; text-align: center; min-height: 20px; font-variant-numeric: tabular-nums; }
.num-ball { font-size: 20px; }
.num-ball.all { background: var(--win-soft); color: var(--win-ink); box-shadow: inset 0 0 0 2px var(--win); }
.num-ball.all[aria-pressed="true"] { background: var(--brass); color: var(--bg); box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--brass); }

/* ---------- Launch screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 120% 70% at 50% 42%, #245a42 0%, #173a2b 55%, #121614 100%);
  transition: opacity .45s ease, visibility .45s;
  padding-bottom: 6vh;
}
.splash.out { opacity: 0; visibility: hidden; }
.splash-mark { position: relative; display: flex; flex-direction: column; align-items: center; animation: splash-in .7s cubic-bezier(.2,.8,.2,1) both; }
.splash-ghost { display: block; animation: splash-float 2.4s ease-in-out .7s infinite; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.splash-shadow { width: 96px; height: 14px; margin-top: 14px; border-radius: 50%; background: rgba(0,0,0,.35); filter: blur(4px); animation: splash-shadow 2.4s ease-in-out .7s infinite; }
.splash-eye { transform-box: fill-box; transform-origin: center; animation: splash-blink 2.4s 1s infinite; }
.splash-name { margin-top: 28px; font-family: var(--display); font-weight: 700; font-size: 40px; letter-spacing: .12em; color: var(--cue); animation: splash-up .6s ease .25s both; }
.splash-tag { margin-top: 6px; font-family: var(--body); font-size: 15px; color: var(--ink-2); animation: splash-up .6s ease .4s both; }
@keyframes splash-in { from { opacity: 0; transform: translateY(18px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes splash-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splash-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes splash-shadow { 0%,100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.82); opacity: .7; } }
@keyframes splash-blink { 0%,44%,52%,100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }
@media (prefers-reduced-motion: reduce) {
  .splash-mark, .splash-ghost, .splash-shadow, .splash-eye, .splash-name, .splash-tag { animation: none; }
}

/* ---------- Level hero ---------- */
.level-hero { gap: 16px; }
.lvl-big { width: 88px; height: 88px; border-radius: 44px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--brass-soft); border: 3px solid var(--brass); color: var(--brass-ink); font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1; }
.lvl-big.pending { border-style: dashed; border-color: var(--line-2); background: transparent; color: var(--ink-2); }
.bar.brass > span { background: var(--brass); }
.ladder { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.rung { height: 26px; border-radius: 6px; background: var(--panel-2); color: var(--ink-3); font-family: var(--display); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.rung.done { background: var(--brass-soft); color: var(--brass-ink); }
.rung.on { background: var(--brass); color: #1b211e; }
.play-rec { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--brass-soft); }
.play-rec > span:last-child { color: var(--brass-ink); }

.back-btn { appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; white-space: nowrap; flex: none; border-radius: 20px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.back-btn:disabled { opacity: .4; cursor: default; }

/* ---------- One-tap misses ---------- */
.mull-switch { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); font: inherit; cursor: pointer; }
.mull-switch .sw { width: 46px; height: 28px; border-radius: 14px; background: var(--line-2); position: relative; flex: none; transition: background .15s; }
.mull-switch .sw span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: var(--ink-2); transition: transform .15s, background .15s; }
.mull-switch[aria-checked="true"] { border-color: var(--brass); background: var(--brass-soft); }
.mull-switch[aria-checked="true"] .sw { background: var(--brass); }
.mull-switch[aria-checked="true"] .sw span { transform: translateX(18px); background: #1b211e; }
.miss-card.armed .ball { box-shadow: 0 0 0 3px var(--brass); }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 70px; }
.chip.tag { min-height: 32px; padding: 0 10px; font-size: 12px; }

/* ---------- Game layer ---------- */
.ghost-stage { flex: none; width: 96px; height: 112px; display: flex; align-items: center; justify-content: center; border-radius: 22px;
  background: radial-gradient(circle at 50% 40%, rgba(224,178,79,.22), rgba(224,178,79,0) 70%); }
.ghost-stage .ghost-svg { animation: ghost-bob 3s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); }
.ghost-stage.mystery { background: radial-gradient(circle at 50% 40%, rgba(154,165,159,.16), rgba(0,0,0,0) 70%); }
@keyframes ghost-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.xp-chip { font-size: 12px; font-weight: 600; color: var(--brass-ink); background: var(--brass-soft); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.ghost-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.gr { position: relative; height: 46px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; }
.gr.current { background: var(--brass-soft); box-shadow: inset 0 0 0 2px var(--brass); }
.gr.busted .ghost-svg { opacity: .55; }
.gr-x { position: absolute; right: 3px; bottom: 2px; font-size: 11px; font-weight: 700; color: var(--win-ink); }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gal { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--panel-2); text-align: center; }
.gal.current { background: var(--brass-soft); box-shadow: inset 0 0 0 2px var(--brass); }
.gal.busted .ghost-svg { opacity: .7; }
.g-name { font-size: 12px; font-weight: 600; line-height: 1.1; }
.g-state { font-size: 11px; color: var(--ink-3); }
.gal.busted .g-state { color: var(--win-ink); }
.gal.current .g-state { color: var(--brass-ink); }
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--panel-2); opacity: .55; }
.badge-tile.on { opacity: 1; background: var(--brass-soft); box-shadow: inset 0 0 0 1px rgba(224,178,79,.5); }
.b-icon { font-size: 26px; line-height: 1.1; }
.b-name { font-weight: 600; font-size: 14px; }
.b-how { font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.rec-row { min-height: 40px; border-top: 1px solid var(--line); }
.rec-row:first-of-type { border-top: 0; }
.xp-card { gap: 6px; }
.xp-big { font-size: 36px; color: var(--brass); line-height: 1; }
.bust-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(6,9,7,.8); display: flex; align-items: center; justify-content: center; padding: 16px; animation: bust-fade .25s ease both; }
.bust { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--brass); border-radius: 24px; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; animation: bust-pop .35s cubic-bezier(.2,.9,.3,1.3) both; }
.bust .btn { width: 100%; }
.bust-ghosts { display: flex; align-items: center; gap: 14px; }
.bust-old { opacity: .45; filter: grayscale(.6); transform: rotate(-8deg); }
.bust-arrow { font-size: 28px; color: var(--brass); }
.bust-new .ghost-svg { animation: ghost-bob 2.4s ease-in-out infinite; }
@keyframes bust-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bust-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ghost-stage .ghost-svg, .bust-new .ghost-svg, .bust, .bust-wrap { animation: none; } }

/* ---------- Big moments ---------- */
.sb-card { position: relative; overflow: visible; }
.ghost-talk { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.gt-ghost { position: relative; flex: none; }
.gt-ghost .ghost-svg { display: block; animation: ghost-bob 3s ease-in-out infinite; }
.gt-bubble { position: relative; display: flex; flex-direction: column; gap: 1px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px 12px; min-width: 0; animation: bubble-in .3s cubic-bezier(.2,.9,.3,1.3) both; }
.gt-bubble::before { content: ''; position: absolute; left: -7px; top: 50%; margin-top: -6px; border: 6px solid transparent; border-right-color: var(--line-2); border-left: 0; }
.gt-text { font-weight: 600; font-size: 15px; }
.ghost-talk.gloat .gt-bubble { border-color: var(--ghost); background: var(--ghost-soft); }
.ghost-talk.gloat .gt-text { color: var(--ghost-ink); }
.ghost-talk.gloat .gt-ghost .ghost-svg { animation: gloat .6s ease-in-out 2; }
.ghost-talk.nervous .gt-ghost .ghost-svg { animation: shiver .12s linear 8; }
.ghost-talk.nervous .gt-bubble { border-color: var(--win); }
.sweat { position: absolute; right: -4px; top: 0; font-size: 13px; animation: drip 1.2s ease-in infinite; }
@keyframes bubble-in { from { opacity: 0; transform: scale(.8) translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes gloat { 0%,100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-8px) rotate(-8deg); } 60% { transform: translateY(-4px) rotate(8deg); } }
@keyframes shiver { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes drip { 0% { opacity: 0; transform: translateY(-2px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }
.xp-pop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--brass); pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,.6); animation: xp-rise 1.3s ease-out both; z-index: 2; }
@keyframes xp-rise { 0% { opacity: 0; transform: translate(-50%, 16px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -40px) scale(1); } }

.finale { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; animation: bust-fade .3s ease both; cursor: pointer; }
.finale.win { background: radial-gradient(circle at 50% 40%, rgba(63,174,118,.32), rgba(63,174,118,0) 70%), #0b0f0d; }
.finale.loss { background: radial-gradient(circle at 50% 45%, rgba(110,60,160,.38), rgba(110,60,160,0) 70%), #09070d; }
.finale-inner { position: relative; z-index: 2; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.finale-inner .btn { width: 100%; margin-top: 8px; }
.finale-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 56px; line-height: .95; }
.finale.win .finale-title { color: var(--brass); animation: title-pop .6s .25s cubic-bezier(.2,.9,.3,1.4) both; }
.finale.loss .finale-title { color: var(--ghost-ink); animation: flicker 1.6s .3s linear both; }
.finale-line { margin: 0; font-size: 16px; color: var(--ink); }
.finale-xp { margin: 0; font-family: var(--display); font-weight: 700; font-size: 32px; color: var(--brass); animation: title-pop .5s .7s both; }
.finale-badge { margin: 0; font-size: 15px; color: var(--brass-ink); background: var(--brass-soft); border-radius: 999px; padding: 6px 14px; animation: title-pop .5s 1s both; }
.finale.win .finale-ghost .ghost-svg { animation: busted 1.4s .1s cubic-bezier(.5,0,.7,.4) both; }
.finale.loss .finale-ghost { position: relative; }
.finale.loss .finale-ghost .ghost-svg { animation: rise .9s cubic-bezier(.2,.9,.3,1.2) both, gloat .7s 1s ease-in-out 3; }
.haha { position: absolute; right: -54px; top: 6px; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ghost-ink); transform: rotate(12deg); animation: title-pop .4s 1s both; }
.cf { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; z-index: 1; animation-name: fall; animation-timing-function: linear; animation-iteration-count: 2; }
@keyframes fall { 0% { top: -20px; opacity: 1; } 100% { top: 105%; opacity: .7; margin-left: 30px; } }
@keyframes busted { 0% { transform: scale(1) rotate(0); opacity: 1; } 35% { transform: scale(1.15) rotate(-10deg); opacity: 1; } 100% { transform: scale(.2) rotate(540deg) translateY(-120px); opacity: 0; } }
@keyframes rise { from { transform: translateY(80px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes title-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes flicker { 0%,18%,22%,52%,56%,100% { opacity: 1; } 0% { opacity: 0; } 20%,54% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .gt-ghost .ghost-svg, .ghost-talk .gt-ghost .ghost-svg, .gt-bubble, .sweat, .xp-pop, .finale, .finale *, .cf { animation: none !important; }
  .cf { display: none; }
}

/* ---------- Ghost health ---------- */
.hp-bar { height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line-2); }
.hp-bar > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #e07a3f, #f09a66); transition: width .4s ease; }
.finale-hp { width: 100%; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); animation: title-pop .5s .5s both; }
.finale.win.hit .finale-ghost .ghost-svg, .finale.win.win .finale-ghost .ghost-svg { animation: hit-shake .5s .2s ease-in-out 2; }
@keyframes hit-shake { 0%,100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-10px) rotate(-8deg); } 40% { transform: translateX(10px) rotate(6deg); } 60% { transform: translateX(-6px) rotate(-4deg); } 80% { transform: translateX(4px); } }

/* ---------- Rematch picker ---------- */
.ghost-pick { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.gp { appearance: none; height: 52px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.gp.locked { border-color: transparent; background: var(--panel-2); opacity: .6; cursor: default; }
.gp[aria-pressed="true"] { border-color: var(--brass); background: var(--brass-soft); }
.gp.current[aria-pressed="false"] { border-style: dashed; border-color: var(--brass); }
button.gr { appearance: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
button.gal { appearance: none; border: 0; font: inherit; color: inherit; cursor: pointer; }

/* ---------- XP shop ---------- */
.shop-mini { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); color: var(--ink); text-decoration: none; }
.shop .slot { width: 40px; height: 40px; border-radius: 10px; border: 2px dashed var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
.shop .slot.on { border: 2px solid var(--brass); background: var(--brass-soft); }
.mull-switch.bonus { border-color: rgba(224,178,79,.6); }

.hp-bar > span.drain { animation: hp-drain 1.2s .6s ease-in-out both; }
@keyframes hp-drain { from { width: var(--from); } to { width: var(--to); } }
@media (prefers-reduced-motion: reduce) { .hp-bar > span.drain { animation: none; } }

/* ---------- Games in progress ---------- */
.paused-item { display: flex; align-items: center; gap: 10px; cursor: default; }
.pz-ghost { flex: none; width: 40px; display: flex; justify-content: center; }
.pz-go { min-height: 40px; padding: 0 14px; font-size: 14px; flex: none; width: auto; }
.pz-x { flex: none; width: 36px; height: 36px; font-size: 22px; color: var(--ink-3); }

/* Straight pool 14.1 rack tracker */
.sp-dots { display: flex; gap: 3px; flex-wrap: nowrap; }
.sp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brass); display: block; }
.sp-dot.gone { background: var(--line); }
.sp-rerack { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--brass); animation: sp-pulse 1.2s ease-in-out 2; }
.sp-rerack-t { font-weight: 700; color: var(--brass); font-size: 15px; letter-spacing: .02em; }
@keyframes sp-pulse { 50% { box-shadow: 0 0 0 4px rgba(212,175,55,.25); } }

/* Scratch */
.scratch-btn { min-height: 44px; border-radius: 12px; background: transparent; border: 1.5px dashed #c8644a; color: #f0a08a; font-weight: 600; font-size: 15px; }
.scratch-btn[aria-pressed="true"] { background: rgba(200, 100, 74, .15); border-style: solid; }
.scratch-btn:disabled { opacity: .45; }
.scratch-note { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(200, 100, 74, .14); border: 1px solid #c8644a; color: #f0a08a; }
.miss-card.scratching { border-color: #c8644a; }
.scratch-btn.tall { min-height: 64px; border-radius: 14px; flex-direction: column; gap: 2px; }
.scratch-btn.tall .sub { color: #f0a08a; opacity: .85; font-weight: 400; }
.seg.miss-mode button.sc[aria-pressed="true"] { background: rgba(200, 100, 74, .22); color: #f0a08a; }
.seg.miss-mode button.sc { color: #f0a08a; }

/* Straight pool: balls-made slider */
.sp-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; touch-action: pan-y; }
.sp-slider::-webkit-slider-runnable-track { height: 10px; border-radius: 6px; background: linear-gradient(to right, var(--brass) 0 var(--p, 0%), var(--line) var(--p, 0%) 100%); }
.sp-slider::-moz-range-track { height: 10px; border-radius: 6px; background: var(--line); }
.sp-slider::-moz-range-progress { height: 10px; border-radius: 6px; background: var(--brass); }
.sp-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; border-radius: 50%; background: #f3efe3; border: 3px solid var(--brass); margin-top: -11px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.sp-slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #f3efe3; border: 3px solid var(--brass); }

/* Swipe-to-clear racks */
.sw-rack { touch-action: none; user-select: none; -webkit-user-select: none; }
.sw-ball { transition: transform .22s ease, opacity .22s ease, background-color .22s ease; }
.sw-ball.gone { transform: scale(.6); opacity: .5; background: transparent !important; color: var(--ink-2) !important; box-shadow: none !important; border: 2px dashed var(--ink-2) !important; }

/* Seals */
.seal-list { display: flex; flex-direction: column; gap: 6px; }
.seal { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.seal.done { opacity: .6; }
.seal.done .seal-t { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.35); }
.seal-ic { font-size: 18px; width: 22px; text-align: center; flex: none; }
.seal-t { font-size: 14px; line-height: 1.3; }
.seal-st { font-size: 12px; color: var(--brass); font-weight: 600; }
.seal-corner { font-size: 12px; font-weight: 700; color: var(--brass); letter-spacing: .03em; animation: sp-pulse 1.2s ease-in-out infinite; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--brass); }
.finale-seal { margin: 0; font-weight: 600; color: var(--brass); font-size: 15px; }
