:root {
    --bg: #0f1720;
    --surface: #172230;
    --fg: #f4f7fb;
    --muted: #90a4b7;
    --border: #263544;
    --accent: #5be36a;
    --accent-fg: #08240d;
    --food: #ff6b6b;
    --radius: 14px;
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    background: radial-gradient(circle at top, #1b2a3a 0%, var(--bg) 70%);
    color: var(--fg);
    font-family: var(--font-sans);
    display: grid;
    place-items: center;
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
    padding: 1.5rem;
}

.game-wrap {
    text-align: center;
    max-width: 30rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    letter-spacing: -0.02em;
    margin: 0;
}

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

.score-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1.4rem;
    min-width: 6rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

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

.score-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.board-shell {
    position: relative;
    width: min(400px, 90vw);
    height: min(400px, 90vw);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
    background: #0c141c;
}

#game {
    display: block;
    width: 100%;
    height: 100%;
    background: #0c141c;
    image-rendering: pixelated;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 22, 0.85);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.5rem;
    text-align: center;
    transition: opacity 0.15s ease;
}

.overlay.hidden {
    display: none;
}

.overlay-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.overlay-text {
    color: var(--muted);
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
}

.btn {
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.65rem 1.6rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 6px 16px -6px rgba(91, 227, 106, 0.6);
}

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

.btn:active {
    transform: translateY(0);
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

@media (max-width: 480px) {
    .scoreboard {
        gap: 0.6rem;
    }

    .score-box {
        min-width: 5rem;
        padding: 0.5rem 0.9rem;
    }
}
