/* GAME LAYER · styles for the board screens, celebrations and dialogs. Dark by design (the abyss). */
:root {
  --void: #030308; --board: #07070f; --ink: #e8eaf4; --muted: #767c96; --line: rgba(130, 140, 200, 0.18); --panel: rgba(9, 10, 19, 0.97);
  --hot: #ff5a2e; --win: #ffd36b; --loss: #b34cff; --ok: #6fe39a;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--void); color: var(--ink); font-family: var(--mono); overflow: hidden; }
canvas.board { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
body.playing canvas.board { cursor: crosshair; }
button { font-family: var(--mono); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

button.go { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.03em; padding: 13px 20px; border: 0; cursor: pointer; color: #120806; background: var(--hot); box-shadow: 0 0 26px rgba(255, 90, 46, 0.35); font-variant-numeric: tabular-nums; white-space: nowrap; }
button.go.cash { background: var(--win); box-shadow: 0 0 30px rgba(255, 211, 107, 0.45); }
button.go.cash.nudge { animation: nudge 1.1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.06); box-shadow: 0 0 46px rgba(255, 211, 107, 0.8); } }
button.go:disabled { background: #1b1c28; color: var(--muted); box-shadow: none; cursor: default; }
button.ghost { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 8px 11px; cursor: pointer; white-space: nowrap; }
button.ghost:hover { border-color: var(--muted); }
button.ghost:disabled { opacity: 0.4; cursor: default; }
.seg { display: flex; flex-wrap: wrap; }
.seg button { font-size: 12px; background: transparent; color: var(--muted); border: 1px solid var(--line); margin-left: -1px; padding: 8px 11px; cursor: pointer; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); position: relative; z-index: 1; background: rgba(232, 234, 244, 0.06); }
.seg button:disabled { opacity: 0.4; cursor: default; }

/* HUD + bottom bar */
.hud { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.hud .mid { text-align: center; flex: 1; min-width: 0; }
.hud .mid b { display: block; font-family: var(--display); font-size: 22px; letter-spacing: 0; color: var(--ink); font-variant-numeric: tabular-nums; text-transform: none; }
.hud .mid .sub { color: var(--muted); font-size: 0.6em; }
.hud .right { text-align: right; }
.hud .right b { display: block; font-size: 16px; color: var(--ink); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.pen { color: var(--loss); }
.bar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; gap: 10px; justify-items: center; padding-top: 10px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: linear-gradient(to top, rgba(3,3,8,0.96) 55%, rgba(3,3,8,0)); z-index: 5; }
.strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 640px; font-variant-numeric: tabular-nums; }
.strip div { border-top: 2px solid var(--line); padding-top: 4px; font-size: 12px; text-align: center; color: var(--muted); }
.strip div span { display: block; font-size: 9px; letter-spacing: 0.08em; }
.strip div span:last-child { margin-top: 2px; }
.strip div.now { border-color: var(--win); color: var(--win); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; justify-content: center; }
.group { display: grid; gap: 5px; }
.group > span { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
button.main { min-width: 210px; }
@media (max-width: 760px) { button.main { min-width: 0; width: 100%; } .controls { width: 100%; } .hud .mid b { font-size: 16px; } .hud { font-size: 10px; } }

/* toast + celebrations */
.toast { position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 900; font-size: clamp(22px, 6vw, 54px); pointer-events: none; opacity: 0; transition: opacity 0.2s ease; white-space: nowrap; z-index: 15; }
.toast.show { opacity: 1; }
#party { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 29; background: radial-gradient(circle at 50% 45%, rgba(255, 226, 160, 0.5), transparent 65%); animation: flash 0.7s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.winbanner { position: fixed; left: 50%; top: 44%; z-index: 31; text-align: center; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(0.6); transition: transform 0.4s cubic-bezier(0.2, 1.6, 0.4, 1), opacity 0.25s; white-space: nowrap; }
.winbanner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.wb-tier { font-family: var(--display); font-weight: 900; line-height: 1; font-size: clamp(34px, 10vw, 92px); color: var(--win); text-shadow: 0 0 34px rgba(255, 211, 107, 0.6); }
.tier-win .wb-tier { font-size: clamp(30px, 8vw, 64px); }
.wb-amt { margin-top: 10px; font-family: var(--display); font-weight: 900; font-size: clamp(24px, 6.5vw, 52px); color: var(--ink); font-variant-numeric: tabular-nums; text-shadow: 0 0 24px rgba(255, 255, 255, 0.35); }
.wb-sub { margin-top: 8px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.tier-mega .wb-tier { color: transparent; background: linear-gradient(90deg, #ffd36b, #fff4cf, #ff8a3d, #ffd36b); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 1.3s linear infinite; text-shadow: none; filter: drop-shadow(0 0 26px rgba(255, 200, 90, 0.75)); }
@keyframes shine { to { background-position: 300% 0; } }
@media (prefers-reduced-motion: reduce) { button.go.cash.nudge, .tier-mega .wb-tier { animation: none; } .winbanner, .toast { transition: none; } }

/* dialogs */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; grid-template-columns: minmax(0, 1fr); overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 20px) max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); background: rgba(3, 3, 8, 0.8); }
.panel { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); padding: 22px; display: grid; gap: 18px; box-sizing: border-box; }
.panel.wide { max-width: 940px; }
.panel > * { min-width: 0; }
.panel h2 { font-family: var(--display); font-size: 20px; margin: 0; }
.panel h3 { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.panel p { margin: 0; font-size: 13px; line-height: 1.6; }
.panel .btns { display: flex; gap: 10px; flex-wrap: wrap; }
.pnote { font-size: 11px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; font-size: 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; font-variant-numeric: tabular-nums; }
.kv .ok { color: var(--ok); } .kv .bad { color: var(--hot); }
table.odds { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.odds th, table.odds td { padding: 5px 4px; text-align: right; border-bottom: 1px solid var(--line); }
table.odds th:first-child, table.odds td:first-child { text-align: left; }
table.odds th { color: var(--muted); font-weight: 400; }

/* tournaments: fill bar, leaderboards, ceremony */
.fill { height: 6px; background: var(--line); overflow: hidden; }
.fill i { display: block; height: 100%; width: 0; background: var(--hot); box-shadow: 0 0 10px var(--hot); }
.panel .hero { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 9vw, 54px); line-height: 1; font-variant-numeric: tabular-nums; }
.promo { font-size: 12px; line-height: 1.5; color: var(--ink); border-left: 2px solid var(--win); padding-left: 10px; }
table.lb { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.lb td { padding: 5px 0; border-bottom: 1px solid var(--line); }
table.lb td:last-child { text-align: right; }
table.lb tr.me td { color: var(--hot); }
table.lb tr.cut td { border-bottom: 1px dashed var(--ok); }
table.lb tr.gap td { color: var(--muted); text-align: center; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 6px; font-size: 9px; letter-spacing: 0.12em; color: #1a1206; background: linear-gradient(90deg, #ffd36b, #fff1c4); font-weight: 700; vertical-align: 1px; }
.result { display: flex; align-items: center; gap: 16px; }
.result .hero .of { font-size: 0.4em; color: var(--muted); }
.rtitle { font-family: var(--display); font-weight: 900; font-size: clamp(18px, 5vw, 26px); letter-spacing: 0.04em; opacity: 0; transform: scale(1.6); transition: opacity 0.25s, transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
.rtitle.show { opacity: 1; transform: scale(1); }
.rtitle.gold { color: transparent; background: linear-gradient(90deg, #ffd36b, #fff4cf, #ff8a3d, #ffd36b); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; animation: shine 1.3s linear infinite; filter: drop-shadow(0 0 18px rgba(255, 200, 90, 0.7)); }
.rtitle.silver { color: #e3e8f3; text-shadow: 0 0 18px rgba(220, 230, 255, 0.5); }
.rtitle.bronze { color: #f0a868; text-shadow: 0 0 18px rgba(240, 160, 100, 0.5); }
.rtitle.paid { color: var(--win); } .rtitle.out, .rtitle.returned { color: var(--muted); }
.medal { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 28px; color: #1a1206; transform: scale(0) rotate(-40deg); transition: transform 0.55s cubic-bezier(0.2, 1.7, 0.4, 1); }
.medal.show { transform: scale(1) rotate(0); }
.medal.gold { background: radial-gradient(circle at 35% 30%, #fff4cf, #ffd36b 45%, #c98a1c); box-shadow: 0 0 34px rgba(255, 200, 90, 0.75); }
.medal.silver { background: radial-gradient(circle at 35% 30%, #ffffff, #c9d1e2 45%, #8992a8); box-shadow: 0 0 26px rgba(220, 230, 255, 0.5); }
.medal.bronze { background: radial-gradient(circle at 35% 30%, #ffd9b0, #e09b5a 45%, #8f4f22); box-shadow: 0 0 26px rgba(240, 160, 100, 0.5); }
.stamp { display: inline-block; font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: 0.08em; color: var(--ok); border: 3px solid var(--ok); padding: 4px 12px; transform: rotate(-6deg) scale(2.2); opacity: 0; animation: stamp 0.45s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; box-shadow: 0 0 22px rgba(111, 227, 154, 0.35); }
@keyframes stamp { to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.nearmiss { color: var(--hot); }
@media (prefers-reduced-motion: reduce) { .rtitle, .medal { transition: none; } .rtitle.gold { animation: none; } .stamp { animation: none; opacity: 1; transform: rotate(-6deg); } }
