:root {
  --bg: radial-gradient(circle at 15% 15%, #1f2937 0%, #111827 45%, #020617 100%);
  --panel: #0f172ad6;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
  --line: #334155;
  --winning: #f59e0b;
  --x-color: #ef4444;
  --o-color: #3b82f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 20px;
}

.app {
  width: min(92vw, 440px);
  background: var(--panel);
  backdrop-filter: blur(4px);
  border: 1px solid #334155;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 16px 36px #02061780;
}

.controls {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.controls select,
.controls button {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
}

.controls select {
  background: #0b1220;
  color: var(--text);
  padding: 0 10px;
}

.controls button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

.controls button:focus-visible,
.controls select:focus-visible,
.cell:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
}

.board-wrap {
  margin-top: 16px;
}

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

.cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1220;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.cell:hover:not([disabled]) {
  transform: translateY(-1px);
  border-color: #0ea5e9;
  box-shadow: 0 8px 20px #00000055;
}

.cell[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
}

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

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

.cell.is-winning {
  border-color: var(--winning);
  box-shadow: inset 0 0 0 2px #fbbf24;
  background: #3b2a0d;
}

@media (max-width: 480px) {
  .controls {
    grid-template-columns: 1fr;
  }
}
