@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('./file-loader.css');

body {
    margin: 0;
    padding: 0;
    background: #0a0a0a;
    font-family: 'Orbitron', monospace;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    /* Prevent mobile touch behaviors */
    
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
   
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Prevent touch behaviors on game area */
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    
    /* Initially hidden until assets are loaded */
    display: none;
    visibility: hidden;
}

/* When game container is shown after loading */
#gameContainer.loaded {
    display: flex;
    visibility: visible;
}

#gameContainer canvas {
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    width: auto;
    height: auto;
    border: 3px solid #4CAF50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Mobile specific - improve centering and fullscreen behavior */
@media (max-width: 768px) {
    body {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100); /* Use custom viewport height */
        /* Support safe areas for notched devices */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        /* Prevent any scrolling on mobile */
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }
    
    #gameContainer {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        display: flex;
        justify-content: center;
        align-items: center; /* Center the canvas instead of flex-end */
        padding: 0;
        margin: 0;
        /* Account for safe areas */
        top: env(safe-area-inset-top, 0);
        height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
        height: calc(calc(var(--vh, 1vh) * 100) - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
        /* Prevent scrolling and improve touch response */
        overflow: hidden;
        touch-action: manipulation;
        -webkit-user-select: none;
        user-select: none;
    }
    
    #gameContainer canvas {
        border: none;
        border-radius: 0;
        position: relative;
        display: block;
        margin: 0;
        /* Make canvas fill entire screen on mobile */
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        max-width: none;
        max-height: none;
        /* Cover entire screen area */
        object-fit: cover;
        object-position: center;
        /* Smooth rendering on mobile */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        /* Prevent context menu on mobile */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Portrait mobile - canvas fills entire screen */
@media (max-width: 768px) and (orientation: portrait) {
    #gameContainer canvas {
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
    }
}

/* Landscape mobile - canvas fills entire screen */
@media (max-width: 768px) and (orientation: landscape) {
    #gameContainer canvas {
        width: 100vw !important;
        height: 100vh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
    }
}

/* Main UI Panel - Simplified Score Board */
#ui {
    position: absolute;
    top: 15px;
    left: 20px;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: white;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    box-shadow: none;
    backdrop-filter: none;
    display: none; /* Hide by default to prevent flash */
    min-width: auto;
}

/* Mobile UI adjustments */
@media (max-width: 768px) {
    #ui {
        top: 10px;
        left: 10px;
        padding: 0;
        font-size: 18px;
        border-radius: 0;
    }
    
    #multiplierUI {
        top: 10px;
        right: 10px;
        padding: 0;
        font-size: 16px;
        border-radius: 0;
    }
    
    #scoreMultiplier {
        font-size: 18px !important;
        margin-bottom: 2px;
    }
    
    #multiplierLabel {
        font-size: 11px !important;
    }
    
    #magnetUI {
        top: 80px;
        right: 10px;
        padding: 8px;
        border-radius: 6px;
    }
    
    #magnetTimer {
        font-size: 16px !important;
    }
    
    #diloUI {
        top: 150px;
        right: 10px;
        padding: 8px;
        border-radius: 6px;
    }
    
    #diloTimer {
        font-size: 16px !important;
    }
    
    #invincibilityNotification {
        top: 220px;  /* Below dilo UI on mobile */
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
        max-width: 160px;
        border-radius: 6px;
    }
    
    #pauseButton {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 80px; /* Position to the left of multiplier UI on mobile */
        border-width: 2px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #ui {
        font-size: 16px;
        padding: 0;
    }
    
    #multiplierUI {
        padding: 0;
        font-size: 14px;
    }
    
    #scoreMultiplier {
        font-size: 16px !important;
        margin-bottom: 2px;
    }
    
    #multiplierLabel {
        font-size: 10px !important;
    }
    
    #magnetUI {
        top: 70px;
        padding: 6px;
    }
    
    #magnetTimer {
        font-size: 14px !important;
    }
    
    #diloUI {
        top: 130px;
        padding: 6px;
    }
    
    #diloTimer {
        font-size: 14px !important;
    }
    
    #invincibilityNotification {
        top: 190px;  /* Adjusted for landscape */
        padding: 6px 10px;
        font-size: 11px;
        max-width: 140px;
    }
    
    #pauseButton {
        width: 40px;
        height: 40px;
        top: 8px;
        right: 70px; /* Position to the left of multiplier UI on mobile landscape */
        border-width: 2px;
    }
}

#ui div {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
#ui span {
    color: white;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
}

/* Multiplier UI - Simplified */
#multiplierUI {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: white;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: none;
    backdrop-filter: none;
    display: none; /* Hide by default to prevent flash */
    min-width: auto;
}
#scoreMultiplier {
    font-size: 20px;
    margin-bottom: 3px;
    transition: all 0.3s ease;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    font-weight: 700;
}
#multiplierLabel {
    font-size: 12px;
    opacity: 0.9;
    color: white;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
}
.multiplier-active {
    transform: scale(1.05);
}
.multiplier-active #scoreMultiplier {
    text-shadow: 0 0 15px rgba(0, 255, 136, 1), 2px 2px 4px rgba(0, 0, 0, 0.9);
}

/* Magnet UI */
#magnetUI {
    position: absolute;
    top: 160px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 0, 102, 0.1) 0%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #FF0066;
    border-radius: 12px;
    padding: 15px;
    color: #FF6699;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 102, 153, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 0, 102, 0.3);
    backdrop-filter: blur(5px);
    display: none; /* Hide by default to prevent flash */
}
#magnetUI.active {
    display: block; /* Show when active */
    opacity: 1;
    transform: scale(1.05);
    border-color: #FF6699;
    background: linear-gradient(135deg, rgba(255, 102, 153, 0.3) 0%, rgba(0, 0, 0, 0.8) 100%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 102, 153, 0.6);
}
#magnetTimer {
    font-size: 24px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
    color: #FF6699;
    text-shadow: 0 0 15px rgba(255, 102, 153, 1);
}
#magnetLabel {
    font-size: 12px;
    opacity: 0.9;
    color: #FFCCDD;
}

/* Dilo UI */
#diloUI {
    position: absolute;
    top: 260px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.1) 0%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #0066FF;
    border-radius: 12px;
    padding: 15px;
    color: #6699FF;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(102, 153, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 102, 255, 0.3);
    backdrop-filter: blur(5px);
    display: none; /* Hide by default to prevent flash */
}
#diloUI.active {
    display: block; /* Show when active */
    opacity: 1;
    transform: scale(1.05);
    border-color: #6699FF;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.3) 0%, rgba(0, 0, 0, 0.8) 100%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 102, 255, 0.6);
}
#diloTimer {
    font-size: 24px;
    margin-bottom: 5px;
    transition: all 0.3s ease;
    color: #6699FF;
    text-shadow: 0 0 15px rgba(102, 153, 255, 1);
}
#diloLabel {
    font-size: 12px;
    opacity: 0.9;
    color: #CCDDFF;
}

/* Invincibility Notification */
#invincibilityNotification {
    position: absolute;
    top: 360px;  /* Position below the dilo UI */
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #FFD700;
    border-radius: 12px;
    padding: 12px 18px;
    color: #FFD700;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 150;
    text-align: center;
    font-size: 14px;
    opacity: 0;
    transform: translateX(100px) scale(0.8);
    transition: all 0.5s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(5px);
    pointer-events: none;
    max-width: 200px;
    word-wrap: break-word;
}
#invincibilityNotification.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}
#invincibilityNotification.active {
    border-color: #FFA500;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 165, 0, 0.15) 50%, rgba(0, 0, 0, 0.8) 100%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.5);
    animation: invincibilityPulse 1s ease-in-out infinite alternate;
}
@keyframes invincibilityPulse {
    0%, 100% { transform: translateX(0) scale(1); }
    50% { transform: translateX(0) scale(1.05); }
}

/* Mobile invincibility notification adjustments */
@media (max-width: 768px) {
    #invincibilityNotification {
        top: 220px;  /* Below magnet UI on mobile */
        right: 10px;
        padding: 10px 14px;
        font-size: 12px;
        max-width: 160px;
        border-radius: 8px;
    }
}

        /* Whitepaper Puzzle UI - Smaller Size */
#whitepaperUI {
    position: absolute;
    top: 60px;
    left: 20px;
    background: none; /* Remove background for simpler look */
    border: none; /* Remove border for simpler look */
    border-radius: 0;
    padding: 0; /* Remove padding for simpler look */
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: none; /* Remove box shadow for simpler look */
    backdrop-filter: none; /* Remove backdrop filter for simpler look */
    min-width: auto; /* Remove min-width constraint */
    max-width: none; /* Remove max-width constraint */
}

#whitepaperTitle {
    font-size: 11px;
    margin-bottom: 8px;
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(255, 255, 255, 1);
    font-weight: 700;
    display: none; /* Hide title on desktop for simpler look */
}

#whitepaperPuzzleContainer {
    position: relative;
    width: 200px;
    height: 285px;
    margin: 0; /* Remove margin for simpler positioning */
    border: none; /* Remove border for cleaner look */
    border-radius: 0; /* Remove border radius for cleaner look */
    overflow: hidden;
    background: none; /* Remove background for cleaner look */
}

#whitepaperBaseImage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    filter: brightness(0.4);
    z-index: 1;
}

#whitepaperPuzzleGrid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 1px;
    z-index: 2;
}

.puzzle-piece {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.puzzle-piece.revealed {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
    animation: pieceReveal 0.5s ease;
}

.puzzle-piece.just-collected {
    animation: pieceCollected 0.6s ease;
}

/* Hidden pieces that don't exist in the puzzle set (calculated dynamically) */
.puzzle-piece.hidden {
    background: transparent;
    border: none;
}

/* Mobile-only progress bar styles */
#whitepaperProgressBar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50 0%, #81C784 50%, #A5D6A7 100%);
    transition: width 0.5s ease-out;
    z-index: 1;
    display: none; /* Hidden on desktop */
}

#whitepaperProgressBar.complete {
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Puzzle animations */
@keyframes pieceReveal {
    0% {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1);
    }
    50% {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
    100% {
        background: transparent;
        transform: scale(1.02);
    }
}

@keyframes pieceCollected {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }
    25% {
        transform: scale(1.15);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    100% {
        transform: scale(1.02);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
    }
}

/* Developer Team UI */
#devTeamUI {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.15) 0%, rgba(34, 139, 34, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #00FF88;
    border-radius: 10px;
    padding: 10px;
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(5px);
    min-width: 180px;
    max-width: 200px;
    display: none; /* Initially hidden, enabled by stage */
}

#devTeamTitle {
    font-size: 11px;
    margin-bottom: 8px;
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(0, 255, 136, 1);
    font-weight: 700;
}

#devTeamContainer {
    position: relative;
    width: 160px;
    height: 120px;
    margin: 0 auto 8px auto;
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

#devTeamGrid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    padding: 8px;
    gap: 4px;
    overflow-y: auto;
}

.dev-sprite {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border: 1px solid rgba(0, 255, 136, 0.5);
    border-radius: 4px;
    background: rgba(0, 255, 136, 0.1);
    animation: devGlow 2s ease-in-out infinite alternate;
}

@keyframes devGlow {
    from {
        box-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
    }
    to {
        box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
    }
}

#devTeamCounter {
    font-size: 9px;
    color: #CCCCCC;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

/* Completion glow effect */
.whitepaper-complete {
    border-color: #FFD700 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.6) !important;
    animation: whitepaperCompleteGlow 2s ease-in-out infinite alternate;
}

