:root {
    --bg-color: #0f172a;
    --canvas-bg: #1e293b;
    --text-primary: #f8fafc;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --star-color: #fbbf24;
    --spike-color: #ef4444;
    --health-fill: #10b981;
    --health-bg: #334155;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 75vw;
    max-width: 800px;
    max-height: 600px;
    border-radius: 16px;
    box-shadow: 0 0 40px var(--accent-glow), 0 0 100px rgba(0,0,0,0.5);
    background-color: var(--canvas-bg);
    overflow: hidden;
}

@media (min-aspect-ratio: 4/3) {
    #game-container {
        width: 133.33vh;
        height: 100vh;
    }
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    /* Subtly grain or pattern could go here, but canvas handles the draw */
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass to canvas if needed */
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.8), transparent);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.stats-left, .stats-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-right {
    align-items: flex-end;
}

.lives-container {
    display: flex;
    gap: 4px;
    font-size: 24px;
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.heart {
    transition: transform 0.2s ease;
}

.heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

.health-bar-bg {
    width: 120px;
    height: 10px;
    background-color: var(--health-bg);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.health-bar-fill {
    width: 100%;
    height: 100%;
    background-color: var(--health-fill);
    transition: width 0.3s ease, background-color 0.3s ease;
}

.stars-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--star-color);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.level-container {
    font-size: 18px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#game-over-screen {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#game-over-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#game-over-title {
    font-size: 64px;
    font-weight: 900;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
}

#game-over-message {
    font-size: 24px;
    color: #cbd5e1;
    margin-bottom: 32px;
}

#restart-btn {
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    background: var(--text-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(255,255,255,0.25);
    font-family: inherit;
}

#restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,255,255,0.4);
}

#restart-btn:active {
    transform: translateY(0);
}


