/* ============================================================================
   Draw stage (Civic Trust). Page chrome is themed via the .page-shell accent
   ramp (--accent-*). The slot machine / reel internals below are unchanged in
   structure — the JS in assets/draw/* depends on these class names — and only
   pick up the per-game accent for the settled balls.
   ========================================================================== */

.draw-stage {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Heading row ── */

.draw-stage__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.draw-stage__eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--accent-700);
    margin-bottom: 8px;
}

.draw-stage__title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink-900);
}

.draw-stage__spec {
    margin: 6px 0 0;
    font-size: 0.92rem;
    color: var(--ink-500);
}

/* ── Chamber: light console frame holding the (dark) draw machine ── */

.draw-chamber {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background:
        radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent-500) 7%, #fff) 0%, var(--surface) 60%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.draw-chamber::before {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--accent-500), var(--accent-600));
}

.draw-chamber__machine { display: inline-flex; }

/* ── Start button (centered over the chamber) ── */

.start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}
.start-button:hover { transform: translate(-50%, -50%) translateY(-1px); }
.start-button:active { transform: translate(-50%, -50%) scale(0.99); }
.start-button.hidden { display: none; }

/* ── Result tray (official record; filled as reels settle) ── */

.result-tray {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.25s ease, background-color 0.25s ease;
}
.result-tray--done { border-color: var(--ok-200); background: var(--ok-50); }

.result-tray__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-400);
    flex-shrink: 0;
}
.result-tray--done .result-tray__label { color: var(--ok-700); }

/* Segment groups inside the tray (e.g. main numbers │ Joker) */
.result-group { display: flex; align-items: center; gap: 10px; }
.result-group__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--joker-600);
    flex-shrink: 0;
}
.result-group__slots { display: flex; gap: 12px; flex-wrap: wrap; }
.result-group__sep { width: 1px; align-self: stretch; min-height: 34px; background: var(--line-strong); }
.result-tray--done .result-group__sep { background: var(--ok-200); }

.result-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ink-400);
    background: var(--surface-2);
    border: 2px dashed var(--line-strong);
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.result-slot--filled {
    color: #fff;
    border-style: solid;
    border-color: transparent;
    background: radial-gradient(circle at 35% 32%,
        color-mix(in srgb, var(--accent-500) 55%, #fff) 0%,
        var(--accent-500) 52%,
        var(--accent-700) 100%);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-600) 32%, transparent);
    animation: slot-pop 0.34s ease-out;
}
/* Joker (bonus) slot — gold, regardless of the game accent */
.result-slot--joker.result-slot--filled {
    background: radial-gradient(circle at 35% 32%, #ffe08a 0%, var(--joker-500) 52%, var(--joker-700) 100%);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--joker-600) 38%, transparent);
}
@keyframes slot-pop {
    0%   { transform: scale(1.28); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ============================================================================
   Slot Machine — structure unchanged (JS-dependent); accent applied to balls.
   ========================================================================== */

.slot-machine {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 40px;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    border-radius: 16px;
    border: 2px solid #3d566e;
    min-width: 600px;
    min-height: 200px;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.05),
        0 4px 20px rgba(0, 0, 0, 0.3);
}

.slot-machine-reels {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ── Segment group (e.g. 5 main reels │ 1 Joker reel) ── */

.slot-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.slot-group__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.55);
}

.slot-group--joker .slot-group__label {
    color: var(--joker-400);
    text-shadow: 0 0 10px color-mix(in srgb, var(--joker-500) 45%, transparent);
}

.slot-group__reels {
    display: flex;
    gap: 18px;
    align-items: center;
}

.slot-divider {
    align-self: center;
    width: 1px;
    height: 104px;
    margin: 0 6px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.18) 20%, rgba(255, 255, 255, 0.18) 80%, transparent);
}

/* ── Single Reel (circular window) ── */

