/**
 * Web Demo by Philip Newborough
 * More info: https://philipnewborough.co.uk/demos/
 */

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Design tokens ──────────────────────────────────────────────────────── */
/* Synthwave / neon arcade 80s CRT palette:
   hot pink (#ff1aff), electric cyan (#00e5ff), deep space, amber CRT text */
:root {
    --bg:           #080614;          /* deep space black-purple            */
    --bg-glow:      #120830;          /* slightly lighter for radial centre */
    --accent:       #ff1aff;          /* hot neon magenta                   */
    --accent-dim:   #5c0a5c;          /* deep magenta                       */
    --gold:         #00cfff;          /* neon sky blue (CRT text glow)      */
    --unicorn:      #bf5fff;          /* synthwave vivid purple             */
    --cyan:         #00e5ff;          /* electric cyan                      */
    --surface:      rgba(255, 255, 255, 0.06);
    --radius:       10px;
}

/* ── Body ───────────────────────────────────────────────────────────────── */
body {
    font-family: "BitcountGridSingleInk-VariableFont_CRSV,ELSH,ELXP,SZP1,SZP2,XPN1,XPN2,YPN1,YPN2,slnt,wght_20260331_162924", Arial, sans-serif;
    background: url('../img/background.png') center center / cover no-repeat;
    background-attachment: fixed;
    background-color: var(--bg);
    color: var(--gold);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top))
             max(12px, env(safe-area-inset-right))
             max(16px, env(safe-area-inset-bottom))
             max(12px, env(safe-area-inset-left));
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-x pan-y;
    overscroll-behavior: none;
}

main.machine {
    position: relative;
}

/* ── Machine wrapper ────────────────────────────────────────────────────── */
.machine {
    width: 100%;
    max-width: 640px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    border: 3px solid transparent;
    background-clip: padding-box;
    outline: 3px solid transparent;
    box-shadow: inset 0 0 8px rgba(0, 229, 255, 0.06);
}

/* Outer neon glow lives on ::after so only opacity is animated (compositor-only, no repaint) */
.machine::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    box-shadow:
        0 0  6px 2px  var(--cyan),
        0 0 20px 5px  var(--accent),
        0 0 44px 10px rgba(255, 26, 255, 0.45),
        0 0 64px 16px rgba(0, 229, 255, 0.18);
    pointer-events: none;
    will-change: opacity;
    animation: neon-border-pulse 2.5s ease-in-out infinite;
}

@keyframes neon-border-pulse {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.35; }
}

