:root {
  --nexo-dark: #090d16; 
  --nexo-navy: #0f172a; 
  --nexo-cyan: #38bdf8; 
  --nexo-cyan-hover: #0284c7; 
  --bg-gray: #f8fafc; 
  --nexo-highlight: #0f172a;

  /* Emil Kowalski Motion Philosophy Curves */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: #f3f5f8;
}

/* Protección: Deshabilitar selección de texto únicamente en contenedores de juego y examen */
#gameContainer, .no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Tipografía de títulos y botones con Space Grotesk */
h1, h2, h3, h4, .font-heading, .btn-heading {
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
}

/* HEADER UNIFICADO Y NAVEGACIÓN */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  padding: 14px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  gap: 16px;
}

.logo-container {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-nav-levels {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  max-width: fit-content;
}

/* BANNERS HERO (PC Y MÓVIL) */
.hero-banner-container {
  background-image: linear-gradient(
    90deg, 
    #f3f5f8 0%, 
    #f3f5f8 15%, 
    rgba(243,245,248,0.8) 30%, 
    rgba(243,245,248,0.1) 50%, 
    rgba(243,245,248,0) 70%
  ), url('img/heropc.jpg');
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
}

@media (max-width: 767px) {
  .hero-banner-container {
    background-image: linear-gradient(
      180deg, 
      rgba(243,245,248,0.92) 0%, 
      rgba(243,245,248,0.6) 35%, 
      rgba(243,245,248,0.1) 70%,
      rgba(243,245,248,0) 100%
    ), url('img/herocel.jpg');
    background-position: center top;
    background-size: cover;
  }
}

/* TARJETAS CON ESTILO GLASSMORPHISM Y FEEDBACK TÁCTIL (EMIL KOWALSKI CRAFT) */
.nexo-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), border-color 180ms var(--ease-out);
  will-change: transform;
}

.nexo-card:hover {
  border-color: rgba(15, 23, 42, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 16px 28px -8px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.nexo-card:active {
  transform: scale(0.985);
  transition-duration: 70ms;
}

.nexo-card-dark {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* MICROINTERACCIONES Y FEEDBACK HÁPTICO UNIVERSAL */
button:not(:disabled), [role="button"], a[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

.btn-interactive {
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background-color 150ms var(--ease-out), opacity 150ms var(--ease-out);
  will-change: transform;
}

.btn-interactive:active {
  transform: scale(0.97);
  transition-duration: 70ms;
}

/* UTILIDADES DINÁMICAS */
.dinamic-focus:focus {
  border-color: var(--nexo-highlight) !important;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1) !important;
}

.dinamic-banner {
  border-left-color: var(--nexo-highlight) !important;
}

.dinamic-accent {
  color: var(--nexo-highlight) !important;
}

.dinamic-radio:checked {
  accent-color: var(--nexo-highlight) !important;
}

.dinamic-button {
  background-color: var(--nexo-highlight) !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* GLITCH TECNOLÓGICO 100% AZUL Y CIAN */
.glitch-nexo {
  position: relative;
  display: inline-block;
  font-size: 1.75em;
  line-height: 0.9;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #00f0ff 0%, #0066ff 50%, #0011ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.45));
}

.glitch-nexo::before,
.glitch-nexo::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #38bdf8 0%, #0055ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  clip: rect(0, 0, 0, 0);
}

.glitch-nexo::before {
  left: -2px;
  text-shadow: 2px 0 #00f0ff;
  animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch-nexo::after {
  left: 2px;
  text-shadow: -2px 0 #0044ff;
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% { clip: rect(15px, 9999px, 30px, 0); transform: skew(0.3deg); }
  10% { clip: rect(40px, 9999px, 65px, 0); transform: skew(-0.5deg); }
  20% { clip: rect(0, 0, 0, 0); }
  50% { clip: rect(8px, 9999px, 25px, 0); transform: skew(0.8deg); }
  60% { clip: rect(0, 0, 0, 0); }
  80% { clip: rect(50px, 9999px, 80px, 0); transform: skew(-0.2deg); }
  100% { clip: rect(0, 0, 0, 0); }
}

@keyframes glitch-anim-2 {
  0% { clip: rect(0, 0, 0, 0); }
  15% { clip: rect(25px, 9999px, 45px, 0); transform: skew(-0.8deg); }
  30% { clip: rect(0, 0, 0, 0); }
  45% { clip: rect(60px, 9999px, 90px, 0); transform: skew(0.4deg); }
  75% { clip: rect(10px, 9999px, 35px, 0); transform: skew(-0.3deg); }
  100% { clip: rect(0, 0, 0, 0); }
}

/* EFECTOS Y UTILIDADES PARA JUEGOS */
.perspective-1000 { perspective: 1000px; }
.transform-style-3d { transform-style: preserve-3d; }
.backface-hidden { backface-visibility: hidden; }
.rotate-y-180 { transform: rotateY(180deg); }

.screen-blur-active {
  filter: blur(25px) grayscale(100%) !important;
  pointer-events: none !important;
}

@media print {
  body {
    display: none !important;
  }
}

@keyframes explode {
  0% { transform: scale(0.3); opacity: 1; }
  50% { transform: scale(1.8); opacity: 0.9; }
  100% { transform: scale(2.5); opacity: 0; }
}

.animate-explosion {
  animation: explode 0.4s ease-out forwards;
}

@keyframes shakeCanvas {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 6px); }
  40% { transform: translate(8px, -6px); }
  60% { transform: translate(-6px, -4px); }
  80% { transform: translate(6px, 4px); }
}

.animate-shake {
  animation: shakeCanvas 0.22s var(--ease-out);
}

/* JOYSTICK STYLES (RESPONSIVE) */
.joystick-container {
  position: relative;
  width: 110px;
  height: 110px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 50%;
  backdrop-filter: blur(4px);
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.joystick-knob {
  position: absolute;
  width: 48px;
  height: 48px;
  background: radial-gradient(circle, #38bdf8 0%, #0284c7 100%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

@media (max-width: 640px) {
  .joystick-container {
    width: 86px;
    height: 86px;
  }
  .joystick-knob {
    width: 38px;
    height: 38px;
  }
}

/* FULLSCREEN BUTTON STYLES (CALIBRATED) */
.btn-fullscreen {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #38bdf8;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out), color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
  display: flex;
  align-items: center;
  gap: 6px;
  will-change: transform;
}

.btn-fullscreen:hover {
  background: #38bdf8;
  color: #090d16;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

.btn-fullscreen:active {
  transform: scale(0.96);
  transition-duration: 70ms;
}

/* PANTALLA COMPLETA Y ADAPTACIÓN MÓVIL EN JUEGOS */
#gameContainer:fullscreen {
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  border-radius: 0 !important;
  padding: 0.75rem !important;
  overflow-y: auto !important;
  background-color: #020617 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}

@media (min-width: 640px) {
  #gameContainer:fullscreen {
    padding: 1.5rem !important;
  }
}

/* MODO JUEGO ACTIVO EN MÓVILES (FULL IMMERSION) */
body.in-game-active {
  overscroll-behavior: none !important;
  background-color: #020617 !important;
}

@media (max-width: 768px) {
  body.in-game-active .site-header,
  body.in-game-active footer,
  body.in-game-active a[aria-label="Contactar por WhatsApp"] {
    display: none !important;
  }

  body.in-game-active #mainContainer {
    padding: 0.5rem !important;
    min-height: 100dvh !important;
  }

  body.in-game-active #gameContainer {
    padding: 0 !important;
    width: 100% !important;
  }
}

/* SUPERFICIES TÁCTILES Y CANVAS DE JUEGOS */
#canvas, #hsCanvas, #abCanvas, #sdCanvasContainer, #gameContainer canvas {
  touch-action: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

#gameContainer:fullscreen #gameResultsModal,
#gameContainer:fullscreen #meetingModal,
#gameContainer:fullscreen #taskModal,
#gameContainer:fullscreen #resultModal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
}

#gameContainer:fullscreen #penaltyFeedback {
  z-index: 9999 !important;
}

.vote-btn { 
  background: #1e293b; 
  color: white; 
  border: 1px solid rgba(148, 163, 184, 0.2); 
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 10px; 
  border-radius: 8px; 
  font-size: 14px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  cursor: pointer; 
  transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out), border-color 150ms var(--ease-out); 
  will-change: transform;
}

