/* Noughts & Crosses page styles — pairs with ../../shared.css */

.game-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.game-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
  line-height: 1;
}
.game-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.score {
  display: flex;
  gap: 8px;
}
.score-cell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 78px;
  text-align: center;
  box-shadow: var(--shadow);
}
.score-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.score-value {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
#scoreX .score-value { color: var(--danger); }
#scoreO .score-value { color: var(--accent); }

/* Mode + difficulty controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.control-group {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow);
}
.control-group[hidden] { display: none; }
.opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 600 13px 'Inter', sans-serif;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.opt:hover { color: var(--ink); }
.opt.is-active {
  background: var(--accent);
  color: var(--paper);
  box-shadow: 0 6px 16px -8px rgba(31, 58, 95, 0.5);
}
.opt-label {
  display: inline-flex;
  align-items: center;
  font: 600 12px 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 0 12px;
}

/* Play layout */
.play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 760px) {
  .play { grid-template-columns: 1fr; }
}

.ttt-wrap {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  max-width: 520px;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  gap: 10px;
  position: relative;
}
.ttt-cell {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(48px, 11vw, 84px);
  transition: background 160ms ease, transform 120ms ease;
  position: relative;
  outline: none;
  padding: 0;
  color: var(--ink);
}
.ttt-cell:hover:not(:disabled) { background: var(--accent-soft); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell.mark-x { color: var(--danger); }
.ttt-cell.mark-o { color: var(--accent); }
.ttt-cell.is-win { background: #f7e7a8; animation: ttt-win-pulse 800ms ease-out; }
@keyframes ttt-win-pulse {
  0%   { background: #f7e7a8; box-shadow: 0 0 0 0 rgba(213, 192, 125, 0.7); }
  50%  { background: #eed88c; box-shadow: 0 0 0 8px rgba(213, 192, 125, 0); }
  100% { background: #f7e7a8; }
}
@media (prefers-reduced-motion: reduce) {
  .ttt-cell.is-win { animation: none; }
}
.ttt-cell .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: pop 220ms cubic-bezier(0.16, 1, 0.3, 1);
  width: 60%;
  height: 60%;
}
.ttt-cell .mark svg { width: 100%; height: 100%; }
@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.winline {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  pointer-events: none;
}
.winline line {
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw 380ms ease-out 80ms forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Side */
.aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.turn-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.turn-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.turn-mark {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.turn-mark svg { width: 48px; height: 48px; }
.turn-mark.x { color: var(--danger); }
.turn-mark.o { color: var(--accent); }

.howto {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink-soft);
  font-size: 13px;
}
.howto summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  list-style: none;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: ' +'; color: var(--muted); }
.howto[open] summary::after { content: ' −'; }
.howto ul { margin: 10px 0 0; padding-left: 18px; }
.howto li { margin: 6px 0; line-height: 1.5; }

@media (max-width: 520px) {
  .game-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .score { width: 100%; }
  .score-cell { flex: 1; min-width: 0; }
  .game-title { font-size: 26px; }
}
