/* ============================================================
   Colección Épica — Guía Multimedia QR
   Paleta: azul marino #141d35 · dorado #f5c842
   ============================================================ */

:root {
  --navy: #141d35;
  --navy-2: #1a2540;
  --navy-3: #232f52;
  --gold: #f5c842;
  --gold-soft: #f7d572;
  --ink: #eef1f8;
  --muted: #9aa6c4;
  --line: rgba(245, 200, 66, 0.18);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --ff-title: 'Bebas Neue', 'Barlow Condensed', sans-serif;
  --ff-ui: 'Barlow Condensed', sans-serif;
  --ff-body: 'Barlow', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--ff-body);
  background: var(--navy);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Patrón de fondo: usa assets/patron-sp.png con overlay navy para legibilidad.
   Si la imagen no existe, queda el color navy de fondo (sin romperse). */
.bg-pattern {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(20, 29, 53, 0.82), rgba(20, 29, 53, 0.92)),
    url('../assets/patron-sp.png');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

.screen { position: relative; z-index: 1; min-height: 100dvh; display: none; }
.screen.active { display: block; animation: fadeUp .5s ease both; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   SPLASH
   ============================================================ */
#splash {
  flex-direction: column; align-items: center; justify-content: center;
  min-height: 100dvh; text-align: center; gap: 26px; padding: 24px;
}
#splash.active { display: flex; }
.splash-logo-img {
  width: min(88%, 560px); height: auto;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .5));
  animation: logoIn 1s cubic-bezier(.2, .8, .2, 1) both, logoFloat 4s ease-in-out 1s infinite;
}
@keyframes logoIn { from { opacity: 0; transform: translateY(22px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes logoFloat { 50% { transform: translateY(-8px); } }

.splash-ball {
  font-size: 78px; line-height: 1;
  animation: ballDrop .9s cubic-bezier(.2,.8,.2,1) both, ballSpin 3.5s linear .9s infinite;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.5));
}
@keyframes ballDrop { 0% { transform: translateY(-120px) scale(.6); opacity: 0; } 60% { transform: translateY(10px) scale(1.05); opacity: 1; } 100% { transform: translateY(0) scale(1); } }
@keyframes ballSpin { to { transform: rotate(360deg); } }
.splash-logo { font-family: var(--ff-title); font-size: clamp(46px, 13vw, 84px); letter-spacing: 2px; color: var(--gold); line-height: .9; }
.splash-sub { font-family: var(--ff-ui); text-transform: uppercase; letter-spacing: 3px; color: var(--muted); font-size: 14px; }
.splash-bar { width: min(260px, 70vw); height: 4px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 6px; }
.splash-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); animation: load 2.4s ease forwards; }
@keyframes load { to { width: 100%; } }
.splash-hint { font-family: var(--ff-ui); letter-spacing: 1px; color: var(--muted); font-size: 12px; animation: blink 1.4s ease infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ============================================================
   PIEZA
   ============================================================ */
.hero {
  position: relative; height: 56dvh; min-height: 320px; max-height: 520px;
  background-size: cover; background-position: center; overflow: hidden;
}
.hero.no-img { background-color: var(--navy-3); background-image: linear-gradient(160deg, var(--navy-3), var(--navy)); }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,29,53,.15) 0%, rgba(20,29,53,.55) 55%, var(--navy) 100%);
}
.hero-tag {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  background: var(--gold); color: var(--navy);
  font-family: var(--ff-ui); font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  font-size: 13px; padding: 6px 12px; border-radius: 8px;
}
.hero-num {
  position: absolute; right: 10px; bottom: -6px; z-index: 1;
  font-family: var(--ff-title); font-size: clamp(120px, 40vw, 240px);
  color: rgba(245,200,66,.12); line-height: .8; pointer-events: none;
}
.pieza-body { position: relative; z-index: 2; padding: 0 22px 120px; margin-top: -40px; }
.pieza-cat { font-family: var(--ff-ui); text-transform: uppercase; letter-spacing: 2px; color: var(--gold); font-size: 14px; font-weight: 700; }
.pieza-title { font-family: var(--ff-title); font-size: clamp(38px, 11vw, 60px); line-height: .95; margin: 4px 0 14px; }

