/* Slot Simulator: a deep-space casino floor. The reels sit in a ship's viewport whose rim takes the
   game's accent; gold is kept for money (wins, balance), so a glance tells you what you won. */

:root {
    --tt-topnav-h: 64px;
    --void: #060716;
    --deep: #0b0e29;
    --panel: rgba(17, 21, 56, 0.74);
    --panel-solid: #121641;
    --line: rgba(150, 165, 255, 0.15);
    --line-strong: rgba(150, 165, 255, 0.32);
    --star: #eceeff;
    --dust: #a0a8d8;
    --dim: #6f77ad;
    --gold: #ffc94d;
    --gold-hot: #ff9f1c;
    --danger: #ff6b8b;
    --accent: #8b6cff;
    --accent2: #3fe0f0;
    --font-display: 'Unbounded', 'Sora', system-ui, sans-serif;
    --font-ui: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --radius-s: 10px;
    --radius-m: 16px;
    --radius-l: 24px;
    --z-modal: calc(var(--tt-z-modal, 1000) + 10);
    --z-toast: calc(var(--tt-z-modal, 1000) + 20);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--void); color: var(--star); }
body {
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noscript { padding: 24px; text-align: center; }

/* ------------------------------------------------------------------ the app shell */

.slots-app {
    position: relative;
    height: calc(100vh - var(--tt-topnav-h) - var(--ad-bottom, 0px));
    height: calc(100dvh - var(--tt-topnav-h) - var(--ad-bottom, 0px));
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(55% 45% at 12% 18%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
        radial-gradient(45% 40% at 88% 80%, color-mix(in srgb, var(--accent2) 18%, transparent), transparent 70%),
        radial-gradient(35% 30% at 72% 8%, rgba(255, 79, 163, 0.10), transparent 70%),
        var(--void);
    transition: background 0.6s ease;
}
.slots-app:fullscreen { height: 100vh; height: 100dvh; }
.starfield { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ------------------------------------------------------------------ lobby */

.lobby {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: clamp(18px, 3.2vh, 40px) clamp(16px, 4vw, 56px) 20px;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vh, 32px);
}
.lobby-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
}
.lobby-intro { max-width: 640px; }
.lobby h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(30px, 4.6vw, 58px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    background: linear-gradient(100deg, #ffffff 30%, #c9b8ff 65%, #8ff2ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.lobby-lede { margin: 0; color: var(--dust); font-size: clamp(14px, 1.3vw, 16px); max-width: 60ch; }

.wallet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    white-space: nowrap;
}
.wallet .fa-wallet { color: var(--gold); }
.wallet-label { color: var(--dust); font-size: 13px; }
.wallet-amount { font-family: var(--font-display); font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

.ghost-btn {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--accent2); }

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(12px, 1.6vw, 22px);
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--radius-l);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 45%),
        var(--panel);
    border: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.tile:hover, .tile:focus-visible {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
    box-shadow: 0 18px 50px color-mix(in srgb, var(--accent) 25%, transparent);
    outline: none;
}
.tile-art {
    position: relative;
    height: clamp(130px, 22vh, 210px);
    background:
        radial-gradient(70% 90% at 50% 105%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
        radial-gradient(40% 50% at 85% 20%, color-mix(in srgb, var(--accent2) 35%, transparent), transparent 70%);
    border-bottom: 1px solid var(--line);
}
.tile-art::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 15%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 40% 60%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 85% 55%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 10% 80%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 55% 25%, #fff 50%, transparent 51%);
    opacity: 0.6;
}
.art {
    position: absolute;
    width: 34%;
    aspect-ratio: 1;
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
    transition: transform 0.35s ease;
}
.art-1 { left: 6%; bottom: 8%; transform: rotate(-12deg); }
.art-2 { left: 33%; bottom: 16%; width: 40%; z-index: 1; }
.art-3 { right: 5%; bottom: 6%; transform: rotate(10deg); }
.tile:hover .art-1 { transform: rotate(-16deg) translateY(-6px); }
.tile:hover .art-2 { transform: translateY(-10px) scale(1.04); }
.tile:hover .art-3 { transform: rotate(14deg) translateY(-4px); }

