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

html,
body {
    height: 100%;
    width: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-image:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.15), transparent 60%),
        linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.85)),
        url("https://pwamarket.fra1.digitaloceanspaces.com/2025-11-17/691b509070167.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #ffffff;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 8px;
    overflow: hidden;
    position: relative;
}

/* Soft vignette */
.page-overlay {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top, transparent 0, rgba(0, 0, 0, 0.4) 70%),
        radial-gradient(circle at bottom, rgba(0, 0, 0, 0.75), transparent 55%);
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

/* HEADER */

.header {
    text-align: center;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-bottom: 6px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2b0000;
    background: linear-gradient(90deg, #ffd54f, #ffeb3b);
    box-shadow: 0 0 10px rgba(255, 214, 64, 0.7);
}

.header-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #ff5722;
    box-shadow: 0 0 8px rgba(255, 87, 34, 0.9);
}

.main-title {
    font-size: clamp(2.3rem, 7vw, 3.3rem);
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow:
        0 0 4px #000,
        0 0 8px #ffd700,
        0 0 18px #ff9800,
        0 0 26px #e65100;
    margin-bottom: 4px;
    animation: titleFlicker 2.2s infinite alternate;
}

.subtitle {
    font-size: clamp(0.95rem, 3.8vw, 1.1rem);
    font-weight: 400;
    color: #fffbe6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.75);
}

/* MAIN */

.main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-wrapper {
    position: relative;
    width: 100%;
    padding: 16px 10px 18px;
    background: radial-gradient(circle at top, rgba(92, 0, 0, 0.9), rgba(20, 0, 0, 0.95));
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.85);
    box-shadow:
        0 0 20px rgba(255, 215, 0, 0.6),
        0 16px 26px rgba(0, 0, 0, 0.6),
        inset 0 0 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
}

#spin-counter {
    font-size: clamp(0.7rem, 3.2vw, 0.82rem);
    font-weight: 700;
    color: #ffd700;
    text-shadow: 1px 1px 2px #000;
    white-space: nowrap;
}

.badge-chances {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.7);
    flex-shrink: 0;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background-color: #ffeb3b;
    box-shadow: 0 0 6px rgba(255, 235, 59, 0.8);
}

.badge-text {
    font-size: clamp(0.6rem, 2.8vw, 0.7rem);
    font-weight: 600;
    color: #ffecb3;
    white-space: nowrap;
}

/* SLOT MACHINE */

#slot-machine {
    --symbol-size: 90px;

    position: relative;
    width: 100%;
    margin: 8px auto 14px;
    padding: 6px;
    border-radius: 16px;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.85), rgba(20, 0, 0, 0.9));
    box-shadow:
        inset 0 0 12px rgba(0, 0, 0, 0.9),
        0 0 10px rgba(0, 0, 0, 0.8);
}

/* reels wrapper */
.slot-reels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: min(2.2vw, 10px);
    padding: 4px;
}

/* single reel */
.slot-reel {
    position: relative;
    background: linear-gradient(180deg, rgba(25, 25, 25, 0.95), rgba(0, 0, 0, 0.98));
    border-radius: 12px;
    padding: 4px;
    overflow: hidden;
    box-shadow:
        inset 0 0 8px rgba(0, 0, 0, 0.9),
        0 0 8px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    height: calc(var(--symbol-size) * 3); /* exactly 3 visible rows */
}

/* symbols container (scrolling column) */
.slot-reel-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    will-change: transform;
}

/* one symbol cell */
.slot-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    height: var(--symbol-size);
}

.slot-symbol img {
    width: 78%;
    max-width: 84px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

/* highlight line across winning row */
.win-line-marker {
    pointer-events: none;
    position: absolute;
    left: 4%;
    right: 4%;
    top: 50%;
    transform: translateY(-50%);
    border-top: 3px solid rgba(255, 215, 0, 0.0);
    border-bottom: 3px solid rgba(255, 215, 0, 0.0);
    border-radius: 999px;
}

.win-line-marker.active {
    animation: winGlow 1.1s ease-in-out infinite;
    border-top-color: #ffd700;
    border-bottom-color: #ffd700;
    box-shadow:
        0 0 8px rgba(255, 215, 0, 0.85),
        0 0 16px rgba(255, 193, 7, 0.7);
}

/* SPIN BUTTON */

.spin-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 85%;
    max-width: 310px;
    margin: 10px auto 0;
    padding: 12px 18px;
    border-radius: 999px;
    font-size: clamp(1.05rem, 4.3vw, 1.3rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4a0500;
    background: radial-gradient(circle at top, #fff59d, #ffc107);
    border: none;
    cursor: pointer;
    box-shadow:
        0 7px 0 #f57c00,
        0 14px 16px rgba(0, 0, 0, 0.5);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
    overflow: hidden;
    outline: none;
    transition:
        transform 0.1s ease-in-out,
        box-shadow 0.1s ease-in-out,
        filter 0.15s ease-in-out;
}

.spin-button .spin-btn-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.75), transparent 60%);
    opacity: 0.0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.spin-button:not(:disabled) {
    animation: spinPulse 1.8s infinite;
}

.spin-button:active {
    transform: translateY(3px);
    box-shadow:
        0 3px 0 #f57c00,
        0 8px 12px rgba(0, 0, 0, 0.55);
    filter: brightness(0.98);
}

