/* ==========================================================================
   billion.io: pixel UI
   ========================================================================== */
@font-face { font-family: 'Press Start 2P'; src: url(/fonts/press-start-2p.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url(/fonts/silkscreen-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Silkscreen'; src: url(/fonts/silkscreen-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url(/fonts/pixelify-sans.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #050a16;
  --navy: #0a1426;
  --panel: rgba(9, 19, 38, 0.9);
  --panel-solid: #0c1830;
  --line: #1d3156;
  --line-2: #2a4677;
  --text: #e6f1ff;
  --muted: #7f93b5;
  --dim: #4b5f84;
  --cyan: #4fd6ff;
  --pink: #ff4f81;
  --gold: #ffc94a;
  --purple: #b28bff;
  --green: #3ddc84;
  --brown: #c58b52;
  --gray: #5a6782;

  --t-billion: var(--gold);
  --t-jackpot: var(--purple);
  --t-money: var(--green);
  --t-ballpark: var(--cyan);
  --t-change: var(--brown);
  --t-broke: var(--gray);

  --f-display: 'Press Start 2P', ui-monospace, monospace;
  --f-label: 'Silkscreen', ui-monospace, monospace;
  --f-body: 'Pixelify Sans', ui-monospace, monospace;

  --notch: 6px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 16px;
  overflow: hidden;
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#world {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  image-rendering: pixelated;
  z-index: 0;
}
.crt {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.07) 2px 3px),
    radial-gradient(ellipse at center, rgba(0,0,0,0) 62%, rgba(0,0,0,.28) 100%);
  mix-blend-mode: multiply;
}
body.no-crt .crt { display: none; }
.dim {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: rgba(4, 8, 20, 0.66);
  opacity: 0; transition: opacity .8s ease;
}
body.screen-results .dim { opacity: 1; }

/* ---------- pixel boxes ---------------------------------------------------- */
.px-box {
  background: var(--panel);
  clip-path: polygon(
    0 var(--notch), calc(var(--notch) / 2) var(--notch), calc(var(--notch) / 2) calc(var(--notch) / 2), var(--notch) calc(var(--notch) / 2), var(--notch) 0,
    calc(100% - var(--notch)) 0, calc(100% - var(--notch)) calc(var(--notch) / 2), calc(100% - var(--notch) / 2) calc(var(--notch) / 2), calc(100% - var(--notch) / 2) var(--notch), 100% var(--notch),
    100% calc(100% - var(--notch)), calc(100% - var(--notch) / 2) calc(100% - var(--notch)), calc(100% - var(--notch) / 2) calc(100% - var(--notch) / 2), calc(100% - var(--notch)) calc(100% - var(--notch) / 2), calc(100% - var(--notch)) 100%,
    var(--notch) 100%, var(--notch) calc(100% - var(--notch) / 2), calc(var(--notch) / 2) calc(100% - var(--notch) / 2), calc(var(--notch) / 2) calc(100% - var(--notch)), 0 calc(100% - var(--notch)));
}

