body {
    background: #000;
    margin: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}
#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #111;
    border: 2px solid #444;
}

/* HUD container */
#hud { position: absolute; top: 12px; right: 16px; z-index: 20; display: flex; gap: 10px; align-items: center; }

/* Epic page title */
#title {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 30; /* above HUD and canvas */
    pointer-events: none; /* don't block clicks */
}
.title-main {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial;
    font-weight: 800;
    font-size: clamp(28px, 6vw, 64px);
    line-height: 1;
    letter-spacing: 0.02em;
    color: #fff;
    /* gradient text */
    background: linear-gradient(90deg, #ffe28a 0%, #ff7a7a 35%, #7ad9ff 70%, #d6b8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow:
        0 6px 30px rgba(58, 22, 90, 0.6),
        0 2px 8px rgba(0,0,0,0.6);
    filter: drop-shadow(0 10px 22px rgba(120,50,200,0.35));
    transform-origin: center;
}
.title-sub {
    margin-top: 6px;
    font-family: system-ui, sans-serif;
    font-size: clamp(12px, 1.4vw, 18px);
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 6px rgba(0,0,0,0.45);
    opacity: 0.95;
    pointer-events: none;
}

/* Level display */
#levelDisplay { color: #fff; font-family: system-ui, sans-serif; font-size: 18px; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.06); box-shadow: 0 2px 8px rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
/* Lives display (same area as level) */
#livesDisplay { color: #00ff66; font-family: system-ui, sans-serif; font-weight: 700; font-size: 18px; background: linear-gradient(180deg, rgba(0,255,102,0.06), rgba(0,255,102,0.02)); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(0,255,102,0.12); box-shadow: 0 6px 20px rgba(0,255,102,0.08), 0 2px 8px rgba(0,0,0,0.6); backdrop-filter: blur(4px); text-shadow: 0 2px 8px rgba(0,255,102,0.08); }

/* Stylized Story button */
#storyButton {
    appearance: none;
    -webkit-appearance: none;
    background: radial-gradient(circle at 30% 20%, #2ec1ff 0%, #1b9edc 35%, #0f6ea8 100%);
    color: white;
    font-family: system-ui, sans-serif;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 6px 14px rgba(16,78,120,0.45), inset 0 -2px 6px rgba(0,0,0,0.25);
    cursor: pointer;
    transform: translateY(0);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
#storyButton:hover { transform: translateY(-3px); filter: brightness(1.05); box-shadow: 0 10px 18px rgba(16,78,120,0.5); }
#storyButton:active { transform: translateY(0); box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
#storyButton:focus { outline: 2px solid rgba(46,193,255,0.35); outline-offset: 3px; }

/* Mute button bottom-left */
/* mute control is a non-focusable div to avoid stealing keyboard focus */
#muteButton {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 30;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #222, #111);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 14px rgba(0,0,0,0.6);
    cursor: pointer;
    font-size: 18px;
}
#muteButton:hover { transform: translateY(-2px); filter: brightness(1.08); }
#muteButton.muted { background: linear-gradient(180deg, #440000, #220000); color: #ffcccc; }

/* ensure it doesn't receive keyboard focus styling */
#muteButton:focus { outline: none; }

/* Game Over overlay */
/* Generic centered overlay (used for both start modal and game over) */
#gameOverOverlay, #startModal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 100; }
#startModal[aria-hidden="false"], #gameOverOverlay[aria-hidden="false"] { display: flex; }
#gameOverOverlay .overlay-content, #startModal .overlay-content { background: rgba(8,8,12,0.92); color: #fff; padding: 22px 28px; border-radius: 12px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.04); font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif; max-width: 680px; margin: 12px; }
#gameOverOverlay h1, #startModal h1 { margin: 0 0 6px 0; font-size: 36px; font-weight: 700; letter-spacing: -0.01em; }
#gameOverOverlay p, #startModal p { margin: 8px 0; color: rgba(255,255,255,0.95); }
#startModal .muted-note { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 6px; }
#gameOverOverlay .overlay-button, #startModal .overlay-button { margin-top: 12px; padding: 10px 18px; font-size: 16px; border-radius: 10px; border: none; background: linear-gradient(180deg,#3ad976,#06a763); color: #fff; cursor: pointer; }
#gameOverOverlay .overlay-button:hover, #startModal .overlay-button:hover { filter: brightness(1.05); transform: translateY(-2px); }
