:root {
  --bg: #f1efed; --surface: #ffffff; --surface-2: #f5f4f2; --line: #e4e1dd; --grid: #e9e7e4;
  --ink: #161513; --ink-soft: #4f4a45; --axis: #161513; --nav: #211e1c;
  --feature: #312d2a; --on-feature: #ffffff;
  --col-c: #33553c; --col-w: #227e9e; --on-faction: #ffffff;
  --gold: #f0cc71; --gold-soft: #f7e0a1; --link: #006b8f; --focus: #227e9e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --surface: #211e1c; --surface-2: #2b2724; --line: #3a3531; --grid: #302c29;
    --ink: #f1efed; --ink-soft: #bdb6af; --axis: #a8a29c; --nav: #0e0d0c;
    --feature: #f1efed; --on-feature: #161513;
    --col-c: #6c9a6f; --col-w: #6cc3e3; --on-faction: #161513; --link: #6cc3e3; --focus: #6cc3e3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --surface: #211e1c; --surface-2: #2b2724; --line: #3a3531; --grid: #302c29;
  --ink: #f1efed; --ink-soft: #bdb6af; --axis: #a8a29c; --nav: #0e0d0c;
  --feature: #f1efed; --on-feature: #161513;
  --col-c: #6c9a6f; --col-w: #6cc3e3; --on-faction: #161513; --link: #6cc3e3; --focus: #6cc3e3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, sans-serif; font-size: 16px; line-height: 24px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1600px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 72px); }

nav.top { background: var(--nav); }
nav.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
nav.top a.tab { display: flex; align-items: center; height: 64px; padding: 0 16px; font-size: 14px; font-weight: 600; color: #fff; }
nav.top a.tab:hover { text-decoration: none; background: rgba(255, 255, 255, 0.06); }
nav.top a.tab[aria-current="page"] { box-shadow: inset 0 -5px 0 var(--gold-soft); }
nav.top .spacer { flex: 1 1 auto; }
.ghost-btn, nav.top select {
  min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border: 1px solid #47423e; border-radius: 4px; background: transparent; color: #fff;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
nav.top select option { color: #161513; }
[hidden] { display: none !important; }

header.hero { padding: 48px 0 24px; }
header.hero .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hero-text { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
h1, h2 { font-family: Parisienne, cursive; font-weight: 400; margin: 0; }
h1 { font-size: 64px; line-height: 76px; }
h2 { font-size: 36px; line-height: 44px; }
.rule { width: 40px; height: 4px; background: var(--gold); }
.lead { margin: 0; font-size: 18px; line-height: 27px; font-weight: 350; }
.meta { font-size: 14px; color: var(--ink-soft); }

main .wrap { display: flex; flex-direction: column; gap: 32px; padding-bottom: 48px; }

/* 4 tiles in one row, 2×2 on tablets, one column on phones: never a lone tile in a row. */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.score { display: inline-flex; align-items: center; gap: 10px; }
.score .swatch { width: 14px; height: 14px; border-radius: 3px; }
.score .sep { color: var(--ink-soft); }
.sites-line { margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.sites-line span { display: inline-flex; align-items: center; gap: 8px; }
.kpi { background: var(--surface); border-radius: 15px; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; }
.kpi.feature { background: var(--feature); color: var(--on-feature); }
.kpi .label { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 40px; line-height: 48px; font-weight: 300; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; line-height: 20px; }

.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.swatch.c { background: var(--col-c); }
.swatch.w { background: var(--col-w); }

.panel { background: var(--surface); border-radius: 15px; padding: 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-head p, .panel > p { margin: 0; font-size: 16px; line-height: 24px; font-weight: 350; }
.legend { display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px; font-weight: 500; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend .line { width: 16px; height: 0; border-top: 3px solid; }
.legend .line.c { border-color: var(--col-c); }
.legend .line.w { border-color: var(--col-w); border-top-style: dashed; }
.legend .line.goal { border-color: var(--ink-soft); border-top-width: 1px; border-top-style: dashed; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 32px; }
.note { font-size: 12px; line-height: 20px; color: var(--ink-soft); margin: 0; }
.empty { padding: 32px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; color: var(--ink-soft); font-size: 14px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--ink-soft); font-size: 12px; font-family: Inter, system-ui, sans-serif; }
.chart .readout {
  position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 12px; font-size: 12px; line-height: 18px; white-space: nowrap; display: none;
}

.table-box { overflow-x: auto; }
.scroll-x { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
th { text-align: left; font-size: 12px; font-weight: 600; padding: 12px 16px; background: var(--surface-2); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 600; }
.pair { display: inline-flex; gap: 6px; align-items: center; }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.events li { display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.events time { font-size: 12px; color: var(--ink-soft); min-width: 120px; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--on-faction); }
.badge.c { background: var(--col-c); }
.badge.w { background: var(--col-w); }
.badge.n { background: var(--surface-2); color: var(--ink); }

.bars { display: flex; gap: 12px; }
.bars .y { height: 240px; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; line-height: 12px; text-align: right; width: 28px; flex: none; color: var(--ink-soft); }
.bars .plot { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.bars .area { position: relative; height: 240px; border-bottom: 1px solid var(--axis); display: flex; }
.bars .col { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bars .col div { width: 36%; max-width: 16px; border-radius: 2px 2px 0 0; }
.bars .labels { display: flex; }
.bars .labels > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; }

footer.site { background: var(--surface); border-top: 1px solid var(--line); }
footer.site .wrap { padding-top: 32px; padding-bottom: 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: 12px; line-height: 20px; }
footer.site p { margin: 0; }

.error { background: var(--surface); border-radius: 15px; padding: 24px 32px; }

@media (max-width: 640px) {
  h1 { font-size: 48px; line-height: 58px; }
  .panel { padding: 20px; }
  nav.top a.tab { height: 52px; padding: 0 10px; }
  nav.top .ghost-btn .btn-text { display: none; }
  nav.top .ghost-btn { padding: 10px 12px; }
  nav.top .wrap { flex-wrap: nowrap; }
}
