/* ===== Connect Four — game UI =====
   Colours come from the center's shared --gc-* tokens (base.css), so this
   page follows light/dark automatically. The board itself keeps the classic
   Connect Four blue frame with red and yellow discs. */

.wrap {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: clamp(24px, 6vw, 48px) 20px 40px;
  text-align: center;
}
.head .title { margin: 0; font-size: clamp(26px, 6vw, 34px); letter-spacing: -.02em; }
.head .sub { margin: 4px 0 0; color: var(--gc-text-muted); font-weight: 600; min-height: 1.4em; }

/* Mode / difficulty segmented controls */
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--gc-surface-2); border: 1px solid var(--gc-border); border-radius: 999px; }
.segmented--sub { margin-top: -8px; }
.seg {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px;
  background: transparent; color: var(--gc-text-muted);
  transition: background .15s ease, color .15s ease;
}
.seg--sm { padding: 5px 12px; font-size: 12.5px; }
.seg:hover { color: var(--gc-text); }
.seg[aria-selected="true"] { background: var(--gc-accent); color: var(--gc-on-accent); box-shadow: var(--gc-shadow); }
.seg:focus-visible { outline: none; box-shadow: var(--gc-ring); }

/* Board */
.board-frame { position: relative; width: min(92vw, 440px); cursor: pointer; }
.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  aspect-ratio: 7 / 6;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(160deg, #2f6ad4, #2453ab);
  box-shadow: var(--gc-shadow-hi);
}
.cell {
  position: relative;
  overflow: hidden;
}
/* The hole every disc falls into */
.cell::before {
  content: "";
  position: absolute; inset: 9%;
  border-radius: 50%;
  background: var(--gc-surface);
  box-shadow: inset 0 2px 5px rgba(9, 20, 46, .4);
}
/* Ghost preview of where the disc would land (colour follows data-cur) */
.cell--ghost::after {
  content: "";
  position: absolute; inset: 9%;
  border-radius: 50%;
  z-index: 2;
  opacity: .38;
}
.board[data-cur="1"] .cell--ghost::after { background: #e23b3b; }
.board[data-cur="2"] .cell--ghost::after { background: #f0b429; }

.disc {
  position: absolute; inset: 9%;
  border-radius: 50%;
  z-index: 1;
  animation: c4-drop .34s cubic-bezier(.55, .06, .68, .19) both;
}
.disc--red { background: radial-gradient(circle at 35% 30%, #ff8a7a, #e23b3b 55%, #a71d1d); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .28); }
.disc--yellow { background: radial-gradient(circle at 35% 30%, #ffe08a, #f0b429 55%, #c2850c); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .22); }
@keyframes c4-drop { from { transform: translateY(var(--drop, -320px)); } }

.cell--win .disc {
  box-shadow: 0 0 0 3px var(--gc-accent), 0 0 16px color-mix(in srgb, var(--gc-accent) 65%, transparent);
  animation: pop .3s ease;
}
@keyframes pop { from { transform: scale(.85); } }

/* Transparent column buttons floating above the board */
.cols {
  position: absolute; inset: 10px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
}
/* Each button spans the full 6-row height, so every row (incl. the top)
   is a reliable drop target instead of relying on align-content stretch. */
.col { appearance: none; background: transparent; border: 0; padding: 0; cursor: pointer; border-radius: 10px; grid-row: 1 / -1; }
.col:focus-visible { outline: none; box-shadow: inset var(--gc-ring); }

/* Scoreboard */
.scores { display: flex; gap: 10px; width: 100%; }
.score {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px;
  background: var(--gc-surface); border: 1px solid var(--gc-border); border-radius: 12px;
}
.score__k { font-size: 12px; color: var(--gc-text-muted); font-weight: 600; }
.score__v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Controls */
.controls { display: flex; gap: 10px; }
.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--gc-border); background: var(--gc-surface); color: var(--gc-text);
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--gc-accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--gc-ring); }
.btn--primary { background: var(--gc-accent); border-color: var(--gc-accent); color: var(--gc-on-accent); }
.btn--primary:hover { filter: brightness(1.05); }

@media (prefers-reduced-motion: reduce) {
  .disc, .cell--win .disc { animation: none; }
}
