* {
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --card: #111827;
  --card-alt: #1f2937;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --cell: #1e293b;
  --cell-hover: #334155;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 20px;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #1e293b 0%, var(--bg) 60%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 420px;
}

.game-card {
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(8px);
}

.game-header {
  text-align: center;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  line-height: 1.1;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-panel {
  background: rgba(31, 41, 55, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.status {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.board-wrapper {
  display: flex;
  justify-content: center;
}

.board {
  width: min(92vw, 360px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cell {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--cell) 0%, #0f172a 100%);
  color: var(--text);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.cell:hover {
  background: var(--cell-hover);
}

.cell:active {
  transform: scale(0.98);
}

.cell:focus-visible,
.reset-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.cell.winner {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.35), rgba(56, 189, 248, 0.12));
  border-color: rgba(56, 189, 248, 0.5);
}

.cell:disabled {
  opacity: 1;
  cursor: not-allowed;
}

.controls {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.reset-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #082f49;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 16px;
  min-height: 52px;
  cursor: pointer;
}

.reset-btn:hover {
  filter: brightness(1.02);
}

@media (max-width: 375px) {
  body {
    padding: 10px;
  }

  .game-card {
    padding: 14px;
    border-radius: 18px;
  }

  .board {
    width: min(94vw, 340px);
    gap: 8px;
  }

  .cell {
    border-radius: 16px;
  }
}
