:root {
  color-scheme: light;
  --dark-slate: #283d3b;
  --stormy-teal: #197278;
  --powder-petal: #edddd4;
  --tomato-jam: #c44536;
  --chestnut: #772e25;
  --bg: #f7f2ed;
  --panel: #fffdf9;
  --ink: var(--dark-slate);
  --muted: #687570;
  --line: rgba(40, 61, 59, 0.2);
  --line-strong: rgba(40, 61, 59, 0.38);
  --accent: var(--stormy-teal);
  --soft: #f3ece6;
  --surface: #fbf6f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #fbf6f1 0, var(--bg) 320px);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.has-open-modal {
  overflow: hidden;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1160px, calc(100% - 72px));
  margin: 0 auto;
  padding: 48px 0 88px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.intro {
  max-width: 820px;
}

/* Logo et nom ramènent à l'accueil (2027, premier tour) : lien sans
   soulignement ni couleur de lien, le titre garde son apparence. */
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand:focus-visible {
  outline: 2px solid var(--stormy-teal);
  outline-offset: 4px;
  border-radius: 8px;
}

.brand-mark {
  width: clamp(82px, 8vw, 102px);
  height: clamp(44px, 4.5vw, 54px);
  flex: none;
}

.top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
}

.tagline {
  margin: 10px 0 0;
  max-width: 62ch;
  color: var(--stormy-teal);
  font-size: 0.98rem;
  line-height: 1.45;
  font-weight: 500;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 2.8vw, 3.15rem);
  line-height: 1.02;
  font-weight: 760;
}

h2 {
  font-size: clamp(1.22rem, 1.8vw, 1.48rem);
  line-height: 1.16;
  font-weight: 750;
  color: var(--dark-slate);
}

.source {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
  white-space: nowrap;
}

.freshness {
  max-width: 290px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: right;
}

.site-footer {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid rgba(40, 61, 59, 0.14);
}

.site-footer .source {
  text-align: left;
  white-space: normal;
  line-height: 1.4;
}

.election-control {
  width: 112px;
}

.election-control label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.round-control[hidden] {
  display: none;
}

.round-modebar[hidden] {
  display: none;
}

.toolbar {
  margin: 0;
}

.filters-card {
  margin: 22px 28px 0;
  border: 1px solid rgba(25, 114, 120, 0.2);
  border-radius: 2px;
  background: rgba(25, 114, 120, 0.055);
  padding: 18px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.filters-card.is-collapsed {
  display: none;
}

.filters-body[hidden] {
  display: none;
}

.filters-summary {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.filters-summary[hidden] {
  display: none;
}

.filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  width: 100%;
  min-height: 42px;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--dark-slate);
  cursor: pointer;
  font: inherit;
  font-size: 0.87rem;
  font-weight: 650;
  white-space: nowrap;
}

.filters-toggle:hover {
  background: rgba(255, 253, 249, 0.9);
  border-color: var(--stormy-teal);
}

.filters-toggle-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.filters-toggle[aria-expanded="true"] .filters-toggle-chevron {
  transform: translateY(2px) rotate(-135deg);
}

.nowcast-panel,
.nowcast-score-panel {
  margin-top: 64px;
  padding: 30px 28px 32px;
  border: 2px solid var(--dark-slate);
  border-radius: 2px;
  background: var(--panel);
}

.nowcast-score-panel {
  margin-top: 0;
}

/* `display` posé par une classe l'emporte sur l'attribut `hidden` de la
   feuille de style du navigateur : sans ces règles, masquer un conteneur du
   panneau le laisse visible et les deux modes s'empilent. */
.nowcast-panel[hidden],
.nowcast-scenarios-cta[hidden],
.nowcast-score-panel[hidden],
.nowcast-warning[hidden],
.nowcast-cards[hidden] {
  display: none;
}

.nowcast-interpretation {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.55;
}

.nowcast-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.nowcast-head h2 {
  max-width: 720px;
  margin: 0 0 7px;
}
.nowcast-head p,
.nowcast-method-note p {
  color: var(--muted);
  line-height: 1.5;
}
.nowcast-scenario-button:focus-visible {
  border-color: var(--stormy-teal);
  background: rgba(25, 114, 120, 0.045);
  outline: 2px solid rgba(25, 114, 120, 0.18);
  outline-offset: 1px;
}

.nowcast-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.nowcast-card-head strong {
  flex: none;
  color: var(--dark-slate);
  font-size: 1.08rem;
}

.nowcast-candidate {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--dark-slate);
  font-size: 0.89rem;
  font-weight: 750;
}

.nowcast-candidate::before {
  width: 9px;
  height: 9px;
  margin-right: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--candidate-color);
  content: "";
}

/* La liste et son évolution sont lues ensemble : les deux colonnes partagent
   titre, note et contenu. La distribution de scores reste ensuite dans son
   propre bloc, pour ne pas mélanger les deux unités. */
.nowcast-overview {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  grid-auto-flow: column;
  gap: 0 18px;
  margin-top: 26px;
  align-items: start;
}

.nowcast-overview[hidden] {
  display: none;
}

.nowcast-overview-column {
  display: contents;
}

