/* Mapa de la noche del 5 (demostración, tarea #8). Diseño: entrega 3 (nuvola-gestion/archivo/REYES_MAGOS/Entrega3/). */
body.app { background: var(--noche); color: var(--papel); overflow: hidden; height: 100dvh; }
.mapa-app { position: fixed; inset: 0; overflow: hidden; }
.demo-aviso { position: absolute; z-index: 30; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); margin: 0; background: oklch(0.2 0.08 262 / .85); color: var(--crema); font-size: 13px; padding: 6px 14px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }

.mapa-lienzo { position: absolute; inset: 0; touch-action: none; }
.mapa-lienzo svg { display: block; width: 100%; height: 100%; }
.mapa-capa { position: absolute; inset: 0; pointer-events: none; }
.costa-ancha { fill: none; stroke: oklch(0.52 0.08 220); stroke-width: 14; stroke-opacity: .55; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.costa { fill: none; stroke: oklch(0.95 0.03 90); stroke-width: 3; stroke-opacity: .7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.arena { fill: oklch(0.82 0.1 80); }
.tierra { fill-opacity: 1;  stroke: oklch(0.66 0.1 65); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.ruta-futura { fill: none; stroke: oklch(0.97 0.02 85); stroke-opacity: .75; stroke-width: 3; stroke-dasharray: 1 11; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ruta-hecha { fill: none; stroke: oklch(0.86 0.13 85); stroke-width: 6; stroke-dasharray: 1 10; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 3px oklch(0.9 0.12 88)); }

.pieza { position: absolute; }
.pieza.oriente { width: 96px; transform: translate(-50%, -70%); filter: drop-shadow(0 0 18px oklch(0.88 0.14 86 / .5)); }
.pieza.casita { transform: translate(-50%, -80%); display: flex; flex-direction: column; align-items: center; }
.pieza.casita img { width: 76px; filter: drop-shadow(0 0 16px oklch(0.9 0.14 86 / .7)); }
.pieza.casita span { font: 400 16px var(--titulo); color: var(--papel); text-shadow: 0 1px 6px oklch(0.15 0.08 268), 0 0 2px oklch(0.15 0.08 268); white-space: nowrap; }
/* La caravana mira a la derecha con la estrella delante; yendo al oeste se le da la vuelta. */
.pieza.caravana { transform: translate(-82%, -78%); filter: drop-shadow(0 4px 6px oklch(0.15 0.08 268 / .5)); transition: none; }
.pieza.caravana.oeste { transform: translate(-18%, -78%) scaleX(-1); }

.burbuja { position: absolute; transform: translate(-50%, -100%); display: flex; gap: 10px; align-items: center; background: var(--papel); color: var(--tinta); border-radius: 18px; padding: 8px 14px 8px 8px; width: min(300px, 80vw); font-size: 15px; line-height: 1.35; box-shadow: 0 6px 20px oklch(0.15 0.08 268 / .4); animation: aparecer .4s ease-out; }
.burbuja::after { content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; border: 9px solid transparent; border-bottom: 0; border-top-color: var(--papel); }
.burbuja img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px var(--oro); }
@keyframes aparecer { from { opacity: 0; transform: translate(-50%, -90%); } }

.tarjeta-mapa { position: absolute; z-index: 20; background: var(--papel); color: var(--tinta); border-radius: 200px 200px 22px 22px / 60px 60px 22px 22px; padding: 30px 24px 22px; box-shadow: 0 10px 40px oklch(0.12 0.06 268 / .5), inset 0 0 0 2px var(--oro); }
.tarjeta-mapa.inicio { left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(420px, calc(100% - 24px)); }
.tarjeta-mapa.inicio h1 { font-size: 34px; text-align: center; margin-bottom: 16px; }
.tarjeta-mapa .campo { position: relative; }
.tarjeta-mapa .boton { width: 100%; }
.opcional { font-weight: 400; color: var(--tinta-suave); }
.sugerencias { position: absolute; left: 0; right: 0; top: calc(100% - 4px); z-index: 5; list-style: none; margin: 0; padding: 6px; background: #fff; border: 1.5px solid oklch(0.78 0.05 80); border-radius: 14px; box-shadow: 0 10px 30px oklch(0.2 0.08 268 / .25); max-height: 300px; overflow: auto; }
.sugerencias li { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; }
.sugerencias li span { font-size: 14px; color: var(--tinta-suave); }
.sugerencias li[aria-selected="true"], .sugerencias li:hover { background: oklch(0.93 0.035 80); }

.hud .reloj { position: absolute; z-index: 20; right: 14px; top: max(46px, calc(env(safe-area-inset-top) + 40px)); background: oklch(0.2 0.08 262 / .8); border-radius: 16px; padding: 6px 14px; display: flex; flex-direction: column; align-items: center; box-shadow: inset 0 0 0 1.5px oklch(0.72 0.13 75 / .7); }
.hud .reloj span:first-child { font: 400 26px var(--titulo); }
.reloj-dia { font-size: 12px; color: var(--crema); }
.tarjeta-mapa.estado { left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px); transform: translateX(-50%); width: min(420px, calc(100% - 24px)); text-align: center; padding: 26px 20px 16px; }
.estado-donde { font-size: 15px; color: var(--tinta-suave); margin: 0 0 2px; }
.estado-falta { font: 400 20px/1.25 var(--titulo); margin: 0 0 12px; }
.tarjeta-mapa.estado .boton { min-height: 50px; font-size: 17px; padding: 0 14px; }
.contador { font-size: 14px; margin: 8px 0 0; color: var(--tinta-suave); }
.contador strong { color: var(--tinta); }
.nota-prueba { font-size: 12px; }
@media (min-width: 900px) {
  .tarjeta-mapa.estado { left: 28px; transform: none; bottom: 90px; width: 380px; }
  .tarjeta-mapa.inicio { left: 28px; transform: none; bottom: 90px; }
}

.grande { position: absolute; z-index: 25; left: 50%; top: 30%; transform: translate(-50%, -50%); margin: 0; width: min(560px, 90vw); text-align: center; font: 400 clamp(32px, 7vw, 54px)/1.1 var(--titulo); color: var(--papel); text-shadow: 0 2px 24px oklch(0.15 0.08 268), 0 0 4px oklch(0.15 0.08 268); animation: aparecer-grande .8s ease-out; pointer-events: none; }
@keyframes aparecer-grande { from { opacity: 0; transform: translate(-50%, -40%); } }

.mandos { position: absolute; z-index: 22; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; overflow-x: auto; max-width: calc(100% - 16px); padding: 6px; background: oklch(0.2 0.08 262 / .85); border-radius: 999px; scrollbar-width: none; }
.mandos button { flex: none; border: 0; background: oklch(0.32 0.1 266); color: var(--papel); font: inherit; font-size: 14px; min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; }
.mandos button:hover { background: oklch(0.4 0.12 266); }
.mandos #seguir { background: var(--oro); color: var(--noche); }

.final { position: absolute; inset: 0; z-index: 40; background: var(--noche); display: flex; flex-direction: column; animation: fundido 1.2s ease-out; }
@keyframes fundido { from { opacity: 0; } }
.final img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.final-texto { position: relative; margin-top: auto; padding: 120px 20px max(24px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, oklch(0.18 0.08 268 / .92) 40%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.final h2 { font-size: clamp(36px, 8vw, 60px); color: var(--papel); margin: 0 0 6px; text-shadow: 0 2px 20px oklch(0.15 0.08 268); }
.final h2 span { color: var(--oro-claro); }
.final .boton { width: min(360px, 100%); }
.final-enlaces { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.final-enlaces .boton-borde { min-height: 46px; font-size: 16px; padding: 0 18px; }

.creditos { position: absolute; z-index: 15; left: 8px; bottom: 2px; margin: 0; font-size: 10px; color: oklch(0.9 0.03 85 / .7); pointer-events: auto; }
.creditos a { color: inherit; }
@media (max-width: 899px) { .creditos { display: none; } }
@media (prefers-reduced-motion: reduce) { .burbuja, .grande, .final { animation: none; } }

/* Modo presentación: como lo verá una familia (sin aviso ni mandos; el reloj pausa al tocarlo). */
.presentacion .mandos { display: none; }
.presentacion .reloj { cursor: pointer; }
.presentacion .tarjeta-mapa.estado { bottom: max(14px, env(safe-area-inset-bottom)); }

/* Decorado de la tanda 3: montañas y palmeras en su sitio; barco en el mar; turrón al dejar comida */
.decorado { position: absolute; transform: translate(-50%, -82%); pointer-events: none; filter: drop-shadow(0 3px 3px oklch(0.2 0.06 268 / .35)); }
.pieza.caravana.barco { transform: translate(-60%, -82%); }
.pieza.caravana.barco.oeste { transform: translate(-40%, -82%) scaleX(-1); }
.regalo-camellos { position: fixed; z-index: 50; width: 90px; transform: translate(-50%, -100%); pointer-events: none; animation: regalo 1.8s ease-out forwards; }
@keyframes regalo { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.6); } 25% { opacity: 1; transform: translate(-50%, -110%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(.8); } }
.grande { background: oklch(0.18 0.08 268 / .72); border-radius: 28px; padding: 18px 22px; top: 24%; box-shadow: 0 10px 40px oklch(0.1 0.05 268 / .5); }

/* Ríos (Natural Earth): trazo de pincel, del grosor de la pantalla aunque se acerque el mapa */
.rio-halo { fill: none; stroke: oklch(0.95 0.03 90); stroke-opacity: .55; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.rio { fill: none; stroke: oklch(0.55 0.09 222); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* Prueba de «noche de cuento» (30/10/2026): ríos de pincel, nombres pintados y luz de la estrella */
.rio-halo { stroke: oklch(0.9 0.05 200); stroke-opacity: .35; }
.rio { stroke: oklch(0.6 0.09 215); stroke-opacity: .85; }
.rios .rio-halo { stroke-width: 10px !important; }
.rios .rio { stroke-width: 4.5px !important; }
.nombre-lugar { position: absolute; transform: translate(-50%, -50%); font: 400 17px var(--titulo); color: oklch(0.32 0.07 60); text-shadow: 0 0 6px oklch(0.92 0.06 85), 0 0 2px oklch(0.92 0.06 85); white-space: nowrap; pointer-events: none; transition: opacity .6s; letter-spacing: .02em; }
.nombre-lugar.mar { font-style: italic; font-family: var(--lectura); font-size: 16px; color: oklch(0.88 0.05 230); text-shadow: 0 0 6px oklch(0.2 0.08 260); letter-spacing: .15em; }
.luz-estrella { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), oklch(0.9 0.12 85 / .18) 0, transparent 140px, oklch(0.12 0.06 268 / .38) 420px, oklch(0.1 0.06 268 / .62) 900px); mix-blend-mode: multiply; }
@media (max-width: 600px) { .nombre-lugar { font-size: 14px; } }

/* Noche más marcada: penumbra alrededor y luz cálida donde va la estrella */
.luz-estrella { background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), oklch(0.95 0.12 85 / .2) 0, transparent 160px, oklch(0.12 0.06 268 / .5) 380px, oklch(0.08 0.05 268 / .78) 820px) !important; }

/* Sin la penumbra de «noche» (usuario, 30/10/2026). Movimiento: balanceo, barco que se mece, estela y estrella. */
.luz-estrella { display: none; }
.pieza.caravana { animation: andar 0.9s ease-in-out infinite; }
.pieza.caravana.barco { animation: mecerse 3.2s ease-in-out infinite; }
@keyframes andar { 50% { margin-top: -3px; } }
@keyframes mecerse { 0%, 100% { rotate: -2deg; margin-top: 0; } 50% { rotate: 2deg; margin-top: -4px; } }
.estela { position: absolute; inset: 0; pointer-events: none; }
.estela i { position: absolute; width: 9px; height: 9px; margin: -4px 0 0 -4px; background: radial-gradient(circle, oklch(0.98 0.06 95), oklch(0.85 0.14 85) 50%, transparent 70%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: chispa 1.6s ease-out forwards; }
@keyframes chispa { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: translate(var(--d, 0), -26px) scale(.3); } }
@media (prefers-reduced-motion: reduce) { .pieza.caravana, .pieza.caravana.barco { animation: none; } .estela { display: none; } }

/* Tanda 4: caravana por separado, lugares, nubes, gaviotas y delfines */
.decorado.lugar { transform: translate(-50%, -70%); filter: drop-shadow(0 4px 6px oklch(0.2 0.06 268 / .4)); }
.reyes { position: absolute; aspect-ratio: 3.3 / 1; transform: translate(-100%, -86%); pointer-events: none; filter: drop-shadow(0 4px 5px oklch(0.15 0.08 268 / .45)); }
.reyes.oeste { transform: translate(0, -86%) scaleX(-1); }
.reyes img { position: absolute; bottom: 0; }
.reyes .camello { width: 31%; animation: andar 0.9s ease-in-out infinite; }
.reyes .baltasar { left: 0; animation-delay: -.3s; animation-duration: .95s; }
.reyes .gaspar { left: 22%; animation-delay: -.6s; animation-duration: .88s; }
.reyes .melchor { left: 44%; animation-duration: .92s; }
.reyes .estrella-guia { left: 66%; bottom: 62%; width: 36%; animation: guia 2.4s ease-in-out infinite; }
@keyframes guia { 50% { transform: translateY(-4px) scale(1.06); filter: drop-shadow(0 0 10px oklch(0.9 0.14 88)); } }
.pieza.caravana.barco { transform: translate(-60%, -82%); }
.vida-mar { position: absolute; aspect-ratio: 2 / 1; transform: translate(-50%, -70%); pointer-events: none; }
.vida-mar.oeste { transform: translate(-50%, -70%) scaleX(-1); }
.vida-mar img { position: absolute; }
.gaviota { width: 13%; }
.gaviota.g1 { left: 8%; top: -18%; animation: volar 6s ease-in-out infinite; }
.gaviota.g2 { left: 78%; top: -8%; width: 10%; animation: volar 7.5s ease-in-out infinite reverse; }
@keyframes volar { 0%, 100% { translate: 0 0; } 50% { translate: 18px -10px; } }
.delfin { width: 15%; bottom: 0; opacity: 0; }
.delfin.d1 { left: 86%; animation: saltar 5s ease-in-out infinite; }
.delfin.d2 { left: -4%; animation: saltar 6.4s ease-in-out 2.2s infinite; }
@keyframes saltar { 0%, 55%, 100% { opacity: 0; translate: 0 20px; } 65% { opacity: 1; translate: 0 -6px; } 80% { opacity: 1; translate: 6px -14px; } 92% { opacity: 0; translate: 10px 10px; } }
.nubes { position: absolute; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.nubes img { position: absolute; left: -40%; opacity: .55; animation: nube linear infinite; }
@keyframes nube { to { transform: translateX(185vw); } }
@media (prefers-reduced-motion: reduce) { .reyes .camello, .reyes .estrella-guia, .gaviota, .delfin, .nubes img { animation: none; } .delfin { opacity: 0; } }
.nombre-lugar { transform: translate(-50%, 45%); }
.nombre-lugar.mar { transform: translate(-50%, -50%); }

/* Animaciones sencillas (usuario, 30/10/2026) */
.reyes .camello { animation-name: andar-mas; }
@keyframes andar-mas { 0%, 100% { translate: 0 0; rotate: 0deg; } 25% { translate: 0 -5px; rotate: -1.5deg; } 75% { translate: 0 -2px; rotate: 1deg; } }
.decorado.arbol { transform-origin: 50% 95%; animation: mecer-arbol 4s ease-in-out infinite; }
@keyframes mecer-arbol { 0%, 100% { rotate: -2deg; } 50% { rotate: 2.5deg; } }
.destello-mar { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: oklch(0.96 0.07 92); clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); animation: titilar 3s ease-in-out infinite; pointer-events: none; }
@keyframes titilar { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .9; transform: scale(1); } }
.casita { isolation: isolate; }
.casita .humo { position: absolute; left: 62%; top: -8px; width: 20px; height: 40px; pointer-events: none; }
.casita .humo i { position: absolute; left: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: oklch(0.96 0.01 260 / .8); filter: blur(2px); animation: humo 3s ease-out infinite; }
.casita .humo i:nth-child(2) { animation-delay: 1s; } .casita .humo i:nth-child(3) { animation-delay: 2s; }
@keyframes humo { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 20% { opacity: .9; } 100% { opacity: 0; transform: translate(10px, -40px) scale(1.8); } }
.casita .ventana { position: absolute; left: 58%; top: 52%; width: 14%; height: 14%; z-index: -1; border-radius: 4px; background: oklch(0.9 0.15 85); box-shadow: 0 0 14px 6px oklch(0.85 0.15 80 / .7); animation: ventana 2.2s ease-in-out infinite; }
@keyframes ventana { 50% { box-shadow: 0 0 22px 10px oklch(0.9 0.15 85 / .9); } }
.lluvia { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 5; }
.lluvia i { position: absolute; width: 14px; height: 14px; margin: -7px; background: radial-gradient(circle, oklch(0.99 0.05 95), oklch(0.86 0.14 85) 55%, oklch(0.72 0.14 72)); clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%); opacity: 0; animation: caer 2.4s ease-in forwards; }
@keyframes caer { 0% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.6) rotate(0); } 20% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--x) * .15), -10px) scale(1.1) rotate(180deg); } }
@media (prefers-reduced-motion: reduce) { .decorado.arbol, .destello-mar, .casita .humo i, .casita .ventana, .lluvia i { animation: none; } .destello-mar { opacity: .6; } }

/* Lienzo único (30/10/2026): el bocadillo se coloca con transform desde la esquina, sin left/top */
.mapa-lienzo canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.burbuja { left: 0; top: 0; transform: none; animation: aparecer-burbuja .4s ease-out; will-change: transform; }
@keyframes aparecer-burbuja { from { opacity: 0; translate: 0 8px; } }
.ver-todo { font-size: 14px; margin-top: 8px; }
