/* =========================================
   STYLE.CSS - VERSIÓN FINAL (OPTIMIZADA)
   Arquitectura: App Shell (Scroll Interno) + Diseño Móvil Expandido
   ========================================= */

/* 1. FUENTES */
@import url('https://fonts.googleapis.com/css2?family=Courgette&family=Montserrat:wght@300;400;500;600&display=swap');

/* 2. VARIABLES */
:root {
  /* Tipografía */
  --title-font: 'Courgette', cursive;
  --body-font: 'Montserrat', sans-serif;

  /* Colores Base - Mejorado contraste */
  --text-light: #E8E8E8;
  --text-medium: #C5B8B8;
  --text-dark: #E0CFC1;
  --header-color: #F0E6DC;
  
  /* Fondos y Capas */
  --background-overlay: rgba(20, 18, 28, 0.75);
  --container-bg: rgba(32, 30, 43, 0.75);
  --content-bg: rgba(30, 32, 33, 0.85);
  --input-bg: rgba(107, 93, 116, 0.5);
  --modal-bg: rgba(30, 30, 30, 0.95);
  --modal-overlay-bg: rgba(0, 0, 0, 0.85);
  
  /* Interacción */
  --border-color-input: #8E7383;
  --button-bg-initial: #9A8C8B;
  --button-bg-hover: #3F3938;
  
  /* Acentos */
  --progress-color: #A3C3BD;
  --highlight-pink: #ff7aa8;
  --highlight-pink-light: #ffaed0;
  --highlight-green: #7B9D8F;
  --highlight-red: #E74C3C;
  --highlight-gold: #FFD700;
  
  /* Componentes Específicos */
  --achievement-bg: #4A4A6A;
  --achievement-text: #E0CFC1;
  --favorite-icon-default: #888;
  --favorite-icon-active: #FFD700;

  /* Z-Index (Arquitectura Estricta) */
  --z-bg: -10;
  --z-particles: -5;
  --z-overlay: -1;
  --z-content: 10;
  --z-fab: 1500;
  --z-menu: 1499;
  --z-toast: 2000;
  --z-modal: 9999;
}

body.dark-mode {
  --text-light: #f2e6df;
  --text-medium: #d8ccc3;
  --background-overlay: rgba(5, 5, 5, 0.85);
  --container-bg: rgba(20, 20, 20, 0.8);
  --content-bg: rgba(17, 17, 17, 0.95);
  --button-bg-initial: #4A4A4A;
  --highlight-pink: #A860A8;
}

/* 3. ESTRUCTURA BASE (BLOQUEO DE SCROLL EN BODY) 
   Esto soluciona el Background Jumping en Chrome Android */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%; 
  overflow: hidden; /* Bloqueamos scroll nativo */
  position: fixed; /* Fijamos el viewport */
}

body {
  font-family: var(--body-font);
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* 4. CAPAS FIJAS (FONDO Y PARTICULAS) */
#fixed-bg {
  position: fixed;
  inset: 0;
  background: url('assets/images/fondo-romantico.webp') center / cover no-repeat;
  z-index: var(--z-bg);
  pointer-events: none;
  transform: translateZ(0); /* Fuerza GPU */
}

#tsparticles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.background-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--background-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  pointer-events: none;
}

/* 5. CONTENEDOR DE SCROLL INTERNO (EL NUEVO BODY) */
#app-scroll {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  overflow-y: auto; 
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; 
  overscroll-behavior: none; 
  z-index: var(--z-content);
  display: flex; flex-direction: column; align-items: center;
}

/* Scrollbar personalizado */
/* Eliminado */

/* 6. COMPONENTES UI PRINCIPALES */
.container {
  background-color: var(--container-bg);
  padding: 2.5rem; border-radius: 16px;
  text-align: center; max-width: 900px; width: 90%;
  margin: 4rem auto 8rem auto; 
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 35px 0 rgba(0, 0, 0, 0.4);
}

/* Tipografía */
h1 { font-family: var(--title-font); color: var(--header-color); font-weight: 400; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); margin-bottom: 1.5rem; font-size: 3em; letter-spacing: 1px; }
h2, .section-title { font-family: var(--title-font); color: var(--header-color); font-weight: 400; margin-bottom: 1rem; }
.intro-text { font-size: 1.1em; margin-bottom: 2rem; color: var(--text-medium); }

.header-img { 
  width: 140px; height: auto; margin-bottom: 1.5rem; 
  filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
  animation: float 6s ease-in-out infinite; 
}

/* Inputs y Botones */
.input-container { display: flex; gap: 12px; margin-bottom: 2rem; justify-content: center; }

#codeInput {
  flex-grow: 1; max-width: 350px; padding: 15px 20px;
  border: 2px solid var(--border-color-input); border-radius: 12px;
  background-color: var(--input-bg); color: var(--text-light);
  font-family: var(--body-font); font-size: 1.1em; text-align: center;
  transition: all 0.3s ease;
}
#codeInput:focus { border-color: var(--highlight-pink); outline: none; box-shadow: 0 0 15px rgba(255, 122, 168, 0.3); }
#codeInput.success { border-color: var(--highlight-green); box-shadow: 0 0 15px rgba(39, 174, 96, 0.3); }
#codeInput.error { border-color: var(--highlight-red); box-shadow: 0 0 15px rgba(231, 76, 60, 0.3); }