/* Completion glow animation */
@keyframes whitepaperCompleteGlow {
    from {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.6) !important;
    }
    to {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 50px rgba(255, 215, 0, 1.0) !important;
    }
}

.whitepaper-complete #whitepaperBaseImage {
    opacity: 1 !important;
    filter: brightness(1.2) saturate(1.3) !important;
}

        /* Mobile adjustments */
@media (max-width: 768px) {
    #whitepaperUI {
        top: auto;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
        padding: 8px 12px;
        width: 90vw;
        max-width: 350px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        /* Restore background and styling for mobile */
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(240, 240, 240, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
        border: 2px solid #E8E8E8;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(5px);
    }
    
    #whitepaperTitle {
        font-size: 10px;
        margin-bottom: 6px;
        white-space: nowrap;
        display: block; /* Show title on mobile */
    }
    
    #whitepaperPuzzleContainer {
        width: 100%;
        height: 40px;
        margin: 6px 0;
        border: 2px solid #E8E8E8;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.8);
    }
    
    #whitepaperPuzzleGrid {
        display: none; /* Hide puzzle grid on mobile */
    }
    
    #whitepaperProgressBar {
        display: block; /* Show progress bar on mobile */
    }
    
    #whitepaperBaseImage {
        position: absolute;
        top: 50%;
        right: 6px;
        width: 30px;
        height: 38px;
        object-fit: contain;
        transform: translateY(-50%);
        opacity: 0.4;
        filter: brightness(0.6);
        z-index: 2;
        transition: all 0.3s ease;
    }
    
    #whitepaperBaseImage.complete {
        opacity: 1;
        filter: brightness(1.2) saturate(1.3);
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    
    #whitepaperCounter {
        font-size: 10px;
        font-weight: 700;
        display: block; /* Show counter on mobile */
        margin-top: 4px;
        color: rgba(255, 255, 255, 0.9);
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #whitepaperUI {
        top: auto;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
        padding: 6px 10px;
        width: 85vw;
        max-width: 300px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        /* Restore background and styling for mobile landscape */
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(240, 240, 240, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
        border: 2px solid #E8E8E8;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(5px);
    }
    
    #whitepaperTitle {
        font-size: 9px;
        margin-bottom: 4px;
        white-space: nowrap;
        display: block; /* Show title on mobile landscape */
    }
    
    #whitepaperPuzzleContainer {
        width: 100%;
        height: 35px;
        margin: 4px 0;
        border: 2px solid #E8E8E8;
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.8);
    }
    
    #whitepaperPuzzleGrid {
        display: none; /* Hide puzzle grid on mobile landscape */
    }
    
    #whitepaperProgressBar {
        display: block; /* Show progress bar on mobile landscape */
    }
    
    #whitepaperBaseImage {
        position: absolute;
        top: 50%;
        right: 5px;
        width: 25px;
        height: 30px;
        object-fit: contain;
        transform: translateY(-50%);
        opacity: 0.4;
        filter: brightness(0.6);
        z-index: 2;
        transition: all 0.3s ease;
    }
    
    #whitepaperBaseImage.complete {
        opacity: 1;
        filter: brightness(1.2) saturate(1.3);
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
    
    #whitepaperCounter {
        font-size: 9px;
        font-weight: 700;
        display: block; /* Show counter on mobile landscape */
        margin-top: 3px;
        color: rgba(255, 255, 255, 0.9);
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #invincibilityNotification {
        top: 180px;  /* Adjusted for landscape */
        padding: 8px 12px;
        font-size: 11px;
        max-width: 140px;
    }
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(30, 30, 30, 0.9) 100%);
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 15px 25px;
    color: white;
    text-align: center;
    font-size: 13px;
    font-weight: 400;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.6), 1px 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 200;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 15px rgba(76, 175, 80, 0.2);
    backdrop-filter: blur(5px);
    max-width: 800px;
    display: none; /* Hide by default to prevent flash */
}

/* Instructions Page */
#instructionsPage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2a1a0a 100%);
    display: none;
    z-index: 500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    overflow-y: auto;
}
#instructionsPage.open {
    display: flex;
}
.instructions-panel {
    background: 
        linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(30, 30, 30, 0.85) 100%),
        url('/assets/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid #4CAF50;
    border-radius: 15px;
    padding: 0;
    max-width: 625px;
    max-height: 60vh;
    margin: 20px;
    color: white;
    font-family: 'Orbitron', monospace;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 60px rgba(76, 175, 80, 0.4);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.instructions-header {
    position: sticky;
    top: 0;
    background: 
        linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
    padding: 32px 32px 20px 32px;
    border-radius: 15px 15px 0 0;
    border-bottom: 2px solid rgba(76, 175, 80, 0.3);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.instructions-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 32px 32px 32px;
}

.instructions-panel h1 {
    margin: 0 0 0 0;
    text-align: center;
    color: #4CAF50;
    font-size: 30px;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 18px 0;
}
.control-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
}
.control-key {
    font-weight: 700;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    padding: 6px 10px;
    border-radius: 6px;
    margin-right: 10px;
    min-width: 60px;
    text-align: center;
    font-size: 15px;
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
    border: 1px solid rgba(76, 175, 80, 0.4);
}
.control-description {
    flex: 1;
    font-size: 15px;
    color: #E0E0E0;
}
.items-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin: 18px 0;
}
.item-card {
    background: rgba(76, 175, 80, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}
.item-icon {
    width: 30px;
    height: 30px;
    margin: 0 auto 6px auto;
    display: block;
    object-fit: contain;
}
.item-info {
    flex: 1;
}
.item-name {
    font-weight: 600;
    color: #4CAF50;
    font-size: 15px;
    margin-bottom: 4px;
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}
.item-effect {
    font-size: 12px;
    color: #B0B0B0;
    line-height: 1.2;
}
.back-button {
    position: absolute;
    top: 18px;
    left: 18px;
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    border: 2px solid #66BB6A;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', monospace;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(76, 175, 80, 0.3);
    z-index: 11;
}
.back-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(76, 175, 80, 0.5);
}
.objective-text {
    font-size: 16px;
    line-height: 1.4;
    color: #C0C0C0;
    text-align: center;
    margin: 18px 0;
    padding: 12px;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 8px;
}

.mobile-controls-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
}

.mobile-controls-section h3 {
    margin: 0 0 15px 0;
    color: #4CAF50;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

/* Hide mobile controls on desktop, show on mobile */
@media (min-width: 769px) {
    .mobile-controls-section {
        display: none;
    }
}

/* Mobile Instructions adjustments */
@media (max-width: 768px) {
    .instructions-panel {
        margin: 20px;
        max-width: calc(100vw - 40px);
        max-height: 60vh;
        border-radius: 12px;
    }
    
    .instructions-header {
        padding: 20px 20px 15px 20px;
        border-radius: 12px 12px 0 0;
    }
    
    .instructions-content {
        padding: 15px 20px 20px 20px;
    }
    
    .instructions-panel h1 {
        font-size: 24px;
    }
    
    .back-button {
        padding: 8px 14px;
        font-size: 12px;
        top: 15px;
        left: 15px;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 15px 0;
    }
    
    .control-item {
        padding: 8px 10px;
    }
    
    .control-key {
        font-size: 13px;
        padding: 5px 8px;
        min-width: 50px;
        margin-right: 8px;
    }
    
    .control-description {
        font-size: 13px;
    }
    
    .items-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 15px 0;
    }
    
    .item-card {
        padding: 10px;
    }
    
    .item-icon {
        width: 24px;
        height: 24px;
        margin: 0 auto 5px auto;
    }
    
    .item-name {
        font-size: 13px;
        margin-bottom: 3px;
    }
    
    .item-effect {
        font-size: 10px;
    }
    
    .objective-text {
        font-size: 14px;
        margin: 15px 0;
        padding: 10px;
    }
    
    .mobile-controls-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    .mobile-controls-section h3 {
        font-size: 16px;
        margin: 0 0 12px 0;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    .instructions-panel {
        margin: 15px;
        max-height: 60vh;
        border-radius: 10px;
    }
    
    .instructions-header {
        padding: 15px 15px 12px 15px;
        border-radius: 10px 10px 0 0;
    }
    
    .instructions-content {
        padding: 12px 15px 15px 15px;
    }
    
    .instructions-panel h1 {
        font-size: 20px;
    }
    
    .back-button {
        padding: 6px 10px;
        font-size: 10px;
        top: 12px;
        left: 12px;
    }
    
    .controls-grid {
        gap: 6px;
        margin: 12px 0;
    }
    
    .control-item {
        padding: 6px 8px;
    }
    
    .control-key {
        font-size: 11px;
        padding: 4px 6px;
        min-width: 45px;
        margin-right: 6px;
    }
    
    .control-description {
        font-size: 11px;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 12px 0;
    }
    
    .item-card {
        padding: 8px;
        display: flex;
        align-items: center;
        text-align: left;
    }
    
    .item-icon {
        width: 20px;
        height: 20px;
        margin: 0 8px 0 0;
        flex-shrink: 0;
    }
    
    .item-info {
        flex: 1;
    }
    
    .item-name {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .item-effect {
        font-size: 9px;
    }
    
    .objective-text {
        font-size: 12px;
        margin: 12px 0;
        padding: 8px;
        line-height: 1.3;
    }
    
    .mobile-controls-section {
        margin: 12px 0;
        padding: 10px;
    }
    
    .mobile-controls-section h3 {
        font-size: 14px;
        margin: 0 0 10px 0;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .instructions-panel {
        margin: 15px;
        max-height: 60vh;
        border-radius: 10px;
    }
    
    .instructions-header {
        padding: 12px 15px 10px 15px;
        border-radius: 10px 10px 0 0;
    }
    
    .instructions-content {
        padding: 10px 15px 15px 15px;
    }
    
    .instructions-panel h1 {
        font-size: 20px;
    }
    
    .back-button {
        padding: 5px 8px;
        font-size: 9px;
        top: 10px;
        left: 10px;
    }
    
    .controls-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin: 10px 0;
    }
    
    .control-item {
        padding: 6px 8px;
    }
    
    .control-key {
        font-size: 11px;
        padding: 3px 6px;
        min-width: 40px;
        margin-right: 6px;
    }
    
    .control-description {
        font-size: 11px;
    }
    
    .items-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
        margin: 10px 0;
    }
    
    .item-card {
        padding: 6px;
    }
    
    .item-icon {
        width: 18px;
        height: 18px;
        margin: 0 auto 3px auto;
    }
    
    .item-name {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    .item-effect {
        font-size: 8px;
        line-height: 1.1;
    }
    
    .objective-text {
        font-size: 11px;
        margin: 10px 0;
        padding: 6px;
        line-height: 1.2;
    }
    
    .mobile-controls-section {
        margin: 10px 0;
        padding: 8px;
    }
    
    .mobile-controls-section h3 {
        font-size: 12px;
        margin: 0 0 8px 0;
    }
}

/* Game Over Screen */
#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
    border: 3px solid #4CAF50;
    border-radius: 20px;
    padding: 40px;
    color: white;
    text-align: center;
    font-weight: 700;
    display: none;
    z-index: 300;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 50px rgba(76, 175, 80, 0.4);
    backdrop-filter: blur(10px);
    min-width: 400px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    /* Better responsive behavior */
    width: auto;
    box-sizing: border-box;
}
#gameOver h2 {
    color: #FF6B6B;
    font-size: 36px;
    margin: 0 0 25px 0;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.8);
    line-height: 1.2;
}
#gameOver p {
    margin: 15px 0;
    font-size: 18px;
    color: #E0E0E0;
    line-height: 1.4;
}
#gameOver span {
    color: #4CAF50;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}
