/* ───────────────────────────────
   RESET BÁSICO
─────────────────────────────── */

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #1d2640 0, #020617 50%, #000 100%);
  color: #e5e7eb;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
}

/* Utilidad genérica para ocultar */
.hidden {
  display: none !important;
}

/* ───────────────────────────────
   CONTENEDOR PRINCIPAL
─────────────────────────────── */

.container {
  width: 100%;
  max-width: 480px;
  background: rgba(2, 6, 23, 0.96);
  border-radius: 18px;
  padding: 22px 18px 26px;
  box-shadow:
    0 0 20px rgba(56, 189, 248, 0.25),
    0 18px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* ───────────────────────────────
   TITULOS Y TEXTOS
─────────────────────────────── */

h1 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 4px;
  letter-spacing: 3px;
  font-weight: 800;
  font-size: 1.6rem;
  text-transform: uppercase;
}

h2 {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

h3 {
  margin: 4px 0 12px;
  font-weight: 700;
}

.subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 0;
  margin-bottom: 14px;
}

.subtitle.small {
  font-size: 0.75rem;
  margin-bottom: 10px;
}

section {
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ───────────────────────────────
   FILAS DE FORMULARIO
─────────────────────────────── */

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Input numérico real pero oculto */
.hidden-input {
  display: none;
}

/* ───────────────────────────────
   CONTADORES (+ / -)
─────────────────────────────── */

.counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 12px;
  min-width: 150px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617);
  border: 1px solid #111827;
  box-shadow:
    inset 0 0 10px rgba(15, 23, 42, 0.9),
    0 6px 14px rgba(15, 23, 42, 0.8);
}

.counter-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #020617;
  color: #e5e7eb;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.7);
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    background 0.08s ease-out,
    opacity 0.08s ease-out;
}

.counter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.8);
}

.counter-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.85);
}

.counter-value {
  min-width: 40px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
}

/* ───────────────────────────────
   INPUTS DE TEXTO (NOMBRES)
─────────────────────────────── */

input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  font-size: 0.95rem;
  font-weight: 500;
}

input[type="text"]::placeholder {
  color: #6b7280;
}

input[type="text"]:focus {
  outline: 2px solid #38bdf8;
  border-color: transparent;
}

/* ───────────────────────────────
   BOTONES
─────────────────────────────── */

button {
  width: 100%;
  padding: 11px 14px;
  border-radius: 999px;
  border: none;
  margin-top: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    background 0.08s ease-out,
    opacity 0.08s ease-out;
}

button.primary {
  background: linear-gradient(135deg, #22d3ee, #38bdf8);
  color: #020617;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}

button.secondary {
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.7);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ───────────────────────────────
   LISTA DE JUGADORES
─────────────────────────────── */

#players-container {
  margin-top: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-input {
  padding: 10px 12px;
  border-radius: 14px;
  background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617);
  border: 1px solid #0f172a;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-input label {
  font-size: 0.8rem;
  color: #a5b4fc;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ───────────────────────────────
   MENSAJES DE ERROR
─────────────────────────────── */

.error {
  color: #fca5a5;
  min-height: 18px;
  font-size: 0.85rem;
  margin-top: 2px;
}

/* ───────────────────────────────
   PANTALLA DE ROL
─────────────────────────────── */

#role-screen {
  text-align: center;
}

#role-player-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #9ca3af;
  margin-bottom: 2px;
}

#role-player-name {
  font-size: 1.3rem;
  font-weight: 800;
}

.role-message {
  min-height: 60px;
  margin: 18px 0 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-label {
  font-size: 1.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid transparent;
}

.role-word {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.3);
}

.role-impostor {
  color: #f97373;
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.45);
}

/* ───────────────────────────────
   PANTALLA DE RONDA
─────────────────────────────── */

#round-screen p {
  font-size: 0.9rem;
  color: #d1d5db;
}

/* ───────────────────────────────
   BLOQUE "RESULTADO"
─────────────────────────────── */

.reveal {
  margin-top: 20px;
  padding: 24px 20px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(248, 113, 113, 0.6);
  text-align: center;
  box-shadow: 0 0 40px rgba(248, 113, 113, 0.4);
}

.reveal-animate {
  animation: revealPop 0.4s ease-out;
}

@keyframes revealPop {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reveal-header {
  margin-bottom: 10px;
}

.reveal-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fca5a5;
}

.reveal-word-box,
.reveal-impostors-box {
  margin-top: 10px;
}

.reveal-label {
  display: block;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.reveal-word {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.15);
  color: #22c55e;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 1.05rem;
}

.reveal-impostors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.impostor-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.6);
  color: #fecaca;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ───────────────────────────────
   RULETA
─────────────────────────────── */

.roulette-help {
  font-size: 0.9rem;
  color: #d1d5db;
  margin-bottom: 10px;
}

#roulette-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
}

#roulette-wheel {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 3px solid #111827;
  background: radial-gradient(circle at center, #020617 0, #020617 35%, #020617 100%);
  box-shadow:
    0 0 18px rgba(56, 189, 248, 0.4),
    0 14px 30px rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 3s cubic-bezier(0.22, 0.61, 0.36, 1);
  cursor: pointer;
}

#roulette-canvas {
  width: 180px;
  height: 180px;
  border-radius: 50%;
}

.roulette-result {
  min-height: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
}

/* POPUP QUIÉN EMPIEZA */

.roulette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.roulette-popup {
  position: relative;
  background: #020617;
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid #1f2937;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
  min-width: 220px;
  max-width: 80%;
  text-align: center;
  animation: popupIn 0.2s ease-out;
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1rem;
  cursor: pointer;
  width: auto;
  padding: 0;
  box-shadow: none;
}

.popup-close:hover {
  color: #e5e7eb;
}

.popup-text {
  margin: 8px 4px 2px;
  font-size: 0.95rem;
  color: #e5e7eb;
  font-weight: 500;
}

#popup-name {
  display: block;
  margin-top: 6px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #38bdf8;
}

/* ───────────────────────────────
   PANTALLA DE CATEGORÍAS
─────────────────────────────── */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 10px;
}

.category-card {
  border: 1px solid #111827;
  background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617);
  border-radius: 16px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    border-color 0.08s ease-out,
    background 0.08s ease-out;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cat-icon-wrapper {
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cat-icon {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* un poco más grande en pantallas grandes */
@media (min-width: 480px) {
  .cat-icon-wrapper {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
  }
}

.cat-subtitle {
  display: block;
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 2px;
}

.category-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
  border-color: #4f46e5;
}

.category-card.selected {
  border-color: #22c55e;
  box-shadow:
    0 0 0 1px #22c55e,
    0 10px 24px rgba(22, 163, 74, 0.5);
}
