:root {
  --bg: #f4efe6;
  --panel: #fffaf2;
  --ink: #31261c;
  --muted: #756453;
  --line: #7d6a57;
  --accent: #b36a2e;
  --whiteStone: #f7f7f3;
  --blackStone: #202020;
  --legal: rgba(58, 140, 92, 0.28);
  --selected: rgba(53, 100, 185, 0.28);
  --centre: rgba(230, 194, 120, 0.35);
  --corner: rgba(193, 111, 44, 0.18);
  --lastmove: rgba(201, 62, 62, 0.22);
  --danger: #a33b31;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 20px;
  border-right: 1px solid #d8cab7;
  background: linear-gradient(180deg, #fffaf2 0%, #f7efdf 100%);
  overflow: auto;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
h1 { margin: 0; font-size: 1.6rem; }
h2 { margin: 0 0 10px; font-size: 1rem; }
p, li { line-height: 1.42; }
.muted { color: var(--muted); }
.card {
  background: var(--panel);
  border: 1px solid #ddcfbe;
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
}
.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.stat-row:last-child { border-bottom: 0; }
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
button {
  appearance: none;
  border: 1px solid #ccb79a;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  cursor: pointer;
}
button:hover { background: #faf4ea; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.board-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  min-height: 78vh;
}
svg {
  width: min(92vw, 1100px);
  height: auto;
  max-height: 92vh;
  display: block;
}
.log-panel { padding: 0 18px 18px; }
.log {
  background: var(--panel);
  border: 1px solid #ddcfbe;
  border-radius: 16px;
  padding: 10px 12px;
  max-height: 250px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  white-space: pre-wrap;
}
.warning {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--danger);
  font-weight: 600;
}
.small { font-size: 0.92rem; }
.legend-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid #746858;
  display: inline-block;
}
.dot.centre { background: var(--centre); }
.dot.corner { background: var(--corner); }
.dot.white { background: var(--whiteStone); }
.dot.black { background: var(--blackStone); }
.dot.legal { background: var(--legal); }
.dot.selected { background: var(--selected); }
.dot.lastmove { background: var(--lastmove); }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid #d8cab7; }
  .controls, .legend-list { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {

  #sidebar {
    font-size: 0.85rem;
  }

  #logContainer {
    max-height: 120px;
    overflow-y: auto;
  }

}


.stat-row-diagnostics strong {
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: normal;
  text-align: right;
  max-width: 14rem;
}
