/* ==========================================================================
   ¿QUIÉN QUIERE SER INGENIERO? (QQSI) — ESTILOS MAESTROS DEFINITIVOS
   Inspirado en la Arquitectura de Quiz Show y la Gama Oficial del PDF
   100% CSS Nativo Independiente (Sin dependencias externas ni Tailwind CDN)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cabinet+Grotesk:wght@700;800;900&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700;800&family=Playfair+Display:ital,wght@1,600;1,700&display=swap');

/* --- Reset Básico & Box Sizing --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --denim-bg-top: #1b3d64;
  --denim-bg-bottom: #091728;
  --denim-stitch: rgba(255, 255, 255, 0.9);
  --ribbon-blue-1: #2563eb;
  --ribbon-blue-2: #1d4ed8;
  --gingham-blue: rgba(147, 197, 253, 0.42);
  --navy-dark: #071322;
  --navy-card: #0b1a2d;
  --navy-card-hover: #122842;
  --cyan-bright: #38bdf8;
  --emerald-bright: #10b981;
  --amber-bright: #f59e0b;
  --red-bright: #ef4444;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
  background-color: #f0f6fc;
  background-image: 
    linear-gradient(90deg, var(--gingham-blue) 50%, transparent 50%),
    linear-gradient(var(--gingham-blue) 50%, transparent 50%);
  background-size: 32px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* --- Variantes de Fondo para Pantallas Oscuras (Admin / Presentador) --- */
body.dark-stage {
  background-color: var(--navy-dark) !important;
  background-image: radial-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 0), linear-gradient(180deg, #071322 0%, #030810 100%) !important;
  background-size: 24px 24px, 100% 100% !important;
}