.nowcast-overview-title {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nowcast-overview-intro {
  min-width: 0;
  margin-bottom: 10px;
}

.nowcast-overview-note {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.nowcast-history-chart-wrap,
.nowcast-overview-chart-wrap {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 6px 8px;
}

.nowcast-history-chart-wrap svg,
.nowcast-overview-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
}

/* Les scores ont leur propre encadré : ils ne sont pas une autre vue de
   l'indice, et les violons peuvent donc prendre toute la largeur. */
.nowcast-score-ranges {
  margin: 0;
  padding: 0;
  border: 0;
}

.nowcast-score-ranges > div:first-child {
  margin-bottom: 12px;
}

/* La légende est tracée dans le SVG, sur une bande réservée en haut du
   graphique : hors de lui, elle décalait les deux colonnes l'une par rapport à
   l'autre pour deux lignes de texte. */
/* Zones de survol : elles couvrent toute la colonne (ou la rangée) du candidat,
   pas seulement sa forme, qui est trop étroite pour être visée au doigt. */
.nowcast-violin-hit {
  fill: transparent;
  cursor: pointer;
}

.nowcast-violin-hit:focus-visible {
  outline: 2px solid var(--stormy-teal);
  outline-offset: -2px;
}

.nowcast-overview-tooltip[hidden] {
  display: none;
}

.history-tooltip[hidden] {
  display: none;
}

.history-tooltip {
  width: max-content;
  max-width: min(250px, calc(100% - 16px));
}

.history-tooltip b {
  color: var(--dark-slate);
}

.history-hover-rule {
  stroke: var(--dark-slate);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.28;
  pointer-events: none;
}

.history-hover-marker {
  stroke: #fff;
  stroke-width: 2.5;
  pointer-events: none;
}

.history-hover-rule[hidden],
.history-hover-marker[hidden] {
  display: none;
}

.nowcast-history-raw-point[tabindex],
.nowcast-history-point[tabindex] {
  cursor: pointer;
}

.nowcast-history-raw-point[tabindex]:focus-visible,
.nowcast-history-point[tabindex]:focus-visible {
  outline: none;
  stroke: var(--dark-slate);
  stroke-width: 2;
}

.nowcast-overview-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.nowcast-overview-tooltip dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.nowcast-overview-tooltip dd {
  margin: 0;
  color: var(--dark-slate);
  font-weight: 700;
  text-align: right;
}

.nowcast-violin-legend-label {
  fill: var(--muted);
  font-size: 0.7rem;
}

.nowcast-violin-legend-swatch {
  fill: var(--dark-slate);
  stroke: none;
}

.nowcast-violin-legend-swatch.nowcast-violin-band {
  fill-opacity: 0.9;
}

.nowcast-violin-legend-swatch.nowcast-violin-tail {
  fill-opacity: 0.16;
  stroke: none;
}

.nowcast-overview-list {
  display: grid;
  min-height: 259px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 4px;
}

.nowcast-overview-row {
  min-width: 0;
  padding: 7px 8px;
}

.nowcast-overview-row + .nowcast-overview-row {
  border-top: 1px solid var(--line);
}

.nowcast-overview-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

/* Le chiffre est déjà là, à droite du nom : cette ligne dit ce qu'il faut en
   penser. Elle reste dans l'encre courante pour ne pas suggérer une précision
   supplémentaire par sa couleur. */
.nowcast-outlook {
  display: block;
  margin: 3px 0 0;
  font-size: 0.74rem;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.nowcast-outlook.is-strong {
  color: var(--ink);
}

.nowcast-outlook.is-uncertain {
  color: var(--ink);
}

.nowcast-outlook.is-weak {
  color: var(--ink);
}

.nowcast-outlook.is-marginal {
  color: var(--ink);
  font-weight: 400;
}

/* La probabilité affichée est une valeur unique : une jauge remplie depuis 0 %
   en est la lecture directe, aux deux formats. */
.nowcast-overview-gauge {
  display: block;
  height: 6px;
  margin: 7px 0 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7ebe9;
}

.nowcast-overview-gauge span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

/* La distribution complète, effilée sur ses deux queues : c'est elle qui donne
   au violon sa silhouette. */
.nowcast-violin-tail {
  fill-opacity: 0.16;
  stroke-opacity: 0.5;
  stroke-width: 1;
  stroke-linejoin: round;
}

/* La fourchette à 80 % en plein, à l'intérieur. Toutes les formes partagent une
   seule échelle de densité, donc ces surfaces pleines sont égales entre elles. */
.nowcast-violin-band {
  fill-opacity: 0.9;
  stroke: none;
}

.nowcast-violin-cap {
  stroke: #ffffff;
  stroke-opacity: 0.55;
  stroke-width: 1;
}

/* La médiane du mélange : elle peut tomber dans un creux quand les hypothèses
   se contredisent, et c'est justement ce que la forme sert à montrer. */
.nowcast-violin-median {
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Les bornes chiffrées se posent hors de la partie pleine, sur l'aplat léger :
   une encre unique, sombre, y est lisible pour toutes les couleurs. */
.nowcast-range-bound {
  fill: var(--dark-slate);
  font-size: 0.68rem;
  font-weight: 750;
}

.nowcast-range-name {
  fill: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.nowcast-history[hidden] {
  display: none;
}

.nowcast-grid-line {
  stroke: #dfe5e2;
  stroke-width: 1;
}

.nowcast-axis-label,
.nowcast-single-notice {
  fill: var(--muted);
  font-family: inherit;
  font-size: 11px;
}

.nowcast-history-trend {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.nowcast-history-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.nowcast-history-point {
  stroke: #fff;
  stroke-width: 1.2;
}

.nowcast-history-raw-point {
  stroke: #fff;
  stroke-width: 1.2;
  opacity: 0.55;
}

.nowcast-history-raw-point.is-current {
  opacity: 1;
  stroke: #fff;
  stroke-width: 1.7;
}

.nowcast-history-legend-marker {
  fill: var(--dark-slate);
}

.nowcast-history-legend-trend {
  stroke: var(--dark-slate);
}

.nowcast-history-legend-label {
  fill: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.nowcast-history-end-label {
  font-weight: 720;
}

.nowcast-method-note {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.nowcast-method-note summary {
  color: var(--dark-slate);
  cursor: pointer;
  font-weight: 700;
}

.nowcast-method-note p {
  max-width: 900px;
  margin: 10px 0 0;
}

.nowcast-method-note a {
  color: var(--stormy-teal);
  font-weight: 700;
}

.filters-head h2 {
  font-size: 1.08rem;
  color: var(--dark-slate);
}

.filters-head h3 {
  margin: 0;
  color: var(--dark-slate);
  font-size: 1rem;
}

.filters-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 18px 16px;
  align-items: end;
}

.scenario-notice {
  margin-top: 20px;
  border: 1px solid rgba(196, 69, 54, 0.46);
  border-radius: 2px;
  background: rgba(237, 221, 212, 0.55);
  color: var(--chestnut);
  padding: 12px 14px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.scenario-notice[hidden] {
  display: none;
}

.control {
  min-width: 0;
}

.control label {
  display: block;
  margin: 0 0 8px;
  color: var(--dark-slate);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.2;
}

.control select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 14px) 50% / 6px 6px no-repeat,
    var(--panel);
  color: var(--ink);
  padding: 0 34px 0 13px;
  outline: none;
  cursor: pointer;
  font-size: 0.92rem;
}

.election-control select {
  min-height: 34px;
  border-color: rgba(40, 61, 59, 0.28);
  background-color: rgba(255, 253, 249, 0.62);
  color: var(--muted);
  padding-left: 11px;
  font-size: 0.82rem;
  font-weight: 650;
}

.election-control select:hover,
.election-control select:focus {
  color: var(--ink);
}

.control select:hover {
  border-color: var(--stormy-teal);
  background-color: var(--surface);
}

.control select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(25, 114, 120, 0.22);
  outline-offset: 1px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  padding: 0;
}

.segmented button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 650;
  padding: 0 6px;
  /* Un libellé qui passe à la ligne fait grandir le contrôle et casse
     l'alignement de la pile d'en-tête. */
  white-space: nowrap;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button:hover {
  background: rgba(237, 221, 212, 0.32);
  color: var(--ink);
}

.segmented button:focus-visible {
  outline: 2px solid rgba(25, 114, 120, 0.22);
  outline-offset: -2px;
}

.round-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

.chart-actions .time-control .segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 42px;
}

.chart-panel {
  background: var(--panel);
  border: 2px solid var(--dark-slate);
  border-radius: 2px;
  overflow: visible;
  min-width: 0;
}

/* Au second tour, la mosaïque est déplacée juste avant le graphique principal.
   Ils restent deux blocs distincts, avec leur propre respiration. */
.duel-mosaic-panel + .chart-panel {
  margin-top: 64px;
}

.round-modebar {
  display: flex;
  align-items: center;
  min-height: 58px;
  margin-bottom: 32px;
  padding: 10px 16px;
  border: 1px solid rgba(25, 114, 120, 0.24);
  border-radius: 3px;
  background: rgba(25, 114, 120, 0.045);
}

.round-modebar .round-control {
  display: flex;
  align-items: center;
  gap: 13px;
}

.round-modebar .round-control label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Rappel du nom du site dans la barre : seul le thème collant l'affiche. */
.modebar-brand {
  display: none;
}

/* La barre porte aussi le choix de l'élection et reste visible : son display
   flex l'emporterait sinon sur l'attribut hidden du sélecteur de tour (2007). */
.round-modebar .round-control[hidden] {
  display: none;
}

.round-modebar .round-switch {
  width: 214px;
  min-height: 36px;
  border-color: rgba(25, 114, 120, 0.32);
  background: var(--panel);
}

.round-modebar .round-switch button {
  font-size: 0.82rem;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  padding: 30px 28px 0;
}

.chart-export-button {
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 28px;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid rgba(25, 114, 120, 0.36);
  border-radius: 2px;
  background: rgba(255, 254, 250, 0.9);
  color: var(--stormy-teal);
  cursor: pointer;
}

.chart-export-button:hover {
  border-color: var(--stormy-teal);
  background: rgba(25, 114, 120, 0.12);
}

.chart-export-button:focus-visible {
  outline: 3px solid rgba(25, 114, 120, 0.24);
  outline-offset: 2px;
}

.chart-export-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.chart-export-button svg {
  width: 14px;
  height: 14px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.chart-actions {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) minmax(240px, 1.35fr);
  flex: 0 0 390px;
  gap: 10px;
  align-items: end;
  padding-top: 2px;
}

.chart-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 500px;
}

.time-range-custom-button {
  display: grid;
  place-items: center;
  width: 42px;
  flex: 0 0 42px;
  padding: 0;
}

.time-range-custom-button svg {
  width: 18px;
  height: 18px;
  min-height: 0;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: var(--panel);
  vector-effect: non-scaling-stroke;
}

.time-range-editor {
  margin: -2px 28px 20px;
  padding: 15px 18px 12px;
  border: 1px solid rgba(25, 114, 120, 0.25);
  border-radius: 3px;
  background: rgba(25, 114, 120, 0.045);
}

.time-range-editor[hidden] {
  display: none;
}

.time-range-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 11px;
}

.time-range-editor h3 {
  margin: 0;
  font-size: 0.88rem;
}

.time-range-editor p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.time-range-editor output {
  color: var(--stormy-teal);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.time-range-overview {
  position: relative;
  height: 48px;
  border: 1px solid rgba(40, 61, 59, 0.18);
  border-radius: 2px;
  background: rgba(255, 253, 249, 0.84);
  overflow: hidden;
}

.time-range-density {
  position: absolute;
  inset: 6px 0 5px;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  padding: 0 2px;
}

.time-range-density span {
  min-width: 1px;
  flex: 1;
  border-radius: 1px 1px 0 0;
  background: rgba(40, 61, 59, 0.16);
}

.time-range-selection {
  position: absolute;
  inset-block: 0;
  background: rgba(25, 114, 120, 0.12);
  pointer-events: none;
}

.time-range-selection::before,
.time-range-selection::after {
  position: absolute;
  inset-block: 0;
  width: 2px;
  background: var(--stormy-teal);
  content: "";
}

.time-range-selection::before {
  left: 0;
  transform: translateX(-50%);
}

.time-range-selection::after {
  right: 0;
  transform: translateX(50%);
}

.time-range-overview input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.time-range-overview input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 38px;
  border: 2px solid var(--panel);
  border-radius: 3px;
  background: var(--stormy-teal);
  box-shadow: 0 1px 5px rgba(40, 61, 59, 0.25);
  appearance: none;
  cursor: ew-resize;
  pointer-events: auto;
}

.time-range-overview input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 38px;
  border: 2px solid var(--panel);
  border-radius: 3px;
  background: var(--stormy-teal);
  box-shadow: 0 1px 5px rgba(40, 61, 59, 0.25);
  cursor: ew-resize;
  pointer-events: auto;
}

