/* ==========================================================================
   Four in a Row — only what's unique to this game.
   ========================================================================== */

.game[data-game="four-in-a-row"] {
  --game-color: var(--cat-classic);
  max-width: max(300px, min(620px, calc((100svh - 200px) * 1.02)));
}
.game[data-game="four-in-a-row"] .game__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) clamp(10px, 3vw, 22px) var(--space-4);
  background: var(--bg-sunken);
}

.c4-status {
  margin: 0;
  min-height: 1.5em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-0);
  text-align: center;
}

/* The board: a navy frame with 7 × 6 holes; a ghost disc row above it */
.c4-board {
  --cell: calc(100% / 7);
  position: relative;
  width: 100%;
  padding-top: calc(100% / 7);  /* space for the hover disc */
}
.c4-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  padding: 2.2%;
  background: var(--ink-900);
  border: 3px solid var(--ink-900);
  border-radius: 16px;
  box-shadow: 0 6px 0 #0B111B;
}
.c4-cell {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
/* the empty hole */
.c4-cell::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: var(--bg-sunken);
  box-shadow: inset 0 4px 0 rgb(0 0 0 / 0.25);
}
.disc {
  position: relative;
  z-index: 1;
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: 3px solid var(--ink-900);
  opacity: 0;
}
.c4-cell.is-you .disc, .c4-cell.is-cpu .disc { opacity: 1; }
.c4-cell.is-you .disc { background: radial-gradient(circle at 35% 30%, #F4826D, #E8553D 60%); }
.c4-cell.is-cpu .disc { background: radial-gradient(circle at 35% 30%, #FAD27F, #F2B33D 60%); }
.c4-cell.is-dropping .disc {
  animation: disc-fall calc(180ms + (var(--fall) - 1) * 45ms) cubic-bezier(0.45, 0, 1, 1);
}
@keyframes disc-fall { from { transform: translateY(calc(var(--fall) * -112%)); } }
.c4-cell.is-win .disc { animation: win-pulse 0.7s var(--ease-spring) infinite alternate; box-shadow: 0 0 0 4px #FBF7F0; }
@keyframes win-pulse { to { transform: scale(1.1); } }

/* Invisible full-height column buttons on top of the board */
.c4-cols {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 2.2%;
}
.c4-col {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
}
.c4-col:focus-visible { outline: 3px solid var(--mustard); outline-offset: -3px; }
.c4-board:not(.can-drop) .c4-col { cursor: default; }

/* Ghost disc above the chosen column */
.c4-board::before {
  content: "";
  position: absolute;
  top: 1%;
  left: calc(2.2% + var(--hover, 3) * (95.6% / 7) + 95.6% / 7 * 0.11);
  width: calc(95.6% / 7 * 0.78);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px dashed var(--ink-900);
  background: color-mix(in srgb, var(--tomato) 45%, transparent);
  opacity: 0;
  transition: left 0.15s var(--ease-out), opacity var(--dur-fast);
}
.c4-board.can-drop::before { opacity: 1; }
[data-theme="dark"] .c4-board::before { border-color: var(--cream-50); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .c4-board::before { border-color: var(--cream-50); } }

.c4-legend { display: flex; gap: var(--space-4); font-size: var(--step--1); font-weight: 700; color: var(--text-soft); }
.c4-legend span { display: inline-flex; align-items: center; gap: 0.4em; }
.c4-legend i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-900); }
