:root {
  --bg: #0f172a;
  --panel: #111827;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --win: #22c55e;
  --lose: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100svh; display: grid; place-items: center;
  background: radial-gradient(1000px 600px at 50% 10%, #0b1026, var(--bg));
  color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system,
    Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.app {
  width: min(92vw, 560px);
  margin: auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px; padding: 20px; backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}

.header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title { font-size: clamp(20px, 4vw, 28px); font-weight: 700; letter-spacing: 0.3px; }
.subtitle { color: var(--muted); font-size: 14px; }

.board {
  margin: 18px 0 12px; width: 100%; aspect-ratio: 1 / 1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}

.cell {
  background: var(--panel); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; display: grid; place-items: center; cursor: pointer;
  font-size: clamp(42px, 10vw, 70px); font-weight: 800; user-select: none;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.cell:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.33); }
.cell.disabled { cursor: not-allowed; opacity: 0.8; }

.cell.x { color: var(--accent); text-shadow: 0 0 18px rgba(56,189,248,0.45); }
.cell.o { color: var(--accent-2); text-shadow: 0 0 18px rgba(34,211,238,0.45); }
.cell.win { color: var(--win); text-shadow: 0 0 20px rgba(34,197,94,0.5); }

.status { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.badge {
  padding: 8px 12px; border-radius: 999px; font-weight: 700; letter-spacing: 0.4px;
  background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.25);
}

.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
button {
  all: unset; cursor: pointer; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  box-shadow: 0 6px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  font-weight: 700; letter-spacing: 0.4px; transition: transform 120ms ease, box-shadow 160ms ease;
}
button:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.3); }

.footer { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* Responsive adjustments */

/* Phones */
@media (max-width: 480px) {
  .title { font-size: 20px; }
  .subtitle { font-size: 12px; }
  .cell { font-size: clamp(32px, 8vw, 50px); border-radius: 12px; }
  .controls { flex-direction: column; width: 100%; }
  button { width: 100%; text-align: center; }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
  .title { font-size: 24px; }
  .cell { font-size: clamp(40px, 8vw, 60px); }
  .controls { flex-direction: row; justify-content: center; }
}

/* Large monitors */
@media (min-width: 1200px) {
  .app { width: 600px; }
  .title { font-size: 32px; }
  .cell { font-size: 80px; }
}
