/* The explorers and Your Grid. Standalone: doesn't extend style.css. */
:root {
  --bg: #fcfcfb; --surface: #ffffff; --panel: #f4f3f0; --line: #e4e2dc; --grid: #ecebe7; --faint: #f0efec;
  --border: #d6d4cd; --ink: #0b0b0b; --ink2: #2b2a28; --muted: #52514e; --accent: #1c5cab; --on-ink: #ffffff; --good: #1a7f37; --bad: #c0322b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --surface: #1f1f1d; --panel: #292927; --line: #383835; --grid: #2e2e2b; --faint: #2a2a28;
    --border: #4a4a46; --ink: #f0efec; --ink2: #d9d8d3; --muted: #b4b2aa; --accent: #86b6ef; --on-ink: #141413; --good: #5cc27b; --bad: #f2827a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --surface: #1f1f1d; --panel: #292927; --line: #383835; --grid: #2e2e2b; --faint: #2a2a28;
  --border: #4a4a46; --ink: #f0efec; --ink2: #d9d8d3; --muted: #b4b2aa; --accent: #86b6ef; --on-ink: #141413; --good: #5cc27b; --bad: #f2827a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; }
:focus-visible { outline: 3px solid #f0a100; outline-offset: 2px; }

/* Question tabs: one row of chips under the site header, on every screen size. If they don't
   fit, they swipe sideways rather than wrapping (explore-core.js fades the edge while more are off-screen). */
.top { max-width: 1440px; margin: 0 auto; padding: 4px 32px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs[data-more] { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.tabs a {
  display: flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  font-size: 14px; padding: 9px 14px; border-radius: 8px; color: var(--muted); text-decoration: none;
}
.tabs a .icon { display: none; }
.tabs a:hover { background: var(--grid); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }

/* Buttons and controls */
.seg {
  font: inherit; font-size: 13px; padding: 8px 12px; min-height: 40px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 0; margin-left: -1px;
}
.seg:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg:last-child { border-radius: 0 8px 8px 0; }
.seg.solo, .seg:only-child { border-radius: 8px; margin-left: 0; }
a.seg { display: inline-flex; align-items: center; text-decoration: none; }
.seg[aria-pressed="true"], .seg[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.group { display: flex; flex-wrap: wrap; }
select {
  font: inherit; font-size: 14px; padding: 8px 12px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink);
}
input[type="range"] { width: 100%; accent-color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.timeline { display: flex; align-items: center; gap: 16px; }
.timeline .play { min-width: 80px; font-weight: 600; }
.timeline .slider { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.timeline label, .ticks { font-size: 13px; color: var(--muted); }
.ticks { display: flex; justify-content: space-between; font-size: 12px; }
.big-year { font-size: 44px; font-weight: 600; line-height: 1; min-width: 110px; }

/* The year bar (explore-core.js docks it): a slim sticky row under the header, the same spot
   on every view that has years. On a phone the timeline inside it pins to the bottom instead. */
.timebar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.timebar .timeline { max-width: 1440px; margin: 0 auto; padding: 8px 32px; gap: 16px; }
.timebar .play { min-height: 36px; padding: 6px 12px; min-width: 72px; }
.timebar .big-year { font-size: 26px; min-width: 64px; }
.timebar .slider { gap: 0; }

/* Tiles / Map, in a corner of the map that's empty in both forms: bottom right for the US, bottom left for Europe. */
.mapbox { position: relative; }
.form-float { position: absolute; z-index: 1; right: 0; bottom: 0; flex-direction: column; flex-wrap: nowrap; }
#w-form .form-float { right: auto; left: 0; }
.group.form-float .seg { display: grid; place-items: center; width: 36px; min-height: 36px; padding: 0; margin: -1px 0 0; border-radius: 0; }
.group.form-float .seg:first-child { margin-top: 0; border-radius: 8px 8px 0 0; }
.group.form-float .seg:last-child { border-radius: 0 0 8px 8px; }
.form-float .icon { width: 18px; height: 18px; }

/* The picked state or country (pickCard in explore-core.js): an ordinary card until a phone
   opens it as a drawer. */
.pick { display: contents; }
.pick-bar { display: none; }
svg.chart { touch-action: pan-y; } /* a sideways finger scrubs the chart, a vertical one scrolls the page */

/* Layout */
#view { max-width: 1440px; margin: 0 auto; padding: 20px 32px 40px; outline: none; }
.lead { display: flex; flex-direction: column; gap: 6px; max-width: 1000px; margin-bottom: 16px; }
.lead h1 { font-size: 30px; line-height: 1.2; font-weight: 600; }
.lead p { margin: 0; font-size: 16px; color: var(--muted); }
.delta { font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; vertical-align: 0.2em; margin-left: 4px; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.cols { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.cols > .main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cols > .side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 14px; padding: 20px; min-width: 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.card h2 { font-size: 15px; font-weight: 600; }
.card h2.big { font-size: 20px; }
.sub { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.note { padding: 16px 20px; border-radius: 12px; background: var(--panel); font-size: 13px; line-height: 1.45; color: var(--ink2); }
.note strong { display: block; margin-bottom: 4px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat { font-size: 34px; font-weight: 600; }
.loading, .error { padding: 48px 0; color: var(--muted); }
.error { color: var(--ink); }
.foot { max-width: 1440px; margin: 0 auto; padding: 16px 32px 32px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* Legend */
.legend { display: flex; flex-direction: column; gap: 6px; }
.legend .title { margin: 0; font-size: 13px; font-weight: 500; }
.legend .steps { display: flex; flex-wrap: wrap; gap: 2px; }
.legend .step { display: flex; flex-direction: column; gap: 4px; width: 66px; font-size: 12px; color: var(--muted); }
.legend .tick { align-self: flex-start; transform: translateX(-50%); white-space: nowrap; line-height: 1.2; }
.legend .ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.legend .swatch { height: 12px; border-radius: 2px; }
.key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* Maps: tile grid and border map */
.mapbox { width: 100%; }
.tiles { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; max-width: 860px; margin: 0 auto; }
/* Small grids (a short window or a phone): keep the state code, drop the value, which the
   selected-state panel shows. Measured on the grid itself, not the window. */
.tiles { container-type: inline-size; } /* the tiles query the grid's own width */
@container (max-width: 560px) {
  .tile .t-val { display: none; }
  .tile .t-st { font-size: 11px; }
}
.tile {
  font: inherit; position: relative; overflow: hidden; aspect-ratio: 1; min-width: 0; padding: 0 0 4px;
  border: 0; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: background-color .3s ease;
}
.tile .t-st { font-size: clamp(10px, 1.3vw, 15px); font-weight: 600; }
.tile .t-val { font-size: clamp(9px, 1vw, 12px); }
.tile .t-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; display: flex; gap: 1px; padding-top: 1px; background: var(--surface); }
.tile .t-strip:empty { display: none; }
.tile.sel { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); z-index: 1; }
.geo { width: 100%; max-width: 900px; height: auto; display: block; margin: 0 auto; }
.geo path.st { cursor: pointer; stroke: var(--surface); stroke-width: 1; transition: fill .3s ease; }
.geo path.st:hover { opacity: .85; }
.geo path.outline { fill: none; stroke: var(--ink); stroke-width: 2.5; pointer-events: none; }
[hidden] { display: none !important; }

/* Bars and lists */
.mixbar { display: flex; gap: 2px; height: 16px; }
.mixbar div { border-radius: 2px; }
.rank-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 52px; align-items: center; gap: 8px; font-size: 13px; }
.rank-row .bar { height: 8px; border-radius: 0 4px 4px 0; }
.rank-row .v { text-align: right; }
.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 500; }
.readout { display: flex; flex-direction: column; gap: 6px; font-size: 13px; flex: 1 1 180px; }
.readout .r-title { margin: 0; font-weight: 600; font-size: 15px; }
.readout .r-row { display: flex; align-items: center; gap: 8px; }
.readout .r-row i { width: 10px; height: 10px; border-radius: 2px; }
.readout .r-row span:nth-child(2) { flex: 1; }
.readout .r-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 6px; }
.chart-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.chart-wrap svg { flex: 3 1 420px; min-width: 0; height: auto; }
svg text { font-family: inherit; }
.projects .p-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) 64px; gap: 4px 10px; align-items: start; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--faint); }
.projects .p-row i { width: 10px; height: 10px; margin-top: 4px; border-radius: 2px; }
.projects .p-row .v { text-align: right; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis .card { gap: 4px; padding: 16px 18px; }
.kpis .k-label, .kpis .k-note { font-size: 13px; color: var(--muted); }
.kpis .k-value { font-size: 26px; font-weight: 600; }
@media (min-width: 761px) { .kpis.six { grid-template-columns: repeat(3, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th { text-align: right; font-weight: 500; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.plain td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--faint); }
table.plain th:first-child, table.plain td:first-child { text-align: left; }
.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ops div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 8px; background: var(--panel); font-size: 13px; }
.ops strong { font-size: 14px; }

/* World ranking race */
:root { --race-lead: 284px; } /* where the bars start: the rank and place columns and their gaps */
.race-head { display: grid; grid-template-columns: 34px 230px minmax(0, 1fr); gap: 10px; padding-right: 14px; font-size: 12px; color: var(--muted); }
.race-scroll { height: 620px; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-right: 4px; }
.race { position: relative; padding-top: 4px; }
.race-world { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--ink); opacity: .6; pointer-events: none; transition: left .6s ease; }
.race-row {
  font: inherit; position: absolute; left: 0; right: 0; height: 26px; padding: 0; border: 0; background: transparent; color: var(--ink);
  display: grid; grid-template-columns: 34px 230px minmax(0, 1fr); align-items: center; gap: 10px; text-align: left; cursor: pointer;
  transition: top .6s ease, opacity .4s ease;
}
.race-row:hover .r-name { text-decoration: underline; }
.race-row .r-rank { font-size: 13px; color: var(--muted); text-align: right; }
.race-row .r-place { display: flex; align-items: baseline; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.race-row .r-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.race-row.sel .r-name { font-weight: 700; }
.race-row .r-tag { font-size: 11px; color: var(--muted); }
.race-row .r-bar { height: 18px; min-width: 2px; border-radius: 0 4px 4px 0; display: flex; align-items: center; justify-content: flex-end; transition: width .6s ease; }
.race-row.sel .r-bar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.race-row .r-val { font-size: 12px; font-weight: 600; padding: 0 6px; white-space: nowrap; }
.pinned { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 14px; border-radius: 8px; background: var(--panel); font-size: 14px; }

/* Flows: grid operators inside the selected region, with diverging net bars */
.ops-list { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.ops-list h2 { margin-bottom: 2px; }
.ops-list .sub { margin-bottom: 6px; }
.op-row { font: inherit; display: grid; grid-template-columns: minmax(0, 1fr) 110px 46px; gap: 8px; align-items: center; width: 100%;
  padding: 6px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; font-size: 13px; }
.op-row:hover, .op-row.open { background: var(--panel); }
.op-row.open { font-weight: 600; }
.op-row .v { text-align: right; }
.op-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-track { position: relative; height: 12px; }
.op-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; border-left: 1px solid var(--border); }
.op-bar { position: absolute; top: 0; height: 12px; min-width: 1px; border-radius: 2px; }
.op-partners { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 6px; padding: 8px 10px; border-radius: 6px; background: var(--panel); }
.op-partner { display: grid; grid-template-columns: 18px minmax(0, 1fr) 64px; gap: 6px; font-size: 12px; }
.op-partner .v { text-align: right; }

/* Potential: paired bars per state */
.pot-head, .pot-row { display: grid; grid-template-columns: 170px minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.pot-head { font-size: 12px; color: var(--muted); padding-right: 14px; }
.pot-scroll { height: 520px; }
.pot-row { font: inherit; width: 100%; padding: 5px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.pot-row:hover { background: var(--panel); }
.pot-row.sel { background: var(--panel); font-weight: 600; }
.pot-name { font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.pot-tag { font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.pot-tag.untapped { border-color: var(--accent); color: var(--accent); }
.pot-track { position: relative; display: flex; align-items: center; gap: 6px; height: 16px; min-width: 0; }
.pot-bar { display: block; height: 12px; min-width: 2px; border-radius: 0 3px 3px 0; flex: none; }
.pot-v { font-size: 12px; white-space: nowrap; }
.pot-one { position: absolute; left: 25%; top: -3px; bottom: -3px; border-left: 1px dashed var(--ink); opacity: .5; }

/* Desktop: size maps and long lists to the window's height, so a view fits on one screen
   without scrolling. --fit is the height left after the header, year bar, headline and the
   card's controls. The tile grid is about 1.37 times as wide as it is tall. */
@media (min-width: 761px) {
  .timebar .slider label { display: none; } /* the big year already says it; phones hide that instead */
  /* --chrome is what sits above and below the map or list; views with extra control rows set
     more (the router puts data-view on each view's root). The calc is written out at each use
     so it picks up the view's own --chrome. */
  :root { --chrome: 396px; }
  [data-view="mix"], [data-view="potential"] { --chrome: 486px; }
  [data-view="building"] { --chrome: 446px; }
  [data-view="world"] { --chrome: 516px; }
  [data-view^="world-"] { --chrome: 456px; } /* world explorer: subtitle and continent buttons */
  [data-view="world-mix"] { --chrome: 506px; } /* plus its fuel buttons */
  [data-view="world-imports"] { --chrome: 486px; } /* plus its two-ended legend */
  [data-view="world-use"] { --chrome: 536px; } /* plus its measure buttons */
  .tiles { max-width: min(860px, calc(max(280px, 100vh - var(--chrome)) * 1.37)); }
  .geo { max-height: max(280px, calc(100vh - var(--chrome))); }
  .race-scroll { height: max(280px, calc(100vh - var(--chrome))); }
  .pot-scroll { height: min(520px, max(280px, calc(100vh - var(--chrome)))); }
}
/* Wide enough for the sidebar beside the main column: the main column sets the row's height,
   and the sidebar matches it and scrolls inside itself (height 0 keeps the sidebar's content
   out of the row's sizing; min-height 100% then stretches it to the row). */
@media (min-width: 1100px) {
  .cols:has(> .side) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 24px; align-items: stretch; }
  .cols:has(> .side) > .main { align-self: start; }
  .cols > .side { height: 0; min-height: 100%; overflow-y: auto; overscroll-behavior: contain; gap: 16px; padding-right: 2px; }
}

@media (min-width: 761px) and (max-width: 1100px) { .tabs a { padding: 9px 8px; } }
/* Tablet: the profile's small chart drops under the big one. Keep it beside its neighbour
   rather than letting a 320-wide drawing stretch across the page with oversized labels. */
@media (min-width: 761px) and (max-width: 1099px) {
  .stack { flex-direction: row; }
  .stack > .card { flex: 1 1 0; min-width: 0; }
  .cols > .card > svg { display: block; max-width: 460px; margin: 0 auto; }
}

@media (max-width: 760px) {
  :root { --time-h: 57px; --race-lead: 154px; }
  .timebar { border-bottom: 0; }
  .pot-head, .pot-row { grid-template-columns: 96px minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; }
  .pot-name { white-space: normal; flex-wrap: wrap; font-size: 12px; }
  .pot-scroll { height: 440px; }
  #view, .foot { padding-left: 16px; padding-right: 16px; }
  /* The tabs stay in view at the top while the page scrolls: an icon and short label each, as
     chips that swipe sideways. The site's sections are in the bar at the bottom (shell.css). */
  .top { position: sticky; top: 0; z-index: 12; padding: 6px 16px; background: var(--bg); }
  .tabs { gap: 6px; margin: 0 -16px; padding: 0 16px; }
  .tabs a { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
  .tabs a:hover { background: none; color: var(--muted); }
  .tabs a .icon { display: block; width: 16px; height: 16px; }
  .tabs a span { display: none; }
  .tabs a::after { content: attr(data-short); }
  .tabs a[aria-current="page"], .tabs a[aria-current="page"]:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
  /* Button rows stay one row: buttons share the width, and a long label wraps inside its
     button rather than dropping a lone button onto a second line. */
  .group { flex-wrap: nowrap; max-width: 100%; }
  .seg { min-height: 44px; }
  .group .seg { flex: 1 1 auto; min-width: 0; padding: 6px 8px; line-height: 1.2; text-align: center; justify-content: center; }
  .group.form-float .seg { flex: none; width: 44px; min-height: 44px; padding: 0; }
  /* Seven or more (continents, world fuels) would be too narrow to read: swipe them instead,
     with the same right-edge fade as the tabs (explore-core.js sets data-more). */
  .group:has(> .seg:nth-child(7)) { overflow-x: auto; scrollbar-width: none; }
  .group:has(> .seg:nth-child(7))::-webkit-scrollbar { display: none; }
  .group:has(> .seg:nth-child(7)) .seg { flex: none; white-space: nowrap; padding: 6px 12px; }
  .group[data-more] { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  #view { padding-top: 20px; }
  .lead h1 { font-size: 22px; }
  .lead p { font-size: 15px; }
  .card { padding: 16px; }
  /* The year slider sits fixed just above the site's bottom bar, so it can be scrubbed while scrolling
     the map and panels: one slim row of Play, the year and the slider. */
  .timebar .timeline {
    position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 10; gap: 12px;
    padding: 6px 16px; max-width: none;
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgb(0 0 0 / .08);
  }
  .timeline .tl-label, .timeline .big-year { display: none; }
  .timeline .yr { color: var(--ink); }
  .timebar .play { min-height: 44px; }
  .timeline .slider { flex-direction: row; align-items: center; gap: 10px; }
  .timeline input[type="range"] { height: 44px; margin: 0; }
  .timeline .slider label { flex: none; }
  .timeline .ticks { display: none; }
  body:has(.timeline) { padding-bottom: calc(var(--nav-h) + var(--time-h)); }
  /* A tap on the map opens the picked card over the bottom of the page. Closed, it's a card in
     the column as usual. Leave room to scroll the map's lower rows clear of the drawer. */
  .pick.open {
    position: fixed; left: 0; right: 0; bottom: var(--nav-h); z-index: 9; display: block;
    max-height: 62vh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgb(0 0 0 / .12);
  }
  body:has(.timeline) .pick.open { bottom: calc(var(--nav-h) + var(--time-h)); box-shadow: none; }
  body:has(.pick.open) { padding-bottom: calc(var(--nav-h) + var(--time-h) + 150px); }
  .pick.open .pick-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; padding: 0 4px 0 16px; background: var(--surface); touch-action: none; }
  .pick-toggle, .pick-close { font: inherit; min-height: 44px; border: 0; background: none; color: var(--accent); cursor: pointer; }
  .pick-toggle { flex: 1; padding: 0; font-size: 14px; font-weight: 600; text-align: left; }
  .pick-close { width: 44px; color: var(--muted); font-size: 24px; line-height: 1; }
  .pick.open > .card { gap: 10px; padding: 0 16px 14px; border: 0; border-radius: 0; background: none; }
  .pick.open:not(.full) > .card > :not(.peek) { display: none !important; } /* some children set display inline */
  /* Rows and links people tap */
  .pot-row, .op-row, .near-row, .matches button { min-height: 44px; }
  .row-between > a, .controls a { display: inline-block; padding: 12px 0; margin: -12px 0; }
  .examples button { min-height: 44px; }
  .delta { font-size: 13px; vertical-align: 0.15em; }
  .ticks { font-size: 11px; }
  .big-year { font-size: 32px; min-width: 0; }
  .legend .steps { flex-wrap: nowrap; }
  .legend .step { width: auto; flex: 1 1 0; min-width: 0; font-size: 11px; }
  .race-head, .race-row { grid-template-columns: 26px 112px minmax(0, 1fr); gap: 8px; }
  .race-row { height: 44px; }
  .race-row .r-name { font-size: 13px; }
  .race-scroll { height: 480px; }
  .rank-row { grid-template-columns: 100px minmax(0, 1fr) 48px; }
}
/* Tiles are about 30px wide on a phone: keep the state code, drop the value (tap for it).
   Wide charts shrink to about half size, so their text is set larger in viewBox units (CSS
   font-size beats the SVG attribute). The flow map keeps region names and drops TWh labels,
   which the side panel lists. */
@media (max-width: 600px) {
  svg.chart text { font-size: 20px; }
  svg.flowmap text.region-label { font-size: 30px; stroke-width: 6px; }
  svg.flowmap text.arc-label { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .card { padding: 12px 14px; }
  .kpis .k-value { font-size: 20px; }
  .kpis .k-label, .kpis .k-note { font-size: 12px; }
  .stat { font-size: 28px; }
  .tiles { gap: 2px; }
  .mapbox { margin-inline: -8px; } /* every pixel helps: 11 columns of tiles to tap */
  .tile .t-val { display: none; }
  .tile .t-st { font-size: 10px; }
  .tile { border-radius: 4px; }
}

/* World explorer: continent buttons; countries outside the chosen continent aren't drawn. */
.conts { margin-bottom: 4px; }
.geo.world { max-width: none; }
.geo path.st.out { display: none; }
.geo.world path { vector-effect: non-scaling-stroke; }
.geo.world path.st { stroke-width: .75; }
.geo.world path.outline { stroke-width: 1.25; } /* countries can be huge; a heavy line takes over the map */
.world-tiles { max-width: 640px; }
/* World and region grids have fewer, bigger tiles than the US grid: keep values down to 360px. */
@container (max-width: 560px) { .world-tiles .tile .t-val { display: inline; } }
@container (max-width: 360px) { .world-tiles .tile .t-val { display: none; } }
/* On desktop their height follows the window too. Europe's grid is about as wide as it is tall. */
@media (min-width: 761px) { .world-tiles { max-width: min(640px, max(280px, 100vh - var(--chrome))); } }
