/* ==========================================================================
   TOGGLE BUBBLE - STYLESHEET
   Retro 8-Bit Pixel Art aesthetic with CloudFire Corporate Branding
   Desktop PC & Smartphone Responsive Layout
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Poppins:wght@600;800&display=swap');

:root {
    --brand-navy: #000074;
    --brand-pink: #FF0068;
    --brand-cyan: #00AAFF;
    --brand-purple: #C3229C;
    --brand-green: #00E676;
    --brand-yellow: #FFD600;
    --brand-orange: #FF6D00;
    --brand-white: #FFFFFF;
    --brand-dark: #050616;
    --brand-card-bg: rgba(10, 14, 38, 0.94);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #000000;
    color: #ffffff;
    font-family: 'Press Start 2P', monospace, sans-serif;
    overflow: hidden;
}

/* ==========================================================================
   FULLSCREEN INTRO (100% PITCH BLACK, "DARK MODE" + UNLIT VIBRATING TOGGLE)
   ========================================================================== */
.intro-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease;
    overflow: hidden;
}

.intro-fullscreen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.intro-canvas {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100001;
    cursor: pointer;
}

.intro-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 36px;
    text-align: center;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 100002;
}

.intro-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 0;
    transition: all 0.6s ease;
    white-space: nowrap;
}

.intro-word-dark {
    font-size: 32px;
    letter-spacing: 3px;
    color: #FFFFFF;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
    display: inline-block;
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1),
                filter 3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* "Dark" word fading out smoothly over 3 seconds */
.intro-word-dark.fading-dark-3s {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(-20px) scale(0.65);
    pointer-events: none;
}

.intro-word-mode {
    font-size: 32px;
    letter-spacing: 3px;
    color: #FFFFFF;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
    display: inline-block;
    transition: font-size 3s cubic-bezier(0.25, 1, 0.5, 1),
                color 2s ease,
                text-shadow 2.5s ease,
                transform 3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* "MODE" word growing bigger and bigger over 3 seconds */
.intro-word-mode.growing-mode-3s {
    font-size: 46px;
    color: var(--brand-cyan);
    text-shadow: 0 0 20px var(--brand-cyan), 0 0 40px var(--brand-pink);
    transform: scale(1.35);
}

/* "CLOUDFIRE" word revealed */
.intro-word-cloudfire {
    font-size: 46px;
    letter-spacing: 3px;
    color: var(--brand-pink);
    text-shadow: 0 0 25px var(--brand-pink), 0 0 50px var(--brand-cyan);
    display: inline-block;
    animation: burstPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes burstPop {
    0% { transform: scale(0.4); opacity: 0; }
    80% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}

/* "CLOUDFIRE MODE" combined and vibrating for 5 full seconds */
.intro-title-container.cloudfire-mode-active {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 36px; /* Generous, clear separation between CLOUDFIRE and MODE */
    animation: intenseVibe 0.05s infinite alternate;
}

.intro-title-container.cloudfire-mode-active .intro-word-cloudfire,
.intro-title-container.cloudfire-mode-active .intro-word-mode {
    font-size: 38px;
    color: var(--brand-pink) !important;
    text-shadow: 0 0 28px var(--brand-pink), 0 0 55px #FFFFFF, 3px 3px 0px var(--brand-navy);
    letter-spacing: 2px;
    display: inline-block;
    transform: none !important; /* Critical: prevent scale bleeding from eating up the gap */
    margin: 0;
}

.intro-title-container.cloudfire-mode-active .intro-word-cloudfire {
    margin-right: 10px; /* Explicit additional spacing */
}

@keyframes intenseVibe {
    0% {
        transform: scale(1.10) translate(-4px, 3px) rotate(-1.2deg);
    }
    50% {
        transform: scale(1.16) translate(5px, -4px) rotate(1.4deg);
    }
    100% {
        transform: scale(1.12) translate(-3px, -3px) rotate(-0.8deg);
    }
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    .intro-title-container {
        gap: 10px;
    }
    .intro-title-container.cloudfire-mode-active {
        gap: 22px;
        white-space: nowrap;
    }
    .intro-word-dark, .intro-word-mode {
        font-size: 20px;
        letter-spacing: 2px;
    }
    .intro-word-mode.growing-mode-3s {
        font-size: 24px;
        transform: scale(1.25);
    }
    .intro-word-cloudfire {
        font-size: 20px;
        letter-spacing: 1px;
    }
    .intro-title-container.cloudfire-mode-active .intro-word-cloudfire,
    .intro-title-container.cloudfire-mode-active .intro-word-mode {
        font-size: 19px;
        letter-spacing: 1px;
        transform: none !important;
    }
    .intro-title-container.cloudfire-mode-active .intro-word-cloudfire {
        margin-right: 6px;
    }
}

/* ==========================================================================
   CLOUDFIRE BRAND INTRO TOGGLE SWITCH (SLIDING & DRAGGABLE)
   ========================================================================== */
.toggle-switch-container {
    cursor: pointer;
    padding: 10px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.brand-toggle-switch {
    width: clamp(155px, 42vw, 192px);
    aspect-ratio: 1000 / 560;
    position: relative;
    cursor: grab;
    display: block;
    animation: subtleToggleVibe 2.4s infinite ease-in-out;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: transparent;
    border: none;
    outline: none;
    touch-action: none;
}

.brand-toggle-switch.is-dragging {
    cursor: grabbing;
    animation: none !important;
}

.brand-toggle-switch:hover:not(.is-dragging):not(.igniting-2s) {
    transform: scale(1.04);
}

/* Track container & images */
.brand-toggle-track {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.track-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.track-off {
    opacity: 1;
    z-index: 1;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.85));
}

.track-on {
    opacity: 0;
    z-index: 2;
    filter: drop-shadow(0 0 20px rgba(255, 0, 104, 0.85)) drop-shadow(0 0 35px rgba(0, 170, 255, 0.8));
}

/* Sliding Knob */
.brand-toggle-knob {
    position: absolute;
    top: 10.893%;
    left: 6.1%;
    width: 43.8%;
    height: 78.214%;
    cursor: grab;
    z-index: 5;
    touch-action: none;
    transform: translateX(0);
    will-change: transform;
}

.brand-toggle-knob.is-grabbing {
    cursor: grabbing;
}

.knob-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    border-radius: 50%;
    transition: opacity 0.25s ease;
}

.knob-off {
    opacity: 1;
    z-index: 1;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.9));
}