.button {
  background-color: var(--button-bg-initial); color: var(--text-light);
  border: none; border-radius: 12px; padding: 15px 25px;
  font-family: var(--body-font); font-weight: 600; font-size: 1em;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; position: relative; overflow: hidden;
  transition: transform 0.2s;
}
.button:active { transform: scale(0.96); }
.button.small-button { padding: 10px 18px; font-size: 0.9em; }

#hintBtn { background-color: var(--highlight-gold); color: #333; width: 50px; padding: 0; font-size: 1.2rem; }
#hintBtn:hover { background-color: #f39c12; color: #fff; box-shadow: 0 0 15px rgba(255,215,0,0.5); }

/* 7. CONTENIDO DINÁMICO (Cartas) */
.contenido-container {
  background-color: var(--content-bg); padding: 2.5rem; border-radius: 16px;
  margin-top: 2rem; text-align: left; line-height: 1.8; color: var(--text-medium);
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: slideUp 0.5s ease-out;
}
.contenido-container img { max-width: 100%; border-radius: 12px; margin: 1.5em auto; display: block; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.mensaje-texto { font-size: 1.2em; white-space: pre-wrap; color: var(--text-light); }

/* 8. VIDEOS, LOADERS & IFRAMES (Restaurado) */
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9; /* Forzar 16:9 siempre */
  border-radius: 12px;
  overflow: hidden;
  margin: 1.5em 0;
  background: #000; /* Fondo negro inicial */
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}

/* Spinner de carga */
.video-loader {
  position: absolute;
  width: 40px; height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--highlight-pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

/* Iframe de video (oculto hasta cargar) */
.video-frame {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: none; opacity: 0; transition: opacity 0.6s ease-in;
  z-index: 2;
}

/* Contenedor Iframe Externo */
.internal-wrapper { width: 100%; display: flex; flex-direction: column; align-items: center; margin-top: 15px; }
.internal-frame {
  width: 100%; height: 600px;
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 20px;
  background: white;
}

/* 9. PROGRESO Y LOGROS (Multicolor Restaurado) */
.achievements-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px dashed rgba(255,255,255,0.2); }
.progress-bar-container {
  width: 100%; max-width: 400px; background-color: rgba(255,255,255,0.1);
  border-radius: 20px; height: 16px; margin: 0 auto; overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--progress-color), var(--highlight-pink-light), var(--highlight-pink));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(255, 122, 168, 0.5);
}

/* 10. LISTAS Y COLECCIÓN */

/* --- CONTENEDOR PRINCIPAL --- */
.unlocked-codes-section[hidden] { display: none !important; }

.unlocked-codes-panel, .unlocked-codes-section { 
  /* CAMBIO: Quitamos backdrop-filter y usamos un fondo más sólido */
  background: var(--content-bg); /* Usa el color sólido definido en tus variables */
  padding: 1.5rem; 
  border-radius: 16px; /* Bajamos un poco el radio para suavizar bordes de píxeles */
  margin-top: 1.5rem; 
  border: 1px solid rgba(255, 255, 255, 0.1); /* Borde simple */
  /* Sin box-shadow pesado */
  display: flex; flex-direction: column;
  max-height: 85vh; 
}

/* --- FILTROS --- */
.filter-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 1.5rem; justify-content: center; }
.filter-controls input, .filter-controls select { 
  padding: 12px 15px; 
  border-radius: 10px; 
  border: 1px solid rgba(255, 255, 255, 0.15); 
  background: rgba(0, 0, 0, 0.2); 
  color: var(--text-light); 
  outline: none;
}

/* --- LISTA --- */
.lista-codigos { 
  display: flex; flex-direction: column; gap: 10px; 
  list-style: none; overflow-y: auto; padding: 2px;
  /* Rendimiento: will-change avisa al navegador que esto se moverá */
  will-change: scroll-position;
}

/* --- TARJETA DE CÓDIGO (OPTIMIZADA) --- */
.lista-codigo-item {
  position: relative; 
  /* CAMBIO: Color plano en vez de degradado complejo */
  background: rgba(255,255,255,0.05); 
  padding: 12px 15px; 
  border-radius: 12px; 
  border: 1px solid rgba(255,255,255,0.05);
  
  /* Flexbox eficiente */
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  gap: 15px;
  
  cursor: pointer; 
  /* Solo animamos opacidad y transform, que son baratos para la GPU */
  transition: background 0.2s, transform 0.1s; 
}

.lista-codigo-item:hover { 
  background: rgba(255,255,255,0.1); /* Cambio simple de color al hover */
  transform: translateY(-1px); /* Movimiento mínimo */
}

.lista-codigo-item:active { transform: scale(0.98); }

.lista-codigo-item.locked { 
  background: rgba(0,0,0,0.2); 
  border: 1px dashed rgba(255,255,255,0.1); 
  opacity: 0.6; 
}