/* ── Score coin icon ──────────────────────────────────────────────────── */
.score-coin {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

/* ── Info display (above wheels) ────────────────────────────────────────── */
.info {
    background: var(--surface);
    border: 1px solid rgba(0, 229, 255, 0.25); /* cyan CRT border */
    border-radius: var(--radius);
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px 16px;
    font-size: clamp(15.6px, 3.9vw, 23.4px);
    text-align: center;
}

.info span {
    display: inline-block;
    line-height: 0.8;
}

.info span.flash,
.info span.score {
    font-size: clamp(28px, 7vw, 48px);
}

.info span.flash {
    will-change: opacity;
    animation: flash 1s linear infinite;
}

.info span.flash-fast {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    animation: flash 0.5s linear infinite;
}

.info span.marquee {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    white-space: nowrap;
    animation: marquee 4s linear infinite;
}

.info span.gameover {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    animation: flash 4s linear infinite;
}

/* ── Wheels canvas ──────────────────────────────────────────────────────── */
.wheels {
    width: 100%;
    aspect-ratio: 3 / 1.2;
    max-height: 50vh;
    border-radius: var(--radius);
    display: block;
    border: 2px solid rgba(0, 229, 255, 0.3);
    box-shadow:
        inset 0 6px 24px rgba(0, 0, 0, 0.4),
        0 0  6px 2px  rgba(0, 229, 255, 0.6),
        0 0 20px 6px  rgba(255, 26, 255, 0.32),
        0 0 44px 12px rgba(0, 229, 255, 0.14);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
/* ── Action button row ──────────────────────────────────────────────────── */
.action-btns {
    display: flex;
    gap: 10px;
}

.btn--small {
    flex: none;
    padding: 6px 10px;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.04);
}

.btn--tiny {
    flex: none;
    padding: 6px 8px;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: none;
    border-radius: 6px;
    margin-left: 6px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
}

.settings-row--reset { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.settings-reset { background: linear-gradient(180deg,#e74c3c,#c0392b) !important; color: #fff !important; border-color: #a93226 !important; }
.settings-reset:hover { background: linear-gradient(180deg,#ec6558,#c0392b) !important; }
.settings-reset__help { font-size:0.85em; opacity:0.8; margin-top:6px; order:3; flex-basis:100%; }
.settings-reset-confirm { display:none; align-items:center; gap:8px; order:2; padding:6px 8px; border-radius:8px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.04); }
.settings-reset-confirm span { font-size:13px; margin-right:8px; opacity:0.95; }

/* Confirm / Cancel button colors */
.btn--confirm,
.btn--cancel {
    background: linear-gradient(180deg,#e74c3c,#c0392b) !important;
    color: #fff !important;
    border: 1px solid #a93226 !important;
    text-shadow: none;
}
.btn--confirm:active,
.btn--cancel:active { transform: translateY(1px); }

.btn {
    font-family: inherit;
    flex: 1;
    padding: clamp(14px, 2.5vw, 24px) 0;
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #05d9e8, #00b4c8);
    color: #001820;
    font-size: clamp(23.4px, 5.2vw, 44.2px);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: default;
    line-height: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.20);
}

/* Collect button uses hot pink neon styling */
.btn-collect {
    background: linear-gradient(180deg, #ff1aff, #cc00cc);
    color: #fff;
}

.btn.ready {
    will-change: opacity;
    animation: btn-pulse 1s ease-in-out infinite;
    cursor: pointer;
    box-shadow: 0 0 28px rgba(0, 229, 255, 0.65),
                0 0 8px  rgba(0, 229, 255, 0.35);
}

.btn.ready:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

.btn-collect.ready {
    animation: collect-pulse 1s ease-in-out infinite;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(180deg, #ff1aff, #cc00cc);
    box-shadow: 0 0 24px rgba(255, 26, 255, 0.65),
                0 0 6px  rgba(255, 26, 255, 0.35);
}

.btn-collect.ready:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

.btn.gameover {
    background: #1a0a2e;
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

/* Small buttons for settings / confirmations */
.btn--small {
    flex: none;
    padding: 6px 10px;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: none;
    border-radius: 6px;
}

.btn--tiny {
    flex: none;
    padding: 6px 8px;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: none;
    border-radius: 6px;
    margin-left: 6px;
}

.settings-row--reset { display:flex; align-items:center; gap:12px; }
.settings-reset__help { font-size:0.85em; opacity:0.8; margin-top:6px; }
.settings-reset-confirm { display:none; align-items:center; gap:8px; }
.settings-reset-confirm:not([hidden]) { display:flex; }
.settings-reset-confirm__actions { display:flex; align-items:center; }

/* ── Gamble info ──────────────────────────────────────────────────────────── */
.info span.gamble {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    color: var(--gold);
}

/* ── Higher / Lower info ──────────────────────────────────────────────────── */
.info span.hl-game {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    color: var(--gold);
    line-height: 1.15;
}

/* ── Pick a Box info ──────────────────────────────────────────────────────── */
.info span.pb-game {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    color: var(--gold);
    line-height: 1.15;
}

/* ── Spin the Wheel info ───────────────────────────────────────────── */
.info span.sw-game {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    color: var(--gold);
    line-height: 1.15;
}

/* ── Quick Stop info ──────────────────────────────────────────────────────── */
.info span.qs-game {
    font-size: clamp(18.2px, 4.55vw, 31.2px);
    color: var(--gold);
    line-height: 1.15;
}

/* ── Nudge buttons ──────────────────────────────────────────────────────── */
.nudge-btns {
    display: flex;
    gap: 10px;
}

.btn-nudge-up,
.btn-nudge-down {
    font-family: inherit;
    flex: 1;
    padding: clamp(6px, 1.2vw, 10px) 0;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.12);
    font-size: clamp(13px, 2.86vw, 18.2px);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: default;
    line-height: 1;
    user-select: none;
}

.btn-nudge-up.nudgeable,
.btn-nudge-down.nudgeable {
    color: var(--unicorn);
    border-color: var(--unicorn);
    cursor: pointer;
    animation: nudge-flash 0.6s ease-in-out infinite;
}

.btn-nudge-up.nudgeable:active,
.btn-nudge-down.nudgeable:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

/* ── Higher / Lower active nudge buttons (middle column only) ───────────── */
.btn-nudge-up.hl-active,
.btn-nudge-down.hl-active {
    color: #00e5ff;
    border-color: #00e5ff;
    cursor: pointer;
    animation: hl-flash 0.6s ease-in-out infinite;
}

.btn-nudge-up.hl-active:active,
.btn-nudge-down.hl-active:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

/* ── Hold buttons ───────────────────────────────────────────────────────── */
.hold-btns {
    display: flex;
    gap: 10px;
}

.btn-hold {
    font-family: inherit;
    flex: 1;
    padding: clamp(8px, 1.5vw, 14px) 0;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.12);
    font-size: clamp(11.7px, 2.6vw, 16.9px);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: default;
    line-height: 1;
    user-select: none;
}

.btn-hold.holdable {
    color: var(--gold);
    border-color: var(--gold);
    cursor: pointer;
    animation: hold-flash 0.6s ease-in-out infinite;
}

.btn-hold.held {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 20px rgba(255, 26, 255, 0.65),
                0 0  6px rgba(255, 26, 255, 0.45);
    cursor: pointer;
    animation: none;
}

.btn-nudge-up.pb-active {
    color: #ff9f0a;
    border-color: #ff9f0a;
    cursor: pointer;
    animation: pb-flash 0.6s ease-in-out infinite;
}

.btn-nudge-up.pb-active:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

/* ── Signage ────────────────────────────────────────────────────────────── */
.signage {
    background: #0a0520;
    border: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 6px 10px;
    text-align: center;
    box-shadow: 0 0 16px rgba(255, 26, 255, 0.35), inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.signage-text {
    font-size: clamp(24px, 6.5vw, 52px);
    font-weight: 900;
    letter-spacing: 0.14em;
    color: var(--gold);
    text-shadow:
        0 0  6px var(--gold),
        0 0 18px #0088ff,
        0 0 36px #0044cc;
    padding: 4px 0;
    line-height: 1;
    will-change: opacity;
    animation: sign-flicker 5s linear infinite;
}

.signage-lights {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 3px 0;
}

/* Animate the two light rows as single units — 2 compositor layers instead of 28 */
.signage-lights:first-child  { will-change: opacity; animation: bulb-chase 1.4s linear infinite 0s;   }
.signage-lights:last-child   { will-change: opacity; animation: bulb-chase 1.4s linear infinite 0.7s; }

.bulb {
    display: inline-block;
    width: clamp(7px, 1.4vw, 11px);
    height: clamp(7px, 1.4vw, 11px);
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 5px 2px var(--cyan), 0 0 2px #fff;
}

/* Bottom row bulbs use hot pink to mirror the dual-neon colour scheme */
.signage-lights:last-child .bulb {
    background: var(--accent);
    box-shadow: 0 0 5px 2px var(--accent), 0 0 2px #fff;
}

/* ── Keyframes ──────────────────────────────────────────────────────────── */
@keyframes bulb-chase {
    0%, 44%, 100% { opacity: 1;    }
    50%,  94%     { opacity: 0.06; }
}

@keyframes sign-flicker {
    0%, 18%, 20%, 22%, 24%, 52%, 54%, 100% { opacity: 1;    }
    19%, 23%, 53%                           { opacity: 0.08; }
}

/* Mobile-friendly fallback: disable fixed background on touch/coarse pointers to avoid performance issues */
@media (pointer: coarse), (max-width: 768px) {
    body {
        background-attachment: scroll;
        background-position: center top;
    }
}

@keyframes btn-pulse {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.6; }
}

@keyframes hold-flash {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.2; }
}

@keyframes nudge-flash {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.2; }
}

@keyframes hl-flash {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.2; }
}

@keyframes pb-flash {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.2; }
}

@keyframes flash {
    0%, 100% { opacity: 0; }
    50%       { opacity: 1; }
}

@keyframes collect-pulse {
    0%, 100% { opacity: 1;    }
    50%       { opacity: 0.6; }
}

@keyframes marquee {
    from { transform: translateX(100vw); }
    to   { transform: translateX(-100vw); }
}

/* ── Pay table ──────────────────────────────────────────────────────────── */
.pay-table {
    position: relative;
    background: var(--surface);
    border: 1px solid rgba(199, 125, 255, 0.15);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: clamp(10.4px, 2.3vw, 14px);
}

.pay-heading {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9em;
    color: rgba(0, 207, 255, 0.45);
    margin-bottom: 8px;
}

.pay-row {
    display: grid;
    grid-template-columns: 2em 1fr 1fr;
    text-align: center;
    padding: 2px 0;
    color: rgba(0, 207, 255, 0.7);
}

.pay-row--head {
    font-size: 0.8em;
    color: rgba(0, 207, 255, 0.35);
    border-bottom: 1px solid rgba(199, 125, 255, 0.15);
    padding-bottom: 5px;
    margin-bottom: 2px;
}

.pay-row span:first-child {
    text-align: left;
    font-size: 1.3em;
    line-height: 1.4;
}

.pay-row--head span:first-child {
    font-size: 1em;
}

.pay-row--poop {
    color: var(--accent);
    opacity: 0.7;
    border-top: 1px solid rgba(199, 125, 255, 0.15);
    margin-top: 3px;
    padding-top: 5px;
}

.pay-row--skull {
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
}

.pay-footnote {
    text-align: center;
    font-size: 0.75em;
    color: rgba(0, 207, 255, 0.3);
    margin-top: 9px;
}

/* ── Win explosion canvas ───────────────────────────────────────────────── */
#explosion-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

/* ── Spin the Wheel canvas ──────────────────────────────────────────────── */
#wheel-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 90;
    display: none;
}
#wheel-canvas.active {
    display: block;
}

/* ── Game Over modal ───────────────────────────────────────────────────── */
.game-over-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.09) 3px,
            rgba(0, 0, 0, 0.09) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(20, 3, 35, 0.97) 0%, rgba(8, 2, 16, 0.99) 72%);
    opacity: 0;
    animation: none;
}

.game-over-modal[hidden] {
    display: none;
}

.game-over-modal.game-over-modal--in {
    animation: gameover-fadein 3s ease forwards;
}

.game-over-modal__inner {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
}

.game-over-modal__title {
    margin: 0;
    font-size: clamp(22px, 5vw, 36px);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ff1aff;
    text-shadow: 0 0 18px rgba(255, 26, 255, 0.8), 0 0 6px rgba(255, 26, 255, 0.5);
}

.game-over-modal__body {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 26, 255, 0.22);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: clamp(13px, 2.8vw, 15.5px);
    line-height: 1.7;
    text-align: left;
    color: rgba(255, 180, 220, 0.72);
}

.game-over-modal__body p:first-child {
    color: rgba(255, 200, 235, 0.92);
}