.knob-on {
    opacity: 0;
    z-index: 2;
    filter: drop-shadow(0 0 16px rgba(0, 170, 255, 0.95)) drop-shadow(0 0 28px rgba(255, 0, 104, 0.85));
}

@keyframes subtleToggleVibe {
    0%, 100% {
        transform: scale(1.0) rotate(0deg);
    }
    20% {
        transform: scale(1.025) rotate(-0.8deg);
    }
    40% {
        transform: scale(1.025) rotate(0.8deg);
    }
    60% {
        transform: scale(1.035) rotate(-0.5deg);
    }
    80% {
        transform: scale(1.015) rotate(0.5deg);
    }
}

/* 2-Second CloudFire Neon Glow Ignition Animation */
.brand-toggle-switch.igniting-2s {
    cursor: default;
    animation: toggleIgnitePulse 0.5s infinite alternate ease-in-out;
}

.brand-toggle-switch.igniting-2s .brand-toggle-knob {
    transform: translateX(100.685%) !important;
}

.brand-toggle-switch.igniting-2s .track-off,
.brand-toggle-switch.igniting-2s .knob-off {
    opacity: 0 !important;
}

.brand-toggle-switch.igniting-2s .track-on,
.brand-toggle-switch.igniting-2s .knob-on {
    opacity: 1 !important;
}

@keyframes toggleIgnitePulse {
    0% {
        transform: scale(1.0);
        filter: drop-shadow(0 0 20px rgba(255, 0, 104, 0.9)) drop-shadow(0 0 40px rgba(0, 170, 255, 0.85));
    }
    100% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 35px rgba(255, 0, 104, 1)) drop-shadow(0 0 65px rgba(0, 170, 255, 1));
    }
}

/* Desktop Arcade Controls Sidebar (Audio & Menu Principale only) */
.desktop-controls-bar {
    display: none;
    width: 220px;
    z-index: 10;
}

.desktop-card {
    background: rgba(8, 12, 38, 0.92);
    border: 2px solid #1c2b66;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(0, 0, 80, 0.5);
}