#gameOver button {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    border: 2px solid #66BB6A;
    padding: 15px 35px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 25px;
    margin-left: 10px;
    margin-right: 10px;
    transition: all 0.3s ease;
    font-family: 'Orbitron', monospace;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(76, 175, 80, 0.3);
    /* Better touch target */
    min-height: 44px;
    min-width: 120px;
    touch-action: manipulation;
}

/* Play Again button - primary action with blue styling */
#gameOver button[onclick="playAgain()"] {
    background: linear-gradient(135deg, #2196F3 0%, #1565C0 100%);
    border: 2px solid #42A5F5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(33, 150, 243, 0.4);
    order: -1; /* Puts this button first in flex layout */
}

#gameOver button[onclick="playAgain()"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(33, 150, 243, 0.6);
}

/* Back to Menu button - secondary action with subdued styling */
#gameOver button[onclick="backToMenu()"] {
    background: linear-gradient(135deg, #757575 0%, #424242 100%);
    border: 2px solid #9E9E9E;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(117, 117, 117, 0.2);
}

#gameOver button[onclick="backToMenu()"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(117, 117, 117, 0.3);
}

#gameOver button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(76, 175, 80, 0.5);
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    #gameOver {
        padding: 35px;
        min-width: 360px;
        max-width: calc(100vw - 60px);
        max-height: calc(100vh - 60px);
    }
    
    #gameOver h2 {
        font-size: 32px;
        margin: 0 0 22px 0;
    }
    
    #gameOver p {
        font-size: 17px;
        margin: 14px 0;
    }
    
    #gameOver button {
        padding: 14px 32px;
        font-size: 17px;
        margin-top: 22px;
    }
}

/* Mobile Game Over adjustments */
@media (max-width: 768px) {
    #gameOver {
        padding: 20px;
        min-width: 280px;
        margin: 15px;
        border-radius: 15px;
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 30px);
        border-width: 2px;
    }
    
    #gameOver h2 {
        font-size: 24px;
        margin: 0 0 18px 0;
    }
    
    #gameOver p {
        font-size: 16px;
        margin: 12px 0;
    }
    
    #gameOver button {
        padding: 14px 28px;
        font-size: 16px;
        margin-top: 20px;
        width: 100%;
        max-width: 280px;
        min-height: 48px;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    #gameOver {
        padding: 16px;
        min-width: 260px;
        margin: 12px;
        border-radius: 12px;
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }
    
    #gameOver h2 {
        font-size: 20px;
        margin: 0 0 15px 0;
    }
    
    #gameOver p {
        font-size: 14px;
        margin: 10px 0;
    }
    
    #gameOver button {
        padding: 12px 24px;
        font-size: 15px;
        margin-top: 18px;
        width: 100%;
        max-width: none;
        min-height: 50px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    #gameOver {
        padding: 14px;
        min-width: 240px;
        margin: 10px;
        border-radius: 10px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
    
    #gameOver h2 {
        font-size: 18px;
        margin: 0 0 12px 0;
    }
    
    #gameOver p {
        font-size: 13px;
        margin: 8px 0;
    }
    
    #gameOver button {
        padding: 11px 20px;
        font-size: 14px;
        margin-top: 15px;
        min-height: 52px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #gameOver {
        padding: 12px 20px;
        max-height: calc(100vh - 20px);
        margin: 10px;
        overflow-y: auto;
    }
    
    #gameOver h2 {
        font-size: 20px;
        margin: 0 0 10px 0;
    }
    
    #gameOver p {
        font-size: 14px;
        margin: 6px 0;
        line-height: 1.3;
    }
    
    #gameOver button {
        padding: 10px 20px;
        font-size: 14px;
        margin-top: 12px;
        min-height: 44px;
    }
}

/* Very short landscape screens */
@media (max-height: 500px) and (orientation: landscape) {
    #gameOver {
        padding: 8px 16px;
        max-height: calc(100vh - 16px);
        margin: 8px;
        border-radius: 8px;
    }
    
    #gameOver h2 {
        font-size: 18px;
        margin: 0 0 8px 0;
    }
    
    #gameOver p {
        font-size: 13px;
        margin: 4px 0;
        line-height: 1.2;
    }
    
    #gameOver button {
        padding: 8px 16px;
        font-size: 13px;
        margin-top: 10px;
        min-height: 40px;
    }
}

/* Pause Menu */
#pauseMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
    border: 3px solid #FFB74D;
    border-radius: 20px;
    padding: 40px;
    color: white;
    text-align: center;
    font-weight: 700;
    display: none;
    z-index: 350;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 183, 77, 0.4);
    backdrop-filter: blur(10px);
    min-width: 400px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    /* Enable touch interactions */
    touch-action: auto;
    -webkit-user-select: auto;
    user-select: auto;
}
#pauseMenu h2 {
    color: #FFB74D;
    font-size: 36px;
    margin: 0 0 25px 0;
    text-shadow: 0 0 15px rgba(255, 183, 77, 0.8);
}
#pauseMenu p {
    margin: 15px 0;
    font-size: 18px;
    color: #E0E0E0;
}
#pauseMenu .pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}
#pauseMenu button {
    background: linear-gradient(135deg, #FFB74D 0%, #FF8F00 100%);
    color: white;
    border: 2px solid #FFCC80;
    padding: 15px 35px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', monospace;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 183, 77, 0.3);
    /* Enable touch interactions */
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}
#pauseMenu button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 183, 77, 0.5);
}
#pauseMenu button.resume-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border-color: #66BB6A;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(76, 175, 80, 0.3);
}
#pauseMenu button.resume-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(76, 175, 80, 0.5);
}
#pauseMenu button.restart-btn {
    background: linear-gradient(135deg, #FF7043 0%, #D84315 100%);
    border-color: #FF8A65;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 112, 67, 0.3);
}
#pauseMenu button.restart-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 112, 67, 0.5);
}

/* Mobile Pause Menu adjustments */
@media (max-width: 768px) {
    #pauseMenu {
        padding: 20px;
        min-width: 280px;
        margin: 20px;
        border-radius: 15px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
    
    #pauseMenu h2 {
        font-size: 24px;
        margin: 0 0 20px 0;
    }
    
    #pauseMenu p {
        font-size: 16px;
        margin: 12px 0;
    }
    
    #pauseMenu button {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    #pauseMenu .pause-buttons {
        gap: 12px;
        margin-top: 20px;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    #pauseMenu {
        padding: 15px;
        min-width: 250px;
        margin: 15px;
        border-radius: 12px;
    }
    
    #pauseMenu h2 {
        font-size: 20px;
        margin: 0 0 15px 0;
    }
    
    #pauseMenu p {
        font-size: 14px;
        margin: 10px 0;
    }
    
    #pauseMenu button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    #pauseMenu .pause-buttons {
        gap: 10px;
        margin-top: 15px;
    }
}

/* Mobile Game Over adjustments */
@media (max-width: 768px) {
    #gameOver {
        padding: 20px;
        min-width: 280px;
        margin: 20px;
        border-radius: 15px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
}

#gameOver h2 {
        font-size: 24px;
        margin: 0 0 20px 0;
    }
    
    #gameOver p {
        font-size: 16px;
        margin: 12px 0;
    }
    
    #gameOver button {
        padding: 12px 24px;
        font-size: 16px;
        margin-top: 20px;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    #gameOver {
        padding: 15px;
        min-width: 250px;
        margin: 15px;
        border-radius: 12px;
    }
    
    #gameOver h2 {
        font-size: 20px;
        margin: 0 0 15px 0;
    }
    
    #gameOver p {
        font-size: 14px;
        margin: 10px 0;
    }
    
    #gameOver button {
        padding: 10px 20px;
        font-size: 14px;
        margin-top: 15px;
        width: 100%;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #gameOver {
        padding: 15px;
        max-height: calc(100vh - 30px);
        margin: 15px;
    }
    
    #gameOver h2 {
        font-size: 20px;
        margin: 0 0 12px 0;
    }
    
    #gameOver p {
        font-size: 14px;
        margin: 8px 0;
    }
    
    #gameOver button {
        padding: 8px 16px;
        font-size: 14px;
        margin-top: 12px;
    }
    
    #pauseMenu {
        padding: 15px;
        max-height: calc(100vh - 30px);
        margin: 15px;
    }
    
    #pauseMenu h2 {
        font-size: 20px;
        margin: 0 0 12px 0;
    }
    
    #pauseMenu p {
        font-size: 14px;
        margin: 8px 0;
    }
    
    #pauseMenu button {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    #pauseMenu .pause-buttons {
        gap: 8px;
        margin-top: 12px;
    }
}

/* Sound Menu */
#soundMenu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    z-index: 400;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
#soundMenu.open {
    display: flex;
}
.sound-panel {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
    border: 3px solid #4CAF50;
    border-radius: 20px;
    padding: 35px;
    min-width: 400px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    color: white;
    font-family: 'Orbitron', monospace;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 60px rgba(76, 175, 80, 0.4);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}
.sound-panel h2 {
    margin: 0 0 25px 0;
    text-align: center;
    color: #4CAF50;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
}
.volume-control {
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(76, 175, 80, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}
.volume-control label {
    font-size: 16px;
    min-width: 120px;
    font-weight: 600;
    color: #E0E0E0;
}
.volume-slider {
    flex: 1;
    margin: 0 20px;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    background: linear-gradient(to right, #2E7D32, #4CAF50);
    border-radius: 5px;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 10px rgba(76, 175, 80, 0.6);
    border: 2px solid #81C784;
}
.volume-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #81C784;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.volume-value {
    font-size: 14px;
    min-width: 45px;
    text-align: center;
    color: #4CAF50;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
.sound-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}
.sound-btn {
    padding: 12px 25px;
    border: 2px solid #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    color: #4CAF50;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Orbitron', monospace;
    transition: all 0.3s ease;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.sound-btn:hover {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 15px rgba(76, 175, 80, 0.4);
}
.sound-btn.mute {
    border-color: #f44336;
    color: #f44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    text-shadow: 0 0 8px rgba(244, 67, 54, 0.6);
}
.sound-btn.mute:hover {
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 15px rgba(244, 67, 54, 0.4);
}

/* Mobile Sound Menu adjustments */
@media (max-width: 768px) {
    .sound-panel {
        padding: 25px;
        min-width: 280px;
        margin: 20px;
        border-radius: 15px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 40px);
    }
    
    .sound-panel h2 {
        font-size: 22px;
        margin: 0 0 20px 0;
    }
    
    .volume-control {
        margin: 15px 0;
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .volume-control label {
        font-size: 14px;
        min-width: auto;
        text-align: center;
        margin-bottom: 5px;
    }
    
    .volume-slider {
        margin: 0;
        height: 12px;
    }
    
    .volume-slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .volume-slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
    
    .volume-value {
        text-align: center;
        margin-top: 5px;
        font-size: 16px;
    }
    
    .sound-buttons {
        flex-direction: column;
        gap: 12px;
        margin-top: 25px;
    }
    
    .sound-btn {
        padding: 15px 20px;
        font-size: 16px;
        width: 100%;
        text-align: center;
    }
    
    .sound-btn:hover {
        transform: translateY(-1px);
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    .sound-panel {
        padding: 20px;
        min-width: 250px;
        margin: 15px;
        border-radius: 12px;
    }
    
    .sound-panel h2 {
        font-size: 18px;
        margin: 0 0 15px 0;
    }
    
    .volume-control {
        margin: 12px 0;
        padding: 10px;
        gap: 8px;
    }
    
    .volume-control label {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .volume-slider {
        height: 10px;
    }
    
    .volume-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .volume-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .volume-value {
        font-size: 14px;
        margin-top: 3px;
    }
    
    .sound-buttons {
        gap: 10px;
        margin-top: 20px;
    }
    
    .sound-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .sound-panel {
        padding: 20px;
        margin: 15px;
        max-height: calc(100vh - 30px);
        border-radius: 12px;
    }
    
    .sound-panel h2 {
        font-size: 18px;
        margin: 0 0 12px 0;
    }
    
    .volume-control {
        margin: 10px 0;
        padding: 8px;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .volume-control label {
        font-size: 11px;
        min-width: 80px;
        text-align: left;
        margin-bottom: 0;
    }
    
    .volume-slider {
        height: 8px;
        margin: 0 10px;
    }
    
    .volume-slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    .volume-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
    
    .volume-value {
        font-size: 11px;
        min-width: 35px;
        margin-top: 0;
    }
    
    .sound-buttons {
        flex-direction: row;
        gap: 8px;
        margin-top: 15px;
        flex-wrap: wrap;
    }
    
    .sound-btn {
        padding: 8px 12px;
        font-size: 11px;
        flex: 1;
        min-width: 0;
    }
}

/* Enhanced Pause Button */
#pauseButton {
    position: absolute;
    top: 20px;
    right: 200px; /* Position to the left of the multiplier UI */
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95) 0%, rgba(46, 125, 50, 0.9) 100%);
    border: 3px solid rgba(76, 175, 80, 0.8);
    border-radius: 50%;
    cursor: pointer;
    z-index: 250;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: none; /* Hide by default to prevent flash */
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 6px 20px rgba(76, 175, 80, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
    backdrop-filter: blur(10px);
    /* Enable proper touch handling on mobile */
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#pauseButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    border-radius: 50%;
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

#pauseButton::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pauseButtonPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pauseButtonPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

/* CSS-based pause icon */
#pauseButton .pause-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#pauseButton .pause-icon::before,
#pauseButton .pause-icon::after {
    content: '';
    width: 4px;
    height: 16px;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

#pauseButton .pause-icon::before {
    margin-right: 3px;
}

#pauseButton .pause-icon::after {
    margin-left: 3px;
}

#pauseButton img {
    display: none; /* Hide the original image */
}

#pauseButton:hover {
    transform: scale(1.15) translateY(-2px);
    background: linear-gradient(135deg, rgba(102, 187, 106, 1) 0%, rgba(76, 175, 80, 0.95) 100%);
    border-color: rgba(102, 187, 106, 1);
    box-shadow: 
        0 10px 30px rgba(76, 175, 80, 0.6),
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#pauseButton:hover::before {
    transform: translateX(100%);
}

