:root {
  --bg-deep: #1a1f3c;
  --bg-gradient-end: #2a3560;
  --card: #f8f6f1;
  --text: #1a1f3c;
  --text-muted: #5a6278;
  --x-color: #e85d4c;
  --o-color: #2ec4b6;
  --win-bg: #fff3c4;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  --cell-shadow: 0 2px 8px rgba(26, 31, 60, 0.08);
  --radius: 16px;
  --gap: 10px;
}

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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: "Outfit", sans-serif;
  background: linear-gradient(145deg, var(--bg-deep), var(--bg-gradient-end));
  color: var(--text);
}

.game {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

#status {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-bottom: 24px;
}

.cell {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--cell-shadow);
  font-family: inherit;
  font-size: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.cell:hover:not(:disabled):not(.cell--x):not(.cell--o) {
  background: #f0eeea;
  box-shadow: 0 4px 16px rgba(46, 196, 182, 0.2);
  transform: scale(1.03);
}

.cell:focus-visible {
  outline: 3px solid var(--o-color);
  outline-offset: 2px;
}

.cell--x {
  color: var(--x-color);
  animation: pop-in 0.2s ease;
}

.cell--o {
  color: var(--o-color);
  animation: pop-in 0.2s ease;
}

.cell--win {
  background: var(--win-bg);
  box-shadow: 0 0 0 2px var(--o-color);
}

.cell:disabled {
  cursor: default;
}

#reset {
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--card);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

#reset:hover {
  background: var(--bg-gradient-end);
  transform: translateY(-1px);
}

#reset:focus-visible {
  outline: 3px solid var(--o-color);
  outline-offset: 2px;
}

@keyframes pop-in {
  from {
    transform: scale(0.6);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cell,
  .cell--x,
  .cell--o,
  #reset {
    animation: none;
    transition: none;
  }

  .cell:hover:not(:disabled):not(.cell--x):not(.cell--o) {
    transform: none;
  }
}

@media (min-width: 480px) {
  .cell {
    font-size: 3rem;
  }
}
