@import "fonts.css";
@import "../vendor/leaflet/leaflet.css";

/* ============================================================================
   SISTEMA DE DISEÑO — Audioguía del Guadalquivir
   Identidad fluvial/sevillana: río, agua, arena cálida, luz andaluza (oro).
   Móvil-first, áreas táctiles ≥44px, animaciones GPU (transform/opacity).
   ========================================================================== */
:root {
  /* Paleta */
  --rio-profundo: #0e3b52;
  --rio: #1d6f8b;
  --rio-claro: #4a98b0;
  --agua: #cfe6ee;
  --agua-suave: #e8f3f7;
  --arena: #f3e8d6;
  --arena-clara: #faf4ea;
  --oro: #d99a2b;
  --oro-claro: #f0c061;
  --coral: #e07a5f;
  --texto: #16242b;
  --texto-suave: #4a5a62;
  --blanco: #ffffff;
  --sombra-1: 0 2px 8px rgba(14, 59, 82, .12);
  --sombra-2: 0 8px 28px rgba(14, 59, 82, .18);
  --sombra-3: 0 -8px 28px rgba(14, 59, 82, .16);

  /* Tipografía */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Métrica */
  --radio: 16px;
  --radio-sm: 10px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Tiempos */
  --t-rapida: 160ms;
  --t-media: 280ms;
  --t-lenta: 480ms;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; overflow-x: hidden; max-width: 100vw; }
body {
  font-family: var(--sans);
  color: var(--texto);
  background: var(--agua-suave);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body[dir="rtl"] { direction: rtl; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }

#app { position: relative; min-height: 100dvh; overflow: hidden; }

/* ---- Pantalla base + transiciones entre pantallas ---- */
.screen {
  position: absolute; inset: 0;
  width: 100%; max-width: 100%; overflow: hidden;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column;
  will-change: transform, opacity;
}
.screen > * { min-width: 0; max-width: 100%; }
.screen.enter { animation: screenIn var(--t-media) var(--ease-out) both; }
.screen.leave { animation: screenOut var(--t-media) var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes screenOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-10px) scale(.99); } }