/* --- SVG Global Resets & Bounds --- */
svg {
  box-sizing: border-box;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Explicit Utility Classes */
.w-3\.5, .w-3 { width: 14px !important; }
.w-4 { width: 16px !important; }
.w-5 { width: 20px !important; }
.w-6 { width: 24px !important; }
.w-7 { width: 28px !important; }
.w-8 { width: 32px !important; }
.w-10 { width: 40px !important; }
.w-12 { width: 48px !important; }
.w-16 { width: 64px !important; }

.h-3\.5, .h-3 { height: 14px !important; }
.h-4 { height: 16px !important; }
.h-5 { height: 20px !important; }
.h-6 { height: 24px !important; }
.h-7 { height: 28px !important; }
.h-8 { height: 32px !important; }
.h-10 { height: 40px !important; }
.h-12 { height: 48px !important; }
.h-16 { height: 64px !important; }

/* Tipografía */
.font-display {
  font-family: 'Cabinet Grotesk', -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* --- Elementos Decorativos Fijos --- */
.decor-stars {
  position: absolute !important;
  top: 12px !important;
  left: 15px !important;
  width: 90px !important;
  height: 90px !important;
  max-width: 90px !important;
  max-height: 90px !important;
  pointer-events: none !important;
  z-index: 5 !important;
  opacity: 0.9 !important;
}

.decor-boat {
  position: absolute !important;
  bottom: 12px !important;
  right: 18px !important;
  width: 120px !important;
  height: 80px !important;
  max-width: 120px !important;
  max-height: 80px !important;
  pointer-events: none !important;
  z-index: 15 !important;
  opacity: 0.95 !important;
}

.decor-waves {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 35px !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

/* --- Logo CEIS Avatar --- */
.logo-avatar {
  width: 84px !important;
  height: 84px !important;
  max-width: 84px !important;
  max-height: 84px !important;
  border-radius: 9999px !important;
  background-color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 16px auto !important;
  border: 3px solid var(--cyan-bright) !important;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4), 0 8px 24px rgba(0, 0, 0, 0.6) !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  position: relative;
  z-index: 20;
}

.logo-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

.logo-avatar-sm {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  border-radius: 9999px !important;
  background-color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 2px solid var(--cyan-bright) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3) !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}

.logo-avatar-sm img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* --- Tarjeta Principal Denim con Costuras Pespunteadas --- */
.denim-card {
  background-color: #122842 !important;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.08) 1.2px, transparent 0),
    linear-gradient(145deg, #1b3d64 0%, #0a1828 100%) !important;
  background-size: 6px 6px, 100% 100% !important;
  position: relative;
  border-radius: 28px;
  box-shadow: 
    0 25px 60px -15px rgba(4, 14, 26, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  color: #ffffff !important;
  padding: 40px 36px;
  z-index: 10;
  text-align: center !important;
}

/* Costuras pespunteadas interiores */
.denim-card::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 2.5px dashed var(--denim-stitch);
  border-radius: 20px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- Header del Hub --- */
.hub-header {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  margin: 0 auto 24px auto !important;
}

.hub-subtitle {
  text-align: center !important;
  margin: 0 auto 18px auto !important;
  max-width: 580px !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  color: #f1f5f9 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7) !important;
  font-weight: 600 !important;
  display: block !important;
}

/* --- Cinta / Lazo Superior para Preguntas --- */
.ribbon-banner {
  position: relative !important;
  background: linear-gradient(180deg, var(--ribbon-blue-1) 0%, var(--ribbon-blue-2) 100%) !important;
  color: #ffffff !important;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 16px auto !important;
  text-align: center !important;
  padding: 10px 40px;
  border-radius: 6px;
  border-top: 2px dashed rgba(255, 255, 255, 0.95);
  border-bottom: 2px dashed rgba(255, 255, 255, 0.95);
}

.ribbon-banner::before,
.ribbon-banner::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: -8px;
  width: 24px;
  background: #1e40af;
  z-index: -1;
}

.ribbon-banner::before {
  left: -16px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 50% 50%);
}

.ribbon-banner::after {
  right: -16px;
  clip-path: polygon(0 0, 100% 0, 50% 50%, 100% 100%, 0 100%);
}

/* --- Cuadrícula de Roles del Hub --- */
.hub-container {
  max-width: 980px;
  margin: auto;
  width: 100%;
  padding: 24px 16px;
  z-index: 10;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 24px 0 12px 0;
  text-align: left;
}

@media (max-width: 820px) {
  .roles-grid {
    grid-template-columns: 1fr;
  }
}

.role-card-box {
  background: rgba(6, 17, 33, 0.9) !important;
  backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: #ffffff !important;
  transition: all 0.25s ease;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.role-card-box:hover {
  background: rgba(10, 26, 48, 0.98) !important;
  border-color: var(--cyan-bright);
  transform: translateY(-4px);
  box-shadow: 0 18px 35px -5px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.25);
}

.role-icon-box {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.role-icon-blue { background: #2563eb; color: #ffffff; }
.role-icon-green { background: #059669; color: #ffffff; }
.role-icon-amber { background: #d97706; color: #ffffff; }

/* Botones de Acción Luminosos en Tarjetas */
.role-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 18px;
}

.btn-glow-blue {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #031428 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-glow-green {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  color: #022013 !important;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

.btn-glow-amber {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #241402 !important;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

/* --- Pantalla de Proyección (Display) --- */
.display-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(8, 20, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(56, 189, 248, 0.2);
  z-index: 30;
  width: 100%;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-round {
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

.badge-teams {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}

/* Temporizador Digital LED */
.timer-led-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #030810;
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  padding: 8px 18px;
  border-radius: 16px;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.timer-led-digits {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.timer-led-box.urgent {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
  animation: pulse-urgent 1s infinite alternate;
}

.timer-led-box.urgent .timer-led-digits {
  color: #f87171;
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

@keyframes pulse-urgent {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

/* Tarjetas de Opciones A, B, C, D */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-card {
  background: rgba(8, 20, 36, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}

.option-letter {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #041224;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Barra Inferior de Entregas en Tiempo Real */
.live-submissions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(4, 12, 22, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1.5px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  overflow-x: auto;
  z-index: 30;
}

.submission-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 32, 54, 0.9);
  border: 1.5px solid #38bdf8;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
  animation: slide-up-pop 0.3s ease-out;
  white-space: nowrap;
}

@keyframes slide-up-pop {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Pulsador Arcade Móvil (Team Screen) --- */
.buzzer-arcade-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 32px auto;
  width: 100%;
}

.buzzer-arcade-btn {
  width: 220px;
  height: 220px;
  border-radius: 9999px;
  background: radial-gradient(circle at 35% 35%, #38bdf8 0%, #0284c7 60%, #03487a 100%);
  border: 8px solid #ffffff;
  box-shadow: 
    0 0 35px rgba(56, 189, 248, 0.6),
    0 15px 35px rgba(0, 0, 0, 0.7),
    0 6px 0 #025087 inset;
  color: #ffffff;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.buzzer-arcade-btn:active:not(:disabled) {
  transform: scale(0.94) translateY(6px);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4), 0 4px 10px rgba(0, 0, 0, 0.5);
}

.buzzer-arcade-btn:disabled {
  background: #334155 !important;
  border-color: #64748b !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 0.7;
}

.buzzer-arcade-btn.pulsing {
  animation: buzzer-pulse 1.4s infinite alternate;
}

@keyframes buzzer-pulse {
  0% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.5), 0 10px 25px rgba(0, 0, 0, 0.6); }
  100% { box-shadow: 0 0 45px rgba(56, 189, 248, 0.9), 0 15px 40px rgba(0, 0, 0, 0.8); }
}

/* --- Panel de Administración / Juez (Admin 3 Columns) --- */
.admin-layout-grid {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 20px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
}

@media (max-width: 1100px) {
  .admin-layout-grid {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background: rgba(8, 20, 36, 0.92);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.admin-card-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modales de Autenticación */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 20, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Math Rendering */
.math-display {
  font-size: 2.2rem;
  line-height: 1.4;
  color: #67e8f9 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.katex {
  font-size: 1.15em;
  color: #67e8f9 !important;
}

/* Progress bar de Equipos */
.team-progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 6px;
}

.team-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}
