/* style.css - Refactor para Minijuegos - Optimizado para iPhone */
@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&display=swap');

/* --- Variables CSS --- */
:root {
  --primary-color: #ff6b9d;
  --secondary-color: #ff8fab;
  --background-gradient: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.35);
  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --shadow-glass: 0 12px 40px rgba(236, 72, 153, 0.25);
  --blur-strength: blur(12px);
  --sparkle-gradient: linear-gradient(135deg, #ff6b9d, #c084fc, #8b5cf6, #ec4899);
}

/* --- Configuración General --- */
body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background-gradient);
  color: var(--text-primary);
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Solo aplicar flex center al index/home */
body:not(.snake-page):not(.quiz-page):not(.mejora-vida-page) {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

html {
  height: 100%;
  overflow-x: hidden;
}

/* --- Contenedor Principal con efecto cristal --- */
.main-container {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-glass);
  padding: 2em 1.5em;
  width: 100%;
  max-width: min(500px, calc(100vw - 40px));
  box-sizing: border-box;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.main-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  z-index: 1;
}

/* Contenedores adicionales con efecto cristal */
.container {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-glass);
  padding: 2em;
  width: 100%;
  max-width: min(500px, calc(100vw - 40px));
  box-sizing: border-box;
  margin: 0 auto;
}

/* --- Cabecera y Título --- */
.title-container {
  position: relative;
  margin-bottom: 2em;
}

.title-image {
  position: absolute;
  left: 50%;
  top: -70px; /* Ajustar para que se vea bien */
  transform: translateX(-50%);
  width: 120px;
  max-width: 50vw;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.1));
}

.main-title {
  font-size: clamp(2.2em, 7vw, 3.5em);
  font-weight: 800;
  margin-top: 50px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}

