/* Portada y acceso. La portada no usa JavaScript: todo el movimiento es CSS.
   Sin animaciones (o si el navegador no las puede unir al desplazamiento) se ve el final de cada escena, una debajo de otra. */
@property --luz { syntax: "<color>"; inherits: true; initial-value: #8fe3b5; }
@property --nivel { syntax: "<color>"; inherits: true; initial-value: #e5675c; }
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #0b3a49; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #0f4758; }
@property --c3 { syntax: "<color>"; inherits: true; initial-value: #165669; }
@property --agua { syntax: "<color>"; inherits: true; initial-value: #08303d; }
@property --agua-cerca { syntax: "<color>"; inherits: true; initial-value: #052733; }
@property --onda { syntax: "<color>"; inherits: true; initial-value: #1d5366; }
@property --borde-agua { syntax: "<color>"; inherits: true; initial-value: #3f8296; }
@property --lampara { syntax: "<color>"; inherits: true; initial-value: #ffc933; }
@property --estrellas { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --sol { syntax: "<number>"; inherits: true; initial-value: 190; }
@property --sol-x { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --luna { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --disco { syntax: "<integer>"; inherits: false; initial-value: 92; }

html { --cabecera: 74px; scroll-behavior: smooth; scroll-padding-top: 92px; }
.piezas { position: absolute; }
.tramo { width: min(1180px, 100%); margin-inline: auto; padding-inline: clamp(18px, 4vw, 40px); }
.noche { background: var(--noche); color: var(--sobre-noche); }
.boton.farol { background: var(--farol); border-color: var(--farol); color: var(--sobre-farol); }
.boton.farol:hover { background: #ffd966; border-color: #ffd966; }
.boton.claro { background: #0b3a49; border-color: #8fb3be; color: #f2f7f8; }
.boton.claro:hover { border-color: #ffffff; }

/* Siempre a la vista, también en el móvil. El color es el del cielo, con cualquier tema. */
.arriba { position: sticky; top: 0; z-index: 10; background: #0b3a49; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 16px clamp(18px, 4vw, 56px); }
.arriba a:not(.boton) { color: inherit; }
.arriba nav { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-left: auto; }
.arriba nav a { padding: 8px 0; text-decoration: none; }
.arriba nav a:hover { text-decoration: underline; }

/* ---------- Apertura: el faro ---------- */
.apertura { position: relative; isolation: isolate; display: grid; min-height: min(740px, calc(100vh - 108px)); overflow: hidden; }
.escena { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.mensaje { display: grid; align-content: start; justify-items: start; gap: 20px; max-width: 760px; padding: clamp(20px, 5vh, 56px) clamp(18px, 4vw, 56px) 320px; }
.mensaje h1 { font-size: clamp(42px, 5.600vw, 76px); font-weight: 600; font-stretch: 87%; line-height: 1; letter-spacing: -.01em; }
.mensaje p { max-width: 46ch; font-size: clamp(17px, 1.400vw, 20px); line-height: 1.5; }

.escena text { fill: #d5e5e9; font: 400 16px var(--cuerpo); text-anchor: middle; }
.escena .hallazgo text { fill: #10262e; text-anchor: start; }
.hallazgo .nombre { font-size: 16px; font-weight: 600; }
.escena .hallazgo .dato { fill: #b3261e; font-size: 17px; font-weight: 600; }
.haz { transform-origin: 0 0; transform: rotate(-40.93deg); animation: barrer 16s linear infinite; }
@keyframes barrer {
  0% { transform: rotate(-14deg); } 38% { transform: rotate(-66deg); } 50%, 91% { transform: rotate(-40.93deg); } 100% { transform: rotate(-14deg); }
}
.vuelta { fill: #fff0bd; stroke: #ffc933; stroke-width: 4; opacity: 0; } .v-e3 { fill: #ffe1dd; stroke: #ff9a90; }
.hallazgo { animation: hallar 16s linear infinite; }
@keyframes hallar { 0%, 50% { opacity: 0; } 52%, 89% { opacity: 1; } 92%, 100% { opacity: 0; } }
.vaiven.e1 { animation: vaiven 5s ease-in-out infinite alternate, luz-e1 16s linear infinite; --luz: #8fe3b5; }
.v-e1 { animation: vuelve-e1 16s linear infinite; }
@keyframes vuelve-e1 { 0%, 4.25% { opacity: 0; transform: none; } 5.15% { opacity: 1; transform: none; } 11.95% { opacity: 1; transform: translate(730px, -228.4px); } 12.55%, 100% { opacity: 0; transform: translate(730px, -228.4px); } }
@keyframes luz-e1 { 0%, 3.35% { --luz: #6b929f; } 4.75%, 91% { --luz: #8fe3b5; } 96%, 100% { --luz: #6b929f; } }
.vaiven.e2 { animation: vaiven 5s ease-in-out infinite alternate, luz-e2 16s linear infinite; --luz: #8fe3b5; }
.v-e2 { animation: vuelve-e2 16s linear infinite; }
@keyframes vuelve-e2 { 0%, 11.61% { opacity: 0; transform: none; } 12.51% { opacity: 1; transform: none; } 19.31% { opacity: 1; transform: translate(595px, -302.8px); } 19.91%, 100% { opacity: 0; transform: translate(595px, -302.8px); } }
@keyframes luz-e2 { 0%, 10.71% { --luz: #6b929f; } 12.11%, 91% { --luz: #8fe3b5; } 96%, 100% { --luz: #6b929f; } }
.vaiven.e3 { animation: vaiven 5s ease-in-out infinite alternate, luz-e3 16s linear infinite; --luz: #ff9a90; }
.v-e3 { animation: vuelve-e3 16s linear infinite; }
@keyframes vuelve-e3 { 0%, 19.98% { opacity: 0; transform: none; } 20.88% { opacity: 1; transform: none; } 27.68% { opacity: 1; transform: translate(360px, -275.4px); } 28.28%, 100% { opacity: 0; transform: translate(360px, -275.4px); } }
@keyframes luz-e3 { 0%, 19.08% { --luz: #6b929f; } 20.48%, 91% { --luz: #ff9a90; } 96%, 100% { --luz: #6b929f; } }
.vaiven.e4 { animation: vaiven 5s ease-in-out infinite alternate, luz-e4 16s linear infinite; --luz: #8fe3b5; }
.v-e4 { animation: vuelve-e4 16s linear infinite; }
@keyframes vuelve-e4 { 0%, 31.08% { opacity: 0; transform: none; } 31.98% { opacity: 1; transform: none; } 38.78% { opacity: 1; transform: translate(235px, -318px); } 39.38%, 100% { opacity: 0; transform: translate(235px, -318px); } }
@keyframes luz-e4 { 0%, 30.18% { --luz: #6b929f; } 31.58%, 91% { --luz: #8fe3b5; } 96%, 100% { --luz: #6b929f; } }
.vaiven.e5 { animation: vaiven 5s ease-in-out infinite alternate, luz-e5 16s linear infinite; --luz: #8fe3b5; }
.v-e5 { animation: vuelve-e5 16s linear infinite; }
@keyframes vuelve-e5 { 0%, 35.1% { opacity: 0; transform: none; } 36% { opacity: 1; transform: none; } 42.8% { opacity: 1; transform: translate(142px, -235.6px); } 43.4%, 100% { opacity: 0; transform: translate(142px, -235.6px); } }
@keyframes luz-e5 { 0%, 34.2% { --luz: #6b929f; } 35.6%, 91% { --luz: #8fe3b5; } 96%, 100% { --luz: #6b929f; } }

.vaiven { animation: vaiven 5s ease-in-out infinite alternate; }
.vaiven.e2 { animation-duration: 6s, 16s; } .vaiven.e4 { animation-duration: 4.500s, 16s; }
.vaiven-suave { animation: vaiven-suave 6s ease-in-out infinite alternate; }
@keyframes vaiven { from { transform: translateY(-4px) rotate(-2.500deg); } to { transform: translateY(5px) rotate(2.500deg); } }
@keyframes vaiven-suave { from { transform: translateY(-5px); } to { transform: translateY(6px); } }
.olas { animation: olas 9s linear infinite; --paso: 220px; }
.olas.lenta { animation-duration: 14s; --paso: 160px; } .olas.rapida { animation-duration: 8s; --paso: 280px; }
.delante .olas { --paso: 240px; } .olas.mini { animation-duration: 3s; --paso: 82px; } .olas.gota { animation-duration: 2.500s; --paso: 44px; }
@keyframes olas { to { transform: translateX(var(--paso)); } }
.nube { animation: nube 34s ease-in-out infinite alternate; } .nube-2 { animation-duration: 46s; animation-direction: alternate-reverse; }
@keyframes nube { from { transform: translateX(-50px); } to { transform: translateX(70px); } }
.estrellas { animation: estrellas 4s ease-in-out infinite alternate; }
@keyframes estrellas { from { opacity: .9; } to { opacity: .35; } }

.pausa { position: absolute; right: clamp(14px, 3vw, 32px); bottom: 14px; padding: 8px 12px; border-radius: 4px; background: #052733; color: #f2f7f8; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pausa .no, #pausa:checked ~ .pausa .si { display: none; }
#pausa:checked ~ .pausa .no { display: inline; }
#pausa:focus-visible ~ .pausa { outline: 3px solid var(--farol); outline-offset: 2px; }
body:has(#pausa:checked) :is(.haz, .hallazgo, .vuelta, .vaiven, .vaiven-suave, .olas, .nube, .estrellas, .gaviota) { animation-play-state: paused; }

/* ---------- Una noche de guardia ---------- */
.lienzo text { fill: #10262e; font: 400 20px var(--cuerpo); }
.lienzo .nombre { font-weight: 600; } .lienzo .dato { font-size: 22px; font-weight: 600; fill: #0f5468; } .lienzo .malo { fill: #b3261e; }
.lienzo .grande { font: 600 38px var(--titular); } .lienzo .titulo-hoja { font: 600 29px var(--titular); }
.lienzo .centrado, .lienzo .en-boton, .lienzo .placa, .lienzo .rotulo, .lienzo .hora-movil { text-anchor: middle; }
.lienzo .en-boton { fill: #ffffff; font-weight: 600; } .lienzo .placa { font: 600 30px var(--titular); }
.lienzo .rotulo { fill: #f2f7f8; font-weight: 600; } .lienzo .hora-movil { fill: #f2f7f8; font: 600 42px var(--titular); }
.lienzo .marcas text { fill: #e3edef; } .lienzo .marcas .limite { fill: #ffb3ab; font-weight: 600; }
.sol { transform: translate(calc(var(--sol-x) * 1px), calc(var(--sol) * 1px)); }
.luna { transform: translate(calc(var(--luna) * -230px), calc(var(--luna) * 90px)); }
.reflejo { transform: translateX(calc(var(--luna) * -230px)); }
.gaviota { animation: vaiven-suave 3s ease-in-out infinite alternate; }
.lienzo .titulo-lista { font: 600 24px var(--titular); } .lienzo .quien-ayuda { font-size: 18px; fill: #465e68; }
.lienzo .tarjeta .dato { font-size: 21px; }
.acto { --luz: #8fe3b5; }
.a2, .roja { --luz: #ff9a90; }
.haz-acto { transform-origin: 0 0; transform: rotate(-20deg); }
.nivel { transform: translateY(21px); }
.ondas circle { fill: none; stroke: #ff9a90; stroke-width: 4; opacity: .5; transform-box: fill-box; transform-origin: center; }
.guia { fill: none; stroke: #5b8795; stroke-width: 3; stroke-dasharray: 3 12; stroke-linecap: round; }
.senal { fill: none; stroke: #ffc933; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1; }
.aceptar { transform-box: fill-box; transform-origin: center; }
.cursor { opacity: 0; }
.lienzo .cartel { fill: #f2f7f8; font-size: 17px; font-weight: 600; text-anchor: middle; }
.puente { transform-origin: 0 0; }
.paso-luz { transform: translateX(-196px); }
.tarjeta, .resuelto { transform-box: fill-box; transform-origin: center bottom; }
.cuenta-disco::after { counter-reset: disco var(--disco); content: counter(disco) " %"; font: 600 64px/1 var(--titular); color: #ffb3ab; font-variant-numeric: tabular-nums; }

.guardia h2, .vigila h2, .limites h2, .acceso h2 { font-size: clamp(30px, 3.400vw, 44px); font-stretch: 87%; }
.relato { display: grid; gap: 12px; padding: 26px 28px 28px; border-radius: 8px; background: #052733; color: #f2f7f8; }
.relato .reloj { font: 600 52px/1 var(--titular); color: #ffc933; font-variant-numeric: tabular-nums; }
.relato h3 { font-size: 27px; }
.relato p { max-width: 42ch; font-size: 17px; }
.hito, .saltos, .comun { display: none; }

/* Sin animación al bajar: cinco escenas seguidas, cada una con su hora */
.guardia { background: #052733; color: #f2f7f8; }
.guardia h2 { padding: clamp(48px, 7vw, 80px) clamp(18px, 4vw, 56px) 26px; }
.acto { position: relative; display: grid; align-items: center; min-height: min(56vw, 700px); overflow: hidden; }
.acto .lienzo { position: absolute; inset: 0; width: 100%; height: 100%; }
.acto .relato { position: relative; width: min(430px, 35vw); margin: 24px clamp(18px, 4vw, 56px); }
.a2 { --luna: .35; } .a3 { --luna: .6; }
.a2, .a3 { --c1: #072a37; --c2: #0a3443; --c3: #0f4051; --agua: #062936; --onda: #16485a; --borde-agua: #2c6476; }
.a4 { --c1: #6ba3b3; --c2: #a9cbcb; --c3: #f5d592; --agua: #2f7588; --onda: #70afbd; --borde-agua: #fbe9bd; --estrellas: 0; --sol: 22; }
.a5 { --c1: #b9dbe2; --c2: #d3e8eb; --c3: #fae7b8; --agua: #4b94a7; --onda: #94cad6; --borde-agua: #ffffff; --estrellas: 0; --sol: -330; --sol-x: -455; --lampara: #dfe9ec; }

@supports (animation-timeline: view()) and (animation-range: contain 0% contain 100%) {
  @media (prefers-reduced-motion: no-preference) and (min-height: 600px) {
    .guardia { position: relative; height: 760vh; view-timeline: --g block; view-timeline-inset: 0px; }
    .hito { display: block; position: absolute; top: calc((100% - 100vh) * var(--p)); width: 1px; height: 1px; scroll-margin-top: -92px; }
    .h1 { --p: .16; } .h2 { --p: .384; } .h3 { --p: .565; } .h4 { --p: .785; } .h5 { --p: .965; }
    .fija { position: sticky; top: var(--cabecera); height: calc(100vh - var(--cabecera)); overflow: hidden; animation: amanecer linear both, pasar-la-noche linear both; animation-timeline: --g, --g; animation-range: contain 0% contain 100%, contain 0% contain 62%; }
    .comun { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
    .fondo-propio { display: none; }
    .guardia h2 { position: absolute; z-index: 2; left: clamp(18px, 4vw, 56px); top: 26px; padding: 10px 16px; border-radius: 6px; background: #052733; font-size: clamp(22px, 2.300vw, 30px); }
    .acto { position: absolute; inset: 0; min-height: 0; --c1: inherit; --c2: inherit; --c3: inherit; --agua: inherit; --onda: inherit; --borde-agua: inherit; --estrellas: inherit; --sol: inherit; --sol-x: inherit; --luna: inherit; --lampara: inherit; }
    .acto .relato { margin-block: 0; }
    .saltos { position: absolute; z-index: 2; left: 50%; bottom: 18px; display: flex; gap: 4px; padding: 5px; border-radius: 8px; background: #052733; transform: translateX(-50%); }
    .saltos::before { content: ""; position: absolute; inset: -5px 6px auto; height: 4px; border-radius: 2px; background: var(--farol); transform-origin: left; animation: avance linear both; animation-timeline: --g; animation-range: contain 0% contain 100%; }
    .saltos a { display: grid; place-items: center; min-width: 74px; min-height: 40px; border-radius: 5px; color: #f2f7f8; font: 600 17px/1 var(--titular); text-decoration: none; font-variant-numeric: tabular-nums; }
    .saltos a:hover span { text-decoration: underline; text-underline-offset: 4px; }
    .saltos a:focus-visible { outline-color: var(--farol); }
    .vaiven.b3 { animation: vaiven 5s ease-in-out infinite alternate, apagada linear both; animation-timeline: auto, --g; animation-range: normal, contain 5.55% contain 6.55%; }
    .t-b3 { animation: aparecer linear both; animation-timeline: --g; animation-range: contain 5.95% contain 7.95%; }
    .vaiven.b2 { animation: vaiven 5s ease-in-out infinite alternate, apagada linear both; animation-timeline: auto, --g; animation-range: normal, contain 9.14% contain 10.14%; }
    .t-b2 { animation: aparecer linear both; animation-timeline: --g; animation-range: contain 9.54% contain 11.54%; }
    .vaiven.b1 { animation: vaiven 5s ease-in-out infinite alternate, apagada linear both; animation-timeline: auto, --g; animation-range: normal, contain 13.35% contain 14.35%; }
    .t-b1 { animation: aparecer linear both; animation-timeline: --g; animation-range: contain 13.75% contain 15.75%; }
    .haz-acto { animation: girar-foco linear both; animation-timeline: --g; animation-range: contain 2% contain 16%; }
    .nivel { animation: llenar linear both; animation-timeline: --g; animation-range: contain 22.4% contain 34.4%; }
    .a2 { animation: poner-rojo linear both; animation-timeline: --g; animation-range: contain 32.8% contain 34.8%; }
    .cuenta-disco { animation: contar linear both; animation-timeline: --g; animation-range: contain 22.4% contain 34.4%; }
    .sube-fila { animation: subir-fila linear both; animation-timeline: --g; animation-range: contain 33.2% contain 36%; }
    .baja-fila { animation: bajar-fila linear both; animation-timeline: --g; animation-range: contain 33.2% contain 36%; }
    .ondas circle { animation: onda linear both; animation-timeline: --g; animation-range: contain 40.4% contain 46%; }
    .s1 { animation: trazar linear both; animation-timeline: --g; animation-range: contain 42.4% contain 47.6%; }
    .s2 { animation: trazar linear both; animation-timeline: --g; animation-range: contain 48% contain 52.8%; }
    .notificacion { animation: llegar linear both; animation-timeline: --g; animation-range: contain 52.8% contain 56%; }
    .aceptar { animation: pulsar linear both; animation-timeline: --g; animation-range: contain 66.8% contain 68.8%; }
    .puente { animation: bajar linear both; animation-timeline: --g; animation-range: contain 68.8% contain 73.6%; }
    .paso-luz { animation: cruzar linear both; animation-timeline: --g; animation-range: contain 73.6% contain 76.4%; }
    .conectado { animation: venir linear both; animation-timeline: --g; animation-range: contain 76.4% contain 77.4%; }
    .p1 { animation: escribir linear both; animation-timeline: --g; animation-range: contain 82.8% contain 84.8%; }
    .p2 { animation: escribir linear both; animation-timeline: --g; animation-range: contain 85.2% contain 87.2%; }
    .p3 { animation: escribir linear both; animation-timeline: --g; animation-range: contain 87.6% contain 89.6%; }
    .p4 { animation: escribir linear both; animation-timeline: --g; animation-range: contain 90% contain 92%; }
    .resuelto { animation: aparecer linear both; animation-timeline: --g; animation-range: contain 93.2% contain 95.2%; }
    .a1 > .lienzo { animation: irse-costa linear both; animation-timeline: --g; animation-range: contain 0% contain 20%; }
    .a1 > .relato { animation: irse-texto linear both; animation-timeline: --g; animation-range: contain 0% contain 20%; }
    .saltos .s1 { animation: momento linear both; animation-timeline: --g; animation-range: contain 0% contain 20%; }
    .a2 > .lienzo { animation: recorrer-costa linear both; animation-timeline: --g; animation-range: contain 20% contain 40%; }
    .a2 > .relato { animation: pasar-texto linear both; animation-timeline: --g; animation-range: contain 20% contain 40%; }
    .saltos .s2 { animation: momento linear both; animation-timeline: --g; animation-range: contain 20% contain 40%; }
    .a3 > .lienzo { animation: recorrer-costa linear both; animation-timeline: --g; animation-range: contain 40% contain 60%; }
    .a3 > .relato { animation: pasar-texto linear both; animation-timeline: --g; animation-range: contain 40% contain 60%; }
    .saltos .s3 { animation: momento linear both; animation-timeline: --g; animation-range: contain 40% contain 60%; }
    .a4 > .lienzo { animation: recorrer-costa linear both; animation-timeline: --g; animation-range: contain 60% contain 80%; }
    .a4 > .relato { animation: pasar-texto linear both; animation-timeline: --g; animation-range: contain 60% contain 80%; }
    .saltos .s4 { animation: momento linear both; animation-timeline: --g; animation-range: contain 60% contain 80%; }
    .a5 > .lienzo { animation: llegar-costa linear both; animation-timeline: --g; animation-range: contain 80% contain 100%; }
    .a5 > .relato { animation: llegar-texto linear both; animation-timeline: --g; animation-range: contain 80% contain 100%; }
    .saltos .s5 { animation: momento linear both; animation-timeline: --g; animation-range: contain 80% contain 100%; }
    .cursor { animation: mover-cursor linear both, esconder-cursor linear both; animation-timeline: --g, --g; animation-range: contain 62% contain 66.8%, contain 69.2% contain 70.8%; }

  }
}
@keyframes amanecer {
  0%, 14% { --c1: #0b3a49; --c2: #0f4758; --c3: #165669; --agua: #08303d; --agua-cerca: #052733; --onda: #1d5366; --borde-agua: #3f8296; --estrellas: 1; --sol: 190; --lampara: #ffc933; }
  24%, 58.500% { --c1: #072a37; --c2: #0a3443; --c3: #0f4051; --agua: #062936; --agua-cerca: #041e28; --onda: #16485a; --borde-agua: #2c6476; --estrellas: 1; --sol: 190; --lampara: #ffc933; }
  61.500% { --c1: #2c5f7b; --c2: #8b93aa; --c3: #e9aa90; --agua: #1c5468; --agua-cerca: #123f50; --onda: #4d8799; --borde-agua: #f3c3a8; --estrellas: .15; --sol: 110; --lampara: #ffdf8a; }
  66%, 77% { --sol-x: 0; --c1: #6ba3b3; --c2: #a9cbcb; --c3: #f5d592; --agua: #2f7588; --agua-cerca: #215f71; --onda: #70afbd; --borde-agua: #fbe9bd; --estrellas: 0; --sol: 22; --lampara: #fff0bd; }
  88%, 100% { --sol-x: -455; --c1: #b9dbe2; --c2: #d3e8eb; --c3: #fae7b8; --agua: #4b94a7; --agua-cerca: #37798b; --onda: #94cad6; --borde-agua: #ffffff; --estrellas: 0; --sol: -330; --lampara: #dfe9ec; }
}
@keyframes pasar-la-noche { to { --luna: 1; } }
@keyframes irse-costa { 0%, 93% { translate: 0 0; opacity: 1; } 100% { translate: -22% 0; opacity: 0; } }
@keyframes recorrer-costa { 0% { translate: 22% 0; opacity: 0; } 7%, 93% { translate: 0 0; opacity: 1; } 100% { translate: -22% 0; opacity: 0; } }
@keyframes llegar-costa { 0% { translate: 22% 0; opacity: 0; } 7%, 100% { translate: 0 0; opacity: 1; } }
@keyframes irse-texto { 0%, 94% { translate: 0 0; opacity: 1; } 100% { translate: 0 -30px; opacity: 0; } }
@keyframes pasar-texto { 0% { translate: 0 30px; opacity: 0; } 6%, 94% { translate: 0 0; opacity: 1; } 100% { translate: 0 -30px; opacity: 0; } }
@keyframes llegar-texto { 0% { translate: 0 30px; opacity: 0; } 6%, 100% { translate: 0 0; opacity: 1; } }
@keyframes avance { from { transform: scaleX(0); } }
@keyframes esconder-cursor { from { opacity: 1; } }
@keyframes subir-fila { from { transform: translateY(112px); } }
@keyframes bajar-fila { from { transform: translateY(-56px); } }
@keyframes momento { 0%, 100% { background: transparent; color: #f2f7f8; } 2%, 98% { background: #ffc933; color: #10262e; } }
@keyframes apagada { from { --luz: #6b929f; } }
@keyframes aparecer { from { opacity: 0; transform: translateY(26px) scale(.850); } }
@keyframes girar-foco { from { transform: rotate(-74deg); } }
@keyframes llenar { from { transform: translateY(96px); } }
@keyframes poner-rojo { from { --luz: #8fe3b5; --nivel: #4fa9be; } }
@keyframes contar { from { --disco: 71; } }
@keyframes onda { from { opacity: 0; transform: scale(.300); } }
@keyframes trazar { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes llegar { from { opacity: 0; transform: translateY(-150px); } }
@keyframes mover-cursor { from { transform: translate(190px, 190px); } }
@keyframes pulsar { 0%, 100% { transform: scale(1); } 50% { transform: scale(.860); } }
@keyframes bajar { from { transform: rotate(-86deg); } }
@keyframes cruzar { from { transform: translateX(0); } }
@keyframes escribir { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -20px 0 0); } }

/* ---------- Qué vigila: seis instrumentos ---------- */
.vigila .tramo { display: grid; gap: 26px; padding-block: clamp(64px, 9vw, 112px); }
.instrumentos { display: grid; grid-template-columns: 5fr 7fr; align-items: start; gap: 28px clamp(28px, 5vw, 64px); }
.elegir { display: grid; margin: 0; padding: 0; border: 0; }
.elegir legend { margin-bottom: 18px; padding: 0; color: var(--pizarra); font-size: 17px; }
.elegir label { display: grid; gap: 2px; padding: 13px 18px; border-left: 4px solid var(--linea); cursor: pointer; }
.elegir b { font: 600 20px/1.250 var(--titular); }
.elegir span { color: var(--pizarra); }
.elegir label:hover { border-color: var(--mar); }
.elegir input:checked + label { border-color: var(--mar); background: var(--mar-suave); }
.elegir input:checked + label span { color: var(--tinta); }
.elegir input:focus-visible + label { outline: 3px solid var(--mar); outline-offset: -3px; }
.aparato { position: sticky; top: calc(var(--cabecera) + 20px); padding: clamp(12px, 2vw, 26px); border-radius: 12px; background: #0b3a49; }
.aparato > svg { display: none; width: 100%; height: auto; }
.instrumentos:has(#i1:checked) .v1, .instrumentos:has(#i2:checked) .v2, .instrumentos:has(#i3:checked) .v3,
.instrumentos:has(#i4:checked) .v4, .instrumentos:has(#i5:checked) .v5, .instrumentos:has(#i6:checked) .v6 { display: block; }
.aparato text { fill: #f2f7f8; font: 400 20px var(--cuerpo); text-anchor: middle; }
.aparato .fuerte { font: 600 29px var(--titular); } .aparato .izq { text-anchor: start; } .aparato .der { text-anchor: end; }
.aparato .alerta { fill: #f3b455; font-weight: 600; } .aparato .oscuro { fill: #10262e; font-weight: 600; }
.aparato .sube { transform-box: fill-box; transform-origin: bottom; animation: subir 1.200s cubic-bezier(.2, .8, .3, 1) both; }
.aparato .antes { animation: irse .300s 1s both; }
.aparato .despues { animation: venir .400s 1s both; } .aparato .tarde { animation-delay: 1.800s; }
.aparato .rodar { animation: rodar 1s ease-out both; }
.aparato .aguja-larga, .aparato .aguja-corta { transform-origin: 260px 146px; animation: aguja 1.200s ease-in-out both; } .aparato .aguja-corta { animation-name: aguja-corta; }
.aparato .trazo { fill: none; stroke-dasharray: 1; animation: trazar 1s ease-out both; } .aparato .largo { animation-duration: 1.800s; animation-timing-function: linear; }
@keyframes subir { from { transform: scaleY(0); } }
@keyframes irse { to { opacity: 0; } }
@keyframes venir { from { opacity: 0; } }
@keyframes rodar { from { transform: translateY(46px); opacity: 0; } }
@keyframes aguja { from { transform: rotate(-360deg); } }
@keyframes aguja-corta { from { transform: rotate(-60deg); } }

/* ---------- Puede y no puede ---------- */
.limites .tramo { display: grid; gap: 34px; padding-block: clamp(56px, 8vw, 96px); }
.limites .columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 28px clamp(28px, 6vw, 88px); }
.limites h3 { font-size: 25px; }
.limites ul { margin: 14px 0 0; padding: 0; list-style: none; }
.limites li { position: relative; padding: 11px 0 11px 34px; font-size: 17px; }
.limites li::before, .limites li::after { content: ""; position: absolute; left: 2px; top: 17px; width: 16px; height: 9px; border: solid var(--farol); border-width: 0 0 3px 3px; transform: rotate(-45deg); }
.limites li::after { display: none; }
.limites .no li::before, .limites .no li::after { display: block; left: 0; top: 22px; width: 20px; height: 0; border-color: var(--suave-noche); border-width: 0 0 3px; }
.limites .no li::after { transform: rotate(45deg); }

/* ---------- Acceso y pie ---------- */
.acceso { position: relative; isolation: isolate; display: grid; align-items: center; min-height: 560px; overflow: hidden;
  --c1: #b9dbe2; --c2: #d3e8eb; --c3: #fae7b8; --agua: #4b94a7; --onda: #94cad6; --borde-agua: #ffffff; --estrellas: 0; --sol: -190; --sol-x: 330; --lampara: #dfe9ec; }
.paisaje { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.acceso .relato { justify-items: start; gap: 16px; width: min(500px, calc(100% - 36px)); margin: 40px clamp(18px, 6vw, 130px); }
.acceso .relato :focus-visible { outline-color: var(--farol); }
.pie { display: flex; justify-content: space-between; gap: 20px; padding: 22px clamp(18px, 4vw, 56px); border-top: 1px solid var(--linea); color: var(--pizarra); }

/* ---------- Página para entrar ---------- */
.entrada { display: grid; grid-template-columns: minmax(300px, 5fr) 7fr; min-height: calc(100vh - 34px); }
.entrada .lado { position: relative; isolation: isolate; display: grid; align-content: start; gap: clamp(28px, 7vh, 72px); padding: clamp(24px, 4vw, 56px); overflow: hidden; }
.entrada .lado img.faro { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; object-position: 0 100%; }
.entrada .lado > a:last-child { position: absolute; left: clamp(24px, 4vw, 56px); bottom: 24px; }
.entrada .lado a { color: inherit; }
.entrada .lado p { max-width: 30ch; font: 600 clamp(26px, 3vw, 40px)/1.120 var(--titular); font-stretch: 87%; }
.entrada main { display: grid; align-content: center; padding: clamp(28px, 6vw, 88px); }
.paso { display: grid; gap: 18px; width: min(400px, 100%); }
.paso h1 { font-size: 32px; }
#codigo { display: none; }
#codigo:target { display: grid; }
.entrada main:has(#codigo:target) #datos { display: none; }

@media (max-width: 860px) {
  .arriba nav { display: none; }
  .arriba .boton { margin-left: auto; }
  .apertura { min-height: 0; }
  .mensaje { padding-bottom: 400px; }
  .escena { top: auto; left: -74px; width: calc(100% + 74px); height: 470px; }
  .e4 text { display: none; }
  .escena text { font-size: 19px; }
  .hallazgo .nombre, .escena .hallazgo .dato { font-size: 18px; }
  .acceso { align-items: end; min-height: 0; padding-top: 300px; background: #37798b; }
  .paisaje { inset: 0 0 auto; height: 330px; }
  .acceso .relato { width: auto; margin: 0 14px 24px; }
  .instrumentos, .limites .columnas, .entrada { grid-template-columns: 1fr; }
  /* El dibujo se queda a la vista mientras se elige un instrumento */
  .aparato { grid-row: 1; top: calc(var(--cabecera) + 8px); z-index: 1; padding: 6px 12px; box-shadow: 0 0 0 10px var(--niebla); }
  .aparato > svg { max-height: 34vh; }
  .entrada { min-height: 0; }
  .entrada .lado { gap: 18px; }
  .entrada .lado img.faro { display: none; }
  .entrada .lado > a:last-child { position: static; }
  /* La escena arriba, centrada en el dibujo, y el texto debajo */
  .acto { display: block; min-height: 0; padding-top: 400px; }
  .acto .lienzo, .comun { inset: 0 auto auto 50%; width: 712px; height: 400px; transform: translateX(-65.300%); }
  .acto .relato { width: auto; margin: 0; border-radius: 0; }
  .relato .reloj { font-size: 40px; }
  .cuenta-disco::after { font-size: 44px; }
}
@supports (animation-timeline: view()) and (animation-range: contain 0% contain 100%) {
  @media (prefers-reduced-motion: no-preference) and (max-width: 860px) and (min-height: 600px) {
    .guardia { height: 620vh; }
    .fija { background: #052733; }
    .acto { padding-top: 0; }
    .acto .lienzo, .comun { inset: 0 auto auto 50%; height: calc(100vh - var(--cabecera) - 300px); width: calc((100vh - var(--cabecera) - 300px) * 1.778); min-width: 712px; }
    .acto .relato { position: absolute; inset: auto 0 62px; height: 238px; align-content: start; gap: 8px; padding: 16px 18px; }
    .relato h3 { font-size: 23px; } .relato p { font-size: 16px; }
    .guardia h2 { top: 12px; left: 12px; }
    .saltos { bottom: 8px; width: calc(100% - 20px); }
    .saltos a { flex: 1; min-width: 0; min-height: 44px; }
  }
}
@media (max-width: 520px) { .elegir label { padding: 11px 14px; } }
@media (prefers-reduced-motion: reduce) {
  .pausa { display: none; }
  .apertura *, .acto *, .aparato *, .paisaje * { animation: none !important; }
  .aparato .antes { display: none; }
}
