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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: crosshair;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Title overlay */
#title-overlay {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    transition: opacity 1.5s ease;
}

#title-overlay.faded {
    opacity: 0.15;
}

#title-overlay h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        0 0 10px rgba(255, 100, 200, 0.9),
        0 0 30px rgba(255, 50, 150, 0.6),
        0 0 60px rgba(200, 50, 255, 0.4),
        0 0 100px rgba(100, 100, 255, 0.3),
        0 4px 0 rgba(255, 50, 150, 0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 10px rgba(255, 100, 200, 0.9),
            0 0 30px rgba(255, 50, 150, 0.6),
            0 0 60px rgba(200, 50, 255, 0.4),
            0 0 100px rgba(100, 100, 255, 0.3),
            0 4px 0 rgba(255, 50, 150, 0.3);
    }
    100% {
        text-shadow:
            0 0 10px rgba(100, 200, 255, 0.9),
            0 0 30px rgba(50, 150, 255, 0.6),
            0 0 60px rgba(50, 100, 255, 0.4),
            0 0 100px rgba(150, 50, 255, 0.3),
            0 4px 0 rgba(50, 150, 255, 0.3);
    }
}

#title-overlay p {
    margin-top: 16px;
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.45rem, 1vw, 0.6rem);
    font-weight: 400;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
    text-shadow: 0 0 8px rgba(255, 100, 200, 0.3);
}

/* HUD */
#hud {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(100, 200, 255, 0.3);
    border-radius: 4px;
    z-index: 10;
    box-shadow:
        0 0 10px rgba(100, 200, 255, 0.15),
        inset 0 0 15px rgba(100, 200, 255, 0.05);
}

.hud-separator {
    width: 2px;
    height: 28px;
    background: rgba(100, 200, 255, 0.2);
    box-shadow: 0 0 4px rgba(100, 200, 255, 0.3);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
}

.hud-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.35rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(100, 200, 255, 0.5);
    text-shadow: 0 0 6px rgba(100, 200, 255, 0.3);
}

.hud-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 8px rgba(100, 200, 255, 0.5);
    font-variant-numeric: tabular-nums;
}

.hud-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(100, 200, 255, 0.7);
    background: rgba(100, 200, 255, 0.08);
    border: 2px solid rgba(100, 200, 255, 0.3);
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(100, 200, 255, 0.4);
}

.hud-btn:hover {
    color: rgba(255, 255, 255, 1);
    background: rgba(100, 200, 255, 0.2);
    border-color: rgba(100, 200, 255, 0.6);
    box-shadow: 0 0 12px rgba(100, 200, 255, 0.3);
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.8);
}

.hud-btn:active {
    transform: scale(0.95);
}

.hud-btn.destruction {
    color: rgba(255, 80, 80, 0.8);
    border-color: rgba(255, 80, 80, 0.3);
    background: rgba(255, 80, 80, 0.08);
    text-shadow: 0 0 6px rgba(255, 80, 80, 0.4);
}

.hud-btn.destruction:hover {
    color: rgba(255, 120, 120, 1);
    background: rgba(255, 80, 80, 0.2);
    border-color: rgba(255, 80, 80, 0.6);
    box-shadow: 0 0 12px rgba(255, 80, 80, 0.3);
    text-shadow: 0 0 10px rgba(255, 80, 80, 0.8);
}

/* Controls hint */
#controls-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.4rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: rgba(100, 200, 255, 0.25);
    text-shadow: 0 0 6px rgba(100, 200, 255, 0.15);
    pointer-events: none;
    z-index: 10;
    transition: opacity 2s ease;
}

/* Mobile tweaks */
@media (max-width: 600px) {
    #title-overlay {
        top: 24px;
    }

    #hud {
        bottom: 16px;
        gap: 10px;
        padding: 8px 16px;
    }

    .hud-item {
        min-width: 36px;
    }

    .hud-btn {
        padding: 6px 12px;
        font-size: 0.6rem;
    }

    #controls-hint {
        display: none;
    }
}
