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

body {
    font-family: Arial, sans-serif;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background-color: #000000; /* Black background behind everything */
}

#main-container {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    z-index: 1;
}

/* Main Menu Screen */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 20vh;
    height: 100vh;
    width: 100%;
    background-color: #0047AB; /* Dark blue background */
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
    z-index: 10;
    opacity: 1;
}

#game-container.slide-off {
    transform: translateY(-100%); /* Slide up and off screen */
}

#game-container.fade-in {
    transform: translateY(0);
    opacity: 1;
}

#title {
    color: white;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 5rem; /* Increased from 3.5rem to 5rem */
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 40px;
}

#single-player-btn {
    padding: 15px 30px;
    font-size: 1.5rem;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    background-color: #000000; /* Changed to black */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#single-player-btn:hover {
    background-color: #333333; /* Dark gray on hover */
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#single-player-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Game Mode Selection Screen */
#gamemode-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10vh;
    background-color: #000000; /* Black background */
    z-index: 5;
    overflow-y: auto; /* Add scrolling for many game modes */
    padding-bottom: 20px;
    transition: opacity 0.4s ease-in-out;
    opacity: 1;
}

#gamemode-container.fade-out {
    opacity: 0;
    pointer-events: none; /* Disable interaction with elements */
}

#gamemode-container.hide {
    display: none; /* Completely remove from layout and interaction */
}

#back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    font-size: 1.2rem;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    background-color: transparent;
    color: white;
    border: 2px solid white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    opacity: 0;
    transform: translateX(-20px);
    z-index: 15;
}

#back-btn.appear {
    opacity: 1;
    transform: translateX(0);
}

#back-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#back-btn:active {
    transform: translateY(1px);
}

#gamemode-title {
    color: white;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 3rem;
    text-align: center;
    margin-bottom: 50px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#gamemode-title.appear {
    opacity: 1;
    transform: translateY(0);
}

#gamemode-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 80%;
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
}

#gamemode-options.appear {
    opacity: 1;
    transform: translateY(0);
}

.gamemode-box {
    width: 100%;
    background-color: #333333;
    border-radius: 10px;
    padding: 20px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    transform: translateY(100px);
    opacity: 0;
    border-left: 5px solid #00BFFF;
    position: relative; /* Add position relative for absolute positioning of coming soon text */
}

/* Style for non-Classic Mode boxes (coming soon) */
.gamemode-box.coming-soon {
    background-color: #1a1a1a; /* Dark gray background */
    border-left-color: #666666; /* Gray border */
    cursor: not-allowed; /* Show that it's not clickable */
    opacity: 0.7; /* Make it slightly transparent */
}

/* Coming soon text styling */
.gamemode-box.coming-soon::after {
    content: 'COMING SOON';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid #ffffff;
    z-index: 10;
    pointer-events: none;
}

/* Dim the content of coming soon boxes */
.gamemode-box.coming-soon h3,
.gamemode-box.coming-soon p {
    opacity: 0.3;
    filter: blur(1px);
}

/* Remove hover effects for coming soon boxes */
.gamemode-box.coming-soon:hover {
    transform: translateY(0) scale(1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background-color: #1a1a1a;
}

.gamemode-box:nth-child(1) {
    transition-delay: 0.15s;
}

.gamemode-box:nth-child(2) {
    transition-delay: 0.25s;
    border-left-color: #8B0000; /* Changed to dark red (previously on Lava Mode) */
}

.gamemode-box:nth-child(3) {
    transition-delay: 0.35s;
    border-left-color: #7CFC00;
}

.gamemode-box:nth-child(4) {
    transition-delay: 0.45s;
    border-left-color: #FF5733; /* Changed to orange-red (previously on Hardcore) */
}

.gamemode-box:nth-child(5) {
    transition-delay: 0.55s;
    border-left-color: #9370DB; /* Medium Purple for Endless */
}

.gamemode-box:nth-child(6) {
    transition-delay: 0.65s;
    border-left-color: #708090; /* Slate Gray for The Shadow */
}

/* Override border colors for coming soon boxes */
.gamemode-box.coming-soon:nth-child(2),
.gamemode-box.coming-soon:nth-child(3),
.gamemode-box.coming-soon:nth-child(4),
.gamemode-box.coming-soon:nth-child(5),
.gamemode-box.coming-soon:nth-child(6) {
    border-left-color: #666666;
}

#gamemode-options.appear .gamemode-box {
    transform: translateY(0);
    opacity: 1;
}