#pauseButton:hover .pause-icon::before,
#pauseButton:hover .pause-icon::after {
    background: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

#pauseButton:active {
    transform: scale(1.05) translateY(0px);
    transition: all 0.1s ease;
}



/* Stage Title Display */
#stageTitle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #FFD700;
    border-radius: 10px;
    padding: 20px 40px;
    color: white;
    text-align: center;
    font-family: 'Orbitron', monospace;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: none;
}

/* Boss Stage Styling - Full screen with background */
#stageTitle.boss-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    transform: none;
    background-size: contain;  /* Changed from 'cover' to 'contain' to show full image */
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000000; /* Black background for areas not covered by image */
    border: none;
    border-radius: 0;
    padding: 0;
    z-index: 10000; /* Highest z-index */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: none;
    box-shadow: none;
}

/* Boss-specific background overlays for better text readability */
#stageTitle.boss-stage::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* Reduced from 0.4 to 0.3 for better image visibility */
    z-index: -1;
}

/* Enhanced fallback for ultra-wide screens where contain might be too small */
@media (min-aspect-ratio: 21/9) {
    #stageTitle.boss-stage {
        background-size: cover; /* Use cover for ultra-wide screens */
    }
}

/* Enhanced fallback for very tall screens where contain might be too small */
@media (max-aspect-ratio: 9/16) {
    #stageTitle.boss-stage {
        background-size: cover; /* Use cover for very tall screens */
    }
}

/* Responsive background sizing for different screen ratios */
@media (min-width: 1200px) and (min-height: 800px) {
    #stageTitle.boss-stage {
        /* For large screens, we can try a hybrid approach */
        background-size: contain;
        background-color: #111111; /* Slightly lighter black for large screens */
    }
}

/* Mobile and tablet specific background handling */
@media (max-width: 768px) {
    #stageTitle.boss-stage {
        background-size: contain; /* Changed from 'cover' to 'contain' to show full image on mobile */
        background-position: center center !important; /* Force center positioning */
        background-repeat: no-repeat !important;
        background-color: #000000 !important; /* Ensure black background for letterboxing */
        /* Enhanced centering for mobile */
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 20px;
        box-sizing: border-box;
        /* Ensure full viewport coverage */
        position: fixed !important;
        top: 0 !important;
        left: 14px !important;
        width: 110vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile */
        margin: 0 !important;
        transform: none !important;
        overflow: hidden !important;
    }
    
    #stageTitle.boss-stage::before {
        background: rgba(0, 0, 0, 0.3); /* Reduced overlay opacity to show more of the image */
    }
    
    /* Ensure all child elements are centered */
    #stageTitle.boss-stage * {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Landscape mobile specific handling */
@media (max-width: 768px) and (orientation: landscape) {
    #stageTitle.boss-stage {
        background-size: contain; /* Changed from 'cover' to 'contain' for full image visibility */
        background-position: center center !important; /* Force center positioning */
        background-repeat: no-repeat !important;
        background-color: #000000 !important; /* Ensure black background for letterboxing */
        background-attachment: fixed; /* Ensure background stays centered */
        /* Enhanced centering for landscape mobile */
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px;
        box-sizing: border-box;
        /* Ensure full viewport coverage */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile */
        margin: 0 !important;
        transform: none !important;
        overflow: hidden !important;
    }
    
    #stageTitle.boss-stage::before {
        background: rgba(0, 0, 0, 0.3); /* Consistent overlay opacity */
    }
    
    /* Ensure all child elements are centered in landscape */
    #stageTitle.boss-stage * {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Wavin Good Boss Styling */
#stageTitle.wavin-good-boss #stageTitleNumber {
    font-family: 'Orbitron', monospace;
    font-size: 16px; /* Reduced from 72px to make it very small */
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6); /* Reduced opacity to de-emphasize */
    text-shadow: 
        0 0 5px rgba(75, 0, 128, 0.4),
        1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px; /* Reduced margin */
    letter-spacing: 1px; /* Reduced letter spacing */
    text-transform: uppercase;
    order: -1; /* Place above boss name */
}

#stageTitle.wavin-good-boss #stageTitleName {
    font-family: 'Orbitron', monospace;
    font-size: 84px; /* Increased from 36px to make boss name the hero */
    font-weight: 900; /* Increased weight */
    color: #DDA0DD;
    text-shadow: 
        0 0 30px rgba(221, 160, 221, 1),
        0 0 60px rgba(221, 160, 221, 0.8),
        6px 6px 12px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px; /* Increased margin */
    letter-spacing: 4px; /* Increased letter spacing */
    text-transform: uppercase;
    animation: wavinGoodPulse 2s infinite;
}

#stageTitle.wavin-good-boss #stageTitleDescription {
    font-family: 'Orbitron', monospace;
    font-size: 22px; /* Slightly increased for better readability */
    font-weight: 600;
    color: #E6E6FA;
    text-shadow: 0 0 15px rgba(230, 230, 250, 0.8);
    max-width: 600px;
    letter-spacing: 1px;
}

/* Rugpuller Boss Styling */
#stageTitle.rugpuller-boss #stageTitleNumber {
    font-family: 'Courier New', monospace;
    font-size: 16px; /* Reduced from 72px */
    font-weight: 600;
    color: rgba(255, 0, 128, 0.6); /* Reduced opacity */
    text-shadow: 
        0 0 5px rgba(255, 0, 128, 0.4),
        1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    order: -1;
}

#stageTitle.rugpuller-boss #stageTitleName {
    font-family: 'Courier New', monospace;
    font-size: 84px; /* Increased from 36px */
    font-weight: 900;
    color: #FF69B4;
    text-shadow: 
        0 0 30px rgba(255, 105, 180, 1),
        0 0 60px rgba(255, 105, 180, 0.8),
        6px 6px 12px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: rugpullerGlitch 2s infinite;
}

#stageTitle.rugpuller-boss #stageTitleDescription {
    font-family: 'Courier New', monospace;
    font-size: 22px;
    font-weight: 600;
    color: #FFB6C1;
    text-shadow: 0 0 15px rgba(255, 182, 193, 0.8);
    max-width: 600px;
    letter-spacing: 1px;
}

/* Solana Boss Styling */
#stageTitle.solana-boss #stageTitleNumber {
    font-family: 'Orbitron', monospace;
    font-size: 16px; /* Reduced from 72px */
    font-weight: 600;
    color: rgba(153, 69, 255, 0.6); /* Reduced opacity */
    text-shadow: 
        0 0 5px rgba(153, 69, 255, 0.4),
        1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    order: -1;
}

#stageTitle.solana-boss #stageTitleName {
    font-family: 'Orbitron', monospace;
    font-size: 84px; /* Increased from 36px */
    font-weight: 900;
    color: #14F195;
    text-shadow: 
        0 0 30px rgba(20, 241, 149, 1),
        0 0 60px rgba(153, 69, 255, 0.8),
        6px 6px 12px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: solanaSpeed 1.5s infinite;
}

#stageTitle.solana-boss #stageTitleDescription {
    font-family: 'Orbitron', monospace;
    font-size: 22px; /* Increased for consistency */
    font-weight: 600;
    color: #B794F6;
    text-shadow: 0 0 15px rgba(183, 148, 246, 0.8);
    max-width: 600px;
    letter-spacing: 1px;
}

/* CZ Boss Styling */
#stageTitle.cz-boss #stageTitleNumber {
    font-family: 'Orbitron', monospace;
    font-size: 16px; /* Reduced from 72px */
    font-weight: 600;
    color: rgba(240, 185, 11, 0.6); /* Reduced opacity */
    text-shadow: 
        0 0 5px rgba(240, 185, 11, 0.4),
        1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    order: -1;
}

#stageTitle.cz-boss #stageTitleName {
    font-family: 'Orbitron', monospace;
    font-size: 84px; /* Increased from 36px */
    font-weight: 900;
    color: #FCD535;
    text-shadow: 
        0 0 30px rgba(252, 213, 53, 1),
        0 0 60px rgba(240, 185, 11, 0.8),
        6px 6px 12px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: czGlow 2s infinite;
}

#stageTitle.cz-boss #stageTitleDescription {
    font-family: 'Orbitron', monospace;
    font-size: 22px; /* Increased for consistency */
    font-weight: 600;
    color: #FFF3CD;
    text-shadow: 0 0 15px rgba(255, 243, 205, 0.8);
    max-width: 600px;
    letter-spacing: 1px;
}

/* Cosmos Boss Styling */
#stageTitle.cosmos-boss #stageTitleNumber {
    font-family: 'Orbitron', monospace;
    font-size: 16px; /* Reduced from 72px */
    font-weight: 600;
    color: rgba(153, 102, 204, 0.6); /* Reduced opacity */
    text-shadow: 
        0 0 5px rgba(153, 102, 204, 0.4),
        1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    order: -1;
}

