* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a18;
    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; }

#layerInfo {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 600;
    color: #aabbcc;
    opacity: 0;
    transition: opacity 0.3s;
    letter-spacing: 2px;
}
#layerInfo.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.75);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    z-index: 10;
}

#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: #55ddaa; text-shadow: 0 0 30px rgba(85,221,170,0.4); }
#deathOverlay h1 { color: #ff6666; }

#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: #1a3050;
    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);
}

#finalScore {
    font-size: 34px !important;
    color: #fff !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#finalLayer {
    font-size: 16px !important;
    color: #aab !important;
}

#newBest {
    color: #ffcc00 !important;
    font-size: 14px !important;
    min-height: 20px;
}

#bestScore {
    margin-top: 16px;
    font-size: 13px;
    color: #556;
}
#bestScore span { color: #99aacc; font-weight: 600; }

@media (max-width: 640px) {
    #overlay h1, #deathOverlay h1 { font-size: 32px; letter-spacing: 4px; }
}
