/* The stone games (Go, Reversi, Pincer): one square board, of points where
   the lines cross or of squares, and a stone on some of them. The sides'
   stones differ in shape as well as colour: RAPTOR's carries a ring. */
.stones-wrap { display: grid; gap: 12px; justify-items: center; }
.stones-meta { display: flex; justify-content: space-between; gap: 8px; width: min(100%, 640px); flex-wrap: wrap; }
.stones-meta .count { display: flex; align-items: center; gap: 6px; font: 600 12px/1 var(--mono); letter-spacing: 0.08em; }
.stones-meta .count svg { width: 18px; height: 18px; }
.stones-meta .c0 { color: var(--p0); }
.stones-meta .c1 { color: var(--p1); }
.stones-actions { display: flex; gap: 8px; width: min(100%, 640px); }
.stones-actions .btn { flex: 1; }

.goban-frame {
  --n: 9;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 3px;
  width: min(100%, 640px, max(300px, calc(100dvh - 250px)));
}
.col-names, .row-names {
  display: grid;
  font: 500 9px/1 var(--mono);
  color: var(--ink-faint);
  text-align: center;
}
.col-names { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.row-names { grid-template-rows: repeat(var(--n), minmax(0, 1fr)); align-items: center; }
.goban-frame.dense .col-names, .goban-frame.dense .row-names { font-size: 7px; }

.goban {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(var(--accent-rgb), 0.08), transparent 70%),
    var(--feed-bg);
  overflow: hidden;
}
.goban .lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.goban .lines path { fill: none; stroke: var(--ink-dim); stroke-opacity: 0.55; stroke-width: 1; vector-effect: non-scaling-stroke; }
.goban .lines circle { fill: var(--ink-dim); fill-opacity: 0.8; }
.pts {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
}
.pt {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  --c: var(--p0);
}
.pt.has { cursor: default; }
.pt.p1, .ghost.p1 { --c: var(--p1); }
.ghost.p0 { --c: var(--p0); }
.goban.squares .pt { border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.goban.squares .pt:nth-child(8n) { border-right: 0; }
.goban.squares .pt:nth-last-child(-n + 8) { border-bottom: 0; }
.pt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pt:not(.has):hover::before, .pt.aim::before {
  content: "";
  position: absolute;
  inset: 22%;
  border: 2px dashed var(--side);
  border-radius: 50%;
  opacity: 0.8;
}
.pt.aim::before { inset: 4%; opacity: 1; }

/* ---- stones (their look is in hud.css, shared with the lobby's cards) */
.stone-svg { position: absolute; inset: 5%; width: 90%; height: 90%; display: block; overflow: visible; }
.goban.squares .stone-svg { inset: 10%; width: 80%; height: 80%; }
.pt.last::after {
  /* the stone just placed: a small square, so it is a shape and not a colour */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%) rotate(45deg);
  background: #fff;
  box-shadow: 0 0 0 1px #06101a;
  pointer-events: none;
}
.pt.new .stone-svg { animation: stone-in 0.22s ease-out both; }
@keyframes stone-in { from { transform: scale(1.5); opacity: 0; } }
.pt.flip .stone-svg { animation: stone-flip 0.5s ease-in-out both; }
@keyframes stone-flip { 0% { transform: scaleX(1); filter: brightness(0.4); } 50% { transform: scaleX(0.05); } 100% { transform: scaleX(1); } }
.pt.win .stone-svg { animation: stone-lit 1.1s ease-in-out infinite alternate; }
@keyframes stone-lit { from { filter: drop-shadow(0 0 1px var(--c)); } to { filter: drop-shadow(0 0 8px var(--c)); } }
.ghost { position: absolute; inset: 0; pointer-events: none; }
.ghost:not(.aimed) { animation: stone-out 0.6s ease-in both; }
@keyframes stone-out { to { transform: scale(0.3); opacity: 0; } }
.ghost.aimed { opacity: 0.55; }

/* an open square (Reversi): a small ring where the side to move may play */
.pt.hint::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20%;
  height: 20%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--side);
  border-radius: 50%;
  opacity: 0.75;
  pointer-events: none;
}
/* the count at the end of Go: whose each empty point is, a square for
   VANGUARD and a diamond for RAPTOR */
.pt.land-0::after, .pt.land-1::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  height: 26%;
  transform: translate(-50%, -50%);
  background: var(--p0);
  pointer-events: none;
}
.pt.land-1::after { background: var(--p1); transform: translate(-50%, -50%) rotate(45deg); }

.reduce-motion .pt .stone-svg, .reduce-motion .ghost:not(.aimed) { animation: none; }
.reduce-motion .ghost:not(.aimed) { display: none; }

/* Painted plates (common/plates.js): the surface under each board. */
body.has-board-go .game-go .goban { background: var(--plate-board-go) center / 100% 100%, var(--feed-bg); }
body.has-board-reversi .game-reversi .goban { background: var(--plate-board-reversi) center / 100% 100%, var(--feed-bg); }
body.has-board-pincer .game-pincer .goban { background: var(--plate-board-pincer) center / 100% 100%, var(--feed-bg); }
