:root {
  --night: #1a0309;
  --wine: #4a0716;
  --red: #d4102f;
  --felt: #0d5a33;
  --felt-dark: #073a20;
  --gold: #ffd75e;
  --gold-deep: #c9971a;
  --cream: #fff6e0;
  --muted: #e9c9a8;
  --line: rgba(255, 215, 94, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(120% 70% at 50% 0%, #6b0b20 0%, var(--wine) 35%, var(--night) 75%) fixed,
    var(--night);
  color: var(--cream);
  font: 16px/1.4 Rubik, system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}
input { -webkit-user-select: text; user-select: text; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px;
  background: linear-gradient(var(--night), rgba(26, 3, 9, 0.85) 70%, transparent);
}
.brand { display: flex; align-items: center; min-height: 44px; text-decoration: none; }
.logo { font: 18px Bungee, sans-serif; letter-spacing: 0.12em; color: var(--gold); }
.logo img { height: 22px; width: auto; display: block; }
.sound {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--line); background: rgba(0, 0, 0, 0.25);
  display: grid; place-items: center; font-size: 20px;
}
.sound span::before { content: "🔕"; }
.sound[data-on="1"] { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 215, 94, 0.5); }
.sound[data-on="1"] span::before { content: "🔔"; }

main { max-width: 540px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); position: relative; }