.title-text {
  background: linear-gradient(135deg, #ff6b9d 0%, #ec4899 50%, #be185d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  position: relative;
  animation: titleGlow 3s ease-in-out infinite alternate;
}

.title-accent {
  background: linear-gradient(135deg, #c084fc 0%, #8b5cf6 50%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  font-style: italic;
  transform: scale(1.05);
  position: relative;
  animation: titleGlow 3s ease-in-out infinite alternate-reverse;
}

/* Eliminar estilos antiguos de h1 */
h1:not(.main-title) {
  font-size: clamp(2.5em, 8vw, 3.8em);
  font-weight: 700;
  margin-top: 50px;
  background: linear-gradient(135deg, #ec4899 0%, #be185d 50%, #a21caf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
  position: relative;
  text-align: center;
  animation: titleGlow 3s ease-in-out infinite alternate;
}

/* Efecto de brillo animado para el título */
@keyframes titleGlow {
  0% {
    filter: drop-shadow(0 0 5px rgba(236, 72, 153, 0.3));
  }
  100% {
    filter: drop-shadow(0 0 15px rgba(236, 72, 153, 0.6)) 
           drop-shadow(0 0 25px rgba(190, 24, 93, 0.4));
  }
}

/* Efecto de cristal detrás del título */
h1::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -20px;
  right: -20px;
  bottom: -10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  z-index: -1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.subtitle {
  font-size: 1.3em;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  margin-top: 0.8em;
  letter-spacing: 0.02em;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.sparkle {
  font-size: 1.1em;
  animation: sparkleFloat 2s ease-in-out infinite alternate;
  display: inline-block;
}

.sparkle:nth-child(1) {
  animation-delay: 0s;
}

.sparkle:nth-child(3) {
  animation-delay: 1s;
}

@keyframes sparkleFloat {
  0% {
    transform: translateY(0px) rotate(0deg) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-3px) rotate(10deg) scale(1.1);
    opacity: 1;
  }
}

/* --- Menú de Navegación --- */
.menu-container {
  display: flex;
  flex-direction: column;
  gap: 1em;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.menu-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  padding: 1.2em 1em;
  border-radius: 20px;
  text-decoration: none;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 12px 40px rgba(236, 72, 153, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: visible;
  min-height: 130px;
  width: 100%;
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  text-align: center;
}

.button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  flex: 1;
}

.menu-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.menu-button:hover::before {
  left: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.5em;
  border-radius: 12px;
  text-decoration: none;
  font-size: 1em;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  border: none;
  outline: none;
}

.menu-button:active,
.btn:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.1s ease;
}

/* Estados para botones táctiles */
.menu-button:focus,
.btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Desktop hover effects */
@media (hover: hover) and (pointer: fine) {
  .menu-button:hover,
  .btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
      0 16px 50px rgba(236, 72, 153, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.6),
      0 1px 3px rgba(0, 0, 0, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
  }
  
  #options-container button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-3px);
    box-shadow: 
      0 12px 30px rgba(236, 72, 153, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.4);
  }
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
  .menu-button:hover,
  .btn:hover {
    transform: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  }
}

.menu-button .material-icons {
  font-size: 2em;
}

/* --- Progress Bar Styles --- */
.progress-container {
  width: 100%;
  margin-top: auto;
  opacity: 1;
  visibility: visible;
  display: block;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skill-level {
  font-size: 0.75em;
  font-weight: 600;
  margin-top: 0.5em;
  opacity: 1;
  line-height: 1.2;
  visibility: visible;
  display: block;
  text-align: center;
}

.skill-beginner { color: #f59e0b; }
.skill-intermediate { color: #3b82f6; }
.skill-advanced { color: #8b5cf6; }
.skill-expert { color: #10b981; }

/* --- Pie de página --- */
.footer-love {
  text-align: center;
  font-size: 0.95em;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2em;
  font-weight: 500;
  opacity: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* --- Optimizaciones para Desktop --- */
@media screen and (min-width: 768px) {
  body {
    padding: 40px;
  }
  
  .main-container,
  .container {
    max-width: 600px;
    padding: 3em 2.5em;
  }
  
  .menu-button {
    padding: 2em;
    font-size: 1.2em;
    min-height: 140px;
    height: 140px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .menu-container {
    gap: 1.5em;
  }
  
  h1 {
    font-size: clamp(2.5em, 6vw, 4em);
  }
  
  .title-image {
    width: 140px;
    top: -80px;
  }
  
  #options-container button {
    padding: 1.2em 2em;
    font-size: 1.1em;
    max-width: 500px;
    margin: 0 auto 1em auto;
  }
  
  .question-text {
    font-size: 1.4em;
    max-width: 500px;
    margin: 0 auto 2em auto;
  }
  
  .answer-buttons {
    max-width: 500px;
    margin: 0 auto 2em auto;
    gap: 1em;
  }
  
  .answer-buttons button {
    padding: 1.2em 2em;
    font-size: 1.1em;
  }
  
  .session-options {
    max-width: 500px;
    margin: 0 auto 2rem auto;
  }
  
  .btn-session {
    padding: 1.2em 2em;
    font-size: 1.1em;
    min-width: 150px;
  }
}

/* --- Optimizaciones para Tablet --- */
@media screen and (min-width: 481px) and (max-width: 767px) {
  body {
    padding: 20px;
  }
  
  .main-container,
  .container {
    max-width: 500px;
    padding: 2.5em 2em;
  }
  
  .menu-button {
    padding: 1.8em;
    font-size: 1.15em;
    min-height: 130px;
    height: 130px;
    width: 100%;
    box-sizing: border-box;
  }
  
  h1 {
    font-size: clamp(2em, 6vw, 3.2em);
  }
  
  #options-container button {
    padding: 1.1em 1.8em;
    font-size: 1.05em;
  }
}

/* --- Optimizaciones para iPhone --- */
@media screen and (max-width: 480px) {
  html {
    height: 100%;
    overflow: hidden;
  }
  
  body {
    padding: 0;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .main-container {
    padding: max(0.5em, env(safe-area-inset-top)) 0.5em max(0.5em, env(safe-area-inset-bottom)) 0.5em;
    margin: 0;
    border-radius: 0;
    border: none;
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    gap: 0.3em;
  }
  
  .container:not(.quiz-container):not(.results-container) {
    padding: max(0.2em, env(safe-area-inset-top)) 1em max(1.5em, env(safe-area-inset-bottom)) 1em;
    margin: 0 auto;
    border-radius: 16px;
    max-height: 100vh;
    overflow-y: auto;
    width: calc(100vw - 2em);
    max-width: calc(100vw - 2em);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.3em;
  }
  
  .title-container {
    margin-bottom: 0.5em;
    flex-shrink: 0;
  }
  
  .title-image {
    width: clamp(60px, 15vw, 80px);
    top: -30px;
  }
  
  .main-title,
  h1 {
    margin-top: 5px;
    font-size: clamp(1.3em, 5vw, 2em);
    margin-bottom: 0.2em;
    line-height: 1.1;
  }
  
  header {
    margin-bottom: 0.1em;
    padding: 0;
  }
  
  .decorative-image-small {
    margin-bottom: 0;
    margin-top: -0.2em;
  }
  
  header h1 {
    margin-top: -0.1em;
    margin-bottom: 0.1em;
  }
  
  .subtitle {
    font-size: clamp(0.8em, 3.5vw, 1em);
    margin-bottom: 0.5em;
  }
  
  .menu-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6em;
    width: 100%;
    flex: 1;
    align-content: center;
    padding: 0.5em;
  }
  
  .menu-button {
    padding: 1em;
    font-size: 1em;
    min-height: clamp(80px, 12vh, 120px);
    height: clamp(80px, 12vh, 120px);
    gap: 0.5em;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-strength);
    -webkit-backdrop-filter: var(--blur-strength);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-glass);
  }
  
  .menu-button .material-icons {
    font-size: 1.8em;
  }
  
  .footer-branding {
    margin-bottom: 0.5em;
    flex-shrink: 0;
  }
  
  .social-links {
    gap: 1em;
  }
  
  .social-icon {
    width: 40px;
    height: 40px;
  }
  
  .footer-love {
    font-size: 0.8em;
    margin-bottom: 0;
    flex-shrink: 0;
    padding-bottom: max(0.5em, env(safe-area-inset-bottom));
  }
  
  /* Optimizaciones para botones de opciones en móvil */
  #options-container {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    width: 100%;
    align-items: center;
  }
  
  #options-container button {
    padding: 1.2em 1em;
    font-size: 1.1em;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    min-height: 3em;
    text-align: center;
  }
  
  /* Optimización del main content */
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.2em 0;
    max-height: calc(100vh - 8em);
    overflow-y: auto;
  }
  
  /* Centrar footer y botón volver al menú */
  footer {
    text-align: center;
    padding: 0.5em 0;
    margin-top: auto;
    flex-shrink: 0;
    min-height: 3em;
  }
  
  footer .btn {
    display: inline-block;
    margin: 0 auto;
  }
  
  /* Optimizar feedback container para respuestas */
  #feedback-container {
    margin-top: 1em;
    padding: 1em;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.1em;
    min-height: 2em;
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Optimizar botones de respuesta para mejora de vida */
  .answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    width: 100%;
    align-items: center;
  }
  
  .answer-buttons button {
    width: 100%;
    padding: 1.2em 1em;
    font-size: 1.1em;
    margin: 0;
    box-sizing: border-box;
    min-height: 3em;
    text-align: center;
  }
  
  #next-btn {
    margin: 1em 0;
    width: 100%;
    max-width: none;
  }
  
  .progress-container {
    margin-top: 0.2em;
  }
  
  .skill-level {
    font-size: 0.65em;
    margin-top: 0.2em;
  }
  
  .progress-bar {
    height: 4px;
  }
  
  /* Optimización para quizz */
  .quiz-container:not(.hide) {
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0.3em;
    margin: 0;
    overflow: hidden;
    gap: 0.5em;
    position: fixed;
    top: 0;
    left: 0;
  }
  
  .quiz-header {
    padding: 0.5em 0;
    margin-bottom: 0.5em;
  }
  
  .quiz-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 0.5em;
  }
  
  .question-container {
    margin-bottom: 0.5em;
  }
  
  .question-text {
    font-size: clamp(1.1em, 4.5vw, 1.4em);
    line-height: 1.3;
    margin: 0 0 1em 0;
    padding: 1em;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
  
  .answers-container {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
  }
  
  .answer-button {
    padding: 0.8em;
    font-size: clamp(0.9em, 3.5vw, 1.1em);
    line-height: 1.2;
    min-height: 50px;
  }
  
  .quiz-footer {
    padding: 0.5em 0;
    margin-top: 0.5em;
  }
  
  .quiz-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 0.5em;
  }
  
  .next-button {
    padding: 0.8em 1.5em;
    font-size: 1em;
    width: 100%;
  }
}