.spin-button:disabled {
    background: linear-gradient(180deg, #bdbdbd, #757575);
    color: #263238;
    cursor: not-allowed;
    box-shadow:
        0 7px 0 #424242,
        0 14px 16px rgba(0, 0, 0, 0.7);
    animation: none;
}

/* FOOTER */

.footer {
    display: flex;
    justify-content: center;
    padding-bottom: 4px;
}

.live-counter {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-left: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    position: relative;
}

.live-counter::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 11px;
    height: 11px;
    background-color: #39ff14;
    border-radius: 999px;
    box-shadow:
        0 0 5px #39ff14,
        0 0 10px #39ff14,
        0 0 18px rgba(57, 255, 20, 0.9);
    animation: greenGlow 1.4s infinite ease-in-out;
}

.live-counter-label {
    opacity: 0.8;
    font-size: 0.78rem;
}

.live-counter-value {
    font-size: 0.92rem;
}

/* MODAL */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.95));
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
    z-index: 1000;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background: radial-gradient(circle, #6b0000 0%, #240000 100%);
    padding: 24px 18px 20px;
    border-radius: 22px;
    text-align: center;
    width: 90%;
    max-width: 380px;
    border: 3px solid #ffd700;
    box-shadow:
        0 0 28px rgba(255, 215, 0, 0.85),
        0 18px 28px rgba(0, 0, 0, 0.7);
    transform: scale(0.7);
    transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background:
        radial-gradient(circle at top, rgba(255, 235, 59, 0.3), transparent 55%),
        radial-gradient(circle at bottom, rgba(244, 67, 54, 0.35), transparent 55%);
    mix-blend-mode: screen;
}

.win-symbol-img {
    width: 112px;
    height: 112px;
    margin: -26px auto 4px;
    position: relative;
    z-index: 1;
    animation: bounceIn 0.9s ease;
}

.modal-title {
    position: relative;
    z-index: 1;
    font-size: clamp(1.8rem, 6.3vw, 2.4rem);
    font-weight: 900;
    color: #ffd700;
    text-shadow:
        0 0 10px #ffd700,
        0 0 20px #ff9800;
    margin-bottom: 6px;
    letter-spacing: 0.2em;
}

.modal-text {
    position: relative;
    z-index: 1;
    font-size: clamp(0.95rem, 4vw, 1.1rem);
    margin-bottom: 16px;
    color: #fffceb;
    font-weight: 600;
}

.modal-note {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    opacity: 0.75;
    margin-top: 8px;
}

/* CTA button */

.cta_button {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 16px;
    font-size: clamp(1.05rem, 4.3vw, 1.2rem);
    font-weight: 800;
    color: #ffffff;
    text-decoration: none;
    background: radial-gradient(circle at top, #ff7043, #b71c1c);
    border: 2px solid #ffc107;
    border-radius: 999px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    box-shadow:
        0 0 15px rgba(255, 87, 34, 0.9),
        inset 0 0 6px rgba(255, 255, 255, 0.45);
    animation: pulse 1.9s infinite;
}

/* ANIMATIONS */

@keyframes titleFlicker {
    0%, 100% {
        text-shadow:
            0 0 4px #fff,
            0 0 11px #ffd700,
            0 0 19px #ffd700;
        opacity: 1;
    }
    50% {
        text-shadow:
            0 0 2px #ffd700;
        opacity: 0.85;
    }
}

@keyframes winGlow {
    0%,
    100% {
        opacity: 0.75;
        box-shadow:
            0 0 6px rgba(255, 215, 0, 0.9),
            0 0 12px rgba(255, 193, 7, 0.9);
    }
    50% {
        opacity: 1;
        box-shadow:
            0 0 14px rgba(255, 215, 0, 1),
            0 0 22px rgba(255, 193, 7, 1),
            0 0 30px rgba(255, 152, 0, 0.9);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow:
            0 0 15px #ff5722,
            inset 0 0 5px rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.04);
        box-shadow:
            0 0 26px #ff9800,
            inset 0 0 10px rgba(255, 255, 255, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow:
            0 0 15px #ff5722,
            inset 0 0 5px rgba(255, 255, 255, 0.4);
    }
}

@keyframes greenGlow {
    0%,
    100% {
        opacity: 0.8;
        box-shadow:
            0 0 5px #39ff14,
            0 0 10px #39ff14;
    }
    50% {
        opacity: 1;
        box-shadow:
            0 0 8px #39ff14,
            0 0 18px #39ff14,
            0 0 26px #00ff00;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.2);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    70% {
        transform: scale(0.92);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes spinPulse {
    0%,
    100% {
        transform: translateY(0);
        box-shadow:
            0 7px 0 #f57c00,
            0 14px 16px rgba(0, 0, 0, 0.5);
    }
    50% {
        transform: translateY(1px);
        box-shadow:
            0 6px 0 #f57c00,
            0 12px 14px rgba(0, 0, 0, 0.5);
    }
}

/* Small screens tweaks */

@media (max-height: 640px) {
    body {
        padding: 6px 6px;
    }
    .container {
        gap: 4px;
    }
    #game-wrapper {
        padding: 8px 6px 10px;
        transform: scale(0.9);
        transform-origin: top center;
    }
    .spin-button {
        margin-top: 0;
    }
}