.actions-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.desktop-brand-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
    image-rendering: crisp-edges;
}

.desktop-card-title {
    font-size: 13px;
    color: var(--brand-cyan);
    text-shadow: 1px 1px 0px var(--brand-navy), 0 0 10px rgba(0, 170, 255, 0.6);
    text-align: center;
    margin-bottom: 4px;
}

.desktop-card-sub {
    font-size: 8px;
    color: #ffd8ea;
    text-align: center;
}

.desktop-card-heading {
    font-size: 9px;
    color: var(--brand-cyan);
    margin-bottom: 10px;
    border-bottom: 1px solid #1c2b66;
    padding-bottom: 6px;
    letter-spacing: 1px;
}

.dt-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8px;
    margin-bottom: 8px;
    color: #9bb0db;
}

.dt-stat-row strong {
    color: #ffffff;
    font-size: 9px;
}

.dt-highlight {
    color: #FFE600 !important;
}

.val-danger {
    color: var(--brand-pink) !important;
    animation: pulseWarn 0.6s infinite alternate;
}

.val-normal {
    color: #66d1ff !important;
}

.desktop-controls-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desktop-controls-list li {
    font-size: 7px;
    line-height: 1.5;
    color: #d0e5ff;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.key-badge {
    color: var(--brand-pink);
    font-weight: bold;
    font-size: 8px;
}

.dt-canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8px 0;
}

#desktopNextCanvas {
    image-rendering: pixelated;
    background: rgba(3, 5, 20, 0.7);
    border-radius: 50%;
    border: 2px solid var(--brand-cyan);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.4);
}

.desktop-hint {
    font-size: 7px;
    color: #8da4d8;
    text-align: center;
    line-height: 1.5;
}

.desktop-leaderboard-mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dt-rank-row {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #14204c;
    color: #cad8f8;
}

.dt-rank-row strong {
    color: #FFE600;
}

.btn-arcade-sm {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 10px;
    background: #0e1847;
    border: 2px solid var(--brand-cyan);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    margin-bottom: 8px;
}

.btn-arcade-sm:hover {
    background: #172769;
    border-color: #fff;
}

/* ==========================================================================
   MAIN APP LAYOUT - FULL VIEWPORT CENTERING (DESKTOP & MOBILE)
   ========================================================================== */
.app-layout {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    background: #000000;
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

.app-layout.intro-hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 440px;
    max-height: 780px;
    background: #040514;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
    margin: 0;
}

/* Desktop Wide View: Game strictly centered in screen, controls sidebar to the right */
@media (min-width: 900px) {
    .app-layout {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 36px;
        padding: 24px;
    }

    #gameContainer {
        border: 3px solid #1c2b66;
        border-radius: 14px;
        box-shadow: 0 0 50px rgba(0, 170, 255, 0.3), 0 0 80px rgba(255, 0, 104, 0.22);
    }

    .desktop-sidebar {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: stretch;
        width: 220px;
        flex-shrink: 0;
        z-index: 20;
        margin: 0;
    }
}

/* Mobile Screen: Fullscreen portrait, Sidebar hidden */
@media (max-width: 899px) {
    .app-layout {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0;
        gap: 0;
    }

    #gameContainer {
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        max-height: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .desktop-sidebar {
        display: none !important;
    }

    .menu-footer {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .menu-footer-copy {
        width: 100%;
        text-align: center;
        margin-top: 3px;
        font-size: 6px;
    }
}

/* Crisp Pixel Art Canvas */
#gameCanvas {
    display: block;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
    cursor: crosshair;
}

/* ==========================================================================
   MAIN MENU OVERLAY
   ========================================================================== */
#mainMenuOverlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 30px 20px 25px 20px;
    background: linear-gradient(180deg, rgba(3, 4, 20, 0.72) 0%, rgba(8, 12, 35, 0.45) 60%, rgba(3, 4, 20, 0.82) 100%);
    pointer-events: auto;
}

.menu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 14px;
    border-radius: 30px;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
}

.brand-badge img {
    height: 24px;
    width: auto;
    image-rendering: crisp-edges;
}

.game-title {
    font-size: 24px;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 3px 3px 0px var(--brand-navy), -2px -2px 0px var(--brand-pink), 0 0 15px rgba(0, 170, 255, 0.8);
    margin-top: 10px;
}

