:root {
  --bg: #f4f4f2;
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #d8d8d6;
  --soft: #ecece9;
  --shadow: 0 8px 28px rgba(0,0,0,.08);
  --font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { min-height: 100%; }
a { color: var(--ink); }
a:focus, button:focus, input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.pre-aviso {
  background: var(--ink); color: var(--paper); font-size: .8rem; letter-spacing: .04em;
  text-align: center; padding: .35rem .75rem;
}
#sala {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #f7f7f5;
  touch-action: none;
}
body.vista-2d #sala { display: none; }
#hud {
  position: fixed; z-index: 4; left: 0; right: 0; top: 1.7rem; display: flex;
  justify-content: space-between; gap: .5rem; padding: .5rem .7rem; pointer-events: none;
}
#hud > * { pointer-events: auto; }
.marca { display: flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.92); padding: .3rem .55rem; border-radius: 999px; border: 1px solid var(--line); }
.marca img { width: 36px; height: 32px; }
.marca strong { font-weight: 600; font-size: .9rem; }
.acciones, .opts { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
button, .btn {
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); border-radius: 999px;
  padding: .35rem .7rem; font: inherit; font-size: .85rem; cursor: pointer;
}
button[aria-pressed="true"], button.activo { background: var(--ink); color: var(--paper); }
button:disabled { opacity: .45; cursor: not-allowed; }
#entrada {
  position: fixed; inset: 0; z-index: 8; background: #f7f7f5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 2rem;
  transition: opacity .8s ease, visibility .8s;
}
#entrada.fuera { opacity: 0; visibility: hidden; pointer-events: none; }
#entrada img { width: 92px; height: auto; margin-bottom: 1.2rem; }
#entrada h1 { font-weight: 500; font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 .4rem; letter-spacing: -.02em; }
#entrada p { color: var(--muted); max-width: 28rem; }
#panel-2d {
  display: none; position: relative; z-index: 3; max-width: 1120px; margin: 0 auto;
  padding: 4.8rem 1rem 3rem;
}
body.vista-2d #panel-2d { display: block; }
section {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.25rem;
  padding: 1rem 1.1rem 1.15rem; margin: 0 0 1rem; box-shadow: var(--shadow);
}
section h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; letter-spacing: -.01em; }
.fila { display: grid; gap: 1rem; }
@media (min-width: 860px) {
  .fila-2 { grid-template-columns: 1fr 1fr; }
  .fila-3 { grid-template-columns: 1.1fr .9fr; }
}
.muted, .aviso, .cita { color: var(--muted); font-size: .86rem; }
.aviso { border-left: 2px solid var(--ink); padding-left: .6rem; margin: .4rem 0; }
.cartel, .ficha, .parada {
  border: 1px solid var(--line); border-radius: .9rem; padding: .7rem .8rem; margin: .45rem 0;
  background: var(--bg);
}
.cartel.especial { border-width: 2px; background: var(--paper); }
.cartel h3, .ficha h3, .parada h3 { margin: 0 0 .25rem; font-size: 1rem; font-weight: 600; }
.etiqueta { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
#mapa { height: 380px; border-radius: .9rem; border: 1px solid var(--line); filter: grayscale(1) contrast(.95) brightness(1.05); }
.filtros { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin: .4rem 0 .7rem; font-size: .9rem; }
.lista-mapa { max-height: 260px; overflow: auto; }
form.mostrador { display: grid; gap: .5rem; }
form.mostrador label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; }
select, input[type="text"] { font: inherit; border: 1px solid var(--line); border-radius: .5rem; padding: .35rem .45rem; background: var(--paper); color: var(--ink); }
#itinerario { white-space: pre-wrap; line-height: 1.45; }
#joystick {
  position: fixed; z-index: 5; left: 1rem; bottom: 1.2rem; width: 112px; height: 112px;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.55);
  display: none; touch-action: none;
}
#joystick.visto { display: block; }
body.vista-2d #joystick { display: none !important; }
#joystick .knob {
  position: absolute; width: 46px; height: 46px; border-radius: 50%; background: var(--ink);
  left: 33px; top: 33px; opacity: .55;
}
#ayuda-movil {
  position: fixed; z-index: 5; left: 50%; bottom: .7rem; transform: translateX(-50%);
  background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 999px;
  font-size: .75rem; color: var(--muted); padding: .25rem .7rem; pointer-events: none;
}
body.vista-2d #ayuda-movil { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.leaflet-container { font: inherit; }

