:root {
  --ground: #F4F7F5;
  --surface: #FFFFFF;
  --ink: #17302B;
  --ink-2: #4C615B;
  --line: #DCE6E2;
  --line-soft: #E6EEEB;
  --mint: #2E9C87;
  --mint-ink: #1F7A69;
  --mint-soft: #E1F3EE;
  --peach: #E8744F;
  --peach-ink: #8A3A1F;
  --peach-soft: #FDEDE5;
  --wood: #EBCB8B;
  --wood-line: #6B5434;
  --radius-l: 24px;
  --radius-m: 16px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); }
a { color: var(--mint-ink); }
a:hover { color: var(--ink); }
button, input { font: inherit; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232,116,79,.55); } 70% { box-shadow: 0 0 0 9px rgba(232,116,79,0); } 100% { box-shadow: 0 0 0 0 rgba(232,116,79,0); } }
@keyframes turn { 0% { box-shadow: 0 0 0 0 rgba(46,156,135,.45); } 70% { box-shadow: 0 0 0 8px rgba(46,156,135,0); } 100% { box-shadow: 0 0 0 0 rgba(46,156,135,0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.94); } 60% { opacity: 1; transform: scale(1.02); } 100% { transform: none; } }
@keyframes drop { 0% { transform: scale(1.45); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes ring { 0% { transform: scale(.9); opacity: .95; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes dots { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.rise { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .16s; } .rise.d3 { animation-delay: .24s; }
.pop { animation: pop .45s cubic-bezier(.2,.9,.3,1.2) both; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--peach); animation: pulse 1.6s infinite; display: inline-block; }
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-ink); animation: dots 1.2s infinite; display: inline-block; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { padding: 10px 16px; border-radius: 999px; text-decoration: none; color: var(--ink-2); transition: background-color .2s, color .2s; }
.nav a:hover { background: var(--mint-soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--mint-soft); color: var(--ink); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--peach-soft); color: var(--peach-ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.pill.idle { background: var(--mint-soft); color: var(--mint-ink); }

main { max-width: 1180px; margin: 0 auto; padding: 40px 22px 64px; display: flex; flex-direction: column; gap: 40px; }
.display { font-size: clamp(36px, 6vw, 58px); line-height: 1.15; font-weight: 800; letter-spacing: 1px; }
.title { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.muted { color: var(--ink-2); }
.lead { font-size: 18px; line-height: 1.75; color: var(--ink-2); max-width: 32em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 24px; transition: transform .25s ease, box-shadow .25s ease; }
.card.hover:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(23,48,43,.10); }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .2s, background-color .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(23,48,43,.14); color: var(--ink); }
.btn:active { transform: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { color: #fff; }
.btn.danger { border-color: #F2C2AF; color: var(--peach-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; }
.field input { min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid #CFDDD8; background: #fff; color: var(--ink); }
.field input:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 4px rgba(46,156,135,.18); }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--ground); }
.tabs button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: none; background: transparent; cursor: pointer; color: var(--ink); }
.tabs button[aria-selected="true"] { background: #fff; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.tag.win { background: var(--mint-soft); color: var(--mint-ink); }
.tag.loss { background: var(--peach-soft); color: var(--peach-ink); }
.tag.void { background: var(--ground); color: var(--ink-2); }

.step-no { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 700; font-size: 18px; }

.board-wrap { position: relative; width: 100%; max-width: 760px; }
.board { width: 100%; height: auto; display: block; border-radius: 22px; box-shadow: inset 0 0 0 1px rgba(107,84,52,.25), 0 24px 48px rgba(64,48,20,.14); touch-action: manipulation; }
.board .stone { transform-box: fill-box; transform-origin: center; animation: drop .45s cubic-bezier(.2,1.5,.4,1) both; }
.board .ring { transform-box: fill-box; transform-origin: center; animation: ring 1.6s ease-out infinite; }
.board.clickable { cursor: pointer; }
.board .ghost { pointer-events: none; }

.player { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-m); border: 1.5px solid var(--line-soft); }
.player.active { border-color: var(--mint); background: #F2FAF7; animation: turn 1.8s infinite; }
.chip { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink); flex: 0 0 auto; }
.chip.B { background: var(--ink); } .chip.W { background: #fff; }
.bubble { padding: 14px 16px; border-radius: 4px 18px 18px 18px; background: #fff; border: 1px solid var(--line); line-height: 1.7; animation: pop .35s ease both; }
.winbar { display: flex; height: 12px; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.winbar span { display: block; height: 100%; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }
.toggle[aria-pressed="true"] { border-color: var(--mint); background: var(--mint-soft); color: var(--ink); font-weight: 600; }
.movelist { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: 240px; overflow-y: auto; }
.movelist li { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--ground); font-family: var(--mono); font-size: 14px; }
.movelist li.latest { background: var(--peach-soft); }
.cand { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 12px; background: var(--ground); font-size: 14px; line-height: 1.6; }
.cand b { font-family: var(--mono); min-width: 3.2em; }

table.games { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
table.games th { text-align: left; color: var(--ink-2); font-weight: 500; font-size: 13px; padding: 10px 12px; }
table.games td { padding: 12px; border-top: 1px solid var(--line-soft); }
table.games tbody tr:hover { background: var(--ground); }
.scroll-x { overflow-x: auto; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; z-index: 50; animation: toast .3s ease both; max-width: calc(100% - 32px); }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
footer.site { max-width: 1180px; margin: 0 auto; padding: 0 22px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--ink-2); font-size: 14px; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  main { padding: 28px 16px 48px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.notice { width: min(480px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: 0 24px 48px rgba(23,48,43,.18); }
.notice::backdrop { background: rgba(23,48,43,.35); }
.notice h2 { font-size: 20px; margin-bottom: 12px; }
.notice p { color: var(--ink-2); line-height: 1.8; margin: 0 0 10px; }
.notice form { display: flex; justify-content: flex-end; margin-top: 18px; }