.datos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.dato { background: var(--navy-3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.dato b { display: block; font-family: var(--ff-ui); text-transform: uppercase; letter-spacing: 1px; font-size: 11px; color: var(--muted); font-weight: 600; }
.dato span { font-size: 16px; color: var(--ink); font-weight: 600; }
.dato-plain { display: flex; align-items: center; }
.dato-plain span { font-size: 15px; }

.pieza-desc { color: var(--muted); font-size: 16px; line-height: 1.55; margin-bottom: 26px; }

.pieza-cta { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 6px; }
.play-cta {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 62px; background: var(--gold); color: var(--navy); border: none; border-radius: 14px;
  font-family: var(--ff-ui); font-weight: 700; font-size: 21px; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 12px 28px rgba(245, 200, 66, .32); transition: transform .15s cubic-bezier(.2,.8,.2,1);
}
.play-cta svg { width: 22px; height: 22px; fill: var(--navy); }
.play-cta:active { transform: scale(.98); }
.play-cta:disabled { background: var(--navy-3); color: var(--muted); box-shadow: none; cursor: default; border: 1px solid var(--line); }
.play-cta:disabled svg { display: none; }
.change-lang {
  background: none; border: none; color: var(--muted); font-family: var(--ff-ui);
  font-size: 15px; letter-spacing: .5px; text-decoration: underline; cursor: pointer; min-height: 44px;
}
.change-lang:active { color: var(--gold); }

/* ============================================================
   SELECCIÓN DE IDIOMA
   ============================================================ */
#langselect { padding: 28px 22px; }
#langselect.active { display: flex; }
.ls-wrap { margin: auto; width: 100%; max-width: 460px; text-align: center; animation: fadeUp .5s ease both; }
.ls-logo { width: min(74%, 360px); height: auto; margin: 0 auto 28px; display: block; filter: drop-shadow(0 12px 26px rgba(0,0,0,.45)); }
.ls-title { font-family: var(--ff-ui); font-weight: 700; font-size: 22px; letter-spacing: .5px; line-height: 1.2; margin-bottom: 24px; }
.ls-title span { display: block; font-weight: 500; font-size: 16px; color: var(--muted); margin-top: 3px; }
.ls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ls-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  min-height: 100px; background: var(--navy-2); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 16px 12px; cursor: pointer; color: var(--ink);
  transition: transform .15s cubic-bezier(.2,.8,.2,1), border-color .2s, background .2s;
}
.ls-btn:hover { border-color: var(--gold); }
.ls-btn:active { transform: scale(.96); }
.ls-btn.current, .ls-btn.suggested { border-color: var(--gold); background: rgba(245,200,66,.08); }
.ls-flag { font-size: 40px; line-height: 1; }
.ls-name { font-family: var(--ff-ui); font-weight: 600; font-size: 18px; }

/* ============================================================
   PLAYER
   ============================================================ */
.player-wrap { max-width: 540px; margin: 0 auto; padding: 0 0 120px; }
.player-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: linear-gradient(rgba(20,29,53,.92), rgba(20,29,53,.7));
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-3); border: 1px solid var(--line); color: var(--ink); cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), border-color .18s;
}
.icon-btn:hover { border-color: var(--gold); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 22px; height: 22px; fill: var(--ink); }

.lang-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 14px;
  background: var(--navy-3); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--ff-ui); font-weight: 600; font-size: 16px; color: var(--ink); cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), border-color .18s;
}
.lang-pill:hover { border-color: var(--gold); }
.lang-pill:active { transform: scale(.96); }
.lang-pill .flag { font-size: 18px; line-height: 1; }
.lang-pill .chev { width: 16px; height: 16px; fill: var(--gold); }