#stageTitle.cosmos-boss #stageTitleName {
    font-family: 'Orbitron', monospace;
    font-size: 84px; /* Increased from 36px */
    font-weight: 900;
    color: #DDA0DD;
    text-shadow: 
        0 0 30px rgba(221, 160, 221, 1),
        0 0 60px rgba(153, 102, 204, 0.8),
        6px 6px 12px rgba(0, 0, 0, 0.9);
    margin-bottom: 20px;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: cosmicFloat 3s infinite;
}

#stageTitle.cosmos-boss #stageTitleDescription {
    font-family: 'Orbitron', monospace;
    font-size: 22px; /* Increased for consistency */
    font-weight: 600;
    color: #E6E6FA;
    text-shadow: 0 0 15px rgba(230, 230, 250, 0.8);
    max-width: 600px;
    letter-spacing: 1px;
}

/* Boss Stage Animations */
@keyframes wavinGoodPulse {
    0%, 100% { 
        transform: scale(1);
        text-shadow: 
            0 0 30px rgba(221, 160, 221, 1),
            0 0 60px rgba(221, 160, 221, 0.8),
            6px 6px 12px rgba(0, 0, 0, 0.9);
    }
    50% { 
        transform: scale(1.02);
        text-shadow: 
            0 0 40px rgba(221, 160, 221, 1),
            0 0 80px rgba(221, 160, 221, 0.9),
            6px 6px 12px rgba(0, 0, 0, 0.9);
    }
}

@keyframes rugpullerGlitch {
    0%, 100% { 
        transform: translateX(0);
        color: #FF69B4;
    }
    10% { 
        transform: translateX(-3px);
        color: #FF1493;
    }
    20% { 
        transform: translateX(3px);
        color: #FF0080;
    }
    30% { 
        transform: translateX(-2px);
        color: #FF69B4;
    }
}

@keyframes solanaSpeed {
    0% { 
        transform: scale(1);
        color: #14F195;
    }
    50% { 
        transform: scale(1.05);
        color: #9945FF;
    }
    100% { 
        transform: scale(1);
        color: #14F195;
    }
}

@keyframes czGlow {
    0%, 100% { 
        text-shadow: 
            0 0 30px rgba(252, 213, 53, 1),
            0 0 60px rgba(240, 185, 11, 0.8),
            6px 6px 12px rgba(0, 0, 0, 0.9);
    }
    50% { 
        text-shadow: 
            0 0 50px rgba(252, 213, 53, 1),
            0 0 100px rgba(240, 185, 11, 1),
            6px 6px 12px rgba(0, 0, 0, 0.9);
    }
}

@keyframes cosmicFloat {
    0%, 100% { 
        transform: translateY(0);
        opacity: 1;
    }
    33% { 
        transform: translateY(-8px);
        opacity: 0.9;
    }
    66% { 
        transform: translateY(8px);
        opacity: 0.95;
    }
}

#stageTitle.show {
    opacity: 1 !important;
    display: block !important;
}
#stageTitle.hide {
    opacity: 0 !important;
}

#stageTitleNumber {
    font-size: 36px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    margin-bottom: 8px;
    letter-spacing: 2px;
}

#stageTitleName {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

#stageTitleDescription {
    font-size: 14px;
    font-weight: 400;
    color: #CCCCCC;
    text-shadow: 0 0 6px rgba(204, 204, 204, 0.3);
    line-height: 1.3;
    max-width: 350px;
    margin: 0 auto;
}

/* Mobile stage title adjustments */
@media (max-width: 768px) {
    #stageTitle {
        padding: 15px 25px;
        margin: 0 15px;
        max-width: calc(100% - 30px);
    }
    #stageTitleNumber {
        font-size: 28px;
        margin-bottom: 6px;
    }
    #stageTitleName {
        font-size: 16px;
        margin-bottom: 4px;
    }
    #stageTitleDescription {
        font-size: 12px;
        max-width: 250px;
    }
    
    /* Boss Stage Mobile Adjustments */
    #stageTitle.boss-stage {
        padding: 20px;
        justify-content: center;
        align-items: center;
    }
    
    /* Boss stage numbers - very small on mobile */
    #stageTitle.wavin-good-boss #stageTitleNumber,
    #stageTitle.rugpuller-boss #stageTitleNumber,
    #stageTitle.solana-boss #stageTitleNumber,
    #stageTitle.cz-boss #stageTitleNumber,
    #stageTitle.cosmos-boss #stageTitleNumber {
        font-size: 12px; /* Very small stage number */
        margin-bottom: 8px;
        letter-spacing: 0.5px;
        opacity: 0.7; /* Further de-emphasize */
    }
    
    /* Boss names - large and prominent on mobile */
    #stageTitle.wavin-good-boss #stageTitleName,
    #stageTitle.rugpuller-boss #stageTitleName,
    #stageTitle.solana-boss #stageTitleName,
    #stageTitle.cz-boss #stageTitleName,
    #stageTitle.cosmos-boss #stageTitleName {
        font-size: 48px; /* Large hero text on mobile */
        margin-bottom: 16px;
        letter-spacing: 2px;
        line-height: 1.1; /* Tight line height for large text */
    }
    
    /* Boss descriptions - readable size on mobile */
    #stageTitle.wavin-good-boss #stageTitleDescription,
    #stageTitle.rugpuller-boss #stageTitleDescription,
    #stageTitle.solana-boss #stageTitleDescription,
    #stageTitle.cz-boss #stageTitleDescription,
    #stageTitle.cosmos-boss #stageTitleDescription {
        font-size: 16px; /* Increased for better readability */
        max-width: 90%;
        margin: 0 auto;
        line-height: 1.4;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #stageTitle {
        padding: 10px 20px;
    }
    #stageTitleNumber {
        font-size: 24px;
        margin-bottom: 4px;
    }
    #stageTitleName {
        font-size: 14px;
        margin-bottom: 3px;
    }
    #stageTitleDescription {
        font-size: 11px;
        max-width: 200px;
    }
    
    /* Boss Stage Landscape Mobile Adjustments */
    #stageTitle.boss-stage {
        padding: 15px;
    }
    
    /* Boss stage numbers - tiny in landscape */
    #stageTitle.wavin-good-boss #stageTitleNumber,
    #stageTitle.rugpuller-boss #stageTitleNumber,
    #stageTitle.solana-boss #stageTitleNumber,
    #stageTitle.cz-boss #stageTitleNumber,
    #stageTitle.cosmos-boss #stageTitleNumber {
        font-size: 10px; /* Very tiny in landscape */
        margin-bottom: 6px;
        letter-spacing: 0.5px;
        opacity: 0.6;
    }
    
    /* Boss names - medium size in landscape to fit */
    #stageTitle.wavin-good-boss #stageTitleName,
    #stageTitle.rugpuller-boss #stageTitleName,
    #stageTitle.solana-boss #stageTitleName,
    #stageTitle.cz-boss #stageTitleName,
    #stageTitle.cosmos-boss #stageTitleName {
        font-size: 32px; /* Smaller in landscape but still prominent */
        margin-bottom: 10px;
        line-height: 1;
    }
    
    /* Boss descriptions - compact in landscape */
    #stageTitle.wavin-good-boss #stageTitleDescription,
    #stageTitle.rugpuller-boss #stageTitleDescription,
    #stageTitle.solana-boss #stageTitleDescription,
    #stageTitle.cz-boss #stageTitleDescription,
    #stageTitle.cosmos-boss #stageTitleDescription {
        font-size: 13px; /* Slightly larger than before */
        max-width: 80%;
        line-height: 1.3;
    }
}

/* Menu Overlay Container */
#menuOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none; /* Allow clicks to pass through when no menu is shown */
    /* Enable touch interactions for all children */
    touch-action: auto;
    -webkit-user-select: auto;
    user-select: auto;
}

/* When menus are active, enable pointer events */
#menuOverlay.active {
    pointer-events: auto;
}

/* HP Bar Section */
#hpBar {
    position: absolute;
    top: 170px; /* Position below multiplier UI */
    left: 82px; /* Align with right side like multiplier UI */
    background: linear-gradient(135deg, rgba(15, 15, 25, 0.95) 0%, rgba(25, 25, 40, 0.95) 100%);
    border: 3px solid #ff6b6b;
    padding: 18px;
    width: 200px; /* Fixed width for desktop */
    max-width: 200px; /* Ensure max width constraint */
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.8), 2px 2px 6px rgba(0, 0, 0, 0.9);
    z-index: 100;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 107, 107, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: none; /* Hide by default to prevent flash */
    backdrop-filter: blur(8px);
    text-align: center;
}

#hpBarLabel {
    margin-bottom: 12px;
    text-align: center;
    font-size: 14px;
    color: #ff6b6b;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

#hpBarHearts {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to flex-start for better row alignment */
    gap: 8px;
    width: 100%;
    flex-wrap: wrap; /* Allow hearts to wrap to multiple lines */
    max-width: 100%; /* Ensure container doesn't exceed parent */
    line-height: 1; /* Prevent extra spacing between rows */
}

.hp-heart {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.6));
    flex-shrink: 0; /* Prevent hearts from shrinking */
    margin-bottom: 4px; /* Add small gap between rows */
}

/* Initially hide hearts 4-10 until player gets more HP */
#heart4, #heart5, #heart6, #heart7, #heart8, #heart9, #heart10 {
    display: none;
}

.hp-heart.active {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px rgba(255, 107, 107, 0.9)) 
            brightness(1.2) 
            saturate(1.3);
}

.hp-heart.lost {
    opacity: 0.3;
    transform: scale(0.8);
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5)) 
            grayscale(1) 
            brightness(0.5);
}

.hp-heart.critical {
    animation: heartBeat 0.6s ease-in-out infinite alternate;
}

@keyframes heartBeat {
    0% { 
        transform: scale(1.0);
        filter: drop-shadow(0 0 8px rgba(255, 107, 107, 0.6));
    }
    100% { 
        transform: scale(1.2);
        filter: drop-shadow(0 0 16px rgba(255, 0, 0, 1.0)) 
                brightness(1.3) 
                saturate(1.5);
    }
}

/* Mobile HP Bar adjustments */
@media (max-width: 768px) {
    #hpBar {
        top: 80px; /* Below multiplier UI on mobile */
        right: 10px; /* Align with mobile right margin */
        left: auto; /* Override any left positioning */
        padding: 12px;
        width: 140px; /* Fixed width for mobile */
        max-width: 140px; /* Ensure max width constraint on mobile */
        border-radius: 15px;
        border-width: 2px;
        font-size: 14px;
    }
    
    #hpBarLabel {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .hp-heart {
        width: 24px;
        height: 24px;
        margin-bottom: 3px; /* Slightly smaller gap on mobile */
    }
    
    #hpBarHearts {
        gap: 6px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #hpBar {
        top: 70px; /* Adjust for landscape */
        right: 10px;
        left: auto;
        padding: 10px;
        width: 120px; /* Fixed width for landscape mobile */
        max-width: 120px; /* Ensure max width constraint on landscape mobile */
        border-radius: 12px;
        font-size: 12px;
    }
    
    #hpBarLabel {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .hp-heart {
        width: 20px;
        height: 20px;
        margin-bottom: 2px; /* Smaller gap on landscape */
    }
    
    #hpBarHearts {
        gap: 4px;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    #hpBar {
        top: 85px;
        right: 15px;
        padding: 15px;
        width: 160px; /* Fixed width for tablet */
        max-width: 160px; /* Ensure max width constraint on tablet */
        font-size: 15px;
    }
    
    .hp-heart {
        width: 28px;
        height: 28px;
        margin-bottom: 3px; /* Add gap for tablet too */
    }
}

