:root {
    /* Dark Mode (Default) */
    --bg-color: #0d0d15;
    --primary-color: #00f3ff;
    --secondary-color: #ff00ff;
    --accent-color: #ffcc00;
    --text-color: #ffffff;
    --panel-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 243, 255, 0.1);
    --font-main: 'Rajdhani', sans-serif;
    --font-display: 'Orbitron', sans-serif;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-color: #f0f2f5;
    --primary-color: #0077cc; /* Darker Blue */
    --secondary-color: #d100d1; /* Darker Magenta */
    --accent-color: #e6b800; /* Darker Yellow */
    --text-color: #333333;
    --panel-bg: rgba(0, 0, 0, 0.05);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.game-container {
    position: relative;
    width: 800px;
    max-width: 100%;
}

.game-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--panel-bg);
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    backdrop-filter: blur(5px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.stat-box {
    text-align: center;
}

.label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    letter-spacing: 1px;
}

.value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--primary-color);
    /* Remove text-shadow in light mode via JS or specific CSS if needed, 
       but we keep it subtle or use the variable */
    text-shadow: 0 0 10px var(--primary-color); 
}

/* In light mode, reduce the glow intensity for readability */
body.light-mode .value {
    text-shadow: none;
}

canvas {
    display: block;
    /* We'll handle canvas background in JS or use a transparent canvas with CSS background */
    background: radial-gradient(circle at center, #1a1a2e 0%, #0d0d15 100%); 
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 0 20px var(--shadow-color);
    margin: 0 auto;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

body.light-mode canvas {
    background: radial-gradient(circle at center, #ffffff 0%, #e0e0e0 100%);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 21, 0.9); /* Dark overlay default */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    border-radius: 8px;
}

body.light-mode .overlay {
    background: rgba(240, 242, 245, 0.9);
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

.game-over-title {
    background: linear-gradient(90deg, #ff416c, #ff4b2b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 65, 108, 0.5);
    animation: pulseRed 2s infinite alternate;
}

.victory-title {
    background: linear-gradient(90deg, #8eff63, #6bff4b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(142, 255, 99, 0.5);
    animation: pulseGreen 2s infinite alternate;
}

.level-up-title {
    background: linear-gradient(90deg, #00f3ff, #0077ff); /* Cyan to Blue */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    animation: pulseBlue 0.8s infinite alternate;
    font-size: 3.5rem; /* Slightly larger */
}

p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: var(--text-color);
    opacity: 0.8;
}

.glow-btn {
    padding: 15px 40px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

body.light-mode .glow-btn {
    box-shadow: none;
    font-weight: bold;
}

.glow-btn:hover {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
    transform: scale(1.05);
}

body.light-mode .glow-btn:hover {
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 119, 204, 0.4);
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulseRed {
    0% { text-shadow: 0 0 10px rgba(255, 65, 108, 0.5); }
    50% { text-shadow: 0 0 30px rgba(255, 65, 108, 1); }
    100% { text-shadow: 0 0 10px rgba(255, 65, 108, 0.5); }
}

@keyframes pulseGreen {
    0% { text-shadow: 0 0 10px rgba(142, 255, 99, 0.5); }
    50% { text-shadow: 0 0 30px rgba(142, 255, 99, 1); }
    100% { text-shadow: 0 0 10px rgba(142, 255, 99, 0.5); }
}

@keyframes pulseBlue {
    0% { text-shadow: 0 0 10px rgba(0, 243, 255, 0.5); transform: scale(1); }
    100% { text-shadow: 0 0 40px rgba(0, 243, 255, 1); transform: scale(1.05); }
}

/* Theme Toggle Button */
.theme-toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

body.light-mode .theme-btn {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-btn:hover {
    transform: rotate(30deg);
    background: var(--primary-color);
    color: #fff;
}
