:root {
    --board-bg: #a89d6b;
    --board-line: rgba(24, 24, 22, 0.85);
    --page-bg: #f6f1e6;
    --ink: #1f1f1d;
    --muted: #6a655d;
    --cell-size: 32px;
    --stone-size: 24px;
    --board-padding: 26px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: var(--page-bg);
    font-family: "Source Sans 3", sans-serif;
    color: var(--ink);
}

h1 {
    font-family: "Libre Baskerville", serif;
    font-size: 1.4rem;
    margin: 4px 0 0;
}

p {
    margin: 0;
}

.game-shell {
    display: grid;
    gap: 18px;
    width: min(900px, 100%);
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.game-eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--muted);
}

.game-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-pill {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(31, 31, 29, 0.12);
    color: var(--ink);
}

.reset-btn {
    border: none;
    background: var(--ink);
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
}

.reset-btn:hover {
    opacity: 0.9;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 24px;
    align-items: start;
}

.game-rules {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(31, 31, 29, 0.12);
    border-radius: 16px;
    padding: 18px 18px 20px;
    box-shadow: 0 12px 30px rgba(31, 31, 29, 0.12);
    color: var(--ink);
}

.game-rules h2 {
    font-family: "Libre Baskerville", serif;
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.game-rules p {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 10px;
}

.rules-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.7rem;
    color: var(--ink);
    margin-top: 12px;
}

.rules-note {
    font-size: 0.85rem;
    color: var(--muted);
}

.toast {
    min-height: 22px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(31, 31, 29, 0.12);
    box-shadow: 0 8px 18px rgba(31, 31, 29, 0.12);
    width: fit-content;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: rgba(255, 236, 236, 0.9);
    border-color: rgba(143, 24, 24, 0.25);
    color: #7a1616;
}

.toast.is-win {
    background: rgba(236, 255, 240, 0.9);
    border-color: rgba(26, 122, 60, 0.25);
    color: #1a6b36;
}

table {
    border-collapse: collapse;
    margin: 0;
    background-color: var(--board-bg);
}

table td {
    border: 1px solid var(--board-line);
    width: var(--cell-size);
    height: var(--cell-size);
}

.circle {
    position: absolute;
    width: var(--stone-size);
    height: var(--stone-size);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.circle.stone-black {
    background: radial-gradient(circle at 30% 30%, #4b4b4b, #0b0b0b 70%);
}

.circle.stone-white {
    background: radial-gradient(circle at 30% 30%, #ffffff, #d9d6cf 70%);
    border: 1px solid rgba(0, 0, 0, 0.18);
}

#game-board {
    position: relative;
}

#game-board-outer {
    display: grid;
    place-items: center;
    padding: var(--board-padding);
    background: linear-gradient(145deg, #b3a770, #9a8f5f);
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(31, 31, 29, 0.18);
    overflow: auto;
    max-width: calc(14 * var(--cell-size) + 2 * var(--board-padding));
}

@media (max-width: 600px) {
    :root {
        --cell-size: 24px;
        --stone-size: 18px;
        --board-padding: 18px;
    }

    #game-board-outer {
        padding: var(--board-padding);
    }

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

    .game-layout {
        grid-template-columns: 1fr;
    }
}