/* ---- Botones ---- */
.btn {
  min-height: var(--tap); padding: 0 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; font-weight: 600; font-size: 1rem;
  transition: transform var(--t-rapida) var(--ease), box-shadow var(--t-rapida) var(--ease), background var(--t-rapida);
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, var(--oro), var(--oro-claro)); color: #4a3208; box-shadow: var(--sombra-1); }
.btn-primary:disabled { background: #d9d2c4; color: #9a948a; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: rgba(255, 255, 255, .14); color: var(--blanco); backdrop-filter: blur(6px); }
.btn-block { width: 100%; }

.muted { color: var(--texto-suave); }

/* ============================================================================
   SPLASH
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: radial-gradient(120% 100% at 50% 0%, var(--rio) 0%, var(--rio-profundo) 70%);
  color: var(--blanco);
}
.splash.hide { animation: splashOut var(--t-lenta) var(--ease) forwards; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }
.splash .barco { width: 120px; animation: bob 2.4s var(--ease) infinite; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); }
.splash h1 { color: var(--blanco); font-size: 1.5rem; text-align: center; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-10px) rotate(1.5deg); } }
.splash .wave { position: absolute; bottom: 0; left: 0; width: 100%; height: 120px; opacity: .25;
  background: radial-gradient(80% 80% at 50% 100%, var(--agua), transparent 70%); animation: pulse 3s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .15; } 50% { opacity: .35; } }

/* ============================================================================
   PORTADA (INTRO): timelapse del recorrido a pantalla completa
   ========================================================================== */
.intro {
  justify-content: space-between; color: var(--blanco);
  background: var(--rio-profundo); isolation: isolate;
}
.intro-media {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center;
}
.intro-video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 900ms var(--ease);
}
.intro.playing .intro-video { opacity: 1; }
/* Degradado: cielo limpio arriba, agua oscurecida abajo para que el texto se lea. */
.intro-shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(14,59,82,.55) 0%, rgba(14,59,82,0) 22%),
    linear-gradient(0deg, rgba(8,32,45,.92) 0%, rgba(8,32,45,.72) 30%, rgba(14,59,82,0) 62%);
}
.intro-top { display: flex; justify-content: center; padding-top: 2vh; }
.intro-logo {
  width: 76px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.35));
  animation: introUp 900ms var(--ease-out) 150ms both;
}
.intro-bottom {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 460px; margin: 0 auto;
}
.intro-bottom > * { animation: introUp 900ms var(--ease-out) both; }
.intro-kicker {
  margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--oro-claro); animation-delay: 250ms;
}
.intro h1 {
  font-size: clamp(2rem, 9vw, 2.6rem); line-height: 1.05; text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0,0,0,.35); animation-delay: 350ms;
}
.intro-lead {
  margin: 0 0 10px; font-size: 1.02rem; line-height: 1.4; opacity: .95; animation-delay: 450ms;
}
.intro-lead span { display: block; font-size: .88rem; opacity: .75; margin-top: 2px; }
.intro-start {
  min-height: 56px; font-size: 1.12rem; font-weight: 700; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); animation-delay: 600ms;
}
.intro-start span { font-weight: 500; opacity: .8; }
.intro-note {
  margin: 4px 0 0; text-align: center; font-size: .8rem; line-height: 1.35; opacity: .78;
  animation-delay: 700ms;
}
.intro-action { display: flex; flex-direction: column; gap: 10px; animation: introUp 900ms var(--ease-out) 600ms both; }
.intro-action > * { animation: none; }
/* Acceso con código, sobre el vídeo */
.intro-login {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 20px;
  background: rgba(8, 32, 45, .45); border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.intro-login label { font-size: .85rem; font-weight: 600; opacity: .92; }
.intro-login label span { font-weight: 400; opacity: .75; }
.intro-field { display: flex; gap: 8px; }
.intro-field input {
  flex: 1 1 auto; min-width: 0; height: 54px; padding: 0 14px;
  border-radius: 14px; border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.94); color: var(--rio-profundo);
  font: 700 1.25rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: .12em; text-transform: uppercase; text-align: center;
  outline: none; transition: border-color var(--t-rapida), box-shadow var(--t-rapida);
}
.intro-field input::placeholder { color: #9fb3bd; letter-spacing: .12em; }
.intro-field input:focus { border-color: var(--oro-claro); box-shadow: 0 0 0 4px rgba(240,192,97,.35); }
.intro-field input:disabled { opacity: .6; }
.intro-login .intro-start {
  flex: 0 0 auto; min-height: 54px; padding: 0 20px; font-size: 1.05rem; border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.intro-login .intro-start span { display: none; }
.intro-start.loading { opacity: .75; }
.intro-error { margin: 0; min-height: 0; font-size: .86rem; line-height: 1.35; color: #ffd2c4; font-weight: 600; }
.intro-error:empty { display: none; }
.intro-login.has-error input { border-color: var(--coral); animation: shake 320ms var(--ease); }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.intro-login .intro-note { margin: 0; text-align: left; }
@keyframes introUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (min-width: 700px) {
  /* Escritorio/tableta: el vídeo es vertical; se centra con el póster de fondo. */
  .intro-media { background-color: var(--rio-profundo); }
  .intro-video { max-width: 520px; margin: 0 auto; box-shadow: 0 0 80px rgba(0,0,0,.5); }
}

/* ============================================================================
   SELECCIÓN DE IDIOMA
   ========================================================================== */
.lang { background: linear-gradient(170deg, var(--arena-clara), var(--agua-suave)); }
.lang h2 { text-align: center; color: var(--rio-profundo); font-size: 1.6rem; margin-top: 6vh; }
.lang .sub { text-align: center; margin-bottom: 18px; }
.lang-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  max-width: 480px; width: 100%; margin: 0 auto; overflow-y: auto; padding-bottom: 12px;
}
.lang-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra-1);
  min-height: var(--tap); border: 2px solid transparent;
  transition: transform var(--t-rapida) var(--ease), border-color var(--t-rapida);
  opacity: 0; animation: flagIn var(--t-media) var(--ease-out) forwards;
}
.lang-card:active { transform: scale(.97); }
.lang-card.sel { border-color: var(--oro); }
.lang-card img { width: 40px; height: 30px; object-fit: cover; border-radius: 6px; box-shadow: var(--sombra-1); flex: 0 0 auto; }
.lang-card span { font-weight: 600; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes flagIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================================
   TUTORIAL
   ========================================================================== */
.tut { background: linear-gradient(170deg, var(--rio-profundo), var(--rio)); color: var(--blanco); padding: 0; }
.tut-track { flex: 1; overflow: hidden; position: relative; display: flex; }
.tut-slide {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px; padding: calc(24px + var(--safe-top)) 28px 16px;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.tut-ico {
  width: 120px; height: 120px; border-radius: 50%;
  display: grid; place-items: center; font-size: 3.4rem;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  animation: floaty 3s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.tut-slide h2 { color: var(--blanco); font-size: 1.5rem; }
.tut-slide p { opacity: .92; line-height: 1.5; max-width: 30ch; }
.tut-foot { padding: 14px 20px calc(20px + var(--safe-bottom)); display: flex; align-items: center; justify-content: space-between; }
.tut-dots { display: flex; gap: 8px; }
.tut-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.35); transition: all var(--t-rapida); }
.tut-dot.on { background: var(--oro); width: 22px; border-radius: 4px; }
.tut-skip { color: rgba(255,255,255,.8); font-weight: 600; min-height: var(--tap); padding: 0 12px; }

/* ============================================================================
   MAPA
   ========================================================================== */
.map-screen { padding: 0; }
#map { position: absolute; inset: 0; background: var(--agua); }
.leaflet-container { font-family: var(--sans); background: var(--agua); }

/* Cabecera flotante */
.map-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 500;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,0));
}
.map-header .chip, .map-header .spacer { pointer-events: auto; }
.spacer { flex: 1; }
.chip {
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--blanco); border-radius: 999px; box-shadow: var(--sombra-1); font-weight: 600; font-size: .9rem;
  transition: transform var(--t-rapida) var(--ease);
}
.chip:active { transform: scale(.95); }
.chip img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; }
.chip.icon { width: 44px; padding: 0; justify-content: center; font-size: 1.2rem; }