.game-over-modal__kicker {
    color: var(--accent) !important;
    font-size: 1.07em;
}

.game-over-modal__time-prompt {
    color: rgba(255, 180, 220, 0.6);
    font-size: clamp(12px, 2.4vw, 14px);
    font-style: italic;
    margin: 0;
}

.btn-time-travel {
    font-family: inherit;
    padding: clamp(14px, 2.4vw, 20px) clamp(36px, 8vw, 72px);
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ff1aff, #cc00cc);
    color: #fff;
    font-size: clamp(20px, 4.5vw, 32px);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
    cursor: pointer;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    animation: btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 24px rgba(255, 26, 255, 0.6),
                0 0  6px rgba(255, 26, 255, 0.35);
}

.btn-time-travel:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

@keyframes gameover-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Winner modal ───────────────────────────────────────────────────────── */
.winner-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.09) 3px,
            rgba(0, 0, 0, 0.09) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(30, 20, 0, 0.97) 0%, rgba(10, 8, 0, 0.99) 72%);
    opacity: 0;
    animation: none;
}

.winner-modal[hidden] {
    display: none;
}

.winner-modal.winner-modal--in {
    animation: winner-fadein 3s ease forwards;
}

.winner-modal__inner {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
}

.winner-modal__title {
    margin: 0;
    font-size: clamp(22px, 5vw, 36px);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ffd700;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.8), 0 0 6px rgba(255, 215, 0, 0.5);
}

.winner-modal__body {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.22);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: clamp(13px, 2.8vw, 15.5px);
    line-height: 1.7;
    text-align: left;
    color: rgba(255, 230, 150, 0.72);
}

.winner-modal__body p:first-child {
    color: rgba(255, 240, 180, 0.92);
}

.winner-modal__kicker {
    color: #ffd700 !important;
    font-size: 1.07em;
}

.winner-modal__rewind-prompt {
    color: rgba(255, 230, 150, 0.6);
    font-size: clamp(12px, 2.4vw, 14px);
    font-style: italic;
    margin: 0;
}

.btn-winner-rewind {
    font-family: inherit;
    padding: clamp(14px, 2.4vw, 20px) clamp(36px, 8vw, 72px);
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffd700, #cc9900);
    color: #1a0a00;
    font-size: clamp(20px, 4.5vw, 32px);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
    cursor: pointer;
    text-shadow: 0 1px 4px rgba(255, 255, 255, 0.2);
    animation: btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.6),
                0 0  6px rgba(255, 215, 0, 0.35);
}

.btn-winner-rewind:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

@keyframes winner-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes elem-glitch-out {
    0%   { opacity: 1; transform: none; filter: none; }
    15%  { opacity: 0.7; transform: skewX(10deg) scaleY(1.03); filter: brightness(2.5) hue-rotate(90deg); }
    35%  { opacity: 0.4; transform: skewX(-6deg) scaleX(0.97); filter: brightness(0.4); }
    55%  { opacity: 0.8; transform: skewX(4deg); filter: brightness(3) hue-rotate(200deg) saturate(3); }
    75%  { opacity: 0.15; transform: scaleX(0.92) skewX(-3deg); filter: brightness(0.2); }
    100% { opacity: 0; transform: scaleX(0.85); filter: none; }
}

.time-travel-vanish {
    animation: elem-glitch-out 0.45s ease forwards;
    pointer-events: none;
}

/* ── Welcome modal ──────────────────────────────────────────────────────── */
.welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Rich dark background with CRT scanline overlay */
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.09) 3px,
            rgba(0, 0, 0, 0.09) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(28, 15, 58, 0.96) 0%, rgba(12, 7, 21, 0.99) 72%);
}

.welcome-modal.welcome-modal--out {
    animation: modal-fadeout 0.45s ease forwards;
    pointer-events: none;
}

.welcome-modal__inner {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
    animation: modal-fadein 0.9s ease both;
}

.welcome-modal__year {
    font-size: clamp(72px, 20vw, 130px);
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1;
    color: var(--gold);
    text-shadow:
        0 0  8px var(--gold),
        0 0 24px #0088ff,
        0 0 56px #0044cc;
    animation: sign-flicker 7s linear infinite;
}

.welcome-modal__body {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(199, 125, 255, 0.22);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: clamp(13px, 2.8vw, 15.5px);
    line-height: 1.7;
    text-align: left;
    color: rgba(0, 207, 255, 0.72);
}

.welcome-modal__body p:first-child {
    color: rgba(0, 207, 255, 0.92);
}

.welcome-modal__kicker {
    color: var(--unicorn) !important;
    font-size: 1.07em;
}

.btn-enter {
    font-family: inherit;
    padding: clamp(14px, 2.4vw, 20px) clamp(36px, 8vw, 72px);
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ff1aff, #cc00cc);
    color: #fff;
    font-size: clamp(20px, 4.5vw, 32px);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
    cursor: pointer;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    animation: btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 24px rgba(255, 26, 255, 0.6),
                0 0  6px rgba(255, 26, 255, 0.35);
}

.btn-enter:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

/* ── Welcome Back modal ─────────────────────────────────────────────────── */
.welcome-back-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.09) 3px,
            rgba(0, 0, 0, 0.09) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(15, 5, 40, 0.97) 0%, rgba(8, 2, 20, 0.99) 72%);
}

.welcome-back-modal[hidden] { display: none; }

.welcome-back-modal.welcome-back-modal--out {
    animation: modal-fadeout 0.45s ease forwards;
    pointer-events: none;
}

.welcome-back-modal__inner {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    text-align: center;
    animation: modal-fadein 0.9s ease both;
}

.welcome-back-modal__header {
    font-size: clamp(12px, 2.4vw, 15px);
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--cyan);
    text-shadow:
        0 0  6px var(--cyan),
        0 0 20px rgba(0, 229, 255, 0.55);
    font-family: monospace;
    animation: sign-flicker 8s linear infinite;
}

.welcome-back-modal__body {
    background: rgba(0, 229, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: clamp(13px, 2.8vw, 15.5px);
    line-height: 1.7;
    text-align: left;
    color: rgba(180, 240, 255, 0.72);
}

.welcome-back-modal__body p:first-child {
    color: rgba(200, 245, 255, 0.92);
}

.welcome-back-modal__actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-continue {
    font-family: inherit;
    padding: clamp(12px, 2vw, 16px) clamp(28px, 6vw, 56px);
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--cyan), #009bb0);
    color: #001820;
    font-size: clamp(16px, 3.5vw, 24px);
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 3px;
    line-height: 1;
    cursor: pointer;
    text-shadow: none;
    animation: btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.6),
                0 0  6px rgba(0, 229, 255, 0.35);
}

.btn-continue:active {
    transform: scale(0.97);
    animation-play-state: paused;
}

