/* Layout: a score sheet. Header and view tabs, then the state map beside the live mix, then the day as a staff with a playhead. */
:root {
  --bg: #edf0f3;
  --surface: #ffffff;
  --ink: #15212c;
  --muted: #5a6977;
  --line: #d4dbe2;
  --accent: #1d58b8;
  --on-accent: #ffffff;
  --calm: #a9cbea;
  --band0: #d63f28; --band1: #ef9273; --band2: #e6dcd6; --band3: #93bde4; --band4: #2c6db3;
  --band0-ink: #ffffff; --band1-ink: #15212c; --band2-ink: #15212c; --band3-ink: #15212c; --band4-ink: #ffffff;
  --hot: #e2462b;
  --land: #e3e9ef;
  --land-edge: #b6c2cd;
  --nuc: #7550cc;
  --hyd: #2878d0;
  --wnd: #109c93;
  --ren: #d99e0b;
  --gas: #e0652c;
  --dual: #a3402a;
  --oth: #6d6058;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c151e; --surface: #132029; --ink: #e6edf4; --muted: #8ea0b0; --line: #233342;
    --accent: #6ea6ff; --on-accent: #08121c; --calm: #284a6b; --band0: #ff6b46; --band1: #b5503a; --band2: #454c57; --band3: #36679a; --band4: #86bbf5; --band0-ink: #0c151e; --band1-ink: #f3e9e5; --band2-ink: #e6edf4; --band3-ink: #e6edf4; --band4-ink: #0c151e; --hot: #ff6b46;
    --land: #182734; --land-edge: #2e4255;
    --nuc: #a283ff; --hyd: #4f9cff; --wnd: #2bc6ba; --ren: #ffc53d; --gas: #ff8148; --dual: #d4643f; --oth: #9b8d82;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--ink); margin: 0; }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  padding-block: max(28px, env(safe-area-inset-top, 0px)) 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
[hidden] { display: none !important; }
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 22px; }
.view { display: grid; gap: 20px; }