.tile-body { padding: 16px 18px 8px; flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.tile-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(17px, 1.45vw, 21px);
    line-height: 1.15;
    margin: 0;
    letter-spacing: -0.01em;
}
.tile-tag { margin: 0; color: var(--dust); font-size: 13.5px; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 4px 0 0; padding: 0; }
.chips li {
    font-size: 11.5px;
    padding: 3px 9px;
    border-radius: 999px;
    color: color-mix(in srgb, var(--accent) 50%, #ffffff);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.tile-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px 16px;
    font-size: 12.5px;
    color: var(--dust);
}
.tile-stat b { color: var(--star); font-weight: 600; }
.vol { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.vol i { width: 4px; border-radius: 2px; background: var(--line-strong); }
.vol i:nth-child(1) { height: 5px; } .vol i:nth-child(2) { height: 8px; }
.vol i:nth-child(3) { height: 11px; } .vol i:nth-child(4) { height: 14px; }
.vol[data-vol="low"] i:nth-child(-n+1),
.vol[data-vol="medium"] i:nth-child(-n+2),
.vol[data-vol="high"] i:nth-child(-n+3),
.vol[data-vol="very high"] i { background: var(--accent); }
.tile-play {
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    color: #0a0820;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 75%, #ffffff), var(--accent));
}

.lobby-foot {
    max-width: 1320px;
    width: 100%;
    margin: auto auto 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--dim);
    font-size: 12.5px;
}
.foot-link { color: var(--dust); }

/* ------------------------------------------------------------------ game view */

.game {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}
.game-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px clamp(10px, 2vw, 24px);
}
.game-title {
    flex: 1;
    margin: 0;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(15px, 1.7vw, 21px);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-actions { display: flex; gap: 4px; }
.bar-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--dust);
    font-size: 15px;
    transition: background 0.15s, color 0.15s;
}
.bar-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--star); }
.back-btn { font-size: 13.5px; font-weight: 600; }

