/* Congreso en directo · RTVE — estilos (estética RTVE Play) */
:root {
  --bg: #111111;
  --surface: #1c1c1c;
  --surface-2: #262626;
  --border: #333333;
  --text: #ffffff;
  --muted: #a3a3a3;
  --accent: #f05014;
  --accent-2: #ffa000;
  --grad: linear-gradient(135deg, var(--accent-2), var(--accent));
  --live: #cd0000;
  --warn: #f8d000;
  --radius: 8px;
  --tx-size: 26px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font: 16px/1.4 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* La app ocupa exactamente la pantalla: sin scroll de página */
.app {
  position: relative; height: 100vh; height: 100dvh; max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden; overflow: clip;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.top { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.logo { width: 62px; height: auto; display: block; flex: none; }
.top .sep { width: 1px; align-self: stretch; margin: 4px 0; background: var(--border); }
.top h1 { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.15; min-width: 0; }
.top .beta { flex: none; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted);
             font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }

.body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: clip; }

/* Escenario: subtítulos */
.stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.transcript {
  flex: 1; min-height: 0; overflow: hidden; padding: 16px 20px 20px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 14px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 64px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 64px);
}
.line { margin: 0; font-size: calc(var(--tx-size) * .72); line-height: 1.35; color: var(--muted); }
.line.current { font-size: var(--tx-size); line-height: 1.3; color: var(--text); font-weight: 500; }
.line .who {
  display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.placeholder { margin: auto 0; text-align: center; color: var(--muted); font-size: 16px; }
.placeholder b { display: block; color: var(--text); font-size: 20px; font-weight: 500; margin-bottom: 6px; }

.toast {
  position: absolute; left: 12px; right: 12px; top: 8px; z-index: 3;
  padding: 10px 12px; border-radius: var(--radius); font-size: 14px;
  background: #2b2410; border: 1px solid #6b5a12; color: #fde68a;
}
.toast.ok { background: #102a17; border-color: #1f6b33; color: #a7f3c0; }
.toast.info { background: var(--surface-2); border-color: var(--border); color: var(--text); }

/* Dock inferior */
.dock {
  flex: none; padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.signal {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 10px;
  font-size: 13px; line-height: 1.3; color: var(--warn);
}
.signal svg { flex: none; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-btn {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); text-align: left;
}
.lang-btn > svg { flex: none; color: var(--muted); }
.lang-btn .txt { flex: 1; min-width: 0; }
.lang-btn small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lang-btn b { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-btn:focus-visible, .icon-btn:focus-visible, .play:focus-visible, .live-chip:focus-visible,
.opt:focus-visible, .cta:focus-visible, .pick:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 10px; }
.icon-btn {
  justify-self: start; min-width: 48px; height: 44px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: transparent; font-weight: 700;
}
.play {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 4px 18px rgba(240,80,20,.35);
}
.play .i-pause { display: none; }
body.playing .play .i-play { display: none; }
body.playing .play .i-pause { display: block; }
.live-chip {
  justify-self: end; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 4px; border: 0; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.live-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live-chip.live { background: var(--live); color: #fff; cursor: default; }
.live-chip.behind { background: #fff; color: #111; }
.live-chip.warn { background: var(--warn); color: #111; cursor: default; }

/* Pantalla inicial */
.welcome {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; overflow-y: auto;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); background: var(--bg);
}
/* Ilustración del congreso: a sangre arriba y fundida con el fondo; el título entra por encima de su parte baja.
   Es pequeña (332×216): en el móvil cubre; en escritorio va a su tamaño y se alarga con el morado de su borde. */
.welcome-art {
  position: relative; flex: none; margin: -8px -20px 0; height: clamp(160px, 30dvh, 300px);
  background: url(congres.png) 30% 30% / cover no-repeat, #46194f;
}
.welcome-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(17,17,17,.15) 0, rgba(17,17,17,0) 30%, rgba(17,17,17,.6) 70%, var(--bg) 100%);
}
.welcome .hero { position: relative; display: flex; flex-direction: column; margin: -48px 0 16px; }
.welcome .cta { position: relative; margin-top: auto; } /* en el móvil, «Empezar» abajo, a mano del pulgar */
@media (prefers-reduced-motion: no-preference) {
  .welcome-art { animation: art-in 1.4s cubic-bezier(.2, .7, .2, 1) both; }
  .welcome .hero > *, .welcome .cta { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
  .welcome .hero > :nth-child(2) { animation-delay: .06s; }
  .welcome .hero > :nth-child(3) { animation-delay: .12s; }
  .welcome .hero > :nth-child(4) { animation-delay: .18s; }
  .welcome .cta { animation-delay: .26s; }
}
@keyframes art-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.welcome .kicker {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px;
  background: var(--live); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.welcome .kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.welcome h2 { margin: 14px 0 6px; font-size: 24px; line-height: 1.15; font-weight: 900; }
.welcome p { margin: 0; color: var(--muted); }
.picks { display: grid; gap: 8px; margin: 28px 0 0; }
.welcome .beta-note { position: relative; margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.welcome .credits { position: relative; margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 767px) and (max-height: 700px) { .welcome-art { height: 22dvh; } } /* móvil bajo: que quepan los créditos */

/* Escritorio: un solo bloque centrado (cartel, título, idiomas y «Empezar»), sin huecos */
@media (min-width: 768px) {
  .welcome { justify-content: center; padding: 24px 20px 32px; }
  .welcome-art {
    margin: 0; height: 300px; border-radius: 12px;
    background: url(congres.png) right center / auto 100% no-repeat, linear-gradient(#42154d, #481c57);
  }
  .welcome-art::after {
    border-radius: inherit;
    background: linear-gradient(to right, rgba(69, 25, 81, 1) 30%, rgba(69, 25, 81, 0) 38%),
                linear-gradient(to bottom, rgba(17,17,17,0) 45%, rgba(17,17,17,.7) 80%, var(--bg) 100%);
  }
  .welcome .hero { margin: -56px 0 0; }
  .welcome h2 { font-size: 32px; }
  .picks { grid-template-columns: 1fr 1fr; }
  .welcome .cta { margin-top: 24px; }
  /* Fuera de la columna, la misma ilustración muy desenfocada; solo mientras se ve la pantalla de inicio */
  html:has(#welcome:not([hidden])) body { background: transparent; }
  html:has(#welcome:not([hidden])) body::before {
    content: ""; position: fixed; inset: -80px; z-index: -1;
    background: url(congres.png) center / cover; filter: blur(60px) brightness(.7) saturate(1.4);
  }
  html:has(#welcome:not([hidden])) .app {
    background: var(--bg); box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 40px 120px rgba(0,0,0,.7);
  }
}
.pick {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: left;
}
.pick > svg:first-child { flex: none; color: var(--accent); }
.pick .txt { flex: 1; min-width: 0; }
.pick small { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pick b { display: block; font-size: 18px; font-weight: 500; }
.pick > svg:last-child { color: var(--muted); }
.cta {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 56px; margin-top: 16px; border: 0; border-radius: var(--radius);
  background: var(--grad); color: #fff; font-size: 18px; font-weight: 700;
}

/* Hoja inferior de idiomas */
.backdrop {
  position: absolute; inset: 0; z-index: 10; background: rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 85%;
  display: flex; flex-direction: column; background: var(--surface);
  border-radius: 16px 16px 0 0; border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(105%); transition: transform .25s cubic-bezier(.2,.8,.2,1); visibility: hidden;
}
.sheet.open { transform: none; visibility: visible; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 8px auto 0; }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; }
.sheet h2 { margin: 0; font-size: 18px; font-weight: 700; }
.sheet .close { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; }
.sheet .list { overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px;
  border: 0; border-radius: var(--radius); background: transparent; text-align: left;
}
.opt:hover { background: var(--surface-2); }
.opt .txt { flex: 1; min-width: 0; }
.opt b { display: block; font-size: 17px; font-weight: 500; }
.opt small { display: block; font-size: 13px; color: var(--muted); }
.opt .radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); }
.opt[aria-checked="true"] { background: var(--surface-2); }
.opt[aria-checked="true"] b { color: var(--accent-2); }
.opt[aria-checked="true"] .radio { border: 6px solid var(--accent); }
.opt.down { opacity: .5; }
.opt.none b { font-weight: 400; }
.list .divider { height: 1px; background: var(--border); margin: 6px 12px; }
.list .empty { color: var(--muted); padding: 16px 12px; margin: 0; }

audio { display: none; }

@media (min-width: 721px) {
  .app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
