:root {
  --wood: #e3b060;
  --wood-line: #4a3418;
  --board-size: min(88vw, 560px);
  --ink: #2b2b2b;
  --bg: #f7f2e8;
  --panel: #ffffff;
  --accent: #2e7d32;
  --lib: #2196f3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.topbar { text-align: center; padding: 18px 12px 6px; }
.topbar h1 { margin: 0; font-size: 1.7rem; }
.subtitle { margin: 4px 0 0; color: #96835f; font-size: .95rem; }

/* Tabs */
.tabs { display: flex; justify-content: center; gap: 8px; padding: 14px 12px; flex-wrap: wrap; }
.tab {
  border: none; background: #ece0c8; color: #6b5533;
  padding: 10px 18px; border-radius: 999px; font-size: 1rem; cursor: pointer; transition: all .15s;
}
.tab:hover { background: #e2d3b3; }
.tab.active { background: var(--wood-line); color: #fff; }

/* Layout */
.layout { display: flex; gap: 28px; justify-content: center; align-items: flex-start; padding: 8px 16px 48px; flex-wrap: wrap; }
.board-area { display: flex; flex-direction: column; align-items: center; }

/* Board */
.board-wrap {
  width: var(--board-size);
  height: var(--board-size);
  background: var(--wood);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  position: relative;
}
.go-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.intersections { position: absolute; inset: 0; }
.pt {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pt:hover .ghost-stone { opacity: .45; }
.ghost-stone { width: 82%; height: 82%; border-radius: 50%; opacity: 0; transition: opacity .1s; }
.pt.black-turn:hover .ghost-stone { background: radial-gradient(circle at 34% 32%, #666, #000); }
.pt.white-turn:hover .ghost-stone { background: radial-gradient(circle at 34% 32%, #fff, #cfcfcf); }

.stone { width: 88%; height: 88%; border-radius: 50%; box-shadow: 0 2px 3px rgba(0,0,0,.35); }
.stone.b { background: radial-gradient(circle at 34% 30%, #6a6a6a, #050505 70%); }
.stone.w { background: radial-gradient(circle at 34% 30%, #ffffff, #c4c4c4 75%); }

.starpoint { fill: var(--wood-line); }
.gridline { stroke: var(--wood-line); stroke-width: 1; }

/* markers */
.last-marker { width: 30%; height: 30%; border-radius: 50%; }
.last-marker.on-b { background: rgba(255,255,255,.85); }
.last-marker.on-w { background: rgba(0,0,0,.7); }
.lib-dot { width: 26%; height: 26%; border-radius: 50%; background: var(--lib); opacity: .8; }
.terr { width: 34%; height: 34%; border-radius: 3px; }
.terr.b { background: rgba(0,0,0,.55); }
.terr.w { background: rgba(255,255,255,.8); border: 1px solid rgba(0,0,0,.25); }

.turn-banner {
  margin-top: 14px; padding: 8px 20px; background: var(--panel);
  border-radius: 8px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.turn-banner.win { background: var(--accent); color: #fff; }

/* Panel */
.panel { width: min(92vw, 380px); background: var(--panel); border-radius: 12px; padding: 20px; box-shadow: 0 4px 18px rgba(0,0,0,.08); }
.panel h2 { margin-top: 0; }
.hint { color: #8a7852; font-size: .9rem; }
.hidden { display: none; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 2px solid #e6d8bd; background: #fbf5e9; border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-size: .9rem; transition: all .15s;
}
.chip:hover { border-color: var(--wood-line); }
.chip.active { border-color: var(--accent); background: #eaf6ea; }

.detail-card { background: #fbf5e9; border-radius: 10px; padding: 14px 16px; border: 1px solid #ece0c8; }
.detail-card h3 { margin: 0 0 6px; }

.rules-list .rule { background: #fbf5e9; border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; border: 1px solid #ece0c8; }
.rules-list .rule h3 { margin: 0 0 4px; font-size: 1rem; }
.rules-list .rule p { margin: 0; font-size: .9rem; color: #6b5533; }

/* controls */
.controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.size-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.btn { border: none; background: var(--wood-line); color: #fff; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: #ece0c8; color: #6b5533; }
.btn.ghost.active { background: var(--wood-line); color: #fff; }
.size-btn { padding: 8px 12px; }

.status-box { background: #eaf6ea; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; min-height: 44px; font-size: .92rem; }
.status-box.warn { background: #fdeaea; }

.captured { display: flex; gap: 20px; font-size: .95rem; color: #6b5533; margin-bottom: 12px; }
.captured span { font-weight: 700; color: var(--ink); }

.score-box { background: #fff8e8; border: 1px solid #e6d8bd; border-radius: 10px; padding: 14px 16px; font-size: .95rem; }
.score-box h3 { margin: 0 0 8px; }
.score-box table { width: 100%; border-collapse: collapse; }
.score-box td { padding: 3px 0; }
.score-box .win-line { margin-top: 8px; font-weight: 700; color: var(--accent); }

@media (max-width: 900px) { .layout { gap: 20px; } }