.stage {
    position: relative;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-content: center;
    justify-items: center;
    padding: 0 clamp(8px, 2vw, 24px);
}
.marquee {
    grid-column: 2;
    grid-row: 1;
    min-height: 40px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.chip {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(8, 10, 32, 0.7);
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--dust);
    white-space: nowrap;
}
.chip b { font-family: var(--font-display); font-weight: 700; color: var(--star); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chip.hot { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 18%, rgba(8, 10, 32, 0.8)); }
.chip.money b { color: var(--gold); }
.chip.bump { animation: bump 0.45s ease; }
.jackpot { flex-direction: column; align-items: center; gap: 0; padding: 4px 14px; border-radius: 12px; }
.jackpot span { font-size: 11px; }
.jackpot[data-j="grand"] { border-color: rgba(255, 201, 77, 0.6); }
.jackpot[data-j="major"] { border-color: rgba(255, 79, 123, 0.5); }
.jackpot[data-j="minor"] { border-color: rgba(176, 124, 255, 0.5); }
.jackpot[data-j="mini"] { border-color: rgba(54, 226, 244, 0.5); }
.jackpot.lit { animation: jackpotLit 1s ease 3; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); transition: background 0.2s, transform 0.2s; }
.dots i.on { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.machine {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    padding: 7px;
    border-radius: 30px;
    background:
        linear-gradient(140deg, color-mix(in srgb, var(--accent) 90%, #ffffff) 0%, transparent 32%, transparent 68%, var(--accent2) 100%),
        #0c0f2c;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 0 46px color-mix(in srgb, var(--accent) 34%, transparent),
        0 30px 70px rgba(0, 0, 0, 0.55);
    transition: box-shadow 0.4s ease;
}
.machine.feature { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 70px color-mix(in srgb, var(--accent2) 55%, transparent), 0 30px 70px rgba(0, 0, 0, 0.55); }
.window {
    position: relative;
    width: var(--win-w, 600px);
    height: var(--win-h, 360px);
    border-radius: 24px;
    overflow: hidden;
    background:
        radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        linear-gradient(180deg, #0b0e2e, #05061a);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 10px 30px rgba(0, 0, 0, 0.5);
}
.window::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.09), transparent 28%, transparent 80%, rgba(255, 255, 255, 0.03));
    z-index: 6;
}
.reels { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); }
.reel { position: relative; overflow: hidden; }
.reel + .reel { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.045); }
.strip { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.strip.blur .sym { filter: blur(1.2px) brightness(1.15); }
.cell {
    position: relative;
    height: var(--ch, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease, filter 0.25s ease;
}
.sym { width: var(--sym, 80px); height: var(--sym, 80px); overflow: visible; display: block; }
.val {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.6);
}
.val-mult { top: 50%; transform: translateY(-38%); font-size: calc(var(--sym, 80px) * 0.24); }
.val-coin { top: 50%; transform: translateY(-50%); font-size: calc(var(--sym, 80px) * 0.19); color: #4a2600; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); }
.val-coin.jp { font-size: calc(var(--sym, 80px) * 0.17); color: #ffffff; text-shadow: 0 0 6px rgba(0, 0, 0, 0.8), 0 1px 0 #6b2b00; }
.socket { width: calc(var(--sym, 80px) * 0.7); height: calc(var(--sym, 80px) * 0.7); border-radius: 50%;
    border: 2px dashed rgba(255, 201, 77, 0.22); background: radial-gradient(circle, rgba(255, 201, 77, 0.06), transparent 70%); }
.cell.shuffle .socket { animation: socketShuffle 0.5s ease-in-out; }

.reels.dim .cell:not(.win):not(.keep) { opacity: 0.26; filter: saturate(0.5); }
.cell.win .sym { animation: winPulse 0.9s ease-in-out infinite; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--gold) 80%, transparent)); }
.cell.win::before {
    content: '';
    position: absolute;
    inset: 5%;
    border-radius: 22%;
    border: 2px solid color-mix(in srgb, var(--gold) 85%, transparent);
    box-shadow: 0 0 16px color-mix(in srgb, var(--gold) 45%, transparent), inset 0 0 18px color-mix(in srgb, var(--gold) 25%, transparent);
    pointer-events: none;
}
.cell.pop .sym, .cell.pop .val { animation: pop 0.34s ease-in forwards; }
.cell.land .sym { animation: land 0.42s cubic-bezier(.2, 1.6, .4, 1); }
.cell.sticky::after {
    content: '';
    position: absolute;
    inset: 4%;
    border-radius: 22%;
    border: 2px solid color-mix(in srgb, var(--accent) 80%, transparent);
    box-shadow: inset 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent);
    pointer-events: none;
}
.cell.lock::after {
    content: '';
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(255, 201, 77, 0.45);
    pointer-events: none;
}
.cell.collect .sym { animation: collect 0.5s ease; }
.cell.tease .sym { animation: tease 0.7s ease-in-out infinite; }

.paylines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; overflow: visible; }
.paylines polyline { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px currentColor); }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.spark {
    position: absolute;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--c, var(--gold));
    box-shadow: 0 0 8px var(--c, var(--gold));
    animation: spark 0.7s ease-out forwards;
}
.step-win {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(16px, 2.4vw, 26px);
    color: var(--gold);
    text-shadow: 0 2px 0 #4a2600, 0 0 18px rgba(255, 159, 28, 0.7);
    white-space: nowrap;
    animation: floatUp 1.1s ease-out forwards;
}

.ticker {
    grid-column: 2;
    grid-row: 3;
    margin: 12px 0 0;
    min-height: 23px;
    text-align: center;
    color: var(--dust);
    font-size: 14px;
    max-width: var(--win-w, 600px);
}
.ticker.money { color: var(--gold); font-weight: 600; }

