/* Standalone interface: rem units use the browser's accessible 16px baseline. */
:root {
  color-scheme: light;
  /* Los mismos colores y letras que Contexta (frontend/actualidad/chatbot.css): son de la misma familia. */
  --bg-main: #fff;
  --bg-subtle: #f3f3f3;
  --bg-hover: #ebebeb;
  --surface: #fff;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #666;
  --text-soft: #4d4d4d;
  --heading: #393637;
  --reading-width: 680px; /* la columna de lectura de Contexta */
  --border-color: #ccc;
  --border-subtle: #e6e6e6;
  --border-field: #b3b3b3;
  --border-button: #999;
  --accent: #b24400;
  --accent-bright: #d25000;
  --accent-soft: #fbefe8;
  --font-body: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Noto Serif', Georgia, serif;
  --font-header: 'Noto Serif', Georgia, serif;
  --party-pp: #2563b0;
  --party-psoe: #c71c29;
  --party-vox: #417d16;
  --party-podemos: #713887;
  --party-chunta: #077783;
  --party-par: #986209;
  --party-teruel-existe: #526475;
  --party-iu-sumar: #a52a64;
}
* { box-sizing: border-box; }
html { height: 100%; font-size: 100%; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-main); color: var(--text-primary); font: 400 16px/1.6 var(--font-body); }
button, input, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button, a, summary, [contenteditable] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* La conversación solo es enfocable para desplazarla con el teclado; su contorno cruzaba la página. */
.container:focus-visible { outline: none; }
button { -webkit-appearance: none; appearance: none; }
[hidden], .ghost, .useful.ghost { display: none !important; }
.sr-only, legend.ghost { display: block !important; position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 1; }
svg { width: 24px; height: 24px; flex-shrink: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 10; padding: 10px 18px; background: white; }
.skip-link:focus { top: 10px; }

/* Masthead and the scrollable conversation share the same reading axis. */
/* Cabecera: «Comparador de programas electorales» firmado «una herramienta de contexta rtve», la «i», «Nueva conversación»
   y «Todos los programas». */
.masthead { display: flex; align-items: center; gap: 20px; width: min(1200px, calc(100% - 80px)); margin: 0 auto; min-height: 76px; padding: 16px 0; flex-shrink: 0; border-bottom: 1px solid var(--border-subtle); }
.masthead__brand { min-width: 0; }
.masthead__title { margin: 0; font: 400 28px/1.3 var(--font-body); color: var(--heading); } /* titular y firma en Roboto */
.masthead__endorsement { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 0; font: 400 14px/1.4 var(--font-body); color: var(--text-secondary); white-space: nowrap; } /* sin sitio, baja «BETA», no el texto */
.masthead__endorsement img { width: auto; height: 18px; }
/* En la conversación, aire entre el nombre y la firma de Contexta. */
.has-conversation .masthead__endorsement { margin-top: 8px; }
/* «BETA» lo pinta el CSS, como en Contexta: fuera del texto de la página y como superíndice, alineado
   con el borde superior del logo. En la cabecera compacta (logo de 16-18 px) es más pequeño para que
   siga quedando arriba; en la portada, del tamaño de Contexta. */
.masthead__endorsement::after { content: "BETA"; align-self: flex-start; padding: 2px 4px 1px; border: 1px solid var(--border-color); border-radius: 4px; font: 600 9px/1 var(--font-body); letter-spacing: .08em; color: var(--text-secondary); }
/* Portada (Figma «Chatbot - Elecciones»): la firma grande y centrada, la «i» arriba a la derecha y sin
   enlaces; al preguntar, la compacta, como Contexta. En móvil, la compacta en las dos. */
body:not(.has-conversation) .masthead__actions, body:not(.has-conversation) .programs-toggle, body:not(.has-conversation) .programs-panel { display: none; }
@media (min-width: 601px) {
  body:not(.has-conversation) .masthead { position: relative; justify-content: center; width: min(1228px, calc(100% - 48px)); padding: 48px 56px 0; border-bottom: 0; }
  body:not(.has-conversation) .masthead__brand { text-align: center; }
  body:not(.has-conversation) .masthead__title { font: 400 clamp(32px, 3.8vw, 44px)/1.2 var(--font-body); letter-spacing: -.02em; color: var(--text-primary); }
  body:not(.has-conversation) .masthead__endorsement { justify-content: center; gap: 8px; margin-top: 6px; font-size: 18px; }
  body:not(.has-conversation) .masthead__endorsement img { height: 36px; }
  body:not(.has-conversation) .masthead__endorsement::after { padding: 4px 6px 3px; font-size: 11px; }
  body:not(.has-conversation) .info-button { position: absolute; top: 48px; right: 0; }
  /* Conversación: cabecera compacta en una fila, como la de Contexta: la firma pequeña con la «i» al lado y,
     a la derecha, «Nueva conversación» y «Todos los programas», que despliega las tarjetas a todo el ancho. */
  .has-conversation .masthead { display: grid; grid-template-columns: minmax(0, max-content) auto 1fr auto auto; grid-template-areas: "brand info . actions programs"; gap: 0 16px; align-items: center; width: min(1228px, calc(100% - 48px)); padding: 12px 0; }
  .has-conversation .masthead__brand { grid-area: brand; }
  /* La «i» del tamaño de «2026» (24 px: el mínimo de WCAG 2.5.8 para pulsar) y en la línea del título, no
     centrada en el bloque del título y la firma. */
  .has-conversation .info-button { grid-area: info; align-self: start; width: 24px; height: 24px; margin-top: 5px; }
  .has-conversation .info-button img { width: 16px; height: 16px; }
  .has-conversation .masthead__actions { grid-area: actions; white-space: nowrap; }
  .has-conversation .programs-toggle { grid-area: programs; white-space: nowrap; }
  .has-conversation .programs-panel { grid-column: 1 / -1; } /* fila propia solo cuando se abre: cerrada no deja hueco */
}
/* Si no cabe todo en una fila sin partir el título, dos filas como en móvil: la firma y la «i»; debajo, a la
   derecha, «Nueva conversación» y «Programas». */
