:root {
  /* Live Captions palette: black surfaces, red / yellow / teal accents */
  --bg: #000000; --panel: #111111; --panel2: #1a1a1a; --line: #262626; --text: #ffffff; --muted: #b0b0b0;
  --red: #FF323C; --yellow: #FFBA00; --teal: #00ACA8;
  --accent: var(--red); --accent2: var(--teal); --ok: #34d399; --warn: var(--yellow); --bad: var(--red);
  --font-display: 'Barlow Semi Condensed', 'Barlow', 'Arial Narrow', sans-serif;
  --font-body: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs: 34px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); }
a { color: var(--teal); text-decoration: none; }
h1, h2, h3, .display { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.brandbar { height: 4px; background: linear-gradient(90deg, var(--room, var(--red)) 0 33%, var(--yellow) 33% 66%, var(--teal) 66%); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
header.top h1 { font-size: 22px; margin: 0; font-weight: 700; }
header.top .sub { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.badge.off .dot { background: var(--bad); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.card { --c: var(--teal); }
.card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c); }
.card:nth-child(3n+1) { --c: var(--red); } .card:nth-child(3n+2) { --c: var(--yellow); }
.card[style*="--c"] { }
/* "Próximamente": eventos agendados con anticipación, sin audio todavía — se distinguen a
   propósito de las salas en vivo con borde punteado y sin la franja de color sólida arriba. */
.card.upcoming { border-style: dashed; opacity: .92; }
.card.upcoming::before { opacity: .5; }
.card .cdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: middle; }
.card .talk { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.card .talk .when { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--red); font-weight: 700; }
.card .talk .ttl { font-family: var(--font-display); text-transform: uppercase; font-size: 17px; line-height: 1.15; margin: 4px 0 2px; }
.card .talk .spk { color: var(--muted); font-size: 13px; }
header.top .sub .talkline { color: var(--yellow); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.card h3 { margin: 0; font-size: 24px; }
.card .room { color: var(--muted); font-size: 13px; }
.langs { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font-size: 14px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pill.active { background: var(--red); border-color: var(--red); color: white; }
.pill:hover { border-color: var(--yellow); }
button, select { font: inherit; }
button.btn { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
button.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.btn.primary:hover { background: #E02832; }
button.btn.danger { background: #2a1214; border-color: #5b2b33; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }
.muted { color: var(--muted); }
/* viewer */
.captions { padding: 20px 16px 18vh; max-width: 1100px; margin: 0 auto; }
.seg { font-size: var(--fs); line-height: 1.35; margin: 0 0 .55em; font-weight: 500; }
.seg .orig { display: block; font-size: .55em; color: var(--muted); font-weight: 400; margin-top: 2px; }
.seg.partial { color: #d6d6d6; opacity: .85; }
.seg.partial::after { content: '▍'; color: var(--yellow); animation: blink 1s infinite; }
.seg.waiting { color: var(--muted); font-style: italic; }
@keyframes blink { 50% { opacity: 0; } }
body.overlay { background: transparent; }
body.overlay header.top { display: none; }
body.overlay .captions { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 40px 30px; text-align: center; }
body.overlay .seg { text-shadow: 0 2px 6px #000, 0 0 2px #000; color: #fff; }
body.overlay .seg .orig { color: #ddd; }
/* operator */
.meter { height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--yellow), var(--red)); transition: width .08s; }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #0a0a0a; border: 1px solid var(--line); border-radius: 10px; padding: 10px; height: 180px; overflow: auto; white-space: pre-wrap; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv b { color: var(--muted); font-weight: 500; }

/* Producer room-card dashboard: live badges + stat grid + now/next chip, so managing
   several stages at once reads like a control room instead of a spreadsheet. */
.roomBadges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.rbadge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-family: var(--font-display); border: 1px solid transparent; }
.rbadge.lang { background: rgba(0,172,168,.16); color: #5fe0dc; border-color: rgba(0,172,168,.4); }
.rbadge.sub { background: rgba(139,92,246,.16); color: #c4b1fb; border-color: rgba(139,92,246,.4); }
.rbadge.engine { background: rgba(255,186,0,.14); color: var(--yellow); border-color: rgba(255,186,0,.4); }
.rbadge.live { background: rgba(52,211,153,.16); color: var(--ok); border-color: rgba(52,211,153,.4); }
.rbadge.live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.rbadge.off { background: rgba(255,50,60,.12); color: #ff8b92; border-color: rgba(255,50,60,.35); }
.rbadge.off .dot { background: #ff8b92; box-shadow: none; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 10px 0; }
.statgrid .stat { background: var(--panel2); padding: 8px 6px; text-align: center; }
.statgrid .stat b { display: block; font-family: var(--font-display); font-size: 20px; line-height: 1.1; }
.statgrid .stat span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.nowNext { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 6px; }
.nowNext .talk { flex: 1 1 220px; margin: 0; }
.nowNext .talk.next { opacity: .7; }
.footerlinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.footerlinks a.btn, .footerlinks button.btn { font-size: 12px; padding: 7px 12px; }
@media (max-width: 600px) { :root { --fs: 26px; } .kv { grid-template-columns: 1fr; } }
select.btn { padding: 8px 12px; background: var(--panel2); color: var(--text); }
input[type=time].btn { padding: 6px 10px; color-scheme: dark; }
button.btn.on { background: var(--teal); border-color: var(--teal); color: #000; }

/* settings panel + welcome modal */
.panel { flex-basis: 100%; width: 100%; border-top: 1px solid var(--line); padding: 10px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.panel .row > b { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); min-width: 80px; font-weight: 600; }
input.btn { text-transform: none; font-family: var(--font-body); font-weight: 400; letter-spacing: 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal .card { max-width: 420px; width: 100%; }

/* v2: people popover */
.popover { position: fixed; top: 64px; right: 16px; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 260px; max-height: 60vh; overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 14px; }
.popover b { display: block; margin-bottom: 8px; font-family: var(--font-display); text-transform: uppercase; }
.person { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.person img, .person .ini { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.person .ini { display: inline-flex; align-items: center; justify-content: center; background: var(--teal); color: #000; font-weight: 700; font-size: 13px; }

/* v2: room chat */
.chat { position: fixed; right: 0; top: 0; bottom: 0; width: 340px; max-width: 100vw; background: var(--panel); border-left: 1px solid var(--line); z-index: 30; display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head b { font-family: var(--font-display); text-transform: uppercase; }
.chat-list { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.chat-form { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg img, .msg .ini { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; }
.msg .ini { display: inline-flex; align-items: center; justify-content: center; background: var(--yellow); color: #000; font-weight: 700; font-size: 13px; }
.msg.spk .ini { background: var(--red); color: #fff; }
.msg .meta { font-size: 12px; margin-bottom: 2px; }
body.with-chat .captions { margin-right: 340px; }
@media (max-width: 700px) { .chat { width: 100vw; } body.with-chat .captions { margin-right: 0; display: none; } }
body.with-chat header.top { margin-right: 340px; } @media (max-width: 700px) { body.with-chat header.top { margin-right: 0; } }

/* pause-to-reread, high contrast (low vision / deaf & hard of hearing), room screen with QR */
body.paused .captions { outline: 3px dashed var(--yellow, #FFBA00); outline-offset: -3px; }
body.paused .captions::before { content: 'PAUSADO · tocá ▶ Volver al vivo'; display: block; color: #FFBA00; font-family: var(--font-display); letter-spacing: .06em; font-size: 14px; margin-bottom: 8px; }
body.hc { --bg: #000; --text: #fff; --fs: 44px; }
body.hc .captions { font-family: 'Atkinson Hyperlegible', var(--font-body); line-height: 1.35; }
body.hc .seg { font-size: var(--fs); color: #fff; background: #000; padding: 6px 10px; border-left: 8px solid #FFBA00; margin: 10px 0; }
body.hc .seg.partial { color: #FFBA00; }
body.hc .seg .orig { color: #ddd; }
body.hc .seg:nth-last-child(n+4) { opacity: .45; }
.missed { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); white-space: pre-wrap; font-size: 16px; line-height: 1.45; }
.missed .qr { width: 240px; height: 240px; background: #fff; padding: 8px; border-radius: 8px; display: block; margin-bottom: 6px; }
body.tv header.top, body.tv #panel, body.tv #chat { display: none !important; }
body.tv .captions { --fs: 52px; padding: 30px 320px 40px 40px; min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-end; }
.tvqr { position: fixed; right: 30px; bottom: 30px; width: 240px; height: 240px; background: #fff; padding: 10px; border-radius: 12px; z-index: 5; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* logo, chat extras, floor, quality, toast, day theme */
.logo { display: inline-flex; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .04em; text-decoration: none; margin-right: 14px; line-height: 1; padding: 6px 8px; border: 2px solid var(--line); border-radius: 8px; }
.logo .l1 { color: var(--red); } .logo .l2 { color: var(--yellow); } .logo .l3 { color: var(--teal); }
.emojis { display: none; flex-wrap: wrap; gap: 4px; padding: 6px 12px; border-top: 1px solid var(--line); }
.emojis button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; font-size: 20px; padding: 4px 6px; cursor: pointer; }
.chat-form .btn.on { background: var(--red); color: #fff; border-color: var(--red); }
#handBtn.on { background: var(--yellow); color: #000; border-color: var(--yellow); }
.floor { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.floor .hand { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; margin: 2px 0; }
.floor .btn { padding: 3px 8px; font-size: 12px; }
.msg audio { width: 220px; height: 32px; margin-top: 4px; display: block; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--yellow); color: #000; padding: 10px 16px; border-radius: 8px; font-weight: 600; z-index: 50; }
#q { font-variant-numeric: tabular-nums; }
.chat-form { flex-wrap: nowrap; } .chat-form .btn { padding: 8px 10px; flex: none; } .chat-form input { min-width: 0; }
.emojis { gap: 3px; } .emojis button { font-size: 18px; padding: 3px 5px; }
/* "Entrar con GitHub": same shape/size as Google's sign-in button (40px, white, Roboto 14px), GitHub mark (Primer octicon, MIT) tinted violet */
.btn.gh { display: inline-flex; align-items: center; gap: 10px; height: 40px; box-sizing: border-box; margin-top: 8px; padding: 0 12px; border-radius: 4px; text-decoration: none; background: #fff; color: #1f1f1f; border: 1px solid #747775; font-family: Roboto, Arial, sans-serif; font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: .25px; }
.btn.gh:hover { background: #f2f2f2; }
.btn.gh .ghmark { width: 20px; height: 20px; flex: none; background: #8957e5; -webkit-mask: url(/img/github-mark.svg) center / contain no-repeat; mask: url(/img/github-mark.svg) center / contain no-repeat; }
#panel .row .btn.gh { height: 32px; font-size: 13px; margin: 0; } #panel .row .btn.gh .ghmark { width: 16px; height: 16px; }
/* fixes: people popover above the chat, chat form never cuts the send button */
.popover, #people { z-index: 40; }
.chat { width: min(340px, 100vw); box-sizing: border-box; }
.chat-form { padding: 8px; gap: 4px; }
.chat-form .btn { padding: 8px 8px; font-size: 15px; }
.chat-form input { flex: 1 1 60px; width: 60px; }
@media (max-width: 420px) { .chat-form #emojiBtn { display: none; } .emojis { display: none !important; } }
.card.welcome { max-width: 460px; border-top: 4px solid var(--room, var(--red)); }
.logo.big { font-size: 30px; border: 0; padding: 0; margin: 0; }
.welcome .roles { display: grid; gap: 8px; }
.welcome .roles .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; text-align: left; width: 100%; box-sizing: border-box; }
.welcome .roles .btn small { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; opacity: .8; }
.welcome .acct { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.welcome .acct .btn.gh { margin: 0; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
@media (max-width: 700px) { .brand .logo { display: none; } }
body.with-chat .popover { right: 356px; }
#wName.err { border-color: var(--red); }

/* ---- day theme: explicit colors everywhere (no reliance on inherited dark defaults) */
:root[data-theme="light"] { --bg: #f4f4f6; --panel: #ffffff; --panel2: #f0f0f3; --line: #d9d9e0; --text: #15151a; --muted: #5a5a66; }
:root[data-theme="light"] body { background: var(--bg); color: var(--text); }
:root[data-theme="light"] header.top { background: #fff; box-shadow: 0 1px 0 var(--line), 0 6px 20px rgba(0,0,0,.05); }
:root[data-theme="light"] button.btn, :root[data-theme="light"] a.btn, :root[data-theme="light"] select.btn, :root[data-theme="light"] input.btn { background: #fff; color: var(--text); border-color: #cfcfd8; }
:root[data-theme="light"] button.btn:hover { border-color: var(--red); }
:root[data-theme="light"] button.btn.primary { background: var(--red); color: #fff; border-color: var(--red); }
:root[data-theme="light"] button.btn.on, :root[data-theme="light"] #handBtn.on { color: #000; }
:root[data-theme="light"] input[type=time].btn { color-scheme: light; }
:root[data-theme="light"] .badge { background: #f0f0f3; color: #3a3a44; border-color: #d9d9e0; }
:root[data-theme="light"] .captions { background: #fff; border-radius: 14px; margin: 14px auto; box-shadow: 0 2px 12px rgba(0,0,0,.06); padding-bottom: 12vh; min-height: 50vh; }
:root[data-theme="light"] .seg { color: #15151a; }
:root[data-theme="light"] .seg.partial { color: #6b5300; opacity: 1; }
:root[data-theme="light"] .seg .orig { color: #5a5a66; }
:root[data-theme="light"] .seg.waiting { color: #8a8a96; }
:root[data-theme="light"] .panel .row > b { color: #3a3a44; }
:root[data-theme="light"] .missed, :root[data-theme="light"] .floor, :root[data-theme="light"] .popover, :root[data-theme="light"] .chat, :root[data-theme="light"] .card { background: #fff; color: var(--text); }
:root[data-theme="light"] .emojis button { background: #f0f0f3; }
:root[data-theme="light"] .modal { background: rgba(20,20,30,.55); }
:root[data-theme="light"] .logo { border-color: #e2e2ea; }
:root[data-theme="light"] .toast { box-shadow: 0 4px 16px rgba(0,0,0,.2); }

/* room switcher: click the room name in the header -> every room with its talk, countdown and audience */
h1.roomsel { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 0 6px; margin-left: -6px; }
h1.roomsel:hover, h1.roomsel:focus-visible { background: var(--panel2); outline: none; }
h1.roomsel .caret { font-size: 14px; color: var(--muted); }
header.top .sub .cd { color: var(--teal); text-transform: none; letter-spacing: 0; font-weight: 700; white-space: nowrap; }
.popover.rooms { left: 16px; right: auto; min-width: 340px; max-width: min(560px, calc(100vw - 32px)); padding: 10px; }
.rooms .sep { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--muted); margin: 10px 4px 4px; }
.rooms .room { display: grid; grid-template-columns: 12px 1fr auto; grid-template-areas: "d n v" "d t c"; column-gap: 10px; row-gap: 2px; align-items: center; padding: 8px 8px; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.rooms .room:hover { background: var(--panel2); border-color: var(--line); }
.rooms .room.cur { background: var(--panel2); border-color: var(--c, var(--teal)); }
.rooms .cdot { grid-area: d; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--teal)); }
.rooms .rn { grid-area: n; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .03em; font-size: 15px; }
.rooms .rt { grid-area: t; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rooms .rt b { color: var(--text); font-weight: 600; }
.rooms .rc { grid-area: c; font-size: 12px; color: var(--teal); font-weight: 700; white-space: nowrap; }
.rooms .rv { grid-area: v; font-size: 12px; white-space: nowrap; }
.rooms .tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 10px; background: var(--line); color: var(--muted); vertical-align: middle; }
.rooms .tag.live { background: var(--red); color: #fff; }
@media (max-width: 700px) { .popover.rooms { left: 8px; right: 8px; min-width: 0; } .rooms .room { grid-template-columns: 12px 1fr; grid-template-areas: "d n" "d t" "d c" "d v"; } }

/* account popover (click your name in the header) */
.badge.clickable { cursor: pointer; } .badge.clickable:hover { border-color: var(--muted); color: var(--text); }
.popover.mepop { min-width: 280px; } .mepop .who { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; } .mepop .who img { width: 40px; height: 40px; border-radius: 50%; } .mepop .who b { display: block; margin: 0; font-family: var(--font-display); text-transform: uppercase; font-size: 15px; } .mepop .toolbar { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- v3: translate a link, media player, listening mode ---- */
.linkcard .linkrow { display: flex; gap: 8px; flex-wrap: wrap; }
.linkcard .linkrow input { flex: 1 1 320px; min-width: 0; }
.media { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 0 6px; display: flex; flex-direction: column; gap: 6px; }
.media .frame { position: relative; width: 100%; max-width: 900px; margin: 0 auto; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.media .frame.audio { aspect-ratio: auto; background: none; }
.media .frame iframe, .media .frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media .frame audio { width: 100%; }
.media .bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; font-size: 13px; }
.media .overcap { position: absolute; left: 4%; right: 4%; bottom: 7%; text-align: center; font-size: clamp(15px, 2.6vw, 30px); line-height: 1.25; font-weight: 600; color: #fff; text-shadow: 0 0 6px #000, 0 0 3px #000; pointer-events: none; }
.media .overcap span { background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
body.withmedia .captions { max-height: none; }
.listenbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.on { outline: 2px solid var(--teal); }
.seg.speaking { color: var(--teal); }
.seg .tap { cursor: help; }
.explain { font-size: 14px; background: var(--panel2); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; font-weight: 400; line-height: 1.4; }
.ask { display: flex; gap: 8px; flex-wrap: wrap; }
.ask input { flex: 1 1 200px; min-width: 0; }
.linkcard input.btn, .ask input.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 15px; }
:root[data-theme="light"] .linkcard input.btn, :root[data-theme="light"] .ask input.btn { background: #fff; }
#listenMode { max-width: 100%; }
.listenbox { min-width: 0; max-width: 100%; }
.answer { white-space: pre-wrap; }
.seg.announce { border-left: 4px solid var(--yellow); padding-left: 10px; }
.seg.degraded { opacity: .7; font-style: italic; }
.seg.degraded::before { content: '⚠ '; font-style: normal; }

/* ---- v4: Buscar y exportar ---------------------------------------------------------------- */
.study-modal { align-items: flex-start; overflow-y: auto; }
.modal .card.study { max-width: 760px; margin: 24px auto; gap: 12px; }
.study .st-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 18px; }
.study .st-head .btn { padding: 6px 10px; }
.st-search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st-search input[type=text], .st-search #stQ { flex: 1 1 220px; min-width: 0; }
.seg2 { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg2 label { padding: 8px 12px; cursor: pointer; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.seg2 label:has(input:checked) { background: var(--teal); color: #fff; }
.seg2 input { accent-color: var(--teal); }
.st-tl { position: relative; height: 64px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.st-bars { display: flex; align-items: flex-end; gap: 1px; height: 100%; }
.st-bars i { flex: 1; background: var(--line); border-radius: 2px 2px 0 0; cursor: pointer; min-width: 1px; }
.st-bars i:hover { background: var(--muted); }
.st-bars i.hit { background: var(--red); }
.st-sel { position: absolute; top: 0; bottom: 0; background: rgba(0,172,168,.18); border-left: 2px solid var(--teal); border-right: 2px solid var(--teal); pointer-events: none; }
.st-range { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.st-range input { width: 84px; padding: 6px 8px; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
button.btn.chip { padding: 5px 10px; font-size: 12px; text-transform: none; }
.st-hits { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.st-hits p { margin: 2px 0; font-size: 13px; }
.st-hit { display: flex; gap: 10px; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); cursor: pointer; font: inherit; font-size: 14px; line-height: 1.35; }
.st-hit:hover, .st-hit:focus-visible { border-color: var(--teal); }
.st-hit .t { font-variant-numeric: tabular-nums; color: var(--teal); font-weight: 700; min-width: 48px; }
.st-hit mark, .st-preview mark { background: rgba(255,186,0,.35); color: inherit; padding: 0 2px; border-radius: 3px; }
.st-exp { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.st-exp legend { padding: 0 6px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.st-style { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st-style label { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; background: var(--panel2); }
.st-style label:has(input:checked) { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.st-style small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.st-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.st-opts label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.st-opts input { accent-color: var(--teal); width: 16px; height: 16px; }
.st-go { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st-go button:disabled { opacity: .5; cursor: wait; }
.st-info { font-size: 13px; min-height: 1em; }
.st-preview { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; line-height: 1.45; }
.st-preview h3 { margin: 0 0 4px; } .st-preview h4 { margin: 14px 0 6px; color: var(--teal); }
.st-preview .ok { color: var(--ok); font-size: 12px; } .st-preview .warn { color: var(--warn); font-size: 12px; }
.st-preview a { color: var(--teal); }
.st-term { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; overflow: hidden; }
.st-term img { float: right; max-width: 110px; max-height: 80px; margin: 0 0 6px 10px; border-radius: 6px; background: #fff; }
.st-term p { margin: 4px 0; }
@media (max-width: 560px) {
  .modal .card.study { margin: 0; padding: 12px; }
  .st-style { grid-template-columns: 1fr; }
  .st-tl { height: 52px; }
}

.study input.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 15px; }
.study input.btn:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

/* v4: home — what every room can do */
.feats { margin-top: 30px; }
.feats h2 { font-family: var(--font-display, inherit); font-size: 16px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.feats ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.feats li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.feats li span { color: var(--muted); font-size: 13px; }

/* ---- v5: accesibilidad adaptativa ------------------------------------------------------------ */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--teal); color: #fff; padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--yellow, #FFBA00); outline-offset: 2px; }
#a11yBtn.on { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.seg { font-size: calc(var(--fs) * var(--a11y-scale, 1)); line-height: var(--a11y-lh, 1.35); letter-spacing: var(--a11y-ls, normal); word-spacing: var(--a11y-ws, normal); }
body.hc .seg { font-size: calc(var(--fs) * var(--a11y-scale, 1)); }
body.a11y-font-atkinson .captions, body.a11y-font-atkinson .seg { font-family: 'Atkinson Hyperlegible', var(--font-body), sans-serif; }
body.a11y-font-lexend .captions, body.a11y-font-lexend .seg { font-family: 'Lexend', var(--font-body), sans-serif; }
body.a11y-font-serif .captions, body.a11y-font-serif .seg { font-family: Georgia, 'Times New Roman', serif; }
body.a11y-upper .seg { text-transform: uppercase; }
/* colour themes (captions area + page) */
body.a11y-themed { background: var(--bg); color: var(--text); }
body.a11y-theme-hc-yw { --bg: #000; --text: #FFE500; --muted: #f5f5f5; --line: #FFE500; }
body.a11y-theme-hc-yw .seg { color: #FFE500; } body.a11y-theme-hc-yw .seg.partial { color: #fff; opacity: 1; }
body.a11y-theme-hc-wb { --bg: #000; --text: #fff; --muted: #eee; --line: #fff; }
body.a11y-theme-hc-wb .seg { color: #fff; } body.a11y-theme-hc-wb .seg.partial { color: #9fe8ff; opacity: 1; }
body.a11y-theme-hc-bw { --bg: #fff; --text: #000; --muted: #222; --panel: #fff; --panel2: #f2f2f2; --line: #000; }
body.a11y-theme-hc-bw .seg { color: #000; } body.a11y-theme-hc-bw .seg.partial { color: #0033a0; opacity: 1; }
body.a11y-theme-blue { --bg: #0b2a6f; --text: #fff; --muted: #dfe7ff; --line: #8fb0ff; }
body.a11y-theme-blue .seg { color: #fff; } body.a11y-theme-blue .seg.partial { color: #ffe27a; opacity: 1; }
body.a11y-theme-sepia { --bg: #f4ecd8; --text: #3b2f1e; --muted: #5b4a33; --panel: #fbf6ea; --panel2: #efe4ca; --line: #cdbb94; }
body.a11y-theme-sepia .seg { color: #3b2f1e; } body.a11y-theme-sepia .seg.partial { color: #7a4b00; opacity: 1; }
body.a11y-theme-cvd { --red: #D55E00; --teal: #0072B2; --yellow: #E69F00; --accent: #0072B2; }
body.a11y-theme-cvd .seg.partial { color: #56B4E9; }
body.a11y-theme-hc-bw header.top, body.a11y-theme-sepia header.top { background: var(--panel); color: var(--text); }
body.a11y-box .seg { background: rgba(0,0,0,.86); color: #fff; padding: .15em .45em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
body.a11y-box.a11y-theme-hc-yw .seg { color: #FFE500; }
body.a11y-box.a11y-theme-hc-bw .seg, body.a11y-box.a11y-theme-sepia .seg { background: rgba(255,255,255,.92); color: #000; }
body.a11y-outline .seg { text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 0 6px #000; }
body.a11y-outline.a11y-theme-hc-bw .seg, body.a11y-outline.a11y-theme-sepia .seg { text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff; }
/* how many lines stay on screen */
body.a11y-lines-1 .captions > .seg:not(:nth-last-child(-n+1)),
body.a11y-lines-2 .captions > .seg:not(:nth-last-child(-n+2)),
body.a11y-lines-3 .captions > .seg:not(:nth-last-child(-n+3)),
body.a11y-lines-4 .captions > .seg:not(:nth-last-child(-n+4)),
body.a11y-lines-6 .captions > .seg:not(:nth-last-child(-n+6)) { display: none; }
body.hc.a11y-lines-1 .seg, body.hc.a11y-lines-2 .seg, body.hc.a11y-lines-3 .seg { opacity: 1; }
/* one sentence at a time, big and centred */
body.a11y-focus .captions { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; text-align: center; padding-bottom: 8vh; }
body.a11y-focus .seg { font-size: calc(var(--fs) * var(--a11y-scale, 1) * 1.35); }
/* big touch targets (WCAG 2.5.5) */
body.a11y-big button.btn, body.a11y-big select.btn, body.a11y-big input.btn, body.a11y-big a.btn, body.a11y-big .badge.clickable { min-height: 48px; min-width: 48px; font-size: 17px; }
body.a11y-big .a11y-chk input, body.a11y-big .st-opts input { width: 24px; height: 24px; }
/* reduced motion: from the system or chosen here */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
body.a11y-reduce *, body.a11y-reduce *::before, body.a11y-reduce *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
/* visual alerts */
body.a11y-flash::after, body.a11y-flash-strong::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 90; border: 8px solid var(--yellow, #FFBA00); animation: a11yflash .9s ease-out forwards; }
body.a11y-flash-strong::after { border-width: 16px; border-color: var(--red, #FF323C); background: rgba(255,50,60,.12); }
body.a11y-reduce.a11y-flash::after, body.a11y-reduce.a11y-flash-strong::after { animation: none; opacity: .9; }
@keyframes a11yflash { from { opacity: 1; } to { opacity: 0; } }
.talk-badge { position: fixed; left: 12px; bottom: 12px; z-index: 45; background: var(--teal); color: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
body.is-talking .talk-badge { opacity: 1; transform: none; }
/* magnifier lens */
.lens { position: fixed; z-index: 80; border-radius: 50%; overflow: hidden; border: 4px solid var(--yellow, #FFBA00); box-shadow: 0 8px 30px rgba(0,0,0,.6); background: var(--bg, #000); pointer-events: none; }
.lens-inner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.lens-inner .captions { padding: 0; }
/* sign-language interpreter & avatar windows */
.signwin { position: fixed; z-index: 60; width: 300px; background: #000; border: 2px solid var(--teal); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.6); color: #fff; }
.signwin .sw-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 4px 10px; background: var(--panel2, #1a1a1a); cursor: move; touch-action: none; font-size: 13px; }
.signwin .sw-tools { display: flex; gap: 4px; }
.signwin .sw-tools .btn { padding: 4px 8px; font-size: 13px; }
.signwin .sw-body { position: relative; aspect-ratio: 3 / 4; background: #000; }
.signwin iframe, .signwin video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.signwin .sw-empty { padding: 14px; font-size: 14px; line-height: 1.4; color: #eee; }
.signwin .sw-open { position: absolute; bottom: 6px; left: 6px; right: 6px; text-align: center; font-size: 12px; color: #9fe8ff; background: rgba(0,0,0,.7); padding: 4px; border-radius: 6px; }
.avatarwin { left: 12px; top: 76px; }
.avatarwin .sw-body { aspect-ratio: 1; }
/* panel */
.a11y-card { max-width: 720px; }
.a11y-lead { margin: 0; font-size: 14px; }
.a11y-profiles { display: flex; flex-wrap: wrap; gap: 6px; }
.a11y-profiles .btn.chip { font-size: 14px; padding: 8px 12px; }
.a11y-profiles .btn.chip.on { border-color: var(--teal); background: rgba(0,172,168,.18); }
.a11y-row { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; align-items: center; padding: 4px 0; }
.a11y-row .a11y-lab { color: var(--muted); font-size: 14px; }
.a11y-row small { grid-column: 2; }
.a11y-ctl { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.a11y-ctl input[type=range] { width: min(260px, 60vw); accent-color: var(--teal); }
.a11y-chk { display: inline-flex; gap: 8px; align-items: center; font-size: 15px; cursor: pointer; }
.a11y-chk input { accent-color: var(--teal); width: 18px; height: 18px; }
.a11y-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.a11y-swatches .sw { display: flex; gap: 8px; align-items: center; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.a11y-swatches .sw:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.a11y-swatches .sw-hc-yw { background: #000; color: #FFE500; } .a11y-swatches .sw-hc-wb { background: #000; color: #fff; }
.a11y-swatches .sw-hc-bw { background: #fff; color: #000; } .a11y-swatches .sw-blue { background: #0b2a6f; color: #fff; }
.a11y-swatches .sw-sepia { background: #f4ecd8; color: #3b2f1e; } .a11y-swatches .sw-cvd { background: #111; color: #56B4E9; }
.a11y-keys ul, .a11y-os ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.7; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .9em; font-family: inherit; }
@media (max-width: 560px) { .a11y-row { grid-template-columns: 1fr; } .a11y-row small { grid-column: 1; } .signwin { width: 200px; } }
/* Windows contrast themes / forced colours: use the system palette, keep every control outlined */
@media (forced-colors: active) {
  .seg, .seg.partial { color: CanvasText !important; background: Canvas !important; text-shadow: none !important; forced-color-adjust: auto; }
  .btn, .badge, .signwin, .card, .st-hit, .a11y-swatches .sw { border: 2px solid ButtonText !important; }
  .talk-badge { background: Highlight; color: HighlightText; }
  .lens { border-color: Highlight; }
  :focus-visible { outline: 3px solid Highlight; }
  .brandbar, body.a11y-flash::after, body.a11y-flash-strong::after { border-color: Highlight; }
}
@media (prefers-contrast: more) { .seg .orig, .muted { color: var(--text) !important; } .btn { border-width: 2px; } }

/* v5: study export — class picker, 4 export types */
.st-class { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.st-class select { max-width: min(520px, 80vw); }
.st-style4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .st-style4 { grid-template-columns: 1fr 1fr; } }
.st-hit .t small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
/* v5: contrast fixes found by axe for every colour theme */
.talk-badge { background: #006f6c; }
body.a11y-theme-hc-bw .logo .l2, body.a11y-theme-sepia .logo .l2 { color: #7a5200; }
body.a11y-theme-hc-bw .logo .l3, body.a11y-theme-sepia .logo .l3 { color: #005f5c; }
body.a11y-theme-hc-bw .talkline, body.a11y-theme-sepia .talkline, body.a11y-theme-hc-bw .talkline .cd, body.a11y-theme-sepia .talkline .cd { color: #5c3d00; }
body.a11y-theme-cvd .cd, body.a11y-theme-cvd .talkline .cd { color: #56B4E9; }
body.a11y-theme-hc-bw header.top .sub .talkline, body.a11y-theme-sepia header.top .sub .talkline, body.a11y-theme-hc-bw header.top .sub .talkline .cd, body.a11y-theme-sepia header.top .sub .talkline .cd { color: #4a3000; }

/* v6: pilot feedback survey */
.fb-card { max-width: 520px; display: flex; flex-direction: column; gap: 10px; }
.fb-card fieldset { border: 1px solid var(--line, #333); border-radius: 10px; padding: 8px 10px; margin: 0; }
.fb-card legend { padding: 0 4px; font-weight: 600; }
.fb-stars { display: flex; gap: 4px; }
.fb-stars label { cursor: pointer; font-size: 30px; line-height: 1; color: #777; }
.fb-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fb-stars label:has(input:checked), .fb-stars label:has(~ label input:checked) { color: #FFB400; }
.fb-stars label:has(input:focus-visible) { outline: 3px solid var(--teal, #00ACA8); border-radius: 6px; }
.fb-stars .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fb-used { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.fb-again { display: flex; gap: 16px; }
.fb-comment textarea { width: 100%; box-sizing: border-box; margin-top: 4px; border-radius: 8px; padding: 8px; font: inherit; background: var(--panel2, #1a1a1a); color: inherit; border: 1px solid var(--line, #333); }