.buy-btn {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    margin-right: clamp(14px, 2.4vw, 34px);
    width: 128px;
    min-height: 128px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
    background:
        radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
        rgba(10, 12, 38, 0.86);
    box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 28%, transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.buy-btn strong { font-family: var(--font-display); color: var(--gold); font-size: 15px; font-variant-numeric: tabular-nums; }
.buy-btn:hover:not(:disabled) { transform: scale(1.04); box-shadow: 0 0 44px color-mix(in srgb, var(--accent) 45%, transparent); }
.buy-btn:disabled { opacity: 0.4; }

/* overlays inside the stage: feature intro and outro, big wins */
.overlay {
    position: absolute;
    inset: 0;
    z-index: calc(var(--tt-z-modal, 1000) + 5);
    display: grid;
    place-items: center;
    background: radial-gradient(60% 60% at 50% 50%, rgba(6, 7, 22, 0.55), rgba(6, 7, 22, 0.88));
    animation: fadeIn 0.25s ease;
    cursor: pointer;
}
.ov-card { text-align: center; padding: 24px; max-width: 520px; }
.ov-kicker { font-size: 15px; color: var(--dust); margin: 0 0 6px; }
.ov-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(30px, 6vw, 64px);
    line-height: 1.02;
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(100deg, #ffffff, color-mix(in srgb, var(--accent) 60%, #ffffff), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: zoomIn 0.5s cubic-bezier(.2, 1.4, .4, 1);
}
.ov-amount {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(34px, 7.5vw, 78px);
    line-height: 1.05;
    margin: 10px 0 0;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 3px 0 #6b3500, 0 0 34px rgba(255, 159, 28, 0.55);
}
.ov-text { color: var(--dust); margin: 12px auto 0; max-width: 40ch; }
.ov-card .primary-btn { margin-top: 20px; min-width: 160px; }
.overlay.big .ov-title { font-size: clamp(36px, 8vw, 86px); }

/* ------------------------------------------------------------------ control deck */

.deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
    grid-template-areas: "balance bet spin toggles win";
    align-items: center;
    gap: clamp(10px, 2vw, 28px);
    padding: 10px clamp(12px, 3vw, 40px) calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, rgba(4, 5, 18, 0.88) 38%);
}
.meter { display: flex; flex-direction: column; min-width: 0; }
.meter-label { font-size: 11.5px; color: var(--dim); }
.meter-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(16px, 1.7vw, 22px);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.meter-balance { grid-area: balance; }
.meter-balance .meter-value { color: var(--gold); }
.meter-win { grid-area: win; text-align: right; align-items: flex-end; }
.meter-win .meter-value { color: var(--gold); }
.meter-win.counting .meter-value { text-shadow: 0 0 16px rgba(255, 201, 77, 0.6); }
.bet-group { grid-area: bet; display: flex; align-items: center; gap: 8px; }
.meter-bet { align-items: center; min-width: 72px; }
.round-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    place-items: center;
    font-size: 14px;
    transition: background 0.15s, border-color 0.15s;
}
.round-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); border-color: var(--accent2); }
.round-btn:disabled, .pill-btn:disabled { opacity: 0.35; }

