body.game-page {
    overflow: hidden;
    background-color: #020617;
}

.game-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    background: radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.2), transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15), transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.1), transparent 70%),
                #020617;
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
    z-index: 9999;
}

.game-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(94, 234, 212, 0.06), transparent 45%);
    pointer-events: none;
}

.game-back-btn {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(8px);
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-back-btn:hover {
    background: rgba(2, 6, 23, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.game-device {
    position: relative;
    max-width: min(520px, 100%);
    width: min(520px, 100%);
    height: min(900px, 100%);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-bottom: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
    .game-overlay {
        padding: 0;
    }

    .game-device {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: none;
        padding: 1.5rem 1.2rem 1.75rem;
        box-shadow: none;
        background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.78));
    }

    .game-back-btn {
        top: 0.75rem;
        left: 1rem;
    }
}

@media (max-height: 760px) {
    .game-overlay {
        align-items: flex-start;
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .game-device {
        height: auto;
        min-height: calc(100vh - 5rem);
    }
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    min-height: 0;
}

.game-screen.hidden {
    display: none;
}

.game-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: linear-gradient(135deg, rgba(2, 6, 23, 0.8), rgba(15, 23, 42, 0.7));
    backdrop-filter: blur(12px);
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
                0 2px 8px rgba(0, 0, 0, 0.2);
}

.game-primary-btn,
.game-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.25rem;
    border-radius: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-primary-btn {
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 50%, #38bdf8 100%);
    color: #f8fafc;
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.4),
                0 4px 12px rgba(59, 130, 246, 0.3);
}

.game-primary-btn:hover,
.game-primary-btn:focus {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 32px rgba(29, 78, 216, 0.5),
                0 6px 16px rgba(59, 130, 246, 0.4);
}

.game-primary-btn:active {
    transform: translateY(0) scale(0.98);
}

.game-secondary-btn {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.game-secondary-btn:hover,
.game-secondary-btn:focus {
    background: rgba(148, 163, 184, 0.25);
    border-color: rgba(148, 163, 184, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.game-secondary-btn:active {
    transform: translateY(0);
}

.game-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(241, 245, 249, 0.9);
    background: rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.game-heading {
    font-size: clamp(1.8rem, 2.6vw, 2.4rem);
    font-weight: 700;
    color: rgba(248, 250, 252, 0.95);
    margin: 0;
}

.game-subtext {
    font-size: 1rem;
    color: rgba(226, 232, 240, 0.8);
    max-width: 34rem;
}

.effect-host {
    position: relative;
}

.bitter-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 8;
}

.bitter-confetti__piece {
    position: absolute;
    top: -12vh;
    width: var(--size, 11px);
    height: calc(var(--size, 11px) * 1.75);
    border-radius: 4px;
    opacity: 0.98;
    transform: translate3d(0, 0, 0) rotate(0deg);
    animation: bitter-confetti-fall var(--duration, 3.8s) cubic-bezier(0.18, 0.55, 0.22, 0.99) infinite;
    animation-delay: var(--delay, 0s);
    mix-blend-mode: screen;
    box-shadow: 0 0 22px rgba(248, 250, 252, 0.58);
    will-change: transform, opacity;
}

.bitter-fail-sparks {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 8;
}

.bitter-fail-sparks__dot {
    position: absolute;
    width: var(--size, 10px);
    height: var(--size, 10px);
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.98);
    opacity: 0;
    animation: bitter-fail-pop var(--duration, 0.6s) ease-out infinite;
    animation-delay: var(--delay, 0s);
    box-shadow: 0 0 18px rgba(248, 113, 113, 0.6);
}

.bitter-fail-ring {
    position: absolute;
    inset: auto 15% -10%;
    height: 20%;
    border-radius: 100%;
    border: 2px solid rgba(248, 113, 113, 0.35);
    animation: bitter-fail-ring-wave 1.1s ease-out infinite;
}

@keyframes bitter-confetti-fall {
    0% {
        opacity: 0;
        transform: translate3d(0, -6vh, 0) rotate(0deg);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--dx, 0px), 120vh, 0) rotate(var(--rotate, 720deg));
    }
}

@keyframes bitter-fail-pop {
    0% {
        transform: scale(0.4) translateY(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1.6) translateY(var(--ty, -90px));
        opacity: 0;
    }
}

@keyframes bitter-fail-ring-wave {
    0% {
        opacity: 0.75;
        transform: scale(0.8);
    }
    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}
