:root {
  /* Charcoal and black with one acid-yellow accent. */
  --bg: #0f1012; --surface: #17181b; --surface-2: #1f2125; --surface-3: #2c2f35; --line: #2a2d33; --deep: #08090a;
  --text: #f5f6f7; --muted: #a3a8b1; --faint: #71767f; --accent: #f1ff14; --accent-ink: #0b0c0d; --win: #2fe08a; --loss: #ff5266; --info: #8b7bff;
  --radius: 12px; --rail: 232px; --font: Inter, "Segoe UI", system-ui, sans-serif; --mono: "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 500 14px/1.5 var(--font); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The page hands focus to <main> after every page change so screen readers start there. It is not a control, so no ring. */
#main:focus { outline: none; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; z-index: 60; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 14px; height: 64px; padding: 0 20px 0 12px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.icon-button { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.icon-button:hover { background: var(--surface-3); color: var(--text); } .icon-button svg { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font: 900 italic 21px/1 var(--font); letter-spacing: .01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; transform: skewX(-8deg); background: linear-gradient(135deg, var(--accent) 0 58%, #c9d600 58%); box-shadow: inset 0 0 0 3px #0000001f; }
.wallet-group { justify-self: center; display: flex; border-radius: 10px; overflow: hidden; background: var(--deep); }
.wallet { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; font-variant-numeric: tabular-nums; }
.wallet strong { font-weight: 700; font-size: 15px; } .wallet .code { color: var(--muted); font-size: 12px; font-weight: 700; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe08a, var(--accent) 60%, #b86f00); box-shadow: inset 0 0 0 2px #ffd56a55; flex: none; }
.wallet-button { height: 40px; padding: 0 16px; background: var(--surface-3); font-weight: 800; }
.wallet-button:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); } .wallet-button:disabled { color: var(--faint); cursor: not-allowed; }
.top-right { display: flex; align-items: center; gap: 10px; }
.profile { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 6px; border-radius: 10px; background: var(--surface-2); font-weight: 700; }
.avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; }

