:root { --bg: #0a0d1a; --surface: #141a2e; --line: #283252; --muted: #8e9bc0; --text: #e8eef5; --accent: #00c46a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(900px 500px at 15% -10%, #26175a 0, transparent 70%), radial-gradient(800px 500px at 100% 10%, #063b52 0, transparent 70%), var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; }
header { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; min-height: 64px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
#wallet { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.balance { display: flex; gap: 10px; align-items: baseline; background: var(--bg); border: 1px solid var(--line); padding: 7px 14px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.balance b { font-size: 16px; }
#who { color: var(--muted); }
h1 { margin: 0; font-size: 22px; }
h2 { margin: 0 0 4px; font-size: 16px; }
main { display: flex; flex-direction: column; gap: 16px; max-width: 1120px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.controls { display: flex; flex-direction: column; gap: 14px; }
#auth { max-width: 360px; margin: 64px auto; display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
input, select, button { font: inherit; text-transform: none; letter-spacing: normal; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
button { cursor: pointer; font-weight: 600; }
button:hover:not(:disabled) { filter: brightness(1.15); border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: #03210f; padding: 12px; }
#last { margin: 0; text-align: center; font-size: 16px; font-weight: 700; }
canvas { width: 100%; height: auto; display: block; }
dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; }
dt { color: var(--muted); }
dd { margin: 0; }
code { word-break: break-all; color: #7dd3fc; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 8px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1; min-width: 180px; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.up { color: #4ade80; }
.down { color: #f87171; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: #b91c1c; padding: 10px 16px; border-radius: 8px; }
@media (max-width: 720px) { header { padding: 10px 16px; } main { margin-top: 16px; } .view { grid-template-columns: minmax(0, 1fr); } .view .controls { order: 2; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.admin { display: flex; flex-direction: column; gap: 16px; max-width: 1120px; margin: 24px auto; padding: 0 16px; }
.admin .card { overflow-x: auto; }
td button { padding: 4px 10px; margin-right: 6px; }

.view { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.stage { display: flex; flex-direction: column; gap: 14px; background: linear-gradient(180deg, #171c38, #0d1122); box-shadow: inset 0 0 80px #0006, 0 10px 40px #0007; }
.primary { background: linear-gradient(135deg, #00e676, #00bfa5); border: 0; box-shadow: 0 6px 20px #00e67655; font-size: 16px; transition: transform .1s; }
.primary:active:not(:disabled) { transform: scale(.96); }
.gold { background: linear-gradient(135deg, #ffd740, #ff9100); box-shadow: 0 6px 22px #ffab4066; animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 34px #ffab40cc; } }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: -8px; }
.quick button { padding: 6px; }
.chips { display: flex; gap: 6px; min-height: 26px; overflow: hidden; justify-content: flex-end; }
.chip { flex: none; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; animation: pop .35s cubic-bezier(.2,1.8,.4,1); }
.chip.good { background: #00e676; color: #03210f; }
.chip.bad { background: #2c3556; color: #c4cdea; }
@keyframes pop { from { transform: scale(0); } }
.result { min-height: 28px; margin: 0; text-align: center; font-size: 19px; font-weight: 800; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
#toast { z-index: 11; }
summary { cursor: pointer; font-weight: 700; font-size: 16px; }
details { overflow-x: auto; }
details h2 { margin-top: 16px; }

/* mines */
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 480px; margin: 0 auto; }
.tile { aspect-ratio: 1; padding: 0; background: none; border: 0; perspective: 600px; cursor: default; }
.tile:hover:not(:disabled) { filter: none; }
.flip { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.front, .back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.front { background: linear-gradient(160deg, #3a4775, #252e52); box-shadow: inset 0 2px 0 #ffffff22, 0 5px 0 #161c36; }
.back { transform: rotateY(180deg); background: #0f1429; border: 1px solid var(--line); }
.back svg { width: 68%; height: 68%; }
.grid.live .tile { cursor: pointer; }
.grid.live .tile:not(.open):hover .flip { transform: translateY(-5px); }
.tile.open .flip { transform: rotateY(180deg); }
.tile.gem:not(.faded) .back { box-shadow: 0 0 22px #00e0a488, inset 0 0 20px #00e0a433; border-color: #00e0a4; }
.tile.bomb:not(.faded) .back { background: radial-gradient(#ff5252, #5a0f1c); box-shadow: 0 0 30px #ff5252; }
.tile.faded .back { opacity: .4; }
.tile.suspense { animation: wiggle .18s infinite; }
@keyframes wiggle { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.stats.two { grid-template-columns: 1fr 1fr; }
.stats.three { grid-template-columns: repeat(3, 1fr); text-align: center; }
.stats.two > div, .stats.three > div { background: var(--bg); border-radius: 8px; padding: 8px; color: var(--muted); font-size: 12px; }
.stats.two b, .stats.three b { color: var(--text); font-size: 18px; }

/* dice */
.cube-wrap { height: 90px; display: grid; place-items: center; perspective: 500px; }
.cube { position: relative; width: 60px; height: 60px; transform-style: preserve-3d; transform: rotateX(-24deg) rotateY(34deg); }
.cube.rolling { animation: tumble .65s linear infinite; }
.cube i { position: absolute; inset: 0; display: grid; place-items: center; font: normal 54px/1 serif; color: #fff; background: linear-gradient(145deg, #7c5cff, #3a28a8); border: 1px solid #b9a8ff; border-radius: 10px; }
.cube .f1 { transform: translateZ(30px); } .cube .f2 { transform: rotateY(180deg) translateZ(30px); }
.cube .f3 { transform: rotateY(90deg) translateZ(30px); } .cube .f4 { transform: rotateY(-90deg) translateZ(30px); }
.cube .f5 { transform: rotateX(90deg) translateZ(30px); } .cube .f6 { transform: rotateX(-90deg) translateZ(30px); }
@keyframes tumble { to { transform: rotateX(336deg) rotateY(394deg) rotateZ(360deg); } }
#diceValue { text-align: center; font-size: clamp(48px, 10vw, 84px); font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 0 30px currentColor; }
.track { position: relative; padding: 34px 12px 0; }
#diceTarget { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; padding: 0; border: 0; border-radius: 99px; }
#diceTarget::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 8px; background: #fff; border: 4px solid #6d4aff; box-shadow: 0 0 18px #6d4affaa; cursor: grab; }
#diceTarget::-moz-range-thumb { width: 22px; height: 22px; border-radius: 8px; background: #fff; border: 4px solid #6d4aff; cursor: grab; }
#diceMarker { position: absolute; top: 4px; left: calc(12px + (100% - 24px) * var(--p, .5)); width: 0; height: 0; border: 11px solid transparent; border-top: 18px solid #ffd740; transform: translateX(-50%); filter: drop-shadow(0 0 8px #ffd740); }
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 10px; }

#crashBoard { border-radius: 10px; background: radial-gradient(circle at 50% 120%, #2a1a66, #090c1c 70%); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

#chickenBoard, #aviatorBoard { border-radius: 10px; }
#chickenBoard { background: #2b303d; cursor: pointer; }
#aviatorBoard { background: #0a0a0d; }
.quick.two { margin-top: 4px; }
/* ---------- sound button on every game ---------- */
.stage { position: relative; }
.speaker { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 17px; z-index: 2; background: #2f3640; }
.stage .chips { padding-right: 46px; }

/* ---------- classic layout (plinko, mines) ---------- */
.view.classic { grid-template-columns: 300px minmax(0, 1fr); gap: 0; background: #1a1e23; border-radius: 12px; box-shadow: 0 12px 40px #0008; }
.classic .controls { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: #23282f; border-radius: 12px 0 0 0; }
.classic .stage { padding: 14px; background: #1a1e23; box-shadow: none; border-radius: 0 12px 0 0; justify-content: center; }
.classic label, .classic .split { color: #a8b6c6; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; margin-top: 4px; }
.classic input:not([type="range"]), .classic select { width: 100%; background: #1a1e23; border: 2px solid #3a434f; font-weight: 600; }
.split { display: flex; justify-content: space-between; }
.mode { display: grid; grid-template-columns: 1fr 1fr; background: #1a1e23; border-radius: 99px; padding: 5px; }
.mode button { border: 0; background: none; border-radius: 99px; }
.mode button.on { background: #353d48; }
.amount { display: flex; background: #3a434f; border-radius: 8px; }
.amount input { flex: 1; min-width: 0; }
.amount button { border: 0; background: none; width: 52px; }
.slider { display: flex; align-items: center; gap: 12px; background: #1a1e23; border-radius: 10px; padding: 8px 14px; }
.slider input { flex: 1; min-width: 0; padding: 0; accent-color: #4f8ff7; border: 0; }
.bet { background: #3776e0; border: 0; padding: 14px; margin-top: 6px; font-size: 15px; }
.bet.cash { background: #00c46a; color: #03210f; }
.soft { background: #353d48; border: 0; }
.classic .stage .chips { order: 0; }
.maxmult { margin: 0 auto; background: #23282f; border-radius: 99px; padding: 8px 18px; font-weight: 600; }
.bar { grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #23282f; border-radius: 0 0 12px 12px; border-top: 1px solid #1a1e23; }
.bar .info { flex: 1; text-align: center; color: #a8b6c6; font-size: 13px; }
.bar button { border: 0; background: none; }
.bar .icon { font-size: 18px; width: 40px; }
.bar [data-tool="fair"] { background: #353d48; }
.pop { position: absolute; bottom: calc(100% + 6px); left: 8px; z-index: 5; width: 260px; background: #2f3640; border-radius: 10px; padding: 14px; box-shadow: 0 10px 30px #000a; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.pop label { flex-direction: row; align-items: center; gap: 10px; color: var(--text); margin: 0; }
.classic .pop input[type="checkbox"] { width: auto; }
.pop .vol input { flex: 1; min-width: 0; padding: 0; }
.view.classic:fullscreen { overflow: auto; align-content: center; }
.classic .grid { max-width: 540px; }
.classic .front { background: #323a45; box-shadow: 0 5px 0 #262c34; border-radius: 10px; }
.classic .back { background: #101418; border: 0; border-radius: 10px; }
.tile.queued .front { background: #7c3aed; box-shadow: 0 5px 0 #4c1d95; }
.grid.picking .tile { cursor: pointer; }
.noanim .flip { transition: none; }
@media (max-width: 720px) { .view.classic { grid-template-columns: minmax(0, 1fr); } .classic .controls { order: 2; border-radius: 0; } .classic .stage { border-radius: 12px 12px 0 0; padding: 8px; } .bar { order: 3; } .grid { gap: 6px; } .bar .info { display: none; } .bar [data-tool="fair"] { margin-left: auto; } }

/* ---------- keno ---------- */
.keno { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 700px; margin: 28px auto 0; }
.keno button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; font-weight: 800; font-size: clamp(12px, 2.4vw, 20px); background: #353d48; box-shadow: 0 5px 0 #262c34; transition: transform .12s, background .15s; }
.keno button:hover:not(:disabled) { transform: translateY(-3px); background: #46515f; }
.keno button:disabled { opacity: 1; cursor: default; }
.keno button.picked { background: #8b2cf5; box-shadow: 0 5px 0 #5a13ab; }
.keno button.drawn { background: #14181c; box-shadow: inset 0 0 0 2px #2c333c; color: #ff4d67; }
.keno button.picked.drawn { background: radial-gradient(circle, #0b0f12 0 52%, #1ee87b 54%, #0fb35c); color: #1ee87b; box-shadow: 0 0 22px #1ee87b99; animation: pop .35s; }
.pays { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; width: 100%; max-width: 700px; margin: 0 auto; }
.pays span { text-align: center; background: #23282f; border-radius: 6px; padding: 6px 2px; font-size: 11px; color: #a8b6c6; overflow: hidden; }
.pays b { display: block; color: var(--text); font-size: 12px; }
.pays span.on { background: #1ee87b; color: #05301a; }
.pays span.on b { color: #05301a; }

/* ---------- aviator ---------- */
.view.avi { grid-template-columns: 300px minmax(0, 1fr); gap: 0; background: #0e0f12; border-radius: 12px; box-shadow: 0 12px 40px #0008; }
.avi-side { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: #1b1c20; border-radius: 12px 0 0 0; min-width: 0; }
.mode.three { grid-template-columns: repeat(3, 1fr); }
.mode.three button { padding: 5px; font-size: 13px; }
.avi-total { display: flex; justify-content: space-between; color: #8b8f98; font-size: 12px; border-bottom: 1px solid #2c2d33; padding-bottom: 8px; }
.avi-total b { color: var(--text); font-size: 16px; }
.avi-list { height: 520px; overflow-y: auto; }
.avi-list table { margin: 0; font-size: 12px; border-collapse: separate; border-spacing: 0 3px; }
.avi-list th, .avi-list td { padding: 6px; border: 0; }
.avi-list td { background: #101114; }
.avi-list tr.won td { background: #1d3320; }
.avi-list tr.own td:first-child { box-shadow: inset 3px 0 0 #ffd740; }
.avi-main { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-width: 0; }
.avi-main .stage { padding: 0; background: none; box-shadow: none; border: 0; }
.avi-history { display: flex; gap: 6px; overflow: hidden; white-space: nowrap; min-height: 22px; font-size: 13px; font-weight: 700; }
.avi-history span { flex: none; background: #1b1c20; border-radius: 99px; padding: 1px 9px; color: #34b4ff; }
.avi-history span.mid { color: #a45cff; }
.avi-history span.big { color: #ff3dc8; }
.avi-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 8px; }
.avi-panel { background: #1b1c20; border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; }
.avi-panel .mode { grid-column: 1 / -1; width: 180px; justify-self: center; padding: 3px; }
.avi-panel .mode button { padding: 3px; font-size: 12px; }
.stepper { display: flex; align-items: center; background: #0e0f12; border-radius: 99px; }
.stepper input { min-width: 0; width: 100%; border: 0; background: none; text-align: center; font-weight: 800; font-size: 16px; padding: 4px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper button { border: 0; background: #2c2d33; border-radius: 50%; width: 28px; height: 28px; padding: 0; flex: none; margin: 3px; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 5px; }
.presets button { padding: 3px; font-size: 12px; border: 0; background: #0e0f12; border-radius: 99px; color: #8b8f98; }
.avi-action { border: 2px solid #ffffff55; border-radius: 16px; font-size: 18px; font-weight: 700; background: #28a909; white-space: pre-line; line-height: 1.3; }
.avi-action.cancel { background: #cb011a; }
.avi-action.cash { background: #d07206; }
.avi-auto { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: center; font-size: 13px; }
.avi-auto label { flex-direction: row; align-items: center; margin: 0; }
.avi-auto input[type="number"] { width: 90px; padding: 4px 8px; }
#aviatorProof { overflow-wrap: anywhere; }
@media (max-width: 820px) { .view.avi { grid-template-columns: minmax(0, 1fr); } .avi-side { order: 2; } .avi-list { height: 260px; } .view.classic .keno { gap: 5px; margin-top: 40px; } .pays { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); } }

/* ---------- lobby ---------- */
a.brand { color: var(--text); text-decoration: none; }
#view-home { display: flex; flex-direction: column; gap: 16px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 28px; border-radius: 14px; background: linear-gradient(115deg, #222834 55%, #2563eb); overflow: hidden; }
.hero-art { font-size: 80px; line-height: 1; transform: rotate(-14deg); filter: drop-shadow(0 10px 20px #0008); }
#search { width: 100%; padding: 14px 16px; background: #12161f; }
.posters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.poster { display: block; border-radius: 14px; overflow: hidden; aspect-ratio: 5 / 7; box-shadow: 0 8px 24px #0007; transition: transform .18s, box-shadow .18s; }
.poster:hover, .poster:focus-visible { transform: translateY(-8px); box-shadow: 0 18px 34px #000b; }
.poster svg { display: block; width: 100%; height: 100%; }
.poster-title { font: 900 54px Impact, "Avenir Next Condensed", "Arial Narrow", sans-serif; fill: #fff; }
.poster-sub { font: 700 10px system-ui; letter-spacing: .12em; fill: #ffffffb0; }
@media (max-width: 560px) { .posters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .hero { padding: 18px; } .hero-art { font-size: 52px; } }

/* ---------- shell ---------- */
body { display: flex; flex-direction: column; }
header { position: sticky; top: 0; z-index: 9; }
main { width: 100%; margin-bottom: 8px; }
#loading { margin: 80px auto; color: var(--muted); }
#crumb { display: flex; align-items: center; gap: 14px; }
#crumb a { color: var(--muted); text-decoration: none; font-weight: 700; background: #23282f; padding: 7px 14px; border-radius: 8px; }
#crumb a:hover { color: var(--text); }
#crumb h1 { font-size: 20px; }
.site { margin-top: auto; padding: 24px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.classic canvas { max-width: 100%; }
.bet.cash { animation: pulse 1.1s infinite; }
@media (max-width: 560px) {
  #who { display: none; }
  .brand { font-size: 17px; }
  #wallet { gap: 6px; }
  .avi-panels { grid-template-columns: minmax(0, 1fr); }
  .pop { width: min(260px, calc(100vw - 48px)); }
}
