:root {
  --bg: #120724;
  --bg2: #1d0d33cc;
  --card: #1a0b2ecc;
  --line: #ff5fa255;
  --text: #fff4fb;
  --muted: #d8b9d6;
  --gold: #ffd166;
  --gold2: #ff6fb1;
  --pink: #ff3d9a;
  --teal: #d9a6ff;
  --display: "Anton", Impact, sans-serif;
  --green: #3ddc97;
  --red: #ff5d73;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
#bg { position: fixed; inset: 0; z-index: -1; display: block; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.45 "Space Grotesk", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, p { margin: 0; }
b { font-weight: 700; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; max-width: 1320px; margin: 0 auto;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6 0 12%, transparent 13%), linear-gradient(140deg, var(--gold), var(--gold2));
  box-shadow: 0 0 24px #f6c54466;
}
h1 {
  font: 400 44px/0.95 var(--display); text-transform: uppercase; letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fff6c2 0%, #ffd166 40%, #ff6fb1 75%, #b44cff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1.5px #2a0a3a; paint-order: stroke fill;
  filter: drop-shadow(3px 4px 0 #2a0a3a) drop-shadow(0 0 18px #ff3d9a88);
  transform: rotate(-2deg); transform-origin: left center;
}
.tag { color: var(--text); font-size: 13px; text-shadow: 0 1px 6px #000a; margin-top: 4px; }
.status { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); font-size: 13px; white-space: nowrap;
}
.badge.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1.6s infinite; }
.badge.demo { color: var(--gold); border-color: #f6c54455; }
@keyframes blink { 50% { opacity: .35; } }

.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px;
  max-width: 1320px; margin: 0 auto; padding: 0 28px 40px;
}
.stage {
  position: relative; border-radius: 28px; overflow: hidden;
  background: linear-gradient(180deg, #ffffff10, #12072455);
  border: 1px solid #ffffff30;
  box-shadow: inset 0 1px 0 #ffffff40, 0 30px 80px #0008;
  backdrop-filter: blur(3px);
  min-width: 0;
}
.card {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 #ffffff22, 0 12px 40px #0006;
}
h2 { font: 400 20px var(--display); text-transform: uppercase; letter-spacing: 0.04em; color: var(--gold); text-shadow: 0 0 12px #ffd16655; }
.big { font-family: var(--display) !important; font-weight: 400 !important; letter-spacing: 0.01em; text-shadow: 3px 3px 0 #2a0a3a, 0 0 24px #ffd16666; }
.w-prize { font-family: var(--display); font-weight: 400 !important; text-shadow: 3px 3px 0 #2a0a3a; }
.badge { backdrop-filter: blur(10px); }
canvas#pot { display: block; width: 100%; height: auto; aspect-ratio: 800 / 720; }

.timer {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 120px; z-index: 2;
}
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .track { fill: #0c0a12cc; stroke: var(--line); stroke-width: 7; }
.timer .ring { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 0; transition: stroke-dashoffset .5s linear, stroke .3s; }
.timer-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.timer .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.timer .time { font: 500 28px var(--mono); }
.timer.hurry .ring { stroke: var(--red); }
.timer.hurry .time { color: var(--red); animation: pulse 1s infinite; }
.timer.drawing .ring { stroke: var(--green); }
@keyframes pulse { 50% { transform: scale(1.08); } }

.empty {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%);
  color: var(--muted); text-align: center; pointer-events: none; padding: 0 24px; width: 100%;
}

.winner {
  position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%);
  z-index: 3; text-align: center; padding: 22px 30px; border-radius: 24px;
  background: #0c0a12ee; border: 1px solid #f6c54488; box-shadow: 0 0 60px #f6c54444;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
  max-width: calc(100% - 32px);
}
.w-kicker { color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; }
.w-wallet { font: 500 18px var(--mono); margin: 10px 0 6px; word-break: break-all; }
.w-prize { font-size: 40px; font-weight: 700; color: var(--gold); }
.w-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }

.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px; }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.count { font: 500 13px var(--mono); color: var(--muted); }
.prize { background: linear-gradient(160deg, #ff3d9a55, #1a0b2ecc 65%); border-color: #ffd16688; }
.k { color: var(--muted); font-size: 13px; }
.big { font-size: 52px; font-weight: 700; color: var(--gold); line-height: 1.1; margin: 4px 0; font-variant-numeric: tabular-nums; }
.big small { font-size: 18px; color: var(--text); }
.sub { color: var(--muted); font-size: 13px; }
.rules { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }

ol { list-style: none; margin: 0; padding: 0; }
.players { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.players li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.players .dot { width: 12px; height: 12px; border-radius: 50%; }
.players .w { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .w a { color: inherit; text-decoration: none; }
.players .w a:hover { text-decoration: underline; }
.players .c { font: 500 12px var(--mono); color: var(--gold); text-align: right; }
.players .bar { grid-column: 2 / 4; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: -2px; }
.players .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); }
.players li.new { animation: flash 1.2s; }
@keyframes flash { from { background: #f6c54422; } }

.winners { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.winners li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.winners .w { font-family: var(--mono); }
.winners .p { color: var(--gold); font-weight: 700; text-align: right; }
.winners .m { color: var(--muted); font-size: 12px; }
.winners button {
  justify-self: end; background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; font: inherit; font-size: 12px; padding: 2px 8px; cursor: pointer;
}
.winners button:hover { color: var(--text); border-color: var(--muted); }
.ok { color: var(--green); } .bad { color: var(--red); }
.muted { color: var(--muted); }

.fair summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; }
.fair summary::after { content: "+"; color: var(--muted); }
.fair[open] summary::after { content: "–"; }
.fair p { color: var(--muted); font-size: 13px; margin-top: 10px; }
.fair code { display: block; margin-top: 8px; font: 12px var(--mono); word-break: break-all; color: var(--text); background: var(--bg); padding: 8px 10px; border-radius: 10px; }

.feed { position: fixed; left: 20px; bottom: 20px; display: flex; flex-direction: column-reverse; gap: 8px; z-index: 10; pointer-events: none; }
.toast {
  background: #1a1526f2; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 13px;
  animation: slide .4s ease-out, fade .6s ease-in 4.4s forwards; display: flex; gap: 10px; align-items: center;
}
.toast .dot { width: 10px; height: 10px; border-radius: 50%; }
.toast b { color: var(--gold); }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
@keyframes fade { to { opacity: 0; transform: translateY(6px); } }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding: 0 16px 32px; }
  .top { padding: 14px 16px; }
  .timer { width: 92px; height: 92px; top: 12px; }
  .timer .time { font-size: 22px; }
  .feed { left: 16px; right: 16px; bottom: 16px; }
}
@media (max-width: 520px) {
  .top { flex-direction: column; align-items: flex-start; }
  .status { justify-content: flex-start; }
  .tag { display: none; }
  .w-prize { font-size: 30px; }
  .stage { border-radius: 20px; }
}

/* neon winner card */
.winner {
  background: linear-gradient(160deg, #ff3d9acc, #5b1f6bdd 55%, #1a0b2eee);
  border: 2px solid #ffd166; box-shadow: 0 0 0 4px #2a0a3a, 0 0 60px #ff3d9a99, 0 20px 60px #000a;
  backdrop-filter: blur(10px);
}
.w-kicker { font: 400 18px var(--display); letter-spacing: .08em; color: #fff; text-shadow: 2px 2px 0 #2a0a3a; }
.w-wallet { color: #fff; }
.w-meta { color: #ffe3f1; }
.toast { background: linear-gradient(90deg, #ff3d9add, #5b1f6bdd); border-color: #ffd16688; backdrop-filter: blur(8px); }
.timer .track { fill: #1a0b2edd; stroke: #ffffff30; }
.timer .ring { stroke: #ff4fc0; filter: drop-shadow(0 0 8px #ff2fb0); }
.timer .time { color: #fff; text-shadow: 0 0 10px #ff2fb0; }
.logo { background: radial-gradient(circle at 35% 30%, #fff 0 10%, transparent 11%), radial-gradient(circle at 50% 50%, #ffd166, #ff3d9a 70%, #7b2cbf); box-shadow: 0 0 24px #ff3d9a99; }
.players .bar i { background: linear-gradient(90deg, var(--pink), var(--gold)); }
.players li.muted { display: block; }
canvas#pot { width: auto; max-width: 100%; max-height: calc(100vh - 110px); margin: 0 auto; }
@media (max-width: 960px) { canvas#pot { max-height: none; width: 100%; } }
.stage { align-self: start; position: sticky; top: 12px; }
@media (max-width: 960px) { .stage { position: relative; top: 0; } }

/* pot: 3D WebGL layer under a crisp 2D overlay (confetti, or the whole pot if WebGL is missing) */
.pot-wrap { position: relative; width: 100%; max-width: calc((100vh - 110px) * 800 / 720); aspect-ratio: 800 / 720; margin: 0 auto; }
.pot-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-height: none !important; margin: 0; }
#pot3d { pointer-events: none; }
@media (max-width: 960px) { .pot-wrap { max-width: none; } }

/* big jackpot counter on the stage */
.jackpot-badge {
  position: absolute; top: 18px; left: 20px; z-index: 2;
  display: flex; flex-direction: column; line-height: 1; padding: 12px 16px 10px; border-radius: 16px;
  background: linear-gradient(160deg, #ff3d9acc, #5b1f6bcc); border: 2px solid #ffd166;
  box-shadow: 0 0 0 3px #2a0a3a, 0 0 30px #ff3d9a88; transform: rotate(-3deg);
}
.jackpot-badge span { font: 400 14px var(--display); letter-spacing: .14em; text-transform: uppercase; color: #fff; }
.jackpot-badge b { font: 400 40px var(--display); color: var(--gold); text-shadow: 3px 3px 0 #2a0a3a, 0 0 20px #ffd16688; font-variant-numeric: tabular-nums; margin-top: 4px; }
.jackpot-badge small { font: 400 13px var(--display); color: #fff; letter-spacing: .1em; }
.tag b { color: var(--gold); }
@media (max-width: 960px) { .jackpot-badge { top: 12px; left: 12px; padding: 8px 12px; } .jackpot-badge b { font-size: 26px; } }
@media (max-width: 520px) { .tag { display: block; font-size: 12px; } h1 { font-size: 34px; } }

/* ---------- 3D roulette stage ---------- */
.stage { height: min(78vh, 760px); min-height: 460px; }
#scene, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#scene { cursor: grab; touch-action: none; }
#scene.grabbing { cursor: grabbing; }
#fx { pointer-events: none; z-index: 1; }
.tip {
  position: absolute; z-index: 4; pointer-events: none; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; border-radius: 12px; background: #1a0b2eee; border: 1px solid #ffd16688;
  box-shadow: 0 8px 30px #0008; font-size: 13px; white-space: nowrap;
}
.tip b { font: 500 14px var(--mono); color: var(--gold); }
.tip span { color: var(--muted); font-size: 12px; }
.hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  font-size: 12px; color: #ffffffb0; background: #0006; padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.no3d { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
.winner { top: auto; bottom: 56px; transform: translateX(-50%); }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
@media (max-width: 960px) { .stage { height: 70vh; min-height: 380px; } .hint { font-size: 11px; } }
[hidden] { display: none !important; }

/* ---------- casino emotions: calls, countdown, flash, shake, sound button ---------- */
.sound-btn {
  position: absolute; top: 18px; right: 18px; z-index: 5; font: 500 13px "Space Grotesk", sans-serif; color: #fff;
  background: #1a0b2ecc; border: 1px solid #ffd16688; border-radius: 999px; padding: 8px 14px; cursor: pointer; backdrop-filter: blur(8px);
}
.sound-btn.off { animation: nudge 2.4s infinite; border-color: #ff4fc0; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 #ff4fc000; } 50% { box-shadow: 0 0 0 6px #ff4fc055; } }
.call {
  position: absolute; left: 50%; top: 34%; z-index: 4; pointer-events: none; white-space: nowrap;
  font: 400 clamp(34px, 6vw, 76px) var(--display); text-transform: uppercase; letter-spacing: .03em;
  background: linear-gradient(180deg, #fff6c2, #ffd166 45%, #ff6fb1); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px #2a0a3a; paint-order: stroke fill; filter: drop-shadow(4px 5px 0 #2a0a3a) drop-shadow(0 0 30px #ff2fb0aa);
  opacity: 0; transform: translate(-50%, -50%) scale(.7);
}
.call.show { animation: callIn 2.2s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.call.hot { background-image: linear-gradient(180deg, #fff, #ff8a8a 50%, #ff2d55); }
.call.jackpot { font-size: clamp(56px, 11vw, 140px); top: 30%; }
.call.jackpot.show { animation: callIn 3.2s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes callIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(-4deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) rotate(-2deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.02) rotate(-2deg); }
}
.big-count {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  font: 400 clamp(120px, 22vw, 260px) var(--display); color: #ffffff; opacity: 0; mix-blend-mode: overlay;
}
.big-count.on { opacity: .35; }
.big-count.beat { animation: thump 1s ease-out; }
@keyframes thump { 0% { transform: translate(-50%, -50%) scale(1.25); opacity: .6; } 100% { transform: translate(-50%, -50%) scale(1); } }
.vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; box-shadow: inset 0 0 0 0 #ff2d5500; transition: box-shadow .4s; border-radius: inherit; }
.vignette.on { box-shadow: inset 0 0 120px 10px #ff2d5555; }
.vignette.beat { animation: pulseRed 1s ease-out; }
@keyframes pulseRed { 0% { box-shadow: inset 0 0 180px 40px #ff2d5599; } 100% { box-shadow: inset 0 0 120px 10px #ff2d5555; } }
.flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(circle at 50% 55%, #fff8e0, #ffd16688 40%, transparent 75%); opacity: 0; }
.flash.go { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.stage.shake { animation: shake .6s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 3px); } 40%, 60% { transform: translate(6px, -3px); }
}
@media (max-width: 960px) { .sound-btn { top: auto; bottom: 48px; right: 12px; } }
@media (prefers-reduced-motion: reduce) { .stage.shake, .call.show, .big-count.beat { animation: none; } .call.show { opacity: 1; transform: translate(-50%, -50%); } }
