:root {
  --bg: #070912;
  --bg-2: #0e1222;
  --panel: rgba(22, 27, 48, 0.78);
  --panel-solid: #161b30;
  --line: rgba(148, 163, 214, 0.16);
  --line-strong: rgba(148, 163, 214, 0.32);
  --text: #e7eaf6;
  --muted: #8b93b5;
  --gold: #facc15;
  --gold-2: #f59e0b;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --green: #34d399;
  --red: #f87171;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(900px 500px at 95% 10%, rgba(236, 72, 153, 0.14), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(250, 204, 21, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
code { font-family: var(--mono); font-size: 0.9em; background: rgba(148, 163, 214, 0.12); padding: 0.1em 0.4em; border-radius: 6px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(7, 9, 18, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.04em; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.6)); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 0.92rem; transition: color .2s, background .2s; }
.nav a:hover { color: var(--text); background: rgba(148, 163, 214, 0.1); }
.server-pill { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.server-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.server-pill[data-state="online"] .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.server-pill[data-state="offline"] .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }

main { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

.hero { text-align: center; padding: 56px 0 28px; }
.eyebrow { display: inline-block; margin: 0 0 14px; padding: 4px 14px; border-radius: 999px; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--gold); border: 1px solid rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.06); }
.hero h1 { margin: 0 auto; max-width: 820px; font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 1.2; letter-spacing: -0.01em; }
.accent { background: linear-gradient(90deg, var(--gold), var(--pink) 60%, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { max-width: 700px; margin: 18px auto 0; color: var(--muted); font-size: 1.05rem; }

.play { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; padding: 20px 0 40px; }

.machine {
  position: relative;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, #1d2240, #11152a);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 6px rgba(250, 204, 21, 0.05);
}
.machine::before {
  content: ""; position: absolute; inset: -1px; border-radius: 28px; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(250, 204, 21, 0.6), transparent 30%, transparent 70%, rgba(236, 72, 153, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.machine-top { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 14px; }
.marquee { font-weight: 900; letter-spacing: 0.32em; font-size: clamp(0.9rem, 2.2vw, 1.15rem); color: #fff7d6; text-shadow: 0 0 12px rgba(250, 204, 21, 0.7); }
.marquee span { color: var(--gold); }
.free-badge {
  position: absolute; right: 0;
  padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700;
  background: linear-gradient(90deg, var(--violet), var(--pink)); box-shadow: 0 0 18px rgba(236, 72, 153, 0.5);
  animation: pulse 1.4s ease-in-out infinite;
}

.reels-frame {
  position: relative;
  padding: 10px;
  border-radius: 18px;
  background: #05070f;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.25), inset 0 10px 30px rgba(0, 0, 0, 0.8);
}
.reels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.reel {
  container-type: inline-size;
  position: relative; overflow: hidden;
  aspect-ratio: 1 / 3;
  border-radius: 12px;
  background: linear-gradient(180deg, #0b0f1f, #151a33 50%, #0b0f1f);
}
.reel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 15, 0.75), transparent 18%, transparent 82%, rgba(5, 7, 15, 0.75));
}
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.reel.spinning .strip { filter: blur(1.6px) brightness(1.1); }
.cell { height: 100cqw; display: grid; place-items: center; position: relative; }
.cell svg { width: 78%; height: 78%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); transition: transform .25s, filter .25s; }
.cell .fallback { font-weight: 900; font-size: 18cqw; color: var(--gold); }
.cell.win { background: radial-gradient(circle, rgba(250, 204, 21, 0.25), transparent 70%); }
.cell.win svg { animation: winPop .9s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.9)); }
.cell.dim svg { opacity: 0.35; filter: grayscale(0.6); }
.cell.scatter svg { animation: winPop .9s ease-in-out infinite; filter: drop-shadow(0 0 14px rgba(139, 92, 246, 1)); }

