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

body {
    background: #000;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
    -webkit-user-select: none;
    user-select: none;
}

#game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#scene-container {
    width: 100%;
    height: 100%;
}

#scene-container canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    pointer-events: none;
    z-index: 10;
}

#hud-left, #hud-right {
    font-size: 11px;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    letter-spacing: 1px;
}

#ring-icon {
    color: #FFD700;
    font-size: 14px;
    animation: ring-spin 1s ease-in-out infinite;
}

@keyframes ring-spin {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(0.3); }
}

#hud-center {
    font-size: 14px;
    color: #fff;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    letter-spacing: 2px;
}

#hud-bottom {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    pointer-events: none;
    z-index: 10;
    font-size: 9px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

/* Title Screen */
#title-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000833;
}

#title-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-conic-gradient(#001155 0% 25%, #000833 0% 50%) 0 0 / 40px 40px;
    animation: checkerScroll 4s linear infinite;
    opacity: 0.4;
}

@keyframes checkerScroll {
    to { background-position: 40px 40px; }
}

#title-content {
    position: relative;
    text-align: center;
    z-index: 1;
}

#title-text {
    font-size: clamp(24px, 6vw, 48px);
    color: #FFD700;
    text-shadow: 4px 4px 0 #CC6600, 6px 6px 0 #000;
    line-height: 1.3;
    margin-bottom: 16px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

#title-subtitle {
    font-size: clamp(10px, 2.5vw, 16px);
    color: #00CC00;
    text-shadow: 2px 2px 0 #006600;
    margin-bottom: 40px;
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

#start-prompt {
    font-size: clamp(8px, 2vw, 13px);
    color: #fff;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #000;
}

#controls-info {
    font-size: clamp(6px, 1.5vw, 9px);
    color: #88AAFF;
    line-height: 2;
    text-shadow: 1px 1px 0 #000;
}

#high-score-display {
    margin-top: 20px;
    font-size: 8px;
    color: #FFD700;
    text-shadow: 1px 1px 0 #000;
}

/* Game Over / Zone Clear */
#game-over-screen, #zone-clear-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
}

.hidden {
    display: none !important;
}

#game-over-text {
    font-size: clamp(20px, 5vw, 40px);
    color: #FF3333;
    text-shadow: 4px 4px 0 #880000;
    margin-bottom: 30px;
}

#zone-clear-text {
    font-size: clamp(20px, 5vw, 40px);
    color: #FFD700;
    text-shadow: 4px 4px 0 #CC6600;
    margin-bottom: 30px;
}

#game-over-stats, #zone-clear-stats {
    font-size: clamp(8px, 2vw, 12px);
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    line-height: 2.5;
    margin-bottom: 30px;
    text-align: center;
}

#retry-prompt, #zone-clear-prompt {
    font-size: clamp(8px, 2vw, 11px);
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    pointer-events: none;
}

#joystick-area {
    pointer-events: auto;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-stick {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
    position: absolute;
}

#mobile-buttons {
    pointer-events: auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#mobile-buttons button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#btn-jump {
    background: rgba(0, 100, 255, 0.4);
}

#btn-boost {
    background: rgba(255, 50, 50, 0.4);
    margin-bottom: 20px;
}

/* Footer */
#game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px;
    z-index: 200;
    background: rgba(0,0,0,0.7);
}

#game-footer a {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #88AAFF;
    text-decoration: none;
}

#game-footer a:hover {
    color: #FFD700;
}

@media (max-width: 768px) {
    #hud-center { font-size: 10px; }
    #hud-left, #hud-right { font-size: 8px; }
    #hud-bottom { font-size: 7px; bottom: 140px; }
}