/* --- TEXTO (Mantiene la corrección de desbordamiento) --- */
.lista-codigo-item > div {
  min-width: 0;         
  overflow: hidden;     
  display: flex;        
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.codigo-text { 
  font-family: var(--body-font);
  font-weight: 600; 
  font-size: 1.1em;
  color: var(--text-light); 
  text-transform: capitalize;
  display: block;
  white-space: nowrap;      
  overflow: hidden;         
  text-overflow: ellipsis; 
}

/* --- ETIQUETA --- */
.category { 
  font-size: 0.75em; 
  /* Fondo semitransparente simple */
  background: rgba(163, 195, 189, 0.1); 
  color: var(--progress-color);
  padding: 2px 8px; 
  border-radius: 6px; /* Menos radio es más fácil de dibujar */
  align-self: flex-start; 
  max-width: 100%; 
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- BOTÓN FAVORITOS --- */
.favorite-toggle-btn { 
  flex: 0 0 auto; 
  width: 40px; height: 40px; 
  /* Quitamos el borde y fondo complejo, dejamos solo área táctil */
  background: transparent; 
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  
  font-size: 1.2em; 
  color: var(--favorite-icon-default); 
  cursor: pointer;
  z-index: 5;
}

/* Feedback visual simple al tocar */
.favorite-toggle-btn:active { background: rgba(255,255,255,0.1); }

.favorite-toggle-btn.active { color: var(--favorite-icon-active); }
#filterFavBtn.active { background-color: var(--highlight-pink); color: white; }

/* 11. MENÚ FAB */
.menu-button {
  position: fixed; bottom: 25px; right: 25px; z-index: var(--z-fab);
  background: var(--highlight-pink); color: white; border: none; border-radius: 50%;
  width: 60px; height: 60px; font-size: 1.5em; cursor: pointer; 
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
}
.menu-button:active { transform: scale(0.9); }

.dropdown-menu {
  position: fixed; bottom: 95px; right: 25px; 
  background: var(--modal-bg);
  border-radius: 16px; padding: 15px; min-width: 220px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6); 
  opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.9);
  transform-origin: bottom right; transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: var(--z-menu); border: 1px solid rgba(255,255,255,0.1);
}
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.dropdown-menu button, .menu-link-button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px;
  color: var(--text-light); background: none; border: none; text-align: left;
  cursor: pointer; border-radius: 8px; font-family: var(--body-font); font-size: 1em; text-decoration: none;
}
.dropdown-menu button:hover, .menu-link-button:hover { background: rgba(255,255,255,0.1); color: var(--highlight-pink); }
.menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 0; }
.danger-text { color: var(--highlight-red) !important; }

/* 12. SUB-MENÚ: COPIA DE SEGURIDAD */
.backup-submenu {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--modal-overlay-bg);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.backup-submenu-content {
  background: var(--content-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.backup-submenu h3 {
  color: var(--header-color);
  margin-bottom: 10px;
  font-family: var(--title-font);
}

.backup-desc {
  color: var(--text-medium);
  margin-bottom: 25px;
  font-size: 0.9em;
}

.backup-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 25px;
}

.backup-option-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  color: var(--text-light);
}

.backup-option-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.backup-option-btn i {
  font-size: 1.5em;
  color: var(--highlight-pink);
  display: block;
  margin-bottom: 10px;
}

.backup-option-btn span {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
}

.backup-option-btn small {
  display: block;
  font-size: 0.85em;
  opacity: 0.7;
}

/* 13. MODAL DE AUDIO (Spotify Style) */
.audio-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--modal-overlay-bg);
  z-index: var(--z-modal);
  display: none;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.audio-modal.show { display: flex; }

.audio-modal-content {
  background: var(--content-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.audio-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.audio-modal-header h2 {
  font-family: var(--title-font);
  color: var(--header-color);
  margin: 0;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5em;
  cursor: pointer;
  padding: 5px;
  transition: color 0.3s;
}

.close-modal-btn:hover {
  color: var(--highlight-pink);
}

/* Controles de Reproducción */
.audio-player-controls {
  margin-bottom: 30px;
}

.current-track-info {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
}

.track-cover-mini {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.track-info-text {
  flex-grow: 1;
}

.track-title {
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 5px;
}

.track-artist {
  font-size: 0.9em;
  color: var(--text-medium);
}

.playback-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.control-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-light);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  transition: all 0.3s;
}

.control-btn.primary {
  width: 60px;
  height: 60px;
  background: var(--highlight-pink);
  border-color: var(--highlight-pink);
  font-size: 1.4em;
}

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

.control-btn.primary:hover {
  background: var(--highlight-pink-light);
}

.audio-options-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.option-btn {
  /* Tamaño fijo que no cede en layouts flex — fix Android */
  flex-shrink: 0;
  flex-grow: 0;
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  line-height: 1;
  padding: 0;
  box-sizing: border-box;
}

.option-btn:hover,
.option-btn.active {
  background: var(--highlight-pink);
  border-color: var(--highlight-pink);
}

/* ── SEEK BAR — Onda Sinusoidal Canvas ── */
.seek-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.seek-time {
  font-size: 0.75em;
  color: var(--text-medium);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.seek-canvas-wrapper {
  flex-grow: 1;
  min-width: 0;
  position: relative;
  /* Área táctil generosa: canvas ocupa todo el contenedor */
  cursor: pointer;
  /* La altura real la fija JS (_setupCanvas), esto es solo fallback */
  height: 40px;
  display: flex;
  align-items: center;
}

.seek-canvas {
  display: block;
  width: 100%;
  height: 40px;
  cursor: pointer;
  /* Antialiasing subpixel */
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
  /* El glow de la onda activa se extiende un poco fuera,
     overflow visible garantiza que no se recorte */
  overflow: visible;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  min-width: 0; /* evitar overflow en flex */
}

.volume-control i {
  color: var(--text-medium);
  font-size: 0.9em;
  flex-shrink: 0;
}

.volume-control input[type="range"] {
  flex-grow: 1;
  min-width: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--highlight-pink);
  cursor: pointer;
  flex-shrink: 0;
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--highlight-pink);
  cursor: pointer;
  border: none;
  flex-shrink: 0;
}

