:root {
    --bg: #1f1d1a;
    --panel: #2b2824;
    --text: #e8e4dc;
    --muted: #9b958a;
    --accent: #b58863;
    --danger: #c0392b;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

nav {
    display: flex;
    gap: 1.25rem;
    padding: .75rem 1rem;
    background: var(--panel);
}

nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); }

main { padding: 1rem; }

.game {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
}

.board-wrap { width: min(92vw, calc(100vh - 10rem), 720px); }
.board { width: 100%; aspect-ratio: 1; }

aside {
    width: min(92vw, 280px);
    background: var(--panel);
    border-radius: 8px;
    padding: 1rem;
}

aside h1 { font-size: 1.1rem; margin: 0 0 .5rem; }

.status { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin: 0 0 .75rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--danger); }
.dot.online { background: #4caf50; }

.moves {
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    padding-left: 2rem;
    font-variant-numeric: tabular-nums;
}
.moves li { padding: .15rem 0; }
.moves li.black { color: var(--muted); }

.admin { max-width: 32rem; margin: 2rem auto; }
.flash { background: #2e4a2e; padding: .5rem .75rem; border-radius: 6px; }

button.danger {
    background: var(--danger);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: .7rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
}

.board-box { position: relative; }

.player {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .1rem;
    font-weight: 600;
    color: var(--muted);
}
.player::before {
    content: '';
    width: .9rem;
    height: .9rem;
    border-radius: 50%;
    border: 1px solid var(--muted);
}
.player[data-player="white"]::before { background: #fff; }
.player[data-player="black"]::before { background: #000; }
.player.active { color: var(--text); }
.player.active::before { box-shadow: 0 0 0 3px var(--accent); }
.player .unnamed { font-weight: 400; font-style: italic; }

.name-form { display: flex; gap: .5rem; margin: 0 0 .75rem; }
.name-form input {
    flex: 1;
    min-width: 0;
    padding: .4rem .6rem;
    border: 1px solid #4a453e;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.name-form button {
    padding: .4rem .8rem;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.promotion {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2%;
    background: rgb(0 0 0 / .6);
}
.promotion[hidden] { display: none; }

.promotion button {
    width: 18%;
    aspect-ratio: 1;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background-color: #d6cfc2;
    cursor: pointer;
}
.promotion piece {
    position: static;
    display: block;
    width: 80%;
    height: 80%;
    margin: auto;
}
.promotion button:hover { background-color: #fff; }

.error { color: #ff8a80; margin: 0 0 .75rem; }
.error[hidden] { display: none; }

.pgn {
    white-space: pre-wrap;
    background: var(--panel);
    padding: .75rem;
    border-radius: 6px;
}

.prompt-link { margin: 0 0 .75rem; }
.prompt-link a, .prompt-page a { color: var(--accent); }

.prompt-page { max-width: 52rem; margin: 1rem auto; }
.prompt-page h1 { font-size: 1.4rem; }
.prompt-page .warning { color: var(--muted); font-size: .9rem; }
.prompt-page .copy {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: .6rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
}
.prompt {
    background: var(--panel);
    border-radius: 8px;
    padding: 1rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .85rem;
    line-height: 1.45;
}