.time-range-overview input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 3px solid rgba(25, 114, 120, 0.3);
  outline-offset: 2px;
}

.time-range-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
}

svg {
  display: block;
  width: 100%;
  height: clamp(510px, calc(100vh - 270px), 660px);
  min-height: 500px;
}

.axis text,
.axis-label,
.empty-state {
  fill: var(--muted);
  font-size: 12.5px;
}

.grid line {
  stroke: #e8e8e2;
  stroke-width: 1;
}

/* Second tour uniquement : au-dessus du seuil on l'emporte, en dessous non.
   Aplats volontairement très pâles, ils doivent situer la lecture sans
   concurrencer les couleurs de candidats. */
.majority-zone-win {
  fill: rgba(64, 138, 84, 0.17);
}

.majority-zone-lose {
  fill: rgba(198, 58, 42, 0.1);
}

/* Courbes miroir du camp sélectionné : un duel par courbe, dans la couleur de
   l'adversaire. Trait nettement plus fin que les courbes pleines et pointillé
   serré : elles accompagnent la lecture sans la disputer. */
.trend-mirror {
  stroke-width: 1.4;
  stroke-dasharray: 2.5 3.5;
}

.matchup-toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  align-self: end;
  color: var(--dark-slate);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.matchup-toggle[hidden] {
  display: none;
}

