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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #fcebc7;
    font-family: 'Nunito', 'Fredoka One', sans-serif;
}

canvas {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1; /* Overlay at z-index 100 will always be on top */
}

/* ── HUD ── */
#hud {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

#hud-level {
    background: rgba(255, 255, 255, 0.88);
    border: 3px solid #111;
    border-radius: 50px;
    padding: 8px 28px;
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #222;
    box-shadow: 4px 4px 0 #111;
    letter-spacing: 1px;
}

#crosshair {
    position: fixed;
    top: 50vh;
    left: 50vw;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid black;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 50;
    pointer-events: none;
}

/* ── Controls Hint ── */
#instructions {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
    background: rgba(255,255,255,0.82);
    border: 3px solid #111;
    border-radius: 16px;
    padding: 14px 20px;
    box-shadow: 4px 4px 0 #111;
}

#instructions p {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 6px;
}

#instructions p:last-child {
    margin-bottom: 0;
}

/* ── Level Overlay ── */
#level-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

#overlay-card {
    background: #fff9e6;
    border: 4px solid #111;
    border-radius: 24px;
    box-shadow: 8px 8px 0 #111;
    padding: 50px 60px;
    text-align: center;
    max-width: 480px;
    width: 90%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

#overlay-title {
    font-family: 'Fredoka One', cursive;
    font-size: 36px;
    color: #111;
    line-height: 1.2;
    margin-bottom: 30px;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.12);
}

.overlay-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #fff;
    border: 3px solid #111;
    border-radius: 50px;
    padding: 14px 42px;
    cursor: pointer;
    box-shadow: 4px 4px 0 #111;
    transition: transform 0.1s, box-shadow 0.1s;
    letter-spacing: 1px;
    width: 100%;
}

.overlay-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #111;
}

.overlay-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #111;
}

#overlay-btn-3d {
    background: #d92b2b; /* Solo red */
}

#overlay-btn-2d {
    background: #2b82d9; /* Co-op blue */
}