/* --- Forzar tema rosa siempre (sin modo oscuro automático) --- */
/* Comentado para mantener consistencia entre dominios */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --background-gradient: linear-gradient(135deg, #1f1024 0%, #3d1a36 50%, #4a1d4a 100%);
    --text-primary: #F2F2F7;
    --text-secondary: #8E8E93;
    --glass-bg: rgba(28, 28, 30, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-glass: 0 8px 32px rgba(168, 85, 247, 0.3);
  }
}
*/

/* --- Clases de utilidad --- */
.hidden {
  display: none;
}

/* --- Animaciones suaves --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Estilos para elementos de juego --- */
#trivial-container,
#game-container {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-glass);
  padding: 2em;
  text-align: center;
  width: 100%;
  max-width: min(500px, calc(100vw - 40px));
  box-sizing: border-box;
}

/* --- Imagen decorativa en páginas internas --- */
.decorative-image-small {
  width: 80px;
  height: auto;
  margin-bottom: 0.3em;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
  max-width: 25vw;
}

/* --- Header para páginas internas --- */
header {
  text-align: center;
  margin-bottom: 1em;
}

header h1 {
  font-size: clamp(1.5em, 4vw, 2em);
  margin-top: 0.2em;
}

/* --- Información del juego --- */
.game-info {
  margin: 0.5em 0 1em 0;
  text-align: center;
}