header.site { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 {
  font-family: var(--display); font-weight: 750; font-size: clamp(36px, 6vw, 60px);
  line-height: .95; letter-spacing: -.02em; margin: 4px 0 8px; text-wrap: balance;
}
h1 a { color: inherit; text-decoration: none; }
h2 { font-family: var(--display); font-weight: 750; font-size: clamp(24px, 3.4vw, 32px); line-height: 1.1; letter-spacing: -.01em; margin: 2px 0 4px; text-wrap: balance; }
.lede { margin: 0; max-width: 56ch; color: var(--muted); }
.note { font-size: 12.5px; color: var(--muted); margin: 0; }

.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.title-block { min-width: 0; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg a, .seg button {
  font: 500 13.5px var(--body); color: var(--muted); background: none; border: 0; text-decoration: none;
  padding: 7px 15px; border-radius: 999px; cursor: pointer;
}
.seg [aria-current="page"], .seg [aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.stepper { display: inline-flex; gap: 4px; }
.stepper a { font: 500 13px var(--mono); color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.stepper a:hover { color: var(--ink); }

.play {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font: 600 16px var(--body); color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: 999px; padding: 13px 22px 13px 16px; cursor: pointer;
}
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play[aria-busy="true"] { opacity: .7; cursor: progress; }
a:focus-visible, button:focus-visible, .chart:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; }
.stage { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 820px) { .stage { grid-template-columns: minmax(0, 1fr); } }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h3 { font: 600 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }

#map { width: 100%; height: auto; display: block; }
#map .land { fill: var(--land); stroke: var(--land-edge); stroke-width: 1.2; }
#map .water { font: italic 12px var(--body); fill: var(--muted); opacity: .7; }
#map .zone-label { font: 500 11px var(--body); fill: var(--ink); }
#map .zone-letter { font: 600 10px var(--mono); fill: var(--muted); }
#map .zone-mw { font: 400 10px var(--mono); fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ramp { width: 90px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--calm), var(--hot)); }
.sw-none { width: 12px; height: 8px; border-radius: 2px; background: var(--line); margin-left: 8px; }

.now { display: grid; gap: 14px; align-content: start; }
.clock { font: 500 44px/1 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock small { font-size: 14px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { border-top: 1px solid var(--line); padding-top: 6px; }
.stat .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font: 500 19px var(--mono); font-variant-numeric: tabular-nums; }
.mood { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 6px; width: fit-content; }
.mood i { width: 14px; height: 14px; border-radius: 50%; background: color-mix(in srgb, var(--hot) calc(var(--strain, 0) * 100%), var(--calm)); }

.mix { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.mix li { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 2px 10px; align-items: center; }
.mix .name { font-size: 13px; font-weight: 500; display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.mix .name span { font-weight: 400; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix .mw { font: 400 12px var(--mono); text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.mix .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.mix .bar b { display: block; height: 100%; border-radius: 3px; width: 0; transition: width .12s linear; }

.summary { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.summary strong { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.summary a { color: var(--ink); }
.chart, .bars { display: block; width: 100%; }
.chart { cursor: pointer; border-radius: 6px; }
.chart text, .bars text { font: 400 11px var(--mono); fill: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; }
.bars rect.day { cursor: pointer; }
.bars rect.day:hover { stroke: var(--ink); stroke-width: 1.5; }

.key { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; margin: 0; }
.key div { min-width: 0; }
.key dt { font-weight: 600; font-size: 14px; }
.key dd { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; max-width: 42ch; }

/* Trends tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.tile {
  display: grid; gap: 8px; text-align: left; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.tile:hover { border-color: var(--ink); }
.tile .when { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tile .d { font-weight: 600; font-size: 14px; }
.tile .w { font: 400 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.band { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; height: 16px; border-radius: 3px; overflow: hidden; }
.band span { background: var(--line); }
.tile .nums { display: flex; justify-content: space-between; align-items: center; font: 400 12px var(--mono); color: var(--muted); }
.tile .nums b { color: var(--ink); font-weight: 500; font-size: 15px; }
.tile .go { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.tile .go svg { width: 13px; height: 13px; fill: var(--on-accent); margin-left: 2px; }

/* Year: five clean-share bands, b0 most strained to b4 cleanest */
.b0 { --cell: var(--band0); --cell-ink: var(--band0-ink); }
.b1 { --cell: var(--band1); --cell-ink: var(--band1-ink); }
.b2 { --cell: var(--band2); --cell-ink: var(--band2-ink); }
.b3 { --cell: var(--band3); --cell-ink: var(--band3-ink); }
.b4 { --cell: var(--band4); --cell-ink: var(--band4-ink); }

.ystats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ystat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.ystat .k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ystat .v { font: 500 22px/1.2 var(--mono); font-variant-numeric: tabular-nums; margin-top: 2px; }
.ystat .s { font-size: 12.5px; color: var(--muted); }
.ystat a { color: inherit; }

.bins { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); }
.bins span { display: inline-flex; align-items: center; gap: 5px; }
.bins i { width: 12px; height: 12px; border-radius: 3px; background: var(--cell, var(--line)); }

.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; margin-top: 6px; }
.cal h4 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 6px; font: 600 14px var(--body); }
.cal h4 span { font: 500 12px var(--mono); padding: 1px 7px; border-radius: 999px; background: var(--cell); color: var(--cell-ink); }
.cal .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal .dow { font: 500 10px var(--mono); color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal .c {
  aspect-ratio: 1; border-radius: 4px; display: grid; place-items: center;
  font: 500 10.5px var(--mono); text-decoration: none; background: var(--cell); color: var(--cell-ink);
}
.cal a.c:hover, .cal a.c:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal .c.none { background: none; color: var(--muted); opacity: .5; border: 1px dashed var(--line); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.monthmix { display: grid; gap: 7px; }
.mrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 12.5px; }
.mrow .ml { color: var(--muted); font-family: var(--mono); }
.mrow .mv { font-family: var(--mono); text-align: right; }
.mrow .mixbar { height: 16px; min-width: 0; }
.mixbar span { display: block; height: 100%; }

.heat-wrap { position: relative; overflow-x: auto; padding-bottom: 4px; }
#heat { display: block; cursor: pointer; }
.tip {
  position: absolute; pointer-events: none; z-index: 2; white-space: nowrap;
  background: var(--ink); color: var(--bg); font: 400 12px var(--mono); padding: 6px 9px; border-radius: 6px;
}
.hours-wrap { overflow-x: auto; }
.hourgrid { display: grid; grid-template-columns: 34px repeat(24, minmax(12px, 1fr)); gap: 2px; min-width: 420px; font: 400 10.5px var(--mono); color: var(--muted); }
.hourgrid .hh { text-align: left; white-space: nowrap; overflow: visible; }
.hourgrid .ml { align-self: center; }
.hourgrid .hc { height: 22px; border-radius: 2px; background: var(--cell); }

/* All time */
.table-wrap { overflow-x: auto; }
table.years { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 640px; }
table.years th { text-align: left; font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 8px 0; border-bottom: 1px solid var(--line); }
table.years td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
table.years td.num { font-family: var(--mono); font-size: 13px; }
.mixbar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; min-width: 160px; }

footer { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer a { color: inherit; }
.msg { padding: 24px; text-align: center; color: var(--muted); }
@media (max-width: 480px) {
  .clock { font-size: 36px; }
  .stat .v { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .mix .bar b { transition: none; } }
