body { gap: 18px; }

/* scoreboard chips (labels adapt to the mode in game.js) */
#score {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* mode + difficulty button groups */
#mode,
#difficulty {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.mode-btn,
.diff-btn {
  padding: 8px 18px;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}
.mode-btn:hover,
.diff-btn:hover { opacity: 1; background: var(--surface-3); }
.mode-btn.active,
.diff-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
/* difficulty group is only shown in vs-CPU mode */
#difficulty[hidden] { display: none; }

/* ---- the board ----
   A 15x15 grid of intersection cells. Each cell paints the grid lines
   through its centre with pseudo-elements so stones sit on the crossings. */
#board {
  --n: 15;
  --cell: 30px;
  --wood: #d9a86c;
  --wood-line: rgba(60, 36, 12, 0.55);
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-template-rows: repeat(var(--n), var(--cell));
  background: var(--wood);
  padding: calc(var(--cell) / 2);
  border-radius: 10px;
  box-shadow: 0 10px 40px var(--shadow);
  border-bottom: 6px solid rgba(60, 36, 12, 0.45);
  touch-action: manipulation;
}
:root[data-theme="dark"] #board {
  --wood: #b07e44;
  --wood-line: rgba(30, 16, 4, 0.7);
}

.cell {
  width: var(--cell);
  height: var(--cell);
  position: relative;
  cursor: pointer;
}
#board.locked .cell { cursor: default; }

/* grid lines: a horizontal and a vertical hairline through each cell centre */
.cell::before,
.cell::after {
  content: '';
  position: absolute;
  background: var(--wood-line);
}
.cell::before { left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-1px); }
.cell::after { top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-1px); }
/* trim the lines at the board edges so they don't poke past the outer crossings */
.cell.edge-l::before { left: 50%; }
.cell.edge-r::before { right: 50%; }
.cell.edge-t::after { top: 50%; }
.cell.edge-b::after { bottom: 50%; }

/* star points (hoshi) — small reference dots on a 15x15 board */
.cell.star {
  background:
    radial-gradient(circle at 50% 50%, var(--wood-line) 0 3px, transparent 3px);
}

/* hover preview of where your stone would land */
.cell.hl::after,
.cell.hl::before { background: var(--accent); }

/* stones */
.stone {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--cell) * 0.84);
  height: calc(var(--cell) * 0.84);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: place 0.18s cubic-bezier(0.34, 1.3, 0.7, 1) forwards;
  z-index: 1;
}
.stone.black {
  background: radial-gradient(circle at 34% 30%, #6b6b6b, #1a1a1a 60%, #000);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.stone.white {
  background: radial-gradient(circle at 34% 30%, #ffffff, #d4d4d4 60%, #b3b3b3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
@keyframes place { to { transform: translate(-50%, -50%) scale(1); } }

/* the most recent stone gets a subtle ring */
.cell.last .stone { outline: 2px solid var(--accent); outline-offset: 1px; }

/* winning line pulse */
.cell.win .stone { animation: winpulse 0.7s ease-in-out infinite alternate; }
@keyframes winpulse {
  from { transform: translate(-50%, -50%) scale(1); }
  to   { transform: translate(-50%, -50%) scale(0.78); filter: brightness(1.4); }
}

/* responsive: shrink the crossings on smaller screens */
@media (max-width: 560px) {
  #board { --cell: 21px; }
}
@media (max-width: 400px) {
  #board { --cell: 18px; }
}