.spin-btn {
    grid-area: spin;
    position: relative;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.55), transparent 42%),
        linear-gradient(145deg, color-mix(in srgb, var(--accent) 85%, #ffffff), var(--accent) 45%, color-mix(in srgb, var(--accent2) 70%, #000000));
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 0 0 34px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 22px rgba(0, 0, 0, 0.5);
    display: grid;
    place-items: center;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.spin-btn svg { width: 42px; height: 42px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); transition: transform 0.3s ease; }
.spin-btn:hover svg { transform: rotate(40deg); }
.spin-btn:active:not(:disabled) { transform: scale(0.94); }
.spin-btn:disabled { filter: grayscale(0.8); opacity: 0.45; }
.spin-btn.spinning svg { animation: rot 0.7s linear infinite; }
.spin-btn.auto svg { opacity: 0.25; }
.spin-count {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
}
.deck-toggles { grid-area: toggles; display: flex; gap: 8px; }
.pill-btn {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dust);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pill-btn:hover:not(:disabled) { color: var(--star); border-color: var(--accent2); }
.pill-btn[aria-pressed="true"], .pill-btn.on {
    color: #0a0820;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent2) 70%, #ffffff), var(--accent2));
    border-color: transparent;
}

/* ------------------------------------------------------------------ dialogs */

.modal {
    position: absolute;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(3, 4, 14, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.18s ease;
}
.modal-card {
    width: min(560px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-l);
    background: linear-gradient(180deg, rgba(30, 34, 82, 0.96), rgba(13, 16, 44, 0.98));
    border: 1px solid var(--line-strong);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
.modal-wide { width: min(820px, 100%); }
.modal-narrow { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 6px 22px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.modal-body { padding: 8px 22px 22px; overflow-y: auto; }
.tabs { display: flex; gap: 4px; padding: 4px 18px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
    min-height: 44px;
    padding: 0 14px;
    border: none;
    background: none;
    color: var(--dust);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--star); border-bottom-color: var(--accent2); }
.primary-btn {
    min-height: 46px;
    padding: 0 22px;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    color: #0a0820;
    background: linear-gradient(135deg, #ffe08a, var(--gold) 50%, var(--gold-hot));
    box-shadow: 0 8px 24px rgba(255, 159, 28, 0.25);
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.06); }
.primary-btn:disabled { opacity: 0.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.field-label { margin: 6px 0 8px; color: var(--dust); font-size: 13px; }
.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.choice {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    font-family: var(--font-display);
    font-weight: 700;
}
.choice[aria-pressed="true"] { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 18%, transparent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--dust); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent2); }
#autoStart { width: 100%; margin-top: 12px; }

/* paytable */
.pay-note { color: var(--dust); font-size: 13px; margin: 6px 0 14px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.pay-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--line);
}
.pay-item svg { width: 54px; height: 54px; flex: none; }
.pay-item dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 1px 10px; font-size: 13px; }
.pay-item dt { color: var(--dim); }
.pay-item dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }
.pay-special { grid-column: 1 / -1; }
.pay-special p { margin: 0; font-size: 13px; color: var(--dust); }
.pay-special strong { color: var(--star); display: block; font-size: 14px; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin: 22px 0 10px; }
.lines-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.mini-line { position: relative; aspect-ratio: 5 / 3.4; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.mini-line svg { position: absolute; inset: 4px 4px 14px; width: calc(100% - 8px); height: calc(100% - 18px); }
.mini-line span { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 10.5px; color: var(--dim); }
.rules { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 10px; color: var(--dust); font-size: 14px; }
.rules li::marker { color: var(--accent2); }

/* math lab + session stats */
.math p { color: var(--dust); font-size: 14px; margin: 8px 0; max-width: 64ch; }
.math p strong { color: var(--star); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.kpi { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.kpi span { display: block; font-size: 12px; color: var(--dim); }
.kpi b { font-family: var(--font-display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.kpi b.gold { color: var(--gold); }
.kpi b.bad { color: var(--danger); }
.chart { width: 100%; height: auto; display: block; margin: 6px 0 4px; }
.chart text { fill: var(--dim); font-size: 11px; font-family: var(--font-ui); }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .zero { stroke: var(--dust); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .path { fill: none; stroke: var(--accent2); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: color-mix(in srgb, var(--accent2) 14%, transparent); }
.chart .bar { fill: var(--accent); }
.chart .bar.none { fill: var(--line-strong); }
.chart .val { fill: var(--star); font-size: 11px; }
.chart-title { font-size: 13px; color: var(--dust); margin: 16px 0 0; }
.sim-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.empty { color: var(--dust); padding: 18px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chart-wrap { position: relative; }
.chart-tip {
    position: absolute;
    pointer-events: none;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(8, 10, 32, 0.95);
    border: 1px solid var(--line-strong);
    font-size: 12px;
    white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
}
.chart .cross { stroke: var(--dust); stroke-width: 1; }
.chart .dot { fill: var(--accent2); stroke: #121641; stroke-width: 2; }
.chart .hit { fill: transparent; }
.sticky-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.sticky-layer .cell { position: absolute; }

.toast {
    position: absolute;
    left: 50%;
    bottom: 120px;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    max-width: min(460px, calc(100% - 32px));
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(24, 28, 70, 0.96);
    border: 1px solid var(--line-strong);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    font-size: 14px;
    text-align: center;
    animation: toastIn 0.25s ease;
}
.toast.bad { border-color: rgba(255, 107, 139, 0.6); }

/* ------------------------------------------------------------------ motion */

@keyframes winPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }
@keyframes pop { 0% { transform: scale(1); opacity: 1; } 35% { transform: scale(1.28); opacity: 1; } 100% { transform: scale(0.1); opacity: 0; } }
@keyframes land { 0% { transform: scale(1.5); opacity: 0.2; } 100% { transform: scale(1); opacity: 1; } }
@keyframes collect { 0% { transform: scale(1); } 40% { transform: scale(1.22); filter: brightness(1.5); } 100% { transform: scale(1); } }
@keyframes tease { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.08); filter: brightness(1.35); } }
@keyframes socketShuffle { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; transform: scale(0.85); } }
@keyframes spark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -110%) scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes jackpotLit { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 22px rgba(255, 201, 77, 0.8); } }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
    .cell.win .sym, .cell.tease .sym, .spin-btn.spinning svg, .jackpot.lit { animation: none; }
    .tile, .art { transition: none; }
    .strip.blur .sym { filter: none; }
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile-art { height: clamp(120px, 18vh, 170px); }
}

@media (max-width: 900px) {
    .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
    .marquee, .machine, .ticker { grid-column: 1; }
    .buy-btn {
        grid-column: 1;
        grid-row: 4;
        justify-self: center;
        margin: 10px 0 0;
        width: auto;
        min-height: 44px;
        border-radius: 999px;
        flex-direction: row;
        gap: 10px;
        padding: 0 18px;
    }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .lobby-head { align-items: stretch; }
    .wallet { justify-content: space-between; }
    .game-grid { grid-template-columns: minmax(0, 1fr); }
    .tile { flex-direction: row; flex-wrap: wrap; }
    .tile-art { width: 100%; height: 118px; }
    .art { width: 76px; }
    .art-1 { left: 18%; } .art-2 { left: calc(50% - 46px); width: 92px; } .art-3 { right: 18%; }
    .tile-body { padding: 12px 14px 4px; }
    .tile-foot { padding: 10px 14px 14px; width: 100%; }
    .chips li:nth-child(n+4) { display: none; }

    .game-bar { padding: 4px 6px; gap: 2px; }
    .back-btn span { display: none; }
    .bar-actions { gap: 0; }
    .marquee { margin-bottom: 8px; min-height: 34px; gap: 6px; }
    .chip { padding: 5px 10px; font-size: 11.5px; }
    .jackpot { padding: 2px 7px; border-radius: 10px; min-width: 0; }
    .jackpot span { font-size: 10px; }
    .jackpot b { font-size: 12px; }
    .ticker { font-size: 13px; margin-top: 8px; }
    .machine { padding: 5px; border-radius: 22px; }
    .window { border-radius: 18px; }

    .deck {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        grid-template-areas: "balance . win" "bet spin toggles";
        row-gap: 6px;
        column-gap: 10px;
        padding: 6px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }
    .bet-group { gap: 4px; justify-self: start; }
    .meter-bet { min-width: 52px; }
    .meter-bet .meter-value { font-size: 15px; }
    .spin-btn { width: 76px; height: 76px; }
    .spin-btn svg { width: 36px; height: 36px; }
    .deck-toggles { flex-direction: column; gap: 4px; justify-self: end; }
    .pill-btn { min-height: 44px; padding: 0 12px; font-size: 12px; }
    .toast { bottom: 150px; }
    .modal { padding: 8px; }
    .modal-body { padding: 6px 16px 18px; }
    .pay-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 380px) {
    .deck { column-gap: 6px; padding-left: 8px; padding-right: 8px; }
    .bet-group { gap: 2px; }
    .meter-bet { min-width: 46px; }
}

@media (max-width: 768px) {
    .tile:hover .art-1, .tile:hover .art-2, .tile:hover .art-3 { transform: none; }
}