.matchup-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--stormy-teal);
  cursor: pointer;
}

.majority-line {
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.axis line,
.axis path {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.trend {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  transition: opacity 140ms ease, stroke-width 140ms ease;
}

.trend-band {
  opacity: 0.1;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.point {
  stroke: #ffffff;
  stroke-width: 1.6;
  transition: opacity 140ms ease, stroke-width 140ms ease;
}

.hit-trend {
  fill: none;
  stroke: rgba(0, 0, 0, 0.001);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 22;
  pointer-events: stroke;
}

.hit-point {
  fill: transparent;
  pointer-events: all;
}

.hit-end-label {
  fill: transparent;
  pointer-events: all;
  cursor: pointer;
}

.hover-dot {
  fill: var(--panel);
  stroke-width: 2.5;
  pointer-events: none;
}

.trend.is-hovered-series {
  opacity: 1;
  stroke-width: 4.2;
}

.point.is-hovered-series {
  opacity: 1;
  stroke-width: 2.2;
}

.trend-band.is-hovered-series {
  opacity: 0.14;
}

.trend.is-muted-series,
.point.is-muted-series,
.end-label.is-muted-series,
.label-leader.is-muted-series,
.end-point.is-muted-series {
  opacity: 0.18;
}

.end-point {
  stroke: var(--panel);
  stroke-width: 2;
  pointer-events: none;
}

.trend-band.is-muted-series {
  opacity: 0.025;
}

.end-label {
  font-size: 12.5px;
  font-weight: 680;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: none;
}

.end-label.is-compact {
  font-size: 11px;
}

.label-leader {
  fill: none;
  stroke-width: 1;
  /* Trait plein : un pointillé de 2 px se lit mal sur les courtes amorces, et
     le trait continu suit mieux l'oeil quand l'étiquette a dû être décalée. */
  opacity: 0.45;
  pointer-events: none;
}

.tooltip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 253, 249, 0.97);
  padding: 10px 11px;
  pointer-events: none;
  font-size: 0.82rem;
}

.tooltip strong {
  display: block;
  margin-bottom: 2px;
}

.tooltip span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.legend-panel {
  padding: 16px 28px 18px;
  border-top: 1px solid rgba(25, 114, 120, 0.18);
  background: rgba(25, 114, 120, 0.055);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.legend-title {
  flex: none;
  margin: 0;
  color: var(--dark-slate);
  font-size: 0.9rem;
  line-height: 31px;
}

.legend {
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel);
  color: var(--dark-slate);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
}

.legend-toggle:hover {
  border-color: var(--stormy-teal);
}

.legend-toggle[hidden] {
  display: none;
}

.legend-toggle[aria-expanded="true"] .filters-toggle-chevron {
  transform: translateY(2px) rotate(-135deg);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  position: relative;
  gap: 7px;
  min-height: 31px;
  border: 1px solid rgba(40, 61, 59, 0.22);
  border-radius: 2px;
  background: rgba(255, 253, 249, 0.52);
  color: rgba(40, 61, 59, 0.82);
  padding: 5px 10px;
  cursor: pointer;
}

.legend-item:hover {
  background: rgba(237, 221, 212, 0.42);
  border-color: var(--stormy-teal);
}

/* Le clic inverse l'état du candidat : au survol, l'action est annoncée
   directement dans l'étiquette plutôt que laissée à deviner. */
.legend-item[aria-pressed="true"]:hover,
.legend-item[aria-pressed="true"]:focus-visible {
  border-color: rgba(196, 69, 54, 0.52);
}

.legend-item[aria-pressed="true"]:hover::after,
.legend-item[aria-pressed="true"]:focus-visible::after {
  content: "Retirer";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(255, 253, 249, 0.96);
  color: var(--tomato-jam);
  font-size: 0.8rem;
  font-weight: 750;
  pointer-events: none;
}

.legend-item[aria-pressed="false"] {
  color: rgba(40, 61, 59, 0.58);
  border-color: rgba(40, 61, 59, 0.14);
  background: rgba(237, 221, 212, 0.18);
  opacity: 1;
}

.swatch {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
}

.legend-name {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.1;
}

.duel-mosaic-panel {
  margin-top: 64px;
  border: 2px solid var(--chestnut);
  border-radius: 2px;
  background: var(--panel);
  padding: 30px 28px 32px;
}

.duel-mosaic-panel[hidden] {
  display: none;
}

.duel-mosaic-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.comparison-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.duel-mosaic-export,
.nowcast-export,
.comparison-export {
  position: static;
  top: auto;
  right: auto;
  flex: 0 0 auto;
}

.nowcast-export {
  align-self: flex-start;
}

.duel-mosaic-head h2 {
  margin: 0;
}

.duel-mosaic-head p {
  margin: 6px 0 0;
  max-width: 78ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.duel-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.duel-tile {
  display: block;
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  padding: 12px 12px 10px;
  text-align: left;
  cursor: pointer;
}

.duel-tile:hover {
  border-color: var(--stormy-teal);
  background: rgba(237, 221, 212, 0.42);
}

.duel-tile.is-selected {
  border: 2px solid var(--dark-slate);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(40, 61, 59, 0.08);
}

.duel-tile.is-selected .duel-tile-chart {
  border-radius: 3px;
  background: rgba(25, 114, 120, 0.028);
  box-shadow: inset 0 0 0 1px rgba(25, 114, 120, 0.1);
}

.duel-tile:focus-visible {
  outline: 2px solid var(--stormy-teal);
  outline-offset: 3px;
}

.duel-tile-head {
  display: grid;
  gap: 3px;
}

.duel-tile-side {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(40, 61, 59, 0.72);
  font-size: 0.86rem;
}

.duel-tile-side.is-leading {
  color: var(--ink);
  font-weight: 640;
}

.duel-tile-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
}

.duel-tile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duel-tile-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.duel-tile-chart {
  display: block;
  width: 100%;
  /* La règle globale `svg` impose la hauteur du grand graphique : une vignette
     se dimensionne au contraire sur son propre rapport d'aspect. */
  height: auto;
  min-height: 0;
  aspect-ratio: 300 / 148;
  margin-top: 6px;
}

.duel-tile-foot {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.duel-tile-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.duel-tile-threshold {
  stroke: var(--chestnut);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  opacity: 0.7;
}

.duel-tile-threshold-label {
  fill: var(--muted);
  font-size: 8.5px;
  dominant-baseline: middle;
}

.duel-tile-date {
  fill: var(--muted);
  font-size: 8.5px;
}

.duel-tile-trend {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.duel-tile-point {
  opacity: 0.7;
}

.comparison-panel {
  margin-top: 64px;
  border: 2px solid var(--chestnut);
  border-radius: 2px;
  background: var(--panel);
}

.comparison-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  padding: 30px 28px 0;
}

.comparison-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* Phrase de lecture : ce que montre le graphique, écrit en toutes lettres et
   recalculé à chaque rendu. Elle passe avant la note de méthode, qui reste en
   dessous, plus petite et en gris — l'ordre visuel suit l'ordre de lecture. */
p.panel-lede {
  margin-top: 12px;
  max-width: 74ch;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.55;
  font-weight: 560;
}

p.panel-lede[hidden] {
  display: none;
}

p.panel-lede + p {
  margin-top: 8px;
  font-size: 0.86rem;
}

.action-button,
.icon-button {
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--dark-slate);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 680;
}

.action-button {
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.action-button:hover,
.icon-button:hover {
  background: var(--stormy-teal);
}

.nowcast-scenarios-cta {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  margin-bottom: 46px;
  padding: 0 28px;
}

/* L'invitation vers le détail hypothèse par hypothèse suit le bloc de
   synthèse, sans en faire partie. */
.nowcast-scenarios-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  grid-column: 2;
  justify-self: end;
  text-decoration: none;
}

.comparison-controls {
  display: grid;
  gap: 12px;
  padding: 22px 30px 0;
}

.comparison-row {
  display: grid;
  grid-template-columns: 13px minmax(126px, 0.42fr) minmax(210px, 1fr) 34px;
  gap: 12px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(40, 61, 59, 0.12);
}

.comparison-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.comparison-swatch {
  width: 13px;
  height: 13px;
  margin-bottom: 14px;
  border-radius: 50%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.icon-button svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  pointer-events: none;
}

.danger-icon-button {
  position: relative;
  align-self: end;
  justify-self: end;
  border-color: rgba(196, 69, 54, 0.64);
  background: rgba(196, 69, 54, 0.12);
  color: var(--tomato-jam);
}

.danger-icon-button:hover {
  border-color: var(--tomato-jam);
  background: var(--tomato-jam);
  color: #ffffff;
}

.comparison-chart-wrap {
  min-height: 440px;
}

.comparison-chart-wrap svg {
  height: 460px;
  min-height: 440px;
}

.comparison-modal[hidden] {
  display: none;
}

.comparison-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.comparison-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 61, 59, 0.46);
}

