:root {
  --bg: #0b1410;
  --panel: #12201a;
  --panel-2: #183026;
  --felt: #0f4d33;
  --felt-edge: #0a3523;
  --text: #e8efe9;
  --muted: #8fa89a;
  --gold: #f2c14e;
  --gold-dark: #c99a2e;
  --red: #d64541;
  --black: #1e2522;
  --green: #2e9e5b;
  --win: #4cd387;
  --lose: #ef7c76;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse at top, #15281f 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Buttons & inputs ---------- */
button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid #2a4a3b;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
button:hover:not(:disabled) { background: #20402f; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--gold); color: #1a1405; border-color: var(--gold-dark); font-weight: 650; }
button.primary:hover:not(:disabled) { background: #f7cf6c; }
button.gold { background: var(--green); border-color: #237a47; font-weight: 650; }
button.big { padding: 11px 26px; font-size: 16px; }
button.mini { padding: 3px 9px; font-size: 13px; }
button.toggle { min-width: 120px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

input, select {
  font: inherit;
  color: var(--text);
  background: #0b1712;
  border: 1px solid #2a4a3b;
  border-radius: 8px;
  padding: 7px 10px;
}
input[type=number] { width: 110px; }
input.short { width: 90px; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px max(16px, 3vw);
  background: rgba(11, 20, 16, .92);
  border-bottom: 1px solid #1f3a2d;
  backdrop-filter: blur(6px);
}
.brand { font-weight: 700; font-size: 18px; color: var(--gold); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.balance { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); padding: 5px 12px; border-radius: 999px; border: 1px solid #2a4a3b; }
.balance-amt { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.content { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #3b1715; color: #ffd9d6; border: 1px solid #7a2c28; padding: 10px 16px; border-radius: 8px; z-index: 50;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login {
  width: min(380px, 100%);
  background: var(--panel); border: 1px solid #23402f; border-radius: var(--radius);
  padding: 28px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}
.login h1 { color: var(--gold); font-size: 24px; margin: 0; }
.login label, .panel label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.login input { width: 100%; }

/* ---------- Lobby ---------- */
.lobby-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-chip { padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.filter-chip.on { background: var(--gold); color: #1a1405; border-color: var(--gold-dark); font-weight: 650; }
.filter-chip.on:hover { background: #f7cf6c; }
.lobby-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tile {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid #23402f; border-radius: var(--radius); color: var(--text);
  transition: transform .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--gold-dark); text-decoration: none; }
.tile-icon { font-size: 30px; flex: none; width: 40px; text-align: center; }
.tile-text { display: grid; gap: 1px; min-width: 0; }
.tile-name { font-weight: 650; font-size: 15px; }
.tile-blurb { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.tile-cat { color: var(--gold-dark); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 560px) {
  .lobby-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 10px; }
  .tile-icon { width: auto; font-size: 22px; line-height: 1.1; }
  .tile-name { font-size: 14px; }
  .tile-blurb { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .tile-cat { display: none; }
  /* One swipeable row of filters instead of wrapping onto two. */
  .lobby-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -10px 10px; padding: 0 10px 2px; scrollbar-width: none; }
  .lobby-filters::-webkit-scrollbar { display: none; }
  .filter-chip { flex: none; padding: 5px 11px; font-size: 13px; }
}

/* ---------- Game chrome ---------- */
.game-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.game-head h2 { margin: 0; }
.game { display: grid; gap: 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.bet-control { display: inline-flex; gap: 8px; align-items: center; }
.bet-control input { font-size: 17px; padding: 9px 12px; }
.bet-control button.mini { min-width: 48px; padding: 9px 14px; font-size: 17px; font-weight: 650; }
.bet-control .label { color: var(--muted); font-size: 13px; }
.status { min-height: 1.6em; text-align: center; font-weight: 600; }
.status.win { color: var(--win); }
.status.lose { color: var(--lose); }
.status.error { color: #ffb4ae; }
.panel { background: var(--panel); border: 1px solid #23402f; border-radius: var(--radius); padding: 16px; }
.panel.narrow { max-width: 420px; display: grid; gap: 12px; }
.panel h3 { font-size: 15px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; margin: 2px; border-radius: 999px; background: var(--panel-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.pill.red { background: var(--red); }
.pill.black { background: #2c3431; }
.pill.green { background: var(--green); }
.history-strip { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; min-height: 26px; }

.paytable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paytable td, .paytable th { padding: 5px 8px; border-bottom: 1px solid #1f3a2d; text-align: left; }
.paytable tr.hit td { background: rgba(242, 193, 78, .18); color: var(--gold); font-weight: 650; }
.num { text-align: right; }
table.history { width: 100%; border-collapse: collapse; }
table.history th, table.history td { padding: 7px 10px; border-bottom: 1px solid #1f3a2d; text-align: left; }
td.win { color: var(--win); }
td.lose { color: var(--lose); }

.felt {
  background: radial-gradient(ellipse at center, #136240 0%, var(--felt) 55%, var(--felt-edge) 100%);
  border: 6px solid #3a2a17; border-radius: 24px; padding: 22px; min-height: 160px;
  display: grid; gap: 18px; justify-items: center; box-shadow: inset 0 0 40px rgba(0, 0, 0, .35);
}
.felt.split { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .felt.split { grid-template-columns: 1fr; } }
.hand-area, .hand { display: grid; gap: 6px; justify-items: center; }
.hand { padding: 8px; border-radius: 10px; }
.hand.active { outline: 2px solid var(--gold); }
.hand-label { font-size: 13px; color: #cfe7d8; font-weight: 600; }

/* ---------- Cards ---------- */
.cards { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 92px; }
.card {
  width: 64px; height: 90px; border-radius: 8px; background: #fbfbf8; color: #111;
  display: grid; place-items: center; align-content: center; gap: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .35); font-weight: 700; user-select: none;
  animation: deal .25s ease-out;
}
.card .rank { font-size: 22px; line-height: 1; }
.card .suit { font-size: 24px; line-height: 1; }
.card.red { color: #c62828; }
.card.back { background: repeating-linear-gradient(45deg, #7d1f1f, #7d1f1f 6px, #942828 6px, #942828 12px); border: 3px solid #fbfbf8; }
.card.small { width: 40px; height: 56px; }
.card.small .rank, .card.small .suit { font-size: 14px; }
.big-cards .card { width: 82px; height: 116px; }
.big-cards .card .rank { font-size: 28px; }
.big-cards .card .suit { font-size: 30px; }
@keyframes deal { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-btn { position: relative; background: none; border: none; padding: 0 0 22px; }
.card-btn:hover:not(:disabled) { background: none; }
.card-btn .hold-tag { position: absolute; bottom: 0; left: 0; right: 0; font-size: 12px; font-weight: 700; color: var(--gold); visibility: hidden; }
/* Video poker: a card marked for replacing drops down, dims, and is labelled. */
.card-btn.swap .hold-tag { visibility: visible; color: #ff8a80; }
.card-btn.swap .card3d { transform: translateY(6px); opacity: .5; }
.card-btn .card3d { transition: transform .15s, opacity .15s; }

/* Flipping cards: a front face and a back face stacked in one grid cell; .down turns it over. */
.card3d { display: inline-grid; perspective: 700px; transition: transform .15s; }
.card3d-inner { display: grid; transform-style: preserve-3d; transition: transform .42s cubic-bezier(.3, .7, .3, 1); }
.card3d-inner.down { transform: rotateY(180deg); }
.card3d-inner > .card { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; animation: none; }
.card3d-inner > .card.back { transform: rotateY(180deg); }
.card3d.dealt { animation: card-slide .32s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes card-slide {
  from { transform: translate(140px, -50px) rotate(14deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.trail { min-height: 60px; }

/* ---------- Chip boards ---------- */
.spot {
  position: relative; display: grid; place-items: center; gap: 2px; padding: 10px 6px;
  background: var(--felt); border: 1px solid #2d7a54; border-radius: 6px; min-height: 48px;
}
.spot:hover:not(:disabled):not([aria-disabled="true"]) { background: #156a45; }
.locked .spot { cursor: not-allowed; }
.spot.red { background: var(--red); border-color: #e46d69; }
.spot.black { background: var(--black); border-color: #3f4a46; }
.spot.green { background: var(--green); }
.spot.hit { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(242, 193, 78, .6); }
.chip-amt:not(:empty) {
  position: absolute; top: -8px; right: -6px; background: var(--gold); color: #1a1405;
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; z-index: 1;
}
.bet-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.bet-row .spot { min-height: 64px; font-weight: 650; }

/* Roulette: wheel on the left, table on the right. Wide screens get the classic horizontal table;
   narrower ones turn it upright so the whole game fits on one phone screen. */
.roulette-layout {
  display: grid; gap: 16px 22px; align-items: start;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  grid-template-areas: "left table" "left info";
}
.roulette-left { grid-area: left; display: grid; gap: 12px; justify-items: center; }
.roulette-table { grid-area: table; }
.roulette-info { grid-area: info; display: grid; gap: 8px; }
.roulette-board {
  display: grid; grid-template-columns: 44px repeat(12, minmax(0, 1fr)) 44px; gap: 4px;
}
.roulette-board .spot { grid-column: var(--wide-col); grid-row: var(--wide-row); min-width: 0; padding: 8px 2px; }
.roulette-wheel {
  width: 100%; max-width: 380px; height: auto; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.roulette-last { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; }
.roulette-result {
  width: 72px; height: 72px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 28px; font-weight: 800; background: var(--panel-2); border: 4px solid var(--gold-dark);
}
.roulette-result.red { background: var(--red); }
.roulette-result.black { background: var(--black); }
.roulette-result.green { background: var(--green); }
.spin-history { display: grid; gap: 10px; }
.spin-history h3 { margin: 0; }
.spin-history p { margin: 0; }
.spin-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; font-variant-numeric: tabular-nums; }
.spin-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
.spin-count { display: grid; justify-items: center; padding: 3px 0; border-radius: 6px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.spin-count.red { background: var(--red); }
.spin-count.black { background: #2c3431; }
.spin-count.green { background: var(--green); }
.spin-count .n { font-size: 11px; opacity: .8; }
.spin-count .k { font-weight: 700; }
.spin-list { display: flex; flex-wrap: wrap; gap: 2px; max-height: 190px; overflow-y: auto; }

@media (max-width: 900px) {
  /* Controls move under the wheel so the upright table can use the full height. */
  .roulette-layout {
    gap: 10px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    grid-template-areas: "left table" "info table";
  }
  .roulette-info .controls { gap: 8px; }
  .roulette-info .bet-control .label { display: none; }
  .roulette-info .bet-control { gap: 6px; }
  .roulette-info .bet-control input { width: 62px; padding: 8px; }
  .roulette-info .bet-control button.mini { min-width: 0; padding: 8px 11px; }
  .roulette-info button.big { padding: 9px 16px; }
  .roulette-info .status { font-size: 14px; }
  /* 14 rows sized to whatever height is left under the top bar and title. */
  .roulette-board {
    --row: clamp(22px, calc((100svh - var(--chrome, 150px) - 39px) / 14), 40px);
    grid-template-columns: 28px 28px repeat(3, 40px);
    grid-template-rows: repeat(14, var(--row));
    gap: 3px;
  }
  .roulette-board .spot {
    grid-column: var(--tall-col); grid-row: var(--tall-row);
    min-height: 0; padding: 0; font-size: 13px; border-radius: 4px;
  }
  .roulette-board .side .spot-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; }
  .roulette-board .chip-amt:not(:empty) { top: -6px; right: -4px; font-size: 10px; padding: 0 4px; }
  .roulette-left { gap: 8px; }
  .roulette-result { width: 52px; height: 52px; font-size: 22px; border-width: 3px; }
  .roulette-last { gap: 6px; }
  .roulette-last .history-strip { max-height: 56px; overflow: hidden; }
  .roulette-help { display: none; }
}
/* Phones: a compact two-line top bar and tighter page padding. */
@media (max-width: 560px) {
  .topbar { padding: 6px 10px; gap: 4px 10px; }
  .brand { font-size: 16px; }
  .topbar nav { gap: 6px 12px; font-size: 14px; }
  .balance { padding: 3px 10px; }
  .balance > .muted { display: none; }
  .content { padding: 10px 10px 12px; }
  .game-head { margin-bottom: 8px; }
  .game-head h2 { font-size: 20px; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sic Bo: an 84-column grid so every section fills one row exactly:
   5 main bets (21+14+14+14+21), 12 doubles/triples (7 each), 14 totals (6 each), 6 singles (14 each). */
/* Row gaps only: 83 column gaps would be wider than a phone, so spots get a small side margin. */
.sicbo-board { display: grid; grid-template-columns: repeat(84, minmax(0, 1fr)); gap: 5px 0; }
.sicbo-board .spot { min-height: 0; min-width: 0; margin: 0 2.5px; padding: 5px 2px; font-size: 13px; line-height: 1.2; }
.sicbo-board .spot-label { white-space: pre-line; }
.sicbo-board .sb-wide { grid-column: span 21; font-weight: 650; }
.sicbo-board .sb-mid { grid-column: span 14; font-weight: 650; }
.sicbo-board .sb-pair { grid-column: span 7; }
.sicbo-board .sb-total { grid-column: span 6; }
.sicbo-board .sb-single { grid-column: span 14; }
.sicbo-felt { min-height: 0; padding: 12px; overflow: hidden; }
.sicbo-dice { gap: 34px; align-items: center; padding-block: 8px 14px; }
.sicbo-dice .die3d { --size: 54px; }
@media (max-width: 700px) {
  /* Phones: doubles and triples 6 a row, totals 7 a row. */
  .sicbo-board .sb-pair { grid-column: span 14; }
  .sicbo-board .sb-total { grid-column: span 12; }
  .sicbo-board .spot { font-size: 12px; padding: 3px 1px; margin: 0 2px; }
  .sicbo-felt { padding: 4px; gap: 0; }
  .sicbo-felt .dice-row { min-height: 0; }
  .sicbo-dice { gap: 24px; padding-block: 6px 10px; }
  .sicbo-dice .die3d { --size: 40px; }
  .sicbo-board .sb-mid, .sicbo-board .sb-wide { font-size: 11px; }
  .game-sicbo .controls { flex-wrap: nowrap; gap: 6px; }
  .game-sicbo .bet-control .label, .sicbo-help { display: none; }
  .game-sicbo .bet-control input { width: 58px; padding: 8px; }
  .game-sicbo .bet-control button.mini { min-width: 0; padding: 8px 10px; }
  .game-sicbo button.big { padding: 9px 16px; }
}

/* ---------- Dice ---------- */
.dice-row { display: flex; gap: 10px; justify-content: center; min-height: 70px; }
.die { font-size: 64px; line-height: 1; color: #fbfbf8; text-shadow: 0 3px 8px rgba(0, 0, 0, .4); }
.dice-row.shaking .die { animation: shake .15s infinite alternate; }
@keyframes shake { from { transform: rotate(-12deg); } to { transform: rotate(12deg) translateY(-4px); } }
.puck { padding: 6px 14px; border-radius: 999px; background: #222; color: #aaa; font-weight: 700; letter-spacing: .05em; }
.puck.on { background: #fbfbf8; color: #111; }
.on-table { display: flex; gap: 6px; min-height: 26px; }

.dice-roll { text-align: center; font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dice-roll.win { color: var(--win); }
.dice-roll.lose { color: var(--lose); }
.dice-slider { width: 100%; accent-color: var(--green); }
.dice-slider.over { accent-color: var(--red); }
.dice-stats { text-align: center; color: var(--muted); }

/* ---------- Slots ---------- */
.reels {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 560px; width: 100%; margin: 0 auto;
  padding: 14px; background: linear-gradient(#2a1a0b, #1a1007); border: 4px solid var(--gold-dark); border-radius: 18px;
}
.reel { display: grid; gap: 8px; }
.reel-cell {
  aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(28px, 7vw, 52px);
  background: #fbf7ec; border-radius: 10px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12);
}
.reel-cell.win { background: #fff1b8; box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(242, 193, 78, .8); }

/* ---------- Keno & Bingo ---------- */
.keno-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.keno-cell { padding: 9px 0; font-variant-numeric: tabular-nums; }
.keno-cell.picked { background: #3e3a17; border-color: var(--gold-dark); color: var(--gold); }
.keno-cell.drawn { background: #26343e; border-color: #4f6b80; }
.keno-cell.hit { background: var(--gold); color: #1a1405; font-weight: 800; }
.keno-pays { text-align: center; }

.bingo-wrap { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
@media (max-width: 640px) { .bingo-wrap { grid-template-columns: 1fr; } }
.bingo-card { display: grid; grid-template-columns: repeat(5, 56px); gap: 4px; justify-content: center; }
.bingo-head { text-align: center; font-weight: 800; color: var(--gold); font-size: 22px; }
.bingo-cell { height: 56px; display: grid; place-items: center; background: #fbf7ec; color: #222; border-radius: 6px; font-weight: 700; font-size: 18px; }
.bingo-cell.marked { background: var(--red); color: #fff; }
.bingo-cell.free { background: var(--green); color: #fff; }
.bingo-called { display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start; }
.ball { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-size: 13px; font-weight: 700; }
.ball.hit { background: var(--red); }

/* ---------- Scratch ---------- */
.scratch-grid { display: grid; grid-template-columns: repeat(3, 100px); gap: 10px; justify-content: center; }
.scratch-cell { height: 100px; border-radius: 12px; font-size: 26px; font-weight: 800; background: #fbf7ec; color: #222; border: 0; }
.scratch-cell.blank { background: #24342c; }
.scratch-cell.covered { background: linear-gradient(135deg, #b9b9b9, #8c8c8c); }
.scratch-cell.covered span { visibility: hidden; }
.scratch-cell.covered:hover { background: linear-gradient(135deg, #cfcfcf, #9c9c9c); }
.scratch-cell.hit { background: var(--gold); }

/* ---------- Crash ---------- */
.crash-stage { position: relative; background: var(--panel); border: 1px solid #23402f; border-radius: var(--radius); overflow: hidden; }
.crash-canvas { width: 100%; height: auto; display: block; }
.crash-mult { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(36px, 9vw, 72px); font-weight: 800; font-variant-numeric: tabular-nums; pointer-events: none; }
.crash-mult.win { color: var(--win); }
.crash-mult.lose { color: var(--lose); }

/* ---------- Plinko ---------- */
.plinko-stage { background: var(--panel); border: 1px solid #23402f; border-radius: var(--radius); padding: 10px; max-width: 660px; width: 100%; margin: 0 auto; }
.plinko-canvas { width: 100%; height: auto; display: block; }
.plinko-slots { display: flex; gap: 2px; }
.plinko-slots .slot { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 5px 0; border-radius: 4px; color: #1a1405; transition: transform .15s; }
.slot.hot { background: #e5534b; color: #fff; }
.slot.warm { background: var(--gold); }
.slot.cold { background: #7f8c87; }
.slot.zero { background: #2b3530; color: #8a9690; }
.slot.bump { transform: translateY(5px); }

/* ---------- Mines ---------- */
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 420px; width: 100%; margin: 0 auto; }
.mine-tile { aspect-ratio: 1; font-size: 30px; background: #24342c; border-color: #35513f; }
.mine-tile.gem { background: #183f2c; }
.mine-tile.mine { background: #3a1d1b; }
.mine-tile.boom { background: var(--red); }
.mine-tile:disabled { opacity: 1; cursor: default; }
.mines-info { text-align: center; color: var(--gold); font-weight: 650; min-height: 1.4em; }

/* ---------- Wheel ---------- */
.wheel-stage { position: relative; display: grid; justify-items: center; }
.wheel-spinner { width: min(420px, 90vw); aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--gold-dark); overflow: hidden; will-change: transform; backface-visibility: hidden; }
.wheel-canvas { display: block; width: 100%; height: 100%; }
.wheel-pointer {
  position: absolute; top: -6px; z-index: 2; width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 28px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5));
}
.spot.w1 { background: #6f5a1e; } .spot.w2 { background: #1f4f74; } .spot.w5 { background: #4a3a7d; }
.spot.w10 { background: #1d6334; } .spot.w20 { background: #7a3d22; } .spot.w40 { background: #7a2522; }

@media (max-width: 560px) {
  .keno-grid { grid-template-columns: repeat(8, 1fr); }
  .bingo-card { grid-template-columns: repeat(5, 48px); }
  .bingo-cell { height: 48px; }
  .scratch-grid { grid-template-columns: repeat(3, 86px); }
  .scratch-cell { height: 86px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}

/* ---------- Chips & admin ---------- */
.banner { background: #2c2610; border: 1px solid var(--gold-dark); color: #f7e3a8; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; }
.mini-link { font-size: 13px; font-weight: 650; padding-left: 4px; }
.admin-link { color: #ffb86b; font-weight: 650; }
.subnav { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.subnav a { padding: 6px 14px; border-radius: 999px; background: var(--panel); border: 1px solid #23402f; color: var(--text); }
.subnav a.on { background: var(--gold); color: #1a1405; border-color: var(--gold-dark); font-weight: 650; }
.subnav a:hover { text-decoration: none; border-color: var(--gold-dark); }
.admin-body { display: grid; gap: 18px; }
.panel.highlight { border-color: var(--gold-dark); box-shadow: 0 0 0 1px rgba(242, 193, 78, .25); }
.section-title { margin-top: 26px; }
main.content > .panel + .panel, main.content > .panel + h3 { margin-top: 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid #2a4a3b; white-space: nowrap; }
table.data td { padding: 7px 8px; border-bottom: 1px solid #1a3227; vertical-align: middle; }
table.data td.num { text-align: right; white-space: nowrap; }
table.data td.win { color: var(--win); }
table.data td.lose { color: var(--lose); }
table.data td.strong { font-weight: 700; color: var(--gold); }
table.data td.note { max-width: 260px; color: var(--muted); overflow-wrap: anywhere; }
table.data td.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
table.data tr.total td { border-top: 2px solid #2a4a3b; font-weight: 650; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.note-input { width: 150px; }
.pill.gold { background: var(--gold); color: #1a1405; }
td.luck { min-width: 210px; }
.meter { position: relative; height: 8px; border-radius: 999px; background: #22352c; overflow: hidden; margin-bottom: 4px; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.meter .fill.good { background: var(--win); }
.meter .fill.mid { background: #8fa89a; }
.meter .fill.bad { background: var(--lose); }
.meter .tick { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #e8efe9; opacity: .6; }
.luck-text { font-size: 13px; font-weight: 600; }
.luck-text.good { color: var(--win); }
.luck-text.bad { color: var(--lose); }

/* ---------- Result banner ---------- */
.outcome {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  display: grid; justify-items: center; align-items: start; padding: 16px; /* top padding set by placeBanner() */
}
.outcome.leaving { opacity: 0; transition: opacity .35s ease; }
.outcome-card {
  position: relative; display: grid; justify-items: center; gap: 2px; text-align: center;
  border-radius: 22px; padding: 18px 34px 20px;
  animation: outcome-pop .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.outcome-label { font-weight: 800; letter-spacing: .08em; }
.outcome-amount { font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05; }
.outcome-sub { font-size: 15px; font-weight: 600; opacity: .9; }

/* Wins: big, gold, glowing. */
.outcome-win .outcome-card, .outcome-big .outcome-card, .outcome-mega .outcome-card {
  background: radial-gradient(ellipse at 50% 0%, #3a2c08 0%, #1b1405 70%);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(242, 193, 78, .18), 0 0 60px rgba(242, 193, 78, .55), 0 20px 60px rgba(0, 0, 0, .6);
}
.outcome-win .outcome-label, .outcome-big .outcome-label, .outcome-mega .outcome-label { color: #ffe08a; font-size: 22px; }
.outcome-win .outcome-amount, .outcome-big .outcome-amount, .outcome-mega .outcome-amount {
  font-size: clamp(48px, 13vw, 84px);
  background: linear-gradient(180deg, #fff6d0 0%, #f2c14e 55%, #c99a2e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #6b4d0c);
}
.outcome-win .outcome-sub, .outcome-big .outcome-sub, .outcome-mega .outcome-sub { color: #f7e3a6; }
.outcome-big .outcome-card, .outcome-mega .outcome-card { animation: outcome-pop .5s cubic-bezier(.2, 1.6, .4, 1) both, outcome-glow 1.1s ease-in-out .5s infinite alternate; }
.outcome-big .outcome-label, .outcome-mega .outcome-label { font-size: 30px; animation: outcome-wiggle .6s ease-in-out .4s 3; }
.outcome-big .outcome-amount { font-size: clamp(56px, 15vw, 100px); }
.outcome-mega .outcome-amount { font-size: clamp(64px, 17vw, 120px); }
.outcome-mega .outcome-label { font-size: 36px; color: #fff; text-shadow: 0 0 18px #f2c14e; }

/* Push and losses: smaller, calmer, no confetti. */
.outcome-push .outcome-card, .outcome-lose .outcome-card {
  padding: 12px 26px 14px; animation: outcome-drop .3s ease-out both;
  background: rgba(20, 28, 25, .94); box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
}
.outcome-push .outcome-card { border: 2px solid #5d7a6b; }
.outcome-push .outcome-label { font-size: 22px; color: var(--text); }
.outcome-lose .outcome-card { border: 2px solid #7a2c28; }
.outcome-lose .outcome-label { font-size: 14px; color: var(--muted); letter-spacing: .04em; }
.outcome-lose .outcome-amount { font-size: 36px; color: var(--lose); }

.confetti { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.confetti i {
  position: absolute; width: 9px; height: 14px; border-radius: 2px; opacity: 0;
  animation: confetti-burst var(--d) cubic-bezier(.15, .7, .3, 1) .05s forwards;
}
.confetti i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }

@keyframes outcome-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes outcome-drop { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes outcome-glow {
  from { box-shadow: 0 0 0 6px rgba(242, 193, 78, .18), 0 0 50px rgba(242, 193, 78, .45), 0 20px 60px rgba(0, 0, 0, .6); }
  to { box-shadow: 0 0 0 10px rgba(242, 193, 78, .28), 0 0 90px rgba(242, 193, 78, .8), 0 20px 60px rgba(0, 0, 0, .6); }
}
@keyframes outcome-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg) scale(1.06); } 75% { transform: rotate(4deg) scale(1.06); } }
@keyframes confetti-burst {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 140px)) rotate(var(--r)); opacity: 0; }
}
table.data.compact { font-size: 13px; }
table.data.compact th { padding: 6px; font-size: 11px; }
table.data.compact td { padding: 4px 6px; }
table.data tr.idle td { opacity: .45; }

/* ---------- Animated background ---------- */
.site-bg { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; pointer-events: none; }
.bg-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.bg-option { display: grid; gap: 2px; text-align: left; padding: 10px 12px; }
.bg-option small { color: var(--muted); font-size: 12px; }
.bg-option.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.account-panels { display: grid; gap: 16px; max-width: 760px; }

/* ---------- High Roll (3D dice) ---------- */
.hr-tray { justify-items: center; gap: 10px; padding-block: 34px 20px; overflow: hidden; }
.hr-dice { display: flex; gap: 48px; perspective: 900px; min-height: 120px; align-items: center; }
/* 3D dice (public/js/dice3d.js): the script moves .die-lift (position, height) and rotates .die-cube. */
.die3d { --size: 84px; position: relative; width: var(--size); height: var(--size); perspective: 700px; }
.die-lift { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.die-cube { position: absolute; inset: 0; transform-style: preserve-3d; }
/* A solid core (three crossed slabs) fills the gaps the rounded faces leave at the edges. */
.die-cube::before, .die-cube::after, .die-core {
  content: ""; position: absolute; inset: 3%; background: #d9d2c3; border-radius: 10%;
}
.die-cube::before { transform: rotateY(90deg); }
.die-cube::after { transform: rotateX(90deg); }
.die-face {
  position: absolute; inset: 0; display: grid; z-index: 1; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 12%; gap: 4%; border-radius: 16%; backface-visibility: hidden;
  background: radial-gradient(circle at 30% 25%, #ffffff, #ece7dc 70%, #d9d2c3);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), inset 0 -4px 8px rgba(0, 0, 0, .12);
}
.die-face span { border-radius: 50%; }
.die-face .pip { background: radial-gradient(circle at 35% 30%, #4a4a4a, #0f0f0f 70%); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.die-face.f1 .pip { background: radial-gradient(circle at 35% 30%, #e0524d, #8e1612 70%); transform: scale(1.25); }
.die-face.f1 { transform: translateZ(calc(var(--size) / 2)); }
.die-face.f6 { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.die-face.f3 { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.die-face.f4 { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.die-face.f2 { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.die-face.f5 { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.die-shadow {
  position: absolute; left: 4%; right: 4%; bottom: -14%; height: 22%; border-radius: 50%; opacity: .55;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .7), transparent 70%); will-change: transform, opacity;
}
.hr-total { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.hr-total.win { color: var(--win); }
.hr-total.lose { color: var(--lose); }
.hr-lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.hr-line { display: grid; justify-items: center; gap: 1px; padding: 8px 6px; }
.hr-line span { color: var(--gold); font-weight: 700; }
.hr-line small { color: var(--muted); font-size: 11px; }
.hr-line.on { background: var(--gold); border-color: var(--gold-dark); }
.hr-line.on strong, .hr-line.on span, .hr-line.on small { color: #1a1405; }
@media (max-width: 560px) {
  .die3d { --size: 58px; }
  .hr-tray { padding-block: 18px 8px; gap: 4px; }
  .hr-dice { gap: 30px; min-height: 80px; }
  .hr-total { font-size: 28px; }
  .hr-lines { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .hr-line { padding: 4px 2px; font-size: 13px; }
  .hr-line small { display: none; }
}

/* ---------- Top bar: Home / Account buttons, name above Sign out ---------- */
.topbar .nav-btn { border: 1px solid #2a4a3b; border-radius: 8px; padding: 5px 12px; background: var(--panel-2); color: var(--text); font-weight: 600; }
.topbar .nav-btn:hover { border-color: var(--gold-dark); text-decoration: none; }
.who { display: inline-grid; justify-items: center; gap: 1px; line-height: 1.1; }
.who-name { font-size: 11px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Spending limits and breaks ---------- */
.limits-panel, .account-panels > .account-panels { display: grid; gap: 12px; }
.limits-panel h3, .limits-panel > p { margin: 0; }
.topbar nav { margin-left: auto; }
.account-panels > .account-panels { gap: 16px; }
.limit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.limit-field { display: grid; gap: 4px; font-size: 14px; color: var(--text); }
.limit-field small { color: var(--muted); font-size: 12px; }
.limit-field input { width: 100%; }
.limit-usage { font-variant-numeric: tabular-nums; }
.limit-usage.near { color: #ffcf7a; }
.limit-pending { margin: 0; padding: 8px 12px; border-radius: 8px; background: #2c2610; border: 1px solid var(--gold-dark); color: #f7e3a8; font-size: 14px; }
.limit-locked { margin: 0; padding: 8px 12px; border-radius: 8px; background: #13283a; border: 1px solid #2f5b80; color: #cfe6ff; font-size: 14px; }
.lock-input { display: flex; gap: 6px; }
.break-row .lock-input input { width: 80px; }
.limit-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.break-body { display: grid; gap: 12px; }
.break-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.break-row .limit-field input { width: 110px; }
.break-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.break-confirm { display: grid; gap: 8px; justify-items: start; padding: 10px 12px; border-radius: 8px; background: #3b1715; border: 1px solid #7a2c28; color: #ffd9d6; }
.break-confirm p { margin: 0; }
.break-now { margin: 0; color: #ffcf7a; font-weight: 600; }
button.danger { background: #a3302a; border-color: #c4453e; color: #fff; font-weight: 650; }
button.danger:hover:not(:disabled) { background: #b8382f; }
@media (max-width: 560px) {
  /* Brand and name/sign-out on the first row, the menu on the second. */
  .topbar .brand { order: 0; flex: 1; }
  .topbar .who { order: 1; }
  .topbar nav { order: 2; width: 100%; margin-left: 0; gap: 5px; font-size: 13px; }
  .topbar .nav-btn { padding: 3px 7px; white-space: nowrap; }
  .topbar .balance { padding: 3px 8px; white-space: nowrap; }
}
.bet-control .bet-max { display: block; font-size: 11px; color: var(--gold); opacity: .8; }
.bet-control .bet-max:empty { display: none; }
