* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% -10%, #f7f9ff, #eef2ff 40%, #e6e9f7 80%);
  color: #1f2937;
}

.app {
  padding: 24px 16px 48px;
  max-width: 720px;
  margin: 0 auto;
}

.app__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

h1 {
  margin: 0;
  font-size: 24px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

label { font-size: 14px; }
select {
  margin-left: 6px;
  padding: 6px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #fff;
}

.btn {
  appearance: none;
  border: 1px solid #6366f1;
  background: #6366f1;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .15s ease, transform .02s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn--secondary { background: #fff; color: #374151; border-color: #c7d2fe; }

.board {
  margin: 20px auto 12px;
  width: min(92vw, 420px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cell {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(36px, 12vw, 64px);
  font-weight: 700;
  color: #111827;
  user-select: none;
  cursor: pointer;
  box-shadow: 0 1px 0 0 rgba(99, 102, 241, 0.25), 0 6px 16px rgba(99,102,241,.08);
  transition: transform .06s ease, box-shadow .15s ease;
}
.cell:hover { transform: translateY(-1px); box-shadow: 0 2px 0 0 rgba(99, 102, 241, 0.28), 0 8px 20px rgba(99,102,241,.12); }
.cell:active { transform: translateY(0); }
.cell[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }
.cell.win { background: #eef2ff; border-color: #c7d2fe; }

.status {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  min-height: 28px;
}
.result { font-weight: 700; color: #1f2937; }

.score {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  body { background: radial-gradient(1200px 800px at 20% -10%, #0f172a, #111827 40%, #0b1220 80%); color: #e5e7eb; }
  .cell { background: #0b1020; color: #e5e7eb; border-color: #1f2937; box-shadow: 0 1px 0 0 rgba(99, 102, 241, 0.2), 0 6px 16px rgba(99,102,241,.18); }
  .cell.win { background: #1b2140; border-color: #374151; }
  .btn--secondary { background: #0b1020; color: #e5e7eb; }
  select { background: #0b1020; color: #e5e7eb; border-color: #374151; }
}