/* Store Progress Bar */
#storeProgressContainer {
    position: absolute;
    top: 0;
    /* left will be set dynamically by JavaScript on desktop */
    height: 100vh;
    height: 100dvh;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-shadow: none;
    z-index: 100;
    box-shadow: none;
    backdrop-filter: none;
    display: none; /* Hide by default to prevent flash */
    width: 16px; /* Wider */
    text-align: center;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#storeProgressBar {
    width: 16px; /* Wider vertical bar */
    height: 100vh; /* Full screen height */
    height: 100dvh;
    background: rgba(13, 45, 74, 0.8); /* Deep sea blue background to match world */
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 0; /* No border radius - tight af */
    overflow: hidden;
    position: relative;
    box-shadow: none;
    margin: 0;
}

/* Default golden progress fill */
#storeProgressFill {
    width: 100%;
    height: 0%;
    background: linear-gradient(0deg, 
        #FFD700 0%, 
        #FFA000 50%, 
        #FFD700 100%);
    transition: height 0.15s ease-out;
    position: absolute;
    bottom: 0;
    left: 0;
    border-radius: 0; /* No border radius - tight af */
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.4);
}

/* VIOLENT red fill when Momentum item is active */
#storeProgressContainer.momentum-active #storeProgressFill {
    background: linear-gradient(0deg, 
        #FF0000 0%, 
        #FF3333 25%,
        #FF6666 50%, 
        #FF3333 75%,
        #FF0000 100%);
    box-shadow: 
        0 0 calc(4px + 8px * var(--glow-intensity, 0)) rgba(255, 0, 0, calc(0.4 + 0.4 * var(--glow-intensity, 0))),
        inset 0 0 calc(2px + 6px * var(--glow-intensity, 0)) rgba(255, 100, 100, calc(0.3 + 0.3 * var(--glow-intensity, 0)));
    filter: brightness(calc(1 + 0.3 * var(--glow-intensity, 0)));
}

/* Remove the shine animation */
#storeProgressFill::after {
    display: none;
}

/* Default store progress bar golden glow effect */
#storeProgressBar {
    border-color: rgba(255, 215, 0, calc(0.4 + 0.4 * var(--glow-intensity, 0)));
    box-shadow: 0 0 calc(2px + 12px * var(--glow-intensity, 0)) rgba(255, 215, 0, calc(0.3 + 0.5 * var(--glow-intensity, 0)));
    transition: all 0.15s ease-out;
}

/* VIOLENT red glow effect when Momentum item is active */
#storeProgressContainer.momentum-active #storeProgressBar {
    border-color: rgba(255, 0, 0, calc(0.6 + 0.4 * var(--glow-intensity, 0)));
    box-shadow: 
        0 0 calc(4px + 30px * var(--glow-intensity, 0)) rgba(255, 0, 0, calc(0.4 + 0.6 * var(--glow-intensity, 0))),
        0 0 calc(8px + 60px * var(--glow-intensity, 0)) rgba(255, 50, 50, calc(0.3 + 0.5 * var(--glow-intensity, 0))),
        0 0 calc(12px + 100px * var(--glow-intensity, 0)) rgba(255, 100, 100, calc(0.2 + 0.3 * var(--glow-intensity, 0)));
    transform: scale(calc(1 + 0.05 * var(--glow-intensity, 0)));
    transition: all 0.1s ease-out;
}

/* Default gentle pulsing effect when near completion */
#storeProgressContainer.near-completion #storeProgressBar {
    animation: progressPulse 1.5s ease-in-out infinite alternate;
}

@keyframes progressPulse {
    0% { 
        box-shadow: 0 0 calc(2px + 12px * var(--glow-intensity, 0)) rgba(255, 215, 0, calc(0.3 + 0.5 * var(--glow-intensity, 0)));
    }
    100% { 
        box-shadow: 0 0 calc(4px + 16px * var(--glow-intensity, 0)) rgba(255, 215, 0, calc(0.5 + 0.5 * var(--glow-intensity, 0)));
    }
}

/* VIOLENT effects when Momentum item is active */
#storeProgressContainer.momentum-active.near-completion #storeProgressBar {
    animation: violentProgressPulse 0.6s ease-in-out infinite alternate, violentShake 0.1s linear infinite !important;
}

/* Add violent shake animation for extreme power */
@keyframes violentShake {
    0% { transform: translateX(0) scale(calc(1 + 0.05 * var(--glow-intensity, 0))); }
    25% { transform: translateX(-2px) scale(calc(1 + 0.05 * var(--glow-intensity, 0))); }
    50% { transform: translateX(2px) scale(calc(1 + 0.05 * var(--glow-intensity, 0))); }
    75% { transform: translateX(-1px) scale(calc(1 + 0.05 * var(--glow-intensity, 0))); }
    100% { transform: translateX(1px) scale(calc(1 + 0.05 * var(--glow-intensity, 0))); }
}

/* Add continuous breathing effect for high progress when Momentum is active */
#storeProgressContainer.momentum-active {
    animation: powerBreathing calc(1s + 0.5s * (1 - var(--glow-intensity, 0))) ease-in-out infinite alternate;
}

@keyframes powerBreathing {
    0% { 
        filter: brightness(calc(1 + 0.1 * var(--glow-intensity, 0))); 
    }
    100% { 
        filter: brightness(calc(1 + 0.3 * var(--glow-intensity, 0))) saturate(calc(1 + 0.5 * var(--glow-intensity, 0))); 
    }
}

@keyframes violentProgressPulse {
    0% { 
        box-shadow: 
            0 0 calc(4px + 30px * var(--glow-intensity, 0)) rgba(255, 0, 0, calc(0.4 + 0.6 * var(--glow-intensity, 0))),
            0 0 calc(8px + 60px * var(--glow-intensity, 0)) rgba(255, 50, 50, calc(0.3 + 0.5 * var(--glow-intensity, 0))),
            0 0 calc(12px + 100px * var(--glow-intensity, 0)) rgba(255, 100, 100, calc(0.2 + 0.3 * var(--glow-intensity, 0)));
        transform: scale(calc(1 + 0.05 * var(--glow-intensity, 0)));
    }
    100% { 
        box-shadow: 
            0 0 calc(8px + 50px * var(--glow-intensity, 0)) rgba(255, 0, 0, calc(0.8 + 0.2 * var(--glow-intensity, 0))),
            0 0 calc(16px + 120px * var(--glow-intensity, 0)) rgba(255, 30, 30, calc(0.6 + 0.4 * var(--glow-intensity, 0))),
            0 0 calc(24px + 200px * var(--glow-intensity, 0)) rgba(255, 80, 80, calc(0.4 + 0.4 * var(--glow-intensity, 0)));
        transform: scale(calc(1 + 0.15 * var(--glow-intensity, 0)));
        filter: brightness(calc(1 + 0.5 * var(--glow-intensity, 0)));
    }
}

/* HP Progress Bar */
#hpProgressContainer {
    position: absolute;
    top: 0;
    /* right will be set dynamically by JavaScript on desktop */
    height: 100vh;
    height: 100dvh;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: white;
    font-size: 12px;
    font-weight: 700;
    text-shadow: none;
    z-index: 100;
    box-shadow: none;
    backdrop-filter: none;
    display: none; /* Hide by default to prevent flash */
    width: 16px; /* Slightly wider than store bar */
    text-align: center;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#hpProgressBar {
    width: 16px; /* Wider vertical bar */
    height: 100vh; /* Full screen height */
    height: 100dvh;
    background: rgba(13, 45, 74, 0.8); /* Deep sea blue background to match world */
    border: 1px solid rgba(74, 144, 226, 0.4); /* Sky blue border to match oceanic theme */
    border-radius: 0; /* No border radius - tight af */
    overflow: hidden;
    position: relative;
    box-shadow: none;
    margin: 0;
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom */
    gap: 2px; /* Gap between HP segments */
    padding: 2px;
}

.hp-segment {
    width: 100%;
    flex: 1; /* Equal size segments */
    background: linear-gradient(0deg, 
        #e74c3c 0%, 
        #c0392b 50%, 
        #e74c3c 100%); /* Red for healthy HP */
    transition: all 0.3s ease-out;
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.4);
    position: relative;
    min-height: 8px; /* Minimum height for each segment */
    border: 1px solid rgba(231, 76, 60, 0.3); /* Red border for segments */
    border-radius: 0; /* No border radius - tight af */
}

.hp-segment.empty {
    background: rgba(13, 45, 74, 0.8); /* Same deep sea blue as coin progress bar */
    box-shadow: 0 0 2px rgba(13, 45, 74, 0.4);
    border: 1px solid rgba(74, 144, 226, 0.3); /* Sky blue border to match HP bar border */
}

.hp-segment.critical {
    animation: hpCriticalPulse 0.8s ease-in-out infinite alternate;
}

@keyframes hpCriticalPulse {
    0% { 
        background: linear-gradient(0deg, #ff4444 0%, #cc2222 50%, #ff4444 100%); /* Brighter red for oceanic contrast */
        box-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
    }
    100% { 
        background: linear-gradient(0deg, #ff1111 0%, #aa0000 50%, #ff1111 100%); /* Intense red warning */
        box-shadow: 0 0 12px rgba(255, 17, 17, 0.9);
    }
}

/* HP progress bar pulsing effect when at critical health */
#hpProgressContainer.critical #hpProgressBar {
    border-color: #ff3333;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
}

/* Mobile Store Progress adjustments */
@media (max-width: 768px) {
    #storeProgressContainer {
        top: 0;
        left: 0; /* Max left positioning on mobile */
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        padding: 0;
        width: 10px; /* Wider on mobile */
    }
    
    #storeProgressBar {
        width: 10px;
        height: 100vh; /* Full screen height */
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0; /* No border radius - tight af */
    }
    
    #storeProgressFill {
        border-radius: 0; /* No border radius - tight af */
    }

    /* Mobile HP Progress adjustments */
    #hpProgressContainer {
        top: 0;
        right: 0; /* Max right positioning on mobile */
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        padding: 0;
        width: 12px; /* Slightly wider on mobile */
    }
    
    #hpProgressBar {
        width: 12px;
        height: 100vh; /* Full screen height */
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0; /* No border radius - tight af */
        gap: 1px; /* Smaller gap on mobile */
        padding: 1px;
    }
    
    .hp-segment {
        border-radius: 0; /* No border radius - tight af */
        min-height: 6px; /* Smaller minimum height on mobile */
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #storeProgressContainer {
        top: 0;
        left: 0; /* Max left positioning on landscape mobile */
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        padding: 0;
        width: 8px; /* Still wider than before for landscape */
    }
    
    #storeProgressBar {
        width: 8px;
        height: 100vh; /* Full screen height */
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0; /* No border radius - tight af */
    }
    
    #storeProgressFill {
        border-radius: 0; /* No border radius - tight af */
    }

    /* Landscape HP Progress adjustments */
    #hpProgressContainer {
        top: 0;
        right: 0; /* Max right positioning on landscape mobile */
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        padding: 0;
        width: 10px; /* Narrower for landscape */
    }
    
    #hpProgressBar {
        width: 10px;
        height: 100vh; /* Full screen height */
        height: calc(var(--vh, 1vh) * 100);
        border-radius: 0; /* No border radius - tight af */
        gap: 1px; /* Smaller gap on landscape */
        padding: 1px;
    }
    
    .hp-segment {
        border-radius: 0; /* No border radius - tight af */
        min-height: 5px; /* Even smaller minimum height on landscape */
    }
}