/* Botón de modo (flotante) */
.mode-btn {
  position: absolute; z-index: 500; right: 14px; bottom: calc(200px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blanco); box-shadow: var(--sombra-2);
  display: grid; place-items: center; font-size: 1.5rem; color: var(--rio-profundo);
  transition: transform var(--t-rapida) var(--ease), background var(--t-media), bottom var(--t-media);
}
.mode-btn:active { transform: scale(.92); }
.mode-btn.following { background: linear-gradient(135deg, var(--rio), var(--rio-profundo)); color: var(--blanco); }
.mode-btn.disabled { opacity: .5; }
.map-screen.follow .mode-btn { bottom: calc(28px + var(--safe-bottom)); }

/* Marcadores */
.poi-pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--rio), var(--rio-profundo));
  border: 2px solid var(--blanco); box-shadow: var(--sombra-1);
  display: grid; place-items: center;
  transition: transform var(--t-media) var(--ease-out);
}
.poi-pin b { transform: rotate(45deg); color: var(--blanco); font-size: .72rem; font-weight: 700; }
.poi-marker.active .poi-pin { background: linear-gradient(135deg, var(--oro), var(--oro-claro)); transform: rotate(-45deg) scale(1.35); z-index: 600; }
.poi-marker.active .poi-pin b { color: #4a3208; }
.poi-marker.near .poi-pin { animation: nearPulse 1.8s ease-in-out infinite; }
@keyframes nearPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(217,154,43,.5); }
  50% { box-shadow: 0 0 0 10px rgba(217,154,43,0); }
}

/* Marcador de usuario */
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--rio); border: 3px solid var(--blanco); box-shadow: var(--sombra-1); }
.me-ring { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; border-radius: 50%;
  transform: translate(-50%,-50%); background: rgba(29,111,139,.25); animation: meRing 2s ease-out infinite; }
@keyframes meRing { 0% { width: 18px; height: 18px; opacity: .7; } 100% { width: 70px; height: 70px; opacity: 0; } }

