:root {
    color-scheme: dark;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #05070f;
    --fg: #f5f8ff;
    --muted: #8990b8;
    --accent: #ffb347;
    --accent-strong: #ffd166;
    --panel-bg: rgba(14, 20, 42, 0.92);
    --border: rgba(255, 255, 255, 0.08);
    --grid-line: rgba(255, 255, 255, 0.06);
}

html[data-lang="en"] {
    --accent: #77ffe0;
    --accent-strong: #9fffe0;
}

html[data-lang="fr"] {
    --accent: #ff6fb7;
    --accent-strong: #ffd6ff;
}

html[data-lang="de"] {
    --accent: #5b8def;
    --accent-strong: #92c7ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(91, 141, 239, 0.18), transparent 50%), var(--bg);
    color: var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.shell {
    width: min(960px, 100%);
    display: grid;
    gap: 24px;
}

.masthead {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    padding: 20px;
    border-radius: 18px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
}

.masthead__brand h1 {
    margin: 0 0 6px;
}

.masthead__brand p {
    margin: 0;
    color: var(--muted);
}

.masthead__stats {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.stat {
    text-align: center;
}

.stat__label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat__value {
    font-size: 24px;
    font-weight: 700;
}

.masthead__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

#startButton,
#resetButton {
    width: 72px;
    height: 72px;
    padding: 0;
    border-radius: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primary,
.ghost,
.lang-btn {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: var(--fg);
    padding: 10px 22px;
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border: none;
    color: #0b1224;
}

.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.ghost:hover,
.lang-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.lang-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 14px;
}

.lang-btn.is-active {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.masthead__langs {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.playfield {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
}

.stage {
    background: var(--panel-bg);
    border-radius: 22px;
    padding: 16px;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
}

#gameCanvas {
    background: rgba(12, 18, 36, 0.8);
    border-radius: 14px;
    border: 1px solid var(--grid-line);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

.hud {
    background: var(--panel-bg);
    border-radius: 22px;
    border: 1px solid var(--border);
    padding: 20px;
    display: grid;
    gap: 18px;
    min-width: 220px;
}

.hud__section h2 {
    margin: 0 0 10px;
}

.controls {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.controls li {
    margin-bottom: 6px;
}

.status {
    background: rgba(16, 24, 48, 0.8);
    border-radius: 12px;
    padding: 12px;
    line-height: 1.4;
    min-height: 72px;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 18, 0.85);
    display: grid;
    place-items: center;
    padding: 32px;
    backdrop-filter: blur(6px);
}

.overlay.hidden {
    display: none;
}

.overlay__content {
    background: rgba(14, 20, 38, 0.92);
    border-radius: 20px;
    padding: 28px;
    border: 1px solid var(--border);
    text-align: center;
    display: grid;
    gap: 16px;
    width: min(320px, 100%);
}

@media (max-width: 840px) {
    .playfield {
        grid-template-columns: 1fr;
    }

    .hud {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .masthead {
        grid-template-columns: 1fr;
    }
}