.game-info small {
  color: var(--text-secondary);
  font-size: 0.85em;
  font-weight: 400;
}

/* --- Canvas del juego --- */
#snake-canvas {
  border-radius: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Controles táctiles mejorados --- */
#controls {
  margin-top: 1.5em;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
}

#controls button {
  font-size: 1.8em;
  padding: 0.8em;
  min-height: 60px;
  min-width: 60px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-weight: 600;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#controls button:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.3);
}

/* --- Mejoras para opciones de trivial --- */
#options-container button {
  width: 100%;
  margin-bottom: 0.8em;
  padding: 1em 1.5em;
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 1em;
  font-weight: 500;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  touch-action: manipulation;
}

#options-container button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

#options-container button:active {
  transform: translateY(0) scale(0.98);
  background: rgba(255, 255, 255, 0.1);
}

/* --- Estilos para la selección de sesión del Quizz */
.session-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

@media (min-width: 480px) {
    .session-options {
        flex-direction: row;
        justify-content: center;
    }
}

.btn-session {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 1em 1.5em;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    touch-action: manipulation;
}

.btn-session:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.btn-session:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* --- Quiz container --- */
.hide {
    display: none !important;
}

.question-text {
    font-size: 1.2em;
    font-weight: 500;
    margin-bottom: 1.5em;
    color: var(--text-primary);
    line-height: 1.4;
}

.answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
    margin-bottom: 1.5em;
}