.vote-btn:hover { 
  background: #334155; 
  border-color: rgba(56, 189, 248, 0.5); 
}

.vote-btn:active {
  transform: scale(0.97);
  transition-duration: 70ms;
}

.vote-btn-disabled { 
  opacity: 0.5; 
  pointer-events: none; 
}

/* ESTILOS Y ANIMACIONES ESPECÍFICAS DE TEST DE NIVELACIÓN */
.fade-in {
  animation: fadeIn 180ms var(--ease-out) forwards;
}

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

.option-label:has(input:checked) {
  background-color: #f0f9ff; 
  border-color: #38bdf8;     
  font-weight: 700;
}

.mode-card:has(input:checked) {
  border-color: #38bdf8;
  background-color: #f0f9ff;
}

/* SKELETON LOADING ANIMATION */
@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

.animate-skeleton {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background-color: #cbd5e1; /* slate-300 */
}

.dark .animate-skeleton {
  background-color: #334155; /* slate-700 */
}

/* DIALOGOS Y MODALES: INTERPOLACIÓN Y ESCALADO SUAVE (EMIL KOWALSKI STANDARD) */
.modal-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out);
  will-change: opacity;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  transform: scale(0.95);
  opacity: 0;
  transition: transform 180ms var(--ease-out), opacity 180ms var(--ease-out);
  will-change: transform, opacity;
}

.modal-overlay.is-open .modal-dialog {
  transform: scale(1);
  opacity: 1;
}

.modal-overlay.is-closing {
  opacity: 0;
  transition: opacity 130ms var(--ease-out);
}

.modal-overlay.is-closing .modal-dialog {
  transform: scale(0.97);
  opacity: 0;
  transition: transform 130ms var(--ease-out), opacity 130ms var(--ease-out);
}

/* ACCESIBILIDAD WCAG 2.3.3: RESPETAR PREFERENCIA DE REDUCCIÓN DE MOVIMIENTO */
@media (prefers-reduced-motion: reduce) {
  .glitch-nexo::before,
  .glitch-nexo::after,
  .animate-bounce,
  .animate-pulse,
  .pulse-mic {
    animation: none !important;
  }
}

/* SONIC ECHO PIXEL ART & VOICE PULSE */
.font-pixel {
  font-family: 'Press Start 2P', monospace, cursive;
}

.canvas-pixelated {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pulse-mic {
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