/* Enhanced text styling for boss stages to ensure readability over images */
#stageTitle.boss-stage #stageTitleNumber {
    position: relative;
    z-index: 2;
    /* Enhanced text shadow for better readability over images */
    text-shadow: 
        0 0 20px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(0, 0, 0, 0.7),
        2px 2px 8px rgba(0, 0, 0, 1),
        -2px -2px 8px rgba(0, 0, 0, 1),
        2px -2px 8px rgba(0, 0, 0, 1),
        -2px 2px 8px rgba(0, 0, 0, 1);
    /* Add a subtle background behind text for extreme cases */
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.1));
    padding: 10px 20px;
    border-radius: 10px;
    backdrop-filter: blur(2px);
}

#stageTitle.boss-stage #stageTitleName {
    position: relative;
    z-index: 2;
    text-shadow: 
        0 0 15px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(0, 0, 0, 0.7),
        2px 2px 6px rgba(0, 0, 0, 1),
        -2px -2px 6px rgba(0, 0, 0, 1);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.05));
    padding: 5px 15px;
    border-radius: 8px;
    backdrop-filter: blur(1px);
}

#stageTitle.boss-stage #stageTitleDescription {
    position: relative;
    z-index: 2;
    text-shadow: 
        0 0 10px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(0, 0, 0, 0.7),
        1px 1px 4px rgba(0, 0, 0, 1),
        -1px -1px 4px rgba(0, 0, 0, 1);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.05));
    padding: 8px 12px;
    border-radius: 6px;
    backdrop-filter: blur(1px);
}

/* Fallback styling for bosses with missing transition backgrounds */
#stageTitle.boss-stage:not([style*="background-image"]) {
    /* Apply boss-specific gradient backgrounds when image is missing */
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
}

#stageTitle.wavin-good-boss:not([style*="background-image"]) {
    background: linear-gradient(135deg, #4B0080 0%, #2D1B69 50%, #000000 100%);
}

#stageTitle.rugpuller-boss:not([style*="background-image"]) {
    background: linear-gradient(135deg, #FF0080 0%, #8B008B 50%, #000000 100%);
}

#stageTitle.cz-boss:not([style*="background-image"]) {
    background: linear-gradient(135deg, #F0B90B 0%, #B8860B 50%, #000000 100%);
}

#stageTitle.cosmos-boss:not([style*="background-image"]) {
    background: linear-gradient(135deg, #9966CC 0%, #2D1B69 50%, #000000 100%);
}

/* Image loading error handling */
#stageTitle.boss-stage {
    /* Ensure we have a good fallback when image fails to load */
    background-attachment: scroll; /* Better performance */
}

/* Special handling for very wide images on standard screens */
@media (aspect-ratio: 16/9) {
    #stageTitle.boss-stage {
        background-size: contain; /* Perfect for 16:9 images on 16:9 screens */
    }
}

@media (aspect-ratio: 4/3) {
    #stageTitle.boss-stage {
        background-size: contain; /* Good for 4:3 screens */
    }
}

/* ===== BEAUTIFUL MENU SYSTEM ===== */
/* Main menu overlay with full-screen immersive design */
.html-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 20% 20%, rgba(13, 45, 74, 0.9) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(30, 77, 114, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(74, 144, 226, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(13, 45, 74, 0.9) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Orbitron', monospace;
    overflow: hidden;
    transition: all 0.5s ease;
}

.html-menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animated background elements */
.menu-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 40%, rgba(74, 144, 226, 0.15) 0%, transparent 70%),
        radial-gradient(circle at 70% 60%, rgba(0, 255, 136, 0.1) 0%, transparent 70%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { 
        transform: scale(1) rotate(0deg);
        opacity: 0.3;
    }
    100% { 
        transform: scale(1.1) rotate(2deg);
        opacity: 0.6;
    }
}

/* Floating particles */
.particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(74, 144, 226, 0.6);
    border-radius: 50%;
    animation: floatParticle 15s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; }
.particle:nth-child(9) { left: 90%; animation-delay: -16s; }
.particle:nth-child(10) { left: 95%; animation-delay: -18s; }

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* Menu content styling */
.menu-content {
    text-align: center;
    z-index: 10;
    max-width: 600px;
    padding: 40px;
}

.logo-section {
    margin-bottom: 50px;
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 
        0 0 20px rgba(74, 144, 226, 0.8),
        0 0 40px rgba(74, 144, 226, 0.6),
        0 0 60px rgba(74, 144, 226, 0.4);
    margin: 0;
    letter-spacing: 3px;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(74, 144, 226, 0.8),
            0 0 40px rgba(74, 144, 226, 0.6),
            0 0 60px rgba(74, 144, 226, 0.4);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(74, 144, 226, 1),
            0 0 50px rgba(74, 144, 226, 0.8),
            0 0 70px rgba(74, 144, 226, 0.6);
    }
}

.game-subtitle {
    font-size: 1.2rem;
    color: #00FF88;
    margin: 10px 0 30px 0;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
}

.ether-crystal {
    font-size: 3rem;
    color: #4a90e2;
    text-shadow: 0 0 25px rgba(74, 144, 226, 0.9);
    animation: crystalSpin 6s linear infinite;
}

@keyframes crystalSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Menu buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 40px 0;
}

.menu-btn {
    background: 
        linear-gradient(145deg, rgba(13, 45, 74, 0.9), rgba(30, 77, 114, 0.8));
    border: 2px solid #4a90e2;
    border-radius: 15px;
    padding: 18px 40px;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 
        0 6px 18px rgba(74, 144, 226, 0.3),
        inset 0 0 20px rgba(13, 45, 74, 0.6);
}

.menu-btn:hover {
    transform: translateY(-3px);
    border-color: #66BB6A;
    box-shadow: 
        0 12px 30px rgba(74, 144, 226, 0.5),
        inset 0 0 30px rgba(102, 187, 106, 0.2);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.menu-btn:hover::before {
    left: 100%;
}

.btn-text {
    position: relative;
    z-index: 1;
}

/* Menu footer */
.menu-footer {
    margin-top: 40px;
}

.ether-status {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.status-item {
    font-size: 0.9rem;
    color: #00FF88;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
    animation: statusPulse 2s ease-in-out infinite alternate;
}

@keyframes statusPulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Floating ether elements */
.menu-ether-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-ether {
    position: absolute;
    font-size: 2rem;
    color: rgba(74, 144, 226, 0.4);
    text-shadow: 0 0 15px rgba(74, 144, 226, 0.6);
    animation: floatEther 8s ease-in-out infinite;
}

.ether-1 { top: 15%; left: 10%; animation-delay: 0s; }
.ether-2 { top: 25%; right: 15%; animation-delay: -2s; }
.ether-3 { bottom: 30%; left: 20%; animation-delay: -4s; }
.ether-4 { bottom: 20%; right: 10%; animation-delay: -6s; }

@keyframes floatEther {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.4;
    }
    50% { 
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .menu-content {
        padding: 20px;
        max-width: 90vw;
    }
    
    .game-title {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }
    
    .game-subtitle {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .menu-btn {
        padding: 15px 30px;
        font-size: 1rem;
    }
    
    .ether-status {
        flex-direction: column;
        gap: 15px;
    }
    
    .particle {
        transform: scale(0.6);
    }
}

/* New Settings Page Styles */
.settings-control {
    background: 
        linear-gradient(145deg, rgba(13, 45, 74, 0.9), rgba(30, 77, 114, 0.8));
    border: 2px solid #4a90e2;
    border-radius: 15px;
    padding: 25px 30px;
    box-shadow: 
        0 6px 18px rgba(74, 144, 226, 0.3),
        inset 0 0 20px rgba(13, 45, 74, 0.6);
}

.settings-label {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-slider-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.settings-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    background: linear-gradient(to right, #2E7D32, #4CAF50);
    border-radius: 6px;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 15px rgba(76, 175, 80, 0.6);
    border: 3px solid #81C784;
    transition: all 0.3s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(76, 175, 80, 0.8);
}

.settings-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #81C784;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.settings-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #00FF88;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
    min-width: 60px;
    text-align: center;
}

.settings-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.settings-buttons .menu-btn {
    flex: 1;
}

/* New Codex Page Styles */
.codex-content {
    margin-top: 40px;
}

.codex-text-box {
    background: 
        linear-gradient(145deg, rgba(13, 45, 74, 0.9), rgba(30, 77, 114, 0.8));
    border: 2px solid #4a90e2;
    border-radius: 15px;
    padding: 40px;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    text-align: center;
    box-shadow: 
        0 6px 18px rgba(74, 144, 226, 0.3),
        inset 0 0 20px rgba(13, 45, 74, 0.6);
    letter-spacing: 0.5px;
}

/* Mobile adjustments for new pages */
@media (max-width: 768px) {
    .settings-control {
        padding: 20px;
    }
    
    .settings-label {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .settings-slider-container {
        gap: 15px;
    }
    
    .settings-value {
        font-size: 1rem;
        min-width: 50px;
    }
    
    .settings-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .codex-text-box {
        padding: 25px;
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Pulse animation for start game transition */
@keyframes pulse {
    0% { 
        opacity: 0.7;
        transform: scale(1);
    }
    50% { 
        opacity: 1;
        transform: scale(1.05);
    }
    100% { 
        opacity: 0.7;
        transform: scale(1);
    }
}

/* Enhanced start button interactions */
.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 10px 25px rgba(0, 255, 136, 0.4),
        0 0 30px rgba(0, 255, 136, 0.6),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
}

.start-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Gentle floating animation for ASMR transition */
@keyframes gentleFloat {
    0% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    33% { 
        transform: translateY(-8px) rotate(5deg);
        opacity: 0.6;
    }
    66% { 
        transform: translateY(-4px) rotate(-3deg);
        opacity: 0.4;
    }
    100% { 
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
}

/* Enhanced floating with more sophisticated movement */
@keyframes enhancedFloat {
    0% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.4;
    }
    25% { 
        transform: translateY(-6px) translateX(3px) rotate(3deg) scale(1.1);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-12px) translateX(-2px) rotate(-2deg) scale(1.05);
        opacity: 0.9;
    }
    75% { 
        transform: translateY(-6px) translateX(-4px) rotate(4deg) scale(1.1);
        opacity: 0.6;
    }
    100% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.4;
    }
}

/* Ripple effect animation */
@keyframes rippleEffect {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Gentle breathing effect for buttons */
@keyframes gentleBreathe {
    0% { 
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0, 255, 136, 0.2);
    }
    50% { 
        transform: scale(1.01);
        box-shadow: 0 6px 18px rgba(0, 255, 136, 0.25);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0, 255, 136, 0.2);
    }
}

/* Soft, ASMR-friendly start button interactions */
.start-btn:hover {
    transform: scale(1.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 20px rgba(0, 255, 136, 0.25),
        0 0 25px rgba(0, 255, 136, 0.15),
         inset 0 0 15px rgba(0, 255, 136, 0.05);
    filter: brightness(1.05);
}

.start-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add gentle breathing to all menu buttons */
.menu-btn {
    animation: gentleBreathe 2.5s ease-in-out infinite;
}

.menu-btn:nth-child(2) {
    animation-delay: 0.3s;
}

.menu-btn:nth-child(3) {
    animation-delay: 0.6s;
}

.menu-btn:nth-child(4) {
    animation-delay: 0.9s;
}

/* Enhanced floating with more sophisticated movement */
@keyframes enhancedFloat {
    0% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.4;
    }
    25% { 
        transform: translateY(-6px) translateX(3px) rotate(3deg) scale(1.1);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-12px) translateX(-2px) rotate(-2deg) scale(1.05);
        opacity: 0.9;
    }
    75% { 
        transform: translateY(-6px) translateX(-4px) rotate(4deg) scale(1.1);
        opacity: 0.6;
    }
    100% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.4;
    }
}

