:root{
  --bg: #0f172a;
  --panel: #111827;
  --accent: #22d3ee;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --win: #22c55e;
  --lose: #ef4444;
  --cell: #1f2937;
  --cell-border: #374151;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 80% -10%, #1e293b 0%, var(--bg) 60%);
  color: var(--text);
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.app{
  width:min(92vw, 720px);
  margin:auto;
  padding:24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 120px);
}

h1{
  text-align:center;
  font-weight:800;
  letter-spacing:.2px;
  margin: 0 0 18px;
}

.controls{
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:center;
  flex-wrap: wrap;
  background: var(--panel);
  padding:14px;
  border-radius:14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width: 160px;
}

label{
  font-size:.9rem;
  color: var(--muted);
}

select{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid #334155;
  background:#0b1220;
  color:var(--text);
  outline:none;
}

.btn{
  padding:12px 16px;
  border-radius:12px;
  border:none;
  cursor:pointer;
  transition: transform .05s ease, box-shadow .2s ease, background .2s ease;
}

.btn.primary{
  background: linear-gradient(90deg, #06b6d4, #22d3ee);
  color:#0b1220;
  font-weight:700;
  box-shadow: 0 8px 20px rgba(34,211,238,.25);
}

.btn:hover{ transform: translateY(-1px); }

.status{
  text-align:center;
  margin:18px 0 8px;
  min-height:28px;
}
#statusText{
  font-weight:600;
  color: var(--muted);
}

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

.cell{
  aspect-ratio:1/1;
  background: var(--cell);
  border: 2px solid var(--cell-border);
  border-radius:18px;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  font-weight:900;
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease, color .2s ease;
  user-select:none;
}

.cell:hover{ transform: translateY(-2px); background:#253246; }

.cell:disabled{
  cursor: not-allowed;
  opacity:.85;
  transform:none;
}

.cell.win{
  border-color: var(--win);
  box-shadow: 0 0 0 2px rgba(34,197,94,.4) inset;
  color: #bbf7d0;
  background: #152718;
}

.note{
  text-align:center;
  color:var(--muted);
  font-size:.9rem;
  margin-top:10px;
}