/* Grid de Playlist */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.playlist-item {
  background: rgba(255,255,255,0.05);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.playlist-item:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.playlist-item.active {
  border-color: var(--highlight-pink);
  background: rgba(255, 122, 168, 0.1);
}

.playlist-item-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.playlist-item-title {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item-artist {
  font-size: 0.75em;
  color: var(--text-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 13. TOASTS Y MODALES (Centrados) */
#achievement-toast-container { 
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); 
  z-index: var(--z-toast); pointer-events: none; width: 90%; max-width: 400px; 
  display: flex; flex-direction: column; align-items: center; 
}
.achievement-toast {
  background: var(--achievement-bg); color: var(--achievement-text); padding: 12px 24px;
  border-radius: 50px; margin-bottom: 10px; font-weight: 600; box-shadow: 0 5px 20px rgba(0,0,0,0.4);
  animation: slideDown 0.5s ease-out, fadeOut 0.5s ease-in 3.5s forwards;
  border: 1px solid rgba(255,255,255,0.1);
}

.glass-overlay, .media-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-overlay-bg);
    z-index: var(--z-modal);
    display: flex; justify-content: center; align-items: center; flex-direction: column;
    padding: 20px; animation: fadeIn 0.3s ease;
}
.glass-card {
    background: var(--content-bg); border: 1px solid rgba(255, 255, 255, 0.2); 
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5); border-radius: 20px; padding: 30px; 
    width: 100%; max-width: 340px; text-align: center; color: var(--text-light);
}
.media-content-container { max-width: 95%; max-height: 80vh; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; }
.secure-media { max-width: 100%; max-height: 70vh; border-radius: 12px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.media-controls { display: flex; gap: 15px; }
.media-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 10px 20px; border-radius: 30px; cursor: pointer; display: flex; align-items: center; gap: 5px; }

/* 14. ANIMACIONES */
@keyframes slideDown { from {transform:translateY(-100%); opacity:0;} to {transform:translateY(0); opacity:1;} }
@keyframes fadeOut { to {opacity:0;} }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
@keyframes float { 0%,100% {transform:translateY(0);} 50% {transform:translateY(-10px);} }
@keyframes slideUp { from {opacity:0; transform:translateY(20px);} to {opacity:1; transform:translateY(0);} }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   15. OPTIMIZACIÓN MÓVIL CRÍTICA
   Maximizar espacio, eliminar tubos, mostrar videos grandes
   ========================================= */
@media (max-width: 768px) {
  /* LAYOUT ANTI-TUBO: Expandir al 98% del ancho */
  .container { 
    width: 98%; 
    margin-top: 3rem; 
    padding: 1.5rem 0.3rem; /* Padding mínimo lateral */
    padding-bottom: 8rem; 
  }
  
  h1 { font-size: 1.8em; margin-bottom: 10px; }
  .intro-text { padding: 0 5px; font-size: 1em; }

  /* CONTENIDO EXPANDIDO */
  .contenido-container { 
    padding: 1rem 0.5rem; /* Menos padding interno */
    font-size: 16px; 
    margin-top: 1.5rem;
  }
  
  /* VIDEOS FULL WIDTH */
  .video-wrapper, .contenido-container img {
    width: 100%; 
    margin: 1em 0; 
    border-radius: 8px;
  }
  
  /* IFRAMES GRANDES */
  .internal-frame { height: 75vh; border-radius: 12px; }

  /* GRID TÁCTIL */
  .input-container { 
    display: grid; 
    grid-template-columns: 1fr 50px; 
    grid-template-rows: auto auto; 
    gap: 8px; 
    padding: 0 5px;
  }
  #codeInput { grid-column: 1 / -1; width: 100%; max-width: none; font-size: 1.1em; padding: 12px; }
  #checkBtn { grid-column: 1 / 2; width: 100%; margin: 0; }
  #hintBtn { grid-column: 2 / 3; width: 100%; height: 100%; margin: 0; }

  /* RENDIMIENTO */
  .header-img { animation: none; width: 120px; }
  .background-overlay, .dropdown-menu, .container, .achievement-toast, .audio-modal-content, .backup-submenu-content {
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  }
  .background-overlay { background-color: rgba(20, 18, 28, 0.9); }

  /* AJUSTES UI */
  .side-panel { width: 85%; }
  .menu-button { width: 55px; height: 55px; bottom: 20px; right: 20px; }
  .dropdown-menu { bottom: 90px; right: 20px; }
}


/* =========================================
   TYPEWRITER CURSOR
   ========================================= */

.typewriter-cursor {
  position: relative;
}

/* Cuerpo del cursor */
.typewriter-cursor::after {
  content: '';
  display: inline-block;

  width: 2px;
  height: 1.35em;

  margin-left: 6px;
  vertical-align: -0.15em;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0),
    var(--highlight-pink),
    rgba(255,255,255,0)
  );

  border-radius: 2px;

  /* Profundidad */
  box-shadow:
    0 0 6px rgba(255, 122, 168, 0.35),
    0 0 14px rgba(255, 122, 168, 0.25);

  opacity: 0.85;

  animation:
    cursorPulse 3.6s ease-in-out infinite,
    cursorFade 1.9s ease-in-out infinite;
}