/* ---------- buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .9em;
  font-family: var(--f-label); font-weight: 700; text-transform: uppercase;
  letter-spacing: .32em;
  background: var(--navy);
  color: var(--text);
  border: 3px solid var(--cyan);
  padding: 18px 24px;
  box-shadow: 0 0 0 3px var(--ink), 0 0 22px rgba(79, 214, 255, .35), inset 0 0 0 2px rgba(79, 214, 255, .12);
  transition: transform .08s steps(2), box-shadow .2s, background .2s;
  touch-action: manipulation;
}
.btn:hover { background: #10213f; box-shadow: 0 0 0 3px var(--ink), 0 0 32px rgba(79, 214, 255, .55), inset 0 0 0 2px rgba(79, 214, 255, .2); }
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .btn-ghost:focus-visible, .icon-btn:focus-visible, .mult-btn:focus-visible { outline: 2px dashed var(--gold); outline-offset: 4px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-main { width: min(610px, 100%); font-size: clamp(16px, 2.2vw, 22px); padding: 20px 24px; }
.btn-main .tri { font-family: var(--f-body); font-size: 1.1em; letter-spacing: 0; }
.btn-pink {
  width: 100%; background: var(--pink); color: #1a0510; border-color: #ff8fb0;
  box-shadow: 0 0 0 3px var(--ink), 0 0 26px rgba(255, 79, 129, .5);
}
.btn-pink:hover { background: #ff6b95; box-shadow: 0 0 0 3px var(--ink), 0 0 36px rgba(255, 79, 129, .7); }
.btn-small { padding: 12px 16px; font-size: 12px; letter-spacing: .25em; }

.btn-ghost {
  font-family: var(--f-label); font-size: 11px; letter-spacing: .25em; text-transform: uppercase;
  background: rgba(10, 20, 38, .55); color: var(--muted);
  border: 1px solid var(--line-2); padding: 9px 12px;
  transition: color .15s, border-color .15s, background .15s;
  touch-action: manipulation;
}
.btn-ghost:hover { color: var(--text); border-color: var(--cyan); background: rgba(16, 33, 63, .8); }

.link-btn {
  background: none; border: 0; padding: 2px 0; color: var(--muted);
  font-family: var(--f-label); font-size: 11px; letter-spacing: .1em; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: rgba(10, 22, 44, .85); border: 2px solid var(--line-2); padding: 0;
  box-shadow: 0 0 0 2px rgba(5, 10, 22, .6);
  transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--cyan); background: #10213f; }
.icon-btn svg { width: 16px; height: 16px; fill: #c6d6f0; shape-rendering: crispEdges; }
.icon-btn.small { width: 30px; height: 30px; }
.corner-left { position: fixed; top: 14px; left: 14px; z-index: 30; }
.corner-right { position: fixed; top: 14px; right: 14px; z-index: 30; display: flex; flex-direction: column; gap: 6px; }
body.screen-play .hide-in-play { display: none; }
body.screen-play .corner-left, body.screen-play .corner-right { top: 74px; }
#btn-sound .ico-off { display: none; }
body.muted #btn-sound .ico-on { display: none; }
body.muted #btn-sound .ico-off { display: block; }

/* ---------- screens -------------------------------------------------------- */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: none;
}
body.screen-title #title,
body.screen-play #play,
body.screen-results #results { display: block; }
.screen.enter { animation: screen-in .5s steps(6) both; }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- title ---------------------------------------------------------- */
.title-hero {
  position: absolute; left: 0; right: 0; top: 34%;
  transform: translateY(-50%);
  text-align: center; padding: 0 16px;
}
.logo {
  position: relative; display: inline-block; margin: 0;
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(42px, 10vw, 104px); letter-spacing: .06em; line-height: 1;
  color: rgba(255, 255, 255, .14);
  -webkit-text-stroke: 3px var(--pink);
  paint-order: stroke fill;
  animation: glitch 6s steps(1) infinite;
}
.logo::after {
  content: attr(data-text);
  position: absolute; left: 5px; top: 3px;
  color: transparent; -webkit-text-stroke: 3px var(--cyan);
  mix-blend-mode: screen; opacity: .9;
  pointer-events: none;
}
@keyframes glitch {
  0%, 91%, 100% { transform: translate(0, 0); clip-path: none; }
  92% { transform: translate(-3px, 0); clip-path: inset(10% 0 55% 0); }
  93% { transform: translate(3px, 0); clip-path: inset(50% 0 10% 0); }
  94% { transform: translate(0, 0); clip-path: none; }
  96% { transform: translate(2px, -1px); }
  97% { transform: translate(0, 0); }
}
.subtitle {
  margin: 28px 0 0; font-family: var(--f-label); font-weight: 700; color: #2fb7e6;
  font-size: clamp(14px, 2vw, 22px); letter-spacing: .6em; padding-left: .6em;
  text-shadow: 0 2px 0 rgba(255,255,255,.6);
}
.tagline {
  margin: 22px 0 0; font-family: var(--f-label); color: #5d7b9c; font-size: clamp(11px, 1.3vw, 14px); letter-spacing: .14em;
}
.title-dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 16px calc(18px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.title-dock > * { width: min(610px, 100%); }
.how { font-family: var(--f-label); font-size: 11px; color: var(--muted); letter-spacing: .25em; text-transform: uppercase; }
.how summary { cursor: pointer; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: '▸ '; }
.how[open] summary::before { content: '▾ '; }
.how-body {
  text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 15px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-2); padding: 12px 16px; margin-top: 8px; line-height: 1.45;
}
.how-body p { margin: 0 0 8px; }
.how-body p:last-child { margin: 0; }
.how-body b { color: var(--gold); font-weight: 600; }
.title-dock .link-btn { text-align: left; }
.dock-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dock-meta { font-family: var(--f-label); font-size: 11px; letter-spacing: .25em; color: var(--muted); }
.dock-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- play ----------------------------------------------------------- */
.hud {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: min(700px, calc(100% - 20px));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
}
.hud-box { padding: 8px 14px 9px; min-width: 120px; display: flex; flex-direction: column; justify-self: start; border: 0; box-shadow: inset 0 0 0 2px var(--line); }
.hud-box.right { justify-self: end; align-items: flex-end; }
.hud-label { font-family: var(--f-label); font-size: 9px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.hud-value { font-family: var(--f-display); font-size: clamp(14px, 2.2vw, 20px); margin-top: 6px; white-space: nowrap; }
.cyan { color: var(--cyan); }
.pink { color: var(--pink); }
.gold { color: var(--gold); }
.hud-progress { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pips { display: flex; gap: 4px; }
.pip { width: 13px; height: 13px; background: #13213d; box-shadow: inset 0 0 0 2px #1f3358; }
.pip.current { background: var(--pink); box-shadow: 0 0 10px rgba(255, 79, 129, .7); animation: pip 1s steps(2) infinite; }
@keyframes pip { 50% { opacity: .55; } }
.pip[data-tier] { box-shadow: none; }
.pip[data-tier="billion"] { background: var(--t-billion); }
.pip[data-tier="jackpot"] { background: var(--t-jackpot); }
.pip[data-tier="money"] { background: var(--t-money); }
.pip[data-tier="ballpark"] { background: var(--t-ballpark); }
.pip[data-tier="change"] { background: var(--t-change); }
.pip[data-tier="broke"] { background: var(--t-broke); }

.prompt {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  padding: 20px 24px 16px;
  box-shadow: inset 0 0 0 2px var(--line);
}
.prompt.deal { animation: deal .55s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes deal { from { transform: translate(-50%, -30px) scale(.96); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.prompt-step { margin: 0 0 12px; font-family: var(--f-label); font-size: 11px; letter-spacing: .35em; color: var(--pink); }
.prompt-main { display: flex; gap: 16px; align-items: center; }
.item-icon {
  flex: 0 0 auto; width: 76px; height: 76px; display: grid; place-items: center;
  background: #0d1d38; box-shadow: inset 0 0 0 2px var(--line-2);
}
.item-icon canvas { width: 60px; height: 60px; image-rendering: pixelated; animation: bob 2.4s steps(4) infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.prompt-q { margin: 0; font-family: var(--f-body); font-weight: 600; font-size: clamp(19px, 2.6vw, 26px); line-height: 1.25; }
.prompt-q span { color: var(--gold); }
.prompt-blurb { margin: 6px 0 0; color: #a9bad6; font-size: 15px; line-height: 1.35; }
.prompt-hint { margin: 14px 0 0; text-align: center; font-family: var(--f-label); font-size: 10px; letter-spacing: .25em; color: var(--muted); }

.guess {
  position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  padding: 14px 18px 12px;
  box-shadow: inset 0 0 0 2px var(--line);
}
.guess.locked { pointer-events: none; opacity: .6; }
.timer { height: 8px; background: #0e1b33; box-shadow: inset 0 0 0 1px var(--line-2); margin-bottom: 12px; }
.timer-fill { height: 100%; width: 100%; background: var(--cyan); transform-origin: left; }
.guess.hurry .timer-fill { background: var(--pink); animation: pip .5s steps(2) infinite; }
.timer-text { margin-left: auto; font-family: var(--f-display); font-size: 12px; color: var(--cyan); }
.guess.hurry .timer-text { color: var(--pink); }
.guess-row { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.money-input {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  background: #050c1a; box-shadow: inset 0 0 0 2px var(--line-2); padding: 0 12px;
}
.money-input:focus-within { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 14px rgba(79, 214, 255, .3); }
.dollar { font-family: var(--f-display); font-size: 20px; color: var(--green); }
.money-input input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text);
  font-family: var(--f-display); font-size: clamp(18px, 3vw, 24px); padding: 14px 0;
}
.money-input input::placeholder { color: #2c3e60; }
.mult { display: flex; gap: 4px; }
.mult-btn {
  width: 46px; font-family: var(--f-display); font-size: 14px;
  background: #0d1d38; border: 2px solid var(--line-2); color: var(--muted);
  touch-action: manipulation;
}
.mult-btn:hover { color: var(--text); border-color: var(--cyan); }
.mult-btn.on { background: var(--green); color: #04220f; border-color: #8ff0bb; }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 12px 0 0; touch-action: pan-y; }
.slider:focus { outline: none; }
.slider::-webkit-slider-runnable-track { height: 8px; background: linear-gradient(90deg, #7a5a2f, var(--green) 45%, var(--cyan) 70%, var(--purple) 88%, var(--gold)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.slider::-moz-range-track { height: 8px; background: linear-gradient(90deg, #7a5a2f, var(--green) 45%, var(--cyan) 70%, var(--purple) 88%, var(--gold)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; background: var(--text); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--cyan); border-radius: 0; }
.slider::-moz-range-thumb { width: 18px; height: 18px; background: var(--text); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--cyan); border-radius: 0; }
.slider-scale { position: relative; height: 14px; font-family: var(--f-label); font-size: 9px; color: var(--dim); margin: 0 11px; }
.slider-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.slider-scale span:nth-child(1) { left: 0; }
.slider-scale span:nth-child(2) { left: 15.38%; }
.slider-scale span:nth-child(3) { left: 38.46%; }
.slider-scale span:nth-child(4) { left: 61.54%; }
.slider-scale span:nth-child(5) { left: 84.62%; }
.slider-scale span:nth-child(6) { left: 100%; }
.guess-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.guess-preview { font-family: var(--f-label); font-size: 12px; color: var(--muted); letter-spacing: .08em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess-preview.has { color: var(--green); }
.btn-lock { padding: 13px 20px; font-size: 13px; flex: 0 0 auto; }

.countdown {
  position: absolute; left: 0; right: 0; bottom: calc(26px + var(--safe-b)); text-align: center; z-index: 5;
}
.countdown p {
  display: inline-block; margin: 0; padding: 10px 18px; background: rgba(5, 10, 22, .55);
  font-family: var(--f-label); font-size: 12px; letter-spacing: .25em; color: #a9bad6;
}
.countdown b { color: var(--cyan); font-size: 16px; }

.reveal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -6%);
  width: min(620px, calc(100% - 24px)); text-align: center;
  padding: 26px 18px;
  background: radial-gradient(ellipse at center, rgba(4, 8, 20, .82) 0%, rgba(4, 8, 20, .55) 55%, rgba(4, 8, 20, 0) 75%);
}
.reveal > * { animation: rise .5s steps(5) both; }
.reveal > *:nth-child(2) { animation-delay: .15s; }
.reveal > *:nth-child(3) { animation-delay: .3s; }
.reveal > *:nth-child(4) { animation-delay: .45s; }
.reveal > *:nth-child(5) { animation-delay: .6s; }
.reveal > *:nth-child(6) { animation-delay: .75s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal-tier {
  margin: 0; font-family: var(--f-label); font-weight: 700; font-size: clamp(26px, 5vw, 40px); letter-spacing: .22em;
  color: var(--tc, var(--gold)); text-shadow: 0 0 18px var(--tc, var(--gold));
}
.reveal[data-tier="billion"] { --tc: var(--t-billion); }
.reveal[data-tier="jackpot"] { --tc: var(--t-jackpot); }
.reveal[data-tier="money"] { --tc: var(--t-money); }
.reveal[data-tier="ballpark"] { --tc: var(--t-ballpark); }
.reveal[data-tier="change"] { --tc: var(--t-change); }
.reveal[data-tier="broke"] { --tc: var(--t-broke); }
.reveal[data-tier="billion"] .reveal-tier { animation: rise .5s steps(5) both, shimmer 1.2s steps(3) .5s infinite; }
@keyframes shimmer { 50% { text-shadow: 0 0 30px var(--gold), 0 0 6px #fff; } }
.reveal-name { margin: 14px 0 0; font-size: clamp(17px, 2.4vw, 21px); font-weight: 600; }
.reveal-prices { display: flex; justify-content: center; gap: clamp(16px, 5vw, 46px); margin-top: 16px; }
.reveal-prices > div { display: flex; flex-direction: column; gap: 6px; }
.reveal-prices .lbl { font-family: var(--f-label); font-size: 9px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.reveal-prices .val { font-family: var(--f-display); font-size: clamp(14px, 2.6vw, 20px); }
.reveal-off { margin: 12px 0 0; font-family: var(--f-label); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.reveal-pts { margin: 12px 0 0; font-family: var(--f-display); font-size: clamp(13px, 2vw, 17px); }
.reveal-pts b { color: var(--tc); font-weight: 400; }
.reveal-fact { margin: 14px auto 0; max-width: 460px; font-family: var(--f-label); font-size: 11px; letter-spacing: .12em; line-height: 1.8; color: #91a4c4; }

.play-dock { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); text-align: center; }
.btn-next { min-width: 200px; font-size: 15px; animation: rise .4s steps(4) .6s both; }

/* ---------- results -------------------------------------------------------- */
#results { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.results-col { width: min(470px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 calc(40px + var(--safe-b)); }
.res-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-left: 40px; }
.logo-sm { font-size: 20px; -webkit-text-stroke-width: 1px; animation: none; }
.logo-sm::after { left: 2px; top: 1px; -webkit-text-stroke-width: 1px; }
.res-meta { font-family: var(--f-label); font-size: 10px; letter-spacing: .25em; color: var(--muted); text-align: right; }
.res-score { display: flex; align-items: baseline; gap: 14px; margin: 20px 0 12px; }
.res-big { font-family: var(--f-display); font-size: clamp(44px, 12vw, 64px); text-shadow: 3px 3px 0 rgba(255, 79, 129, .5); }
.res-alt { font-family: var(--f-label); font-size: 13px; color: var(--cyan); letter-spacing: .1em; }
.res-block { margin: 18px 0 22px; }
.dist { width: 100%; height: 120px; display: block; overflow: visible; }
.dist-axis { position: relative; height: 16px; font-family: var(--f-label); font-size: 9px; color: var(--dim); border-top: 1px solid var(--line-2); }
.dist-axis span { position: absolute; top: 4px; transform: translateX(-50%); }
.dist-axis span.you { color: var(--pink); }
.res-better { margin: 12px 0 0; font-family: var(--f-label); font-size: 11px; letter-spacing: .22em; color: var(--cyan); }
.res-better small { color: var(--muted); font-size: 10px; letter-spacing: .15em; margin-left: 8px; }
.sec-title { margin: 0 0 10px; font-family: var(--f-label); font-size: 11px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; padding-bottom: 6px; border-bottom: 1px dashed var(--line-2); }
.sec-title span { color: var(--dim); font-size: 9px; letter-spacing: .2em; margin-left: 8px; }
.climb { width: 100%; height: auto; display: block; }
.climb text { font-size: 9px; }
.plumb line { animation: plumb-up .8s steps(8) var(--d) both; }
.plumb circle, .plumb g { animation: screen-in .3s steps(3) calc(var(--d) + .7s) both; }
@keyframes plumb-up { from { stroke-dashoffset: 200; stroke-dasharray: 200; } to { stroke-dashoffset: 0; stroke-dasharray: 200; } }
.px-ico { display: block; image-rendering: pixelated; }
.climb text { font-family: 'Silkscreen', monospace; font-size: 10px; fill: var(--dim); }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 28px 74px 1fr; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid rgba(29, 49, 86, .7); font-family: var(--f-label); font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.ledger li .rng { color: var(--lc); }
.ledger li.me { color: var(--text); background: linear-gradient(90deg, rgba(79, 214, 255, .08), transparent); box-shadow: inset 2px 0 0 var(--lc); }
.ledger li.me .desc { font-weight: 700; }
.copy-note { min-height: 18px; margin: 8px 0 0; text-align: center; font-family: var(--f-label); font-size: 10px; color: var(--green); letter-spacing: .2em; }
.card { background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); padding: 18px; }
.card-kicker { margin: 0; font-family: var(--f-label); font-size: 9px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.card-title { margin: 8px 0 12px; font-family: var(--f-label); font-weight: 700; font-size: 20px; color: var(--pink); letter-spacing: .12em; text-transform: uppercase; }
.card-text { margin: 0 0 14px; font-size: 15px; line-height: 1.4; color: #b9c8e0; }
.board { list-style: none; margin: 0 0 14px; padding: 0; }
.board li { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid rgba(29, 49, 86, .7); font-size: 15px; }
.board li.me { background: rgba(255, 79, 129, .1); box-shadow: inset 2px 0 0 var(--pink); }
.board li.board-empty { display: block; border: 0; }
.board li.sep { display: block; text-align: center; color: var(--dim); border: 0; padding: 2px; }
.board .b-rank { font-family: var(--f-label); font-size: 11px; color: var(--muted); }
.board li:nth-child(1) .b-rank { color: var(--gold); }
.board li:nth-child(2) .b-rank { color: #d6e2f5; }
.board li:nth-child(3) .b-rank { color: var(--brown); }
.board .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .b-tiers { display: flex; gap: 2px; }
.board .b-tiers i { width: 7px; height: 7px; display: block; }
.board .b-score { font-family: var(--f-display); font-size: 12px; color: var(--pink); min-width: 38px; text-align: right; }
.board .b-extra { font-family: var(--f-label); font-size: 10px; color: var(--muted); }
.board-empty { color: var(--muted); font-family: var(--f-label); font-size: 11px; letter-spacing: .1em; padding: 12px 0; }
.t-billion { background: var(--t-billion); } .t-jackpot { background: var(--t-jackpot); } .t-money { background: var(--t-money); }
.t-ballpark { background: var(--t-ballpark); } .t-change { background: var(--t-change); } .t-broke { background: var(--t-broke); }
.next-stack { text-align: center; font-family: var(--f-label); font-size: 11px; letter-spacing: .3em; color: var(--muted); margin: 26px 0 14px; }
.res-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- modal ---------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(3, 6, 15, .7); animation: screen-in .25s steps(3) both; }
.modal-panel {
  position: relative; width: min(520px, 100%); max-height: min(86vh, 760px); max-height: min(86dvh, 760px);
  display: flex; flex-direction: column; background: var(--panel-solid);
  box-shadow: inset 0 0 0 2px var(--line-2);
  animation: modal-in .3s steps(4) both;
  --notch: 8px;
}
@keyframes modal-in { from { transform: translateY(16px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px dashed var(--line-2); }
.modal-kicker { margin: 0 0 6px; font-family: var(--f-label); font-size: 9px; letter-spacing: .3em; color: var(--cyan); text-transform: uppercase; }
.modal-head .glitch-title {
  position: relative; margin: 0; font-family: var(--f-display); font-weight: 400;
  font-size: 22px; letter-spacing: .04em; color: #f4f8ff; text-transform: uppercase;
  text-shadow: -2px 0 var(--pink), 2px 0 var(--cyan);
}
.modal-body { padding: 16px 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-body p { line-height: 1.45; color: #c2d0e6; }
.modal-body b { color: var(--gold); font-weight: 600; }

.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.menu-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: #0d1d38; border: 1px solid var(--line-2); padding: 12px 14px;
  font-family: var(--f-label); font-size: 13px; letter-spacing: .2em; text-transform: uppercase;
}
.menu-list button:hover { border-color: var(--cyan); background: #112546; }
.menu-list .m-ico { width: 22px; text-align: center; font-family: var(--f-body); letter-spacing: 0; }
.menu-list small { margin-left: auto; color: var(--muted); font-size: 10px; letter-spacing: .1em; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 10px; background: #0d1d38; border: 1px solid var(--line-2); color: var(--muted);
  font-family: var(--f-label); font-size: 11px; letter-spacing: .25em; text-transform: uppercase;
}
.tabs button.on { color: var(--ink); background: var(--cyan); border-color: var(--cyan); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-family: var(--f-label); font-size: 10px; letter-spacing: .25em; color: var(--muted); text-transform: uppercase; }
.field input {
  background: #050c1a; border: 0; box-shadow: inset 0 0 0 2px var(--line-2); color: var(--text);
  font-family: var(--f-body); font-size: 17px; padding: 12px; outline: 0;
}
.field input:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
.form-err { min-height: 18px; margin: 4px 0 10px; color: var(--pink); font-family: var(--f-label); font-size: 11px; letter-spacing: .05em; }
.form-note { margin: 14px 0 0; font-size: 13px; color: var(--muted) !important; }
.full { width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 18px; }
.stat { background: #0d1d38; box-shadow: inset 0 0 0 1px var(--line-2); padding: 10px; text-align: center; }
.stat b { display: block; font-family: var(--f-display); font-size: 16px; color: var(--text) !important; font-weight: 400; }
.stat span { display: block; margin-top: 6px; font-family: var(--f-label); font-size: 9px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.hist { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin: 0 0 18px; padding: 0 2px; border-bottom: 1px solid var(--line-2); }
.hist i { flex: 1; background: var(--cyan); min-height: 2px; max-width: 16px; }
.hist i.late { background: var(--dim); }

.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 6px; }
.day-btn {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  background: #0d1d38; border: 1px solid var(--line-2); padding: 10px;
}
.day-btn:hover { border-color: var(--cyan); }
.day-btn .d-num { font-family: var(--f-label); font-size: 13px; letter-spacing: .1em; }
.day-btn .d-date { font-family: var(--f-label); font-size: 9px; color: var(--muted); letter-spacing: .1em; }
.day-btn .d-score { font-family: var(--f-display); font-size: 11px; color: var(--pink); margin-top: 2px; }
.day-btn .d-play { font-family: var(--f-label); font-size: 10px; color: var(--cyan); letter-spacing: .2em; margin-top: 2px; }
.day-btn.today { border-color: var(--gold); }

.pack-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pack-btn {
  display: flex; align-items: center; gap: 10px; background: #0d1d38; border: 1px solid var(--line-2); padding: 12px; text-align: left;
  font-family: var(--f-label); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.pack-btn:hover { border-color: var(--cyan); background: #112546; }
.pack-btn canvas { width: 32px; height: 32px; image-rendering: pixelated; flex: 0 0 auto; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle-row span { font-family: var(--f-label); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }
.toggle-row small { display: block; font-family: var(--f-body); font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--muted); margin-top: 4px; }
.switch { width: 54px; height: 28px; background: #13213d; border: 2px solid var(--line-2); position: relative; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--muted); transition: transform .12s steps(2); }
.switch[aria-checked="true"] { background: #0f3a2a; border-color: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(26px); background: var(--green); }

.lb-day { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-family: var(--f-label); font-size: 12px; letter-spacing: .2em; }
.lb-day button { background: #0d1d38; border: 1px solid var(--line-2); width: 34px; height: 30px; }
.lb-day button:disabled { opacity: .3; cursor: default; }

/* ---------- toast ---------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--panel-solid); box-shadow: inset 0 0 0 2px var(--pink); padding: 12px 18px;
  font-family: var(--f-label); font-size: 12px; letter-spacing: .1em; max-width: calc(100% - 32px);
  animation: toast-in .25s steps(3) both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- small screens -------------------------------------------------- */
@media (max-width: 640px) {
  .corner-left { top: 10px; left: 10px; }
  .corner-right { top: 10px; right: 10px; }
  body.screen-play .corner-left, body.screen-play .corner-right { display: none; }
  /* results scroll under fixed buttons; settings and leaderboard live in the menu */
  body.screen-results .corner-right { display: none; }
  .title-hero { top: 30%; }
  .logo { -webkit-text-stroke-width: 2px; }
  .logo::after { left: 3px; top: 2px; -webkit-text-stroke-width: 2px; }
  .subtitle { margin-top: 20px; letter-spacing: .45em; }
  .tagline { padding: 0 10px; line-height: 1.7; }
  .dock-row { flex-direction: column; align-items: stretch; }
  .dock-meta { text-align: center; }
  .dock-btns { justify-content: center; }
  .dock-btns .btn-ghost { flex: 1; padding: 9px 6px; letter-spacing: .15em; font-size: 10px; }
  .btn { letter-spacing: .24em; }
  .hud { top: 8px; gap: 6px; }
  .hud-box { min-width: 0; padding: 6px 10px 7px; }
  .hud-label { font-size: 8px; letter-spacing: .2em; }
  .pip { width: 10px; height: 10px; }
  .pips { gap: 3px; }
  .prompt { top: 66px; padding: 14px 14px 12px; }
  .prompt-step { margin-bottom: 8px; }
  .item-icon { width: 60px; height: 60px; }
  .item-icon canvas { width: 48px; height: 48px; }
  .prompt-main { gap: 12px; }
  .prompt-blurb { font-size: 14px; }
  .prompt-hint { display: none; }
  .guess { padding: 12px 12px 10px; bottom: calc(8px + var(--safe-b)); }
  .mult-btn { width: 40px; }
  .btn-lock { padding: 12px 14px; letter-spacing: .18em; }
  .reveal { top: 42%; }
  .reveal-fact { font-size: 10px; }
  .res-head { padding: 0 34px 0 34px; flex-direction: column; align-items: flex-start; gap: 6px; }
  .res-meta { text-align: left; }
  .pack-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 640px) {
  .prompt-blurb { display: none; }
  .slider-scale { display: none; }
  .title-hero { top: 28%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }

/* ---------- menu (tile grid) ---------------------------------------------- */
.menu-sec { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-family: var(--f-label); font-size: 10px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.menu-sec::after { content: ''; flex: 1; border-top: 1px dashed var(--line-2); }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 76px; padding: 14px 8px;
  background: #0b1730; border: 2px solid var(--line); color: #93a7c9;
  font-family: var(--f-label); font-weight: 700; font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  transition: border-color .15s, color .15s, background .15s; touch-action: manipulation;
}
.menu-tile:hover { border-color: var(--cyan); color: var(--text); background: #0f1f3d; }
.menu-tile.hot { border-color: var(--pink); color: var(--pink); }
.menu-tile.hot:hover { background: #1a1630; }
.menu-tile .menu-ico { width: 18px; height: 18px; }
.menu-card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; margin-top: 12px;
  background: #0b1730; border: 1px solid var(--line-2); padding: 14px 16px; touch-action: manipulation;
}
.menu-card:hover { border-color: var(--cyan); background: #0f1f3d; }
.menu-card span { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.menu-card b { font-family: var(--f-label); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.menu-card small { font-family: var(--f-body); font-size: 13px; color: var(--muted); }
.menu-card i { font-style: normal; font-size: 18px; }
.menu-card.pink b, .menu-card.pink i, .menu-card.pink .menu-ico { color: var(--pink) !important; }
.menu-card.cyan b, .menu-card.cyan i, .menu-card.cyan .menu-ico { color: var(--cyan) !important; }
.menu-foot { margin: 20px 0 0; padding-top: 12px; border-top: 1px dashed var(--line-2); font-family: var(--f-label); font-size: 10px; letter-spacing: .1em; color: var(--muted) !important; }

/* ---------- receipts ("the catch") ---------------------------------------- */
.receipts { list-style: none; margin: 0; padding: 0; }
.receipts li { border-bottom: 1px solid rgba(29, 49, 86, .7); }
.r-row {
  width: 100%; display: grid; grid-template-columns: 18px 20px 1fr auto 14px; gap: 10px; align-items: center;
  background: none; border: 0; padding: 12px 2px; text-align: left; cursor: pointer;
}
.r-row:disabled { cursor: default; }
.r-row:not(:disabled):hover { background: rgba(79, 214, 255, .04); }
.r-num { font-family: var(--f-label); font-size: 10px; color: var(--dim); }
.r-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.r-kick { font-family: var(--f-label); font-size: 9px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-ans { font-weight: 600; font-size: 17px; color: var(--text); }
.r-ans em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--gold); }
.r-sub { font-family: var(--f-label); font-size: 10px; color: var(--muted); letter-spacing: .03em; }
.r-sub b { color: var(--cyan); font-weight: 400; }
.r-pts { font-family: var(--f-display); font-size: 12px; color: var(--tc); }
.r-plus { font-family: var(--f-label); color: var(--dim); text-align: center; }
.receipts li[data-tier="billion"] { --tc: var(--t-billion); }
.receipts li[data-tier="jackpot"] { --tc: var(--t-jackpot); }
.receipts li[data-tier="money"] { --tc: var(--t-money); }
.receipts li[data-tier="ballpark"] { --tc: var(--t-ballpark); }
.receipts li[data-tier="change"] { --tc: var(--t-change); }
.receipts li[data-tier="broke"] { --tc: var(--t-broke); }
.r-more { padding: 4px 4px 16px 48px; animation: screen-in .3s steps(3) both; }
.guess-chart { width: 100%; height: 90px; display: block; border-bottom: 1px solid var(--line-2); }
.guess-axis { position: relative; height: 16px; font-family: var(--f-label); font-size: 9px; color: var(--dim); }
.guess-axis span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.guess-legend { display: flex; gap: 12px; align-items: center; margin: 8px 0 0; font-family: var(--f-label); font-size: 9px; letter-spacing: .15em; color: var(--muted); text-transform: uppercase; }
.guess-legend i { display: inline-block; width: 10px; height: 3px; margin-right: -6px; }
.lg-price { background: var(--gold); } .lg-you { background: var(--pink); } .lg-all { background: var(--cyan); opacity: .6; height: 8px !important; }
.guess-note { margin: 8px 0 0; font-family: var(--f-label); font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.guess-note b { color: var(--cyan); font-weight: 400; }

/* ---------- logbook -------------------------------------------------------- */
.logbook { margin: 0; font-family: var(--f-label); font-size: 11px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; line-height: 1.8; }
.logbook b { color: var(--text); font-weight: 700; }

@media (max-width: 640px) {
  .r-more { padding-left: 8px; }
  .menu-tile { min-height: 72px; letter-spacing: .16em; }
}