.pane { padding: 20px 18px; display: none; }
.pane.active { display: block; animation: fadeIn .3s ease both; }

/* Now playing: arte de la pieza + título */
.now { display: flex; align-items: center; gap: 16px; margin: 8px 0 28px; }
.art {
  position: relative; width: 92px; height: 92px; flex-shrink: 0; border-radius: 18px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--navy-3), var(--navy-2));
  box-shadow: 0 12px 28px rgba(0,0,0,.45), inset 0 0 0 1.5px rgba(245,200,66,.35);
}
.art-num { font-family: var(--ff-title); font-size: 42px; line-height: 1; color: rgba(245,200,66,.55); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.track-meta b { font-family: var(--ff-ui); font-size: 23px; font-weight: 700; display: block; line-height: 1.12; }
.track-meta small { color: var(--muted); font-size: 14px; letter-spacing: .2px; }

/* Waveform */
.waveform { display: flex; align-items: center; gap: 3px; height: 80px; margin: 4px 0 20px; }
.waveform .bar { flex: 1; min-width: 2px; background: rgba(238,241,248,.16); border-radius: 99px; transition: background .12s linear, transform .12s ease; transform-origin: center; }
.waveform .bar.on { background: var(--gold); }
.waveform .bar.active { animation: bounce .5s ease infinite; }
@keyframes bounce { 50% { transform: scaleY(1.35); } }

/* Controles */
.controls { position: relative; display: flex; align-items: center; justify-content: center; gap: 30px; margin: 8px 0 22px; }
.controls::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 220px; height: 160px; transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(245,200,66,.18), transparent 68%); filter: blur(8px); pointer-events: none;
}
.ctrl {
  position: relative; width: 58px; height: 58px; border-radius: 50%; cursor: pointer;
  background: var(--navy-3); border: 1px solid var(--line); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-family: var(--ff-ui); font-weight: 600; font-size: 10px; letter-spacing: .5px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), border-color .18s;
}
.ctrl:hover { border-color: var(--gold); }
.ctrl:active { transform: scale(.9); }
.ctrl svg { width: 22px; height: 22px; fill: var(--ink); }
.ctrl-play {
  position: relative; width: 78px; height: 78px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 32% 24%, var(--gold-soft), var(--gold) 58%, #e0b02e);
  box-shadow: 0 16px 36px rgba(245,200,66,.42), inset 0 2px 5px rgba(255,255,255,.45);
  transition: transform .15s cubic-bezier(.2,.8,.2,1);
}
.ctrl-play:active { transform: scale(.94); }
.ctrl-play svg { width: 32px; height: 32px; fill: var(--navy); }

/* Progreso */
.progress { margin: 2px 0 22px; }
.progress-bar { position: relative; height: 6px; background: rgba(238,241,248,.12); border-radius: 99px; cursor: pointer; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); border-radius: 99px; }
.progress-dot { position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%; background: var(--gold); transform: translate(-50%, -50%); left: 0; box-shadow: 0 0 0 5px rgba(245,200,66,.18); }
.times { display: flex; justify-content: space-between; font-family: var(--ff-ui); color: var(--muted); font-size: 13px; margin-top: 9px; font-variant-numeric: tabular-nums; }

/* Subtítulos */
.subs-wrap { margin: 6px 0 16px; }
.subs-label { display: block; text-align: center; font-family: var(--ff-ui); text-transform: uppercase; letter-spacing: 2.5px; font-size: 11px; color: var(--muted); margin-bottom: 9px; }
.subs { min-height: 88px; background: linear-gradient(rgba(0,0,0,.20), rgba(0,0,0,.30)); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; align-items: center; justify-content: center; text-align: center; }
.subs p { font-size: 18px; line-height: 1.5; color: var(--ink); transition: opacity .25s ease; }
.subs .muted { color: var(--muted); }

