:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --line: #d8e0ea;
  --x: #e23d4f;
  --o: #087f8c;
  --accent: #255f85;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(8, 127, 140, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(226, 61, 79, 0.12), transparent 32%),
    var(--bg);
  color: var(--ink);
}

.game-shell {
  width: min(92vw, 430px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 55px rgba(23, 32, 51, 0.14);
  text-align: center;
}

h1 {
  margin: 24px 0 8px;
  font-size: clamp(2rem, 8vw, 3.1rem);
  line-height: 1;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.scoreboard div {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.score-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.scoreboard strong {
  font-size: 1.45rem;
}

.status {
  min-height: 1.5rem;
  margin: 0 0 22px;
  color: var(--accent);
  font-weight: 800;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  aspect-ratio: 1;
}

.cell {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-size: clamp(2.7rem, 16vw, 5.2rem);
  font-weight: 900;
  line-height: 1;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.cell:hover:not(:disabled),
.cell:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(37, 95, 133, 0.16);
  transform: translateY(-2px);
  outline: none;
}

.cell:disabled {
  cursor: default;
}

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

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

.cell.winner {
  border-color: #f2b705;
  background: #fff8df;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.actions button:last-child {
  background: #334155;
}

.actions button:hover,
.actions button:focus-visible {
  filter: brightness(1.08);
  outline: 3px solid rgba(37, 95, 133, 0.25);
}

@media (max-width: 420px) {
  .game-shell {
    padding: 20px;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}
