/* ========================================================
   ESTILOS KAHOOT! - INTELIGENCIA ARTIFICIAL
   Presentación: Alexander Portillo & Ezequiel Valenzuela
   ======================================================== */

:root {
  --kahoot-purple: #46178f;
  --kahoot-dark-purple: #2f0d5f;
  --kahoot-deep: #1e093d;
  --kahoot-light-purple: #6a2eb9;
  
  --color-red: #e21b3c;
  --color-red-shadow: #b8152e;
  --color-blue: #1368ce;
  --color-blue-shadow: #0f4fa0;
  --color-yellow: #d89e00;
  --color-yellow-shadow: #ad7e00;
  --color-green: #26890c;
  --color-green-shadow: #1c6709;
  
  --text-light: #ffffff;
  --text-dark: #1f2937;
  --card-bg: rgba(255, 255, 255, 0.96);
  --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(circle at 50% 20%, #5720aa 0%, var(--kahoot-purple) 50%, var(--kahoot-dark-purple) 100%);
  color: var(--text-light);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Fondo con figuras geométricas flotantes características de Kahoot */
.bg-shapes {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}

.bg-shape {
  position: absolute;
  filter: blur(1px);
  animation: float 20s infinite ease-in-out alternate;
}

.shape-triangle {
  top: 10%;
  left: 8%;
  width: 0;
  height: 0;
  border-left: 45px solid transparent;
  border-right: 45px solid transparent;
  border-bottom: 80px solid #e21b3c;
}

.shape-diamond {
  top: 65%;
  left: 6%;
  width: 70px;
  height: 70px;
  background: #1368ce;
  transform: rotate(45deg);
  animation-duration: 25s;
}

.shape-circle {
  top: 15%;
  right: 8%;
  width: 90px;
  height: 90px;
  background: #ffa602;
  border-radius: 50%;
  animation-duration: 18s;
}

.shape-square {
  bottom: 12%;
  right: 10%;
  width: 75px;
  height: 75px;
  background: #26890c;
  transform: rotate(15deg);
  animation-duration: 22s;
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-40px) rotate(25deg); }
}

/* Canvas de confeti por encima de todo */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Header superior */
header.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(30, 9, 61, 0.45);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffa602, #ff5722);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(255, 166, 2, 0.3);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Contenedor principal de pantallas */
main.game-container {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  animation: fadeIn 0.35s ease forwards;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   PANTALLA 1: LOBBY DE INICIO
   ======================================================== */
.lobby-card {
  background: var(--card-bg);
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--card-shadow);
  text-align: center;
  max-width: 580px;
  margin: auto;
  border: 4px solid #fff;
}

.presentation-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 14px;
  border-radius: 50px;
  margin-bottom: 16px;
}

.btn-qr-link {
  background: transparent;
  border: 1px dashed #7c3aed;
  color: #6d28d9;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 50px;
  cursor: pointer;
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-qr-link:hover {
  background: #ede9fe;
  transform: scale(1.03);
}

.lobby-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #2e1065;
  line-height: 1.15;
  margin-bottom: 8px;
}

.lobby-authors {
  font-size: 1rem;
  color: #4b5563;
  margin-bottom: 24px;
  font-weight: 500;
}

.lobby-authors strong {
  color: #6d28d9;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #374151;
  margin-bottom: 8px;
}

.avatar-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.avatar-opt {
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.avatar-opt:hover {
  transform: scale(1.15);
  border-color: #8b5cf6;
}

.avatar-opt.selected {
  border-color: #7c3aed;
  background: #ede9fe;
  transform: scale(1.18);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}

.nickname-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.15rem;
  font-weight: 700;
  border: 3px solid #d1d5db;
  border-radius: var(--radius-md);
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  color: #111827;
}

.nickname-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

.btn-start {
  width: 100%;
  padding: 16px 24px;
  background: #333;
  color: white;
  font-size: 1.25rem;
  font-weight: 900;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 0 #111;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

.btn-start:hover {
  background: #1f2937;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #111;
}

.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #111;
}

.rules-hint {
  display: flex;
  justify-content: space-around;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 600;
}

/* ========================================================
   PANTALLA 2: CUENTA REGRESIVA (3, 2, 1)
   ======================================================== */
.countdown-screen {
  align-items: center;
  justify-content: center;
  margin: auto;
  text-align: center;
}

.countdown-category {
  font-size: 1.1rem;
  color: #fde047;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.countdown-qnumber {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 24px;
}

.countdown-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: white;
  color: var(--kahoot-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: 900;
  margin: 0 auto 20px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: popNum 0.9s infinite ease-out;
}

@keyframes popNum {
  0% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

.countdown-tip {
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.85;
}

/* ========================================================
   PANTALLA 3: PREGUNTA ACTIVA
   ======================================================== */
.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
}