.transcript-toggle { width: 100%; min-height: 50px; background: var(--navy-2); border: 1px solid var(--line); color: var(--ink); border-radius: 14px; font-family: var(--ff-ui); font-weight: 600; font-size: 15px; letter-spacing: .5px; cursor: pointer; transition: border-color .18s; }
.transcript-toggle:hover { border-color: var(--gold); }
.transcript { display: none; margin-top: 12px; padding: 18px; background: var(--navy-2); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); line-height: 1.7; font-size: 15px; }
.transcript.open { display: block; }
.transcript p { margin-bottom: 8px; }

/* Error */
#error { display: none; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; text-align: center; gap: 14px; padding: 30px; }
#error.active { display: flex; }
#error h1 { font-family: var(--ff-title); font-size: 44px; color: var(--gold); }
#error a { color: var(--gold); font-family: var(--ff-ui); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--gold); color: var(--navy); font-family: var(--ff-ui); font-weight: 700; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   MUSEO VIRTUAL (aditivo · no afecta el flujo QR)
   ============================================================ */
.museo-back {
  position: absolute; top: 16px; left: 16px; z-index: 3; display: none; align-items: center; gap: 5px;
  background: rgba(20, 29, 53, .72); backdrop-filter: blur(8px); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 8px 14px 8px 11px; font-family: var(--ff-ui); font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), border-color .2s;
}
.museo-back:hover { border-color: var(--gold); }
.museo-back:active { transform: scale(.95); }
body.menu-mode .museo-back { display: inline-flex; }
body.menu-mode .hero-tag { left: auto; right: 16px; }

/* Barra de navegación inferior (sala + reproductor) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(20,29,53,.35), rgba(20,29,53,.97) 45%); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.bottom-nav.visible { display: flex; }
.nav-menu { display: inline-flex; align-items: center; gap: 8px; background: var(--navy-3); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 10px 20px; font-family: var(--ff-ui); font-weight: 600; font-size: 16px; letter-spacing: .3px; cursor: pointer; transition: transform .15s cubic-bezier(.2,.8,.2,1), border-color .2s; }
.nav-menu svg { width: 18px; height: 18px; fill: var(--gold); }
.nav-menu:hover { border-color: var(--gold); }
.nav-menu:active { transform: scale(.96); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:disabled:hover { border-color: var(--line); }

#mls { padding: 28px 22px; }
#mls.active { display: flex; }

.menu-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: linear-gradient(rgba(20,29,53,.92), rgba(20,29,53,.6)); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.menu-logo { height: 40px; width: auto; }
.menu-body { max-width: 760px; margin: 0 auto; padding: 24px 18px 64px; }
.menu-title { font-family: var(--ff-title); font-size: clamp(36px, 10vw, 56px); line-height: .92; }
.menu-sub { color: var(--muted); font-family: var(--ff-ui); letter-spacing: 2px; text-transform: uppercase; font-size: 13px; margin: 6px 0 24px; }
.menu-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .menu-grid { grid-template-columns: 1fr 1fr; } }
.sala-card {
  display: flex; align-items: stretch; background: var(--navy-2); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; cursor: pointer; text-align: left; color: var(--ink); padding: 0;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), border-color .2s;
}
.sala-card:hover { border-color: var(--gold); }
.sala-card:active { transform: scale(.985); }
.sala-card .thumb { width: 112px; flex-shrink: 0; object-fit: cover; background: var(--navy-3); align-self: stretch; }
.sala-card .meta { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
.sala-card .ord { font-family: var(--ff-ui); font-weight: 700; color: var(--gold); font-size: 13px; letter-spacing: 1px; }
.sala-card .cat { font-family: var(--ff-title); font-size: 23px; line-height: 1; }
.sala-card .tit { color: var(--muted); font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
