/* Pantalla de aventura */
.pantalla.aventura {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  position: relative; overflow-y: auto; height: 100vh; height: 100dvh; min-height: 0;
}
.pantalla.aventura[hidden] { display: none; }
.av-fondo {
  position: fixed; inset: 0; z-index: 0;
  background: #1E3B2A center / cover no-repeat;
  filter: brightness(.85);
}
.av-fondo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(20, 45, 30, .15), rgba(20, 45, 30, .45)); }
.pantalla.aventura > *:not(.av-fondo):not(.av-capa):not(.ambiente) { position: relative; z-index: 2; width: min(640px, 100%); }
.pantalla.aventura > .ambiente { position: fixed; z-index: 1; }
.av-fondo { background-size: 260% auto !important; transition: background-position 1s; }

/* Barra de arriba: salir, puntos de progreso y zona */
.av-barra { display: flex; align-items: center; gap: 12px; }
.av-salir {
  width: 48px; height: 48px; flex: none; border: none; border-radius: 50%;
  background: rgba(255, 251, 242, .92); color: var(--tinta); font-size: 22px; font-weight: 800;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.av-puntos { display: flex; gap: 8px; }
.av-puntos i { width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, .45); border: 3px solid rgba(255, 255, 255, .8); }
.av-puntos i.hecho { background: var(--sol); border-color: #fff; }
.av-puntos i.ahora { background: #fff; transform: scale(1.25); }
.av-zona { margin-left: auto; color: #fff; font-weight: 700; font-size: 15px; text-shadow: 0 2px 3px rgba(0, 0, 0, .5); text-align: right; line-height: 1.2; }

/* Luxi con su bocadillo */
.av-lumi { display: flex; align-items: center; gap: 8px; min-height: 92px; }
.av-lumi img { width: 76px; flex: none; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); animation: flotar 3s ease-in-out infinite; }
.av-acomp { width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden; border: 4px solid #fff; background: var(--sol); box-shadow: 0 4px 6px rgba(0, 0, 0, .3); display: flex; align-items: center; justify-content: center; margin-left: -18px; }
.av-acomp[hidden] { display: none; }
.av-acomp img { width: 100%; height: 100%; object-fit: cover; }
.av-acomp span { font-family: var(--letra-titulo); font-weight: 800; font-size: 28px; color: #6B4400; }
.av-lumi-dice {
  position: relative; margin: 0; flex: 1;
  background: var(--papel); border-radius: 18px; padding: 10px 14px;
  font-weight: 700; font-size: 18px; line-height: 1.3; box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}
.av-lumi-dice::before { content: ""; position: absolute; left: -9px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-left: 0; border-right-color: var(--papel); }
.av-lumi-dice.nuevo { animation: aparecer .3s cubic-bezier(.3, 1.4, .5, 1) both; }

/* El reto */
.av-reto {
  background: var(--papel); border-radius: 28px; padding: 18px 18px 20px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .22); text-align: center;
}
.av-reto.entra { animation: aparecer .4s cubic-bezier(.3, 1.4, .5, 1) both; }
.av-asignatura { display: inline-block; margin: 0 0 6px; padding: 2px 14px; border-radius: 20px; background: #E8F3EA; color: #2F7A4B; font-weight: 800; font-size: 15px; letter-spacing: .03em; text-transform: uppercase; }
.av-texto { margin: 6px 0 10px; padding: 12px 14px; background: #FFF1D6; border-radius: 16px; font-size: 21px; line-height: 1.5; text-align: left; }
.av-pregunta { font-family: var(--letra-titulo); font-size: 24px; line-height: 1.3; margin: 4px 0 10px; }
.av-cuenta { font-family: var(--letra-titulo); font-size: 40px; font-weight: 800; margin: 0 0 6px; color: #6B4423; }
.av-escuchar { min-height: 56px; padding: 0 22px; margin: 0 0 12px; border: none; border-radius: 18px; background: var(--cielo-2); color: #fff; font-weight: 800; font-size: 22px; box-shadow: 0 4px 0 #284FA3; }

/* Respuestas */
.av-respuestas { display: grid; gap: 10px; transition: opacity .3s; }
.av-respuestas.esperando { opacity: .55; }
.av-respuestas.esperando, .av-respuestas.bloqueado { pointer-events: none; }
.av-respuestas.grande { grid-template-columns: repeat(3, 1fr); }
.av-opcion {
  min-height: 62px; padding: 8px 14px; border: 3px solid #E4DCCB; border-radius: 18px;
  background: #fff; color: var(--tinta); font-weight: 800; font-size: 24px;
  box-shadow: 0 4px 0 #E4DCCB; transition: transform .1s;
}
.grande .av-opcion { font-size: 56px; min-height: 96px; padding: 4px; }
.av-opcion:active { transform: translateY(3px); box-shadow: 0 1px 0 #E4DCCB; }
.av-opcion.bien, .av-escrito.bien { background: #DDF5E5; border-color: var(--hoja); box-shadow: 0 4px 0 #2E9A57; animation: salto .4s; }
.av-opcion.mal { background: #FFE1DC; border-color: var(--coral); box-shadow: none; opacity: .7; animation: temblor .35s; }

/* Teclado de números */
.av-escrito {
  display: block; min-height: 64px; margin: 0 auto 4px; width: min(260px, 100%);
  border: 3px solid #E4DCCB; border-radius: 18px; background: #fff; color: var(--tinta);
  font-family: var(--letra-titulo); font-size: 40px; font-weight: 800; line-height: 58px;
}
.av-escrito.mal { border-color: var(--coral); background: #FFE1DC; animation: temblor .35s; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(320px, 100%); margin: 0 auto; }
.teclado button {
  min-height: 56px; border: none; border-radius: 16px; background: #F1EADB; color: var(--tinta);
  font-weight: 800; font-size: 26px; box-shadow: 0 4px 0 #D9CFBA;
}
.teclado button:active { transform: translateY(3px); box-shadow: 0 1px 0 #D9CFBA; }
.teclado button.tecla-ok { background: var(--hoja); color: #fff; box-shadow: 0 4px 0 #2E9A57; }

/* Final con premio */
.av-final { position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 45, 30, .55); }
.av-final[hidden] { display: none; }
.av-final h1 { font-size: 34px; }
.av-final-lumi { width: 150px; margin-top: -90px; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3)); animation: flotar 2s ease-in-out infinite; }
.av-final-estrellas { font-size: 46px; margin: 8px 0; letter-spacing: 4px; animation: salto .6s .2s both; }

/* Efectos */
.chispa { position: fixed; z-index: 20; pointer-events: none; font-size: 26px; animation: chispa 1s ease-out forwards; }
.estrella-cae { position: fixed; top: -50px; z-index: 20; pointer-events: none; animation: caer 2.6s ease-in forwards; }
@keyframes chispa { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.1); opacity: 0; } }
@keyframes caer { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes salto { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes temblor { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Pantallas anchas (tablet en horizontal): Luxi más grande */
@media (min-width: 900px) and (min-height: 600px) {
  .av-lumi img { width: 100px; }
  .av-pregunta { font-size: 28px; }
}
