:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --cell: #334155;
  --cell-hover: #475569;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --x: #38bdf8;
  --o: #f472b6;
  --win: #22c55e;
  --accent: #6366f1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #1e293b, var(--bg));
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  letter-spacing: 0.02em;
}

.status {
  font-size: 1.15rem;
  color: var(--muted);
  min-height: 1.6em;
}

.status .mark { font-weight: 700; }
.mark-x { color: var(--x); }
.mark-o { color: var(--o); }

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  width: min(90vw, 420px);
  aspect-ratio: 1 / 1;
  background: var(--panel);
  padding: 10px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.cell {
  background: var(--cell);
  border: none;
  border-radius: 12px;
  color: var(--text);
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.05s ease;
  font-family: inherit;
  padding: 0;
  line-height: 1;
}

.cell:hover:not(:disabled) { background: var(--cell-hover); }
.cell:active:not(:disabled) { transform: scale(0.97); }
.cell:disabled { cursor: default; }
.cell.x { color: var(--x); }
.cell.o { color: var(--o); }
.cell.win {
  background: var(--win);
  color: #0b3d1a;
  animation: pop 0.35s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.restart {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease;
  font-family: inherit;
}

.restart:hover { filter: brightness(1.1); }
.restart:active { transform: scale(0.97); }

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

@media (max-width: 380px) {
  .board { gap: 8px; padding: 8px; }
  .cell { border-radius: 10px; }
}
