:root {
  color-scheme:light;
  --ink:#1c293a;
  --muted:#5e625f;
  --accent:#994236;
  --paper:#f7f4ed;
  --line:#d5cfc1;
  --brass:#b9945c;
  --serif:Georgia,"STSong","Songti SC","SimSun",serif;
  --mono:Consolas,"SFMono-Regular",monospace;
  color:var(--ink);
  background:var(--paper);
  font:16px/1.5 "Microsoft YaHei UI","PingFang SC",system-ui,sans-serif;
}
* {box-sizing:border-box}
body {margin:0;min-height:100vh}
h1,h2,p {margin:0}
button,input,select,textarea {font:inherit}
button {color:inherit;cursor:pointer}
button:disabled {cursor:default;opacity:.45}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {outline:3px solid #ae513e;outline-offset:3px}
[hidden] {display:none!important}
.sr,.skip-table:not(:focus) {position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.skip-table:focus {position:fixed;top:8px;left:8px;z-index:10;padding:8px 14px;background:var(--ink);color:white}
.shell {width:min(1120px,calc(100% - 72px));margin-inline:auto}
.mast-row {display:flex;align-items:center;gap:clamp(18px,5vw,65px);min-height:62px}
.brand,.mast-aside {display:flex;align-items:center}
.brand {gap:9px;color:inherit;text-decoration:none;font:700 1.7rem var(--serif)}
.brand-mark {display:grid;grid-template:repeat(2,8px)/repeat(2,8px);gap:2px}
.brand-mark i {background:currentColor;border-radius:50%}
.brand-mark i:nth-child(2) {border-radius:1px;background:var(--accent)}
.mast-aside {gap:clamp(12px,2.4vw,32px)}
.back-to-show {color:inherit;text-decoration:none;align-content:center;min-height:42px}
.masthead {border-bottom:1px solid var(--line)}

.page-head {display:flex;align-items:center;justify-content:space-between;gap:20px;margin:clamp(20px,3vh,30px) 0 22px;padding-bottom:17px;border-bottom:1px solid #aba89f}
h1 {font:700 clamp(2.4rem,4.2vw,3.6rem)/1.08 var(--serif);letter-spacing:-.055em}
h1 span {display:inline-block;margin-left:.5em;color:#666a65;font-size:.48em;font-weight:500;letter-spacing:.01em}
h2 {font:700 1.35rem/1.3 var(--serif)}
.head-actions,.challenge-actions,.dialog-foot,.primary-actions,.connect-buttons,.input-row {display:flex;align-items:center;gap:8px}
.button {display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:40px;padding:8px 15px;border:1px solid #bbb9b0;border-radius:4px;background:transparent;color:var(--ink);font-size:.86rem;font-weight:650}
.button.primary,.button.primary:focus {border-color:var(--ink);background:var(--ink);color:#fff9eb}
.button.primary:hover:not(:disabled) {background:#31475b}
.secondary:hover:not(:disabled),.light:hover:not(:disabled) {background:#ece8dc;border-color:#958c7c}
.text-action,.show-link {color:var(--muted);font-size:.82rem;text-underline-offset:4px}
.text-action {padding:4px 3px;border:0;background:transparent;text-decoration:underline;text-decoration-color:#b1a79b}
.text-action:hover,.show-link:hover {color:var(--accent);text-decoration-color:currentColor}

.layout {display:grid;grid-template-columns:minmax(0,1.55fr) minmax(290px,.95fr);align-items:start;gap:clamp(30px,5vw,78px);padding-bottom:44px}
.table-card {width:100%;max-width:clamp(448px,calc(100svh - 315px),626px);margin-inline:auto}
.table-heading,.table-name,.board-caption,.side-header,.dialog-head {display:flex;align-items:center;gap:9px}
.table-heading,.side-header,.dialog-head {justify-content:space-between}
.table-heading {margin-bottom:7px;min-height:31px}
.table-name {gap:10px;min-width:0}
.table-name h2 {font-size:1.16rem;overflow-wrap:anywhere}
.kind-label {border-left:2px solid var(--accent);padding-left:7px;color:var(--accent);font-weight:700;font-size:.76rem;white-space:nowrap}
.turn-box {display:flex;align-items:center;gap:9px;min-height:36px;margin:0 1px 8px;color:var(--ink)}
.turn-box>div {display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 13px}
.turn-box strong {font-size:.94rem}
.turn-box p,.secondary-copy,.history-empty {font-size:.84rem;line-height:1.6;color:var(--muted)}
.turn-disc {display:none}
.turn-box[data-color=black] .turn-disc,.turn-box[data-color=white] .turn-disc {display:block;width:14px;height:14px;border-radius:50%;flex:none;background:#26313b;border:1px solid #323b40}
.turn-box[data-color=white] .turn-disc {background:#fffaf0;border-color:#89867b}

.board-surround {
  position:relative;isolation:isolate;padding:clamp(7px,1vw,12px);
  border:1px solid #483226;border-radius:7px;
  background-color:#57402e;
  background-image:repeating-linear-gradient(3deg,transparent 0 3px,#23150a22 4px,transparent 5px 10px),linear-gradient(135deg,#80634b 0%,#4e3527 33%,#715039 65%,#442e22 100%);
  box-shadow:inset 0 0 0 1px #b79a73,inset 0 0 0 3px #513a2c,0 3px 0 #49372b,0 8px 13px -9px #32271ad9,0 17px 32px -23px #32271aa3;
}
.board-frame {
  position:relative;aspect-ratio:1;padding:4.2% 3.2% 3.2% 4.2%;border-radius:2px;background-color:#e4bd89;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='192' viewBox='0 0 320 192'%3E%3Cfilter id='grain' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.009 .26' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .34 0 0 0 0 .22 0 0 0 0 .12 .24 .08 0 0 -.04'/%3E%3C/filter%3E%3Cpath fill='%23715134' filter='url(%23grain)' d='M0 0h320v192H0z'/%3E%3C/svg%3E"),linear-gradient(112deg,#edcfa4 0%,#e7c291 46%,#efcfa1 72%,#e1ba89 100%);
  box-shadow:0 0 0 1px #402c20,inset 0 0 0 1px #ffe1b0,inset 0 0 17px #a678493d;
}
.axis {position:absolute;display:grid;align-items:center;justify-items:center;font:700 clamp(.57rem,.85vw,.73rem)/1 var(--mono);color:#5d4432}
.axis-top {top:0;left:4.2%;right:3.2%;height:4.2%;grid-template-columns:repeat(15,1fr)}
.axis-left {left:0;top:4.2%;bottom:3.2%;width:4.2%;grid-template-rows:repeat(15,1fr)}
.board-grid {--edge:calc(100% / 30);width:100%;height:100%;display:grid;position:relative;grid-template-columns:repeat(15,minmax(0,1fr));grid-template-rows:repeat(15,minmax(0,1fr))}
.board-grid::before {content:"";position:absolute;pointer-events:none;inset:var(--edge);background-image:linear-gradient(to right,#684e39 1px,transparent 1px),linear-gradient(to bottom,#684e39 1px,transparent 1px);background-size:calc(100% / 14) calc(100% / 14);box-shadow:inset -1px -1px #684e39}
.cell {width:100%;height:100%;position:relative;display:grid;place-items:center;padding:0;border:0;background:transparent;cursor:default;border-radius:50%;touch-action:manipulation}
.cell:focus-visible {outline-offset:-2px;z-index:2}
.cell.star::before {position:absolute;content:"";width:13%;height:13%;background:#563e2c;border-radius:50%}
.board-grid.playable .cell:not(.occupied) {cursor:pointer}
@media(hover:hover) {.board-grid.playable .cell:not(.occupied):hover::after {content:"";position:absolute;inset:9%;border:2px dashed #684933;border-radius:50%;background:#fff1ce5c}}
.stone,.seat-piece {position:relative;border-radius:50%;display:block}
.stone {width:88%;aspect-ratio:1;box-shadow:0 1px 1px #3224199e,1.5px 2.5px 3px #47301f66}
.black {border:1px solid #202225;background:radial-gradient(ellipse at 34% 24%,#696b68 0%,#46494a 21%,#292d2f 52%,#15191b 83%)}
.white {border:1px solid #9f927b;background:radial-gradient(ellipse at 32% 22%,#fffef7 0%,#fbf9ec 36%,#e5dfcd 69%,#bdb39e 100%)}
.cell.last .stone::after {position:absolute;content:"";width:23%;height:23%;inset:0;margin:auto;border-radius:50%;background:#a54433;box-shadow:0 0 0 1px #fff1cb}
.cell.winline .stone {outline:2px solid #a54433;outline-offset:0}
.board-caption {gap:7px;margin:12px 1px 0;color:var(--muted);font-size:.76rem;letter-spacing:.02em}
.last-key {width:7px;height:7px;border-radius:50%;background:var(--accent)}
.board-spec {margin-left:auto}

.board-playback {border-top:1px solid #9d9b8e;padding-top:11px}
.count,.meta {font:500 .78rem/1.3 var(--mono);font-variant-numeric:tabular-nums}
.count {color:var(--ink)}
#scrubber {width:100%;height:20px;accent-color:var(--ink);margin:8px 0 5px;display:block}
.replay-controls {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.replay-controls button {border:1px solid #cac4b6;background:transparent;min-height:37px;border-radius:3px;font-size:.82rem}
.replay-controls button:hover:not(:disabled) {color:var(--accent);background:#ede8dd}

.sidebar {display:grid;gap:23px}
.side-card {min-width:0}
.side-header {margin-bottom:10px}
.board-playback .side-header {margin-bottom:0}
.seat-panel {position:relative;isolation:isolate;padding:20px clamp(16px,2vw,26px);overflow:hidden;border-radius:5px;color:#fbf7e9;background:linear-gradient(115deg,#192637 0%,#223547 70%,#283c4a 100%)}
.seat-panel::before {content:"";position:absolute;z-index:-1;inset:0 0 auto auto;width:44%;height:80%;background-image:linear-gradient(90deg,#fcf1c712 1px,transparent 1px),linear-gradient(#fcf1c712 1px,transparent 1px);background-size:20px 20px;mask-image:linear-gradient(230deg,#000,transparent 75%);pointer-events:none}
.seat-panel .side-header {padding-bottom:12px;border-bottom:1px solid #c3b48657}
.seat-panel .meta {color:#e1d3b2}
.seats {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px}
.seat {display:grid;grid-template-columns:36px minmax(0,1fr);grid-template-rows:auto auto;align-items:center;gap:1px 9px;min-width:0;align-content:center}
.seat-icon {position:relative;grid-row:span 2;display:grid;place-items:center;width:36px}
.seat .seat-art {width:36px;aspect-ratio:1;overflow:hidden;border-radius:50%;box-shadow:0 0 0 1px #d8c9a3a8}
.seat-piece {width:26px;aspect-ratio:1;box-shadow:0 0 0 1px #f6ebd86b}
.seat-art:not([hidden]) + .seat-piece {position:absolute;right:-1px;bottom:0;width:11px}
.seat small,.seat strong {display:block}
.seat small {color:#e6d8b8;font-size:.72rem;letter-spacing:.04em;margin:2px 0 4px}
.seat strong {font:700 clamp(1rem,1.45vw,1.22rem)/1.25 var(--serif);overflow-wrap:anywhere}
.seat-now {grid-column:2;color:#e4c386;font-size:.69rem;line-height:1.2}
.primary-actions {margin-top:16px}
.primary-actions:has(> :not([hidden])) {border-top:1px solid #b6a98657;padding-top:12px}
.primary-actions:not(:has(> :not([hidden]))) {display:none}
.seat-panel .button {flex:1;min-height:34px;border-color:#c9b18a;background:transparent;color:#faf2d8}
.seat-panel .primary {background:#ebd7ac;border-color:#ebd7ac;color:#263243}
.seat-panel .primary:hover:not(:disabled) {background:#f4e3be}
.seat-panel .secondary:hover:not(:disabled) {background:#3a4b57}

.replay-card,.connect-card {border-top:1px solid #9d9b8e;padding:11px 1px 0}
.move-list {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0 5px;max-height:154px;overflow:auto;align-content:start;scrollbar-width:thin}
.move-list:empty,.move-list:not(:empty)+.history-empty {display:none}
.move-chip {display:flex;align-items:center;justify-content:center;gap:5px;min-width:0;min-height:32px;border:0;border-bottom:1px solid var(--line);background:transparent;font:500 clamp(.71rem,1vw,.83rem)/1.4 var(--mono);color:#484c4e}
.move-chip .mini {width:8px;height:8px;border-radius:50%;flex:none}
.move-chip.current {background:var(--ink);border-color:var(--ink);border-radius:3px;color:#fff6df}
.move-chip.current .black {border-color:#b8bac0}
.move-chip:hover:not(.current) {background:#eae4d9}
.connect-buttons {flex-wrap:wrap;margin-top:10px}
.connect-buttons .button {min-height:36px}
.show-link {justify-self:start}
.show-link span {color:var(--accent)}
.challenge-context {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:14px;background:#eee7d8;border-left:3px solid #976e40;margin:0 0 20px;padding:13px 17px}
.challenge-context p {margin-top:4px;font-size:.88rem;line-height:1.5}
.challenge-context a {color:var(--accent);text-underline-offset:3px}
.challenge-actions,.dialog-foot {flex-wrap:wrap}
.input-row input {min-width:0;flex:1}
form label,.field-label {display:block;font-size:.88rem;font-weight:600;margin:12px 0 5px}
input:not([type=range]),select,textarea {width:100%;min-height:38px;border:1px solid #b4b1a5;border-radius:3px;padding:7px 10px;background:#fffdf7;color:var(--ink)}
input:disabled,input[readonly] {background:#ece9df}
.error {border-left:3px solid var(--accent);background:#f3e2d9;padding:10px 14px;margin-bottom:14px;color:#753b30}
dialog {width:min(480px,calc(100% - 24px));max-height:88svh;padding:22px;border:1px solid #a39c89;border-top:4px solid var(--ink);border-radius:4px;background:var(--paper);color:var(--ink);box-shadow:0 20px 70px #181d2955}
dialog::backdrop {background:#17202b88}
.dialog-head {margin-bottom:12px}
.dialog-head h2 {font-size:1.5rem}
.close {font-size:1.55rem;background:none;line-height:1;width:34px;height:34px;border:0}
dialog p {font-size:.91rem;line-height:1.6;color:var(--muted);margin:5px 0 10px}
dialog .button {margin-top:10px}
.dialog-fields {display:grid;grid-template-columns:1fr 1fr;gap:12px}
.dialog-foot {margin-top:12px}
.dialog-list {display:grid;gap:7px;margin-top:9px}
.history-item {width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;border:1px solid var(--line);border-radius:3px;padding:9px 11px;background:#f9f7f1}
.history-item small {display:block;color:var(--muted);margin-top:3px}
.dialog-help {font-size:.84rem}
.toast {position:fixed;z-index:5;bottom:22px;left:50%;max-width:calc(100% - 24px);transform:translateX(-50%);padding:9px 14px;border-radius:4px;background:var(--ink);color:#fffaf0;text-align:center;box-shadow:0 3px 12px #18202a33}

@media(min-width:821px) and (max-height:800px) {
  .page-head {margin:16px 0 15px;padding-bottom:13px}
  h1 {font-size:2.7rem}
  .table-card {max-width:clamp(440px,calc(100svh - 279px),545px)}
  .layout {max-width:1010px;margin-inline:auto}
}
@media(max-width:1000px) and (min-width:821px) {
  .shell {width:calc(100% - 40px)}
  .layout {gap:24px;grid-template-columns:minmax(0,1.35fr) minmax(290px,1fr)}
  .seats {grid-template-columns:1fr;gap:11px}
  .seat {grid-template-columns:36px minmax(0,1fr) auto;grid-template-rows:1fr}
  .seat-now {grid-column:3}
}
@media(max-width:820px) {
  .shell {width:min(610px,calc(100% - 34px))}
  .page-head {margin:19px 0 13px;padding-bottom:12px}
  h1 {font-size:2.3rem}
  .layout {display:block}
  .table-card {max-width:100%}
  .sidebar {margin-top:13px;gap:21px;reading-flow:grid-rows}
  .seat-panel {padding:17px 18px}
  .board-playback {order:-1}
}
@media(max-width:540px) {
  .shell {width:calc(100% - 28px)}
  .mast-row {min-height:51px;gap:15px}
  .mast-aside {gap:10px}
  .page-head {flex-wrap:wrap;gap:10px;margin:14px 0 7px}
  h1 {font-size:2.16rem}
  h1 span {margin-left:.4em}
  .head-actions {margin-left:auto;gap:5px}
  .head-actions .button {min-height:35px;padding:6px 9px;font-size:.77rem}
  .table-heading {min-height:30px;margin-bottom:2px}
  .table-name h2 {font-size:1.02rem}
  .turn-box {min-height:32px;margin-bottom:7px}
  .turn-box>div {gap:0 9px}
  .turn-box p {font-size:.77rem}
  .board-surround {padding:6px}
  .board-caption {margin-top:9px}
  .axis {font-size:clamp(.55rem,2vw,.67rem)}
  .replay-controls button {min-height:40px}
}
@media(prefers-reduced-motion:reduce) {*{scroll-behavior:auto!important}}
#model-tools>summary{display:list-item;cursor:pointer;padding:10px 0;font-weight:650;min-height:44px}
.practice-links{display:flex;flex-wrap:wrap;gap:14px}.practice-links a{display:inline-flex;align-items:center;min-height:44px}
@media(max-width:540px){.head-actions .button,.replay-controls button{min-height:44px}.head-actions{gap:8px}}
