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

* {
    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;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

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

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

#hud div {
    color: #fff;
    font-size: 11px;
    text-shadow: 2px 2px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
    line-height: 1.8;
}

#ring-icon {
    color: #ffd700;
    font-size: 14px;
}

#hud-center {
    text-align: center;
}

#hud-right {
    text-align: right;
}

#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(0,0,20,0.6);
}

#title-content {
    text-align: center;
}

#title-text {
    font-size: clamp(24px, 5vw, 52px);
    color: #ffdd00;
    text-shadow: 4px 4px 0px #cc3300, 6px 6px 0px #000;
    letter-spacing: 4px;
    margin-bottom: 10px;
    animation: titlePulse 2s ease-in-out infinite;
}

#title-subtitle {
    font-size: clamp(10px, 2vw, 18px);
    color: #44ff44;
    text-shadow: 2px 2px 0px #006600, 3px 3px 0px #000;
    margin-bottom: 40px;
}

#start-prompt, #mobile-start-btn {
    font-size: clamp(10px, 2vw, 16px);
    color: #ffffff;
    text-shadow: 2px 2px 0px #000;
    margin-bottom: 30px;
}

#mobile-start-btn {
    display: none;
    padding: 20px 40px;
    background: rgba(255,221,0,0.2);
    border: 2px solid #ffdd00;
    border-radius: 8px;
    margin: 20px auto;
    cursor: pointer;
}

#controls-info {
    font-size: clamp(7px, 1.2vw, 11px);
    color: #aaaacc;
    text-shadow: 1px 1px 0px #000;
    line-height: 2;
}

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

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

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

#game-over-screen, #level-complete-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(0,0,0,0.75);
}

#gameover-text, #complete-text {
    font-size: clamp(20px, 4vw, 42px);
    color: #ff3333;
    text-shadow: 3px 3px 0px #000;
    margin-bottom: 20px;
}

#complete-text {
    color: #ffdd00;
}

#gameover-content, #complete-content {
    text-align: center;
}

#gameover-content div, #complete-content div {
    color: #fff;
    font-size: clamp(8px, 1.5vw, 14px);
    text-shadow: 2px 2px 0px #000;
    line-height: 2.5;
}

#retry-prompt, #complete-prompt {
    margin-top: 20px;
}

#mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    z-index: 50;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

#dpad {
    display: grid;
    grid-template-columns: 50px 50px 50px;
    grid-template-rows: 50px 50px 50px;
    gap: 2px;
    pointer-events: auto;
}

.dpad-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    touch-action: none;
}

.dpad-btn:active {
    background: rgba(255,255,255,0.5);
}

#dpad-center {
    background: none;
    border: none;
}

#dpad-up { grid-column: 2; grid-row: 1; }
#dpad-left { grid-column: 1; grid-row: 2; }
#dpad-center { grid-column: 2; grid-row: 2; }
#dpad-right { grid-column: 3; grid-row: 2; }
#dpad-down { grid-column: 2; grid-row: 3; }

#action-buttons {
    display: flex;
    gap: 12px;
    pointer-events: auto;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,50,50,0.4);
    border: 3px solid rgba(255,100,100,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-family: 'Press Start 2P', monospace;
    touch-action: none;
}

#btn-spin {
    background: rgba(50,100,255,0.4);
    border-color: rgba(100,150,255,0.6);
}

.action-btn:active {
    transform: scale(0.9);
}

#footer {
    position: fixed;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 5;
}

#footer a {
    color: rgba(255,255,255,0.3);
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    text-decoration: none;
}

#footer a:hover {
    color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
    }
    #start-prompt {
        display: none;
    }
    #mobile-start-btn {
        display: block;
    }
    #controls-info {
        display: none;
    }
    #footer {
        display: none;
    }
}

@media (pointer: coarse) {
    #mobile-controls {
        display: flex;
    }
    #start-prompt {
        display: none;
    }
    #mobile-start-btn {
        display: block;
    }
    #controls-info {
        display: none;
    }
}