.comparison-modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 2px solid var(--dark-slate);
  border-radius: 2px;
  background: var(--panel);
  padding: 24px;
}

.comparison-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.comparison-modal-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.comparison-modal-head .icon-button {
  flex: 0 0 34px;
}

.comparison-modal-tools {
  margin-bottom: 22px;
}

.comparison-modal-tools .time-control {
  width: min(100%, 280px);
}

.comparison-modal-card .comparison-controls {
  padding: 0;
}

.comparison-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.comparison-modal-actions .action-button {
  margin-top: 0;
}

.nowcast-scenario-candidate {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid rgba(40, 61, 59, 0.18);
  border-radius: 99px;
  background: rgba(255, 253, 249, 0.78);
  padding: 2px 8px;
  color: var(--dark-slate);
  font-size: 0.79rem;
  line-height: 1.2;
}

.nowcast-scenario-candidate::before {
  width: 7px;
  height: 7px;
  margin-right: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--scenario-candidate-color);
  content: "";
}

.secondary-action {
  background: var(--panel);
  color: var(--dark-slate);
}

.secondary-action:hover {
  background: rgba(237, 221, 212, 0.42);
  color: var(--dark-slate);
}

/* Invitation au second tour, en bas du premier tour : le second tour est un
   autre jeu de données, pas un filtre, donc il se propose explicitement. */
.second-round-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px 28px;
  flex-wrap: wrap;
  margin-top: 64px;
  padding: 30px 28px;
  border: 2px solid var(--tomato-jam);
  border-radius: 2px;
  background: var(--panel);
}

.second-round-cta[hidden] {
  display: none;
}

.second-round-cta p {
  margin-top: 6px;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.polls-table-panel {
  margin-top: 64px;
  border: 2px solid var(--stormy-teal);
  border-radius: 2px;
  background: var(--panel);
}

.polls-table-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px 28px;
  flex-wrap: wrap;
  padding: 30px 28px 0;
}

.polls-table-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.polls-table-tools {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.polls-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--dark-slate);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.polls-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--stormy-teal);
  cursor: pointer;
}

.polls-sort {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.polls-sort button {
  padding: 0 12px;
  white-space: nowrap;
}

.polls-table-wrap {
  margin-top: 22px;
  max-height: 62vh;
  overflow: auto;
}

.polls-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.82rem;
}

.polls-table th,
.polls-table td {
  border-bottom: 1px solid rgba(40, 61, 59, 0.12);
  white-space: nowrap;
}

.polls-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--soft);
  color: var(--dark-slate);
  font-weight: 700;
  text-align: center;
  padding: 8px 4px;
  border-bottom: 2px solid var(--line-strong);
  vertical-align: bottom;
}

/* Colonne « Sondage » figée à gauche : fond opaque pour masquer les scores
   qui défilent dessous, largeur minimale (width: 1 %). */
.polls-table .polls-th-meta,
.polls-table .polls-td-meta {
  position: sticky;
  left: 0;
  width: 1%;
  text-align: left;
  box-shadow: inset -1px 0 0 rgba(40, 61, 59, 0.14);
}

.polls-table thead .polls-th-meta {
  z-index: 3;
  padding-left: 12px;
}

.polls-table tbody .polls-td-meta {
  z-index: 1;
  max-width: 9.5rem;
  background: var(--panel);
  padding: 7px 10px 7px 12px;
  vertical-align: top;
}

.polls-td-meta > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.polls-meta-sondeur {
  font-weight: 650;
  color: var(--dark-slate);
  line-height: 1.25;
}

.polls-meta-date {
  margin-top: 1px;
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.3;
}

.polls-meta-details {
  display: flex !important;
  gap: 6px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.polls-th-candidate {
  font-weight: 650;
  min-width: 46px;
}

.polls-th-candidate span:last-child {
  display: block;
  line-height: 1.1;
}

.polls-th-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-bottom: 3px;
  border-radius: 50%;
}

.polls-table tbody td {
  padding: 6px 4px;
  vertical-align: middle;
}

.polls-table tbody tr.polls-poll-start td {
  border-top: 1px solid rgba(40, 61, 59, 0.16);
}

