@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: light-dark(#fafafa, #101010);
  --card: light-dark(#fff, #171717);
  --fg: light-dark(#111, #f3f3f3);
  --muted: light-dark(#5e5e5e, #adadad);
  --rule: light-dark(#dadada, #393939);
  --track: light-dark(#e8e8e8, #343434);
  --subtle: light-dark(#f3f3f3, #202020);
  --bar: light-dark(#777, #909090);
  --accent-ink: light-dark(#007500, #00ff00);
  --accent: #00ff00;
  --radius: .9rem;
  font: 100%/1.45 "Space Grotesk", system-ui, sans-serif;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] { color-scheme: light; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--fg); background: var(--bg); }
button, select { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration-color: var(--accent-ink); text-underline-offset: .2em; }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-ink); outline-offset: 3px;
}
::selection { background: var(--accent); color: #090909; }
.wrap { max-width: 75rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.mast { border-bottom: 1px solid var(--rule); }
.mast-inner { min-height: 4.7rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mast nav { display: flex; align-items: center; gap: .64rem; font-size: 1.14rem; letter-spacing: -.045em; }
.home { color: var(--muted); text-decoration: none; }
.home:hover { color: var(--fg); text-decoration: underline; }
.site-name { font-weight: 700; }
.slash { color: var(--accent-ink); font-weight: 700; letter-spacing: -.12em; margin-right: .04em; }
.theme-control { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: .55rem; border: 1px solid var(--rule); background: var(--card); }
.theme-control button, .page-controls button {
  border: 0; background: transparent; border-radius: .3rem; display: grid; place-items: center; color: var(--muted);
}
.theme-control button { width: 2rem; height: 1.9rem; padding: .42rem; }
.theme-control button:hover, .page-controls button:enabled:hover { background: var(--track); color: var(--fg); }
.theme-control button[aria-pressed="true"] { background: var(--accent); color: #101010; }
.theme-control svg, .page-controls svg, .source-select svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
main.wrap { padding-top: clamp(1.25rem, 3.7vw, 2.8rem); padding-bottom: 3rem; }
h1, h2, p, figure { margin: 0; }
h2 { font-size: 1.38rem; letter-spacing: -.045em; font-weight: 650; line-height: 1.18; }
.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;
}
.hero {
  display: grid; grid-template-columns: minmax(0, 1.82fr) minmax(0, 1fr); align-items: end; gap: clamp(1.4rem, 4vw, 3.2rem);
  padding: clamp(1.5rem, 3.1vw, 2.5rem); border-radius: var(--radius); background: #141414; border: 1px solid light-dark(#141414,#414141); color: #fafafa;
}
.hero-main { min-width: 0; container-type: inline-size; }
.hero h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.06rem; line-height: 1.3; letter-spacing: -.02em; font-weight: 550; }
.tick { width: .49rem; height: .49rem; background: var(--accent); flex-shrink: 0; }
.grand-total {
  margin: .9rem 0 .55rem; font-size: clamp(1.65rem, min(5.4rem, calc(168cqi / var(--digits, 12))), 5.4rem);
  font-weight: 550; letter-spacing: -.065em; font-variant-numeric: tabular-nums; line-height: 1.04;
}
.coverage { color: #c3c3c3; font-size: .92rem; }
.cumulative { min-width: 0; padding-top: .35rem; padding-bottom: .1rem; }
.cumulative figcaption, .spark-dates { color: #c3c3c3; font-size: .8125rem; }
.cumulative figcaption { margin-bottom: .58rem; }
.cumulative svg { display: block; width: 100%; height: 4.1rem; overflow: visible; }
.spark-dates { display: flex; justify-content: space-between; gap: 1rem; margin-top: .38rem; font-variant-numeric: tabular-nums; }
.sync-line { color: var(--muted); font-size: .855rem; display: flex; align-items: center; gap: .85rem; padding: .8rem .12rem; flex-wrap: wrap; }
.freshness { display: inline-flex; align-items: center; gap: .43rem; }
.freshness::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--accent-ink); }
.freshness.late::before { background: var(--muted); }
#updated { border-left: 1px solid var(--rule); padding-left: .85rem; }
.recent { margin-top: .75rem; }
.recent-heading { display: flex; align-items: baseline; gap: 1rem; justify-content: space-between; margin-bottom: .65rem; }
.recent-heading h2 { font-size: 1.13rem; }
.recent-heading > span { font-size: .85rem; color: var(--muted); }
.recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.recent-period { padding: 1rem clamp(.8rem, 2vw, 1.45rem); margin: 0; min-width: 0; container-type: inline-size; }
.recent-period + .recent-period { border-left: 1px solid var(--rule); }
.recent-period dt { font-size: .94rem; font-weight: 600; letter-spacing: -.02em; }
.recent-period dd { margin: 0; }
.recent-period .recent-count { margin-block: .2rem; color: var(--fg); font-size: clamp(1rem, min(2.25rem, calc(165cqi / var(--digits, 1))), 2.25rem); font-weight: 550; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.recent-dates { color: var(--muted); font-size: .82rem; }
.panels { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.15fr); gap: 1rem; margin-top: 1rem; }
.panel, .export, .state { border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius); }
.panel { padding: clamp(1rem, 2.25vw, 1.65rem); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; min-height: 2.2rem; }
.history-range { font-size: .85rem; color: var(--muted); }
.provider-list { margin: .8rem 0 0; padding: 0; list-style: none; }
.provider-row { padding: .85rem 0 .8rem; border-top: 1px solid var(--rule); }
.provider-row:last-child { padding-bottom: 0; }
.provider-values, .provider-meta { display: flex; justify-content: space-between; align-items: baseline; column-gap: .55rem; }
.provider-name { font-size: 1.04rem; font-weight: 650; letter-spacing: -.045em; }
.provider-tokens { font-size: 1.12rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; white-space: nowrap; }
.provider-meta { font-size: .825rem; color: var(--muted); margin-top: .13rem; }
.provider-track { display: block; margin-top: .48rem; height: 3px; background: var(--track); }
.provider-fill { display: block; height: 100%; width: var(--share); min-width: var(--min-bar, 0); background: var(--fg); }
.source-select { position: relative; display: flex; align-items: center; color: var(--fg); }
.source-select select { appearance: none; border: 1px solid var(--rule); border-radius: .4rem; padding: .4rem 1.9rem .4rem .65rem; background: var(--card); font-size: .875rem; line-height: 1.3; }
.source-select svg { pointer-events: none; position: absolute; right: .55rem; width: .9rem; height: .9rem; }
.history-range { min-height: 1.8rem; display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .75rem; }
.page-controls { display: flex; gap: .22rem; }
.page-controls button { border: 1px solid var(--rule); width: 1.6rem; height: 1.6rem; padding: .3rem; }
.page-controls button:disabled { opacity: .3; }
.plot { display: flex; align-items: stretch; gap: .45rem; margin-top: .55rem; }
.axis { display: flex; flex-direction: column; justify-content: space-between; align-items: end; min-width: 2.6rem; margin: -.55rem 0 1.03rem; font-size: .80rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.bars {
  flex: 1; display: flex; min-width: 0; position: relative; align-items: stretch; justify-content: space-around; gap: .1rem;
  --chart-height: 7rem; --month-height: 1.45rem;
  background: repeating-linear-gradient(to top, var(--rule) 0, var(--rule) 1px, transparent 1px, transparent calc(var(--chart-height) / 2));
  background-size: 100% calc(var(--chart-height) + 1px); background-repeat: no-repeat;
}
.month {
  min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 0; padding: 0; border: 0; background: transparent; color: var(--muted); border-radius: .12rem;
}
.bar-track { width: 100%; height: var(--chart-height); display: flex; justify-content: center; align-items: end; }
.bar-fill { width: 55%; max-width: 3.2rem; height: var(--height); min-height: var(--min-bar, 0); background: var(--bar); border-radius: .12rem .12rem 0 0; }
.month:hover .bar-fill { background: var(--fg); }
.month[aria-pressed="true"] .bar-fill { background: var(--accent-ink); }
.month-label { height: var(--month-height); padding-top: .28rem; width: 100%; text-align: center; font-size: .8125rem; }
.month[aria-pressed="true"] .month-label { color: var(--accent-ink); font-weight: 700; }
.selected-month { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-top: .72rem; border-top: 1px solid var(--rule); padding-top: .7rem; font-size: .895rem; color: var(--muted); }
#selected-count { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; text-align: right; }
.empty { color: var(--muted); font-size: .95rem; padding: 1.5rem 0; }
.export {
  padding: 1.25rem clamp(1rem, 2.25vw, 1.65rem); margin-top: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.export h2 { font-size: 1.13rem; }
.export-copy p { margin-top: .36rem; color: var(--muted); font-size: .9rem; max-width: 43rem; }
.export-reading { text-align: right; display: grid; gap: .13rem; flex-shrink: 0; }
.export-reading strong { font-size: 1.43rem; font-weight: 550; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.export-reading span { font-size: .82rem; color: var(--muted); }
.methods { margin-top: .9rem; border-bottom: 1px solid var(--rule); }
.methods summary { display: flex; justify-content: space-between; align-items: center; padding: 1rem .1rem; gap: .6rem; font-size: .97rem; font-weight: 550; list-style: none; }
.methods summary::-webkit-details-marker { display: none; }
.disclosure-icon { position: relative; width: .85rem; height: .85rem; margin-right: .18rem; }
.disclosure-icon::before, .disclosure-icon::after { content: ""; background: currentColor; position: absolute; width: 100%; height: 1.5px; top: calc(50% - .75px); left: 0; }
.disclosure-icon::after { transform: rotate(90deg); }
details[open] .disclosure-icon::after { display: none; }
.method-content { max-width: 56rem; padding: 0 .1rem 1.2rem; color: var(--muted); font-size: .95rem; }
.method-content p { margin: 0 0 .7rem; }
.method-content a { color: var(--fg); }
.state { padding: 1.6rem; }
.action { color: #101010; background: var(--accent); border: 1px solid var(--accent-ink); border-radius: .4rem; margin-top: 1rem; padding: .45rem .75rem; font-weight: 650; font-size: .85rem; }

@media (max-width: 52rem) {
  .panels { grid-template-columns: 1fr 1fr; }
  .bar-fill { width: 65%; }
  .bars.many-months .month-label { font-size: .74rem; }
}
@media (max-width: 44rem) {
  .mast-inner { min-height: 3.85rem; }
  .hero { grid-template-columns: 1fr; gap: 1.15rem; }
  .hero h2 { font-size: 1.02rem; }
  .grand-total { margin-top: .6rem; }
  .cumulative { border-top: 1px solid #3c3c3c; padding-top: .85rem; }
  .cumulative svg { height: 3.2rem; }
  .panels { grid-template-columns: 1fr; }
  .bars.many-months .month-label { font-size: .78rem; }
  .plot { margin-top: .8rem; }
  .export { flex-wrap: wrap; }
  .export-reading { text-align: left; }
}
@media (max-width: 35rem) {
  .recent-grid { grid-template-columns: 1fr; }
  .recent-period { padding: .75rem 1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: .6rem; }
  .recent-period + .recent-period { border-left: 0; border-top: 1px solid var(--rule); }
  .recent-period .recent-count { grid-area: 1 / 2 / 3 / 3; align-self: center; font-size: clamp(1.05rem, min(1.5rem, calc(95cqi / var(--digits, 1))), 1.5rem); }
}
@media (max-width: 27rem) {
  .sync-line { gap: .3rem .65rem; }
  #updated { border: none; padding-left: 0; }
  .history .panel-heading { align-items: center; }
  .bars.many-months .month:nth-child(even):not(:last-child) .month-label { visibility: hidden; }
}