.answer-buttons button {
    padding: 1em 1.5em;
    text-align: left;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.answer-buttons button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.answer-buttons button.correct {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.6);
    color: #065f46;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.answer-buttons button.wrong {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #7f1d1d;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Feedback visual mejorado */
.question-feedback {
    margin-top: 1.5em;
    padding: 1.2em;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.correct-answer-display {
    color: #065f46;
    font-weight: 700;
    font-size: 1.1em;
    background: rgba(34, 197, 94, 0.15);
    padding: 0.8em 1.2em;
    border-radius: 8px;
    margin: 0.8em 0;
    border-left: 4px solid #10b981;
}

.wrong-answer-display {
    color: #7f1d1d;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.15);
    padding: 0.8em 1.2em;
    border-radius: 8px;
    margin: 0.8em 0;
    border-left: 4px solid #ef4444;
}

.explanation-text {
    color: var(--text-primary);
    font-style: italic;
    font-size: 0.95em;
    margin-top: 1em;
    padding: 1em;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border-left: 3px solid #ec4899;
}

/* Estilos para la pantalla de resultados */
.results-container {
    text-align: center;
}

#confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.final-score-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.feedback-message {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #e3f2fd;
    border-left: 5px solid #2196f3;
    font-style: italic;
}

.incorrect-answers-list p {
    background-color: #ffebee;
    padding: 0.75rem;
    border-radius: 5px;
    margin-top: 0.5rem;
    text-align: left;
}

.incorrect-answers-list strong {
    color: #c62828; /* Rojo oscuro para la respuesta incorrecta */
}

.incorrect-answers-list em {
    color: #2e7d32; /* Verde para la respuesta correcta */
}

.result-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* --- Estilos para el botón de Amor --- */
.love-button {
    background: linear-gradient(135deg, #ff8a80, #ff80ab);
    color: white;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.love-button .material-icons {
    color: white;
}

.love-button:hover::before {
    display: none; /* Ocultar el brillo genérico en hover */
}

@media (hover: hover) {
  .love-button:hover {
    background: linear-gradient(135deg, #ff80ab, #ff8a80);
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 20px rgba(255, 105, 180, 0.4);
    color: white;
  }
}

.love-button:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* --- Hamburger Button --- */
.hamburger-button {
    position: fixed;
    top: max(20px, env(safe-area-inset-top, 0px));
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

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

.hamburger-button:active {
    transform: scale(0.95);
}

/* --- Hamburger Menu --- */
.hamburger-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-strength);
    -webkit-backdrop-filter: var(--blur-strength);
    border: none;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    z-index: 1500;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    padding-top: env(safe-area-inset-top, 20px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-menu.show {
    right: 0;
}

/* Desktop-specific styles */
@media screen and (min-width: 769px) {
    .hamburger-menu {
        width: 320px;
        max-height: calc(100vh - 40px);
        top: 20px;
        right: -340px; /* Hide off-screen */
        border-radius: 12px 0 0 12px;
        height: auto;
        min-height: 400px;
        transform: translateX(0); /* Reset transform for desktop */
        transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    .hamburger-menu.show {
        right: 20px; /* Show menu on desktop */
        transform: translateX(0); /* Ensure it's not moved by mobile styles */
    }
}

.hamburger-content {
    width: min(90vw, 400px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
}

.hamburger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5em 1.5em 1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.hamburger-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 600;
}

.hamburger-body {
    padding: 1.5em;
    flex: 1;
    overflow-y: auto;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-body {
    padding: 1.5em 2em 2em;
}

.setting-group {
    margin-bottom: 2em;
}

.setting-group h4 {
    margin: 0 0 1em 0;
    color: var(--text-primary);
    font-size: 1.1em;
    font-weight: 600;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
    flex-wrap: wrap;
    gap: 0.5em;
}

.setting-item label {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    min-width: 150px;
}

.setting-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.5em;
    font-size: 0.9em;
    min-width: 120px;
}

.setting-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* --- Footer Branding --- */
.footer-branding {
    text-align: center;
    margin-bottom: 1.5em;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.2em;
    align-items: center;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-primary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    box-shadow: 
        0 6px 20px rgba(236, 72, 153, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.social-icon:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(236, 72, 153, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.social-icon .material-icons {
    font-size: 1.3em;
}

.social-icon svg {
    width: 22px;
    height: 22px;
}

/* Colores específicos para cada red social */
.website-icon:hover {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.4);
}

.x-icon:hover {
    background: rgba(15, 20, 25, 0.15);
    border-color: rgba(15, 20, 25, 0.4);
}

.linkedin-icon:hover {
    background: rgba(10, 102, 194, 0.15);
    border-color: rgba(10, 102, 194, 0.4);
}

/* Mobile adjustments for hamburger menu */
/* Optimizaciones adicionales para móvil */
@media screen and (max-width: 480px) {
    .hamburger-button {
        top: max(15px, env(safe-area-inset-top, 0px));
        right: 15px;
        width: 44px;
        height: 44px;
        font-size: 1.1em;
        z-index: 1000;
    }
    
    .hamburger-menu {
        width: min(90vw, 300px);
        right: -100%;
        height: 100vh;
        padding-top: max(60px, env(safe-area-inset-top, 0px));
        padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
    }
    
    .hamburger-header {
        padding: 1em 1.2em 0.8em;
    }
    
    .hamburger-body {
        padding: 1em 1.2em;
        overflow-y: auto;
        flex: 1;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }
    
    .setting-item label {
        min-width: auto;
        font-size: 0.9em;
    }
    
    .setting-select {
        width: 100%;
        font-size: 0.9em;
    }
    
    .social-icon {
        width: 36px;
        height: 36px;
    }
    
    .social-icon .material-icons {
        font-size: 1.1em;
    }
    
    /* Optimizaciones para pantallas de resultados */
    .results-container:not(.hide) {
        height: 100vh;
        width: 100vw;
        max-width: 100vw;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 1em;
        margin: 0;
        overflow: hidden;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    .final-score {
        font-size: clamp(2em, 8vw, 3em);
        margin: 0.5em 0;
    }
    
    .final-score-text {
        font-size: clamp(1.2em, 5vw, 1.5em);
        margin-bottom: 1em;
    }
    
    .restart-button,
    .menu-button-result {
        padding: 0.8em 1.5em;
        font-size: 1em;
        margin: 0.3em 0;
        width: 100%;
    }
}

/* iPhone con notch - Optimización universal */
@media screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3),
       screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3),
       screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2),
       screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) {
    
    body {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
        height: 100vh;
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .main-container,
    .container {
        margin-top: env(safe-area-inset-top, 0);
        margin-bottom: env(safe-area-inset-bottom, 0);
        max-height: calc(100vh - env(safe-area-inset-top, 0) - env(safe-area-inset-bottom, 0));
    }
    
    .hamburger-button {
        top: max(20px, env(safe-area-inset-top, 47px));
        right: 20px;
        z-index: 1000;
    }
    
    .hamburger-menu {
        width: min(90vw, 320px);
        padding-top: max(60px, env(safe-area-inset-top, 47px));
        padding-bottom: max(20px, env(safe-area-inset-bottom, 34px));
        height: 100vh;
    }
    
    /* Optimizaciones para quizz en iPhone con notch */
    .quiz-container {
        padding-top: max(0.5em, env(safe-area-inset-top, 0));
        padding-bottom: max(0.5em, env(safe-area-inset-bottom, 0));
        height: 100vh;
    }
    
    .quiz-header {
        padding-top: 0.5em;
    }
    
    .quiz-footer {
        padding-bottom: 0.5em;
    }
}

/* iPhone 16 Pro Max (440x956) específico */
@media screen and (device-width: 440px) and (device-height: 956px) and (-webkit-device-pixel-ratio: 3) {
    .hamburger-button {
        top: max(25px, env(safe-area-inset-top, 54px));
        right: 25px;
    }
    
    .hamburger-menu {
        width: min(85vw, 320px);
        padding-top: max(25px, env(safe-area-inset-top, 54px));
        padding-bottom: max(25px, env(safe-area-inset-bottom, 34px));
    }
    
    .main-container {
        padding-top: max(25px, env(safe-area-inset-top, 54px));
        padding-bottom: max(25px, env(safe-area-inset-bottom, 34px));
    }
    
    .title-container h1 {
        font-size: 2.8em;
    }
    
    .menu-button {
        padding: 1.2em 1.5em;
        font-size: 1.1em;
    }
}

/* Mejoras generales para todos los iPhones */
@media screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    .hamburger-button {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    .hamburger-menu {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Optimizaciones adicionales de espaciado para iPhone */
    header {
        margin-bottom: 0.3em;
    }
    
    .decorative-image-small {
        width: 60px;
        margin-bottom: 0.1em;
    }
    
    header h1 {
        margin-top: 0.05em;
        font-size: clamp(1.3em, 5vw, 1.8em);
    }
    
    .quiz-container {
        padding: 0.2em;
        gap: 0.3em;
    }
    
    .hamburger-menu {
        will-change: transform;
    }
    
    .hamburger-menu.show {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
    
    /* Asegurar que el menú esté por encima de todo */
    .hamburger-menu {
        z-index: 9999;
    }
    
    .hamburger-button {
        z-index: 10000;
    }
}

/* === DECORACIONES DE ELOTE === */
.elote-decoration {
    display: inline-block;
    animation: eloteBounce 2s ease-in-out infinite;
    font-size: 1.2em;
    margin: 0 0.3em;
}

.elote-decoration:nth-child(even) {
    animation-delay: 1s;
}

.elote-game-button {
    position: relative;
    overflow: visible;
}

.elote-trail {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0.7;
}

.mini-elote {
    font-size: 12px;
    animation: eloteFloat 3s ease-in-out infinite;
    transform-origin: center;
}

.mini-elote:nth-child(1) {
    animation-delay: 0s;
}

.mini-elote:nth-child(2) {
    animation-delay: 0.5s;
}

.mini-elote:nth-child(3) {
    animation-delay: 1s;
}

.elote-game-button:hover .mini-elote {
    animation-duration: 1s;
}

@keyframes eloteBounce {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(5deg);
    }
}

@keyframes eloteFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.7;
    }
    33% {
        transform: translateY(-3px) scale(1.1);
        opacity: 1;
    }
    66% {
        transform: translateY(2px) scale(0.9);
        opacity: 0.8;
    }
}

/* Efecto especial en el título */
.title-container .elote-decoration {
    position: relative;
}

.title-container .elote-decoration::after {
    content: '🌽';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7em;
    opacity: 0;
    animation: eloteSparkle 4s ease-in-out infinite;
}

@keyframes eloteSparkle {
    0%, 90%, 100% {
        opacity: 0;
        transform: translateX(-50%) translateY(0px) scale(0.5);
    }
    5%, 15% {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px) scale(1);
    }
}
/* =============== CLOUD SAVE STYLES =============== */
.cloud-save-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.cloud-button {
    background-color: #5a67d8; /* Un tono azul/morado */
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cloud-button:hover {
    background-color: #434190;
}

/* =============== MODAL STYLES =============== */
.modal-container {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #2c2c2c;
    color: #f1f1f1;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    text-align: center;
    animation: slideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.close-modal-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal-btn:hover,
.close-modal-btn:focus {
    color: #fff;
    text-decoration: none;
}

.modal-content h2 {
    margin-top: 0;
    color: #ffca28; /* Amarillo */
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #3f3f3f;
    color: white;
    box-sizing: border-box; /* Asegura que el padding no afecte el ancho */
}

.status-message {
    margin-top: 15px;
    font-weight: bold;
    min-height: 20px;
}

.status-message.success {
    color: #4caf50; /* Verde */
}

.status-message.error {
    color: #f44336; /* Rojo */
}

 @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* --- ESTILOS ESPECÍFICOS PARA PÁGINAS --- */

/* Snake Game Styles */
.snake-page body {
    padding: 0;
    display: block;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
    min-height: 100vh;
}

.snake-page html {
    height: 100%;
}

.snake-page * {
    box-sizing: border-box;
}

.snake-page #game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    max-width: min(95vw, 600px);
    margin: 0 auto;
    gap: 1em;
}

.snake-page #snake-canvas {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: min(85vw, 360px);
    height: min(85vw, 360px);
    max-width: 360px;
    max-height: 360px;
}

.snake-page #score {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-strength);
    padding: 0.8em 1.5em;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 150px;
}

.snake-page .game-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5em 1em;
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.snake-page #controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0.5em;
    width: 200px;
    height: 120px;
    margin-top: 1em;
}

.snake-page #controls button {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-strength);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-size: 1.5em;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.snake-page #controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.snake-page #controls button:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.snake-page #up-btn { grid-column: 2 / 3; grid-row: 1 / 2; }
.snake-page #left-btn { grid-column: 1 / 2; grid-row: 2 / 3; }
.snake-page #right-btn { grid-column: 3 / 4; grid-row: 2 / 3; }
.snake-page #down-btn { grid-column: 2 / 3; grid-row: 2 / 3; }

.snake-page .start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 107, 157, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.snake-page .start-screen h2 {
    color: white;
    font-size: 1.8em;
    margin-bottom: 0.5em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.snake-page .start-screen p {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 1.5em;
    font-size: 1em;
}

.snake-page .start-btn {
    background: linear-gradient(135deg, #ff6b9d, #ff8a80);
    color: white;
    border: none;
    padding: 1em 2em;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.snake-page .start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
}

.snake-page .start-btn:active {
    transform: translateY(0);
}

.snake-page .start-btn::before {
    content: '✨';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    animation: sparkle 2s infinite;
}

.snake-page .start-btn::after {
    content: '✨';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    animation: sparkle 2s infinite reverse;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: translateY(-50%) scale(0.5); }
    50% { opacity: 1; transform: translateY(-50%) scale(1); }
}

.snake-page .canvas-container {
    position: relative;
    display: inline-block;
}

/* Quiz Pages Styles */
.quiz-page body {
    padding: 0;
    display: block;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
}

.quiz-page #question-container {
    margin-bottom: 1.5em;
    font-size: 1.2em;
    color: #333;
    font-weight: 500;
}

.quiz-page #options-container button {
    display: block;
    width: 100%;
    margin-bottom: 0.75em;
}

.quiz-page #feedback-container {
    margin-top: 1.5em;
    font-size: 1.1em;
    font-weight: bold;
    min-height: 2em;
}