.game-subtitle {
    font-size: 8px;
    color: #ffd8ea;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0px #000;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

/* Pixel Arcade Buttons */
.btn-arcade {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    padding: 13px 16px;
    color: #ffffff;
    background: #0e1847;
    border: 3px solid var(--brand-cyan);
    border-radius: 6px;
    box-shadow: 0 4px 0px var(--brand-navy), 0 0 12px rgba(0, 170, 255, 0.4);
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.15s ease;
}

.btn-arcade:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0px var(--brand-navy), 0 0 18px rgba(0, 170, 255, 0.7);
    background: #172769;
}

.btn-arcade:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0px var(--brand-navy);
}

.btn-arcade.primary {
    background: linear-gradient(135deg, #FF0068 0%, #C3229C 100%);
    border-color: #ffffff;
    box-shadow: 0 4px 0px #700029, 0 0 16px rgba(255, 0, 104, 0.6);
}

.menu-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-footer .btn-mini {
    flex: 1 1 auto;
    text-align: center;
    padding: 7px 8px;
    font-size: 7px;
}

.menu-footer-copy {
    width: 100%;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #8da4d8;
    white-space: nowrap;
    letter-spacing: 0.5px;
    text-align: center;
    margin-top: 4px;
}

/* Trophy Victory Menu Overlay */
.trophy-menu-overlay {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100015;
    animation: fadeInTrophy 0.8s ease;
}

@keyframes fadeInTrophy {
    from { opacity: 0; transform: translate(-50%, 15px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.btn-mini {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: rgba(20, 32, 75, 0.8);
    border: 2px solid #3d5afe;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-mini.muted {
    border-color: #777;
    color: #aaa;
}

/* ==========================================================================
   IN-GAME HUD
   ========================================================================== */
#gameHUD {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 14px;
    z-index: 20;
}

.hud-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(4, 7, 24, 0.85);
    border: 2px solid #1c2b66;
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hud-label {
    font-size: 7px;
    color: #7995cc;
}

.hud-val {
    font-size: 10px;
    color: #ffffff;
    text-shadow: 1px 1px 0px #000;
}

#hudScore {
    color: #FFE600;
}

.hud-laser-item {
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid #00F0FF;
    border-radius: 4px;
    padding: 2px 6px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    animation: laserPulse 1.2s infinite alternate ease-in-out;
}

@keyframes laserPulse {
    0% { box-shadow: 0 0 6px rgba(0, 240, 255, 0.3); border-color: #00F0FF; }
    100% { box-shadow: 0 0 14px rgba(255, 0, 104, 0.7); border-color: #FF0068; }
}

.hud-btn-menu {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    background: #0e1847;
    border: 2px solid var(--brand-pink);
    color: #fff;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
    box-shadow: 0 3px 0px #700029;
    min-width: 38px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s ease, background 0.15s ease;
}

.hud-btn-menu:hover {
    background: #1d2a6d;
    border-color: #ffffff;
}

.hud-btn-menu:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0px #700029;
}

@keyframes pulseWarn {
    from { transform: scale(1); opacity: 0.85; }
    to { transform: scale(1.08); opacity: 1; text-shadow: 0 0 10px #FF0068; }
}

/* Mobile Friendly Bottom Controls Bar */
.hud-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    padding: 4px 6px;
    margin-bottom: 4px;
}

.hud-action-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: #ffffff;
    background: rgba(16, 26, 68, 0.88);
    border: 2px solid var(--brand-cyan);
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    box-shadow: 0 3px 0px var(--brand-navy);
    transition: transform 0.1s ease;
}

.hud-action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0px var(--brand-navy);
}

.hud-action-btn.fire-btn {
    background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple));
    border-color: #FFFFFF;
    font-size: 11px;
    padding: 12px 22px;
    box-shadow: 0 3px 0px #700029, 0 0 12px rgba(255, 0, 104, 0.6);
}

/* ==========================================================================
   MODALS (Game Over, Level Clear, Leaderboard, How To)
   ========================================================================== */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 3, 14, 0.88);
    backdrop-filter: blur(4px);
    z-index: 60;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
}