.player-info-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
}

.streak-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f97316;
  color: white;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-left: 8px;
  animation: pulseFire 1.5s infinite;
}

@keyframes pulseFire {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.score-counter {
  font-size: 1.1rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Tarjeta de la Pregunta */
.question-card {
  background: white;
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}

.timer-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.timer-svg {
  transform: rotate(-90deg);
  width: 72px;
  height: 72px;
}

.timer-bg-circle {
  stroke: #e5e7eb;
  stroke-width: 6;
  fill: none;
}

.timer-progress-circle {
  stroke: #7c3aed;
  stroke-width: 6;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s;
}

.timer-progress-circle.warning {
  stroke: #e21b3c;
  animation: pulseTimer 0.6s infinite alternate;
}

@keyframes pulseTimer {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: #111827;
}

.question-content {
  flex: 1;
}

.question-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.category-tag {
  background: #ede9fe;
  color: #6d28d9;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.slide-tag {
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.question-title {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  color: #111827;
}

/* Grilla de respuestas estilo Kahoot */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

.answer-card {
  border: none;
  border-radius: var(--radius-md);
  padding: 20px 22px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.2s;
  min-height: 110px;
  position: relative;
  user-select: none;
}

.answer-card .shape-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
}

.answer-card .card-text {
  flex: 1;
}

.answer-card .key-hint {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
}

/* Colores específicos de Kahoot */
.answer-card.red {
  background: var(--color-red);
  box-shadow: 0 6px 0 var(--color-red-shadow);
}
.answer-card.red:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-red-shadow);
}
.answer-card.red:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-red-shadow);
}

.answer-card.blue {
  background: var(--color-blue);
  box-shadow: 0 6px 0 var(--color-blue-shadow);
}
.answer-card.blue:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-blue-shadow);
}
.answer-card.blue:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-blue-shadow);
}

.answer-card.yellow {
  background: var(--color-yellow);
  box-shadow: 0 6px 0 var(--color-yellow-shadow);
}
.answer-card.yellow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-yellow-shadow);
}
.answer-card.yellow:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-yellow-shadow);
}

.answer-card.green {
  background: var(--color-green);
  box-shadow: 0 6px 0 var(--color-green-shadow);
}
.answer-card.green:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--color-green-shadow);
}
.answer-card.green:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--color-green-shadow);
}

.answer-card.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.answer-card.selected-pulse {
  transform: scale(0.98);
  filter: brightness(1.2);
}

/* ========================================================
   PANTALLA 4: RESULTADO DE LA RONDA
   ======================================================== */
.feedback-card {
  background: white;
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--card-shadow);
  text-align: center;
  max-width: 620px;
  margin: auto;
  animation: bounceIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.feedback-banner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.feedback-banner.correct {
  background: #dcfce7;
  color: #15803d;
}

.feedback-banner.wrong {
  background: #fee2e2;
  color: #b91c1c;
}

.feedback-banner.timeout {
  background: #fef3c7;
  color: #b45309;
}

.points-awarded {
  font-size: 2.5rem;
  font-weight: 900;
  color: #7c3aed;
  margin-bottom: 6px;
}

.streak-box {
  display: inline-block;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.explanation-box {
  background: #f9fafb;
  border-left: 4px solid #7c3aed;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px;
  text-align: left;
  margin-bottom: 24px;
}

.explanation-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.explanation-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #374151;
}

.btn-next {
  width: 100%;
  padding: 16px 20px;
  background: #111827;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #000;
  transition: all 0.15s;
}

.btn-next:hover {
  background: #1f2937;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #000;
}

.btn-next:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #000;
}

/* ========================================================
   PANTALLA 5: PODIO Y RESULTADOS FINALES
   ======================================================== */
.podium-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 680px;
  margin: auto;
  width: 100%;
}

.podium-title {
  font-size: 2.2rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 4px;
}

.podium-subtitle {
  font-size: 1rem;
  opacity: 0.85;
  text-align: center;
  margin-bottom: 24px;
}

/* Estructura del podio */
.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 24px;
  height: 220px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30%;
  animation: riseUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes riseUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.podium-step.first {
  order: 2;
  height: 100%;
}

.podium-step.second {
  order: 1;
  height: 75%;
}

.podium-step.third {
  order: 3;
  height: 60%;
}

