#game-container {
    position: relative;
    width: 1080px;
    height: 1920px;
    background: radial-gradient(circle at center, #2a0505, #000000);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#game-layout {
    height: 65%;
    display: flex;
    width: 100%;
    position: relative;
    border-bottom: 1px solid #4a0000;
    padding-top: 0;
    box-sizing: border-box;
}

#road {
    width: 340px;
    background-color: #0a0a0a;
    background-image: 
        radial-gradient(circle at 2px 2px, rgba(255,255,255,0.03) 1px, transparent 0),
        linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%, #111),
        linear-gradient(45deg, #111 25%, #050505 25%, #050505 75%, #111 75%, #111);
    background-size: 8px 8px, 40px 40px, 40px 40px;
    background-position: 0 0, 0 0, 20px 20px;
    box-shadow: 
        inset 20px 0 40px rgba(0,0,0,0.9),
        inset -20px 0 40px rgba(0,0,0,0.9),
        0 0 50px rgba(255, 69, 0, 0.1);
    position: relative;
    display: flex;
    justify-content: center;
    border-left: 2px solid #221100;
    border-right: 2px solid #221100;
    overflow: hidden;
}

#road::before {
    content: "";
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 300%;
    background-image: 
        linear-gradient(115deg, transparent 45%, rgba(255, 69, 0, 0.4) 47%, rgba(255, 0, 0, 0.6) 48%, rgba(255, 140, 0, 0.4) 49%, transparent 51%),
        linear-gradient(245deg, transparent 25%, rgba(255, 69, 0, 0.3) 27%, rgba(255, 0, 0, 0.5) 28%, rgba(255, 140, 0, 0.3) 29%, transparent 31%),
        linear-gradient(115deg, transparent 75%, rgba(255, 69, 0, 0.4) 77%, rgba(255, 0, 0, 0.6) 78%, rgba(255, 140, 0, 0.4) 79%, transparent 81%),
        radial-gradient(circle at 50% 50%, rgba(255, 69, 0, 0.15) 0%, transparent 70%);
    background-size: 100% 400px;
    filter: blur(1.5px);
    opacity: 0.6;
    z-index: 0;
    animation: lavaFlowAnim 25s infinite linear, lavaPulse 4s infinite alternate ease-in-out;
    pointer-events: none;
}

#road::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, #000 0%, transparent 15%, transparent 85%, #000 100%);
    pointer-events: none;
    z-index: 1;
}

@keyframes lavaFlowAnim {
    from { transform: translateY(0); }
    to { transform: translateY(400px); }
}

@keyframes lavaPulse {
    0% { opacity: 0.4; filter: blur(1px) brightness(1); }
    100% { opacity: 0.8; filter: blur(2px) brightness(1.5); }
}

#spawning-pool {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 100px;
    background: radial-gradient(ellipse at center, rgba(30, 0, 50, 0.8) 0%, rgba(0, 0, 0, 0.5) 40%, transparent 80%);
    filter: blur(10px);
    z-index: 1;
    animation: eerieMist 6s infinite alternate ease-in-out;
    pointer-events: none;
}

#spawning-pool::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(75, 0, 130, 0.4), transparent 70%);
    animation: creepingDarkness 4s infinite alternate;
}

@keyframes eerieMist {
    0% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    50% { transform: translateX(-52%) scale(1.15) skewX(5deg); opacity: 0.9; }
    100% { transform: translateX(-48%) scale(1) skewX(-5deg); opacity: 0.6; }
}

@keyframes creepingDarkness {
    from { opacity: 0.2; transform: translate(-50%, -50%) scale(0.8) rotate(0deg); }
    to { opacity: 0.7; transform: translate(-50%, -50%) scale(1.3) rotate(10deg); }
}

#portal {
    position: absolute;
    bottom: 0;
    width: 340px;
    height: 100px;
    border-radius: 170px 170px 0 0;
    background: 
        radial-gradient(ellipse at bottom, #000 20%, #1a0033 50%, transparent 80%),
        conic-gradient(from 0deg at 50% 100%, transparent, #4b0082, #9400d3, #ff00ff, #9400d3, #4b0082, transparent);
    box-shadow: 
        0 -15px 60px rgba(148, 0, 211, 0.7),
        inset 0 0 40px rgba(0, 0, 0, 0.9);
    z-index: 1;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: visible;
}

#portal::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 170px 170px 0 0;
    background: repeating-conic-gradient(from 0deg at 50% 100%, transparent 0deg 10deg, rgba(148, 0, 211, 0.1) 10deg 20deg);
    animation: portalSwirl 15s infinite linear;
    pointer-events: none;
}

@keyframes portalSwirl {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#portal-energy-label {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
    font-size: 30px;
    font-weight: bold;
    color: rgba(255, 215, 0, 0.9);
    text-shadow: 0 0 10px #000, 0 0 20px rgba(255, 215, 0, 0.5); 
    pointer-events: none;
    z-index: 10;
}

#portal-gauge-container {
    position: absolute;
    bottom: 45px;
    width: 450px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

@keyframes portalShake {
    0% { transform: translateX(-50%) translateX(-2px); }
    25% { transform: translateX(-50%) translateX(2px); }
    50% { transform: translateX(-50%) translateY(-1px); }
    75% { transform: translateX(-50%) translateX(-2px); }
    100% { transform: translateX(-50%) translateX(2px); }
}

@keyframes flowFill {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

#stage-info {
    position: absolute;
    top: 150px;
    width: 100%;
    text-align: center;
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 4px #000000;
    z-index: 20;
    pointer-events: none;
}

#start-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 10px #fff, 0 0 20px #ff0000;
    z-index: 100;
    display: none;
    pointer-events: none;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Maintain pixel-perfect sharpness */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}
