:root {
  --bg: #232c37;
  --bg2: #1c242e;
  --cell: #eef2f7;
  --ink: #10151b;
  --steel: #55677a;
  --silver: #d7dee8;
  --green: #1f8f4d;
  --green-glow: #63f78f;
  --hit1: #9be86a;
  --hit2: #4cc417;
  --amber: #ffcb4c;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Share Tech Mono", "Courier New", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; } /* beat author display rules (e.g. .stage{display:flex}) */
html { height: 100%; }
body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(99,247,143,.10), transparent 55%),
    linear-gradient(180deg, #2a3542, var(--bg) 42%, var(--bg2));
  color: #eef2f7; font-family: var(--font);
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}

/* reconnect banner */
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--amber); color: #2a1c00; text-align: center;
  font-weight: 700; font-size: 14px; letter-spacing: .04em; padding: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.banner[hidden] { display: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px; }
.brand { font-weight: 800; letter-spacing: .18em; font-size: 20px;
  text-transform: uppercase; text-shadow: 0 0 14px rgba(99,247,143,.35); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px;
  letter-spacing: .14em; color: var(--green-glow); font-weight: 700; }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-glow);
  box-shadow: 0 0 8px var(--green-glow); animation: pulse 1.6s infinite; }
.live.off { color: #8aa; }
.live.off .dot { background: #8aa; box-shadow: none; animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* status line */
.stage { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 8px; }
.statusline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.phase { font-size: 15px; letter-spacing: .1em; text-transform: uppercase; opacity: .92; }
.countdown { font-family: var(--mono); font-size: 15px; color: var(--green-glow);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown.locked { color: var(--amber); }

/* multiplier badge */
.multiwrap { display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 6px; animation: pop .5s ease; }
.multiwrap[hidden] { display: none; }
.multi { font-size: 30px; font-weight: 800; color: #0c0f13;
  background: radial-gradient(circle at 34% 28%, #fff, var(--amber) 70%);
  border-radius: 14px; padding: 4px 14px; box-shadow: 0 0 22px rgba(255,203,76,.6); }
.multilabel { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--amber); }

/* number grid: 10 cols x 8 rows */
.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px;
  background: rgba(255,255,255,.04); padding: 5px; border-radius: 10px;
  border: 1px solid rgba(215,222,232,.16); }
.cell { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  background: var(--cell); color: var(--ink); border-radius: 5px;
  font-weight: 700; font-size: clamp(11px, 3.1vw, 20px); line-height: 1;
  font-variant-numeric: tabular-nums; }
.cell.hit { background: linear-gradient(165deg, var(--hit1), var(--hit2)); color: #0c2f14;
  box-shadow: inset 0 0 8px rgba(0,60,25,.3); }
.cell.latest { background: #0c0f13; color: var(--green-glow);
  box-shadow: 0 0 14px rgba(99,247,143,.65), inset 0 0 8px rgba(99,247,143,.35);
  text-shadow: 0 0 8px rgba(99,247,143,.8); }
.cell.fresh { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.55); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* drawn trays */
.drawn { }
.drawnhead { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.trays { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.slot { aspect-ratio: 1 / 1; border-radius: 50%; border: 1.5px dashed rgba(215,222,232,.35);
  display: flex; align-items: center; justify-content: center; font-size: clamp(10px, 2.7vw, 16px);
  font-weight: 700; color: transparent; }
.slot.filled { border: 1.5px solid #e8eef4; color: #0c0f13;
  background: radial-gradient(circle at 32% 28%, #fff, #d7dee8 62%, #9db0c2); }

/* --- the page scrolls naturally; board / trays / banner / recent stack in order,
   so content can never overlap at any phone height --- */

/* next-game banner (prominent countdown) */
.nextgame { display: flex; align-items: center; justify-content: space-between;
  background: rgba(99,247,143,.07); border: 1px solid rgba(99,247,143,.22);
  border-radius: 12px; padding: 10px 16px; }
.nextgame.locked { background: rgba(255,203,76,.08); border-color: rgba(255,203,76,.3); }
.nextgame.drawing { background: rgba(99,247,143,.13); border-color: var(--green-glow); }
.ngleft { display: flex; flex-direction: column; gap: 2px; }
.nglabel { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; opacity: .75; }
.ngnum { font-weight: 800; font-size: 18px; letter-spacing: .04em; }
.ngclock { font-family: var(--mono); font-size: 32px; font-weight: 700; line-height: 1;
  color: var(--green-glow); font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(99,247,143,.4); }
.nextgame.locked .ngclock { color: var(--amber); text-shadow: 0 0 12px rgba(255,203,76,.4); }

/* recent-results strip — flex-grows to fill remaining height, scrolls if needed */
.recent { display: flex; flex-direction: column; }
.recenthead { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.recentlist { display: flex; flex-direction: column; gap: 6px; }
.rgame { background: rgba(255,255,255,.04); border: 1px solid rgba(215,222,232,.12); border-radius: 10px; padding: 7px 10px; }
.rgame.fresh { animation: pop .5s ease; }
.rgtop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.rgnum { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.rgmult { font-size: 12px; font-weight: 800; color: var(--amber); }
.rgnums { display: flex; flex-wrap: wrap; gap: 4px; }
.rgpill { font-family: var(--mono); font-size: 12px; min-width: 24px; text-align: center;
  padding: 2px 5px; border-radius: 6px; background: rgba(255,255,255,.08); color: var(--silver); }

/* footer + tabs + lure */
.foot { padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); }
/* pin the footer to the bottom on the BOARD view only (uses spare space, so it
   never overlaps when content is tall); on the check view it flows under the header */
body:not(.checking) .foot { margin-top: auto; }
.lure { text-align: center; font-size: 13px; opacity: .85; margin-bottom: 10px; }
.lure strong { color: var(--green-glow); }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; padding: 12px; border: 1px solid rgba(215,222,232,.22); background: rgba(255,255,255,.05);
  color: #eef2f7; border-radius: 10px; font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.tab.active { background: var(--green); border-color: var(--green-glow); color: #04260f; }

/* ticket-check view */
.checkview { padding: 16px; overflow-y: auto; }
.checkinner { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.checktitle { font-size: 20px; letter-spacing: .06em; text-transform: uppercase; text-align: center; }

.btn { padding: 14px; border-radius: 12px; border: 1px solid rgba(215,222,232,.24);
  background: rgba(255,255,255,.06); color: #eef2f7; font-size: 16px; font-weight: 700; letter-spacing: .03em; }
.btn.primary { background: var(--green); border-color: var(--green-glow); color: #04260f; }
.btn.ghost { background: transparent; }
.btn.small { padding: 9px 12px; font-size: 13px; }

.or { text-align: center; opacity: .65; font-size: 13px; }
.manual { display: flex; gap: 8px; }
.manual input { flex: 1; min-width: 0; padding: 13px; border-radius: 12px; border: 1px solid rgba(215,222,232,.24);
  background: rgba(0,0,0,.25); color: #eef2f7; font-family: var(--mono); font-size: 15px; letter-spacing: .04em; }

.scanbox { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanbox .scanline { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px;
  background: var(--green-glow); box-shadow: 0 0 12px var(--green-glow); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0%,100% { top: 22%; } 50% { top: 78%; } }
.scanbox .btn { position: absolute; right: 10px; bottom: 10px; }

.checkmsg { text-align: center; font-size: 14px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); }
.checkmsg.warn { background: rgba(255,203,76,.16); color: var(--amber); }

/* result card */
.result { border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  border: 1px solid rgba(215,222,232,.18); background: rgba(255,255,255,.05); }
.result .verdict { text-align: center; padding: 10px; border-radius: 12px; }
.result .vhead { font-size: 30px; font-weight: 800; letter-spacing: .04em; }
.result .vsub { font-size: 15px; opacity: .9; margin-top: 4px; }
.result.win .verdict { background: linear-gradient(165deg, rgba(76,196,23,.25), rgba(99,247,143,.12)); }
.result.win .vhead { color: var(--green-glow); text-shadow: 0 0 14px rgba(99,247,143,.5); }
.result.lose .vhead, .result.paid .vhead { color: var(--silver); }
.result.wait .vhead { color: var(--amber); }
.tmeta { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 13px; opacity: .85;
  letter-spacing: .04em; text-transform: uppercase; }
.tnums { text-align: center; font-family: var(--mono); font-size: 15px; letter-spacing: .06em;
  background: rgba(0,0,0,.25); border-radius: 10px; padding: 10px; word-spacing: .3em; }
.tresults { width: 100%; border-collapse: collapse; font-size: 14px; }
.tresults th, .tresults td { padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(215,222,232,.12); }
.tresults td:last-child, .tresults th:last-child { text-align: right; }
.ttotal { text-align: center; font-size: 16px; }
.ttotal strong { color: var(--green-glow); font-size: 20px; }

/* "Get the App" page (renders a QR of the app's own live URL) */
.getapp { max-width: 420px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; text-align: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.getapp .brand { font-weight: 800; letter-spacing: .18em; font-size: 20px; text-transform: uppercase;
  text-shadow: 0 0 14px rgba(99,247,143,.35); }
.getapp-h { font-size: 20px; letter-spacing: .06em; text-transform: uppercase; opacity: .95; }
.getapp .qr { width: min(72vw, 300px); background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.getapp .qr svg { width: 100%; height: auto; display: block; }
.getapp .appurl { font-family: var(--mono); font-size: 13px; opacity: .8; word-break: break-all; }
.getapp .btn { width: 100%; max-width: 320px; }
.getapp-tip { font-size: 13px; opacity: .8; line-height: 1.55; }
.getapp-tip strong { color: var(--green-glow); }
.getapp-back { color: var(--silver); font-size: 13px; opacity: .85; text-decoration: none; }