/* Cosmic fall animation - stars falling through space */
@keyframes cosmicFall {
    0% { 
        transform: translateY(-20px) translateX(0px) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% { 
        transform: translateY(50vh) translateX(10px) rotate(180deg) scale(1.2);
        opacity: 0.8;
    }
    90% {
        opacity: 0.3;
    }
    100% { 
        transform: translateY(120vh) translateX(-5px) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* Oceanic float animation - weightless bubble movement */
@keyframes oceanicFloat {
    0% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.3;
    }
    20% { 
        transform: translateY(-15px) translateX(8px) rotate(30deg) scale(1.1);
        opacity: 0.6;
    }
    40% { 
        transform: translateY(-25px) translateX(-5px) rotate(60deg) scale(0.9);
        opacity: 0.8;
    }
    60% { 
        transform: translateY(-30px) translateX(12px) rotate(-45deg) scale(1.2);
        opacity: 0.5;
    }
    80% { 
        transform: translateY(-20px) translateX(-8px) rotate(120deg) scale(1.05);
        opacity: 0.7;
    }
    100% { 
        transform: translateY(0px) translateX(0px) rotate(180deg) scale(1);
        opacity: 0.3;
    }
}

/* Ultra-smooth cosmic fall - silky star movement */
@keyframes smoothCosmicFall {
    0% { 
        transform: translateY(-30px) translateX(0px) rotate(0deg) scale(0.6);
        opacity: 0;
    }
    8% {
        opacity: 0.3;
    }
    15% {
        opacity: 0.8;
        transform: translateY(10vh) translateX(2px) rotate(45deg) scale(0.9);
    }
    45% { 
        transform: translateY(45vh) translateX(8px) rotate(180deg) scale(1.1);
        opacity: 0.9;
    }
    70% { 
        transform: translateY(75vh) translateX(4px) rotate(270deg) scale(1.05);
        opacity: 0.6;
    }
    88% {
        opacity: 0.2;
    }
    100% { 
        transform: translateY(110vh) translateX(-3px) rotate(360deg) scale(0.4);
        opacity: 0;
    }
}

/* Ultra-smooth oceanic float - fluid bubble motion */
@keyframes smoothOceanicFloat {
    0% { 
        transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
        opacity: 0.25;
    }
    12% { 
        transform: translateY(-8px) translateX(4px) rotate(15deg) scale(1.02);
        opacity: 0.45;
    }
    25% { 
        transform: translateY(-18px) translateX(9px) rotate(35deg) scale(1.08);
        opacity: 0.65;
    }
    40% { 
        transform: translateY(-28px) translateX(2px) rotate(65deg) scale(0.95);
        opacity: 0.8;
    }
    55% { 
        transform: translateY(-35px) translateX(-6px) rotate(95deg) scale(1.12);
        opacity: 0.7;
    }
    70% { 
        transform: translateY(-30px) translateX(7px) rotate(125deg) scale(1.05);
        opacity: 0.55;
    }
    85% { 
        transform: translateY(-15px) translateX(-3px) rotate(155deg) scale(1.03);
        opacity: 0.4;
    }
    100% { 
        transform: translateY(0px) translateX(0px) rotate(180deg) scale(1);
        opacity: 0.25;
    }
}

.settings-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.settings-buttons .menu-btn {
    flex: 1;
}

/* New Codex Page Styles */
.codex-content {
    margin-top: 40px;
}

.codex-text-box {
    background: 
        linear-gradient(145deg, rgba(13, 45, 74, 0.9), rgba(30, 77, 114, 0.8));
    border: 2px solid #4a90e2;
    border-radius: 15px;
    padding: 40px;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    text-align: center;
    box-shadow: 
        0 6px 18px rgba(74, 144, 226, 0.3),
        inset 0 0 20px rgba(13, 45, 74, 0.6);
    letter-spacing: 0.5px;
    margin-bottom: 30px;
}

.codex-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.back-btn {
    background: 
        linear-gradient(145deg, rgba(74, 44, 13, 0.9), rgba(114, 77, 30, 0.8)) !important;
    border-color: #e24a4a !important;
}

.back-btn:hover {
    border-color: #ff6666 !important;
    box-shadow: 
        0 12px 30px rgba(226, 74, 74, 0.5),
        inset 0 0 30px rgba(255, 102, 102, 0.2) !important;
}

/* Mobile adjustments for new pages */
@media (max-width: 768px) {
    .settings-control {
        padding: 20px;
    }
    
    .settings-label {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .settings-slider-container {
        gap: 15px;
    }
    
    .settings-value {
        font-size: 1rem;
        min-width: 50px;
    }
    
    .settings-buttons {
        flex-direction: column;
        gap: 15px;
        margin-top: 25px;
    }
    
    .settings-buttons .menu-btn {
        flex: none;
        width: 100%;
    }
    
    .codex-content {
        margin-top: 30px;
    }
    
    .codex-text-box {
        padding: 25px;
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 25px;
    }
    
    .codex-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .codex-buttons .menu-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .settings-control {
        padding: 15px 20px;
    }
    
    .settings-label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .settings-buttons {
        flex-direction: row;
        gap: 15px;
        margin-top: 20px;
    }
    
    .settings-buttons .menu-btn {
        flex: 1;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .codex-text-box {
        padding: 20px;
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 20px;
    }
    
    .codex-buttons {
        flex-direction: row;
        justify-content: center;
    }
    
    .codex-buttons .menu-btn {
        width: auto;
        max-width: 200px;
        padding: 12px 30px;
        font-size: 0.9rem;
    }
}
/* Additional styles for pause menu if needed */
#newPauseMenu .game-title {
    color: #FFB74D;
    text-shadow: 
        0 0 20px rgba(255, 183, 77, 0.8),
        0 0 40px rgba(255, 183, 77, 0.6),
        0 0 60px rgba(255, 183, 77, 0.4);
    animation: pauseTitleGlow 3s ease-in-out infinite alternate;
}

@keyframes pauseTitleGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(255, 183, 77, 0.8),
            0 0 40px rgba(255, 183, 77, 0.6),
            0 0 60px rgba(255, 183, 77, 0.4);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(255, 183, 77, 1),
            0 0 50px rgba(255, 183, 77, 0.8),
            0 0 70px rgba(255, 183, 77, 0.6);
    }
}

#newPauseMenu .game-subtitle {
    color: #FFCC80;
    text-shadow: 0 0 15px rgba(255, 204, 128, 0.8);
}

/* Game stats for pause menu (when in game over mode) */
#newPauseMenu .game-stats {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 15px;
    border: 1px solid rgba(255, 183, 77, 0.3);
}

#newPauseMenu .game-stats p {
    color: #FFE5CC;
    margin: 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 229, 204, 0.6);
}

#newPauseMenu .game-stats span {
    color: #FFB74D;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 183, 77, 0.8);
}

/* Game over specific styling for pause menu */
#newPauseMenu.game-over-mode .game-title {
    color: #FF6B6B;
    text-shadow: 
        0 0 20px rgba(255, 107, 107, 0.8),
        0 0 40px rgba(255, 107, 107, 0.6),
        0 0 60px rgba(255, 107, 107, 0.4);
    animation: gameOverTitleGlow 3s ease-in-out infinite alternate;
}

@keyframes gameOverTitleGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(255, 107, 107, 0.8),
            0 0 40px rgba(255, 107, 107, 0.6),
            0 0 60px rgba(255, 107, 107, 0.4);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(255, 107, 107, 1),
            0 0 50px rgba(255, 107, 107, 0.8),
            0 0 70px rgba(255, 107, 107, 0.6);
    }
}

#newPauseMenu.game-over-mode .game-subtitle {
    color: #FFB3B3;
    text-shadow: 0 0 15px rgba(255, 179, 179, 0.8);
}

/* Combined Mobile UI for Whitepaper + Dev Team */
#combinedMobileUI {
    position: absolute;
    bottom: 5px; /* Move to same position as whitepaper UI */
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    width: 90vw;
    max-width: 350px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(240, 240, 240, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #E8E8E8;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
}

#combinedTitle {
    font-size: 10px;
    margin-bottom: 6px;
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(255, 255, 255, 1);
    font-weight: 700;
    white-space: nowrap;
}

#combinedContent {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

#combinedWhitepaper, #combinedDevs {
    flex: 1;
    font-size: 9px;
    font-weight: 700;
}

/* Standalone Mobile Dev UI (when whitepaper is complete) */
#standaloneMobileDevUI {
    position: absolute;
    bottom: 5px; /* Move to same position as whitepaper UI */
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    width: 90vw;
    max-width: 350px;
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.15) 0%, rgba(34, 139, 34, 0.1) 50%, rgba(0, 0, 0, 0.8) 100%);
    border: 2px solid #00FF88;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(5px);
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 100;
    text-align: center;
    transition: all 0.3s ease;
}

#standaloneMobileDevTitle {
    font-size: 10px;
    margin-bottom: 6px;
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(0, 255, 136, 1);
    font-weight: 700;
    white-space: nowrap;
}

#standaloneMobileDevCounter {
    font-size: 10px;
    font-weight: 700;
}

/* Landscape mobile adjustments for combined UI */
@media (max-width: 768px) and (orientation: landscape) {
    #combinedMobileUI {
        bottom: 5px; /* Keep same bottom position for landscape */
        padding: 6px 10px;
        width: 85vw;
        max-width: 300px;
    }
    
    #combinedTitle {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    #combinedWhitepaper, #combinedDevs {
        font-size: 8px;
    }
    
    #standaloneMobileDevUI {
        bottom: 5px; /* Keep same bottom position for landscape */
        padding: 6px 10px;
        width: 85vw;
        max-width: 300px;
    }
    
    #standaloneMobileDevTitle {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    #standaloneMobileDevCounter {
        font-size: 9px;
    }
}

/* Mobile Whitepaper Completion Animation */
#mobileWhitepaperSuccess {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95) 0%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 215, 0, 0.95) 100%);
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    color: #000;
    font-weight: 700;
    z-index: 10000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: mobileSuccessPulse 2s ease-in-out;
    backdrop-filter: blur(10px);
    max-width: 280px;
    width: 90vw;
}

#mobileSuccessIcon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: mobileSuccessIconSpin 2s ease-in-out;
}

#mobileSuccessText {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

#mobileSuccessSubtext {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

@keyframes mobileSuccessPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(0.95);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    80% {
        transform: translate(-50%, -50%) scale(0.98);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes mobileSuccessIconSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.2);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Combined UI adjustments when whitepaper is completed */
#combinedMobileUI.whitepaper-completed #combinedTitle {
    font-size: 10px;
    margin-bottom: 6px;
}

#combinedMobileUI.whitepaper-completed #combinedWhitepaper {
    display: none;
}

#combinedMobileUI.whitepaper-completed #combinedContent {
    justify-content: center;
}

/* Landscape mobile adjustments for completion animation */
@media (max-width: 768px) and (orientation: landscape) {
    #mobileWhitepaperSuccess {
        padding: 15px;
        max-width: 250px;
    }
    
    #mobileSuccessIcon {
        font-size: 36px;
        margin-bottom: 8px;
    }
    
    #mobileSuccessText {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    #mobileSuccessSubtext {
        font-size: 11px;
    }
}

#whitepaperCounter {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    margin-top: 8px;
    display: none; /* Hide counter on desktop for simpler look */
}

#piecesCollected {
    color: #FFFFFF;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.html-menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Smooth fade-in effect for menu after file loader */
.html-menu-overlay.fade-in {
    opacity: 0;
    animation: menuFadeIn 0.4s ease-out forwards;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}