.btn-reset-game {
    font-family: inherit;
    padding: clamp(12px, 2vw, 16px) clamp(28px, 6vw, 56px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: clamp(13px, 2.8vw, 19px);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-reset-game:hover {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
}

.btn-reset-game:active {
    transform: scale(0.97);
}

@keyframes modal-fadein {
    from { opacity: 0; transform: scale(1.015); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes modal-fadeout {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.98); }
}

/* ── Mobile (≤ 600 px) ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wheels {
        max-height: 45vw;
    }

    .btn {
        padding: 18px 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    }

    .btn--small { padding: 8px 14px; }
    .btn--tiny  { padding: 8px 12px; }

    .btn.ready:active {
        transform: scale(0.97);
        animation-play-state: paused;
    }

    .btn-collect.ready:active {
        transform: scale(0.97);
        animation-play-state: paused;
    }
}

/* ── RPG Event modal ────────────────────────────────────────────────────── */
.rpg-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(10, 2, 30, 0.97) 0%, rgba(5, 2, 14, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.rpg-modal[hidden] { display: none; }

.rpg-modal__inner {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: rgba(10, 4, 30, 0.97);
    border: 2px solid rgba(199, 125, 255, 0.35);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow: 0 0 40px rgba(191,95,255,0.18), 0 0 80px rgba(255,26,255,0.12), inset 0 2px 8px rgba(255,255,255,0.03);
    overflow: hidden;
}

/* CRT scanlines overlay, purely decorative */
.rpg-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.rpg-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.rpg-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.rpg-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(0, 207, 255, 0.55);
    text-transform: uppercase;
}

.rpg-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(0, 207, 255, 0.78);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

/* Dice area */
.rpg-modal__dice-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}
.rpg-modal__dice-area[hidden] { display: none; }

.rpg-dice {
    font-size: clamp(40px, 9vw, 60px);
    line-height: 1;
    text-shadow: 0 0 20px rgba(199,125,255,0.6);
    transition: transform 0.08s linear;
}
.rpg-dice.rolling {
    animation: dice-roll 0.12s linear infinite;
}
@keyframes dice-roll {
    0%   { transform: rotate(-8deg) scale(1.05); }
    25%  { transform: rotate(6deg)  scale(0.96); }
    50%  { transform: rotate(-4deg) scale(1.08); }
    75%  { transform: rotate(8deg)  scale(0.95); }
    100% { transform: rotate(-8deg) scale(1.05); }
}

.rpg-dice-label {
    font-size: clamp(11px, 2.4vw, 13px);
    color: rgba(0, 207, 255, 0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 1.4em;
}

/* Options */
.rpg-modal__options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.rpg-option-btn {
    font-family: inherit;
    width: 100%;
    padding: clamp(10px, 2vw, 14px) 16px;
    border-radius: 8px;
    border: 2px solid rgba(199,125,255,0.4);
    background: rgba(199,125,255,0.07);
    color: var(--unicorn);
    font-size: clamp(12px, 2.6vw, 14.5px);
    text-align: left;
    cursor: pointer;
    line-height: 1.4;
    letter-spacing: 0.03em;
    transition: background 180ms, border-color 180ms, box-shadow 180ms;
}
.rpg-option-btn:hover {
    background: rgba(199,125,255,0.18);
    border-color: var(--unicorn);
    box-shadow: 0 0 16px rgba(199,125,255,0.25);
}
.rpg-option-btn:disabled {
    cursor: not-allowed;
    color: rgba(199,125,255,0.55);
    background: rgba(199,125,255,0.03);
    border-color: rgba(199,125,255,0.2);
    box-shadow: none;
    opacity: 0.65;
}
.rpg-option-btn:disabled:hover {
    background: rgba(199,125,255,0.03);
    border-color: rgba(199,125,255,0.2);
    box-shadow: none;
}
.rpg-option-btn:active { transform: scale(0.98); }

/* Result text */
.rpg-modal__result {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.25);
    position: relative;
    z-index: 2;
}
.rpg-modal__result[hidden] { display: none; }
.rpg-modal__result p {
    margin: 0;
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    color: rgba(0, 207, 255, 0.9);
}
.rpg-modal__result.success { border-color: rgba(48,209,88,0.4); }
.rpg-modal__result.failure { border-color: rgba(255,45,85,0.4); }
.rpg-modal__result.success p { color: #30d158; }
.rpg-modal__result.failure p { color: var(--accent); }

/* Continue button */
.rpg-modal__continue {
    font-family: inherit;
    margin-top: 18px;
    width: 100%;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: clamp(15px, 3.5vw, 20px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    animation: btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(255,26,255,0.5), 0 0 6px rgba(255,26,255,0.3);
    position: relative;
    z-index: 2;
}
.rpg-modal__continue[hidden] { display: none; }
.rpg-modal__continue:active { transform: scale(0.97); animation-play-state: paused; }
.rpg-modal__continue.walkaway {
    background: #1a2a3a;
    box-shadow: 0 0 22px rgba(90,200,250,0.25);
    animation: none;
    color: rgba(255,255,255,0.7);
}

/* ── Settings modal + button ───────────────────────────────────────────── */
.settings-button {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 300;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--cyan) 0%, var(--accent) 55%, #4a0080 100%);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 30px rgba(0,229,255,0.18), 0 0 40px rgba(255,26,255,0.18), inset 0 2px 8px rgba(255,255,255,0.06);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    cursor: pointer;
    transform: translateZ(0);
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms ease;
    backdrop-filter: blur(4px);
}
.settings-button::before {
    /* soft neon halo */
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 18px;
    pointer-events: none;
    box-shadow: 0 0 24px rgba(0,229,255,0.25), 0 0 48px rgba(255,26,255,0.12);
    filter: blur(6px);
    opacity: 0.95;
}
.settings-button::after {
    content: '⚙️';
    font-size: 1.4rem;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 8px rgba(255,255,255,0.9), 0 0 18px rgba(199,125,255,0.6);
    transition: transform 260ms ease;
}
.settings-button:hover {
    transform: translateY(-4px) rotate(-6deg) scale(1.02);
    box-shadow: 0 14px 44px rgba(0,229,255,0.28), 0 0 64px rgba(255,26,255,0.25);
}
.settings-button:active {
    transform: translateY(0) rotate(0) scale(0.98);
}

/* Cassette variant overrides */
.settings-button--cassette {
    width: 92px;
    height: 60px;
    border-radius: 10px;
    padding: 6px 8px;
    background: linear-gradient(180deg,#0a0020 0%, #2a0045 55%, #0d0018 100%);
    border: 2px solid rgba(255,255,255,0.06);
    box-shadow: 0 10px 34px rgba(0,229,255,0.12), 0 0 44px rgba(255,26,255,0.14), inset 0 2px 8px rgba(255,255,255,0.03);
}
.settings-button--cassette::before { box-shadow: 0 0 28px rgba(0,229,255,0.18), 0 0 58px rgba(255,26,255,0.10); border-radius: 12px; }
.settings-button--cassette::after { content: none; }
.settings-button--cassette .cassette-shell { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:100%; color:var(--gold); }
.settings-button--cassette .cassette-window {
    width: 78%;
    height: 42%;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.12));
    border-radius: 6px;
    display:flex; align-items:center; justify-content:space-around; padding:4px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}
.cassette-reel {
    width: 20px; height:20px; border-radius:50%;
    background: radial-gradient(circle at 35% 30%, #fff 0%, #e6e6ff 6%, #b28be6 30%, #6a2d83 100%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.6), 0 0 12px rgba(199,125,255,0.22);
    position: relative;
}
.cassette-reel::before { content: ''; position:absolute; inset:5px; border-radius:50%; background: rgba(0,0,0,0.12); }
.cassette-reel { animation: cassette-reel-spin 4s linear infinite; }
@keyframes cassette-reel-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.cassette-label { margin-top:6px; font-weight:900; font-size:11px; color: #70d5ff; letter-spacing: 1px; text-shadow: 0 0 8px rgba(0, 180, 255, 0.18); }
.settings-button--cassette:hover { transform: translateY(-4px) rotate(-4deg) scale(1.02); box-shadow: 0 16px 48px rgba(123,16,153,0.28), 0 0 64px rgba(255,45,85,0.22); }


.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.6);
}
.settings-modal[hidden] { display: none; }
.settings-modal__inner {
    width: 100%;
    max-width: 420px;
    background: rgba(12, 7, 21, 0.98);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.04);
    padding: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.settings-modal__header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.settings-modal__header h2 { margin:0; color:var(--gold); font-size:1.1rem; }
.settings-modal__close { background:transparent; border:0; color:rgba(255,255,255,0.7); font-size:1.2rem; cursor:pointer; }
.settings-modal__body { margin-top:12px; display:flex; flex-direction:column; gap:32px; }
.settings-modal__footer { margin-top:16px; text-align:right; }
.settings-version { font-size:0.75rem; color:rgba(255,255,255,0.35); }
.settings-row { display:flex; align-items:center; gap:12px; color:rgba(255,255,255,0.9); font-size:0.95rem; }


/* ── Volume sliders ────────────────────────────────────────────────────── */
.settings-row--slider {
    flex-direction: column;
    align-items: stretch;
    padding-left: 0;
    gap: 8px;
}

.settings-slider-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.settings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--accent) var(--fill, 50%),
        rgba(255, 255, 255, 0.12) var(--fill, 50%)
    );
    outline: none;
    cursor: pointer;
    border: none;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, #fff 0%, #f0f0ff 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 12px rgba(199, 125, 255, 0.45);
    cursor: pointer;
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 26, 255, 0.55);
    transform: scale(1.1);
}