/* Carrusel inferior */
.carousel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 500;
  padding: 10px 0 calc(14px + var(--safe-bottom));
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  transition: transform var(--t-media) var(--ease), opacity var(--t-media);
}
.carousel::-webkit-scrollbar { display: none; }
.carousel::before, .carousel::after { content: ""; flex: 0 0 16px; }
.map-screen.follow .carousel { transform: translateY(120%); opacity: 0; pointer-events: none; }
.poi-card {
  flex: 0 0 80%; max-width: 330px; scroll-snap-align: center;
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra-2);
  overflow: hidden; display: flex; height: 168px;
  transition: transform var(--t-media) var(--ease);
}
.poi-card.active { transform: translateY(-6px); }
.poi-card .thumb { flex: 0 0 116px; width: 116px; min-width: 116px; background: var(--agua); object-fit: cover; height: 100%; }
.poi-card .thumb.placeholder { display: grid; place-items: center; font-size: 1.8rem; color: var(--rio-claro); }
.poi-card .body { flex: 1 1 auto; padding: 11px 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.poi-card .idx { font-size: .72rem; font-weight: 700; color: var(--oro); letter-spacing: .04em; }
/* unicode-bidi: plaintext -> el título adopta su propia dirección (RTL para árabe) aunque
   el carrusel esté forzado a LTR para conservar la matemática del scroll. */
.poi-card h3 { font-size: .95rem; line-height: 1.22; color: var(--rio-profundo); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-align: start; unicode-bidi: plaintext; }
.poi-card .go { margin-top: auto; font-size: .82rem; font-weight: 600; color: var(--rio); }

/* Aviso flotante (sin ubicación / contexto inseguro) */
.toast {
  position: absolute; z-index: 510; left: 12px; right: 12px; top: calc(64px + var(--safe-top));
  background: var(--rio-profundo); color: var(--blanco); padding: 12px 14px; border-radius: var(--radio);
  box-shadow: var(--sombra-2); font-size: .9rem; display: flex; gap: 10px; align-items: center;
  animation: screenIn var(--t-media) var(--ease-out) both;
}
.toast button { margin-left: auto; font-weight: 700; color: var(--oro-claro); white-space: nowrap; }

/* ============================================================================
   BOTTOM SHEET (detalle de POI) + reproductor
   ========================================================================== */
.scrim { position: absolute; inset: 0; z-index: 900; background: rgba(14,59,82,.45); opacity: 0; pointer-events: none; transition: opacity var(--t-media); }
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 901;
  max-height: 92dvh; background: var(--arena-clara);
  border-radius: 22px 22px 0 0; box-shadow: var(--sombra-3);
  transform: translateY(100%); transition: transform var(--t-media) var(--ease-out);
  display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #cdbfa8; margin: 10px auto 4px; flex: 0 0 auto; touch-action: none; }
.sheet-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 18px calc(18px + var(--safe-bottom)); }
.sheet-img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radio); background: var(--agua); }
.sheet-img.placeholder { display: grid; place-items: center; font-size: 2.6rem; color: var(--rio-claro); }

/* Galería / slider de imágenes */
.gallery { position: relative; }
.gallery-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; touch-action: pan-x;
  border-radius: var(--radio); -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 100%; width: 100%; height: 240px; scroll-snap-align: center;
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background-color: var(--agua);
}
/* Fondo: la propia imagen ampliada y desenfocada, para rellenar sin recortar la real. */
.gallery-slide img.bg {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  object-fit: cover; filter: blur(22px) saturate(1.1); transform: scale(1.15); z-index: 0;
}
.gallery-slide::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: rgba(14, 59, 82, .18);
}
.gallery-slide img {
  position: relative; z-index: 2; max-width: 100%; max-height: 100%;
  width: auto; height: auto; object-fit: contain; display: block;
}
.gallery-dots { position: absolute; z-index: 3; bottom: 10px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; }
.g-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.6); box-shadow: 0 1px 2px rgba(0,0,0,.4); transition: all var(--t-rapida); }
.g-dot.on { background: var(--oro); width: 18px; border-radius: 4px; }
.img-credit { font-size: .7rem; color: var(--texto-suave); margin: 6px 2px 0; opacity: .8; }
.sheet h2 { color: var(--rio-profundo); font-size: 1.4rem; margin: 12px 0 4px; }
.sheet .texto { line-height: 1.6; color: var(--texto); font-size: 1rem; }

/* Recuadro destacado «¿Sabías que…?» */
.dato {
  margin: 16px 0 4px; padding: 14px 16px; border-radius: var(--radio);
  background: linear-gradient(135deg, rgba(217,154,43,.14), rgba(240,192,97,.18));
  border-inline-start: 4px solid var(--oro); position: relative;
}
.dato-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--serif); font-weight: 700; font-size: .9rem; color: #9a6b12;
  margin-bottom: 4px;
}
.dato-tag::before { content: "💡"; }
.dato p { margin: 0; line-height: 1.55; color: var(--texto); font-size: .98rem; }

/* Reproductor */
.player {
  position: sticky; bottom: 0; margin-top: 16px;
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra-1); padding: 12px;
  display: flex; align-items: center; gap: 12px;
}
.player.unavailable { opacity: .7; }
.play-btn {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--rio), var(--rio-profundo)); color: var(--blanco);
  display: grid; place-items: center; font-size: 1.3rem;
  transition: transform var(--t-rapida) var(--ease);
}
.play-btn:active { transform: scale(.92); }
.player-main { flex: 1; min-width: 0; }
.player-time { display: flex; justify-content: space-between; font-size: .74rem; color: var(--texto-suave); margin-top: 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--agua); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--oro), var(--oro-claro)); transition: width .2s linear; }
/* Ecualizador "reproduciendo" */
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 16px; }
.eq i { width: 3px; background: var(--oro); border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .45s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 16px; } }