.lines-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.lines-overlay polyline { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px currentColor); opacity: 0.95; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: drawLine .5s ease-out forwards; }
.lines-overlay circle { stroke: #05070f; stroke-width: 2; }
.lines-overlay text { font: 800 13px var(--font); fill: #05070f; text-anchor: middle; dominant-baseline: central; }

.win-banner {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle, rgba(5, 7, 15, 0.82), rgba(5, 7, 15, 0.55));
  border-radius: 18px; animation: fadeIn .3s ease-out;
}
.win-title { font-size: clamp(1.6rem, 6vw, 3.4rem); font-weight: 900; letter-spacing: 0.1em; background: linear-gradient(180deg, #fff7d6, var(--gold) 50%, var(--gold-2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(250, 204, 21, 0.6)); animation: zoomIn .5s cubic-bezier(.2, 1.6, .4, 1); }
.win-amount { font-size: clamp(1.4rem, 5vw, 2.6rem); font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; }

.line-ticker { min-height: 1.8em; margin: 12px 4px 4px; text-align: center; font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-ticker strong { color: var(--gold); }

.controls {
  display: grid; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 18px;
  margin-top: 10px; padding: 14px 16px; border-radius: 18px;
  background: rgba(5, 7, 15, 0.55); border: 1px solid var(--line);
}
.meter, .bet { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.meter-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--muted); }
.meter-value { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.meter-value.win { color: var(--green); }
.meter-sub { font-size: 0.75rem; color: var(--muted); }
.meter-sub strong { color: var(--text); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .meter-value { min-width: 2ch; text-align: center; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel-solid); font-size: 1.1rem; font-weight: 700; display: grid; place-items: center; transition: background .2s, transform .1s; }
.icon-btn:hover:not(:disabled) { background: #232a4a; }
.icon-btn:active:not(:disabled) { transform: scale(0.92); }

.spin-btn {
  width: 104px; height: 104px; border-radius: 50%; border: 0; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 40%, var(--gold-2) 75%, #92400e);
  box-shadow: 0 0 0 5px rgba(250, 204, 21, 0.18), 0 10px 30px rgba(245, 158, 11, 0.45), inset 0 -6px 12px rgba(0, 0, 0, 0.25);
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.spin-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 0 7px rgba(250, 204, 21, 0.25), 0 14px 36px rgba(245, 158, 11, 0.6), inset 0 -6px 12px rgba(0, 0, 0, 0.25); }
.spin-btn:active:not(:disabled) { transform: scale(0.95); }
.spin-btn:disabled { opacity: 1; filter: saturate(0.4) brightness(0.8); }
.spin-btn.busy::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid transparent; border-top-color: #fff7d6; animation: spin 0.8s linear infinite; }
.spin-label { font-weight: 900; font-size: 1.15rem; letter-spacing: 0.08em; color: #3b1d00; }

.toggles { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel-solid); font-size: 0.82rem; transition: background .2s, border-color .2s, color .2s; }
.chip:hover:not(:disabled) { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: rgba(250, 204, 21, 0.14); border-color: var(--gold); color: var(--gold); }
.hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 12px 0 0; }

.side { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; backdrop-filter: blur(10px); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 0.95rem; letter-spacing: 0.04em; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; padding: 0; }
.link-btn:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.kv div { display: flex; flex-direction: column; }
.kv dt { font-size: 0.72rem; color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.rtp-bar { position: relative; height: 8px; margin: 14px 0 6px; border-radius: 999px; background: rgba(148, 163, 214, 0.14); }
.rtp-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--pink)); transition: width .6s; }
.rtp-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--gold); box-shadow: 0 0 6px var(--gold); left: 0; }
.json { margin: 0; max-height: 220px; overflow: auto; padding: 12px; border-radius: 10px; background: #05070f; border: 1px solid var(--line); font: 0.76rem/1.5 var(--mono); color: #c7d2fe; white-space: pre-wrap; word-break: break-all; }
.json.tall { max-height: 360px; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.history li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(5, 7, 15, 0.5); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.history li.empty { display: block; color: var(--muted); text-align: center; background: none; }
.history .rid { font-family: var(--mono); color: var(--muted); font-size: 0.72rem; }
.history .amt { font-weight: 700; }
.history .amt.pos { color: var(--green); }
.history .tag { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; background: rgba(139, 92, 246, 0.25); color: #ddd6fe; }

.section { padding: 56px 0 8px; }
.section-title { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 8px; }
.section-lede { color: var(--muted); max-width: 760px; margin: 0 0 24px; }
.sub-title { margin: 32px 0 14px; font-size: 1.05rem; }

.steps { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.steps li { position: relative; padding: 20px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.steps h3 { margin: 10px 0 6px; font-size: 1rem; }
.steps p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.step-no { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 800; color: #3b1d00; background: linear-gradient(180deg, #fff3b0, var(--gold)); }
.sequence { padding: 12px; overflow-x: auto; }
.sequence svg { display: block; width: 100%; min-width: 560px; height: auto; }
.seq-actor rect { fill: rgba(139, 92, 246, 0.2); stroke: var(--violet); }
.seq-actor.server rect { fill: rgba(250, 204, 21, 0.12); stroke: var(--gold); }
.seq-actor text, .seq-note text { fill: var(--text); font: 600 14px var(--font); text-anchor: middle; }
.seq-life { stroke: var(--line-strong); stroke-dasharray: 5 6; }
.seq-msg line { stroke: var(--pink); stroke-width: 2; }
.seq-msg polygon { fill: var(--pink); }
.seq-msg.back line { stroke: var(--green); }
.seq-msg.back polygon { fill: var(--green); }
.seq-msg text { fill: var(--text); font: 13px var(--mono); text-anchor: middle; }
.seq-note rect { fill: rgba(148, 163, 214, 0.1); stroke: var(--line-strong); }
.seq-note.server rect { fill: rgba(250, 204, 21, 0.08); stroke: rgba(250, 204, 21, 0.5); }

.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pay-card { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.pay-card svg { width: 72px; height: 72px; }
.pay-name { font-weight: 800; letter-spacing: 0.04em; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pay-tag { font-size: 0.66rem; padding: 1px 7px; border-radius: 999px; background: rgba(139, 92, 246, 0.25); color: #ddd6fe; font-weight: 600; }
.pay-rows { margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.pay-rows li { display: flex; justify-content: space-between; color: var(--muted); }
.pay-rows strong { color: var(--text); }
.pay-prob { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.scatter-card { margin-top: 14px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.scatter-card svg { width: 48px; height: 48px; }
.lines-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.mini-line { padding: 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); text-align: center; font-size: 0.72rem; color: var(--muted); }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-bottom: 6px; }
.mini-grid span { aspect-ratio: 1; border-radius: 2px; background: rgba(148, 163, 214, 0.14); }
.mini-grid span.on { background: var(--c, var(--gold)); box-shadow: 0 0 6px var(--c, var(--gold)); }

.api-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.api-card p { color: var(--muted); font-size: 0.88rem; }
.api-head { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.api-head code { background: none; padding: 0; font-weight: 700; }
.verb { font: 700 0.72rem var(--mono); padding: 3px 8px; border-radius: 6px; background: rgba(52, 211, 153, 0.16); color: var(--green); }
.verb.post { background: rgba(236, 72, 153, 0.16); color: var(--pink); }

.fair-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.fair h3 { margin: 0 0 6px; font-size: 1rem; color: var(--gold); }
.fair p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.fair strong { color: var(--text); }

.footer { margin-top: 64px; padding: 28px clamp(16px, 4vw, 40px); border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.82rem; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 12px;
  background: #1f2540; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  font-size: 0.9rem; animation: fadeUp .25s ease-out;
}
.toast.error { border-color: rgba(248, 113, 113, 0.6); color: #fecaca; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes winPop { 50% { transform: scale(1.1); } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes zoomIn { from { transform: scale(0.4); opacity: 0; } }

@media (max-width: 1080px) {
  .play { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps, .fair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .server-pill { margin-left: auto; }
  .machine { padding: 12px; border-radius: 22px; }
  .reels-frame { padding: 6px; }
  .reels { gap: 4px; }
  .controls { grid-template-columns: 1fr auto 1fr; grid-template-areas: "bal spin win" "bet bet bet" "tog tog tog"; gap: 12px; }
  .controls > .m-balance { grid-area: bal; }
  .controls > .bet { grid-area: bet; }
  .controls > .spin-btn { grid-area: spin; width: 88px; height: 88px; }
  .controls > .m-win { grid-area: win; }
  .controls > .toggles { grid-area: tog; justify-content: center; }
  .side, .api-grid, .steps, .fair-grid { grid-template-columns: 1fr; }
  .free-badge { position: static; margin-left: 10px; }
  .machine-top { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

.volume { display: flex; align-items: center; }
.volume input { width: 78px; accent-color: var(--gold); }

.bulbs { position: absolute; inset: 6px; pointer-events: none; border-radius: 24px; }
.bulb { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #5b4a1a; transition: background .15s, box-shadow .15s; }
.bulb.on { background: #fff3b0; box-shadow: 0 0 8px 2px rgba(250, 204, 21, 0.85); }
.machine > *:not(.bulbs) { position: relative; }
.machine.attract .bulb { animation: bulbChase 1.2s linear infinite; animation-delay: calc(var(--i) * -0.04s); }
.machine.party .bulb { animation: bulbParty .24s steps(2) infinite; animation-delay: calc(var(--i) * -0.03s); }

.machine.shake { animation: shake .5s cubic-bezier(.36, .07, .19, .97) both; }
.machine.glow { box-shadow: var(--shadow), 0 0 0 6px rgba(250, 204, 21, 0.25), 0 0 80px rgba(250, 204, 21, 0.35); transition: box-shadow .4s; }

.reel.landing { animation: reelLand .32s cubic-bezier(.3, 1.8, .5, 1); }
.reel.anticipate { box-shadow: inset 0 0 0 2px var(--violet), 0 0 28px rgba(139, 92, 246, 0.9); }
.reel.anticipate::before {
  content: ""; position: absolute; inset: -40%; z-index: 2; pointer-events: none;
  background: conic-gradient(from 0deg, transparent, rgba(192, 132, 252, 0.55), transparent 30%, rgba(236, 72, 153, 0.45), transparent 60%);
  animation: spin 1s linear infinite; mix-blend-mode: screen;
}
.cell.land svg { animation: symbolLand .4s cubic-bezier(.3, 1.8, .5, 1); }
.cell.win::after {
  content: ""; position: absolute; inset: 6%; border-radius: 12px; pointer-events: none;
  border: 2px solid rgba(250, 204, 21, 0.9); box-shadow: 0 0 14px rgba(250, 204, 21, 0.7), inset 0 0 14px rgba(250, 204, 21, 0.4);
  animation: frameFlash .9s ease-in-out infinite;
}
.cell.win.wild svg { animation: wildFlip 1.2s ease-in-out infinite; }

.spin-btn::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  background-size: 250% 100%; animation: sheen 3.2s ease-in-out infinite;
}
.spin-btn.stop .spin-label { font-size: 1rem; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.6); transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; }

.meter-value.bump { animation: bump .35s ease-out; }
.meter-value.drop { animation: drop .35s ease-out; }
.line-ticker.flash { animation: tickerIn .35s ease-out; }

.celebrate { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; background: radial-gradient(circle, rgba(20, 10, 40, 0.78), rgba(5, 5, 12, 0.92)); cursor: pointer; animation: fadeIn .3s ease-out; overflow: hidden; }
.celebrate-rays { position: absolute; width: 220vmax; height: 220vmax; left: 50%; top: 50%; margin: -110vmax 0 0 -110vmax; background: repeating-conic-gradient(from 0deg, rgba(250, 204, 21, 0.14) 0 6deg, transparent 6deg 18deg); animation: spin 14s linear infinite; -webkit-mask: radial-gradient(circle, #000 0, transparent 55%); mask: radial-gradient(circle, #000 0, transparent 55%); }
.celebrate-body { position: relative; text-align: center; }
.celebrate-title { font-size: clamp(2.6rem, 11vw, 7rem); font-weight: 900; letter-spacing: 0.06em; line-height: 1; background: linear-gradient(180deg, #fffbe6 0%, #fde047 40%, #f59e0b 70%, #b45309 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 0 #78350f) drop-shadow(0 0 30px rgba(250, 204, 21, 0.7)); animation: titleSlam .7s cubic-bezier(.2, 1.8, .4, 1), titleBreath 1.6s ease-in-out .7s infinite; }
.celebrate[data-tier="mega"] .celebrate-title { background: linear-gradient(180deg, #fff, #f0abfc 35%, #c026d3 70%, #701a75); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 6px 0 #4a044e) drop-shadow(0 0 34px rgba(236, 72, 153, 0.8)); }
.celebrate[data-tier="epic"] .celebrate-title { background: linear-gradient(180deg, #fff, #a5f3fc 30%, #38bdf8 55%, #7c3aed 85%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 6px 0 #1e1b4b) drop-shadow(0 0 40px rgba(56, 189, 248, 0.9)); }
.celebrate[data-tier="free"] .celebrate-title { background: linear-gradient(180deg, #fff, #ddd6fe 30%, #8b5cf6 65%, #4c1d95); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 6px 0 #2e1065) drop-shadow(0 0 34px rgba(139, 92, 246, 0.9)); }
.celebrate-amount { margin-top: 14px; font-size: clamp(2rem, 8vw, 4.6rem); font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 24px rgba(250, 204, 21, 0.7), 0 4px 0 rgba(0, 0, 0, 0.5); }
.celebrate-sub { margin-top: 6px; font-size: 1.1rem; color: #e9d5ff; }
.celebrate-hint { margin-top: 26px; font-size: 0.8rem; color: rgba(231, 234, 246, 0.55); }

@keyframes bulbChase { 0%, 70% { background: #5b4a1a; box-shadow: none; } 80% { background: #fff3b0; box-shadow: 0 0 8px 2px rgba(250, 204, 21, 0.85); } }
@keyframes bulbParty { 0% { background: #fff3b0; box-shadow: 0 0 10px 3px rgba(250, 204, 21, 0.95); } 100% { background: #f0abfc; box-shadow: 0 0 10px 3px rgba(236, 72, 153, 0.9); } }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -1px); } }
@keyframes reelLand { 0% { transform: translateY(0); } 45% { transform: translateY(6px); } 100% { transform: translateY(0); } }
@keyframes symbolLand { 0% { transform: scale(1.18, 0.86); } 60% { transform: scale(0.95, 1.06); } 100% { transform: scale(1); } }
@keyframes frameFlash { 50% { opacity: 0.35; } }
@keyframes wildFlip { 0%, 100% { transform: scale(1) rotate(0); filter: drop-shadow(0 0 10px rgba(232, 121, 249, 0.8)); } 50% { transform: scale(1.14) rotate(-5deg); filter: drop-shadow(0 0 22px rgba(232, 121, 249, 1)) brightness(1.25); } }
@keyframes sheen { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }
@keyframes bump { 40% { transform: scale(1.25); color: var(--gold); } }
@keyframes drop { 40% { transform: translateY(3px); color: var(--red); } }
@keyframes tickerIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes titleSlam { from { transform: scale(3); opacity: 0; } }
@keyframes titleBreath { 50% { transform: scale(1.05); } }

.mono { font-family: var(--mono); }
.version-tag { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; color: var(--gold); border: 1px solid rgba(250, 204, 21, 0.4); background: rgba(250, 204, 21, 0.08); }

.wallet {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 10px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.14), rgba(250, 204, 21, 0.04));
  border: 1px solid rgba(250, 204, 21, 0.45);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.12);
  white-space: nowrap;
}
.wallet-coin { width: 22px; height: 22px; flex: none; }
.wallet-label { font-size: 0.75rem; color: var(--muted); }
.wallet-value { font-size: 1.02rem; font-weight: 800; color: #fff7d6; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; display: inline-block; }
.wallet-value.bump { animation: bump .35s ease-out; }
.wallet-value.drop { animation: drop .35s ease-out; }
.deposit-btn {
  border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 0.85rem; color: #3b1d00;
  background: linear-gradient(180deg, #fff3b0, var(--gold) 55%, var(--gold-2));
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: transform .12s, box-shadow .2s;
}
.deposit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55); }
.deposit-btn:active { transform: scale(0.96); }
.deposit-btn.attention { animation: attention 1.4s ease-in-out infinite; }

.deposit {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: 22px;
  background: linear-gradient(180deg, #1c2140, #11152a); color: var(--text);
  box-shadow: var(--shadow), 0 0 0 1px rgba(250, 204, 21, 0.15);
}
.deposit[open] { animation: dialogIn .28s cubic-bezier(.2, 1.4, .4, 1); }
.deposit::backdrop { background: rgba(3, 4, 10, 0.72); backdrop-filter: blur(4px); }
.deposit-body { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 22px; }
.deposit-head { display: flex; align-items: center; justify-content: space-between; }
.deposit-head h2 { margin: 0; font-size: 1.2rem; }
.deposit-balance { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px; border-radius: 14px; background: rgba(5, 7, 15, 0.6); border: 1px solid var(--line); }
.deposit-balance span { color: var(--muted); font-size: 0.85rem; }
.deposit-balance strong { font-size: 1.6rem; color: #fff7d6; font-variant-numeric: tabular-nums; }
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.package {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 10px 6px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); transition: border-color .2s, background .2s, transform .1s;
}
.package strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.package span { font-size: 0.72rem; color: var(--muted); }
.package:hover { border-color: var(--gold); }
.package:active { transform: scale(0.97); }
.package[aria-pressed="true"] { border-color: var(--gold); background: rgba(250, 204, 21, 0.14); color: var(--gold); }
.custom-amount { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.custom-amount input {
  font: inherit; font-size: 1.05rem; color: var(--text); padding: 10px 12px; border-radius: 12px;
  background: #05070f; border: 1px solid var(--line-strong); font-variant-numeric: tabular-nums;
}
.custom-amount input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2); }
.deposit-error { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 0.85rem; color: #fecaca; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); }
.primary-btn {
  border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 900; font-size: 1rem; letter-spacing: 0.04em; color: #3b1d00;
  background: linear-gradient(180deg, #fff3b0, var(--gold) 50%, var(--gold-2));
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35); transition: transform .12s, filter .2s;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.08); }
.primary-btn:active:not(:disabled) { transform: scale(0.98); }
.deposit .sub-title { margin: 6px 0 0; font-size: 0.95rem; }
.ledger { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.ledger li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(5, 7, 15, 0.5); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.ledger li.empty { display: block; color: var(--muted); text-align: center; background: none; }
.ledger-type { font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; background: rgba(148, 163, 214, 0.15); }
.ledger-type.deposit { background: rgba(250, 204, 21, 0.18); color: var(--gold); }
.ledger-type.free_spin { background: rgba(139, 92, 246, 0.25); color: #ddd6fe; }
.amt.neg { color: var(--red); }

@keyframes attention { 0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35); } 50% { box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.25), 0 4px 24px rgba(245, 158, 11, 0.8); transform: scale(1.05); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } }

@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .server-pill { margin-left: auto; padding: 6px; }
  .server-pill #serverPillText { display: none; }
  .wallet-label { display: none; }
  .brand span { display: none; }
}
@media (max-width: 420px) {
  .wallet-coin { display: none; }
  .deposit-btn { padding: 6px 10px; }
}

body.admin { background-attachment: fixed; }
.admin-active { margin-left: auto; font-size: 0.85rem; color: var(--muted); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.admin-main { max-width: 1320px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; }
.admin-login { max-width: 460px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.admin-login h1 { margin: 0; font-size: 1.4rem; }
.admin-login p { margin: 0; }
.admin-login-form { display: flex; gap: 10px; }
.admin-login-form input { flex: 1; min-width: 0; font: inherit; color: var(--text); padding: 10px 12px; border-radius: 12px; background: #05070f; border: 1px solid var(--line-strong); }
.admin-login-form input:focus { outline: none; border-color: var(--gold); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.admin-editor, .admin-side { display: flex; flex-direction: column; gap: 16px; }
.admin-side { position: sticky; top: 76px; }
.admin-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); min-width: 110px; flex: 1; }
.field input, .admin-table input {
  font: inherit; font-size: 0.95rem; color: var(--text); padding: 8px 10px; border-radius: 10px; width: 100%;
  background: #05070f; border: 1px solid var(--line-strong); font-variant-numeric: tabular-nums; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .admin-table input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18); }
.field.readonly strong { font-size: 1.1rem; color: var(--text); padding: 7px 0; }
#adminApp input.dirty { border-color: rgba(56, 189, 248, 0.8); background: rgba(56, 189, 248, 0.08); }
#adminApp input.invalid { border-color: var(--red); background: rgba(248, 113, 113, 0.1); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 560px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.75rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 6px 8px; border-bottom: 1px solid rgba(148, 163, 214, 0.08); vertical-align: middle; }
.admin-table td input { max-width: 110px; }
.admin-table tfoot td { color: var(--muted); font-weight: 700; border-bottom: 0; }
.admin-table .prob { font-variant-numeric: tabular-nums; color: var(--gold); white-space: nowrap; }
.sym-cell { display: flex; align-items: center; gap: 10px; }
.sym-cell small { display: block; color: var(--muted); font-size: 0.7rem; }
.admin-icon { width: 36px; height: 36px; flex: none; }
.rtp-big { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }
.rtp-big span { font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, #fff7d6, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rtp-big span.bad { background: linear-gradient(180deg, #fecaca, var(--red)); -webkit-background-clip: text; background-clip: text; }
.rtp-big small { color: var(--muted); font-size: 0.75rem; }
.rtp-range { position: relative; height: 10px; margin: 12px 0 6px; border-radius: 999px; background: rgba(248, 113, 113, 0.25); }
.rtp-allowed { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, rgba(52, 211, 153, 0.5), rgba(52, 211, 153, 0.8)); }
.rtp-needle { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #fff; box-shadow: 0 0 8px #fff; transition: left .35s cubic-bezier(.2, 1.2, .4, 1); }
.kv dd.warn { color: var(--gold-2); }
.admin-metrics .kv { margin: 12px 0; }
.admin-errors { margin: 0 0 12px; padding: 10px 12px 10px 28px; border-radius: 10px; font-size: 0.8rem; color: #fecaca; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.4); max-height: 160px; overflow: auto; }
.admin-errors code { color: #fff; }
.admin-actions { display: flex; gap: 10px; margin-top: 12px; }
.admin-actions .primary-btn { flex: 1; }
.admin-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.admin-history li { padding: 10px 12px; border-radius: 12px; background: rgba(5, 7, 15, 0.5); display: flex; flex-direction: column; gap: 4px; }
.admin-history .h-head { display: flex; align-items: center; gap: 8px; }
.admin-history .chip { align-self: flex-start; margin-top: 4px; }
.risk-list { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0; font-size: 0.82rem; }
.risk-list div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed rgba(148, 163, 214, 0.12); }
.risk-list dt { color: var(--muted); }
.risk-list dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 1080px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-side { position: static; }
}
@media (max-width: 760px) {
  .admin-active { display: none; }
  #logoutBtn { margin-left: auto; }
}

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); max-width: 180px; }
.user-btn:hover { border-color: var(--gold); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--violet), var(--pink)); }
.user-name { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; border-radius: 14px; background: #1c2140; border: 1px solid var(--line-strong); box-shadow: var(--shadow); z-index: 40; animation: fadeIn .15s ease-out; }
.menu-head { padding: 8px 10px; font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: none; font-size: 0.88rem; }
.menu button:hover { background: rgba(148, 163, 214, 0.12); }

.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: rgba(5, 7, 15, 0.6); border: 1px solid var(--line); }
.auth-tabs button { padding: 8px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; transition: background .2s, color .2s; }
.auth-tabs button[aria-selected="true"] { background: rgba(250, 204, 21, 0.14); color: var(--gold); }
.auth-main { display: flex; flex-direction: column; gap: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-notice { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 0.85rem; color: #e9d5ff; background: rgba(139, 92, 246, 0.14); border: 1px solid rgba(139, 92, 246, 0.4); }
.recovery-panel { display: flex; flex-direction: column; gap: 12px; }
.recovery-panel h3 { margin: 0; font-size: 1.05rem; }
.recovery-panel p { margin: 0; }
.recovery-code { padding: 16px; border-radius: 14px; text-align: center; font: 800 1.35rem var(--mono); letter-spacing: 0.08em; color: #fff7d6; background: #05070f; border: 1px dashed rgba(250, 204, 21, 0.6); user-select: all; word-break: break-all; }
.recovery-actions { display: flex; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.rtp-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }
.rtp-total span { font-size: 0.75rem; color: var(--muted); }
.rtp-total strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .user-name { display: none; }
  .user-btn { padding: 3px; }
}