.settings-slider::-moz-range-thumb {
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, #fff 0%, #f0f0ff 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 12px rgba(199, 125, 255, 0.45);
    cursor: pointer;
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.settings-slider::-moz-range-thumb:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 26, 255, 0.55);
    transform: scale(1.1);
}

.settings-slider:focus {
    outline: 3px solid rgba(199, 125, 255, 0.2);
    outline-offset: 4px;
    border-radius: 999px;
}


/* ── About button ─────────────────────────────────────────────────────── */
.about-button {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 68px);
    z-index: 300;
    width: 92px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(180deg, #0a0020 0%, #1a0035 55%, #0d0018 100%);
    color: var(--cyan);
    border: 1px solid rgba(0,229,255,0.18);
    box-shadow: 0 4px 18px rgba(0,229,255,0.10), 0 0 28px rgba(255,26,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms ease;
}
.about-button::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 18px rgba(0,229,255,0.15), 0 0 36px rgba(255,26,255,0.08);
    filter: blur(5px);
    opacity: 0.9;
}
.about-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 32px rgba(0,229,255,0.18), 0 0 48px rgba(255,26,255,0.16);
}
.about-button:active {
    transform: translateY(0) scale(0.98);
}
.about-button__icon {
    font-size: 13px;
    font-style: normal;
    line-height: 1;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0,229,255,0.6);
    position: relative;
    z-index: 1;
}
.about-button__label {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #70d5ff;
    text-shadow: 0 0 8px rgba(0,180,255,0.18);
    position: relative;
    z-index: 1;
}


/* ── About modal ──────────────────────────────────────────────────────── */
.about-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.6);
}
.about-modal[hidden] { display: none; }
.about-modal__inner {
    width: 100%;
    max-width: 460px;
    background: rgba(12, 7, 21, 0.98);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.04);
    padding: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.about-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.about-modal__header h2 { margin: 0; color: var(--gold); font-size: 1.1rem; }
.about-modal__close {
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.7);
    font-size: 1.2rem;
    cursor: pointer;
}
.about-modal__body {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.about-modal__description p {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.65;
}
.about-modal__author {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.about-modal__avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(199,125,255,0.3);
    box-shadow: 0 0 20px rgba(199,125,255,0.2);
    object-fit: cover;
}
.about-modal__author-info { display: flex; flex-direction: column; gap: 10px; }
.about-modal__bio {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.55;
}
.about-modal__link {
    font-size: 0.82rem;
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0,229,255,0.3);
    width: fit-content;
    transition: color 150ms ease, border-color 150ms ease;
}
.about-modal__link:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

/* ── Scenario picker modal (secret cheat) ────────────────────────────── */
.about-modal__avatar {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.scenario-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 450;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.78);
}
.scenario-picker-modal[hidden] { display: none; }
.scenario-picker-modal__inner {
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: rgba(10, 4, 28, 0.98);
    border-radius: 12px;
    border: 1px solid rgba(199,125,255,0.3);
    padding: 18px;
    box-shadow: 0 0 40px rgba(199,125,255,0.18), 0 8px 40px rgba(0,0,0,0.7);
    animation: modal-fadein 0.25s ease both;
}
.scenario-picker-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.scenario-picker-modal__header h2 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}
.scenario-picker-modal__close {
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.7);
    font-size: 1.2rem;
    cursor: pointer;
}
.scenario-picker-modal__list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
    padding-right: 2px;
}
.scenario-picker-modal__item {
    font-family: inherit;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(199,125,255,0.3);
    background: rgba(199,125,255,0.06);
    color: var(--unicorn);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 140ms, border-color 140ms, box-shadow 140ms;
}
.scenario-picker-modal__item:hover {
    background: rgba(199,125,255,0.18);
    border-color: var(--unicorn);
    box-shadow: 0 0 14px rgba(199,125,255,0.22);
}
.scenario-picker-modal__item:active { transform: scale(0.98); }
.scenario-picker-modal__item--charm {
    border-color: rgba(255,215,0,0.45);
    background: rgba(255,215,0,0.07);
    color: var(--gold);
}
.scenario-picker-modal__item--charm::after {
    content: ' ✨';
}
.scenario-picker-modal__item--charm:hover {
    background: rgba(255,215,0,0.18);
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(255,215,0,0.28);
}

/* ── Arcade cat ─────────────────────────────────────────────────────────── */
@keyframes cat-bob {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

.arcade-cat {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 80px;
    height: auto;
    cursor: pointer;
    z-index: 10;
    animation: cat-bob 1.2s ease-in-out infinite;
}

/* ── Fluffy dice ─────────────────────────────────────────────────────────── */
@keyframes dice-swing {
    0%, 100% { transform: rotate(-12deg); }
    50%       { transform: rotate(12deg); }
}

.fluffy-dice {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    transform-origin: top center;
    animation: dice-swing 1.6s ease-in-out infinite;
}

/* ── Lucky Dice modal ────────────────────────────────────────────────────── */
.lucky-dice-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(20, 12, 0, 0.97) 0%, rgba(10, 6, 0, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.lucky-dice-modal[hidden] { display: none; }

.lucky-dice-modal__inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(20, 12, 0, 0.97);
    border: 2px solid rgba(255, 200, 50, 0.4);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow: 0 0 40px rgba(255, 180, 0, 0.15), 0 0 80px rgba(255, 160, 0, 0.08), inset 0 2px 8px rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.lucky-dice-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.lucky-dice-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.lucky-dice-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
}

.lucky-dice-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(0, 207, 255, 0.55);
    text-transform: uppercase;
}

.lucky-dice-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(255, 200, 80, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.lucky-dice-modal__dice-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.lucky-dice-modal__dice {
    font-size: clamp(40px, 9vw, 60px);
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 200, 50, 0.7);
    transition: transform 0.08s linear;
}

.lucky-dice-modal__dice.rolling {
    animation: dice-roll 0.12s linear infinite;
}

.lucky-dice-modal__dice-label {
    font-size: clamp(11px, 2.4vw, 13px);
    color: rgba(255, 200, 80, 0.8);
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 1.4em;
}