.modal-content {
    background: var(--brand-card-bg);
    border: 3px solid var(--brand-cyan);
    border-radius: 10px;
    padding: 22px 18px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 170, 255, 0.4), inset 0 0 15px rgba(0, 0, 70, 0.8);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-title {
    font-size: 14px;
    color: #FFFFFF;
    text-shadow: 2px 2px 0px var(--brand-navy), 0 0 10px var(--brand-pink);
}

.modal-score-box {
    background: #040618;
    border: 2px solid #1c2b66;
    padding: 12px;
    border-radius: 6px;
}

.modal-score-label {
    font-size: 8px;
    color: #8fa5d2;
    margin-bottom: 6px;
}

.modal-score-value {
    font-size: 20px;
    color: #FFE600;
    text-shadow: 2px 2px 0px #856100;
}

.modal-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.modal-input-label {
    font-size: 8px;
    color: #c0d4ff;
}

.modal-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    background: #06091e;
    border: 2px solid var(--brand-pink);
    color: #ffffff;
    padding: 10px;
    border-radius: 4px;
    outline: none;
    text-align: center;
    text-transform: uppercase;
}

.modal-input:focus {
    box-shadow: 0 0 10px var(--brand-pink);
}

/* Leaderboard Modal Tabs & List */
.leaderboard-tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.tab-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: #0a1236;
    border: 2px solid #20357d;
    color: #8da4d8;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--brand-navy);
    border-color: var(--brand-cyan);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(0, 170, 255, 0.6);
}

.leaderboard-list {
    background: #05071a;
    border: 2px solid #172554;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 28px 1fr 48px 66px;
    align-items: center;
    font-size: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid #14204c;
    text-align: left;
}

.leaderboard-row .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 4px;
    letter-spacing: 0.2px;
}

.leaderboard-row.top-rank {
    background: rgba(255, 0, 104, 0.15);
    color: #FFE600;
}

.leaderboard-row .score {
    text-align: right;
    color: #FFE600;
}

.leaderboard-row .date {
    color: #6d7f9f;
    font-size: 7px;
}

/* Victory Endless Mode Callout */
.victory-endless-callout {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    line-height: 1.6;
    color: #ffe600;
    text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
    background: rgba(255, 109, 0, 0.12);
    border: 1px dashed rgba(255, 170, 0, 0.45);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 12px;
    text-align: center;
    animation: pulseCallout 2.5s infinite alternate ease-in-out;
}

@keyframes pulseCallout {
    0% { transform: scale(1); border-color: rgba(255, 170, 0, 0.4); }
    100% { transform: scale(1.02); border-color: rgba(255, 230, 0, 0.85); }
}

/* Leaderboard Header & Actions */
.leaderboard-header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    text-align: center;
}

.leaderboard-btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.btn-danger-debug {
    background: rgba(160, 20, 30, 0.85);
    border: 1px solid #ff4d4d;
    color: #ffd6d6;
    font-size: 6.5px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-danger-debug:hover {
    background: #c61010;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

/* -------------------------------------------------------------
 * EASTER EGG: CLOUDFIRE MODE INFERNO (FULLSCREEN PIXEL ART - NO BOX, NO EMOJIS)
 * ------------------------------------------------------------- */
.easter-egg-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #060002;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    animation: screenViolentInfernoShake 0.07s infinite alternate ease-in-out;
}

#easterEggCanvas {
    position: absolute;
    inset: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    z-index: 10;
    pointer-events: none;
}

.easter-egg-inferno-wrap {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 95vw;
    max-width: 900px;
    padding: 10px;
    pointer-events: none;
    text-align: center;
    animation: textViolentVibration 0.08s infinite alternate ease-in-out;
}