/* Pulso lento */
@keyframes cursorPulse {
  0%, 100% {
    transform: scaleY(0.92);
    opacity: 0.55;
  }
  50% {
    transform: scaleY(1.08);
    opacity: 1;
  }
}

/* Desaparición suave */
@keyframes cursorFade {
  0%   { visibility: visible; }
  60%  { visibility: hidden; }
  100% { visibility: visible; }
}

/* Cartas largas: más discreto */
.mensaje-texto.typewriter-cursor::after {
  height: 1.25em;
  box-shadow:
    0 0 4px rgba(255, 122, 168, 0.25),
    0 0 10px rgba(255, 122, 168, 0.15);
  opacity: 0.55;
}

/* Dark mode */
body.dark-mode .typewriter-cursor::after {
  box-shadow:
    0 0 6px rgba(255, 174, 208, 0.35),
    0 0 16px rgba(255, 174, 208, 0.25);
}

/* Móvil: lujo silencioso */
@media (max-width: 768px) {
  .typewriter-cursor::after {
    margin-left: 4px;
    opacity: 0.45;
  }
}

/* =========================================
   MEJORAS VISUALES Y SISTEMA DE LOGROS
   ========================================= */

/* BOTÓN DE VER LOGROS */
.achievements-btn {
  margin-top: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.achievements-btn:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  transform: translateY(-2px) scale(1.02);
}

/* MODAL DE LOGROS */
.achievements-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.achievements-modal.show {
  display: flex;
}

.achievements-modal-content {
  background: linear-gradient(135deg, rgba(45, 45, 68, 0.95) 0%, rgba(30, 30, 45, 0.98) 100%);
  border-radius: 24px;
  padding: 2rem;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUp 0.4s ease-out;
}

.achievements-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.achievements-modal-header h2 {
  font-family: var(--title-font);
  font-size: 2em;
  color: #FFD700;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-modal-btn:hover {
  background: rgba(255, 77, 77, 0.8);
  transform: rotate(90deg);
}

/* TARJETA DE NIVEL DE USUARIO */
.user-level-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.user-level-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-30%, -30%); }
}

.level-badge {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.level-number {
  font-size: 2em;
  font-weight: 700;
  color: white;
  line-height: 1;
}

.level-label {
  font-size: 0.7em;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.level-info {
  flex: 1;
  position: relative;
  z-index: 1;
}

.level-info h3 {
  font-family: var(--title-font);
  font-size: 1.5em;
  color: white;
  margin: 0 0 0.3rem 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.level-info p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 0.8rem 0;
  font-size: 0.9em;
}

.level-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FFA500);
  border-radius: 10px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.level-progress-text {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
}

/* GRID DE ESTADÍSTICAS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 2em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value {
  font-size: 2em;
  font-weight: 700;
  color: var(--highlight-pink-light);
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.85em;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* SECCIÓN DE CATEGORÍAS */
.categories-section {
  margin-bottom: 2rem;
}

.section-subtitle {
  font-family: var(--title-font);
  font-size: 1.3em;
  color: var(--header-color);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.category-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.category-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.05);
}

.category-icon {
  font-size: 2em;
  margin-bottom: 0.5rem;
}

.category-name {
  font-size: 0.9em;
  color: var(--text-light);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.category-count {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--highlight-pink);
}

/* LISTA DE LOGROS */
.achievements-list-section {
  margin-top: 2rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.achievement-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.achievement-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #667eea, #764ba2);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.achievement-card:hover::before {
  transform: scaleY(1);
}

.achievement-card.unlocked {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
  border-color: rgba(102, 126, 234, 0.4);
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.2);
}

.achievement-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.achievement-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5em;
  transition: all 0.3s ease;
}