section h3 { font-size: .95rem; font-weight: 600; margin: 1rem 0 .4rem; }


/* v2: sala rectangular, fichas, barra de zonas y microanimaciones */
button, .btn { transition: background .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease; }
button:hover, .btn:hover { box-shadow: 0 2px 10px rgba(0,0,0,.12); transform: translateY(-1px); }
button:active, .btn:active { transform: scale(.97); }
#sala { cursor: grab; }
#sala:active { cursor: grabbing; }
#etiqueta-3d {
  position: fixed; z-index: 6; left: 0; top: 0; pointer-events: none; background: #fff; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem;
  opacity: 0; transition: opacity .18s ease; white-space: nowrap;
}
#etiqueta-3d.vista { opacity: 1; }
#zonas-bar {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 2.6rem; display: flex; gap: .4rem;
  overflow-x: auto; padding: .3rem .8rem; scrollbar-width: none; justify-content: safe center;
}
#zonas-bar::-webkit-scrollbar { display: none; }
#zonas-bar button { flex: 0 0 auto; background: rgba(255,255,255,.94); border-color: #cfcfcb; backdrop-filter: blur(6px); }
#zonas-bar button:hover { border-color: var(--ink); }
body.vista-2d #zonas-bar, body:not(.en-sala) #zonas-bar { display: none; }
body:not(.en-sala) #ayuda-movil { display: none; }
#ficha {
  width: min(760px, calc(100vw - 1.2rem)); max-height: min(86vh, 900px); border: 1px solid var(--line);
  border-radius: 1.6rem 1.6rem 1.2rem 1.2rem; padding: 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.18); overflow: auto;
}
#ficha::backdrop { background: rgba(245,245,242,.55); backdrop-filter: blur(3px); }
#ficha.entra { animation: ficha-entra .32s cubic-bezier(.2,.8,.2,1); }
@keyframes ficha-entra { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.ficha-cab {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  background: rgba(255,255,255,.96); padding: .9rem 1.1rem .7rem; border-bottom: 1px solid var(--soft);
}
.ficha-cab h2 { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }
.ficha-cab::after { content: ""; position: absolute; left: 1.1rem; right: 40%; bottom: -1px; height: 2px; background: var(--ink); border-radius: 0 0 60% 0; }
#ficha-cuerpo { padding: .6rem 1.1rem 1.2rem; }
#ficha-cuerpo section { box-shadow: none; border: 0; padding: 0; margin: 0; }
#ficha-cuerpo section > h2 { display: none; }
#ficha-cuerpo audio { width: 100%; margin: .4rem 0; }
.cartel, .parada { transition: transform .2s ease, box-shadow .2s ease; }
.cartel:hover, .parada:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.07); }
body.vista-2d #panel-2d { padding-top: 6.2rem; }
@media (max-width: 560px) {
  #hud { flex-wrap: wrap; }
  .marca strong { font-size: .8rem; }
  #zonas-bar { justify-content: flex-start; bottom: 2.5rem; }
  #ayuda-movil { bottom: .5rem; white-space: nowrap; }
  body.vista-2d #panel-2d { padding-top: 8.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v1.2: color, reproductor de fondo, fotos con créditos */
:root { --azul: #0b4ea2; --oro: #f2c230; }
#btn-centro { font-weight: 600; }
.flotante {
  position: fixed; z-index: 6; right: .8rem; bottom: 5.2rem; background: var(--azul); color: #fff; border-color: var(--azul);
  box-shadow: 0 8px 24px rgba(11,78,162,.28); padding: .5rem .9rem;
}
.flotante:hover { background: #083e83; }
#reproductor {
  position: fixed; z-index: 6; right: .8rem; bottom: 5.2rem; display: grid; grid-template-columns: auto auto auto 1fr auto;
  align-items: center; gap: .4rem; width: min(380px, calc(100vw - 1.6rem)); padding: .55rem .65rem;
  background: rgba(255,255,255,.97); border: 1px solid #dfe6f2; border-radius: 1.4rem; box-shadow: 0 14px 40px rgba(11,78,162,.18);
  animation: ficha-entra .3s cubic-bezier(.2,.8,.2,1);
}
#reproductor[hidden] { display: none; }
#reproductor button { padding: .3rem .55rem; border-color: var(--azul); color: var(--azul); }
#reproductor .rep-play { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--azul); color: #fff; font-size: 1rem; }
#reproductor.sonando .rep-play { box-shadow: 0 0 0 0 rgba(11,78,162,.5); animation: latido 1.6s ease-out infinite; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(11,78,162,.45); } 100% { box-shadow: 0 0 0 12px rgba(11,78,162,0); } }
.rep-info { display: flex; flex-direction: column; min-width: 0; font-size: .8rem; }
.rep-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rep-info select { font-size: .75rem; padding: .1rem .2rem; margin-top: .15rem; }
.rep-mini { font-size: .72rem !important; padding: .15rem .45rem !important; }
#rep-nota { grid-column: 1 / -1; margin: .2rem 0 0; max-height: 7rem; overflow: auto; }
body:not(.en-sala):not(.vista-2d) .flotante, body:not(.en-sala):not(.vista-2d) #reproductor { display: none; }
.foto-libre { margin: 0 0 .8rem; }
.foto-libre img { width: 100%; max-height: 52vh; object-fit: cover; border-radius: 1rem; display: block; }
.foto-libre figcaption { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.creditos { font-size: .82rem; color: var(--muted); padding-left: 1.1rem; }
.creditos li { margin: .25rem 0; }
.cartel.especial { border-color: var(--azul); border-left: 6px solid var(--oro); }
.etiqueta { color: var(--azul); font-weight: 600; }
@media (max-width: 560px) {
  .flotante, #reproductor { bottom: 6rem; right: .5rem; }
}
.fuentes { font-size: .85rem; margin: .2rem 0 .6rem; padding-left: 1.1rem; }
.artista ul { margin: .2rem 0 .4rem; padding-left: 1.1rem; font-size: .9rem; }

/* 1.2.1 · aviso de proyecto no oficial */
:root { --aviso-h: 1.55rem; }
@media (max-width: 720px) { :root { --aviso-h: 2.5rem; } }
.aviso-noficial { margin: 0; font-size: .74rem; line-height: 1.3; text-align: center; color: var(--ink); background: rgba(255,255,255,.94); padding: .3rem .7rem; border-top: 1px solid var(--line); }
.aviso-noficial a { color: var(--azul); font-weight: 600; white-space: nowrap; }
body.en-sala:not(.vista-2d) #aviso-noficial { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; min-height: var(--aviso-h); }
body.en-sala:not(.vista-2d) #zonas-bar { bottom: calc(2.6rem + var(--aviso-h)); }
body.en-sala:not(.vista-2d) #ayuda-movil { bottom: calc(.6rem + var(--aviso-h)); }
body.en-sala:not(.vista-2d) #joystick { bottom: calc(1.2rem + var(--aviso-h)); }
body.en-sala:not(.vista-2d) .flotante, body.en-sala:not(.vista-2d) #reproductor { bottom: calc(5.2rem + var(--aviso-h)); }
@media (max-width: 720px) { body.en-sala:not(.vista-2d) .flotante, body.en-sala:not(.vista-2d) #reproductor { bottom: calc(6rem + var(--aviso-h)); } .aviso-noficial { font-size: .68rem; } }

/* v1.3: sin vista 2D. La sala ocupa la primera pantalla (fija); el contenido HTML va debajo, en el documento. */
:root { --bg: #f6efe4; --paper: #fffaf2; --line: #e6d9c4; --soft: #f1e6d4; --ink: #2a1e12; --muted: #6b5a46; }
html { scroll-behavior: smooth; }
html, body { height: auto; }
#sala { background: #f0dcbc; }
#escena-hueco { height: 100vh; height: 100svh; }
#contenido { position: relative; z-index: 3; max-width: 1120px; margin: 0 auto; padding: 1.2rem 1rem 3rem; background: var(--bg); border-radius: 1.4rem 1.4rem 0 0; box-shadow: 0 -12px 40px rgba(60,35,10,.12); }
body.sin-3d #sala, body.sin-3d #hud, body.sin-3d #zonas-bar, body.sin-3d #ayuda-movil, body.sin-3d #joystick, body.sin-3d #escena-hueco, body.sin-3d #etiqueta-3d { display: none !important; }
body.sin-3d #aviso-noficial { position: static; }
body:not(.en-sala) #hud, body:not(.en-sala) #joystick, body:not(.en-sala) #etiqueta-3d { display: none !important; }
body.en-sala #aviso-noficial { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; min-height: var(--aviso-h); }
body.en-sala #zonas-bar { bottom: calc(2.6rem + var(--aviso-h)); }
body.en-sala #ayuda-movil { bottom: calc(.6rem + var(--aviso-h)); }
body.en-sala #joystick { bottom: calc(1.2rem + var(--aviso-h)); }
body.en-sala .flotante, body.en-sala #reproductor { bottom: calc(5.2rem + var(--aviso-h)); }
body:not(.en-sala) .flotante { display: none; }
.aviso-sin3d { margin: 1rem; }
.btn-mas { flex: 0 0 auto; display: inline-flex; align-items: center; background: #2a1e12; color: #fff8ec; border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; text-decoration: none; }
body.embebido #hud .marca { display: none; }
body.embebido .pre-aviso { font-size: .7rem; padding: .15rem; }
.seo-portada h1 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); line-height: 1.15; margin: .2rem 0 .7rem; letter-spacing: -.02em; }
.seo-intro { font-size: 1.02rem; line-height: 1.6; max-width: 70ch; }
.seo-enlaces { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .4rem 1.2rem; margin-top: .8rem; }
.seo-grupo h2 { font-size: .95rem; margin: .6rem 0 .3rem; }
.seo-grupo h2 a { color: #a4472a; }
.seo-grupo ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; line-height: 1.6; }
/* W3 (Calidad c1f3e59): objetivo táctil de al menos 24 px por enlace (axe target-size) */
.seo-grupo li a, .seo-grupo h2 a { display: inline-block; min-height: 24px; padding-block: 3px; line-height: 18px; box-sizing: border-box; }
.seo-grupo li + li { margin-top: 2px; }
.lista-fichas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.lista-avilesia { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.plano3d { margin: 0 0 .8rem; }
.plano3d iframe { width: 100%; height: min(62vh, 520px); border: 0; border-radius: 1rem; background: #e9dcc7; }
.pag-pie { max-width: 1120px; margin: 0 auto; padding: 1rem; font-size: .85rem; color: var(--muted); position: relative; z-index: 3; background: var(--bg); }
#ficha { --c: #1f3a5f; }
#ficha .ficha-cab::after { background: var(--c); }
#ficha-cuerpo > .fr { margin: .4rem 0 .8rem; }
section { background: var(--paper); }
a:focus-visible, button:focus-visible { outline: 3px solid #a4472a; outline-offset: 2px; }

/* 1.3.3: ligas menores, lista compacta */
.ligas-menores{margin:1rem 0;padding:.6rem .9rem;border:1px solid #e8dccb;border-radius:12px;background:#fffaf2}
.ligas-menores summary{cursor:pointer;font-weight:600}
.ligas-menores ul{margin:.5rem 0 0;padding-left:1.1rem;font-size:.92rem;line-height:1.45}
.ligas-menores li{margin:.25rem 0}
.nota-ligas{font-size:.85rem;opacity:.8}

/* 1.3.5: enlaces equivalentes a las lámparas del techo. Ocultos a la vista hasta que el teclado entra en ellos */
.lamparas-apps { position: fixed; top: 4.2rem; left: 50%; transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 1.5rem);
  clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.lamparas-apps:focus-within { clip-path: none; width: auto; height: auto; overflow: visible; }
.lamparas-apps ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: 0; padding: .45rem .55rem; list-style: none;
  background: rgba(28,20,10,.86); border-radius: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.lamparas-apps a, .lamparas-apps span { display: inline-flex; align-items: center; min-height: 32px; min-width: 24px; padding: 0 .75rem; border-radius: 999px;
  background: #c9a24f; color: #2a1d08; font-weight: 600; font-size: .9rem; text-decoration: none; }
.lamparas-apps span { background: #6b5a3c; color: #f1e6cf; }
.lamparas-apps a:focus-visible { outline: 3px solid #ffd27a; outline-offset: 2px; background: #ffd27a; }