.lucky-dice-modal__result {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 180, 0, 0.2);
    background: rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 2;
}
.lucky-dice-modal__result[hidden] { display: none; }
.lucky-dice-modal__result p {
    margin: 0;
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    color: rgba(255, 200, 80, 0.9);
}
.lucky-dice-modal__result.success { border-color: rgba(48, 209, 88, 0.4); }
.lucky-dice-modal__result.failure { border-color: rgba(255, 45, 85, 0.4); }
.lucky-dice-modal__result.success p { color: #30d158; }
.lucky-dice-modal__result.failure p { color: var(--accent); }

.lucky-dice-modal__btn {
    font-family: inherit;
    margin-top: 18px;
    width: 100%;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffcc00, #e0a800);
    color: #1a1000;
    font-size: clamp(15px, 3.5vw, 20px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    animation: lucky-dice-btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(255, 200, 0, 0.5), 0 0 6px rgba(255, 200, 0, 0.3);
    position: relative;
    z-index: 2;
}
.lucky-dice-modal__btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    animation: none;
    box-shadow: none;
}
.lucky-dice-modal__btn:not(:disabled):active {
    transform: scale(0.97);
    animation-play-state: paused;
}

@keyframes lucky-dice-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ── Troll charm ─────────────────────────────────────────────────────────── */
@keyframes troll-rainbow {
    0%   { filter: hue-rotate(0deg)   saturate(1.4) brightness(1.1); }
    25%  { filter: hue-rotate(90deg)  saturate(1.6) brightness(1.2); }
    50%  { filter: hue-rotate(180deg) saturate(1.4) brightness(1.1); }
    75%  { filter: hue-rotate(270deg) saturate(1.6) brightness(1.2); }
    100% { filter: hue-rotate(360deg) saturate(1.4) brightness(1.1); }
}

@keyframes troll-shimmy {
    0%, 75%  { transform: translateY(-50%) translateX(0); }
    77%      { transform: translateY(-50%) translateX(-15px); }
    79%      { transform: translateY(-50%) translateX(10px); }
    81%      { transform: translateY(-50%) translateX(-12px); }
    83%      { transform: translateY(-50%) translateX(8px); }
    85%      { transform: translateY(-50%) translateX(-6px); }
    87%, 100% { transform: translateY(-50%) translateX(0); }
}

.troll-charm {
    position: absolute;
    right: -8px;
    width: 65px;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    animation: troll-rainbow 3s linear infinite,
               troll-shimmy 10s ease-in-out infinite;
}

/* ── Troll's Gambit modal ─────────────────────────────────────────────────── */
.troll-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(4, 18, 4, 0.97) 0%, rgba(2, 10, 2, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.troll-modal[hidden] { display: none; }

.troll-modal__inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(4, 18, 4, 0.97);
    border: 2px solid rgba(80, 200, 80, 0.35);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow: 0 0 40px rgba(60, 180, 60, 0.12), 0 0 80px rgba(40, 140, 40, 0.07), inset 0 2px 8px rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.troll-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.06) 3px,
        rgba(0,0,0,0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.troll-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.troll-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #6ddd6d;
    text-shadow: 0 0 10px #6ddd6d;
}

.troll-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #a8f0a8;
    text-shadow: 0 0 12px rgba(80, 200, 80, 0.55);
    text-transform: uppercase;
}

.troll-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(160, 220, 140, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.troll-modal__troll-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.troll-modal__troll {
    width: clamp(60px, 14vw, 90px);
    height: auto;
    filter: drop-shadow(0 0 12px rgba(80, 200, 80, 0.5));
}

.troll-modal__troll.reacting {
    animation: troll-react 0.55s ease both;
}

@keyframes troll-react {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.35) rotate(-8deg); }
    55%  { transform: scale(0.9)  rotate(5deg); }
    75%  { transform: scale(1.1)  rotate(-3deg); }
    100% { transform: scale(1)    rotate(0deg); }
}

.troll-modal__result {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(80, 180, 80, 0.2);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}
.troll-modal__result[hidden] { display: none; }
.troll-modal__result p {
    margin: 0;
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    color: rgba(160, 220, 140, 0.9);
}
.troll-modal__result.success { border-color: rgba(48, 209, 88, 0.4); }
.troll-modal__result.failure { border-color: rgba(255, 45, 85, 0.4); }
.troll-modal__result.success p { color: #30d158; }
.troll-modal__result.failure p { color: var(--accent); }

.troll-modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    position: relative;
    z-index: 2;
}
.troll-modal__actions[hidden] { display: none; }

.troll-modal__btn {
    font-family: inherit;
    flex: 1;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    font-size: clamp(13px, 3vw, 17px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.troll-modal__btn--poke {
    background: linear-gradient(180deg, #6ddd6d, #3da83d);
    color: #021002;
    animation: troll-btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(80, 200, 80, 0.4), 0 0 6px rgba(80, 200, 80, 0.25);
}
.troll-modal__btn--poke:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    animation: none;
    box-shadow: none;
}
.troll-modal__btn--poke:not(:disabled):active {
    transform: scale(0.97);
    animation-play-state: paused;
}

.troll-modal__btn--leave {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(160, 220, 140, 0.7);
    border: 1px solid rgba(80, 180, 80, 0.25);
}
.troll-modal__btn--leave:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}
.troll-modal__btn--leave:not(:disabled):active {
    transform: scale(0.97);
}

.troll-modal__btn--continue {
    width: 100%;
    margin-top: 18px;
    background: linear-gradient(180deg, #6ddd6d, #3da83d);
    color: #021002;
    box-shadow: 0 0 22px rgba(80, 200, 80, 0.4);
}
.troll-modal__btn--continue:active {
    transform: scale(0.97);
}

@keyframes troll-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ── Cat's Walk modal ────────────────────────────────────────────────────── */

.cat-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.cat-modal[hidden] { display: none; }

.cat-modal__inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(18, 10, 2, 0.97);
    border: 2px solid rgba(220, 150, 40, 0.35);
    border-radius: 12px;
    padding: clamp(20px, 4vw, 32px);
    box-shadow:
        0 0 40px rgba(220, 150, 40, 0.15),
        0 0 80px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(220, 150, 40, 0.04);
}

.cat-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 12px;
}

.cat-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.cat-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #dca028;
}

.cat-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #f5d070;
}