/* the marquee with chasing bulbs */
.marquee {
  position: relative; margin: 8px 0 18px; padding: 26px 18px 22px; text-align: center;
  border-radius: 22px;
  background: linear-gradient(160deg, #8f0f26, #5a0715 60%, #3a040e);
  border: 3px solid var(--gold-deep);
  box-shadow: 0 0 0 4px #2a0309, 0 0 36px rgba(255, 60, 80, 0.35), inset 0 0 30px rgba(0, 0, 0, 0.45);
}
.bulbs { position: absolute; inset: 6px; pointer-events: none; }
.bulb {
  position: absolute; width: 9px; height: 9px; margin: -4.5px; border-radius: 50%;
  background: #6b4a10; animation: chase 1.2s infinite steps(1);
}
.bulb:nth-child(3n + 1) { animation-delay: 0s; }
.bulb:nth-child(3n + 2) { animation-delay: 0.4s; }
.bulb:nth-child(3n) { animation-delay: 0.8s; }
@keyframes chase {
  0% { background: #fff4c2; box-shadow: 0 0 10px 3px rgba(255, 215, 94, 0.9); }
  33%, 100% { background: #7a5410; box-shadow: none; }
}
.marquee h1 {
  margin: 0; font: 46px/0.95 "Bungee Shade", Bungee, sans-serif; color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 215, 94, 0.55);
}
.marquee h1 .sevens { display: block; font-size: 54px; color: #fff1b0; animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { text-shadow: 0 0 28px #ffd75e, 0 0 6px #fff; transform: scale(1.04); } }
.marquee p { margin: 10px 0 0; color: var(--muted); }
.marquee.small { padding: 18px 16px; }
#mq.hang { margin-bottom: 76px; }
.marquee.small h1 { font-size: 32px; }

.baubles { position: absolute; left: 0; right: 0; top: 100%; height: 0; z-index: 3; }
.string { position: absolute; width: 2px; background: var(--gold-deep); transform-origin: top center; }
.bauble {
  position: absolute; width: 38px; height: 38px; margin: -19px; border-radius: 50%;
  touch-action: none; cursor: grab;
  box-shadow: inset -6px -8px 12px rgba(0, 0, 0, 0.35), inset 6px 6px 10px rgba(255, 255, 255, 0.45);
}
.bauble::before {
  content: ""; position: absolute; left: 50%; top: -6px; width: 12px; height: 8px; margin-left: -6px;
  border-radius: 3px; background: var(--gold-deep);
}
.bauble.gone { transform: scale(0) !important; transition: transform 0.15s; }
.bauble.back { animation: grow 0.5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes grow { from { scale: 0; } }

/* countdown */
.count { display: flex; justify-content: center; gap: 8px; margin: 34px 0 6px; }
.count div { text-align: center; }
.count b {
  display: block; min-width: 62px; padding: 8px 6px; border-radius: 10px;
  font: 32px/1 Bungee, sans-serif; color: var(--gold);
  background: linear-gradient(#200207 49%, #000 51%); border: 1px solid var(--line);
}
.count small { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.lead { text-align: center; color: var(--muted); margin: 0 0 18px; }
.lead strong { color: var(--cream); }

/* slot machine */
.slot {
  display: flex; align-items: center; gap: 12px; margin: 22px 0;
  padding: 14px; border-radius: 20px;
  background: linear-gradient(#2b2b2b, #0e0e0e); border: 3px solid var(--gold-deep);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.15);
}
.reels { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reel {
  height: 76px; overflow: hidden; border-radius: 10px;
  background: linear-gradient(#cfc6b0, #fffaf0 30%, #fffaf0 70%, #cfc6b0);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.35), inset 0 -6px 10px rgba(0, 0, 0, 0.35);
}
.strip { display: flex; flex-direction: column; will-change: transform; }
.sym { height: 76px; display: grid; place-items: center; font-size: 40px; }
.sym.seven { font: 46px Bungee, sans-serif; color: var(--red); text-shadow: 2px 2px 0 var(--gold-deep); }
.lever { width: 44px; height: 120px; position: relative; touch-action: none; cursor: grab; flex: none; }
.lever .rod { position: absolute; left: 19px; top: 18px; width: 6px; height: 84px; border-radius: 3px; background: linear-gradient(90deg, #888, #eee, #888); transform-origin: bottom center; }
.lever .knob {
  position: absolute; left: 2px; top: 0; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7b8f, var(--red) 55%, #6d0516);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.lever .base { position: absolute; left: 10px; bottom: 0; width: 24px; height: 18px; border-radius: 6px; background: #555; }
.slot-say { text-align: center; min-height: 22px; margin: -12px 0 18px; color: var(--gold); font: 15px Bungee, sans-serif; letter-spacing: 0.04em; }

/* buttons and tiles */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px;
  margin: 10px 0; padding: 12px 18px; border: 0; border-radius: 16px; text-decoration: none;
  font: 18px Bungee, sans-serif; letter-spacing: 0.03em; color: #3a0510;
  background: linear-gradient(#ffe68f, var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 5px 0 #8a640c, 0 10px 24px rgba(0, 0, 0, 0.4);
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #8a640c; }
.btn.ghost { background: rgba(0, 0, 0, 0.25); color: var(--gold); border: 2px solid var(--line); box-shadow: none; font-size: 15px; min-height: 48px; }

h2 { font: 20px Bungee, sans-serif; color: var(--gold); margin: 28px 0 10px; letter-spacing: 0.02em; }
.pools { display: grid; gap: 12px; }
.tile {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 14px 16px;
  border-radius: 18px; text-decoration: none; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #13804a, var(--felt) 45%, var(--felt-dark));
  border: 2px solid var(--line); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.tile:active, .tile.press { transform: scale(0.97) rotate(-0.6deg); }
.tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.18) 45%, transparent 60%);
  transform: translateX(-120%); animation: shine 5s infinite;
}
.tile:nth-child(2)::after { animation-delay: 0.7s; }
.tile:nth-child(3)::after { animation-delay: 1.4s; }
.tile:nth-child(4)::after { animation-delay: 2.1s; }
.tile:nth-child(5)::after { animation-delay: 2.8s; }
.tile:nth-child(6)::after { animation-delay: 3.5s; }
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.tile .t { flex: 1; min-width: 0; }
.tile .t b { display: block; font: 20px Bungee, sans-serif; color: var(--cream); }
.tile .t small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.chip {
  flex: none; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; text-align: center;
  font: 13px/1.1 Bungee, sans-serif; color: #fff;
  background: repeating-conic-gradient(var(--red) 0 22.5deg, #fff 22.5deg 30deg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
  animation: wobble 6s ease-in-out infinite;
}
.chip i { font-style: normal; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--red); border: 2px dashed rgba(255, 255, 255, 0.7); }
.chip.gold { background: repeating-conic-gradient(var(--gold-deep) 0 22.5deg, #fff 22.5deg 30deg); }
.chip.gold i { background: var(--gold-deep); }
@keyframes wobble { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-12deg); } 96% { transform: rotate(10deg); } }
.tile.uk { background: radial-gradient(120% 140% at 0% 0%, #1f4f9c, #133672 45%, #0a1f45); }
.tile.grand { background: radial-gradient(120% 140% at 0% 0%, #b8860b, #7a5410 45%, #3d2a05); }
.tile.pot { background: radial-gradient(120% 140% at 0% 0%, #b5163a, #7d0c22 50%, #44040f); }

.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--gold); text-decoration: none; font-weight: 600; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin: 12px 0; }
.foot { color: var(--muted); font-size: 13px; text-align: center; margin-top: 28px; }
.foot a { color: var(--gold); }
.preview { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 99px; background: rgba(255, 215, 94, 0.15); color: var(--gold); font-size: 13px; }

/* pool page */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; min-height: 44px; padding: 6px 14px; border-radius: 99px; border: 2px solid var(--line);
  background: rgba(0, 0, 0, 0.25); font-size: 14px; font-weight: 600; color: var(--muted);
}
.pill small { display: block; font-size: 13px; font-weight: 400; }
.pill[aria-pressed="true"] { background: var(--gold); color: #3a0510; border-color: var(--gold); }
.pill:disabled { opacity: 0.4; }
.pill .live { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #3dff8a; box-shadow: 0 0 8px #3dff8a; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 8px 0 18px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); }
.tab { min-height: 48px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); line-height: 1.15; }
.tab[aria-selected="true"] { background: var(--red); color: #fff; box-shadow: 0 0 14px rgba(212, 16, 47, 0.6); }

.board { touch-action: pan-y; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin-top: 8px; }
.step { text-align: center; cursor: pointer; }
.step .who { padding: 0 2px 8px; animation: rise 0.6s cubic-bezier(.3, 1.5, .5, 1) both; }
.step:nth-child(1) .who { animation-delay: 0.25s; }
.step:nth-child(3) .who { animation-delay: 0.4s; }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(0.8); } }
.medal {
  width: 46px; height: 46px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  font: 20px Bungee, sans-serif; color: #3a0510;
  background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 50%, var(--gold-deep));
  box-shadow: 0 0 16px rgba(255, 215, 94, 0.6);
}
.p2 .medal { background: radial-gradient(circle at 35% 30%, #fff, #cfd6dd 50%, #8b97a3); box-shadow: 0 0 12px rgba(220, 230, 240, 0.5); }
.p3 .medal { background: radial-gradient(circle at 35% 30%, #ffd9b0, #d08a4b 50%, #8a4f1d); box-shadow: 0 0 12px rgba(208, 138, 75, 0.5); }
.p1 .medal { width: 56px; height: 56px; font-size: 24px; animation: glow 1.6s ease-in-out infinite; }
.who b { display: block; font-size: 15px; line-height: 1.15; overflow-wrap: anywhere; }
.who small { display: block; font-size: 13px; color: var(--muted); }
.who .val { display: block; margin-top: 4px; font: 16px Bungee, sans-serif; color: var(--gold); }
.block {
  border-radius: 12px 12px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px;
  background: linear-gradient(#1b7a48, var(--felt-dark)); border: 2px solid var(--line); border-bottom: 0;
  transform-origin: bottom; animation: up 0.7s cubic-bezier(.3, 1.4, .5, 1) both;
}
@keyframes up { from { transform: scaleY(0); } }
.p1 .block { height: 120px; background: linear-gradient(var(--red), #6d0516); }
.p2 .block { height: 88px; }
.p3 .block { height: 66px; }
.prize { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--gold); color: #3a0510; font: 13px Bungee, sans-serif; }
.prize.none { background: rgba(0, 0, 0, 0.3); color: var(--muted); font: 600 13px Rubik, sans-serif; }
.empty { opacity: 0.45; }
.rows { margin-top: 14px; border-radius: 16px; overflow: hidden; border: 2px solid var(--line); background: rgba(0, 0, 0, 0.25); }
.row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; }
.row + .row { border-top: 1px solid rgba(255, 215, 94, 0.15); }
.row .n { font: 18px Bungee, sans-serif; color: var(--muted); width: 26px; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; overflow-wrap: anywhere; }
.row .t small { color: var(--muted); font-size: 13px; }
.row .v { text-align: right; font: 15px Bungee, sans-serif; color: var(--gold); }
.row .v small { display: block; font: 13px Rubik, sans-serif; color: var(--muted); }
.row.me { background: rgba(255, 215, 94, 0.14); }

/* rolling digits */
.roll { display: inline-flex; height: 1.1em; line-height: 1.1em; overflow: hidden; vertical-align: bottom; }
.roll .d { display: inline-block; height: 1.1em; overflow: hidden; }
.roll .d > span { display: flex; flex-direction: column; transition: transform 1.4s cubic-bezier(.2, .9, .25, 1.05); }
.roll .d > span > span { height: 1.1em; }

/* pot */
.search { width: 100%; min-height: 56px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--gold-deep); background: #0e0204; color: var(--cream); font: 18px Rubik, sans-serif; }
.search::placeholder { color: #9a7d6a; }
.found { margin-top: 10px; border-radius: 16px; overflow: hidden; border: 2px solid var(--line); }
.found button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 8px 14px; border: 0; background: rgba(0, 0, 0, 0.3); text-align: left; }
.found button + button { border-top: 1px solid rgba(255, 215, 94, 0.15); }
.found small { color: var(--muted); font-size: 13px; }
.jackpot { text-align: center; margin: 10px 0 6px; padding: 20px 12px; border-radius: 22px; background: linear-gradient(160deg, #8f0f26, #3a040e); border: 3px solid var(--gold-deep); }
.jackpot .amt { font: 52px/1.1 Bungee, sans-serif; color: var(--gold); filter: drop-shadow(0 0 14px rgba(255, 215, 94, 0.55)); }
.jackpot .lbl { color: var(--muted); }
.wins .row .v { font-size: 16px; }
.standing { margin-top: 12px; }

/* pin gate */
.dots { display: flex; justify-content: center; gap: 12px; margin: 14px 0 6px; min-height: 30px; }
.dots span { width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 50%, var(--gold-deep)); animation: rise 0.3s both; }
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 290px; margin: 0 auto; }
.key {
  width: 100%; aspect-ratio: 1; border-radius: 50%; border: 0; font: 26px Bungee, sans-serif; color: #fff;
  background: repeating-conic-gradient(var(--red) 0 22.5deg, #fff 22.5deg 30deg);
  box-shadow: 0 5px 0 #4d0410, 0 8px 16px rgba(0, 0, 0, 0.4); padding: 7px;
}
.key i { font-style: normal; width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: var(--red); border: 2px dashed rgba(255, 255, 255, 0.6); }
.key.felt { background: repeating-conic-gradient(var(--felt) 0 22.5deg, #fff 22.5deg 30deg); box-shadow: 0 5px 0 #03240f; }
.key.felt i { background: var(--felt); font-size: 16px; }
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 #4d0410; }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.err { text-align: center; color: #ff8fa0; min-height: 22px; }

.rules li { margin: 8px 0; }
.grandcard { margin: 12px 0; padding: 14px 16px; border-radius: 18px; background: rgba(0, 0, 0, 0.3); border: 2px solid var(--line); }
.grandcard h3 { margin: 0; font: 16px Bungee, sans-serif; color: var(--cream); }
.grandcard .prize { margin-top: 6px; }
.grandcard .rows { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
