/* Tic-Tac-Toe board – only what's specific to this game.
   Shared game-page pieces (header, difficulty, score, status)
   live in /css/style.css so every game looks the same. */

/* Fixed 3×3 grid: rows and columns are always equal thirds,
   whatever is inside the cells. */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 360px);
  aspect-ratio: 1;
}

.ttt-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.ttt-cell:disabled {
  cursor: default;
}

.ttt-cell:not(:disabled):hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.ttt-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The X/O floats on top of the cell, so it can never push
   the cell to a different size. */
.ttt-cell svg {
  position: absolute;
  inset: 19%;
  width: 62%;
  height: 62%;
  animation: mark-in 160ms ease-out;
}

/* The pen stroke draws itself in */
.ttt-cell svg path,
.ttt-cell svg circle {
  stroke-dasharray: 1;
  animation: mark-draw 320ms ease-out both;
}

.ttt-cell.is-x {
  color: var(--accent);
}

.ttt-cell.is-o {
  color: var(--text);
}

/* Online: your marks are always green, your friend's white */
.ttt-cell.is-mine {
  color: var(--accent);
}

.ttt-cell.is-theirs {
  color: var(--text);
}

.ttt-cell.is-win {
  border-color: var(--accent);
  background: var(--accent-soft);
  animation: win-pulse 0.9s ease-in-out 2;
}

@keyframes mark-draw {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@keyframes win-pulse {
  50% { transform: scale(1.06); }
}

@keyframes mark-in {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ttt-cell svg,
  .ttt-cell svg path,
  .ttt-cell svg circle,
  .ttt-cell.is-win { animation: none; }
}

/* Phone held sideways: fit the screen height (see css/style.css) */
@media (orientation: landscape) and (max-height: 540px) {
  .ttt-board { width: min(360px, var(--play-w), var(--play-h)); }
}