.easter-egg-line {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(20px, 5.8vw, 52px);
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.35;
    margin: 8px 0;
    text-transform: uppercase;
    text-align: center;
    background: linear-gradient(
        90deg,
        #ff0055 0%,
        #ff5500 14%,
        #ffe600 28%,
        #00ff66 42%,
        #00e5ff 57%,
        #9900ff 71%,
        #ff0099 85%,
        #ff0055 100%
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(4px 4px 0 #000)
            drop-shadow(-4px -4px 0 #000)
            drop-shadow(4px -4px 0 #000)
            drop-shadow(-4px 4px 0 #000)
            drop-shadow(0 0 25px rgba(255, 230, 0, 0.95))
            drop-shadow(0 0 50px rgba(255, 60, 0, 0.9));
    animation: rainbowHyperSlide 1s linear infinite, lineMegaPulse 0.4s ease-in-out infinite alternate;
}

.easter-egg-line.line-cloudfire {
    font-size: clamp(24px, 6.8vw, 60px);
    letter-spacing: 3px;
}

.easter-egg-line.line-fire {
    font-size: clamp(22px, 6.2vw, 54px);
}

.easter-egg-line.line-boys {
    font-size: clamp(26px, 7.5vw, 68px);
    letter-spacing: 4px;
}

.easter-egg-dismiss-tag {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(7px, 1.8vw, 11px);
    color: #ffe600;
    margin-top: 36px;
    letter-spacing: 1.5px;
    text-shadow: 0 0 10px #ff6600, 2px 2px 0 #000;
    animation: blinkDismissTag 0.8s infinite alternate;
}

@keyframes rainbowHyperSlide {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

@keyframes lineMegaPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes textViolentVibration {
    0% { transform: translate(-3px, 2px) rotate(-0.5deg); }
    25% { transform: translate(3px, -3px) rotate(0.6deg); }
    50% { transform: translate(-4px, -2px) rotate(-0.7deg); }
    75% { transform: translate(4px, 3px) rotate(0.5deg); }
    100% { transform: translate(-2px, 1px) rotate(-0.3deg); }
}

@keyframes screenViolentInfernoShake {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-3px, 2.5px); }
    40% { transform: translate(3px, -2.5px); }
    60% { transform: translate(-2.5px, -3px); }
    80% { transform: translate(2.5px, 2.5px); }
    100% { transform: translate(-1.5px, 1px); }
}

@keyframes blinkDismissTag {
    0% { opacity: 0.45; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1.02); }
}

body.theme-desert .victory-endless-callout {
    background: #fff0d6;
    border-color: #d97724;
    color: #9a3412;
    text-shadow: none;
}

body.theme-desert .btn-danger-debug {
    background: #dc2626;
    border-color: #b91c1c;
    color: #ffffff;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-thumb {
    background: var(--brand-cyan);
    border-radius: 2px;
}

/* ==========================================================================
   DESERT / SUMMER THEME (LIGHT MODE - "NON TI PIACE IL FREDDO?")
   ========================================================================== */
.hud-buttons-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-theme-pill {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    background: rgba(14, 24, 71, 0.85);
    border: 2px solid #365099;
    color: #b8cbed;
    padding: 7px 11px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 0 #0b153c;
    transition: all 0.2s ease;
}

.btn-theme-pill:hover {
    background: rgba(22, 38, 110, 0.95);
    border-color: #66d1ff;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 0 #0b153c, 0 0 10px rgba(0, 170, 255, 0.4);
}

.btn-theme-pill.is-desert {
    background: #ffeed1;
    border-color: #d97724;
    color: #3b1e05;
    box-shadow: 0 2px 0 #a34c05;
}

/* ==========================================================================
   DESERT LIGHT THEME (Warm, High Visibility, Zero Dark Blues)
   ========================================================================== */
body.theme-desert {
    background-color: #faf0e1;
    color: #2b1604;
}

body.theme-desert .app-layout {
    background: radial-gradient(circle at 50% 25%, #fffefb 0%, #faeee0 55%, #edd2b3 100%);
}

body.theme-desert #gameContainer {
    background: #fef7ee;
    border-color: #d97724;
    box-shadow: 0 0 45px rgba(217, 119, 36, 0.35), 0 0 75px rgba(255, 140, 0, 0.2);
}

body.theme-desert .desktop-card {
    background: rgba(255, 251, 244, 0.97);
    border: 2px solid #d97724;
    box-shadow: 0 4px 18px rgba(180, 95, 20, 0.2), inset 0 0 10px rgba(255, 220, 150, 0.4);
}

body.theme-desert .desktop-card-title {
    color: #b8520b;
    text-shadow: 1px 1px 0px #ffe2b8;
}

body.theme-desert .desktop-card-heading {
    color: #b8520b;
    border-bottom: 1px solid #e5a765;
}

body.theme-desert .desktop-card-sub {
    color: #6a3a10;
}

body.theme-desert .dt-stat-label {
    color: #7d4818;
}

body.theme-desert .dt-stat-val {
    color: #2b1604;
}

body.theme-desert .dt-rank-row {
    color: #361c05;
    border-bottom-color: #edd1ad;
}

body.theme-desert .btn-arcade {
    background: #fff8eb;
    color: #2e1704;
    border: 3px solid #d97724;
    box-shadow: 0 4px 0 #9e4c05, 0 0 12px rgba(217, 119, 36, 0.25);
}

body.theme-desert .btn-arcade:hover {
    background: #ffeed1;
    border-color: #f59e0b;
    box-shadow: 0 6px 0 #9e4c05, 0 0 18px rgba(245, 158, 11, 0.4);
}

body.theme-desert .btn-arcade.primary {
    background: linear-gradient(135deg, #FF0068 0%, #FF6D00 100%);
    color: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 4px 0 #990036, 0 0 16px rgba(255, 0, 104, 0.4);
}

body.theme-desert .btn-arcade-sm {
    background: #fff5e6;
    color: #2e1704;
    border-color: #d97724;
    box-shadow: 0 3px 0 #9e4c05;
}

body.theme-desert .btn-arcade-sm:hover {
    background: #ffecd1;
    border-color: #f59e0b;
}

body.theme-desert .btn-mini {
    background: #ffedd5;
    color: #381c05;
    border-color: #d97724;
}

body.theme-desert .btn-mini:hover {
    background: #ffe3bd;
}

body.theme-desert .hud-top-bar {
    background: rgba(255, 252, 246, 0.96);
    border: 2px solid #d97724;
    box-shadow: 0 3px 12px rgba(180, 85, 15, 0.25);
}

body.theme-desert .hud-label {
    color: #783f0f;
}

body.theme-desert .hud-val {
    color: #261303;
    text-shadow: none;
}

body.theme-desert #hudScore {
    color: #c2410c;
    font-weight: bold;
}

body.theme-desert .hud-btn-menu {
    background: #ffecd1;
    border-color: #d97724;
    color: #361b05;
    box-shadow: 0 2px 0 #9e4c05;
}

body.theme-desert #mainMenuOverlay {
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.9) 0%, rgba(254, 237, 212, 0.72) 60%, rgba(255, 247, 235, 0.95) 100%);
}