#gamemode-options.disappear .gamemode-box {
    transform: translateY(100px);
    opacity: 0;
}

.gamemode-box:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    background-color: #444444;
}

.gamemode-box h3 {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.gamemode-box p {
    font-size: 1.1rem;
    line-height: 1.4;
    color: #CCCCCC;
}

/* Classic Mode Game Screen */
#classic-game-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    background-color: #000000;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    overflow-y: visible;
    perspective: 800px;
    padding-bottom: 20vh;
}

#classic-game-container.show {
    opacity: 1;
    z-index: 2;
}

/* Add style for wall windows on the left side */
@keyframes window-glow-left {
    0% { box-shadow: 0 0 3px rgba(0, 100, 200, 0.2); }
    50% { box-shadow: 0 0 5px rgba(0, 150, 255, 0.3); }
    100% { box-shadow: 0 0 3px rgba(0, 100, 200, 0.2); }
}

/* Add style for wall windows on the right side */
@keyframes window-glow-right {
    0% { box-shadow: 0 0 3px rgba(0, 100, 200, 0.2); }
    50% { box-shadow: 0 0 5px rgba(0, 150, 255, 0.3); }
    100% { box-shadow: 0 0 3px rgba(0, 100, 200, 0.2); }
}

/* Left wall windows */
.left-wall-windows {
    position: absolute;
    top: 0;
    left: -28px;
    height: 100%;
    width: 28px;
    z-index: -2;
    transform: skewY(45deg);
    transform-origin: top left;
    pointer-events: none;
}

.left-wall-windows::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-image: repeating-linear-gradient(to bottom,
        transparent 0px,
        transparent 150px,
        rgba(0, 100, 200, 0.15) 150px,
        rgba(0, 100, 200, 0.15) 170px,
        transparent 170px,
        transparent 300px,
        rgba(0, 150, 255, 0.1) 300px,
        rgba(0, 150, 255, 0.1) 310px
    );
}

/* Right wall windows */
.right-wall-windows {
    position: absolute;
    top: 0;
    right: -28px;
    height: 100%;
    width: 28px;
    z-index: -2;
    transform: skewY(-45deg);
    transform-origin: top right;
    pointer-events: none;
}

.right-wall-windows::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    background-image: repeating-linear-gradient(to bottom,
        transparent 0px,
        transparent 200px,
        rgba(0, 100, 200, 0.12) 200px,
        rgba(0, 100, 200, 0.12) 220px,
        transparent 220px,
        transparent 350px,
        rgba(0, 150, 255, 0.08) 350px,
        rgba(0, 150, 255, 0.08) 360px
    );
}

/* Enhance tower with 3D effects */
#black-rectangle {
    width: 70%;
    height: 3000px;
    background-color: #000000;
    box-shadow: 
        0 -4px 10px rgba(0, 0, 0, 0.5), 
        0 0 20px rgba(0, 0, 0, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    position: relative;
    transform: translateY(1200px);
    transition: transform 0.4s ease-in-out 0.3s;
    perspective: 1000px;
    background-image: linear-gradient(to bottom, 
        rgba(10, 10, 10, 1) 0%, 
        rgba(0, 0, 0, 1) 20%, 
        rgba(5, 5, 5, 1) 40%, 
        rgba(0, 0, 0, 1) 60%, 
        rgba(10, 10, 10, 1) 80%, 
        rgba(0, 0, 0, 1) 100%);
    z-index: 1;
}

