/* Lucky Spin game page.
   (Controllers/GamesController.cs, Views/Games/LuckySpin.cshtml)

   The page also loads predict.css and carries the .predict-shell class, purely so
   the shared top bar keeps the same height and logo sizing it has on the Predict
   pages - those rules are keyed on body:has(.predict-shell).

   The past-draw table is NOT styled here: it reuses .history-result-table and the
   .pos-* prize badges from site.css, so it looks identical to the past-result
   search on the home page. Everything else below is Lucky Spin's own. */

.spin-shell {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px 16px calc(126px + env(safe-area-inset-bottom));
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.spin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.spin-back {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    text-decoration: none;
}

.spin-topbar h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .01em;
}

.spin-tagline {
    margin: 2px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

/* ── The cabinet ────────────────────────────────────────────────────────────
   Built in CSS so it follows the light/dark theme. To drop artwork in later,
   put a background-image on .spin-machine and remove its background/border. */

.spin-machine {
    position: relative;
    overflow: hidden;
    padding: 18px 16px 20px;
    border: 1px solid rgba(216, 169, 63, .45);
    border-radius: 20px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(216, 169, 63, .16), transparent 62%),
        var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

/* Soft gold wash behind the mascot; purely decorative. */
.spin-machine-glow {
    position: absolute;
    top: -70px;
    left: 50%;
    width: 260px;
    height: 180px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(216, 169, 63, .28);
    filter: blur(46px);
    pointer-events: none;
}

.spin-machine-head {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.spin-mascot {
    /*width: 292px;*/
    height: 192px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .28));
}

/* Marquee bulbs above the reels. */
.spin-lights {
    display: flex;
    gap: 7px;
}

.spin-lights i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(216, 169, 63, .35);
    animation: spin-bulb 1.8s ease-in-out infinite;
}

.spin-lights i:nth-child(2) { animation-delay: .18s; }
.spin-lights i:nth-child(3) { animation-delay: .36s; }
.spin-lights i:nth-child(4) { animation-delay: .54s; }
.spin-lights i:nth-child(5) { animation-delay: .72s; }

@keyframes spin-bulb {
    0%, 100% { background: rgba(216, 169, 63, .3); }
    50%      { background: #f0c65a; box-shadow: 0 0 8px rgba(240, 198, 90, .85); }
}

/* ── Reels ──────────────────────────────────────────────────────────────── */

.spin-reels {
    --spin-cell: 84px; /* read by luckyspin.js - change it here only */
    position: relative;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, #d8a93f 0%, #a97517 52%, #8b5c12 100%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 8px rgba(0, 0, 0, .3);
}

/* The win line across the reel window, like a real slot cabinet. */
.spin-payline {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 50%;
    height: 2px;
    transform: translateY(-1px);
/*    background: linear-gradient(90deg, transparent, rgba(255, 68, 68, .75), transparent);
*/    pointer-events: none;
    z-index: 2;
}

.spin-reel {
    position: relative;
    width: 64px;
    height: var(--spin-cell);
    overflow: hidden;
    border-radius: 9px;
    background: var(--surface);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, .32), 0 1px 0 rgba(255, 255, 255, .3);
}

/* Fades the digit as it enters and leaves the window, which reads as depth. */
.spin-reel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, .28) 0%,
        transparent 30%,
        transparent 70%,
        rgba(0, 0, 0, .28) 100%);
}

.spin-strip {
    will-change: transform;
    transform: translateY(0);
}

.spin-strip span {
    display: block;
    height: var(--spin-cell);
    line-height: var(--spin-cell);
    color: var(--text);
    font-size: 42px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* ── Start button ───────────────────────────────────────────────────────── */

.spin-start-btn {
    position: relative;
    width: 100%;
    margin-top: 18px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #8b5c12, #6d4710);
    cursor: pointer;
}

.spin-start-btn span {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, #e8bd52, #c8952c);
    color: #40290a;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    transform: translateY(-3px);
    transition: transform .09s ease;
}

.spin-start-btn:active span {
    transform: translateY(0);
}

.spin-start-btn[disabled] {
    cursor: default;
}

.spin-start-btn[disabled] span {
    transform: translateY(0);
    opacity: .75;
}

.spin-status {
    margin: 12px 0 0;
    min-height: 20px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
}

.spin-status.is-error {
    color: #c0392b;
}

/* ── Section shell shared by the past-draw and history panels ───────────── */

.spin-past,
.spin-history,
.spin-about {
    margin-top: 20px;
}

.spin-section-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.spin-section-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
}

.spin-section-head span {
    color: var(--text-soft);
    font-size: 11.5px;
}

.spin-empty {
    margin: 0;
    padding: 18px 0;
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
}

/* ── History chips ──────────────────────────────────────────────────────── */

.spin-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
}

.spin-history-list .spin-empty {
    grid-column: 1 / -1;
}

.spin-history-chip {
    display: grid;
    gap: 2px;
    padding: 10px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    text-align: center;
}

.spin-history-chip strong {
    color: var(--gold);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .1em;
    font-variant-numeric: tabular-nums;
}

.spin-history-chip span {
    color: var(--text-soft);
    font-size: 10.5px;
}

/* Briefly marks the spin that was just added. */
.spin-history-chip.is-new {
    animation: spin-chip-in .45s ease;
    border-color: rgba(216, 169, 63, .7);
}

@keyframes spin-chip-in {
    from { opacity: 0; transform: translateY(-6px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

/* ── Footer copy ────────────────────────────────────────────────────────── */

.spin-about h2 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 900;
}

.spin-about p {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.6;
}

.spin-disclaimer {
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.6;
}

@media (max-width: 360px) {
    .spin-reels {
        --spin-cell: 72px;
        gap: 6px;
    }

    .spin-reel {
        width: 56px;
    }

    .spin-strip span {
        font-size: 34px;
    }

    .spin-history-list {
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    }
}

/* Respect a reduced-motion preference: the reels jump straight to the result
   and the decorative bulbs stop. luckyspin.js checks the same query. */
@media (prefers-reduced-motion: reduce) {
    .spin-strip {
        transition: none !important;
    }

    .spin-lights i,
    .spin-history-chip.is-new {
        animation: none;
    }
}