.reel {
    /* content-box so the visible window is a true 100px (== REEL.cellHeight),
       giving the strip a 1:1 snap. The .page-shell border-box reset would
       otherwise shrink the window to 94px (100 − 2×3px border) while the strip
       still snaps on a 100px pitch, landing the ball ~3px low. */
    box-sizing: content-box;
    width: 100px;
    height: 100px;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle, #252545 0%, #1a1a2e 100%);
    border: 3px solid #475569;
    border-radius: 50%;
    box-shadow:
        inset 0 0 24px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

.reel::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
        ellipse 70% 50% at 40% 30%,
        rgba(255, 255, 255, 0.12) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 2;
}

.reel--settled {
    border-color: transparent;
    box-shadow:
        0 0 18px color-mix(in srgb, var(--accent-500, #3b82f6) 50%, transparent),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ── Reel Strip (slides vertically) ── */

.reel-strip {
    display: flex;
    flex-direction: column;
    transition: none;
}

.reel-strip.spinning {
    animation: reel-spin 0.25s linear infinite;
}

@keyframes reel-spin {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-300px); }
}

/* ── Number Cell ── */

.reel-cell {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
    padding: 12px;
    box-sizing: border-box;
}

/* ── Ball inside each cell ── */

.reel-ball {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e8e8e8 0%, #c0c0c0 50%, #999 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #333;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
    box-shadow:
        inset -3px -3px 6px rgba(0, 0, 0, 0.2),
        inset 3px 3px 6px rgba(255, 255, 255, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Settled ball — colored with the per-game accent */
.reel-cell--settled .reel-ball {
    background: radial-gradient(circle at 35% 35%,
        color-mix(in srgb, var(--accent-500, #3b82f6) 55%, #fff) 0%,
        var(--accent-500, #3b82f6) 50%,
        var(--accent-700, #1d4ed8) 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow:
        inset -3px -3px 6px rgba(0, 0, 0, 0.25),
        inset 3px 3px 6px rgba(255, 255, 255, 0.2),
        0 0 14px color-mix(in srgb, var(--accent-500, #3b82f6) 50%, transparent),
        0 2px 6px rgba(0, 0, 0, 0.3);
    animation: ball-pop 0.35s ease-out;
}

@keyframes ball-pop {
    0%   { transform: scale(1.25); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ── Joker reel — gold, distinct from the main (accent) reels ── */

.reel--joker.reel--settled {
    box-shadow:
        0 0 18px color-mix(in srgb, var(--joker-500) 55%, transparent),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

.reel--joker .reel-cell--settled .reel-ball {
    background: radial-gradient(circle at 35% 35%, #ffe9a8 0%, var(--joker-500) 50%, var(--joker-700) 100%);
    box-shadow:
        inset -3px -3px 6px rgba(0, 0, 0, 0.25),
        inset 3px 3px 6px rgba(255, 255, 255, 0.25),
        0 0 14px color-mix(in srgb, var(--joker-500) 55%, transparent),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ── Header meta: back link ── */

.header-meta__back {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-500);
    text-decoration: none;
    transition: color 0.16s ease;
}
.header-meta__back:hover { color: var(--accent-700); }

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
    .reel-cell--settled .reel-ball,
    .result-slot--filled { animation: none; }
    .status-pill--live .status-pill__dot { animation: none; }
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .draw-stage { gap: 18px; }
    .draw-stage__title { font-size: 1.4rem; }

    .draw-chamber { padding: 28px 14px; }

    .slot-machine {
        min-width: unset;
        padding: 32px 16px;
    }
    .slot-machine-reels { gap: 6px; }
    .slot-group { gap: 10px; }
    .slot-group__reels { gap: 10px; }
    .slot-divider { height: 72px; margin: 0 3px; }
    .reel { width: 68px; height: 68px; }
    .reel-cell { width: 68px; height: 68px; padding: 8px; }
    .reel-ball { font-size: 1.4rem; }

    .result-slot { width: 40px; height: 40px; font-size: 1rem; }
}