.polls-source-link {
  color: var(--stormy-teal);
  text-decoration: none;
}

.polls-source-link:hover {
  text-decoration: underline;
}

.polls-td-score {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.polls-td-score.is-empty {
  color: var(--line);
}

.polls-td-score.is-rank-1 {
  font-weight: 750;
}

.polls-td-score.is-rank-2 {
  font-weight: 680;
}

@media (max-width: 640px) {
  .polls-table {
    font-size: 0.74rem;
  }

  .polls-table thead th {
    padding: 7px 2px;
  }

  .polls-table tbody td {
    padding: 5px 2px;
  }

  .polls-th-candidate {
    min-width: 38px;
  }

  .polls-table tbody .polls-td-meta {
    max-width: 6.6rem;
    padding: 6px 6px 6px 8px;
  }

  .polls-table thead .polls-th-meta {
    padding-left: 8px;
  }

  .polls-meta-date {
    font-size: 0.7rem;
  }

  .polls-meta-details {
    font-size: 0.64rem;
    flex-wrap: wrap;
    gap: 0 5px;
  }
}

@media (max-width: 860px) {
  .polls-table-head {
    padding: 22px 16px 0;
  }

  p.panel-lede {
    font-size: 0.97rem;
  }

}

@media (max-width: 1280px) {
  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .legend {
    flex-wrap: wrap;
  }

}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 1360px);
    padding: 18px 0 24px;
  }

  .topbar,
  .chart-head,
  .comparison-head {
    display: block;
  }

  .topbar {
    margin-bottom: 22px;
  }

  .source {
    margin-top: 10px;
    text-align: left;
    white-space: normal;
  }

  .freshness {
    max-width: none;
    text-align: left;
  }

  .top-actions {
    align-items: flex-start;
    margin-top: 18px;
  }

  .election-control {
    width: 112px;
  }

  .round-modebar {
    min-height: 56px;
    margin-bottom: 22px;
    padding: 13px 16px;
  }

  .filters-card {
    margin: 16px 16px 0;
    padding: 16px;
  }

  .chart-actions {
    width: min(100%, 390px);
    margin-top: 18px;
    padding-top: 0;
  }

  .action-button {
    margin-top: 16px;
  }

  .duel-mosaic-head {
    display: block;
  }

  .filters-head {
    margin-bottom: 15px;
  }

  .nowcast-panel,
  .nowcast-score-panel {
    padding: 20px 16px;
  }

  .nowcast-scenarios-cta {
    grid-template-columns: 1fr;
    margin-bottom: 38px;
    padding: 0 16px;
  }

  .nowcast-scenarios-link {
    grid-column: 1;
  }

  .nowcast-head {
    display: block;
  }

  /* Le bouton d'export reste à droite du titre, comme sur ordinateur. */
  .nowcast-panel > .nowcast-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .nowcast-overview {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }

  .nowcast-overview-column {
    display: block;
    min-width: 0;
  }

  /* L'évolution passe sous la liste quand les deux colonnes ne tiennent plus. */
  .nowcast-overview-column.is-history {
    margin-top: 8px;
  }

  .nowcast-overview-list {
    min-height: 0;
    gap: 9px;
    border: 0;
    background: transparent;
    padding: 0;
  }

  .nowcast-overview-row {
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    padding: 12px 13px 10px;
  }

  .nowcast-overview-row + .nowcast-overview-row {
    border-top: 1px solid var(--line);
  }

  .nowcast-overview-gauge {
    height: 7px;
    margin: 10px 0 8px;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  svg {
    height: 560px;
  }

  .comparison-row {
    grid-template-columns: 13px minmax(100px, 0.48fr) minmax(170px, 1fr) 34px;
  }

  .comparison-modal-card {
    max-height: calc(100vh - 32px);
    padding: 18px;
  }

}

@media (max-width: 560px) {
  h1 {
    font-size: 2rem;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .scenario-notice {
    font-size: 0.82rem;
  }

  .chart-head {
    padding: 22px 16px 0;
  }

  .chart-actions {
    grid-template-columns: minmax(108px, 0.58fr) minmax(200px, 1.42fr);
    gap: 8px;
  }

  .legend-panel {
    padding: 16px;
  }

  .legend-head {
    gap: 12px;
  }

  .legend-item {
    min-height: 29px;
    padding: 4px 8px;
  }

  .comparison-head,
  .comparison-controls {
    padding-left: 16px;
    padding-right: 16px;
  }

  .comparison-row {
    grid-template-columns: 13px minmax(0, 1fr) 34px;
  }

  .comparison-row .control:nth-of-type(2) {
    grid-column: 2 / 4;
  }

  .comparison-swatch {
    grid-row: 1 / 3;
  }

  .comparison-row > .icon-button {
    grid-column: 3;
    grid-row: 1;
  }

  .comparison-modal {
    padding: 12px;
  }

  .comparison-modal-head,
  .comparison-modal-actions {
    display: grid;
  }

  .comparison-modal-actions .action-button {
    width: 100%;
  }

  .chart-wrap {
    min-height: 500px;
  }

  .time-range-editor {
    margin: 0 16px 16px;
    padding: 13px 12px 10px;
  }

  .time-range-editor-head {
    display: block;
  }

  .time-range-editor output {
    display: block;
    margin-top: 7px;
    white-space: normal;
  }

  svg {
    height: 500px;
    min-height: 500px;
  }

}

@media (max-width: 360px) {
  .chart-actions {
    grid-template-columns: 1fr;
  }

}

/* --- Page « toutes les hypothèses » ---------------------------------------
   Un bloc par liste de candidats réellement sondée : les probabilités à
   gauche, l'évolution à droite. La page d'accueil ne montre que la synthèse ;
   c'est ici qu'on déplie hypothèse par hypothèse. */
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--stormy-teal);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

.scenarios-intro {
  max-width: 78ch;
}

.scenarios-page .intro {
  max-width: 940px;
}

.scenarios-page .tagline {
  max-width: 88ch;
}

.scenarios-list {
  display: grid;
  gap: 26px;
  margin-top: 34px;
}

.scenario-block {
  border: 2px solid var(--dark-slate);
  border-radius: 2px;
  background: var(--panel);
  padding: 24px 26px 26px;
}

.scenario-block-head h3 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 720;
  line-height: 1.3;
  color: var(--dark-slate);
}

.scenario-block-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.scenario-block-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
}

.scenario-block-chips-legend {
  color: var(--muted);
  font-size: 0.78rem;
}