body.theme-desert .game-title {
    color: #2b1604;
    text-shadow: 3px 3px 0px #f8cf88, -2px -2px 0px var(--brand-pink), 0 0 15px rgba(255, 109, 0, 0.35);
}

body.theme-desert .game-subtitle {
    color: #9a4708;
    text-shadow: none;
}

body.theme-desert .menu-footer-copy {
    color: #8c521b;
}

body.theme-desert .modal-content {
    background: #fffbf4;
    border: 4px solid #d97724;
    box-shadow: 0 0 35px rgba(217, 119, 36, 0.4);
    color: #2e1805;
}

body.theme-desert .modal-score-box {
    background: #fff1d6;
    border-color: #e0964a;
}

body.theme-desert .modal-score-label {
    color: #7c4415;
}

body.theme-desert .modal-score-value {
    color: #c2410c;
}

body.theme-desert .modal-input {
    background: #fff8ed;
    border-color: #d97724;
    color: #2e1704;
}

body.theme-desert .modal-title {
    color: #b8520b;
    text-shadow: 2px 2px 0px #ffe2b8, 0 0 10px rgba(255, 109, 0, 0.3);
}

body.theme-desert .modal-input-label {
    color: #7c4415;
}

body.theme-desert .tab-btn {
    background: #fff4e0;
    border: 2px solid #d97724;
    color: #6a3a10;
}

body.theme-desert .tab-btn.active {
    background: #ffedd5;
    border-color: #ea580c;
    color: #9a3412;
    box-shadow: 0 0 8px rgba(234, 88, 12, 0.4);
}

body.theme-desert .leaderboard-list {
    background: #fff8ed;
    border: 2px solid #e5a765;
}

body.theme-desert .leaderboard-row {
    color: #361c05;
    border-bottom: 1px solid #edd1ad;
}

body.theme-desert .leaderboard-row.top-rank {
    background: rgba(255, 109, 0, 0.15);
    color: #c2410c;
}

body.theme-desert .leaderboard-row .score {
    color: #b8520b;
}

body.theme-desert .leaderboard-row .date {
    color: #8c5a2c;
}