/* ============================================================================
   MODO AUTO, GUÍA Y MINI-BARRA DE REPRODUCTOR
   ========================================================================== */
.chip.on { background: linear-gradient(135deg, var(--oro), var(--oro-claro)); color: #4a3208; }

.guide-status {
  position: absolute; z-index: 510; left: 12px; right: 12px; top: calc(64px + var(--safe-top));
  background: var(--rio-profundo); color: #fff; padding: 8px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; text-align: center; box-shadow: var(--sombra-1);
  unicode-bidi: plaintext;
}

.player-bar {
  position: absolute; z-index: 520; left: 8px; right: 8px; bottom: calc(8px + var(--safe-bottom));
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; column-gap: 10px;
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra-2); padding: 8px 10px;
  transform: translateY(160%); transition: transform var(--t-media) var(--ease-out);
}
.player-bar.show { transform: none; }
.pb-art { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--agua); }
.pb-art img { width: 100%; height: 100%; object-fit: cover; }
.pb-info { display: flex; flex-direction: column; text-align: start; min-width: 0; }
.pb-now { font-size: .64rem; color: var(--oro); font-weight: 700; letter-spacing: .05em; }
.pb-title { font-weight: 600; color: var(--rio-profundo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.pb-play { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--rio), var(--rio-profundo)); color: #fff; display: grid; place-items: center; }
.pb-close { width: 34px; height: 34px; color: var(--texto-suave); font-size: 1rem; }
.pb-progress { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--agua); overflow: hidden; margin-top: 4px; }
.pb-progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--oro), var(--oro-claro)); }

/* Cuando la mini-barra está visible, sube el carrusel y el botón de modo. */
.map-screen.has-player .carousel { bottom: calc(62px + var(--safe-bottom)); }
.map-screen.has-player .mode-btn { bottom: calc(262px + var(--safe-bottom)); }
.map-screen.follow.has-player .mode-btn { bottom: calc(90px + var(--safe-bottom)); }

/* Cierre accesible de la ficha y controles ±10 s. */
.sheet-close {
  position: absolute; top: 10px; inset-inline-end: 12px; z-index: 3; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(14,59,82,.08); color: var(--texto); font-size: 1rem;
  display: grid; place-items: center;
}
.player .player-time { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.player .nudge { width: 36px; height: 30px; border-radius: 8px; background: var(--agua); color: var(--rio-profundo); font-size: .95rem; flex: 0 0 auto; }
.progress { cursor: pointer; touch-action: none; }

/* Foco accesible y alto contraste. */
:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; border-radius: 4px; }
@media (prefers-contrast: more) {
  .chip, .poi-card, .player, .player-bar, .sheet, .guide-status { border: 1px solid rgba(0,0,0,.35); }
}

/* ============================================================================
   COACHMARKS
   ========================================================================== */
.coach { position: absolute; inset: 0; z-index: 950; }
.coach-hole { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(14,59,82,.7); transition: all var(--t-media) var(--ease); }
.coach-bubble { position: absolute; left: 16px; right: 16px; background: var(--blanco); border-radius: var(--radio);
  padding: 16px; box-shadow: var(--sombra-2); }
.coach-bubble h3 { color: var(--rio-profundo); margin-bottom: 6px; }
.coach-bubble p { line-height: 1.5; color: var(--texto); }
.coach-bubble .row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.coach.dim { background: rgba(14, 59, 82, .7); }
.coach-dots { display: flex; gap: 6px; margin-top: 10px; }
.coach-dots .tut-dot { background: #d8cdb8; }

/* Banner de instalación PWA */
.pwa-banner {
  position: fixed; z-index: 930; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom));
  display: flex; align-items: center; gap: 10px; background: var(--rio-profundo); color: #fff;
  padding: 10px 12px; border-radius: var(--radio); box-shadow: var(--sombra-2);
  transform: translateY(180%); transition: transform var(--t-media) var(--ease-out);
}
.pwa-banner.show { transform: none; }
.pwa-banner img { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; }
.pwa-banner span { flex: 1; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.pwa-banner .pwa-x { color: rgba(255,255,255,.85); width: 30px; height: 30px; flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