/* Left wall of the tower */
#black-rectangle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -30px; /* Position outside the main tower, increased width */
    width: 30px; /* Width of the wall - increased for more visibility */
    height: 100%;
    background: linear-gradient(to right, #111, #222);
    transform: skewY(45deg);
    transform-origin: top left;
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.5);
    z-index: -1;
    /* Add subtle texture pattern to the wall */
    background-image: 
        linear-gradient(90deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 20%),
        repeating-linear-gradient(0deg, 
            transparent 0px, 
            transparent 89px, 
            rgba(50, 50, 50, 0.5) 90px, 
            rgba(50, 50, 50, 0.5) 95px);
}

/* Right wall of the tower */
#black-rectangle::after {
    content: '';
    position: absolute;
    top: 0;
    right: -30px; /* Position outside the main tower, increased width */
    width: 30px; /* Width of the wall - increased for more visibility */
    height: 100%;
    background: linear-gradient(to left, #111, #222);
    transform: skewY(-45deg);
    transform-origin: top right;
    box-shadow: inset 5px 0 10px rgba(0, 0, 0, 0.5);
    z-index: -1;
    /* Add subtle texture pattern to the wall */
    background-image: 
        linear-gradient(270deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 20%),
        repeating-linear-gradient(0deg, 
            transparent 0px, 
            transparent 89px, 
            rgba(50, 50, 50, 0.5) 90px, 
            rgba(50, 50, 50, 0.5) 95px);
}

/* Add left edge highlight */
.tower-left-edge {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.2), 
        rgba(120, 120, 120, 0.1) 10%, 
        rgba(70, 70, 70, 0.05) 30%, 
        rgba(30, 30, 30, 0.03));
    z-index: 2;
}

/* Add right edge highlight */
.tower-right-edge {
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(40, 40, 40, 0.2), 
        rgba(20, 20, 20, 0.1) 10%, 
        rgba(10, 10, 10, 0.05) 30%, 
        rgba(0, 0, 0, 0.03));
    z-index: 2;
}

#classic-game-container.show #black-rectangle {
    transform: translateY(1200px); /* Match initial position */
}

/* Add camera movement animation to reveal the tower */
#classic-game-container.reveal-tower #black-rectangle {
    /* Will be triggered by JavaScript after the initial fade-in */
    transition: transform 6s ease-in-out; /* Original animation timing and easing */
    transform: translateY(-700px); /* Match the final position in JavaScript */
}

/* Tower texture */
.tower-texture {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.05) 0%, transparent 10%);
    pointer-events: none;
    z-index: 1;
}

/* Tower floors */
.tower-floor {
    position: relative;
    width: 100%;
    height: 90px; /* Slightly reduced height of each floor */
    border-top: 2px solid #333; /* Brighter border for visibility */
    background-color: #111;
    margin-top: 5px; /* Reduced spacing between floors */
    transition: background-color 0.3s ease; /* Original transition */
    z-index: 2; /* Make sure floors are above the walls */
}

/* Add floor numbers */
.tower-floor::after {
    content: attr(data-floor);
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 1.8rem; /* Larger floor numbers */
    color: rgba(255, 255, 255, 0.4); /* Brighter text */
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-weight: bold;
}

/* Create different colored floors for visual distinction */
.tower-floor:nth-child(4n+1) {
    background-color: #0a0a0a;
}

.tower-floor:nth-child(4n+2) {
    background-color: #111111;
}

.tower-floor:nth-child(4n+3) {
    background-color: #0c0c0c;
}

.tower-floor:nth-child(4n+4) {
    background-color: #131313;
}

/* Add windows to the tower */
.tower-floor::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 25px;
    width: 30px;
    height: 50px;
    background-color: rgba(30, 30, 30, 0.8);
    border: 2px solid #444; /* Brighter border */
    box-shadow: inset 0 0 10px rgba(0, 100, 255, 0.15);
}

/* Special styling for top floor (Classic Mode) */
.tower-floor[data-floor="30"] {
    background-color: #001830; /* Special color for the top floor */
    border-top: 2px solid #004080;
}

.tower-floor[data-floor="30"]::before {
    background-color: rgba(0, 100, 200, 0.2);
    border: 2px solid #0066cc;
    box-shadow: inset 0 0 15px rgba(0, 150, 255, 0.3), 0 0 10px rgba(0, 150, 255, 0.5);
}

