/* --- Global Reset & Core Styling --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #03030c;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #ffffff;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* --- HUD Layout --- */
#hud {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 2px;
    font-family: monospace;
    transition: opacity 0.3s ease;
}

.score-box {
    color: #00f0ff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.highscore-box {
    color: #e0a000;
    text-shadow: 0 0 10px rgba(224, 160, 0, 0.6);
}

/* --- Menu & Overlay Architecture --- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 3, 12, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 10;
}

.menu-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    border-radius: 16px;
    background: rgba(10, 15, 35, 0.6);
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.1);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: 4px;
    margin-bottom: 10px;
    color: #00f0ff;
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.8);
}

h1.critical {
    color: #ff3c00;
    text-shadow: 0 0 15px rgba(ff, 60, 0, 0.8);
}

.description {
    color: #a0a5c0;
    font-size: 1rem;
    margin-bottom: 30px;
}

.controls-guide {
    text-align: left;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 35px;
    border-left: 3px solid #00f0ff;
}

.controls-guide h3 {
    font-size: 0.9rem;
    color: #8085a0;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.controls-guide p {
    font-size: 0.95rem;
    margin: 8px 0;
    line-height: 1.4;
}

.controls-guide span {
    background: #202540;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #404560;
    font-family: monospace;
}

.final-score-text {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #ffffff;
}

#final-score-val {
    color: #00f0ff;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.restart-tip {
    font-size: 0.85rem;
    color: #606580;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- UI Buttons --- */
.glow-btn {
    background: transparent;
    border: 2px solid #00f0ff;
    color: #00f0ff;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.glow-btn:hover {
    background: #00f0ff;
    color: #03030c;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
    transform: translateY(-2px);
}

.glow-btn:active {
    transform: translateY(1px);
}

.glow-btn.restart-accent {
    border-color: #ffaa00;
    color: #ffaa00;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.2);
}

.glow-btn.restart-accent:hover {
    background: #ffaa00;
    color: #03030c;
    box-shadow: 0 0 25px rgba(255, 170, 0, 0.6);
}

/* --- Utility Classes --- */
.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}