:root {
  color-scheme: light dark;
  --bg: #1c1a18;
  --panel: #2a2622;
  --text: #f2ebe0;
  --accent: #d4a574;
  --hit: rgba(212, 165, 116, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}

.topbar {
  padding: 0.75rem 1rem 0;
  text-align: center;
}

.topbar h1 {
  margin: 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.mode {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  opacity: 0.75;
}

.back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.board-wrap {
  max-width: min(100vw, 640px);
  margin: 0 auto;
  padding: 0 0.5rem 1.5rem;
}

.status {
  text-align: center;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.board svg {
  display: block;
  width: 100%;
  height: 100%;
}

.board .hit {
  fill: transparent;
  stroke: none;
  cursor: pointer;
}

.board .hit.legal:hover {
  fill: var(--hit);
  stroke: var(--accent);
  stroke-width: 0.004;
}

.board .hit:disabled {
  cursor: default;
}

.attn-dot {
  /* Deliberately NOT --accent: that's a wood tan, close enough to the
     board's own color to be nearly invisible on top of it. This needs
     to read clearly against wood, black stones, and white stones alike. */
  fill: #38e0e0;
  stroke: #0a3a3a;
  stroke-width: 0.0008;
  pointer-events: none;
}

/* Score overlay. Cyan/magenta rather than green/red so the two
   directions stay distinguishable to colourblind viewers, and both
   read against wood, black stones and white stones alike - the same
   constraint that ruled --accent out for .attn-dot above. */
.score-dot {
  pointer-events: none;
  stroke-width: 0.0008;
}

.score-good {
  fill: #38e0e0;
  stroke: #0a3a3a;
}

.score-bad {
  fill: #e0389f;
  stroke: #3a0a2a;
}

.score-label {
  fill: #ffffff;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  pointer-events: none;
}

/* Drawn under .score-label as a thick outline, so the digits stay
   legible over wood, a black stone or a white one without needing a
   background plate. */
.score-label-halo {
  fill: none;
  stroke: #000000;
  stroke-width: 0.010;
  stroke-linejoin: round;
  paint-order: stroke;
}

.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

button {
  background: var(--accent);
  color: #1a1208;
  border: none;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

#board-select-row {
  margin-bottom: 0.5rem;
}

#player-select {
  margin-bottom: 0.75rem;
}

.toggle select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
}

.footnote {
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 1.25rem;
}

.footnote a {
  color: var(--accent);
}

.player-name, .clock-text {
  fill: var(--text);
  font-family: system-ui, sans-serif;
  pointer-events: none;
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 1.1rem; }
}
