:root {
  --bg: #0b0d10;
  --fg: #f4f5f7;
  --old: #b9c0ca;
  --part: #8f98a5;
  --muted: #8a919c;
  --accent: #4cc38a;
  --card: #161a20;
  --line: #262c36;
  --fs: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans Arabic", "Geeza Pro", sans-serif;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; }

/* ---------- Selector de idioma ---------- */

.picker {
  min-height: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.picker header { text-align: center; }

.event {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .85rem;
}

h1 { margin: .25em 0 .4em; font-size: clamp(1.9rem, 6vw, 2.8rem); }

.sub { margin: 0; color: var(--muted); line-height: 1.6; font-size: .95rem; }

.langs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 12px;
}

.langs button {
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: start;
  transition: border-color .15s, transform .15s;
}

.langs button:hover, .langs button:focus-visible { border-color: var(--accent); outline: none; }
.langs button:active { transform: scale(.98); }
.langs strong { font-size: 1.35rem; }
.langs small { color: var(--muted); font-size: .85rem; }

/* ---------- Subtítulos ---------- */

.viewer { height: 100%; height: 100dvh; display: flex; flex-direction: column; }

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
}

.bar button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 40px;
  cursor: pointer;
}

.lang-btn { font-weight: 600; }

.status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .9rem; margin-inline-start: auto; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status.live i { background: var(--accent); box-shadow: 0 0 0 4px rgb(76 195 138 / .2); }
.status.reconnecting i { background: #e5a50a; }

.size { display: flex; gap: 6px; }

.subs {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px max(28px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.lines {
  max-width: 920px;
  margin: 0 auto;
  font-size: calc(clamp(1.3rem, 1.6vw + 1rem, 2.4rem) * var(--fs));
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lines p { margin: 0 0 .55em; color: var(--old); }
.lines p:nth-last-child(-n+2) { color: var(--fg); }
.lines p:empty, .lines p:has(span:empty + span:empty) { display: none; }
.part { color: var(--part); }

.wait { color: var(--muted); text-align: center; margin: 28vh auto 0; max-width: 30em; line-height: 1.5; }

.jump {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  inset-inline-end: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--accent);
  color: #062414;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgb(0 0 0 / .4);
}

@media (max-width: 380px) {
  #statusText { display: none; }
  .bar { gap: 8px; }
  .bar button { padding: 8px 10px; }
}