.achievement-card.unlocked .achievement-icon-wrapper {
  background: linear-gradient(135deg, #667eea, #764ba2);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.achievement-card.locked .achievement-icon-wrapper {
  background: rgba(100, 100, 100, 0.3);
}

.achievement-info {
  flex: 1;
}

.achievement-title {
  font-size: 1em;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.3rem;
}

.achievement-card.locked .achievement-title {
  color: var(--text-medium);
}

.achievement-desc {
  font-size: 0.85em;
  color: var(--text-medium);
  line-height: 1.4;
}

.achievement-card.locked .achievement-desc {
  color: #888;
}

.achievement-requirement {
  font-size: 0.75em;
  color: var(--highlight-gold);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* MEJORAS RESPONSIVE MÓVIL */
@media (max-width: 768px) {
  .achievements-modal-content {
    padding: 1.5rem;
    border-radius: 16px;
  }

  .achievements-modal-header h2 {
    font-size: 1.5em;
  }

  .user-level-card {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem 1rem;
  }

  .level-badge {
    width: 70px;
    height: 70px;
  }

  .level-number {
    font-size: 1.8em;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-icon {
    font-size: 1.5em;
  }

  .stat-value {
    font-size: 1.5em;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .achievement-card {
    padding: 1rem;
  }

  .achievement-icon-wrapper {
    width: 45px;
    height: 45px;
    font-size: 1.3em;
  }
}

/* ANIMACIÓN DE SHAKE */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* MEJORAS DE CONTRASTE Y LEGIBILIDAD */
.progreso-text {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.progress-bar-fill {
  background: linear-gradient(90deg, var(--highlight-pink), var(--highlight-pink-light));
  box-shadow: 0 0 10px rgba(255, 122, 168, 0.5);
}

/* MEJORAS GENERALES DE DISEÑO */
.container {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

h1 {
  background: linear-gradient(135deg, #F0E6DC, #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mejorar botones */
.button {
  background: linear-gradient(135deg, var(--button-bg-initial), var(--button-bg-hover));
  transition: all 0.3s ease;
}

.button:hover {
  box-shadow: 0 4px 15px rgba(154, 140, 139, 0.4);
  transform: translateY(-2px);
}

/* MEJORAS EN DARK MODE */
body.dark-mode .achievements-modal-content {
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.98) 0%, rgba(10, 10, 20, 0.98) 100%);
}

body.dark-mode .stat-card,
body.dark-mode .category-card,
body.dark-mode .achievement-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .stat-card:hover,
body.dark-mode .category-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* SCROLLBAR PERSONALIZADO PARA MODAL */
.achievements-modal-content::-webkit-scrollbar {
  width: 8px;
}

.achievements-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.achievements-modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #667eea, #764ba2);
  border-radius: 10px;
}

.achievements-modal-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #764ba2, #667eea);
}

/* =========================================
   NUEVAS FUNCIONALIDADES - EXPERIENCIA INMERSIVA
   ========================================= */

/* 1. SALUDO DINÁMICO */
.dynamic-greeting {
  font-weight: 500;
  color: var(--highlight-pink-light);
  min-height: 1.5em;
  transition: opacity 0.5s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 2. FEEDBACK HÁPTICO VISUAL - SHAKE ANIMATION */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.input-container.error-shake {
  animation: shake 0.2s ease-in-out 0s 2;
}

.input-container.error-shake #codeInput {
  border-color: var(--highlight-red) !important;
  box-shadow: 0 0 15px rgba(231, 76, 60, 0.5) !important;
}

/* 3. SISTEMA DE PISTAS PROGRESIVAS - BOTÓN DE BOMBILLA */
.hint-button {
  background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
  border: none;
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2em;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(243, 156, 18, 0.3);
  margin-left: 0.5rem;
}

.hint-button:hover {
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(243, 156, 18, 0.5);
}

.hint-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(243, 156, 18, 0.3);
}

.hint-button i {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

/* Modo Resonancia - Colores del input según cercanía */
#codeInput.resonance-cold {
  border-color: #3498db !important;
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.6) !important;
  animation: resonancePulse 1.5s ease-in-out infinite;
}

#codeInput.resonance-warm {
  border-color: #f1c40f !important;
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.7) !important;
  animation: resonancePulse 1s ease-in-out infinite;
}

#codeInput.resonance-hot {
  border-color: #e74c3c !important;
  box-shadow: 0 0 25px rgba(231, 76, 60, 0.8) !important;
  animation: resonancePulse 0.6s ease-in-out infinite;
}

@keyframes resonancePulse {
  0%, 100% {
    box-shadow: 0 0 15px currentColor;
  }
  50% {
    box-shadow: 0 0 30px currentColor;
  }
}

/* Animación de aparición de pista */
.hint-appear {
  animation: fadeInDown 0.4s ease-out;
}

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

/* 4. MODAL DEL ORÁCULO */
.oracle-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.oracle-modal.show {
  display: flex;
}

.oracle-modal-content {
  background: linear-gradient(135deg, rgba(30, 30, 50, 0.95) 0%, rgba(20, 20, 35, 0.98) 100%);
  border-radius: 24px;
  padding: 3rem 2rem;
  max-width: 600px;
  width: 95%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 215, 0, 0.3);
  animation: slideUp 0.4s ease-out;
}

.oracle-moon-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
}

.oracle-moon-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  animation: oracleGlow 3s ease-in-out infinite;
}

.oracle-moon-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  color: #FFD700;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

