:root {
  --bg-dark: #0d1117a2;
  --accent: #2ecc71; /* verde */
  --x-color: #27ae60;
  --o-color: #ffffff;
  --muted: #cbd5e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, rgba(34, 34, 34, 0.9), rgba(27, 27, 27, 0.555)),
                url("../img/tresenraya.jpg") no-repeat center center / cover;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  position: relative;
}

/* 🔘 Botón CPU ON/OFF */
#toggleCpu {
  min-width: 120px;
  font-weight: bold;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

/* Estado OFF (rojo) */
#toggleCpu.off {
  background: #e74c3c;
  color: #fff;
}
#toggleCpu.off:hover {
  background: #c0392b;
}

/* Estado ON (verde) */
#toggleCpu.on {
  background: var(--accent); /* verde */
  color: #fff;
}
#toggleCpu.on:hover {
  background: #27ae60;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* opacado */
  z-index: 0;
}

.app {
  width: 100%;
  max-width: 600px;
  position: relative;
  z-index: 1;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}
.app-header h1 {
  margin: 0;
  font-size: 28px;
  color: var(--accent);
}
.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.board-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

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

.score {
  text-align: center;
}
.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.value {
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
}
.turn {
  font-weight: bold;
  color: var(--accent);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 16px;
}

.cell {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s;
}
.cell:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.2);
}
.cell.x {
  color: var(--x-color);
}
.cell.o {
  color: var(--o-color);
}
.cell.win {
  background: rgba(46, 204, 113, 0.3);
  border-color: var(--accent);
}

.controls {
  text-align: center;
}
.message {
  min-height: 20px;
  font-weight: bold;
  color: var(--muted);
  margin-bottom: 10px;
}
.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s ease;
}
.btn:hover {
  background: #27ae60;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
}
.btn.ghost:hover {
  border-color: #fff;
  color: #fff;
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 22px;
  }
  .cell {
    font-size: 2rem;
  }
}