.tower-floor[data-floor="30"]::after {
    color: rgba(0, 150, 255, 0.7);
    font-size: 2rem;
    font-weight: bold;
}

/* Special styling for top floor (Lava Mode - Floor 100) */
.tower-floor[data-floor="100"] {
    background-color: #331a00; /* Orange-tinted for lava mode */
    border-top: 2px solid #ff6600;
}

.tower-floor[data-floor="100"]::before {
    background-color: rgba(255, 100, 0, 0.2);
    border: 2px solid #ff6600;
    box-shadow: inset 0 0 15px rgba(255, 150, 0, 0.3), 0 0 10px rgba(255, 150, 0, 0.5);
}

.tower-floor[data-floor="100"]::after {
    color: rgba(255, 150, 0, 0.8);
    font-size: 2rem;
    font-weight: bold;
}

/* Special styling for first floor */
.tower-floor[data-floor="1"] {
    background-color: #3a3a3a; /* Much lighter background for visibility */
    border-top: 3px solid #888; /* Brighter border for visibility */
    border-bottom: 5px solid #888; /* Add a floor with brighter color */
    margin-bottom: 0; /* Remove margin to connect with ground */
    height: 120px; /* Make floor 1 taller for better visibility */
    position: relative;
}

.tower-floor[data-floor="1"]::after {
    color: rgba(255, 255, 255, 0.9); /* Much brighter number */
    font-size: 2.5rem; /* Larger number */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

.tower-floor[data-floor="1"]::before {
    border-color: #888; /* Brighter window border */
    background-color: rgba(80, 80, 80, 0.8); /* Much lighter window */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3); /* Glow effect */
}

/* Tower ground - the foundation */
#tower-ground {
    width: 140%; /* Wider than the tower for a foundation effect */
    height: 100px;
    background: linear-gradient(to bottom, #4a4a4a, #222); /* Gradient for 3D effect */
    position: relative;
    margin-left: -20%; /* To center it since it's wider than the tower */
    border-radius: 10px 10px 50% 50% / 10px 10px 30px 30px; /* Curved bottom */
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.8), /* Shadow beneath */
        inset 0 5px 10px rgba(255, 255, 255, 0.1); /* Highlight on top */
    z-index: 1;
    margin-bottom: 100px; /* Increased space for landscaping */
}

/* Add texture to the ground and small lights */
#tower-ground::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    
    /* Base texture and path lights */
    background: 
        /* Left light */
        radial-gradient(circle at calc(50% - 40px) 70px, rgba(0, 0, 0, 0.8) 2px, rgba(0, 0, 0, 0.6) 4px, transparent 6px),
        /* Right light */
        radial-gradient(circle at calc(50% + 40px) 70px, rgba(0, 0, 0, 0.8) 2px, rgba(0, 0, 0, 0.6) 4px, transparent 6px),
        /* Additional left light */
        radial-gradient(circle at calc(50% - 30px) 90px, rgba(0, 0, 0, 0.7) 2px, rgba(0, 0, 0, 0.5) 4px, transparent 5px),
        /* Additional right light */
        radial-gradient(circle at calc(50% + 30px) 90px, rgba(0, 0, 0, 0.7) 2px, rgba(0, 0, 0, 0.5) 4px, transparent 5px),
        /* Base texture */
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 2px, transparent 3px),
        radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.1) 2px, transparent 3px),
        radial-gradient(circle at 60% 30%, rgba(255, 255, 255, 0.1) 2px, transparent 3px),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.1) 2px, transparent 3px);
    
    background-size: 100px 100px;
    border-radius: inherit;
    z-index: 2;
}