.podium-avatar {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.podium-name {
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  margin-bottom: 6px;
  text-align: center;
}

.podium-block {
  width: 100%;
  flex: 1;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.podium-step.first .podium-block {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  font-size: 2rem;
}

.podium-step.second .podium-block {
  background: linear-gradient(180deg, #9ca3af, #6b7280);
  font-size: 1.6rem;
}

.podium-step.third .podium-block {
  background: linear-gradient(180deg, #b45309, #78350f);
  font-size: 1.4rem;
}

.podium-score {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.9;
  margin-top: 2px;
}

/* Tarjeta de Estadísticas Personales */
.stats-card {
  background: white;
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
  margin-bottom: 20px;
}

.stat-item {
  background: #f9fafb;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid #e5e7eb;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: #7c3aed;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  margin-top: 2px;
}

.action-buttons {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex: 1;
  padding: 14px 16px;
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: #ddd6fe;
}

.btn-primary {
  flex: 1;
  padding: 14px 16px;
  background: #111827;
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary:hover {
  background: #1f2937;
}

/* Tabla de clasificación en vivo */
.leaderboard-card {
  background: white;
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

.leaderboard-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
}

.leaderboard-item.highlight {
  background: #ede9fe;
  border: 2px solid #8b5cf6;
}

.leaderboard-rank {
  width: 28px;
  font-weight: 900;
  color: #6b7280;
}

.leaderboard-avatar {
  font-size: 1.3rem;
  margin-right: 10px;
}

.leaderboard-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-score {
  font-weight: 900;
  color: #7c3aed;
}

/* ========================================================
   MODAL DE REPASO DE PREGUNTAS
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--card-shadow);
  animation: fadeIn 0.25s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #111827;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-card {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 16px;
  background: #f9fafb;
}

.review-qtitle {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 8px;
  color: #111827;
}

.review-correct-ans {
  background: #dcfce7;
  color: #166534;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-explanation {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.4;
}

/* Toast de notificación */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #111827;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ========================================================
   RESPONSIVIDAD MÓVIL
   ======================================================== */
@media (max-width: 640px) {
  header.app-header {
    padding: 10px 16px;
  }
  
  .brand-logo {
    font-size: 1.2rem;
  }

  main.game-container {
    padding: 12px;
  }

  .lobby-card {
    padding: 24px 18px;
  }

  .lobby-title {
    font-size: 1.7rem;
  }

  .question-card {
    padding: 16px;
    flex-direction: column-reverse;
    text-align: center;
    gap: 12px;
  }

  .question-meta {
    justify-content: center;
  }

  .question-title {
    font-size: 1.15rem;
  }

  .answers-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .answer-card {
    padding: 14px 16px;
    font-size: 1rem;
    min-height: 75px;
  }

  .answer-card .shape-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* ========================================================
   MODO ANFITRIÓN (ADMIN) Y SALA EN VIVO SINCRONIZADA
   ======================================================== */
.admin-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.btn-admin-login {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-admin-login:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #f59e0b;
}

/* Barra de control flotante del anfitrión */
.admin-control-bar {
  background: #111827;
  color: white;
  border-bottom: 2px solid #f59e0b;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-status-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-host-action {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-host-green { background: #16a34a; color: white; }
.btn-host-green:hover { background: #15803d; }

.btn-host-yellow { background: #eab308; color: #111827; }
.btn-host-yellow:hover { background: #ca8a04; }

.btn-host-blue { background: #2563eb; color: white; }
.btn-host-blue:hover { background: #1d4ed8; }

.btn-host-red { background: #dc2626; color: white; }
.btn-host-red:hover { background: #b91c1c; }

.btn-host-dark { background: #374151; color: white; }
.btn-host-dark:hover { background: #4b5563; }

/* Sala de espera para compañeros (Waiting Lobby) */
.waiting-card {
  background: var(--card-bg);
  color: var(--text-dark);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--card-shadow);
  text-align: center;
  max-width: 650px;
  margin: auto;
  border: 4px solid #fff;
}

.waiting-radar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #ede9fe;
  color: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 16px auto;
  position: relative;
  animation: radarPulse 2s infinite ease-out;
}

@keyframes radarPulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5); }
  70% { box-shadow: 0 0 0 25px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.players-joined-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.players-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 12px;
  padding: 4px;
}

.player-chip {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1f2937;
  animation: popNum 0.3s ease;
}

.player-chip.is-me {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}

/* Tabla completa de clasificación al finalizar partida */
.full-scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  text-align: left;
  font-size: 0.9rem;
}

.full-scoreboard-table th {
  background: #f3f4f6;
  color: #4b5563;
  padding: 10px 14px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.full-scoreboard-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  color: #1f2937;
}

.full-scoreboard-table tr:nth-child(even) {
  background: #fafafa;
}

.full-scoreboard-table tr.highlight-row {
  background: #ede9fe;
  font-weight: 800;
}

.full-scoreboard-table tr.highlight-row td {
  color: #6d28d9;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.85rem;
}

.rank-1 { background: #fef3c7; color: #b45309; }
.rank-2 { background: #f3f4f6; color: #4b5563; }
.rank-3 { background: #ffedd5; color: #c2410c; }
