:root {
    color-scheme: dark;
    --background: #191b18;
    --ink: #f3ecdf;
    --muted: #c1bdac;
    --edge: #4c5147;
    --accent: #d9b47b;
    font-family: system-ui, sans-serif;
    background: var(--background);
    color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.layout { width: min(100% - 2rem, 67rem); margin: 0 auto; padding: 1.6rem 0 2.5rem; }
header { margin-bottom: 1.4rem; }
h1, h2 { font-family: Georgia, serif; font-weight: 400; margin: 0; }
h1 { font-size: clamp(2.75rem, 7vw, 4.5rem); letter-spacing: -.045em; line-height: 1; }
header p { color: var(--muted); margin: .65rem 0 0; }
.lobby {
    width: min(100%, 34rem);
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--edge);
    border-radius: .4rem;
}
.lobby label { display: block; margin-bottom: .55rem; }
.lobby input, .lobby select {
    min-width: 0;
    padding: .5rem .65rem;
    border: 1px solid var(--edge);
    border-radius: .3rem;
    background: var(--background);
    color: var(--ink);
    font: inherit;
}
.rival-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: .5rem 1rem;
    margin-bottom: .7rem;
}
.rival-fields select {
    appearance: none;
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding-right: 1.75rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
#opponents form { margin-top: .8rem; }
#bot-status { margin-bottom: 0; }
#opponent { color: var(--muted); }
#minutes { width: 5.5rem; }
#invite-link { flex: 1 1 12rem; }
#invite-status { margin-bottom: 0; color: var(--muted); }
.match-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-bottom: .8rem; }
.match-bar strong { margin-right: auto; }
.clock {
    padding: .35rem .55rem;
    border: 1px solid var(--edge);
    border-radius: .3rem;
    font-size: .9rem;
}
.clock span { font-variant-numeric: tabular-nums; }
.clock.active { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
#new { color: var(--accent); align-self: center; }
.playing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15.5rem, .45fr); gap: clamp(1.1rem, 4vw, 2.7rem); align-items: start; }
.board-frame {
    display: grid;
    grid-template: 1rem auto / 1rem minmax(0, 1fr);
    padding: .45rem .9rem .9rem .45rem;
    background: #a97b4e;
    color: #261b12;
    border: 1px solid #dbb589;
    border-radius: .35rem;
}
.coordinates { display: grid; place-items: center; font: 600 clamp(.48rem, 1.65vw, .71rem)/1 system-ui, sans-serif; }
.columns { grid-column: 2; grid-template-columns: repeat(19, 1fr); }
.rows { grid-row: 2; grid-template-rows: repeat(19, 1fr); }
.board {
    grid-area: 2 / 2;
    position: relative;
    aspect-ratio: 1;
    background: radial-gradient(ellipse at 30% 25%, #e0b380, #bf8e60);
    isolation: isolate;
}
.grid-lines {
    position: absolute;
    inset: calc(50% / 19);
    background-image: linear-gradient(to right, #543922b3 1px, transparent 1px), linear-gradient(to bottom, #543922b3 1px, transparent 1px);
    background-size: calc(100% / 18) calc(100% / 18);
    box-shadow: 1px 1px #543922b3;
}
.star { position: absolute; width: 1%; aspect-ratio: 1; border-radius: 50%; background: #543922; transform: translate(-50%, -50%); }
.points { position: absolute; inset: 0; display: grid; grid-template: repeat(19, 1fr) / repeat(19, 1fr); }
.regions { position: absolute; inset: calc(50% / 19); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); border: 1px solid #69472e; }
.region {
    display: grid;
    place-items: center;
    border: 1px solid #69472e;
    background: #6f4c362b;
    font: 600 clamp(1.8rem, 9vw, 5rem)/1 Georgia, serif;
    color: #3d261d;
}
.region.active { background: #fff0aa35; border-color: #6b5930; }
.region[data-owner="1"] { color: #fff6db; background: #fdeccc77; }
.region[data-owner="2"] { color: #251b14; background: #52362677; }
.point {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}
.point:focus-visible { outline: 2px solid #295771; outline-offset: -1px; z-index: 1; }
.point.legal, .point.markable { cursor: pointer; }
.point.hint::before {
    content: "";
    width: 26%;
    aspect-ratio: 1;
    border: 1px solid #4a4026;
    border-radius: 50%;
    background: #f8d89c;
}
.point.legal:hover::before { content: ""; width: 68%; aspect-ratio: 1; border-radius: 50%; background: #fff2d895; }
.stone, .sample { display: grid; place-items: center; border-radius: 50%; aspect-ratio: 1; }
.stone { width: 88%; font: 700 clamp(.46rem, 1.8vw, 1rem)/1 system-ui, sans-serif; }
.white { background: radial-gradient(circle at 33% 26%, #fffdf4, #d9caaa 82%); color: #392e26; box-shadow: 0 1px 2px #3b251c, inset 0 0 0 1px #fffbeb; }
.black { background: radial-gradient(circle at 33% 26%, #55534b, #171814 75%); color: #fff2d8; box-shadow: 0 1px 2px #34251d, inset 0 0 0 1px #272820; }
.point.last .stone { outline: 2px solid #ac3429; outline-offset: -2px; }
.point.dead .stone { opacity: .43; }
.point.dead::after { content: "×"; position: absolute; color: #631b13; font-size: clamp(.75rem, 3vw, 1.3rem); font-weight: 800; }
.controls { border-top: 1px solid var(--accent); padding-top: 1rem; }
.phase { color: var(--accent); margin: 0 0 .55rem; font-size: .83rem; text-transform: uppercase; letter-spacing: .12em; }
.turn { display: flex; gap: .6rem; align-items: center; }
.turn h2 { font-size: 1.8rem; }
.sample { width: 1.2rem; flex: none; }
#guidance { color: var(--muted); margin: .6rem 0 1rem; line-height: 1.5; }
.message { color: #ffb59c; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions button {
    border: 1px solid var(--edge);
    background: #282d24;
    border-radius: .25rem;
    padding: .55rem .75rem;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
.actions button:hover { border-color: var(--accent); }
.actions #continue, .actions #approve { background: var(--accent); color: #191b18; }
.results { border-top: 1px solid var(--edge); margin: 1.15rem 0 .75rem; }
.results div { display: grid; grid-template-columns: 5.8rem auto; padding: .6rem 0; border-bottom: 1px solid var(--edge); }
dt { color: var(--muted); }
dd { margin: 0; }
.captures { font-size: .875rem; color: var(--muted); }
.secondary { margin-top: 1rem; }
.secondary button { padding: .45rem .6rem; font-size: .875rem; background: transparent; }
table { width: 100%; font-size: .875rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { padding: .5rem 0; color: var(--muted); text-align: left; }
th, td { padding: .35rem .2rem; text-align: right; }
tr > :first-child { text-align: left; }
details { border-top: 1px solid var(--edge); margin-top: 1.4rem; padding-top: .85rem; }
summary { cursor: pointer; color: var(--muted); }
details p { max-width: 67ch; line-height: 1.55; }
@media (max-width: 730px) {
    .playing { grid-template-columns: 1fr; }
    .board-frame { padding: .25rem .48rem .48rem .25rem; }
}