@keyframes oracleGlow {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.oracle-title {
  font-family: var(--title-font);
  font-size: 2em;
  color: #FFD700;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

.oracle-phrase {
  font-family: var(--body-font);
  font-size: 1.2em;
  line-height: 1.9;
  color: var(--text-light);
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border-left: 4px solid #FFD700;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.oracle-phrase-text {
  font-family: var(--title-font);
  font-size: 1.15em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.3px;
}

.oracle-return-message {
  font-size: 0.85em;
  color: rgba(255, 215, 0, 0.8);
  text-align: center;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  font-style: normal;
}

.oracle-close-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin-top: 1rem;
}

.oracle-close-btn:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 5. MODO LECTURA ENVOLVENTE */
.reading-mode-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(15px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.reading-mode-modal.show {
  display: flex;
}

.reading-mode-content {
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  position: relative;
  animation: slideUp 0.4s ease-out;
  overflow-y: auto;
  padding: 0 10px;
}

.exit-reading-btn {
  position: sticky;
  top: 20px;
  right: 0;
  margin-left: auto;
  display: block;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  margin-bottom: 20px;
}

.exit-reading-btn:hover {
  background: rgba(255, 77, 77, 0.8);
  transform: rotate(90deg);
}

.reading-mode-text {
  font-family: var(--title-font);
  font-size: 1.5em;
  line-height: 2;
  color: var(--text-light);
  text-align: center;
  white-space: pre-wrap;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: none;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Botón para activar modo lectura */
.expand-reading-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(102, 126, 234, 0.8);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 5;
}

.expand-reading-btn:hover {
  background: rgba(102, 126, 234, 1);
  transform: scale(1.1);
}

/* 6. RESPONSIVE MOBILE */
@media (max-width: 768px) {
  .hint-button {
    padding: 0.5rem 0.8rem;
    font-size: 1.1em;
  }

  .oracle-modal-content {
    padding: 2rem 1.5rem;
  }

  .oracle-moon-container {
    width: 80px;
    height: 80px;
  }

  .oracle-moon-icon {
    font-size: 3rem;
  }

  .oracle-title {
    font-size: 1.5em;
  }

  .oracle-phrase {
    font-size: 1em;
    padding: 1rem;
  }

  .oracle-phrase-text {
    font-size: 1.05em;
  }

  .reading-mode-text {
    font-size: 1.2em;
    line-height: 1.8;
    padding: 1.5rem;
  }

  .exit-reading-btn {
    width: 45px;
    height: 45px;
    top: 10px;
  }

  /* CORRECCIÓN: Modal de logros en móvil */
  .achievements-modal-content {
    padding: 1.5rem 1rem;
    border-radius: 16px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  .achievements-modal {
    padding: 10px;
  }

  .achievements-modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
  }

  .achievements-modal-header h2 {
    font-size: 1.4em;
  }

  .user-level-card {
    flex-direction: column;
    text-align: center;
    padding: 1.2rem 0.8rem;
  }

  .level-badge {
    width: 70px;
    height: 70px;
  }

  .level-number {
    font-size: 1.8em;
  }

  .level-info h3 {
    font-size: 1.2em;
  }

  .level-info p {
    font-size: 0.85em;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .stat-card {
    padding: 0.8rem;
  }

  .stat-icon {
    font-size: 1.5em;
  }

  .stat-value {
    font-size: 1.5em;
  }

  .stat-label {
    font-size: 0.75em;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .category-card {
    padding: 0.8rem;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .achievement-card {
    padding: 0.8rem;
  }

  .achievement-icon-wrapper {
    width: 45px;
    height: 45px;
    font-size: 1.3em;
  }

  .section-subtitle {
    font-size: 1.1em;
  }
}

/* Dark mode adjustments */
body.dark-mode .oracle-modal-content,
body.dark-mode .reading-mode-content {
  background: linear-gradient(135deg, rgba(15, 15, 25, 0.98) 0%, rgba(10, 10, 20, 0.98) 100%);
}

/* =========================================
   MÓDULO DE BUZÓN (CORREO INTERNO)
   ========================================= */

/* --- BADGES DE NOTIFICACIÓN --- */
.menu-notification-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  background: var(--highlight-red);
  border-radius: 50%;
  border: 2px solid white;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.menu-item-with-badge {
  position: relative;
}

.mailbox-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--highlight-red);
  color: white;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 700;
  margin-left: auto;
}

/* --- MODAL DEL BUZÓN --- */
.mailbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay-bg);
  z-index: var(--z-modal);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.mailbox-modal.show {
  opacity: 1;
  visibility: visible;
}

.mailbox-modal-content {
  background: var(--modal-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 95%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.mailbox-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mailbox-modal-header h2 {
  font-size: 1.5em;
  color: var(--header-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- LISTA DE CORREOS --- */
.mailbox-list {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mail-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.mail-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
  border-color: var(--highlight-pink);
}

.mail-item.unread {
  background: rgba(255, 122, 168, 0.1);
  border-left: 4px solid var(--highlight-pink);
}

.mail-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mail-sender {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.95em;
}

.mail-date {
  font-size: 0.8em;
  color: var(--text-medium);
}

.mail-subject {
  font-weight: 600;
  color: var(--text-light);
  font-size: 1.05em;
  margin-bottom: 5px;
}

.mail-preview {
  font-size: 0.9em;
  color: var(--text-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-unread-indicator {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 10px;
  height: 10px;
  background: var(--highlight-pink);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--highlight-pink);
}

/* --- VISOR DE EMAIL --- */
.mail-viewer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-bg);
  display: none;
  flex-direction: column;
  z-index: 10;
}

.mail-viewer.show {
  display: flex;
}

.mail-viewer-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-light);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.mail-back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mail-viewer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 25px;
}

.mail-viewer-meta {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-viewer-subject {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--header-color);
  margin-bottom: 12px;
}

.mail-viewer-info {
  display: flex;
  gap: 20px;
  font-size: 0.9em;
  color: var(--text-medium);
}

.mail-viewer-info span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-viewer-body {
  font-size: 1.05em;
  line-height: 1.8;
  color: var(--text-light);
  white-space: pre-wrap;
  margin-bottom: 30px;
}

/* --- ADJUNTOS --- */
.mail-attachments {
  margin-top: 30px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-attachments-title {
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.mail-attachment-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}

.mail-attachment-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border-color: var(--highlight-pink);
}

.attachment-icon {
  font-size: 2.5em;
  color: var(--highlight-pink);
  position: relative;
}

.attachment-lock {
  position: absolute;
  bottom: -5px;
  right: -5px;
  font-size: 0.5em;
  background: rgba(0, 0, 0, 0.8);
  padding: 4px;
  border-radius: 50%;
  color: var(--highlight-gold);
}

.attachment-name {
  font-size: 0.85em;
  color: var(--text-light);
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

/* Barra de progreso de descarga */
.attachment-progress {
  width: 100%;
  margin-top: 10px;
}

.attachment-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
  position: relative;
}

.attachment-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--highlight-pink), var(--highlight-pink-light));
  transition: width 0.3s;
}