@media (min-width: 601px) and (max-width: 1053px) {
  .has-conversation .masthead { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand brand info" ". actions programs"; row-gap: 8px; }
  .has-conversation .info-button { justify-self: end; }
}
.programs-toggle { min-height: 41px; display: inline-flex; align-items: center; gap: 20px; padding: 10px; border: 0; border-radius: 4px; background: none; font: 500 18px/1.2 var(--font-body); color: var(--text-primary); }
.programs-toggle:hover { color: var(--accent); }
.programs-toggle img { transform: rotate(-90deg); transition: transform .15s; } /* arrow_back_ios del Figma, hacia abajo */
.programs-toggle[aria-expanded='true'] img { transform: rotate(90deg); }
.programs-toggle__short { display: none; }
/* «Programas» donde «Todos los programas» no deja el título en una línea (y en móvil). */
@media (max-width: 1134px) {
  .programs-toggle__long { display: none; }
  .programs-toggle__short { display: inline; }
}
/* Con los logos pequeños el muro abierto cabe entero en escritorio (40 partidos, tres filas): sin
   desplazamiento propio, que recortaría el nombre emergente de la primera fila. En móvil sí (abajo). */
.programs-panel { flex: 1 0 100%; padding-top: 15px; }
.masthead__actions { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-shrink: 0; } /* el título largo es el que se parte, no los botones */
.text-button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 10px 4px; font-size: 13px; font-weight: 500; }
.text-button > span { font-size: 23px; font-weight: 400; line-height: 1; }
.text-button:hover:not(:disabled) { color: var(--accent); }
.text-button:disabled { opacity: .45; }
.info-button { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: 1px solid var(--border-color); border-radius: 50%; background: var(--surface); }
.info-button:hover { border-color: var(--border-button); background: var(--bg-subtle); }
.outline-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px 10px 16px; border: 1px solid var(--text-primary); border-radius: 22px; background: var(--surface); font: 500 18px/1.2 var(--font-body); color: var(--text-primary); }
.outline-button:hover:not(:disabled) { background: var(--bg-subtle); }
.outline-button:disabled { opacity: .45; }
.outline-button img { width: 20px; height: 20px; flex-shrink: 0; }
/* Como en Contexta: «Nueva conversación» solo cuando hay una conversación que empezar de nuevo. */
body:not(.has-conversation) #new-chat { display: none; }
.mainbodier { min-height: 0; flex: 1; display: flex; flex-direction: column; width: 100%; }
.container { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: #c9c9bf transparent; scroll-padding: 24px; padding: 0 max(24px, calc((100% - 1228px) / 2)); }
/* 61 px: el aviso, el campo y el carrusel quedan a la altura de los de Contexta (su logo mide unos 29 px más
   que el título de 44 px y la firma de aquí). */
.welcome { padding: 61px 0 28px; animation: welcome-in .55s ease-out both; }
/* Aviso de herramienta experimental encima del campo: el de Contexta (.news-experimental), con sus medidas.
   Va dentro de .questionBox, que el campo se lleva al bajar en la conversación: allí no se muestra. */
.experimental-notice { max-width: 640px; margin: 0 auto 30px; font: 300 14px/20px var(--font-body); color: var(--text-secondary); text-align: center; text-wrap: balance; }
.has-conversation .experimental-notice { display: none; }
.eyebrow { display: flex; gap: 10px; align-items: center; font-size: 10px; font-weight: 600; letter-spacing: 1.8px; line-height: 1.6; }
.eyebrow__line { width: 24px; height: 2px; background: var(--accent-bright); }

/* Editorial questions remain driven by suggested_questions.json. */
/* «Para empezar a preguntar» (Figma): carrusel de tarjetas con flechas; en móvil se desliza. */
/* Medidas de Contexta: 56 px del campo al título y del título a las tarjetas. */
.slideBox { margin-top: 56px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font: 400 30px/36px var(--font-display); color: #000; }
/* «Para empezar a preguntar» y «Todos los programas», en Roboto Light 200 (fonts.css la declara). */
:is(.slideBox, .programs) .section-heading h2 { font-family: var(--font-body); font-weight: 200; }
.selecBox { display: flex; align-items: center; gap: 20px; padding: 0; }
.slideOptions { flex: 1; min-width: 0; }
.slideOptions ul { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 0; margin: 0; list-style: none; }
.slideOptions ul::-webkit-scrollbar { display: none; }
/* Tarjetas de 250 px con la pregunta en 20/30, como las de Contexta (sin su foto). */
.slideOptions li { flex: 0 0 min(250px, 82%); min-width: 0; scroll-snap-align: start; }
.slideOptions li > button { position: relative; width: 100%; height: 100%; min-height: 148px; padding: 16px 16px 58px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--surface); text-align: left; font: 300 20px/30px var(--font-body); color: var(--text-soft); transition: border-color .15s; }
.slideOptions li > button::after { content: ''; position: absolute; right: 16px; bottom: 16px; width: 32px; height: 32px; background: url(assets/icons/arrow-forward.svg) center / 32px no-repeat; }
/* Bolitas bajo el carrusel, como las de Contexta (.news-dot): 8 px; la actual, 10 px y naranja. */
.carousel-dots { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 22px 0 24px; }
.carousel-dots[hidden] { display: none; }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: #d9d9d9; cursor: pointer; }
.carousel-dot.is-active { width: 10px; height: 10px; background: var(--accent-bright); }
/* El carrusel recorta lo que sobresale: el contorno de foco va por dentro. */
.slideOptions li > button:focus-visible { outline-offset: -2px; }
.slideOptions strong { font-weight: 500; color: var(--text-primary); }
.slideOptions button:hover { border-color: var(--text-primary); }
.slide-arrow { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: 0; background: none; }
.slide-arrow img { width: 40px; height: 40px; }
.slide-arrow--next img { transform: scaleX(-1); }
/* Desactivada, la flecha del Figma al 50 %. */
.slide-arrow:disabled img { opacity: .5; }
/* Avance continuo, como Contexta (functions.js): sin encaje por tarjeta mientras se mueve (el navegador
   la recolocaría a cada paso) y con las copias que dan la vuelta solo si las preguntas no caben. */
.slideOptions ul.is-looping { scroll-snap-type: none; }
.slideOptions ul:not(.is-looping) .is-clone { display: none; }
/* Pausa del carrusel (WCAG 2.2.2), el botón de Contexta: dos barras, o un triángulo si está en pausa. */
.carousel-pause { width: 32px; height: 32px; flex-shrink: 0; align-self: center; display: grid; place-items: center; padding: 0; border: 1px solid var(--border-color); border-radius: 50%; background: var(--surface); }
.carousel-pause[hidden] { display: none; }
.carousel-pause:hover { border-color: var(--text-primary); }
.carousel-pause span { width: 10px; height: 12px; border-right: 3px solid var(--text-primary); border-left: 3px solid var(--text-primary); }
.carousel-pause[aria-pressed='true'] span { width: 0; height: 0; margin-left: 3px; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--text-primary); }
/* «Todos los programas»: solo el logo, de 107 px (un 25 % menos que los 143 de antes). 8 por fila: la primera
   va del borde de la flecha izquierda del carrusel al de la derecha (el hueco entre logos crece hasta llenar el
   ancho: unos 53 px en 1228) y la segunda, con el mismo hueco, centrada: cada logo en la mitad de dos de
   arriba; 24 px entre filas. Con menos de 12 px de hueco no caben 8: los que quepan, cada fila centrada. El
   nombre sale al pasar el ratón o al llegar con el teclado (siempre lo lee el lector de pantalla); sin
   programa, en gris. */