/* Decorative stairs and path */
#tower-ground::after {
    content: '';
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 70px;
    background: transparent;
    z-index: -1;
    
    /* Create steps with multiple gradients */
    background-image: 
        /* First step */
        linear-gradient(to bottom, #444, #333 10px, transparent 10px),
        /* Second step */
        linear-gradient(to bottom, transparent 15px, #3a3a3a 15px, #333 25px, transparent 25px),
        /* Third step */
        linear-gradient(to bottom, transparent 30px, #333 30px, #222 40px, transparent 40px),
        /* Path */
        linear-gradient(to bottom, transparent 45px, #2a2a2a 45px, #111 100%);
    
    background-size: 
        80px 10px,
        90px 25px,
        100px 40px,
        60px 100%;
    
    background-position:
        center top,
        center top,
        center top,
        center top;
    
    background-repeat: no-repeat;
    
    border-radius: 0 0 30% 30% / 0 0 100% 100%;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* Base plate that extends beyond the tower ground */
.tower-base-plate {
    position: absolute;
    top: 80px; /* Position below the tower ground */
    left: 50%;
    transform: translateX(-50%);
    width: 200%; /* Much wider than the tower */
    height: 20px;
    background: linear-gradient(to bottom, #333, #111);
    border-radius: 50% 50% 50% 50% / 20px 20px 5px 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: -2;
}

/* Entrance door styling */
.tower-entrance {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
    background-color: #222;
    border-radius: 10px;
    box-shadow: 
        inset 0 0 15px rgba(0, 150, 255, 0.3),
        0 0 10px rgba(0, 150, 255, 0.5);
    border: 2px solid #444;
    z-index: 3;
}

/* Tower top - enhanced with border connections for the walls */
.tower-top {
    width: 100%;
    height: 60px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: #222;
    position: relative;
    overflow: hidden;
    /* Add subtle shadow for depth */
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.4);
    z-index: 2; /* Make sure it's above the walls */
}

.tower-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 45%, #333 45%, #333 55%, transparent 55%),
                linear-gradient(-45deg, transparent 45%, #333 45%, #333 55%, transparent 55%);
    background-size: 20px 20px;
}

/* Top cap for left wall */
.tower-top-left-cap {
    position: absolute;
    top: 0;
    left: -30px;
    width: 30px;
    height: 15px;
    background: #222;
    transform: skewX(45deg);
    transform-origin: top right;
    border-top-left-radius: 5px;
    z-index: 2;
}

/* Top cap for right wall */
.tower-top-right-cap {
    position: absolute;
    top: 0;
    right: -30px;
    width: 30px;
    height: 15px;
    background: #222;
    transform: skewX(-45deg);
    transform-origin: top left;
    border-top-right-radius: 5px;
    z-index: 2;
}

/* Game UI */
#game-ui {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

#game-ui.show {
    opacity: 1;
    display: flex;
}

#game-ui.hidden {
    display: none;
    opacity: 0;
}

#math-problem {
    font-size: 3.5rem;
    color: white;
    margin-bottom: 30px;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    text-align: center;
    width: 100%; /* Ensure full width */
    padding: 0 20px; /* Add some padding */
}

#answer-input {
    width: 250px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 5px;
    margin-bottom: 30px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: text;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    pointer-events: auto; /* Ensure it can receive clicks */
}

#answer-input:hover {
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
}

#floor-indicator {
    font-size: 1.4rem;
    color: white;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    margin-top: 20px; /* Add some space at the bottom */
}

/* Gift emoji styling */
.scaling-gift {
    position: absolute;
    font-size: 3rem;
    cursor: pointer;
    z-index: 30;
    pointer-events: auto;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    transition: opacity 0.5s ease-in-out, transform 0.3s ease;
}

.scaling-gift:hover {
    transform: scale(1.2);
}

@keyframes gift-pulse {
    0% {
        transform: translateY(-50%) scale(1);
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    50% {
        transform: translateY(-50%) scale(1.1);
        text-shadow: 0 0 30px rgba(255, 215, 0, 1);
    }
    100% {
        transform: translateY(-50%) scale(1);
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

/* Timer Display */
#timer-display {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-weight: bold;
    color: #00ff66;
    text-shadow: 0 0 15px rgba(0, 255, 102, 0.6);
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px 30px;
    border-radius: 10px;
    border: 2px solid rgba(0, 255, 102, 0.5);
    z-index: 1001;
    transition: color 0.3s ease, text-shadow 0.3s ease, border-color 0.3s ease;
}

#timer-display.hidden {
    display: none;
}

#timer-display.warning {
    color: #ffcc00;
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
    border-color: rgba(255, 204, 0, 0.5);
}

