:root {
  color-scheme: light;
  --ink: #171615;
  --ink-rgb: 23, 22, 21;
  --muted: #706c68;
  --line: #dedbd7;
  --paper: #f4f4f3;
  --paper-rgb: 244, 244, 243;
  --paper-raised: #f4f2f0;
  --card: #fff;
  --accent: #a14142;
  --accent-2: #bd5b55;
  --accent-3: #d17d6d;
  --accent-4: #dfa596;
  --accent-tint: #f0e7e7;
  --deep: #3d3b39;
  --sage: #71877d;
  --ring-empty: #e3e1df;
  --shadow: 0 20px 48px rgba(25, 22, 20, 0.07);
}

/* Mode sombre : piloté par le même attribut data-theme que le site
   principal (voir app/theme-toggle.js et le script anti-flash dans
   index.html). Cette page a son propre jeu de variables (héritage d'une
   feuille de style distincte de style.css), d'où ce bloc séparé. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1efec;
  --ink-rgb: 241, 239, 236;
  --muted: #b6b0a9;
  --line: rgba(255, 255, 255, 0.14);
  --paper: #17161a;
  --paper-rgb: 23, 22, 26;
  --paper-raised: #201f24;
  --card: #232227;
  --accent: #c85f5f;
  --accent-2: #d17d6d;
  --accent-3: #dfa596;
  --accent-4: #e8bdb2;
  --accent-tint: rgba(200, 95, 95, 0.16);
  --deep: #d7d5d2;
  --sage: #9db3a8;
  --ring-empty: #35333a;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Roboto, Arial, sans-serif;
}
.stats-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(24px, 6vw, 120px);
  border-bottom: 1px solid var(--line);
  background: rgba(var(--paper-rgb), 0.95);
  backdrop-filter: blur(12px);
}
.stats-logo img {
  display: block;
  width: 180px;
  height: auto;
}
.stats-header nav {
  display: flex;
  align-items: stretch;
  gap: 28px;
  min-height: 72px;
}
.stats-header nav a {
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.stats-header nav a:hover,
.stats-header nav a.is-active {
  border-color: var(--accent);
  color: var(--accent);
}
.stats-page {
  width: min(1180px, calc(100% - 48px));
  margin: auto;
  padding: 24px 0 110px;
}
.stats-intro {
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.stats-intro > p:last-child {
  max-width: 750px;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.stats-section {
  position: relative;
}
.stats-section + .stats-section {
  margin-top: 18px;
}
.section-heading {
  margin-bottom: 38px;
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.section-heading p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}
@media (min-width: 1100px) {
  .section-heading h2 {
    white-space: nowrap;
  }
}
.counter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.counter {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.counter::after {
  position: absolute;
  right: -22px;
  bottom: -58px;
  color: rgba(161, 65, 66, 0.07);
  font-size: 170px;
  font-weight: 900;
  content: attr(data-index);
}
.counter strong {
  display: block;
  font-size: clamp(54px, 6vw, 84px);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.9;
}
.counter span {
  display: block;
  margin-top: 20px;
  font-size: 15px;
  font-weight: 400;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}
.chart-card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.dashboard-grid--generations {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chart-card--full {
  grid-column: 1/-1;
}
.chart-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.chart-card h3 {
  margin: 0;
  font-size: clamp(18px, 1.8vw, 24px);
  letter-spacing: -0.035em;
}
.chart-info {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color .2s ease, background .2s ease;
}
.chart-info:hover,
.chart-info:focus-visible {
  color: var(--accent);
  background: var(--accent-tint);
}
.chart-info svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.chart-host {
  position: relative;
  min-height: 0;
  padding-top: 24px;
}
.chart-host svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart-scroll {
  overflow-x: auto;
}
.timeline-viewport svg {
  min-width: 900px;
}
.bar-list {
  display: grid;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}
.bar-track {
  position: relative;
  height: 32px;
  border-radius: 0 9px 9px 0;
  background: transparent;
}
.bar-fill {
  position: relative;
  height: 100%;
  min-width: 3px;
  overflow: hidden;
  border-radius: 0 9px 9px 0;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  transform-origin: left;
}
.bar-fill-label {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.bar-fill-label--base {
  color: var(--ink);
}
.bar-value {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
}
.chart-mark {
  cursor: pointer;
  outline: none;
  transition:
    opacity 0.32s ease-out,
    filter 0.32s ease-out;
}
.chart-mark:hover,
.chart-mark:focus,
.chart-mark.is-active {
  filter: saturate(1.08);
}
.chart-host.has-focus .chart-mark:not(.is-active) {
  opacity: 0.18;
}
.chart-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  min-width: 130px;
  max-width: min(340px, calc(100vw - 40px));
  max-height: 70vh;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 9px;
  background: #191817;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  animation: stats-tooltip-in 0.18s ease-out both;
}
.chart-tooltip[hidden] {
  display: none;
}
@keyframes stats-tooltip-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.polar-layout {
  display: grid;
  justify-items: center;
  gap: 18px;
}
.polar-layout svg {
  width: min(100%, 240px);
}
.chart-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  width: 100%;
  gap: 8px;
}
.chart-legend--geography {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 9px;
  align-items: center;
  font-size: 13px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-row strong {
  font-size: 15px;
}
.chart-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.format-track {
  display: flex;
  gap: 5px;
  height: 38px;
  margin: 12px 0 22px;
}
.format-segment {
  min-width: 5px;
  border: 0;
  border-radius: 9px;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.format-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
#status-chart .format-grid {
  grid-template-columns: repeat(3, 1fr);
}
.format-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.format-item strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}
.empty-status {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 32px;
  min-height: 280px;
}
.empty-donut {
  display: grid;
  width: 168px;
  height: 168px;
  place-items: center;
  border: 24px solid var(--ring-empty);
  border-radius: 50%;
  color: var(--muted);
  text-align: center;
}
.empty-donut strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
}
.empty-copy h4 {
  margin: 0;
  font-size: 22px;
}
.empty-copy p {
  max-width: 420px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.status-donut { display:grid; grid-template-columns:minmax(180px,240px) minmax(0,1fr); align-items:center; gap:24px; }
.status-donut svg { width:100%; height:auto; }
.generation-key {
  margin-top: 18px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.generation-key summary {
  cursor: pointer;
  font-weight: 700;
}
.generation-key-content,
.generation-key > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 20px;
}
.generation-key article {
  padding: 14px;
  border-radius: 10px;
  background: var(--paper-raised);
}
.generation-key h4 {
  margin: 0 0 7px;
  color: var(--accent);
}
.generation-key p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 1050px) {
  .stats-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 16px;
  }
  .stats-header nav {
    width: 100%;
    gap: 20px;
    overflow-x: auto;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .chart-card--full {
    grid-column: auto;
  }
  .generation-key-content,
  .generation-key > div {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 680px) {
  .stats-header {
    position: relative;
    padding-inline: 20px;
  }
  .stats-logo img {
    width: 150px;
  }
  .stats-header nav {
    min-height: 56px;
  }
  .stats-page {
    width: min(100% - 32px, 720px);
    padding-top: 22px;
  }
  .stats-intro {
    padding-bottom: 54px;
  }
  .counter-grid {
    grid-template-columns: 1fr;
  }
  .counter {
    min-height: 150px;
  }
  .dashboard-grid {
    gap: 12px;
  }
  .chart-card {
    padding: 20px 16px;
  }
  .format-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .format-item small {
    font-size: 10px;
    line-height: 1.2;
  }
  .format-item strong {
    margin-top: 3px;
    font-size: 16px;
  }
  .chart-legend {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .chart-legend--geography {
    grid-template-columns: repeat(2, 1fr);
  }
  .legend-row {
    grid-template-columns: 8px auto auto;
    gap: 4px;
    align-items: baseline;
  }
  .legend-row strong {
    grid-column: auto;
    font-size: 13px;
  }
  .empty-status {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .status-donut { grid-template-columns:1fr; }
  .generation-key-content,
  .generation-key > div {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 1fr 46px;
  }
}