.scenario-block-warning {
  margin: 14px 0 0;
  border-left: 3px solid rgba(40, 61, 59, 0.3);
  background: rgba(40, 61, 59, 0.05);
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.scenario-block-body {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 22px;
  margin-top: 20px;
  align-items: start;
}

.scenario-block-list {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 4px;
  min-width: 0;
}

.scenario-candidate-row {
  min-width: 0;
  padding: 7px 8px;
}

.scenario-candidate-row + .scenario-candidate-row {
  border-top: 1px solid var(--line);
}

.scenario-block-chart {
  min-width: 0;
}

.scenario-block-chart h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scenario-chart-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  padding: 6px 8px;
  min-width: 0;
}

/* La règle générale `svg` impose la hauteur du grand graphique : ces
   mini-courbes tiennent leur hauteur de leur propre viewBox. */
.scenario-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
}

.scenarios-status {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.92rem;
}

.scenarios-status[hidden] {
  display: none;
}

.scenarios-method-note {
  margin-top: 40px;
}

/* La page de méthode reste volontairement proche d'un article : une colonne,
   peu de niveaux de titres et aucun composant décoratif. */
.methodology-topbar {
  margin-bottom: 14px;
}

.methodology-article {
  max-width: 740px;
}

.methodology-hero {
  padding: 20px 0 32px;
  border-bottom: 1px solid var(--line);
}

.methodology-hero h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.65rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.methodology-lede {
  margin-top: 16px;
  color: var(--stormy-teal);
  font-size: 1.08rem;
  font-weight: 520;
  line-height: 1.55;
}

.methodology-section {
  padding: 30px 0 4px;
}

.methodology-section h3 {
  margin: 0 0 12px;
  color: var(--dark-slate);
  font-size: 1.22rem;
  line-height: 1.25;
}

.methodology-section p {
  color: #3f504d;
  font-size: 1rem;
  line-height: 1.7;
}

.methodology-section p + p {
  margin-top: 14px;
}

.methodology-section em {
  color: var(--dark-slate);
  font-style: normal;
  font-weight: 680;
}

.methodology-limits {
  margin-top: 26px;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .scenario-block {
    padding: 20px 16px 22px;
  }

  .scenario-block-body {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .scenarios-list {
    gap: 22px;
  }

}

/* The two independent disclosures keep each nowcast chart's display controls out of the way. */
.nowcast-candidate-toolbar { display: flex; justify-content: flex-end; margin: 12px 0; }
.nowcast-candidate-picker { position: relative; }
.nowcast-candidate-picker summary { cursor: pointer; border: 1px solid var(--line); padding: 9px 12px; font-size: 0.85rem; font-weight: 650; }
.nowcast-candidate-picker[open] summary { background: #edddd4; }
.nowcast-candidate-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: min(320px, calc(100vw - 64px)); padding: 12px; border: 1px solid var(--muted); background: #fff; }
.nowcast-candidate-menu p { margin: 0 0 8px; font-size: 0.78rem; color: var(--muted); }
.nowcast-candidate-menu [role="group"] { max-height: 300px; overflow-y: auto; }
.nowcast-candidate-option { display: flex; align-items: center; gap: 9px; min-height: 42px; cursor: pointer; font-size: 0.85rem; }
.nowcast-candidate-option:hover { background: #f7f4f0; }
.nowcast-candidate-option input { width: 17px; height: 17px; accent-color: #197278; flex-shrink: 0; }
.nowcast-candidate-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.nowcast-candidate-reset { margin-top: 10px; padding: 9px 0; border: 0; background: transparent; color: #197278; text-decoration: underline; cursor: pointer; font: inherit; font-size: 0.8rem; }

/* Fiche détaillée d'un sondage : ouverte depuis une ligne du tableau ou un
   point du graphique. Une carte par hypothèse (ou par duel), les candidats en
   liste avec une barre fine à l'échelle du meilleur score du sondage, pour que
   les hypothèses se comparent d'un coup d'œil. */
.polls-table tbody tr[data-poll-id] {
  cursor: pointer;
}

.polls-table tbody tr[data-poll-id]:focus-visible {
  outline: 2px solid var(--da-accent, var(--accent));
  outline-offset: -2px;
}

.chart-wrap.is-over-point {
  cursor: pointer;
}

/* Au doigt, glisser horizontalement déplace la barre de lecture ; le
   défilement vertical de la page reste libre. */
#chart {
  touch-action: pan-y;
}

.chart-scrub {
  pointer-events: none;
}

.chart-scrub-rule {
  stroke: var(--ink, #222);
  stroke-width: 1;
  opacity: 0.45;
}

.tooltip.is-scrub {
  min-width: 150px;
}

.tooltip.is-scrub ol {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.tooltip.is-scrub li {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 7px;
  line-height: 1.5;
}

.tooltip.is-scrub li i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tooltip.is-scrub li span {
  display: inline;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tooltip.is-scrub li b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.poll-modal[hidden] {
  display: none;
}

.poll-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.poll-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 61, 59, 0.36);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.poll-modal-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(840px, calc(100vh - 48px));
  overflow: hidden;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(40, 61, 59, 0.28);
  animation: poll-modal-in 0.2s ease-out;
}

.poll-modal-card.is-multi {
  width: min(940px, 100%);
}

.poll-modal-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 26px 28px 18px;
  border-bottom: 1px solid rgba(46, 107, 98, 0.10);
}

.poll-modal-eyebrow {
  margin: 0 0 4px;
  color: var(--da-accent, var(--accent));
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.poll-modal-head h2 {
  margin: 0;
  color: var(--da-green, var(--ink));
  font-family: var(--da-heading-font, inherit);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.poll-modal-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.poll-modal-head-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.poll-modal-head .icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--da-pill-bg, var(--soft));
  color: var(--da-green, var(--ink));
  font-size: 1.3rem;
  line-height: 1;
}

.poll-modal-head .icon-button:hover {
  background: var(--da-pill-bg-hover, var(--surface));
}

.poll-modal-head .icon-button[hidden] {
  display: none;
}

.poll-modal-head .icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.poll-modal-export svg {
  width: 17px;
  height: 17px;
  min-height: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.poll-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 28px 22px;
}

.poll-modal-card.is-multi .poll-modal-body {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
  align-items: start;
}

.poll-scenario {
  margin: 0;
}

.poll-modal-card.is-multi .poll-scenario {
  padding: 16px 18px 14px;
  border-radius: 18px;
  background: rgba(46, 107, 98, 0.05);
}

.poll-scenario h3 {
  margin: 0 0 10px;
  color: var(--da-green, var(--ink));
  font-family: var(--da-heading-font, inherit);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.poll-scenario-variant {
  font-weight: 400;
}

.poll-scenario-meta {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.poll-scenario-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.poll-candidate {
  display: grid;
  grid-template-columns: 20px minmax(0, 12.5rem) minmax(40px, 1fr) 3.1rem;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin: 0 -8px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.86rem;
}

/* Les deux qualifiés (le vainqueur au second tour) sur fond vert, avec une
   coche ; une égalité à cheval sur la dernière place, sur fond orange avec un
   point d'interrogation. */
.poll-candidate.is-qualified {
  background: rgba(47, 138, 93, 0.13);
}

.poll-candidate.is-tied {
  background: rgba(229, 132, 38, 0.16);
}

.poll-candidate-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* La règle globale `svg` des graphiques impose une hauteur minimale. */
.poll-candidate-mark svg {
  display: block;
  flex: none;
  width: 11px;
  height: 11px;
  min-height: 0;
}

.poll-candidate.is-qualified .poll-candidate-mark {
  background: #2f8a5d;
}

.poll-candidate.is-tied .poll-candidate-mark {
  background: #d9771e;
}

.poll-candidate-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  white-space: nowrap;
}

.poll-candidate-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poll-candidate-name small {
  flex: none;
  color: var(--muted);
  font-size: 0.7rem;
}

.poll-candidate-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(40, 61, 59, 0.07);
}

.poll-candidate-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--candidate-color);
  opacity: 0.45;
  transform-origin: left center;
  animation: poll-bar-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.poll-candidate-score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.poll-candidate.is-qualified .poll-candidate-bar span,
.poll-candidate.is-tied .poll-candidate-bar span {
  opacity: 1;
}

.poll-candidate.is-qualified .poll-candidate-label,
.poll-candidate.is-qualified .poll-candidate-score,
.poll-candidate.is-tied .poll-candidate-label {
  color: var(--da-green, var(--ink));
  font-weight: 600;
}

.poll-candidate.is-tied .poll-candidate-score {
  color: #a4520f;
  font-weight: 600;
}

.poll-modal-foot[hidden] {
  display: none;
}

.poll-modal-foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 28px 20px;
  border-top: 1px solid rgba(46, 107, 98, 0.10);
}

.poll-modal-document {
  flex: none;
  display: inline-flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--da-accent, var(--accent));
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.poll-modal-document:hover {
  background: var(--da-green, var(--ink));
}

.poll-modal-document:focus-visible {
  outline: 2px solid var(--da-accent, var(--accent));
  outline-offset: 3px;
}

/* La règle globale `svg` des graphiques impose une hauteur minimale. */
.poll-modal-document svg {
  display: block;
  flex: none;
  width: 15px;
  height: 15px;
  min-height: 0;
}

/* Onglets Sondage / Évolution : le contrôle segmenté du site, à deux choix. */
.segmented.poll-modal-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 250px);
  min-height: 38px;
  margin-top: 14px;
}