#timer-display.danger {
    color: #ff3333;
    text-shadow: 0 0 15px rgba(255, 51, 51, 0.8);
    border-color: rgba(255, 51, 51, 0.5);
    animation: timer-pulse 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

/* Timer Difficulty Overlay */
#timer-difficulty-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

#timer-difficulty-overlay.hidden {
    display: none;
    opacity: 0;
}

#timer-difficulty-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 3px solid rgba(0, 255, 102, 0.6);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 255, 102, 0.2);
    transform: scale(1);
    transition: transform 0.3s ease;
}

#timer-difficulty-popup h3 {
    color: #ffffff;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 2rem;
    margin: 0 0 30px 0;
    text-shadow: 0 0 15px rgba(0, 255, 102, 0.5);
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.difficulty-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.difficulty-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

.difficulty-btn.easy {
    background: linear-gradient(135deg, #00cc66 0%, #00aa44 100%);
}

.difficulty-btn.easy:hover {
    background: linear-gradient(135deg, #00dd77 0%, #00bb55 100%);
}

.difficulty-btn.normal {
    background: linear-gradient(135deg, #00aaff 0%, #0088cc 100%);
}

.difficulty-btn.normal:hover {
    background: linear-gradient(135deg, #00bbff 0%, #0099dd 100%);
}

.difficulty-btn.moderate {
    background: linear-gradient(135deg, #ffaa00 0%, #dd8800 100%);
}

.difficulty-btn.moderate:hover {
    background: linear-gradient(135deg, #ffbb22 0%, #ee9911 100%);
}

.difficulty-btn.hard {
    background: linear-gradient(135deg, #ff6633 0%, #dd4411 100%);
}

.difficulty-btn.hard:hover {
    background: linear-gradient(135deg, #ff7744 0%, #ee5522 100%);
}

.difficulty-btn.extreme {
    background: linear-gradient(135deg, #ff0066 0%, #cc0044 100%);
}

.difficulty-btn.extreme:hover {
    background: linear-gradient(135deg, #ff1177 0%, #dd1155 100%);
}

.difficulty-btn.appalling {
    background: linear-gradient(135deg, #8b0000 0%, #4a0000 100%);
    border: 1px solid #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.difficulty-btn.appalling:hover {
    background: linear-gradient(135deg, #a00000 0%, #5a0000 100%);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
}

.difficulty-btn.impossible {
    background: linear-gradient(135deg, #1a0033 0%, #0d001a 100%);
    border: 2px solid #9933ff;
    text-shadow: 0 0 15px rgba(153, 51, 255, 0.8), 0 0 25px rgba(255, 0, 255, 0.5);
    animation: impossible-pulse 1.5s ease-in-out infinite;
}

.difficulty-btn.impossible:hover {
    background: linear-gradient(135deg, #2a0055 0%, #1a0033 100%);
    box-shadow: 0 0 25px rgba(153, 51, 255, 0.6), 0 0 40px rgba(255, 0, 255, 0.3);
    border-color: #cc66ff;
}

@keyframes impossible-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba(153, 51, 255, 0.3);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(153, 51, 255, 0.6), 0 0 30px rgba(255, 0, 255, 0.2);
    }
}

/* Lava Mode Styles */
#lava-element {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw; /* Full viewport width */
    height: 0;
    background: linear-gradient(to top, 
        #ff2200 0%,
        #ff4400 20%,
        #ff6600 40%,
        #ff8800 60%,
        #ffaa00 80%,
        rgba(255, 200, 0, 0.8) 90%,
        transparent 100%
    );
    z-index: 50; /* Above tower floors but below game UI */
    pointer-events: none;
    transition: height 0.05s linear;
}

#lava-element::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(255, 255, 0, 0.4) 0%, transparent 30%),
        radial-gradient(ellipse at 60% 40%, rgba(255, 200, 0, 0.3) 0%, transparent 25%),
        radial-gradient(ellipse at 80% 10%, rgba(255, 150, 0, 0.5) 0%, transparent 35%),
        radial-gradient(ellipse at 40% 60%, rgba(255, 100, 0, 0.4) 0%, transparent 30%);
    animation: lava-bubble 2s ease-in-out infinite;
}

#lava-element::after {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to top,
        rgba(255, 100, 0, 0.9) 0%,
        rgba(255, 150, 0, 0.6) 40%,
        transparent 100%
    );
    animation: lava-wave 1s ease-in-out infinite;
}

@keyframes lava-bubble {
    0%, 100% {
        background-position: 0 0, 50% 30%, 80% 10%, 30% 50%;
    }
    50% {
        background-position: 10% 10%, 40% 20%, 90% 20%, 20% 40%;
    }
}

@keyframes lava-wave {
    0%, 100% {
        transform: translateY(0) scaleY(1);
    }
    50% {
        transform: translateY(-5px) scaleY(1.2);
    }
}

/* Lava glow effect on the screen */
.lava-rising ~ * {
    box-shadow: 0 0 100px rgba(255, 100, 0, 0.3);
}

/* Lava Mode tower reveal animation */
/* For 100 floors at ~97px each = ~9700px total height */
/* Start high (showing floor 100) and scroll down to floor 1 */
#classic-game-container.reveal-tower-lava #black-rectangle {
    transition: transform 12s ease-in-out;
    transform: translateY(-7000px);
}

/* Lava Lose Dialog Overlay */
.lava-lose-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Lava Lose Dialog */
.lava-lose-dialog {
    background: linear-gradient(135deg, #4a1500 0%, #8b2500 50%, #a33000 100%);
    border: 3px solid rgba(255, 100, 0, 0.8);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 80px rgba(255, 100, 0, 0.5);
    transform: scale(0.8) translateY(50px);
    opacity: 0;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.lava-lose-dialog::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 150, 0, 0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
    pointer-events: none;
}

.lava-lose-title {
    color: #ffffff;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 2.5rem;
    margin: 0 0 20px 0;
    text-shadow: 0 0 20px rgba(255, 100, 0, 0.8);
    animation: lava-glow 1s ease-in-out infinite alternate;
}

.lava-lose-message {
    color: #ffccaa;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
    text-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
}

.lava-lose-countdown {
    color: #ffffff;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 1.1rem;
    margin-top: 20px;
    opacity: 0.8;
}

@keyframes lava-glow {
    0% {
        text-shadow: 0 0 20px rgba(255, 100, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 40px rgba(255, 200, 0, 1), 0 0 60px rgba(255, 100, 0, 0.8);
    }
}

/* Lava Floor Indicator */
.lava-floor-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(80, 20, 0, 0.95), rgba(40, 10, 0, 0.95));
    border: 2px solid #ff6600;
    border-radius: 10px;
    color: #ffaa00;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(255, 100, 0, 0.5), inset 0 0 10px rgba(255, 100, 0, 0.2);
    animation: lava-indicator-pulse 1s ease-in-out infinite alternate;
}

@keyframes lava-indicator-pulse {
    0% {
        box-shadow: 0 0 20px rgba(255, 100, 0, 0.5), inset 0 0 10px rgba(255, 100, 0, 0.2);
        border-color: #ff6600;
    }
    100% {
        box-shadow: 0 0 30px rgba(255, 150, 0, 0.7), inset 0 0 15px rgba(255, 150, 0, 0.3);
        border-color: #ff8800;
    }
}

/* Lava Mode floor 100 pulse animation */
@keyframes pulse-lava-top-floor {
    0% { 
        box-shadow: 0 0 30px rgba(255, 150, 0, 0.5), inset 0 0 20px rgba(255, 150, 0, 0.3); 
    }
    50% { 
        box-shadow: 0 0 50px rgba(255, 200, 0, 0.7), inset 0 0 30px rgba(255, 200, 0, 0.5); 
    }
    100% { 
        box-shadow: 0 0 30px rgba(255, 150, 0, 0.5), inset 0 0 20px rgba(255, 150, 0, 0.3); 
    }
}