.quiz-page .correct {
    color: #22c55e; /* Verde */
}

.quiz-page .incorrect {
    color: #ef4444; /* Rojo */
}

/* Mejora Vida Quiz específico */
.mejora-vida-page body {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%);
}

/* Media Queries específicas para Snake Game */
@media (min-width: 481px) {
    .snake-page html {
        overflow: auto;
        height: auto;
    }

    .snake-page body {
        height: auto;
        overflow: auto;
        position: static;
        width: auto;
        min-height: 100vh;
    }
    
    .snake-page .container {
        height: auto;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 1em;
        margin: 0 auto;
        max-width: 800px;
    }
    
    .snake-page header {
        padding: 0.5em 0;
        margin-bottom: 1em;
        text-align: center;
    }
    
    .snake-page header h1 {
        font-size: 2em;
        margin: 0.2em 0;
    }
    
    .snake-page header img {
        width: 50px;
        height: 50px;
        margin-bottom: 0.2em;
    }
    
    .snake-page #game-container {
        flex: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1em;
        padding: 1em;
        margin: 0 auto;
        max-width: 600px;
        min-height: auto;
    }
    
    .snake-page #snake-canvas {
        width: 400px;
        height: 400px;
        max-width: 400px;
        max-height: 400px;
    }
    
    .snake-page #controls {
        width: 220px;
        height: 140px;
        gap: 0.5em;
        margin: 1em 0;
    }
    
    .snake-page #controls button {
        font-size: 1.5em;
        min-height: 50px;
    }
    
    .snake-page #score {
        font-size: 1.4em;
        padding: 0.8em 1.5em;
        margin: 0;
    }
    
    .snake-page .game-info {
        font-size: 0.9em;
        padding: 0.5em 1em;
        margin: 0;
    }
    
    .snake-page footer {
        padding: 2em 0;
        margin-top: 2em;
        text-align: center;
    }
    
    .snake-page footer .btn {
        padding: 1em 2em;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .snake-page html {
        height: 100%;
        overflow: hidden;
    }

    .snake-page body {
        height: 100vh;
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .snake-page .container {
        height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 0;
        margin: 0;
        justify-content: space-between;
    }
    
    .snake-page header {
        padding: 0.5% 0;
        margin: 0;
        text-align: center;
        flex-shrink: 0;
    }
    
    .snake-page header h1 {
        font-size: clamp(0.9em, 4vw, 1.2em);
        margin: 0.2% 0;
        line-height: 1.1;
    }
    
    .snake-page header img {
        width: min(25px, 6vw);
        height: min(25px, 6vw);
        margin-bottom: 0;
    }
    
    .snake-page #game-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-evenly;
        padding: 2% 2%;
        margin: 0;
        min-height: 0;
    }
    
    .snake-page #score {
        font-size: clamp(0.8em, 3.5vw, 1em);
        padding: 1% 3%;
        margin: 0;
        flex-shrink: 0;
    }
    
    .snake-page .game-info {
        font-size: clamp(0.6em, 2.5vw, 0.8em);
        padding: 0.5% 2%;
        margin: 0;
        flex-shrink: 0;
    }
    
    .snake-page #snake-canvas {
        width: min(80vw, 60vh);
        height: min(80vw, 60vh);
        max-width: min(300px, 80vw);
        max-height: min(300px, 60vh);
        flex-shrink: 0;
    }
    
    .snake-page #controls {
        width: min(40vw, 150px);
        height: min(15vh, 80px);
        gap: 1%;
        margin: 1% 0;
        flex-shrink: 0;
    }
    
    .snake-page #controls button {
        font-size: clamp(1em, 4vw, 1.3em);
        min-height: min(35px, 8vw);
    }
    
    .snake-page footer {
        padding: 1% 0;
        margin: 0;
        text-align: center;
        flex-shrink: 0;
    }
    
    .snake-page footer .btn {
        padding: 2% 4%;
        font-size: clamp(0.8em, 3vw, 1em);
    }
}

/* Optimizaciones específicas para iPhone */
@media screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    .snake-page body {
        -webkit-text-size-adjust: 100%;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
        height: 100vh;
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .snake-page #snake-canvas {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
    
    .snake-page #controls button {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    .snake-page .start-screen {
        padding: 1em;
    }
    
    .snake-page .start-screen h2 {
        font-size: 1.5em;
        margin: 0.5em 0;
    }
    
    .snake-page .start-screen p {
        font-size: 0.9em;
        margin: 0.5em 0;
    }
    
    .snake-page .start-btn {
        padding: 0.8em 1.5em;
        font-size: 1em;
    }
}