.attachment-progress-text {
  font-size: 0.75em;
  color: var(--text-medium);
  text-align: center;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
  .mailbox-modal-content {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .mailbox-modal-header {
    padding: 15px 20px;
  }

  .mailbox-modal-header h2 {
    font-size: 1.3em;
  }

  .mail-viewer-subject {
    font-size: 1.3em;
  }

  .mail-attachments-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .mailbox-list {
    padding: 10px;
  }

  .mail-viewer-content {
    padding: 15px 20px;
  }
}

/* =========================================
   ICONOS SVG - Estilos para reemplazo de emojis
   ========================================= */

/* Contenedor base para iconos SVG */
.svg-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* Estilos generales para todos los iconos SVG */
.svg-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
  transition: transform 0.2s ease;
}

/* Iconos individuales con colores específicos */
.icon-lightbulb {
  color: var(--highlight-gold);
}

.icon-error {
  color: var(--highlight-red);
}

.icon-error-color {
  color: var(--highlight-red) !important;
}

.icon-success {
  color: var(--highlight-green);
}

.icon-success-color {
  color: var(--highlight-green) !important;
}

.icon-lock {
  color: var(--text-medium);
}

.icon-unlocked {
  color: var(--highlight-green);
}

.icon-celebration {
  color: var(--highlight-pink);
  animation: celebration-pulse 0.6s ease infinite;
}

.icon-trophy {
  color: var(--highlight-gold);
}

.icon-fire {
  color: #ff6b35;
}

.icon-fire-color {
  color: #ff6b35 !important;
}

.icon-sparkles {
  color: var(--highlight-pink-light);
  animation: sparkle-twinkle 1.5s ease-in-out infinite;
}

.icon-moon {
  color: var(--progress-color);
}

.icon-star {
  color: var(--highlight-gold);
}

.icon-heart {
  color: var(--highlight-pink);
}

.icon-heart-purple,
.icon-purple {
  color: #A860A8 !important;
}

/* Animaciones para iconos */
@keyframes celebration-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes sparkle-twinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.7; transform: scale(1.05) rotate(5deg); }
}

/* Hover effects para iconos interactivos */
.svg-icon:hover {
  transform: scale(1.1);
}

/* Iconos en toasts */
.achievement-toast .svg-icon {
  margin-right: 0.5em;
  flex-shrink: 0;
}

/* Iconos en mensajes */
.contenido-container .svg-icon {
  margin-right: 0.3em;
  vertical-align: -0.1em;
}

/* Modo oscuro */
body.dark-mode .icon-lightbulb {
  color: #FFD700;
}

body.dark-mode .icon-fire {
  color: #ff8555;
}

body.dark-mode .icon-sparkles {
  color: var(--highlight-pink);
}

/* Responsividad de iconos */
@media (max-width: 768px) {
  .svg-icon {
    width: 0.95em;
    height: 0.95em;
  }
}

/* Asegurar que los SVG no se deformen */
.svg-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINCRONIZACIÓN POR QR
   ═══════════════════════════════════════════════════════════════════════════ */

/* Botón QR en submenu backup */
.backup-option-btn--qr {
  border: 1px solid rgba(var(--highlight-pink-rgb, 255,110,199), 0.4);
}

.backup-option-btn--qr i {
  color: var(--highlight-pink, #ff6ec7);
}

/* Overlay del modal */
.sync-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Contenedor del modal */
.sync-modal-content {
  background: var(--card-bg, #2a2538);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: sync-modal-in 0.25s ease;
}

@keyframes sync-modal-in {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Cabecera del modal */
.sync-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.sync-modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary, #fff);
}

.sync-modal-header h2 i {
  margin-right: 0.4rem;
  color: var(--highlight-pink, #ff6ec7);
}

/* Descripción */
.sync-modal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary, rgba(255,255,255,0.65));
  margin-bottom: 1.1rem;
  line-height: 1.5;
}

/* Contenedor del QR — fondo blanco obligatorio para escaneabilidad */
.sync-qr-wrapper {
  background-color: #ffffff;
  padding: 15px;
  border-radius: 12px;
  display: inline-block;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.sync-qr-wrapper img {
  display: block;
  width: 250px;
  height: 250px;
  image-rendering: pixelated; /* Evita suavizado que difumina el QR */
}

/* Hint informativo */
.sync-modal-hint {
  font-size: 0.75rem;
  color: var(--text-secondary, rgba(255,255,255,0.5));
  margin-bottom: 1.1rem;
  line-height: 1.4;
}

.sync-modal-hint i {
  color: var(--highlight-pink, #ff6ec7);
  margin-right: 0.3rem;
}

/* Botones de acción */
.sync-modal-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Responsividad: QR más pequeño en pantallas muy estrechas */
@media (max-width: 380px) {
  .sync-qr-wrapper img {
    width: 200px;
    height: 200px;
  }
  .sync-modal-content {
    padding: 1.25rem 1rem;
  }
}
