:root {
    --bg-color: #121212;
    --text-color: #ffffff;
    --accent-color: #ff4757;
    --score-color: #f1c40f;
    --font-family: 'Poppins', sans-serif;
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    user-select: none;
    touch-action: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let canvas handle input except for buttons */
    z-index: 2;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--overlay-bg);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: all;
}

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

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

#hud {
    background: transparent;
    pointer-events: none;
    justify-content: flex-start;
    padding: 0;
}

#hud .btn-icon {
    pointer-events: auto;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    transition: background 0.3s;
}

#hud .btn-icon:hover {
    background: rgba(255, 255, 255, 0.4);
}

.hud-top {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 20px;
    font-size: 24px;
    font-weight: bold;
    color: var(--score-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.btn {
    padding: 15px 30px;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #ff6b6b, #ee5253);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 10px;
    font-family: var(--font-family);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    background: #333;
    color: #ddd;
    border: 1px solid #555;
    border-radius: 20px;
    cursor: pointer;
}

.title {
    font-size: 4em;
    margin-bottom: 0.5em;
    color: #ff9ff3;
    text-shadow: 0 0 10px #ff9ff3, 0 0 20px #ff9ff3;
}

.subtitle {
    font-size: 1.5em;
    color: #feca57;
    margin-bottom: 2em;
}

#game-over-screen .final-score {
    font-size: 2em;
    margin: 20px 0;
}

#game-over-screen .high-score {
    font-size: 1.5em;
    color: #1dd1a1;
    margin-bottom: 30px;
}

.controls-hint {
    margin-top: 30px;
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.theme-toggle-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

#pause-screen h2 {
    font-size: 3em;
    color: #feca57;
    margin-bottom: 30px;
}

/* Light Theme overrides */
body.light-mode {
    --bg-color: #f5f6fa;
    --text-color: #2f3640;
    --overlay-bg: rgba(255, 255, 255, 0.85);
    --score-color: #e55039;
}

body.light-mode .screen {
    background: var(--overlay-bg);
}

body.light-mode .title {
    color: #d63031;
    text-shadow: none;
}

body.light-mode .controls-hint {
    color: rgba(0, 0, 0, 0.6);
}

body.light-mode #hud .btn-icon {
    border-color: #2f3640;
    color: #2f3640;
    background: rgba(0, 0, 0, 0.1);
}
