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

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

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

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- HUD Overlay --- */

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

#score-display {
    color: #fff;
    font-size: 20px;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
}

#powerup-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 10px;
    text-shadow: 1px 1px 0 #000;
}

#powerup-bar .bar-fill {
    width: 80px;
    height: 10px;
    background: #333;
    border-radius: 5px;
    overflow: hidden;
}

#powerup-bar .bar-fill-inner {
    height: 100%;
    background: #0f0;
    transition: width 0.1s linear;
}

/* --- Game Over Screen --- */

#game-over-screen {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    gap: 16px;
    text-align: center;
    padding: 20px;
}

.game-over-title {
    font-size: 32px;
    color: #ff4444;
    text-shadow: 3px 3px 0 #000;
}

.game-over-score {
    font-size: 18px;
}

.game-over-hint {
    font-size: 10px;
    color: #aaa;
    margin-top: 20px;
}

.game-over-leaderboard ol {
    list-style: none;
    padding: 0;
    text-align: left;
    font-size: 11px;
}

.game-over-leaderboard ol li {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 0;
    border-bottom: 1px solid #333;
}

.leaderboard-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.leaderboard-entry input {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 6px 10px;
    background: #222;
    color: #fff;
    border: 2px solid #555;
    text-align: center;
    width: 180px;
}

.leaderboard-entry button {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    padding: 8px 16px;
    background: #0a0;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* Stumble indicator */
#stumble-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff4444;
    font-size: 14px;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
    z-index: 15;
    animation: stumblePulse 0.6s ease-in-out forwards;
}

@keyframes stumblePulse {
    0% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Loading screen */
#loading-screen {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #111;
    color: #fff;
    gap: 16px;
    font-family: 'Press Start 2P', monospace;
}

#loading-screen .loading-bar {
    width: 200px;
    height: 12px;
    background: #333;
    border-radius: 6px;
    overflow: hidden;
}

#loading-screen .loading-bar-fill {
    height: 100%;
    background: #0f0;
    width: 0%;
    transition: width 0.2s;
}

.hidden { display: none !important; }
