.stats-body { min-height: 100vh; background: var(--paper); }
.stats-topbar { grid-template-columns: 280px 1fr 140px; }
.stats-paint { display: grid; place-items: center; align-self: stretch; text-decoration: none; box-shadow: none; border-width: 0 0 0 2px; }
.stats-shell { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; }
.stats-hero { display: grid; grid-template-columns: 1fr minmax(280px, 470px); gap: 50px; align-items: end; padding-bottom: 42px; border-bottom: 2px solid var(--ink); }
.stats-hero h1 { margin: 0; font-size: clamp(54px, 9vw, 116px); line-height: .82; letter-spacing: -.075em; }
.stats-hero h1 em { color: var(--blue); font-style: normal; }
.stats-hero > p { margin: 0 0 8px; font: 12px/1.7 ui-monospace, monospace; }
.stats-kpis { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid var(--ink); border-top: 0; }
.stats-kpis article { min-width: 0; padding: 23px; border-right: 1px solid var(--ink); background: rgba(255,255,255,.22); }
.stats-kpis article:nth-child(3n) { border-right: 0; }
.stats-kpis article:nth-child(-n+3) { border-bottom: 1px solid var(--ink); }
.stats-kpis span, .stats-kpis strong, .stats-kpis small { display: block; }
.stats-kpis span { color: var(--orange); font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.stats-kpis strong { margin: 8px 0 5px; font-size: clamp(30px, 4vw, 52px); letter-spacing: -.06em; overflow: hidden; text-overflow: ellipsis; }
.stats-kpis small { color: var(--muted); font: 9px/1.45 ui-monospace, monospace; }
.stats-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.stats-card, .audience-card, .history-lab, .history-media { border: 2px solid var(--ink); background: rgba(255,255,255,.25); box-shadow: 6px 6px 0 var(--ink); }
.stats-card { padding: 25px; min-width: 0; }
.stats-card > header, .history-lab > header { display: flex; justify-content: space-between; gap: 25px; align-items: end; border-bottom: 1px solid var(--ink); padding-bottom: 15px; }
.stats-card h2, .history-lab h2, .audience-card h2 { margin: 0; font-size: clamp(22px, 3vw, 34px); line-height: .96; letter-spacing: -.05em; text-transform: uppercase; }
.stats-card header > p, .history-lab header > p { max-width: 210px; margin: 0; color: var(--muted); text-align: right; font: 9px/1.5 ui-monospace, monospace; }
.bar-chart { display: grid; gap: 10px; margin: 24px 0; }
.bar-row { display: grid; grid-template-columns: 112px 1fr 65px; gap: 9px; align-items: center; font-size: 9px; }
.bar-row > span:first-child { color: var(--muted); }
.bar-track { height: 13px; background: rgba(18,18,18,.08); border-left: 1px solid var(--ink); }
.bar-track i { display: block; width: var(--bar); height: 100%; background: var(--blue); min-width: 1px; }
.bar-row strong { text-align: right; font: 800 9px ui-monospace, monospace; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid var(--ink); }
.metric-row div { padding: 14px 8px 0; border-right: 1px solid var(--line); }
.metric-row div:last-child { border-right: 0; }
.metric-row dt { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.metric-row dd { margin: 5px 0 0; font-size: 17px; font-weight: 900; }
.activity-chart { height: 210px; display: flex; align-items: end; gap: 3px; padding-top: 22px; border-bottom: 1px solid var(--ink); }
.activity-day { flex: 1 1 0; min-width: 3px; display: flex; flex-direction: column-reverse; height: 100%; justify-content: flex-start; }
.activity-day i { display: block; min-height: 1px; }
.activity-day .claim, .chart-key .claim { background: var(--blue); }
.activity-day .takeover, .chart-key .takeover { background: var(--orange); }
.activity-day .recolor, .chart-key .recolor { background: var(--acid); }
.chart-key { display: flex; gap: 15px; margin-top: 10px; justify-content: end; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.chart-key i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border: 1px solid var(--ink); }
.split-card { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.split-card > div + div { border-left: 1px solid var(--ink); padding-left: 22px; }
.contested-list { list-style: none; margin: 16px 0 0; padding: 0; }
.contested-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; border-top: 1px dotted var(--line); padding: 8px 0; font-size: 10px; }
.contested-list a { color: var(--blue); font-weight: 850; }
.contested-list span { color: var(--muted); font: 8px ui-monospace, monospace; }
.palette-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.palette-stat { aspect-ratio: 1; border: 1px solid var(--ink); display: grid; place-items: end start; padding: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
.palette-stat span { background: var(--paper); padding: 2px 3px; color: var(--ink); font: 7px ui-monospace, monospace; }
.history-lab { margin-top: 22px; padding: 28px; }
.history-stage { width: min(780px, 100%); margin: 28px auto 20px; border: 2px solid var(--ink); box-shadow: 7px 7px 0 var(--ink); }
#history-canvas { display: block; width: 100%; aspect-ratio: 1; background: #f7f3e8; image-rendering: pixelated; }
.playback-controls { display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 16px; }
.playback-controls .primary { padding: 10px; }
.playback-controls input { width: 100%; accent-color: var(--blue); }
.speed-label { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.speed-label select { margin-left: 5px; padding: 7px; border: 1px solid var(--ink); background: var(--paper); }
.history-status { min-height: 20px; margin: 14px 0 0; color: var(--muted); font: 9px/1.5 ui-monospace, monospace; text-align: center; }
.history-media { margin-top: 22px; padding: 28px; }
.history-media > header { display: flex; justify-content: space-between; gap: 25px; align-items: end; border-bottom: 1px solid var(--ink); padding-bottom: 15px; }
.history-media h2 { margin: 0; font-size: clamp(22px, 3vw, 34px); line-height: .96; letter-spacing: -.05em; text-transform: uppercase; }
.history-media header > p { max-width: 260px; margin: 0; color: var(--muted); text-align: right; font: 9px/1.5 ui-monospace, monospace; }
.history-media video { display: block; width: min(780px, 100%); aspect-ratio: 1; margin: 28px auto 0; border: 2px solid var(--ink); background: #f7f3e8; box-shadow: 7px 7px 0 var(--ink); image-rendering: pixelated; }
.audience-card { display: grid; grid-template-columns: minmax(220px, .8fr) 1.2fr; gap: 35px; align-items: center; margin-top: 22px; padding: 28px; }
.audience-card > p { color: var(--muted); font: 10px/1.6 ui-monospace, monospace; }
.audience-windows { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); }
.audience-windows div { padding: 14px; border-right: 1px solid var(--line); }
.audience-windows div:last-child { border: 0; }
.audience-windows strong, .audience-windows span { display: block; }
.audience-windows strong { font-size: 25px; }
.audience-windows span { color: var(--muted); font-size: 8px; }
.audience-card .methodology { grid-column: 2; margin: -20px 0 0; }
.stats-generated { color: var(--muted); margin: 24px 0 0; text-align: right; font: 8px ui-monospace, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .stats-topbar { grid-template-columns: 150px 1fr; }
  .stats-shell { width: min(100% - 24px, 650px); padding-top: 30px; }
  .stats-hero, .stats-grid-two, .audience-card { grid-template-columns: 1fr; }
  .stats-hero { gap: 24px; }
  .stats-kpis { grid-template-columns: 1fr 1fr; }
  .stats-kpis article:nth-child(n) { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
  .stats-kpis article:nth-child(2n) { border-right: 0; }
  .stats-kpis article:nth-last-child(-n+2) { border-bottom: 0; }
  .stats-card > header, .history-lab > header, .history-media > header { display: block; }
  .stats-card header > p, .history-lab header > p, .history-media header > p { margin-top: 10px; text-align: left; }
  .audience-card .methodology { grid-column: 1; margin: -15px 0 0; }
}
@media (max-width: 480px) {
  .stats-kpis { grid-template-columns: 1fr; }
  .stats-kpis article:nth-child(n) { border-right: 0; border-bottom: 1px solid var(--ink); }
  .stats-kpis article:last-child { border-bottom: 0; }
  .split-card { grid-template-columns: 1fr; }
  .split-card > div + div { border-left: 0; border-top: 1px solid var(--ink); padding: 20px 0 0; }
  .bar-row { grid-template-columns: 82px 1fr 48px; }
  .metric-row { grid-template-columns: 1fr; }
  .metric-row div { border-right: 0; }
  .history-lab { padding: 18px; }
  .playback-controls { grid-template-columns: 80px 1fr; }
  .speed-label { grid-column: 1/-1; }
  .audience-windows { grid-template-columns: 1fr; }
  .audience-windows div { border-right: 0; border-bottom: 1px solid var(--line); }
}