.cat-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(220, 180, 100, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.cat-modal__cat-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.cat-modal__cat {
    width: clamp(60px, 14vw, 90px);
    height: auto;
    filter: drop-shadow(0 0 12px rgba(220, 150, 40, 0.5));
}

.cat-modal__cat.walking {
    animation: cat-walk 0.55s ease-in-out infinite;
}

@keyframes cat-walk {
    0%   { transform: translateX(-5px) rotate(-4deg); }
    25%  { transform: translateX(0px)  rotate(0deg); }
    50%  { transform: translateX(5px)  rotate(4deg); }
    75%  { transform: translateX(0px)  rotate(0deg); }
    100% { transform: translateX(-5px) rotate(-4deg); }
}

.cat-modal__walking-label {
    font-size: clamp(11px, 2.2vw, 13px);
    color: rgba(220, 180, 100, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
    min-height: 1.4em;
    position: relative;
    z-index: 2;
}

.cat-modal__result {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(220, 150, 40, 0.2);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.cat-modal__result[hidden] { display: none; }

.cat-modal__result p {
    margin: 0;
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    color: rgba(220, 180, 100, 0.9);
}

.cat-modal__result.success { border-color: rgba(255, 185, 55, 0.5); }
.cat-modal__result.success p { color: #ffd060; }

.cat-modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    position: relative;
    z-index: 2;
}
.cat-modal__actions[hidden] { display: none; }

.cat-modal__btn {
    font-family: inherit;
    flex: 1;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    font-size: clamp(13px, 3vw, 17px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.cat-modal__btn--send {
    background: linear-gradient(180deg, #dca028, #a06814);
    color: #120800;
    animation: cat-btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(220, 150, 40, 0.4), 0 0 6px rgba(220, 150, 40, 0.25);
}
.cat-modal__btn--send:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    animation: none;
    box-shadow: none;
}
.cat-modal__btn--send:not(:disabled):active {
    transform: scale(0.97);
    animation-play-state: paused;
}

.cat-modal__btn--leave {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(220, 180, 100, 0.7);
    border: 1px solid rgba(220, 150, 40, 0.25);
}
.cat-modal__btn--leave:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}
.cat-modal__btn--leave:not(:disabled):active {
    transform: scale(0.97);
}

.cat-modal__btn--continue {
    width: 100%;
    margin-top: 18px;
    background: linear-gradient(180deg, #dca028, #a06814);
    color: #120800;
    box-shadow: 0 0 22px rgba(220, 150, 40, 0.4);
}
.cat-modal__btn--continue:active {
    transform: scale(0.97);
}

@keyframes cat-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ── Turtle charm ─────────────────────────────────────────────────────────── */

@keyframes turtle-pulse {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(50, 200, 80, 0.55)); }
    50%       { filter: drop-shadow(0 0 14px rgba(50, 220, 100, 0.95)); }
}

@keyframes turtle-burst {
    0%    { transform: scale(1) rotate(0deg); }
    20%   { transform: scale(1.45) rotate(-14deg); }
    45%   { transform: scale(1.25) rotate(11deg); }
    65%   { transform: scale(1.35) rotate(-7deg); }
    85%   { transform: scale(1.1) rotate(4deg); }
    100%  { transform: scale(1) rotate(0deg); }
}

.turtle-charm {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 60px;
    height: auto;
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    animation: turtle-pulse 2.2s ease-in-out infinite;
}

.turtle-charm.bursting {
    animation: turtle-burst 0.65s ease both;
}

/* ── Turtle Charm modal ──────────────────────────────────────────────────── */

.turtle-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(0, 22, 8, 0.97) 0%, rgba(0, 12, 4, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.turtle-modal[hidden] { display: none; }

.turtle-modal__inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(0, 20, 8, 0.97);
    border: 2px solid rgba(0, 200, 80, 0.35);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow: 0 0 40px rgba(0, 180, 60, 0.12), 0 0 80px rgba(0, 140, 40, 0.07), inset 0 2px 8px rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.turtle-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.turtle-modal__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.turtle-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #22dd88;
    text-shadow: 0 0 10px #22dd88;
}

.turtle-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #88f5b0;
    text-shadow: 0 0 12px rgba(0, 200, 80, 0.55);
    text-transform: uppercase;
}

.turtle-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(140, 230, 160, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.turtle-modal__turtle-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.turtle-modal__turtle {
    width: clamp(60px, 14vw, 90px);
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 200, 80, 0.45));
}

.turtle-modal__turtle.bursting {
    animation: turtle-burst 0.65s ease both;
}

.turtle-modal__result {
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
    display: none;
}
.turtle-modal__result:not([hidden]) { display: block; }
.turtle-modal__result.success {
    background: rgba(0, 180, 60, 0.12);
    border: 1px solid rgba(0, 200, 80, 0.35);
    color: #88f5b0;
}

.turtle-modal__actions {
    display: flex;
    gap: 10px;
    position: relative;
    z-index: 2;
}
.turtle-modal__actions[hidden] { display: none; }

.turtle-modal__btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid rgba(0, 200, 80, 0.4);
    background: rgba(0, 180, 60, 0.12);
    color: #88f5b0;
    font-family: inherit;
    font-size: clamp(11px, 2.5vw, 14px);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 130ms, border-color 130ms, box-shadow 130ms;
    position: relative;
    z-index: 2;
}
.turtle-modal__btn:hover:not(:disabled) {
    background: rgba(0, 200, 80, 0.22);
    border-color: rgba(0, 220, 90, 0.7);
    box-shadow: 0 0 12px rgba(0, 200, 80, 0.3);
}
.turtle-modal__btn:active:not(:disabled) { transform: scale(0.97); }
.turtle-modal__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.turtle-modal__btn--cowabunga {
    background: rgba(0, 180, 60, 0.2);
    border-color: rgba(0, 220, 90, 0.6);
    color: #aaffd0;
    animation: turtle-btn-pulse 1.8s ease-in-out infinite;
}
.turtle-modal__btn--cowabunga:disabled {
    animation: none;
}

.turtle-modal__btn--continue {
    width: 100%;
    margin-top: 4px;
}

@keyframes turtle-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* ── Wizard charm ─────────────────────────────────────────────────────────── */

@keyframes wizard-float {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%       { transform: translateY(-12px) rotate(4deg); }
}

@keyframes wizard-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(180, 80, 255, 0.7)) drop-shadow(0 0 18px rgba(100, 0, 200, 0.4)); }
    50%       { filter: drop-shadow(0 0 18px rgba(220, 120, 255, 1)) drop-shadow(0 0 36px rgba(160, 20, 255, 0.7)); }
}

.wizard-charm {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 116px);
    width: 62px;
    height: auto;
    cursor: pointer;
    z-index: 301;
    animation: wizard-float 2.4s ease-in-out infinite,
               wizard-glow  2s ease-in-out infinite;
    transform-origin: bottom center;
}

/* ── Wizard pay table modifier ─────────────────────────────────────────── */

.pay-table.wizard-active .pay-heading::after {
    content: ' 🧙';
}

.pay-table.wizard-active .pay-row:not(.pay-row--poop):not(.pay-row--skull):not(.pay-row--head) span:not(:first-child) {
    color: #c77dff;
    text-shadow: 0 0 8px rgba(180, 80, 255, 0.5);
}

.wizard-pay-note {
    display: block;
    margin-top: 4px;
    color: #c77dff;
    text-shadow: 0 0 8px rgba(180, 80, 255, 0.5);
    font-size: 0.9em;
}

/* ── Wizard modal ─────────────────────────────────────────────────────────── */

.wizard-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(20, 6, 40, 0.97) 0%, rgba(10, 2, 22, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.wizard-modal[hidden] { display: none; }

.wizard-modal__inner {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: rgba(20, 6, 40, 0.97);
    border: 2px solid rgba(180, 80, 255, 0.4);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow:
        0 0 40px rgba(160, 40, 255, 0.2),
        0 0 80px rgba(100, 0, 200, 0.12),
        inset 0 2px 8px rgba(255, 255, 255, 0.03);
    overflow: hidden;
    text-align: center;
}

.wizard-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.wizard-modal__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.wizard-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #c77dff;
    text-shadow: 0 0 10px #c77dff;
}

.wizard-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #e0b0ff;
    text-shadow: 0 0 14px rgba(180, 80, 255, 0.7);
    text-transform: uppercase;
}

.wizard-modal__wizard-area {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.wizard-modal__wizard {
    width: clamp(60px, 14vw, 80px);
    height: auto;
    filter: drop-shadow(0 0 14px rgba(180, 80, 255, 0.65));
    animation: wizard-float 2.4s ease-in-out infinite;
}

.wizard-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(210, 170, 255, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.wizard-modal__buff {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(160, 40, 255, 0.12);
    border: 1px solid rgba(180, 80, 255, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.wizard-modal__buff-icon {
    font-size: 1.5rem;
}

.wizard-modal__buff-label {
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #c77dff;
    text-shadow: 0 0 8px rgba(180, 80, 255, 0.5);
}

.wizard-modal__btn {
    font-family: inherit;
    width: 100%;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    font-size: clamp(13px, 3vw, 17px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    background: linear-gradient(180deg, #b44fff, #7a1fc0);
    color: #1a0030;
    box-shadow: 0 0 22px rgba(160, 40, 255, 0.4);
    position: relative;
    z-index: 2;
}
.wizard-modal__btn:active {
    transform: scale(0.97);
}

/* ── Magic 8-Ball charm ──────────────────────────────────────────────────── */

@keyframes ball-float {
    0%, 100% { transform: translateY(0) rotate(6deg); }
    50%       { transform: translateY(-10px) rotate(-6deg); }
}

@keyframes ball-glow-idle {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 200, 255, 0.5)) drop-shadow(0 0 14px rgba(0, 100, 200, 0.3)); }
    50%       { filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.8)) drop-shadow(0 0 28px rgba(0, 150, 255, 0.5)); }
}

@keyframes ball-glow-buffed {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 229, 255, 1)) drop-shadow(0 0 26px rgba(0, 200, 255, 0.9)) drop-shadow(0 0 50px rgba(80, 220, 255, 0.6)); }
    50%       { filter: drop-shadow(0 0 22px rgba(120, 240, 255, 1)) drop-shadow(0 0 50px rgba(0, 229, 255, 1))  drop-shadow(0 0 80px rgba(0, 180, 255, 0.8)); }
}

