:root {
    --color-bg: #0A1F1C;
    --color-surface: #142C28;
    --color-primary: #00B894;
    --color-secondary: #55EFC4;
    --color-accent: #FDCB6E;
    --color-text: #ECF0F1;
    --color-muted: #95A5A6;

    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 15px rgba(0, 184, 148, 0.4);
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-stack);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent scroll on mobile if fits */
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: var(--shadow-glow);
    margin-bottom: 0.5rem;
}

p {
    color: var(--color-muted);
}

.stats-bar {
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.875rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-secondary);
    font-variant-numeric: tabular-nums;
}

.canvas-wrapper {
    position: relative;
    padding: 10px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0, 184, 148, 0.2);
}

canvas {
    display: block;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md);
    touch-action: none; /* Prevent scrolling on touch */
}

.controls {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn.primary {
    background: var(--color-primary);
    color: var(--color-bg);
}

.btn.primary:hover {
    background: var(--color-secondary);
    box-shadow: var(--shadow-glow);
}

.btn.secondary {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn.secondary:hover {
    background: rgba(0, 184, 148, 0.1);
}

/* Win Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 31, 28, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--color-primary);
    box-shadow: var(--shadow-glow);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-content h2 {
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.overlay-content p {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.overlay-content span {
    color: var(--color-secondary);
    font-weight: 700;
}

.overlay-content button {
    margin-top: 1.5rem;
    width: 100%;
}

.hidden {
    display: none;
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 500px) {
    .game-container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    canvas {
        max-width: 100%;
        height: auto;
    }
}
