:root {
  --bg: #070a12;
  --bg2: #0b1020;
  --surface: rgba(255, 255, 255, 0.06);
  --surface2: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eaf0ff;
  --muted: rgba(234, 240, 255, 0.72);
  --primary: #60a5fa;
  --primary2: #a78bfa;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 20% 0%, rgba(96, 165, 250, 0.18), transparent 55%),
    radial-gradient(800px 550px at 85% 10%, rgba(167, 139, 250, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

.container { max-width: 980px; margin: 0 auto; padding: 0 18px 40px; }

.top { padding: 14px 18px; border-bottom: 1px solid var(--border); background: rgba(7, 10, 18, 0.6); backdrop-filter: blur(10px); position: sticky; top: 0; }
.back { text-decoration: none; color: var(--muted); font-weight: 800; }
.back:hover { color: var(--text); }

.card {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  box-shadow: var(--shadow);
}

.head h1 { margin: 0 0 6px; letter-spacing: -0.4px; }
.muted { color: var(--muted); margin: 0; }

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.board {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cell {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 900;
  font-size: clamp(44px, 7vw, 70px);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.cell:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.cell:disabled { cursor: not-allowed; opacity: 0.9; }
.cell.win { background: linear-gradient(90deg, rgba(96, 165, 250, 0.25), rgba(167, 139, 250, 0.22)); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.10); }
.btn.primary { background: linear-gradient(90deg, rgba(96, 165, 250, 0.9), rgba(167, 139, 250, 0.85)); }

.hint { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

:where(a, button):focus-visible { outline: 3px solid rgba(96, 165, 250, 0.55); outline-offset: 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