.magic-8-ball {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 196px);
    width: 60px;
    height: auto;
    cursor: pointer;
    z-index: 301;
    animation: ball-float 2.8s ease-in-out infinite,
               ball-glow-idle 2.2s ease-in-out infinite;
    transform-origin: bottom center;
}

.magic-8-ball--buffed {
    animation: ball-float 2.8s ease-in-out infinite,
               ball-glow-buffed 1.2s ease-in-out infinite;
}

/* ── Magic 8-Ball modal ──────────────────────────────────────────────────── */

.eight-ball-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(0, 10, 30, 0.97) 0%, rgba(0, 4, 18, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.eight-ball-modal[hidden] { display: none; }

.eight-ball-modal__inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(0, 10, 28, 0.97);
    border: 2px solid rgba(0, 200, 255, 0.35);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow: 0 0 40px rgba(0, 180, 255, 0.15), 0 0 80px rgba(0, 100, 200, 0.08), inset 0 2px 8px rgba(255, 255, 255, 0.03);
    overflow: hidden;
    text-align: center;
}

.eight-ball-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.eight-ball-modal__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.eight-ball-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00e5ff;
    text-shadow: 0 0 10px #00e5ff;
}

.eight-ball-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #b0eeff;
    text-shadow: 0 0 12px rgba(0, 200, 255, 0.6);
    text-transform: uppercase;
}

.eight-ball-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(150, 220, 255, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.eight-ball-modal__ball-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.eight-ball-modal__ball {
    width: clamp(72px, 18vw, 96px);
    height: auto;
    filter: drop-shadow(0 0 14px rgba(0, 200, 255, 0.55));
    transition: filter 0.3s ease;
}

@keyframes eight-ball-shake {
    0%   { transform: rotate(0deg)   translateX(0); }
    10%  { transform: rotate(-14deg) translateX(-6px); }
    20%  { transform: rotate(12deg)  translateX(6px); }
    30%  { transform: rotate(-10deg) translateX(-5px); }
    40%  { transform: rotate(8deg)   translateX(4px); }
    50%  { transform: rotate(-6deg)  translateX(-3px); }
    60%  { transform: rotate(4deg)   translateX(2px); }
    70%  { transform: rotate(-2deg)  translateX(-1px); }
    80%  { transform: rotate(1deg)   translateX(0); }
    100% { transform: rotate(0deg)   translateX(0); }
}

.eight-ball-modal__ball.shaking {
    animation: eight-ball-shake 0.9s ease both;
}

.eight-ball-modal__fortune {
    min-height: 1.6em;
    font-size: clamp(11px, 2.4vw, 14px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(0, 229, 255, 0.9);
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.7);
}

.eight-ball-modal__result {
    margin: 14px 0 0;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 180, 255, 0.2);
    background: rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 2;
}
.eight-ball-modal__result[hidden] { display: none; }
.eight-ball-modal__result p {
    margin: 0;
    font-size: clamp(12.5px, 2.7vw, 15px);
    line-height: 1.6;
    color: rgba(150, 220, 255, 0.9);
}
.eight-ball-modal__result.positive { border-color: rgba(0, 229, 255, 0.45); }
.eight-ball-modal__result.positive p { color: #00e5ff; }
.eight-ball-modal__result.neutral  { border-color: rgba(160, 160, 200, 0.3); }
.eight-ball-modal__result.neutral  p { color: rgba(180, 200, 230, 0.85); }
.eight-ball-modal__result.negative { border-color: rgba(255, 45, 85, 0.3); }
.eight-ball-modal__result.negative p { color: rgba(255, 160, 160, 0.85); }

.eight-ball-modal__btn {
    font-family: inherit;
    margin-top: 18px;
    width: 100%;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(180deg, #00cfff, #007ab8);
    color: #00111e;
    font-size: clamp(15px, 3.5vw, 20px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    animation: eight-ball-btn-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 22px rgba(0, 200, 255, 0.5), 0 0 6px rgba(0, 200, 255, 0.3);
    position: relative;
    z-index: 2;
}
.eight-ball-modal__btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    animation: none;
    box-shadow: none;
}
.eight-ball-modal__btn:not(:disabled):active {
    transform: scale(0.97);
    animation-play-state: paused;
}

@keyframes eight-ball-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ── All Charms Bonus modal ───────────────────────────────────────────────── */
.all-charms-modal {
    position: fixed;
    inset: 0;
    z-index: 360;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 3px,
            rgba(0, 0, 0, 0.10) 3px,
            rgba(0, 0, 0, 0.10) 4px
        ),
        radial-gradient(ellipse at 50% 40%, rgba(40, 28, 0, 0.97) 0%, rgba(20, 12, 0, 0.99) 72%);
    animation: modal-fadein 0.35s ease both;
}
.all-charms-modal[hidden] { display: none; }

.all-charms-modal__inner {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: rgba(40, 28, 0, 0.97);
    border: 2px solid rgba(255, 200, 0, 0.4);
    border-radius: 12px;
    padding: 22px 24px 20px;
    box-shadow:
        0 0 40px rgba(255, 180, 0, 0.2),
        0 0 80px rgba(200, 120, 0, 0.12),
        inset 0 2px 8px rgba(255, 255, 255, 0.03);
    overflow: hidden;
    text-align: center;
}

.all-charms-modal__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    border-radius: 12px;
    z-index: 1;
}

.all-charms-modal__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 14px;
    position: relative;
    z-index: 2;
}

.all-charms-modal__tag {
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.all-charms-modal__title {
    margin: 0;
    font-size: clamp(15px, 3.5vw, 22px);
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #ffe87c;
    text-shadow: 0 0 14px rgba(255, 200, 0, 0.7);
    text-transform: uppercase;
}

.all-charms-modal__icon-area {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.all-charms-modal__icon {
    font-size: clamp(48px, 12vw, 72px);
    filter: drop-shadow(0 0 14px rgba(255, 200, 0, 0.65));
    animation: wizard-float 2.4s ease-in-out infinite;
    display: block;
}

.all-charms-modal__flavor {
    font-size: clamp(12.5px, 2.7vw, 15px);
    color: rgba(255, 230, 150, 0.85);
    line-height: 1.65;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.all-charms-modal__reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 180, 0, 0.12);
    border: 1px solid rgba(255, 200, 0, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.all-charms-modal__reward-icon {
    font-size: 1.5rem;
}

.all-charms-modal__reward-label {
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 200, 0, 0.5);
}

.all-charms-modal__btn {
    font-family: inherit;
    width: 100%;
    padding: clamp(12px, 2.4vw, 18px) 0;
    border: 0;
    border-radius: 8px;
    font-size: clamp(13px, 3vw, 17px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    background: linear-gradient(180deg, #ffd700, #c87900);
    color: #1a0e00;
    box-shadow: 0 0 22px rgba(255, 180, 0, 0.4);
    position: relative;
    z-index: 2;
}
.all-charms-modal__btn:active {
    transform: scale(0.97);
}
