:root {
    --bg: #050505;
    --surface: rgba(17, 17, 17, 0.92);
    --surface-strong: #141414;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f3f3f3;
    --muted: #a0a0a7;
    --accent: #c2186b;
    --accent-soft: rgba(194, 24, 107, 0.18);
    --light-square: #f1dfc0;
    --dark-square: #7f5539;
    --light-square-active: #f8ec8f;
    --dark-square-active: #a67845;
    --legal-ring: rgba(194, 24, 107, 0.9);
}

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

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(194, 24, 107, 0.14), transparent 28rem),
        linear-gradient(180deg, #080808 0%, #030303 100%);
    color: var(--text);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.game-shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.game-header {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    backdrop-filter: blur(18px);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.back-link {
    width: fit-content;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.back-link:hover,
.back-link:focus-visible {
    border-color: rgba(194, 24, 107, 0.45);
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    outline: none;
}

.header-copy h1 {
    font-size: clamp(2.4rem, 7vw, 4.6rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.header-copy p:last-child {
    max-width: 48ch;
    margin-top: 0.85rem;
    color: var(--muted);
}

.section-tag {
    margin-bottom: 0.4rem;
    color: var(--accent);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
}

.lang-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.lang-button:hover,
.lang-button:focus-visible,
.lang-button.is-active {
    background: rgba(194, 24, 107, 0.16);
    color: var(--text);
}

.lang-button:focus-visible {
    outline: 2px solid rgba(194, 24, 107, 0.4);
    outline-offset: 2px;
}

.lang-button.is-active {
    transform: translateY(-1px);
}

.flag {
    font-size: 1rem;
    line-height: 1;
}

.lang-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 1rem;
}

.board-panel,
.info-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    backdrop-filter: blur(18px);
}

.board-panel {
    padding: 1rem;
}

.board-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-copy {
    display: grid;
    gap: 0.25rem;
}

#status {
    font-size: 1rem;
    font-weight: 500;
}

#status-detail {
    color: var(--muted);
    font-size: 0.95rem;
}

.reset-button {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(194, 24, 107, 0.35);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.reset-button:hover,
.reset-button:focus-visible {
    border-color: rgba(194, 24, 107, 0.6);
    background: var(--accent-soft);
    outline: none;
}

.board-frame {
    padding: 0.8rem;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.18));
}

.board {
    width: min(100%, 520px);
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.board img {
    filter: drop-shadow(0 0.24rem 0.28rem rgba(0, 0, 0, 0.24));
}

.board .white-1e1d7 {
    background-color: var(--light-square);
    color: #2f241b;
}

.board .black-3c85d {
    background-color: var(--dark-square);
    color: #f7efe2;
}

.info-panel {
    display: grid;
    gap: 1rem;
}

.info-card {
    padding: 1.2rem;
}

.info-card p:last-child {
    color: var(--muted);
}

@media (max-width: 860px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .game-shell {
        width: min(100% - 1rem, 100%);
        padding-top: 1rem;
    }

    .game-header,
    .board-panel,
    .info-card {
        border-radius: 20px;
    }

    .board-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .reset-button {
        width: 100%;
    }

    .board {
        width: min(100%, 360px);
    }
}
