/* ── Reset & Base ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: #0e0e14;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #181820;
  color: #dcdce6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ── App Container ────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 36px;
  gap: 0;
}

/* ── Title ─────────────────────────────────────────────────────────── */
h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #50a0ff 0%, #ff5a78 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}

/* ── Canvas ────────────────────────────────────────────────────────── */
#board-canvas {
  border-radius: 12px;
  cursor: pointer;
  /* subtle glow behind canvas */
  box-shadow:
    0 0 60px rgba(80, 160, 255, 0.06),
    0 0 120px rgba(255, 90, 120, 0.04);
}

/* ── Status Text ──────────────────────────────────────────────────── */
#status {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 20px;
  min-height: 1.6em;
  text-align: center;
  transition: color 0.3s ease;
}

#status.x-turn {
  color: #50a0ff;
}

#status.o-turn {
  color: #ff5a78;
}

#status.x-win {
  color: #50a0ff;
  text-shadow: 0 0 16px rgba(80, 160, 255, 0.4);
}

#status.o-win {
  color: #ff5a78;
  text-shadow: 0 0 16px rgba(255, 90, 120, 0.4);
}

#status.draw {
  color: #aaa;
}

/* ── New Game Button ──────────────────────────────────────────────── */
#new-game-btn {
  margin-top: 18px;
  padding: 10px 32px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: #dcdce6;
  background: #37374a;
  border: 1px solid #8c8ca0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

#new-game-btn:hover {
  background: #4b4b5f;
  border-color: #b0b0c0;
}

#new-game-btn:active {
  transform: scale(0.97);
}

/* ── Difficulty Picker Overlay ────────────────────────────────────── */
#difficulty-picker {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 16, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease;
}

#difficulty-picker.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.picker-card {
  background: rgba(38, 38, 58, 0.85);
  border: 1px solid rgba(140, 140, 160, 0.3);
  border-radius: 16px;
  padding: 32px 40px 36px;
  text-align: center;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(80, 160, 255, 0.06);
}

.picker-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: #e0e0f0;
  letter-spacing: -0.01em;
}

.picker-buttons {
  display: flex;
  gap: 14px;
}

.picker-buttons button {
  flex: 1;
  min-width: 100px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.picker-buttons button[data-difficulty="normal"] {
  background: linear-gradient(135deg, #50a0ff, #3080dd);
  box-shadow: 0 4px 16px rgba(80, 160, 255, 0.3);
}

.picker-buttons button[data-difficulty="hard"] {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
}

.picker-buttons button:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.12);
}

.picker-buttons button:active {
  transform: scale(0.97);
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 740px) {
  #board-canvas {
    width: 96vw !important;
    height: 96vw !important;
  }

  h1 {
    font-size: 1.3rem;
  }

  .picker-card {
    padding: 24px 20px 28px;
  }

  .picker-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .picker-buttons button {
    min-width: unset;
    width: 100%;
  }
}