.programs { margin-top: 10px; }
.programs .section-heading { margin-bottom: 30px; }
.programs__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px max(12px, calc((100% - 8 * 107px) / 7 - .2px)); margin: 0; padding: 0; list-style: none; }
.programs__list > li { flex: 0 0 107px; min-width: 0; }
.party-program { position: relative; display: block; border-radius: 8px; color: var(--text-primary); text-decoration: none; }
.party-program__logo { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
/* Frente Amplio y Podemos llevan el logo dentro de un span. */
.party-program__logo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
a.party-program:hover .party-program__logo { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.party-program.is-pending .party-program__logo { filter: grayscale(1); opacity: .4; }
/* El verde azulado de Ara Més es mucho más oscuro que los colores de Junts y UPC: en gris saldría más oscuro.
   Se aclara para que quede del mismo gris que Junts (el logo conserva su color para cuando tenga programa). */
.party-program.is-pending .party-program__logo--ara-mes { filter: grayscale(1) brightness(1.98); }
.party-program__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Centrado sobre el logo; en la primera o la última columna, functions.js lo desplaza hacia dentro
   (--tip-shift) para que no se salga de la pantalla. */
.party-program:is(:hover, :focus-visible, .is-pending:focus) .party-program__name { z-index: 3; bottom: calc(100% + 8px); left: 50%; transform: translateX(calc(-50% + var(--tip-shift, 0px))); width: auto; height: auto; overflow: visible; clip-path: none; padding: 6px 10px; border-radius: 4px; background: var(--text-primary); font: 400 13px/16px var(--font-body); color: #fff; pointer-events: none; }
/* En pantallas táctiles, los logos en gris se tratan como pulsables: así Safari en iPhone muestra su nombre al tocarlos. */
@media (hover: none) { .party-program.is-pending { cursor: pointer; } }
.party-program__note { text-transform: lowercase; }
.party-program__note::before { content: ' · programa '; }
.suggestion-selected > button { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.controlBox { display: none; }
.has-conversation .welcome { display: none; }
/* Conversación en la columna de lectura de Contexta (680 px). */
.has-conversation .container { padding-inline: max(24px, calc((100% - var(--reading-width)) / 2)); }
.has-conversation .questionBox { max-width: var(--reading-width); }
.myDialogue:empty { display: none; }
.myDialogue { padding: 0 0 24px; }

/* The reader and electoral workspace keep independent conversation state. */
body:not([data-workspace='elections']) .electoral-workspace,
body:not([data-workspace='elections']) #new-chat,
body:not([data-workspace='reader']) .reader-workspace,
body:not([data-workspace='reader']) #reader-reset,
body:not([data-workspace='news']) .news-workspace,
body:not([data-workspace='news']) #news-reset { display: none !important; }
/* Current affairs: questions first, with an editorial reading measure. */
.news-workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.news-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; padding: 0 max(24px, calc((100% - 1040px) / 2)); scroll-padding: 24px; }
.news-welcome { padding: 30px 0 32px; animation: welcome-in .4s ease-out both; }
.news-intro { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; align-items: center; }
.news-intro h1 { font: 400 clamp(36px, 4vw, 54px)/1.08 var(--font-display); letter-spacing: -1.5px; margin: 0; }
.news-intro h1 em { color: var(--accent); }
.news-intro > p { max-width: 36ch; color: var(--text-secondary); font-size: 15px; line-height: 1.75; margin: 0; }
.news-topics { margin-top: 32px; }
.news-topics .section-heading { border-top: 1px solid var(--border-color); padding-top: 14px; margin-bottom: 0; align-items: center; }
.news-topics .section-heading h2 { font-size: 16px; font-weight: 600; }
.news-topics .text-button { font-size: 13px; flex-shrink: 0; }
.news-topics .text-button svg { width: 18px; height: 18px; }
#news-feed-status { font-size: 12px; color: var(--text-secondary); margin: 4px 0 18px; }
.news-suggestions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 32px; min-height: 120px; }
.news-suggestions[aria-busy='true']:empty { background: repeating-linear-gradient(0deg, transparent 0 58px, var(--border-subtle) 58px 59px, transparent 59px 120px); }
.news-suggestion { min-width: 0; position: relative; display: grid; grid-template-columns: minmax(0,1fr) 24px; align-content: center; gap: 10px 20px; padding: 20px 12px 20px 0; text-align: left; border: 0; border-top: 1px solid var(--border-color); background: transparent; transition: background .15s; }
.news-suggestion:hover:not(:disabled) { background: var(--accent-soft); }
.news-suggestion:hover:not(:disabled) strong { color: var(--accent); }
.news-suggestion strong { font-size: 17px; font-weight: 500; line-height: 1.5; }
.news-suggestion > svg { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--accent); width: 20px; height: 20px; }
.news-suggestion__source { grid-column: 1; font-size: 12px; color: var(--text-secondary); }
.news-composer { flex-shrink: 0; width: min(var(--reading-width), calc(100% - 48px)); margin: auto auto 0; padding-top: 12px; }
#news-question-form { display: flex; align-items: flex-end; gap: 12px; border: 1px solid #bfc1b4; border-radius: 13px; padding: 10px; background: white; box-shadow: 0 4px 16px #24262006; }
#news-question-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #ed641d16; }
#news-question { flex: 1; min-width: 0; min-height: 44px; max-height: 150px; border: 0; outline: none; background: none; padding: 9px 10px; resize: vertical; font-size: 16px; line-height: 1.6; }
#news-send { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 8px; color: white; background: var(--accent); }
#news-send:hover:not(:disabled) { background: #953500; }
#news-send:disabled { background: var(--bg-subtle); color: var(--text-muted); }
.news-composer__meta { display: flex; justify-content: space-between; gap: 16px; color: var(--text-secondary); font-size: 12px; padding: 8px 3px 0; }
#news-count { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.current-turn { max-width: var(--reading-width); margin: 0 auto; padding: 28px 0; border-bottom: 1px solid var(--border-color); overflow-wrap: anywhere; }
.current-turn:last-child { border-bottom: 0; }
.current-citation { display: inline-block; font: 600 12px var(--font-body); color: var(--accent); background: var(--accent-soft); padding: 6px 9px; border-radius: 5px; text-decoration: none; vertical-align: baseline; }
.current-citation:hover { text-decoration: underline; }
.current-sources { margin-top: 32px; }
.current-sources h3, .current-followups h3 { font-size: 15px; font-weight: 600; margin: 0 0 16px; }
.current-sources__grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.current-source { min-width: 0; display: flex; flex-direction: column; }
.current-source__link { display: flex; flex-direction: column; flex: 1; border: 1px solid var(--border-color); border-radius: 9px 9px 0 0; overflow: hidden; background: var(--surface); text-decoration: none; }
.current-source__link:hover strong { text-decoration: underline; text-decoration-thickness: 1px; }
.current-source__link > img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--bg-subtle); }
.current-source__body { padding: 18px; }
.current-source__meta { display: block; color: var(--text-secondary); font-size: 12px; margin-bottom: 10px; }
.current-source__body > strong { font: 500 23px/1.25 var(--font-display); }
.current-followups { margin-top: 32px; }
.current-followups > button { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; min-height: 44px; padding: 14px 0; text-align: left; border: 0; border-bottom: 1px solid var(--border-color); background: none; font-size: 15px; }
.current-followups > button svg { color: var(--accent); width: 20px; height: 20px; }
.current-followups > button:hover:not(:disabled) { color: var(--accent); }
.current-turn[aria-busy='true'] .answerText { color: var(--text-secondary); }
@media (max-width: 720px) {
  .news-welcome { padding-top: 20px; }
  .news-intro { grid-template-columns: 1fr; gap: 16px; }
  .news-intro > p { max-width: 48ch; font-size: 14px; }
  .news-topics { margin-top: 24px; }
  .news-suggestions { grid-template-columns: 1fr; }
  .news-suggestion { padding-block: 18px; }
  .news-suggestion strong { font-size: 16px; }
  .news-topics .section-heading h2 { font-size: 14px; }
  .news-topics .text-button { font-size: 12px; gap: 5px; }
  .news-composer { width: calc(100% - 32px); }
  .news-scroll { padding-inline: 16px; }
  .current-sources__grid { grid-template-columns: 1fr; }
  .news-composer__meta { font-size: 12px; gap: 8px; }
}
.reader-workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); flex: 1; min-height: 0; width: min(1200px, calc(100% - 80px)); margin: 0 auto; border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; background: var(--surface); }
.reader-source { min-height: 0; overflow-y: auto; padding: 26px; border-right: 1px solid var(--border-color); background: linear-gradient(160deg, #f2f0e7, #f8f7f3 65%); scrollbar-width: thin; }
.reader-source h2 { font: 400 27px/1.15 var(--font-display); letter-spacing: -.5px; margin: 0 0 24px; }
.reader-source.is-loaded h2, .reader-source.is-loaded #article-help { display: none; }
.reader-source.is-loaded #article-form { margin-top: 18px; }
#article-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.article-url-field { display: grid; gap: 9px; }
#article-url { width: 100%; min-width: 0; border: 1px solid #bfc1b4; border-radius: 7px; font-size: 16px; min-height: 44px; padding: 11px 12px; background: white; }
#article-load { border: 0; border-radius: 7px; background: var(--accent); color: white; min-height: 44px; padding: 12px 16px; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; text-align: left; }
#article-load:hover:not(:disabled) { background: #953500; }
#article-load:disabled { opacity: .65; }
#article-help, .reader-source__footnote { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.reader-error { color: #9d2929; font-size: 14px; line-height: 1.6; }
.reader-explore { min-height: 44px; display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; text-decoration: none; border-top: 1px solid var(--border-color); padding-top: 18px; margin-top: 24px; }
.reader-source__footnote { margin: 14px 0 0; }
.article-preview { border-top: 1px solid var(--border-color); margin-top: 24px; padding-top: 24px; overflow-wrap: anywhere; }
.article-preview__image { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; display: block; margin-bottom: 18px; }
.article-preview h3 { font: 500 24px/1.2 var(--font-display); margin: 12px 0; letter-spacing: -.3px; }
.article-preview__snippet { font-size: 14px; color: var(--text-secondary); }
.article-preview__link { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--accent); }
.reader-conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 38px 46px; scroll-padding: 28px; scrollbar-width: thin; }
.reader-welcome { animation: welcome-in .5s ease-out; }
.reader-welcome h1 { font: 400 clamp(34px, 3.6vw, 48px)/1.07 var(--font-display); letter-spacing: -1.8px; margin: 0 0 22px; }
.reader-welcome h1 em { color: var(--accent); }
.reader-welcome > p:not(.eyebrow) { font-size: 14px; color: var(--text-secondary); line-height: 1.8; max-width: 490px; }
.reader-possibilities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 34px 0 26px; border-top: 1px solid var(--border-color); padding-top: 22px; }
.reader-possibilities strong { font-size: 14px; font-weight: 600; }
.reader-possibilities p { font-size: 13px; color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }
.reader-welcome .reader-scope-note { font-size: 13px; border-left: 2px solid var(--border-color); padding-left: 12px; }
.reader-composer { flex-shrink: 0; border-top: 1px solid var(--border-subtle); padding: 16px 24px 10px; background: #fdfdfb; }
.reader-prompts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.reader-prompts button { border: 1px solid var(--border-color); background: transparent; border-radius: 6px; min-height: 44px; padding: 8px 11px; font-size: 13px; }
.reader-prompts button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.reader-prompts button:disabled { opacity: .5; }
#reader-question-form { display: flex; gap: 12px; border: 1px solid var(--border-color); border-radius: 10px; padding: 10px; background: white; align-items: flex-end; }
#reader-question-form:focus-within { border-color: var(--accent); }
#reader-question { flex: 1; width: 100%; min-width: 0; min-height: 40px; max-height: 140px; padding: 10px 6px; resize: vertical; border: 0; background: none; outline: none; font-size: 16px; line-height: 1.5; }
#reader-send { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 7px; background: var(--accent); color: white; font-size: 24px; }
#reader-send:disabled { background: var(--bg-subtle); color: var(--text-muted); }
#reader-status { color: var(--text-secondary); font-size: 12px; margin: 8px 4px 0; }
.reader-turn { border-bottom: 1px solid var(--border-subtle); padding-bottom: 24px; margin-bottom: 30px; overflow-wrap: anywhere; }
.reader-turn:last-child { border-bottom: 0; margin-bottom: 0; }
.reader-turn__question { background: var(--bg-subtle); padding: 12px 18px; border-radius: 12px 12px 2px 12px; margin: 0 0 24px auto; width: fit-content; max-width: 90%; font-size: 16px; }
.reader-turn__source { display: inline-block; min-height: 44px; font-size: 13px; margin-top: 18px; color: var(--accent); }
.reader-turn[aria-busy='true'] .answerText { color: var(--text-secondary); }
@media (max-width: 1000px) {
  .reader-workspace { grid-template-columns: 290px minmax(0, 1fr); }
  .reader-scroll { padding: 28px; }
  .reader-source { padding: 22px; }
}
@media (max-width: 720px) {
  .reader-workspace { display: block; width: calc(100% - 32px); overflow-y: auto; scrollbar-width: thin; }
  .reader-source { overflow: visible; border-right: 0; border-bottom: 1px solid var(--border-color); }
  .reader-source h2 { margin: 12px 0 18px; }
  .article-url-field { grid-template-columns: minmax(0, 1fr) auto; }
  #article-load { padding: 10px; white-space: nowrap; font-size: 13px; }
  .reader-source__footnote { display: none; }
  .reader-explore { margin-top: 14px; padding-top: 12px; }
  .article-preview__image { max-height: 180px; }
  .reader-scroll { padding: 26px 22px; max-height: 65dvh; flex: auto; }
  .reader-composer { padding: 14px 16px; }
  .reader-welcome h1 { margin-top: 20px; }
  .reader-possibilities { grid-template-columns: 1fr; gap: 16px; margin-block: 22px; }
  .reader-possibilities p { margin: 2px 0 0; }
}

/* Composer is a flex sibling, so it never covers the answer or mobile keyboard. */
.questionBox { flex-shrink: 0; width: min(1040px, calc(100% - 48px)); margin: 0 auto; padding-top: 16px; background: var(--bg-main); }
/* En la portada el campo va bajo la firma, como en Contexta (setConversation lo mueve abajo al preguntar);
   mide lo mismo que en la conversación, así no cambia de ancho al preguntar. */
.welcome .questionBox { width: auto; max-width: var(--reading-width); margin: 0 auto; padding: 0; background: none; }
.welcome .ai-disclaimer { display: none; } /* como en Contexta: el aviso de IA, solo en la conversación */
/* Campo en píldora con el botón de enviar circular. */
.questionBox form { border: 1px solid var(--border-field); border-radius: 34px; background: var(--surface); box-shadow: 0 4px 16px rgba(0, 0, 0, .06); transition: border-color .15s, box-shadow .15s; }
.questionBox form:focus-within { border-color: var(--accent-bright); box-shadow: 0 0 0 3px rgba(210, 80, 0, .18); }
fieldset.question { display: flex; align-items: flex-end; gap: 12px; min-height: 68px; border: 0; margin: 0; padding: 10px 10px 10px 28px; }
.wrapper-input { flex: 1; min-width: 0; display: flex; align-items: center; }
#question { width: 100%; min-height: 44px; max-height: 150px; overflow-y: auto; padding: 7px 0; font: 300 22px/30px var(--font-body); overflow-wrap: anywhere; white-space: pre-wrap; outline: none; }
#question:empty::before { content: attr(data-placeholder); pointer-events: none; color: var(--text-muted); }
.stop { display: grid; place-items: center; border: 0; background: none; color: var(--text-muted); width: 40px; height: 40px; flex-shrink: 0; }
.stop svg { width: 18px; height: 18px; }
.send { width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center; background: #a7a5a6; border: 0; color: white; border-radius: 50%; transition: background .18s; } /* el gris de las flechas de las tarjetas (arrow-forward.svg), también con el campo vacío */
.send:hover:not(:disabled) { background: #8c8a8b; }
.send img { transform: rotate(90deg); } /* la flecha de Contexta, hacia la derecha */
/* Aviso de IA como el de Contexta (#news-disclaimer): el icono dentro de la línea y las líneas equilibradas. */
.ai-disclaimer { display: block; margin: 0; padding: 10px 24px 16px; font-size: 14px; line-height: 20px; text-align: center; text-wrap: balance; color: var(--text-secondary); }
.ai-disclaimer img { display: inline-block; width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; }

/* Conversation: question, assistant identity, answer, then supporting material. */
/* Figma «Result»: 28 px entre turnos, sin raya; dentro, 26 px entre bloques y 18 px entre propuestas. */
.answerBox { padding-top: 28px; overflow-wrap: anywhere; }
header.question { display: flex; justify-content: flex-end; margin-bottom: 28px; }
/* La pregunta (Figma): bloque gris (neutral/100) con la esquina de abajo a la derecha recta. */
header.question > span { max-width: 85%; background: #e6e6e6; padding: 16px 22px; border-radius: 10px 10px 0 10px; font: 400 18px/1.45 var(--font-body); } /* medidas de Contexta */
.answer-wrapper { display: flex; flex-direction: column; align-items: stretch; }
.answer { min-width: 0; }
.answerText { font: 300 18px/28px var(--font-body); } /* del tamaño de la pregunta, con 24 px entre párrafos y propuestas */
.answerText > :first-child { margin-top: 0; }
.answerText p { margin: 24px 0; }
/* La viñeta dentro del texto, como en el Figma: la segunda línea empieza bajo ella. */
.answerText ul, .answerText ol { padding-left: 0; list-style-position: inside; margin: 24px 0; }
.answerText li { margin: 24px 0; }
.answerText li::marker { color: var(--text-primary); }
.answerText strong { font-weight: 500; }
/* Los apartados de la respuesta («1. Propuestas del PP…»): en la letra del texto, sin negrita, solo algo mayores. */
.answerText h1, .answerText h2, .answerText h3, .answerText h4 { font: 400 20px/28px var(--font-body); margin: 28px 0 16px; color: var(--text-primary); }
.answerText h1 { font-size: 22px; }
.answerText blockquote { margin: 20px 0; border-left: 2px solid var(--border-color); padding-left: 20px; color: var(--text-secondary); }
.answerText pre { overflow-x: auto; padding: 16px; background: var(--bg-subtle); font-size: 13px; }
.answerText hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 24px 0; }
.source-note { font-size: 15px; line-height: 24px; color: #7f7f7f; } /* por debajo del texto (18 px) */
/* Cita (Figma «Referencia de la propuesta»): etiqueta; al final de una propuesta va en su línea
   (moveTrailingCitations). Rellena con el color de su partido si está en el Figma (abajo); si no, neutra. */
.cite { display: inline-block; border: 1px solid var(--border-color); padding: 5px 10px; margin: 2px; border-radius: 5px; font: 400 15px/18px var(--font-body); vertical-align: baseline; background: var(--surface); text-decoration: none; color: var(--text-primary); }
.cite-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cite-row .cite { margin: 0; }
a.cite:hover { border-color: var(--accent); color: var(--accent); text-decoration: underline; }
/* Color del logo de cada partido en «Todos los programas» (data-color, functions.js) y el texto blanco
   o negro, el de más contraste (todos pasan de 4,5:1). */
.cite[data-color], a.cite[data-color]:hover { border-color: var(--cite-bg); background: var(--cite-bg); color: var(--cite-ink, var(--text-primary)); }
[data-color='psoe'] { --cite-bg: #da1f35; --cite-ink: #fff; }
[data-color='pp'] { --cite-bg: #1e4b8f; --cite-ink: #fff; }
[data-color='frente-amplio'] { --cite-bg: #e54c23; --cite-ink: #000; } /* con #1a1a1a, 4,47:1 */
[data-color='vox'] { --cite-bg: #5ac035; }
[data-color='podemos'] { --cite-bg: #b765c0; }
[data-color='erc'] { --cite-bg: #e5ab4b; }
[data-color='junts'] { --cite-bg: #00c4b2; }
[data-color='pnv'] { --cite-bg: #318731; --cite-ink: #fff; }
[data-color='eh-bildu'] { --cite-bg: #22b194; }
[data-color='bng'] { --cite-bg: #6aade4; }
[data-color='coalicion-canaria'] { --cite-bg: #ffcc33; }
[data-color='pacma'] { --cite-bg: #22d55d; }
[data-color='recortes-cero'] { --cite-bg: #000; --cite-ink: #fff; }
[data-color='upn'] { --cite-bg: #2058ba; --cite-ink: #fff; }
[data-color='teruel-existe'] { --cite-bg: #007e51; --cite-ink: #fff; }
[data-color='adelante-andalucia'] { --cite-bg: #24c87e; }
[data-color='ara-mes-front-ampli'] { --cite-bg: #3d5a80; --cite-ink: #fff; } /* el de su cuadrado provisional, sin logo */
/* Candidaturas sin programa en el comparador: su color, listo para cuando lo tengan. */
[data-color='compromis-front-valencia'] { --cite-bg: #ff5500; }
[data-color='alhora'] { --cite-bg: #e6283e; --cite-ink: #000; }
[data-color='democracia-21'] { --cite-bg: #eabd00; }
[data-color='drago-canarias'] { --cite-bg: #008c71; --cite-ink: #000; }
[data-color='escanos-en-blanco'] { --cite-bg: #808080; --cite-ink: #000; }
[data-color='fe-jons'] { --cite-bg: #f7003b; --cite-ink: #000; }
[data-color='feministas-al-congreso'] { --cite-bg: #7368af; --cite-ink: #fff; }
[data-color='frente-obrero'] { --cite-bg: #882121; --cite-ink: #fff; }
[data-color='iustitia-europa'] { --cite-bg: #e5c64b; }
[data-color='liberacion-canaria'] { --cite-bg: #033e65; --cite-ink: #fff; }
[data-color='pancal-urci'] { --cite-bg: #3c52b1; --cite-ink: #fff; }
[data-color='partido-autonomos'] { --cite-bg: #000000; --cite-ink: #fff; }
[data-color='partido-humanista'] { --cite-bg: #ea5b1f; }
[data-color='pcte'] { --cite-bg: #bb0415; --cite-ink: #fff; }
[data-color='por-un-mundo-mas-justo'] { --cite-bg: #eeb488; }
[data-color='prepal'] { --cite-bg: #d70668; --cite-ink: #fff; }
[data-color='proyecto-alantre'] { --cite-bg: #f1ac00; }
[data-color='puede'] { --cite-bg: #b5ba05; }
[data-color='renacer-renaixer'] { --cite-bg: #b89378; }
[data-color='se-acabo-la-fiesta'] { --cite-bg: #785a46; --cite-ink: #fff; }
[data-color='soria-ya'] { --cite-bg: #232020; --cite-ink: #fff; }
[data-color='tercera-edad-en-accion'] { --cite-bg: #00bf63; }
[data-color='unidad-del-pueblo-canario'] { --cite-bg: #fcb314; }
[data-color='valencia-unida'] { --cite-bg: #01aacd; }
.cite--pp, .party-group--pp, [data-party='pp'] { --party-color: var(--party-pp); }
.cite--psoe, .party-group--psoe, [data-party='psoe'] { --party-color: var(--party-psoe); }
.cite--vox, .party-group--vox, [data-party='vox'] { --party-color: var(--party-vox); }
.cite--podemos, .party-group--podemos, [data-party='podemos'] { --party-color: var(--party-podemos); }
.cite--chunta, .party-group--chunta, [data-party='chunta'] { --party-color: var(--party-chunta); }
.cite--par, .party-group--par, [data-party='par'] { --party-color: var(--party-par); }
.cite--teruel-existe, .party-group--teruel-existe, [data-party='teruel-existe'] { --party-color: var(--party-teruel-existe); }
.cite--iu-sumar, .party-group--iu-sumar, [data-party='iu-sumar'], .cite--sumar, .party-group--sumar, [data-party='sumar'] { --party-color: var(--party-iu-sumar); }
.cite--rtve { color: var(--accent); background: var(--accent-soft); border-color: #ebd5c4; }
.party-group { padding: 18px 22px; margin: 16px 0; border: 1px solid var(--border-subtle); border-left: 3px solid var(--party-color, var(--border-color)); border-radius: 0 10px 10px 0; background: var(--surface); }
.party-group__label { color: var(--party-color, var(--text-primary)); }
.party-group .party-group__label { font: 600 16px var(--font-body); margin: 0 0 12px; }
.party-group ul { margin: 0; }
.copy { order: 5; display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; border: 0; background: none; border-radius: 6px; padding: 10px 0; color: #7f7f7f; font: 400 16px var(--font-body); margin-top: 16px; }
.copy svg { width: 20px; height: 20px; }
.copy:hover, .copy.copied { color: var(--accent); }
.copy .copy__done, .copy.copied .copy__label { display: none; }
.copy.copied .copy__done { display: inline; }
.answerBox[aria-busy='true'] .copy { display: none; }
.useful { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-secondary); }
/* «¿Cómo de bien hemos respondido?» oculta por ahora (Contexta tampoco la tiene); quitar esta regla la recupera. */
.useful { display: none; }
.stars { display: inline-flex; gap: 2px; }
.star { background: none; border: 0; padding: 4px; min-width: 32px; min-height: 36px; font-size: 24px; color: #939689; }
.star.selected, .useful:not(.rated) .stars:hover .star { color: var(--accent); }
.useful:not(.rated) .stars .star:hover ~ .star { color: #939689; }
.star.sending { opacity: .5; }
.useful.rated .star { cursor: default; }

/* Native details keeps every source available without flooding the answer. */
/* Figma: la cabecera es una píldora con el contador redondo; abierta, la lista va debajo. */
.sources-panel { order: 3; margin-top: 26px; }
.sources-panel__title { display: flex; align-items: center; gap: 10px; min-height: 64px; cursor: pointer; padding: 17px 20px; border: 1px solid var(--border-color); border-radius: 32px; background: var(--surface); font: 500 16px/1.2 var(--font-body); color: var(--text-soft); list-style: none; }
.sources-panel__title::-webkit-details-marker { display: none; }
.sources-panel__title::after { content: '+'; margin-left: auto; font: 400 24px/1 var(--font-body); color: var(--text-primary); }
.sources-panel[open] .sources-panel__title::after { content: '−'; }
.sources-panel__count { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e6e6e6; font-size: 14px; color: #333; }
.sources-list { list-style: none; padding: 16px 20px 0; margin: 0; display: grid; gap: 16px; }
.source-item { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; border-left: 2px solid var(--party-color, var(--border-color)); padding-left: 12px; }
.source-party { color: var(--party-color, var(--text-primary)); font-size: 12px; font-weight: 600; }
.source-meta, .source-snippet { font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.source-snippet { grid-column: 1 / -1; margin: 0; }
.source-meta { overflow-wrap: anywhere; }
.source-meta a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.source-meta a:hover { text-decoration-thickness: 2px; }
/* Mapa de páginas: por partido, su programa entero a escala (los blancos separan capítulos) y, en su color,
   las páginas consultadas. */
.page-maps { display: grid; gap: 10px; padding: 16px 20px 0; }
.page-map { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.page-map__label { overflow: hidden; font-size: 12px; color: var(--text-secondary); white-space: nowrap; text-overflow: ellipsis; }
.page-map__bar { position: relative; height: 12px; border-radius: 3px; background: #ececea; }
.page-map__chapter { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--surface); }
.page-map__mark { position: absolute; top: 0; bottom: 0; min-width: 3px; border-radius: 1px; background: var(--cite-bg, var(--text-secondary)); }
.page-map__mark:hover { outline: 2px solid var(--text-primary); outline-offset: 1px; }
/* Al abrir las fuentes, el programa se traza de izquierda a derecha y luego aparecen las páginas citadas
   (con «reducir movimiento», la regla general las deja quietas). */
.page-map__bar { animation: page-map-draw .6s ease-out both; }
.page-map__mark { animation: page-map-mark .3s ease-out .45s both; }
@keyframes page-map-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes page-map-mark { from { opacity: 0; transform: scaleY(.3); } }

/* News cards remain useful when an article has no thumbnail. */
.related-news { order: 2; margin-top: 22px; }
.related-news__title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; font: 400 22px/1.4 var(--font-display); color: var(--heading); }
.related-news__list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.related-news__item { min-width: 0; display: flex; flex-direction: column; }
.related-news__card { display: flex; flex-direction: column; flex: 1; border: 1px solid var(--border-color); border-radius: 10px 10px 0 0; overflow: hidden; background: var(--surface); text-decoration: none; transition: border-color .18s, box-shadow .18s; }
.related-news__card:hover { color: inherit; border-color: #bea48f; box-shadow: 0 3px 10px #24262009; }
.related-news__thumb { width: 100%; height: 140px; object-fit: cover; }
.related-news__body { display: flex; flex-direction: column; gap: 10px; padding: 20px; flex: 1; }
.related-news__publisher { display: flex; align-items: center; justify-content: space-between; color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: .6px; }
.related-news__publisher::after { content: '↗'; font-size: 18px; font-weight: 400; }
.related-news__headline { font: 500 22px/1.2 var(--font-display); letter-spacing: -.2px; }
.related-news__card:hover .related-news__headline { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.related-news__date { order: 5; color: var(--text-muted); font-size: 10px; padding-top: 4px; margin-top: auto; }
.related-news__snippet { font-size: 12px; line-height: 1.65; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.follow-ups { order: 4; margin-top: 26px; }
.follow-ups__title { margin: 0 0 16px; font: 400 18px/26px var(--font-body); color: var(--text-primary); }
/* Pregunta de actualidad (redirect_to_news): el mensaje y el enlace a Contexta forman un bloque, como la
   invitación de Contexta a Elecciones; son dos elementos seguidos con el mismo fondo y borde. */
.answerBox.is-news-redirect .answerText, .news-redirect { padding: 0 24px; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.answerBox.is-news-redirect .answerText { display: flow-root; padding-top: 20px; } /* flow-root: el margen del último párrafo no sale del bloque */
.news-redirect { margin-bottom: 22px; padding-top: 4px; padding-bottom: 20px; }
.news-redirect .outline-button { font-size: 16px; text-decoration: none; }
@media (max-width: 720px) {
  .answerBox.is-news-redirect .answerText, .news-redirect { padding-right: 16px; padding-left: 16px; }
  .answerBox.is-news-redirect .answerText { padding-top: 16px; }
  .news-redirect { padding-bottom: 16px; }
}
.news-redirect .outline-button::after { content: '→'; color: var(--accent); }
.party-picker { order: 4; margin-top: 22px; }
.party-picker__hint { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); }
.party-picker__list { display: flex; flex-wrap: wrap; gap: 8px; }
.party-picker__option { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-color); border-radius: 7px; padding: 8px 12px; font-size: 12px; cursor: pointer; }
.party-picker__option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.party-picker__option:has(input:disabled) { opacity: .5; cursor: default; }
.party-picker__option input { accent-color: var(--accent); margin: 0; }
.party-picker__send { margin-top: 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 7px; padding: 9px 16px; font-size: 12px; font-weight: 600; }
.party-picker__send:disabled { opacity: .5; }
.topic-picker { order: 4; margin-top: 22px; }
.answerText.is-streaming > :last-child::after { content: "▍"; margin-left: 2px; color: var(--accent); animation: answer-caret 1s steps(1) infinite; }
@keyframes answer-caret { 50% { opacity: 0; } }
/* Valorar o copiar solo la respuesta terminada, no el borrador. */
.answer:has(> .answerText.is-streaming) > .useful, .answer-wrapper:has(.answerText.is-streaming) > .copy { display: none; }
.topic-picker__hint { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); }
.topic-picker__list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-picker__option { border: 1px solid var(--border-color); background: transparent; border-radius: 7px; padding: 8px 12px; font-size: 12px; }
.topic-picker__option[hidden] { display: none; }
.topic-picker__option:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.topic-picker__option:disabled { opacity: .55; }
.topic-picker__more { border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; padding: 8px 4px; }
/* Figma: píldoras de 56 px con la flecha gris de las tarjetas de la portada. */
.follow-ups__list { display: flex; flex-wrap: wrap; gap: 12px; }
.follow-up { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; border: 1px solid var(--border-color); background: var(--surface); border-radius: 28px; text-align: left; padding: 11px 16px; font: 300 18px/26px var(--font-body); color: var(--text-primary); }
.follow-up::after { content: ''; flex-shrink: 0; width: 32px; height: 32px; background: url(assets/icons/arrow-forward.svg) center / 32px no-repeat; }
.follow-up:hover:not(:disabled) { background: var(--surface); border-color: var(--accent); }
.follow-up:disabled { opacity: .55; }
.answerText table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse; font-size: 14px; margin: 20px 0; line-height: 1.6; }
.answerText th, .answerText td { border: 1px solid var(--border-color); padding: 12px 14px; text-align: left; vertical-align: top; min-width: 160px; }
.answerText th { background: var(--bg-subtle); font-weight: 600; }
.answerText tbody tr:nth-child(even) { background: #ffffff80; }

/* Honest progress labels, errors and motion preferences. */
.distractor { display: flex; align-items: center; gap: 14px; padding: 8px 0 24px; }
.ballsBox { display: flex; gap: 4px; }
.ballsBox > span { width: 5px; height: 5px; background: var(--accent); border-radius: 50%; animation: pulse-dot 1.4s infinite; }
.ballsBox > :nth-child(2) { animation-delay: .15s; }
.ballsBox > :nth-child(3) { animation-delay: .3s; }
.ballsBox > :nth-child(4) { animation-delay: .45s; }
.stage-label { color: var(--text-secondary); font-size: 13px; }
.answerBox.is-error .answer { background: var(--accent-soft); padding: 16px 20px; border: 1px solid #eacbb5; border-radius: 10px; }
.answerBox.is-error .answerText { font-size: 14px; }
.reveal { animation: welcome-in .35s ease-out both; animation-delay: calc(min(var(--reveal-i, 0), 8) * 25ms); }
@keyframes welcome-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* Accessible, keyboard-dismissable information dialog. */
.info-dialog { width: min(520px, calc(100% - 32px)); padding: 38px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--bg-main); color: var(--text-primary); max-height: calc(100dvh - 48px); overflow-y: auto; box-shadow: 0 16px 60px #0002; }
.info-dialog::backdrop { background: #23271d66; backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; background: none; font-size: 26px; color: var(--text-secondary); }
.info-dialog h2 { font: 400 34px/1.15 var(--font-display); letter-spacing: -.6px; margin: 22px 0; }
.info-dialog h2 em { color: var(--accent); font-style: normal; }
.info-dialog > p:not(.eyebrow), .info-dialog dd { font-size: 15px; line-height: 1.7; color: var(--text-secondary); }
.info-dialog dt { font-size: 15px; font-weight: 600; margin: 20px 0 5px; }
.info-dialog dd { margin: 0; }
.primary-button { width: 100%; border: 0; border-radius: 24px; padding: 13px 20px; background: var(--accent-bright); color: white; font: 500 16px var(--font-body); margin-top: 20px; }
.primary-button:hover { background: var(--accent); }

@media (max-width: 900px) {
  .masthead { width: calc(100% - 48px); min-height: 76px; gap: 18px; }
  .welcome { padding-top: 32px; }
  .slideBox { margin-top: 30px; }
}
@media (max-width: 600px) {
  /* Como Contexta en móvil: la «i» a la derecha del nombre y «Nueva conversación» en su fila. */
  .masthead { min-height: 68px; width: calc(100% - 32px); flex-wrap: wrap; gap: 12px 16px; padding: 12px 0; }
  .masthead__brand { flex: 1 1 calc(100% - 60px); } /* deja sitio a la «i» (44 px + 16 de hueco) en su fila */
  .masthead__title { font-size: 23px; font-weight: 400; }
  .masthead__endorsement { gap: 4px; font-size: 13px; } /* la firma y «BETA» en una línea a 375 px */
  .masthead__endorsement img { height: 16px; }
  /* «Programas» al lado de «Nueva conversación» (324 de 343 px a 375); si no cabe, baja a su fila. */
  .has-conversation .masthead__actions { flex: 1 0 auto; margin-left: 0; }
  .programs-toggle { gap: 10px; padding-inline: 4px; margin-left: auto; font-size: 16px; }
  #new-chat { flex: 1; padding: 10px 16px 10px 12px; font-size: 16px; }
  .text-button { font-size: 12px; }
  /* Medidas de Contexta en móvil (.news-*): márgenes de 16 px, 25 px del aviso al campo, título de 24/34 y
     tarjetas de 220 px, a 15 px, con la pregunta en 18/24. */
  .container { padding: 0 16px; }
  .welcome { padding-top: 26px; }
  .experimental-notice { margin-bottom: 25px; font-size: 13px; line-height: 18px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.4px; }
  .section-heading { gap: 8px; } /* «Para empezar a preguntar» a 24 px cabe en una línea junto a la pausa */
  .section-heading h2 { font-size: 24px; line-height: 34px; }
  .slideOptions ul { gap: 15px; }
  .slideOptions li { flex-basis: 220px; }
  .slideOptions li > button { font-size: 18px; line-height: 24px; }
  /* En móvil se desliza con el dedo: sin flechas, y la siguiente tarjeta asoma por la derecha. */
  .slide-arrow { display: none; }
  .programs__list { display: grid; max-width: none; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 10px; } /* 5 por fila a 375 px */
  .page-map { grid-template-columns: 1fr; gap: 4px; } /* el partido encima de su franja */
  /* Ocho filas en móvil: el muro abierto se desplaza dentro y no saca la conversación del iframe (sin ratón,
     no hay nombre emergente que recortar). */
  .programs-panel { max-height: 50dvh; overflow-y: auto; }
  .questionBox { width: calc(100% - 24px); padding-top: 10px; }
  .questionBox form { border-radius: 31px; }
  fieldset.question { min-height: 62px; padding: 7px 7px 7px 20px; gap: 6px; }
  #question { font-size: 18px; line-height: 24px; padding: 10px 0; max-height: 100px; }
  .send { width: 48px; height: 48px; }
  .ai-disclaimer { font-size: 12px; padding: 8px 18px max(12px, env(safe-area-inset-bottom)); line-height: 16px; }
  header.question > span { max-width: 90%; font-size: 18px; line-height: 26px; padding: 14px 16px; }
  .answerText { font-size: 18px; line-height: 26px; } /* del tamaño de la pregunta, también en móvil */
  .answerText p, .answerText ul, .answerText ol, .answerText li { margin: 16px 0; }
  .answerText h1, .answerText h3, .answerText h4 { font-size: 20px; line-height: 28px; } /* algo mayores que el texto (18 px) */
  .source-note { font-size: 14px; line-height: 1.5; }
  .follow-up { font-size: 16px; line-height: 22px; }
  .party-group { padding: 16px 14px; }
  .related-news__list { grid-template-columns: 1fr; }
  .related-news__body { padding: 18px; }
  .related-news__headline { font-size: 23px; }
  .info-dialog { padding: 28px 24px; }
}
@media (max-width: 400px) {
  .masthead__actions { gap: 8px; }
  .article-url-field { grid-template-columns: 1fr; }
}
@media (max-height: 550px) { .masthead { min-height: 54px; } .ai-disclaimer { padding-block: 6px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body, .mainbodier, .container { display: block; height: auto; overflow: visible; }
  .questionBox, .welcome, .masthead__actions, .follow-ups, .copy, .useful, .distractor, .info-dialog { display: none; }
  .answerBox, .party-group, .related-news__card { break-inside: avoid; }
  .reveal { opacity: 1; animation: none; }
}

/* Visor de programas en un modal (functions.js, openProgramViewer): casi toda la ventana en escritorio y
   toda en móvil; la página de detrás no se desplaza mientras está abierto. */
/* La conversación se desplaza en .container, no en html: el bloqueo va en los dos. */
html.has-program-viewer, html.has-program-viewer .container { overflow: hidden; }
.program-viewer { width: min(1100px, 92vw); height: 92vh; max-width: none; max-height: none; margin: auto; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--bg-main); box-shadow: 0 12px 48px rgba(0, 0, 0, .3); }
.program-viewer::backdrop { background: rgba(0, 0, 0, .55); }
.program-viewer iframe { display: block; width: 100%; height: 100%; border: 0; }
/* El visor no ha cargado en el modal: salida a una pestaña nueva, sobre el recuadro en blanco. */
.program-viewer__fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: var(--bg-main); text-align: center; color: var(--text-primary); }
.program-viewer__fallback p { margin: 0; font-size: 17px; }
.program-viewer__fallback a { color: var(--accent); font-weight: 500; }
.program-viewer__fallback button { font: inherit; border: 1px solid var(--border-color); background: var(--surface); border-radius: 8px; padding: 6px 14px; cursor: pointer; }
@media (max-width: 643px) {
  .program-viewer { width: 100vw; height: 100dvh; border-radius: 0; }
}