/* Side rail: wide with labels, or a narrow strip of icons */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: calc(100vh - 64px); }
.shell.rail { --rail: 64px; }
.side { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 12px 8px; background: var(--surface); box-shadow: 1px 0 0 var(--line); display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
#nav { display: grid; gap: 8px; }
.nav-group { display: grid; gap: 2px; padding: 6px; border-radius: 12px; background: var(--surface-2); }
.nav-label { margin: 4px 8px 4px; font: 800 10px/1.4 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 9px; border-radius: 8px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link[aria-current=page] { background: var(--accent); color: var(--accent-ink); }
.nav-count { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--deep); color: var(--muted); font-size: 11px; }
.nav-link[aria-current=page] .nav-count { background: #0003; color: inherit; }
.side-note { margin: auto 8px 4px; font-size: 12px; color: var(--faint); }
.shell.rail .nav-link span, .shell.rail .nav-label, .shell.rail .side-note, .shell.rail .nav-count { display: none; }
.shell.rail .nav-link { justify-content: center; padding: 6px; } .shell.rail .nav-group { padding: 4px; }

main { padding: 22px 28px 48px; width: 100%; max-width: 1320px; margin: 0 auto; }
h1 { font: 800 24px/1.2 var(--font); margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font: 800 17px/1.3 var(--font); margin: 0; }
.lede { color: var(--muted); margin: 0 0 20px; max-width: 64ch; }
.primary { min-height: 46px; padding: 10px 18px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; width: 100%; }
.primary:hover:not(:disabled) { filter: brightness(1.08); } .primary:disabled { opacity: .45; cursor: not-allowed; }
.primary.cash { background: var(--win); color: #00241b; }
.ghost { min-height: 40px; padding: 8px 14px; border-radius: 9px; background: var(--surface-3); font-weight: 700; }
.ghost:hover:not(:disabled) { filter: brightness(1.2); } .ghost:disabled { opacity: .45; cursor: not-allowed; }
.win { color: var(--win); } .loss { color: var(--loss); }

/* Lobby */
.promos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.promo { position: relative; overflow: hidden; display: grid; align-content: center; justify-items: start; gap: 6px; min-height: 150px; padding: 20px; border-radius: 14px; background: linear-gradient(120deg, var(--p1), var(--p2)); isolation: isolate; }
.promo:after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #0008, #0000 70%); z-index: -1; }
.promo > svg { position: absolute; right: -10px; bottom: -18px; width: 170px; height: 170px; color: #fff; opacity: .28; z-index: -1; transform: rotate(-10deg); }
.promo strong { font: 800 19px/1.2 var(--font); } .promo span { max-width: 26ch; color: #ffffffd9; font-size: 13px; font-weight: 600; }
.promo .ghost { margin-top: 6px; background: #10141ccc; display: inline-flex; align-items: center; }
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; margin-bottom: 12px; border-radius: 10px; background: var(--deep); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; outline: none; font-weight: 600; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-weight: 800; white-space: nowrap; flex: none; }
.tab svg { width: 18px; height: 18px; } .tab:hover { color: var(--text); background: var(--surface-3); }
.tab[aria-current=page] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.row-head .count { color: var(--muted); font-weight: 700; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: linear-gradient(160deg, var(--t1), var(--t2)); isolation: isolate; transition: transform .15s, box-shadow .15s; }
.tile:before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 30% 18%, #ffffff40, #fff0 46%), repeating-linear-gradient(135deg, #ffffff10 0 12px, #fff0 12px 24px); }
.tile:after { content: ''; position: absolute; inset: 46% 0 0; z-index: -1; background: linear-gradient(#0000, #000a); }
a.tile:hover { transform: translateY(-5px); box-shadow: 0 14px 28px #0007; }
.tile-icon { position: absolute; inset: 9% 16% auto; aspect-ratio: 1; color: #fff; filter: drop-shadow(0 8px 10px #0006); }
.tile-icon svg { width: 100%; height: 100%; fill: currentColor; }
.tile-name { position: absolute; left: 8px; right: 8px; bottom: 26px; text-align: center; font: 900 clamp(15px, 1.500vw, 20px)/1.050 var(--font); letter-spacing: .01em; text-transform: uppercase; text-shadow: 0 2px 0 #0007, 0 0 14px #0006; overflow-wrap: anywhere; }
.tile-tag { position: absolute; left: 0; right: 0; bottom: 9px; text-align: center; font: 800 8px/1 var(--font); letter-spacing: .18em; color: #ffffffb0; }
/* A tile with a picture: a flat bright card, the object large and tilted, the name in heavy white type. */
.tile.has-art { background: linear-gradient(175deg, var(--t1) 0 38%, color-mix(in srgb, var(--t1) 45%, var(--t2)) 100%); }
.tile.has-art:before { background: radial-gradient(circle at 82% 12%, #ffffff3d 0 17%, #fff0 17.500%), radial-gradient(circle at 8% 52%, #ffffff24 0 24%, #fff0 24.500%), radial-gradient(circle at 96% 74%, #00000022 0 22%, #0000 22.500%); }
.tile.has-art:after { inset: 58% 0 0; background: linear-gradient(#0000, color-mix(in srgb, var(--t2) 80%, #000)); opacity: .75; }
.tile-art { position: absolute; left: 50%; top: 5%; width: 80%; aspect-ratio: 1; object-fit: contain; transform: translateX(-50%) rotate(-7deg); filter: drop-shadow(0 12px 10px #0000004d); transition: transform .2s; user-select: none; -webkit-user-drag: none; }
a.tile:hover .tile-art { transform: translateX(-50%) rotate(0deg) scale(1.080); }
.tile.has-art .tile-name { bottom: 25px; font-size: clamp(16px, 1.700vw, 22px); letter-spacing: 0; text-shadow: 0 2px 0 #0000004d; }
.tile.has-art .tile-tag { color: #ffffffd9; }
.winchip .tile-art { top: 12%; width: 76%; transform: translateX(-50%); }
.tile-fav { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; background: #0b0d1299; display: grid; place-items: center; color: #fff; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-fav, .tile-fav:focus-visible, .tile-fav[aria-pressed=true] { opacity: 1; }
.tile-fav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.200; } .tile-fav[aria-pressed=true] svg { fill: var(--loss); stroke: var(--loss); }
.tile.soon { filter: saturate(.35); }
.tile-badge { position: absolute; top: 8px; left: 8px; padding: 3px 7px; border-radius: 6px; background: var(--deep); font: 800 10px/1.2 var(--font); letter-spacing: .06em; }
.wins { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.wins::-webkit-scrollbar { display: none; }
.winchip { display: grid; gap: 2px; flex: none; width: 96px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.winchip .tile { aspect-ratio: 1; border-radius: 10px; } .winchip .tile-icon { inset: 20% 26% auto; } .winchip b { color: var(--win); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 18px 12px; }

/* Game page: one frame with the controls on the left, the game on the right and a strip underneath */
.frame { border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.game { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 600px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: 0 0 0 1px var(--line); }
.controls-wrap { background: var(--surface-2); padding: 14px; display: grid; gap: 14px; align-content: start; }
.controls { display: grid; gap: 14px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--deep); }
.modes button { height: 38px; border-radius: 999px; font-weight: 800; color: var(--muted); }
.modes button[aria-pressed=true] { background: var(--surface-3); color: var(--text); }
.auto-on .controls .primary { display: none; }
.auto-status { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); min-height: 18px; }
.stage { background: radial-gradient(120% 90% at 50% 0%, #1e2126, var(--deep) 70%); min-height: 520px; display: grid; place-items: center; position: relative; overflow: hidden; padding: 16px; }
.frame-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); box-shadow: 0 -1px 0 var(--line); }
.frame-bar .tools { display: flex; gap: 6px; } .frame-bar .right { justify-self: end; }
.frame-bar .mark { font: 900 italic 16px/1 var(--font); color: var(--faint); letter-spacing: .02em; }
.tool { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.tool:hover { background: var(--surface-3); color: var(--text); } .tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.200; }
.tool[aria-pressed=true] svg { fill: var(--loss); stroke: var(--loss); }
.game-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 16px 2px 0; } .game-title p { margin: 0; color: var(--muted); }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.field input, .field select, .field output { min-height: 42px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--deep); color: var(--text); font: 700 14px var(--font); width: 100%; font-variant-numeric: tabular-nums; }
.field output { display: flex; align-items: center; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field input:disabled, .field select:disabled { opacity: .6; }
.stake-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 0; border-radius: 9px; border: 1px solid var(--line); background: var(--deep); overflow: hidden; }
.stake-row:focus-within { border-color: var(--accent); }
.stake-row input { border: 0 !important; border-radius: 0; background: none; }
.stake-row button { min-width: 44px; min-height: 42px; background: var(--surface-3); font-weight: 800; color: var(--muted); box-shadow: -1px 0 0 var(--line); }
.stake-row button:hover { color: var(--text); filter: brightness(1.2); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; padding: 12px; border-radius: 12px; background: var(--surface); }
.big { font: 800 clamp(48px, 9vw, 96px)/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.big-note { margin: 10px 0 0; color: var(--muted); font-weight: 700; text-align: center; min-height: 21px; }
.center { display: grid; justify-items: center; }
.chips { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 1; }
.chip { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font: 800 12px var(--font); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font: 800 11px/1.4 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 8px 12px; }
td { padding: 9px 12px; border-top: 1px solid var(--line); font-weight: 600; } td.num, th.num { text-align: right; }
.bets { margin-top: 16px; } .bets h2 { margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; border-radius: 10px; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line), 0 12px 30px #0008; font-weight: 700; z-index: 70; max-width: min(92vw, 480px); }
.toast.bad { box-shadow: 0 0 0 1px var(--loss), 0 12px 30px #0008; }
.scrim { position: fixed; inset: 64px 0 0; background: #000a; z-index: 20; }

/* Playing cards, shared by the card games */
.pcard { display: inline-grid; place-items: center; align-content: center; gap: 2px; width: 64px; height: 90px; border-radius: 9px; background: #f7f8fb; color: #151a26; box-shadow: 0 4px 12px #0006; font: 800 22px/1 var(--font); flex: none; }
.pcard i { font-style: normal; font-size: 24px; } .pcard.red { color: #e11d48; }
.pcard.back { background: repeating-linear-gradient(45deg, #2c2f35 0 6px, #1f2125 6px 12px); border: 3px solid #f7f8fb; }

/* Fairness */
.fair { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.fair h2 { margin-bottom: 12px; }
.kv { display: grid; gap: 4px; margin-bottom: 12px; } .kv span { color: var(--muted); font-size: 12px; font-weight: 800; }
.kv code, pre { font: 500 12px/1.5 var(--mono); background: var(--deep); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; white-space: pre-wrap; margin: 0; }
.stack { display: grid; gap: 12px; }

@media (max-width: 1000px) {
  .shell, .shell.rail { grid-template-columns: minmax(0, 1fr); --rail: 0px; }
  .side { position: fixed; z-index: 25; left: 0; top: 64px; width: 248px; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; }
  .shell.rail .nav-link span, .shell.rail .nav-label, .shell.rail .side-note, .shell.rail .nav-count { display: revert; }
  .shell.rail .nav-link { justify-content: flex-start; padding: 6px 9px; }
  .promos { grid-template-columns: repeat(3, 78%); overflow-x: auto; scrollbar-width: none; }
  .game { grid-template-columns: minmax(0, 1fr); } .stage { order: -1; min-height: 320px; }
  .fields-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { grid-template-columns: auto auto 1fr auto; padding: 0 10px; gap: 8px; } .wallet { padding: 0 10px; } .wallet .code { display: none; } .profile { padding: 0 6px; } .brand span:last-child, .profile span:last-child, #search-jump { display: none; }
  .wallet-group { justify-self: end; } .wallet-button { padding: 0 10px; } main { padding: 14px 12px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* A small sheet over the page (the name dialog) */
.profile { cursor: pointer; } .profile:hover { background: var(--surface-3); }
.sheet { width: min(92vw, 400px); padding: 22px; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 24px 70px #000c; }
.sheet::backdrop { background: #000000b8; }
.sheet h2 { font: 900 italic 22px/1.150 var(--font); text-transform: uppercase; }
.sheet-note { margin: 0; color: var(--muted); font-size: 13px; }
.form-error { margin: 0; color: var(--loss); font-size: 13px; font-weight: 700; }
.sheet-buttons { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
/* A table wider than a small screen scrolls inside its own box, never the whole page. */
#bets-body { overflow-x: auto; }
@media (max-width: 480px) { #bets-body th, #bets-body td { padding-left: 7px; padding-right: 7px; } }
/* Scroll bars everywhere: slim, dark and rounded, so they sit quietly beside the content instead of a white strip. */
* { scrollbar-width: thin; scrollbar-color: #3a3d45 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3d45; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #565a64; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Fairness: the three steps, a revealed seed with its check, and the list of its bets. */
.fair-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; }
.fair-steps li { counter-increment: step; padding: 12px 14px 12px 46px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--muted); font-size: 13px; position: relative; }
.fair-steps li::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 13px; }
.fair-steps b { color: var(--text); }
.fair-seed { display: grid; gap: 8px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.fair-seed:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; } .fair-seed .kv { margin-bottom: 0; }
.fair-line { margin: 0; color: var(--muted); font-size: 13px; } .fair-line code { color: var(--text); font: 500 12px var(--mono); }
.fair-ok { color: var(--win); font-weight: 700; } .fair-bad { color: var(--loss); font-weight: 700; }
.fair-bets { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.fair-bets tbody tr { cursor: pointer; } .fair-bets tbody tr:hover td { background: #ffffff0d; }
.fair-bets th, .fair-bets td { padding: 6px 10px; }
.profile { position: relative; }
.chip-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 900 11px/18px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg, #000); font-variant-numeric: tabular-nums; }
.chip-badge[hidden] { display: none; }
.frame-bar .frame-links { display: flex; gap: 6px; }
