/* =========================================================
   EDIT THESE VARIABLES TO CUSTOMIZE YOUR DESIGN
   (colors, fonts, sizes — change values here and the whole
   game updates automatically)
   ========================================================= */
:root {
  --bg-color: #1e1e2f;
  --container-bg: #2a2a40;
  --cell-bg: #34344f;
  --cell-bg-hover: #3f3f5c;
  --text-color: #f4f4f9;
  --accent-x: #ff6b6b;
  --accent-o: #4ecdc4;
  --win-color: #ffd93d;
  --border-radius: 12px;
  --font-main: "Trebuchet MS", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  font-family: var(--font-main);
  color: var(--text-color);
  padding: 20px;
}

.game-container {
  background-color: var(--container-bg);
  border-radius: var(--border-radius);
  padding: 30px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.title {
  margin: 0 0 20px;
  font-size: 2rem;
  letter-spacing: 1px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-size: 0.9rem;
  opacity: 0.85;
}

#difficulty {
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background-color: var(--cell-bg);
  color: var(--text-color);
  font-family: var(--font-main);
  cursor: pointer;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background-color: var(--accent-x);
  color: #fff;
  font-family: var(--font-main);
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.status {
  min-height: 1.4em;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: bold;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  margin: 0 auto 20px;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
}

.cell {
  background-color: var(--cell-bg);
  border: none;
  border-radius: var(--border-radius);
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cell:hover:not(:disabled) {
  background-color: var(--cell-bg-hover);
}

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

.cell.x {
  color: var(--accent-x);
}

.cell.o {
  color: var(--accent-o);
}

.cell.win {
  background-color: var(--win-color);
  color: #1e1e2f;
}

.scoreboard {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-label {
  font-size: 0.8rem;
  opacity: 0.75;
}

.score-value {
  font-size: 1.4rem;
  font-weight: bold;
}

/* ---------- Mobile responsiveness ---------- */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }
  .game-container {
    padding: 18px;
  }
  .controls {
    justify-content: center;
  }
  #difficulty {
    font-size: 1rem; /* keeps iOS Safari from auto-zooming on focus */
  }
}

@media (max-width: 360px) {
  .title {
    font-size: 1.5rem;
  }
  .cell {
    font-size: 2rem;
  }
}