/* Colonne d'écart de l'onglet Sondage, quand l'institut avait déjà testé la
   même liste : « vs 8 juil. » en tête, « +1,5 » sur chaque ligne. */
.poll-scenario.has-delta .poll-candidate {
  grid-template-columns: 20px minmax(0, 12.5rem) minmax(40px, 1fr) 3.1rem 2.6rem;
}

.poll-candidate-delta {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.poll-delta-head {
  margin: -6px 0 4px;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
  white-space: nowrap;
}

/* Choix de la vague comparée : un lien discret avec chevron plutôt qu'un champ. */
.poll-delta-select {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0 12px 0 1px;
  border: 0;
  border-radius: 4px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%232c5f57' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right center / 8px 5px;
  color: var(--da-accent, var(--accent));
  font: inherit;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}

.poll-delta-select:hover {
  color: var(--da-green, var(--ink));
}

.poll-delta-select:focus-visible {
  outline: 2px solid var(--da-accent, var(--accent));
  outline-offset: 2px;
}

/* Onglet Évolution : un mini-graphique par hypothèse, toutes les courbes
   ensemble. Survoler une courbe l'isole. */
.poll-evo-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: visible;
  margin-top: 2px;
}

.poll-evo-grid {
  stroke: rgba(40, 61, 59, 0.08);
  stroke-width: 1;
}

.poll-evo-tick {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.poll-evo-current {
  stroke: rgba(40, 61, 59, 0.3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.poll-evo-series {
  transition: opacity 0.15s ease;
}

.poll-evo-chart:hover .poll-evo-series {
  opacity: 0.25;
}

.poll-evo-chart .poll-evo-series:hover {
  opacity: 1;
}

.poll-evo-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 9;
  pointer-events: stroke;
}

.poll-evo-line {
  fill: none;
  stroke: var(--candidate-color);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.poll-evo-line.is-strong {
  stroke-width: 2.6;
  opacity: 1;
}

.poll-evo-series circle {
  fill: var(--candidate-color);
  stroke: var(--panel);
  stroke-width: 1;
}

.poll-evo-leader {
  fill: none;
  stroke: var(--candidate-color);
  stroke-width: 0.8;
  opacity: 0.45;
}

.poll-evo-label {
  fill: color-mix(in srgb, var(--candidate-color) 72%, #283d3b);
  font-size: 10.5px;
  font-weight: 500;
}

.poll-evo-label.is-strong {
  font-weight: 700;
}

.poll-evolution-empty {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

@keyframes poll-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

@keyframes poll-bar-in {
  from {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .poll-modal-card,
  .poll-candidate-bar span {
    animation: none;
  }
}

@media (max-width: 560px) {
  .poll-modal {
    padding: 10px;
  }

  .poll-modal-card {
    max-height: calc(100vh - 20px);
    border-radius: 24px;
  }

  .poll-modal-head {
    padding: 20px 20px 14px;
  }

  .poll-modal-head h2 {
    font-size: 1.25rem;
  }

  .poll-modal-body {
    padding: 16px 20px 18px;
  }

  .poll-modal-foot {
    padding: 12px 20px 16px;
  }

  .poll-candidate {
    grid-template-columns: 20px minmax(0, 1fr) 3.2rem;
    row-gap: 4px;
    padding-block: 5px;
  }

  .poll-candidate-bar {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .poll-modal-document {
    width: 100%;
  }

  .poll-scenario.has-delta .poll-candidate {
    grid-template-columns: 20px minmax(0, 1fr) 3.2rem 2.4rem;
  }
}
