* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #06060c;
    margin: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #e0e0e0;
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

#backBtn {
    position: fixed;
    top: 14px;
    left: 16px;
    z-index: 20;
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

#backBtn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

#ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

#score {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255,255,255,0.3);
    opacity: 0;
    transition: opacity 0.3s;
}
#score.visible { opacity: 1; }

#highscore {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: #99a;
    opacity: 0;
    transition: opacity 0.3s;
}
#highscore.visible { opacity: 1; }

#phaseLabel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    color: rgba(255,255,255,0.5);
    opacity: 0;
    transition: opacity 0.6s;
    pointer-events: none;
    text-transform: uppercase;
}
#phaseLabel.visible { opacity: 1; }

#dashBar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}
#dashBar.visible { opacity: 1; }

#dashFill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff6644, #ff8866);
    border-radius: 3px;
    transition: width 0.1s;
}

#shieldIcon {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
#shieldIcon.visible { opacity: 1; }

/* Overlays */
#overlay, #deathOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    z-index: 10;
    overflow-y: auto;
    padding: 40px 20px;
}
#overlay.visible, #deathOverlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#overlay h1, #deathOverlay h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 8px;
    margin-bottom: 12px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
#overlay h1 { color: #ff6644; }
#deathOverlay h1 { color: #ff4444; }

#overlay p, #deathOverlay p {
    font-size: 16px;
    color: #ccd;
    margin-bottom: 8px;
}

.controls {
    font-size: 13px !important;
    color: #aab !important;
    margin-bottom: 20px !important;
}

button {
    margin-top: 8px;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #fff;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
}
button:hover {
    background: rgba(255,255,255,0.95);
    color: #2a5090;
    border-color: #fff;
}

.subtle-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
    padding: 8px 20px;
    color: #99a;
    letter-spacing: 2px;
    margin-top: 16px;
}
.subtle-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}

#menuButtons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
#menuButtons button {
    min-width: 140px;
    border-color: #ff6644;
    color: #ff6644;
}
#menuButtons button:hover {
    background: #ff6644;
    color: #000;
}

input[type="text"] {
    margin-top: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    text-align: center;
    outline: none;
    letter-spacing: 1px;
    width: 200px;
}
input[type="text"]::placeholder { color: #556; }

/* Leaderboard */
#leaderboard {
    margin-top: 24px;
    width: 100%;
    max-width: 400px;
}
#leaderboard h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #667;
    text-align: center;
    margin-bottom: 10px;
}
#leaderList {
    list-style: none;
    padding: 0;
}
#leaderList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
}
.lb-name { color: #dde; font-weight: 600; }
.lb-score { color: #ff8866; font-weight: 700; font-variant-numeric: tabular-nums; }
