*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --line: #2d3a4d;
  --text: #e8eef5;
  --muted: #8b9aad;
  --accent: #5b9fd4;
  --accent-hover: #7ab3e0;
  --cell-size: min(28vw, 120px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
}

.game {
  text-align: center;
  padding: 1.5rem;
}

.game__title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.game__status {
  margin: 0 0 1.25rem;
  min-height: 1.5em;
  font-size: 1.125rem;
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, var(--cell-size));
  grid-template-rows: repeat(3, var(--cell-size));
  gap: 0;
  margin: 0 auto 1.5rem;
  padding: 0;
  border: 3px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.cell {
  margin: 0;
  padding: 0;
  min-width: var(--cell-size);
  min-height: var(--cell-size);
  font: inherit;
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: none;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cell:nth-child(3n) {
  border-right: none;
}

.cell:nth-child(n + 7) {
  border-bottom: none;
}

.cell:hover:not(:disabled) {
  background: #243044;
}

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

.cell:disabled {
  cursor: default;
  opacity: 1;
}

.game__reset {
  padding: 0.65rem 1.35rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.game__reset:hover {
  background: var(--accent-hover);
}

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