
/* Layout: sticky control bar over one reading column (max 1240px); each section = heading, prose, plot grid.
   Tokens: teal-biased neutrals, one teal accent for UI chrome, validated categorical slots for data identity. */
:root {
  --bg: #0b1113; --surface: #121a1d; --surface-2: #172226; --line: #2a383d; --line-soft: #1e2b2f;
  --ink: #e9f0f1; --ink-2: #b9c9cd; --muted: #8ba0a5;
  --accent: #46c2d4; --accent-ink: #06171b; --accent-soft: #12333a;
  --event: #e0b04a; --event-soft: #2e2512;
  --warn-ink: #f0b45a; --warn-soft: #2f2414; --crit: #e66767; --good: #3fbf3f;
  --c-luke: #3987e5; --c-recomb: #d95926; --c-abs: #199e70; --c-prompt: #c98500;
  --c-phot: #3ccf8e;   /* brighter than the default chart band on purpose: small scatter marks on the dark surface */
  --c-L: #9085e9; --c-ST: #d55181; --c-FT: #008300;
  --c-v1: #d95926; --c-v2: #9085e9; --c-v3: #199e70;
  --c-el: #3987e5; --c-ho: #d95926; --c-ph: #199e70; --c-dev: #9085e9; --c-trap: #e66767; --c-esc: #c98500;
  --e1: #cde2fb; --e2: #9ec5f4; --e3: #6da7ec; --e4: #3987e5; --e5: #256abf;
  --g0: #e4f0fd; --g1: #8cbcf0; --g2: #3f8ce6; --g3: #2160ad;
  --map0: #10171b; --map1: #143a66; --map2: #2160ad; --map3: #3f8ce6; --map4: #8cbcf0; --map5: #e4f0fd;
  --font-display: "IBM Plex Sans Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-body); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; letter-spacing: .005em; }
h2 { font-size: 1.55rem; margin: 0; line-height: 1.2; }
h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
p { margin: .35rem 0 .75rem; max-width: 72ch; }
code { font-family: var(--font-mono); font-size: .86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: .55rem 16px; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand b { font-family: var(--font-display); font-size: 1.12rem; letter-spacing: .01em; }
.brand span { font-size: .78rem; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin-left: auto; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { font: 500 .82rem/1 var(--font-body); color: var(--ink-2); background: transparent; border: 0; padding: .45rem .62rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { color: var(--muted); cursor: not-allowed; opacity: .55; }
.seg.mode button[data-mode="event"][aria-pressed="true"] { background: var(--event); color: var(--surface); }
select { font: .82rem var(--font-body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .4rem; max-width: 100%; }

/* page */
main { max-width: 1240px; margin: 0 auto; padding-inline: 16px; padding-block: 1rem 3rem; }
section.block { padding-block: 2.1rem .4rem; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 92px; }
.scope { font: 600 .68rem/1 var(--font-mono); letter-spacing: .08em; padding: .28rem .45rem; border-radius: 3px; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem .7rem; min-width: 0; }
.panel.event { border: 1px dashed var(--event); }
.panel h3 { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.panel h3 .unit { font: 400 .76rem var(--font-mono); color: var(--muted); }
.note { font-size: .84rem; color: var(--ink-2); }
.na { font: .8rem var(--font-mono); color: var(--muted); font-style: italic; }

/* stat tiles and tables */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .8rem; font-size: .86rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv dd small { color: var(--muted); }
.kv dt.long, .kv dd.long { grid-column: 1 / -1; }
.kv dd.long { text-align: left; white-space: normal; overflow-wrap: anywhere; padding-left: .8rem; margin-bottom: .25rem; }
.tbl-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .84rem; }
table.data th, table.data td { padding: .38rem .45rem; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font: 500 .72rem var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom-color: var(--line); vertical-align: bottom; }
table.data td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: .82rem; }
table.data td.txt { font-family: var(--font-body); white-space: normal; text-align: left; min-width: 14ch; }
table.data tr.sel td { background: var(--accent-soft); }
table.data tr:hover td { background: var(--surface-2); }
.chip { display: inline-block; font: 600 .66rem/1 var(--font-mono); letter-spacing: .06em; padding: .25rem .4rem; border-radius: 3px; text-transform: uppercase; white-space: nowrap; }
.chip.open { background: var(--warn-soft); color: var(--warn-ink); }

/* composition bars */
.stack { display: flex; gap: 2px; height: 22px; border-radius: 4px; overflow: hidden; margin: .25rem 0 .15rem; background: var(--surface); }
.stack > div { height: 100%; min-width: 2px; }
.stack-legend { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .78rem; color: var(--ink-2); }
.key { display: inline-flex; align-items: center; gap: .3rem; }
.key i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.key i.box { height: 10px; width: 10px; border-radius: 2px; }
.key i.dash { background: none !important; border-top: 2px dashed; height: 0; width: 20px; }
.key i.dot { background: none !important; border-top: 2px dotted; height: 0; width: 20px; }

/* plots */
.plot { position: relative; width: 100%; }
.plot svg { display: block; width: 100%; overflow: visible; }
.plot svg text { fill: var(--muted); font: 11px var(--font-mono); }
.plot svg .axis line, .plot svg .axis path { stroke: var(--line); }
.plot svg .grid line { stroke: var(--line-soft); }
.legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .78rem; color: var(--ink-2); margin: .1rem 0 .3rem; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow);
  padding: .35rem .5rem; font: .74rem/1.35 var(--font-mono); color: var(--ink); white-space: nowrap; z-index: 5; display: none; }
.tip b { font-weight: 600; }
.tip .row { display: flex; align-items: center; gap: .4rem; }
.tip .row i { width: 12px; height: 2px; display: inline-block; }
.mapbox { position: relative; width: 100%; max-width: 520px; }
.mapbox canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.mapcap { font: .72rem/1.4 var(--font-mono); color: var(--muted); margin-top: .3rem; min-height: 1.4em; }
.cbar { display: flex; align-items: center; gap: .4rem; font: .7rem var(--font-mono); color: var(--muted); margin-top: .3rem; flex-wrap: wrap; }
.cbar canvas { width: 160px; height: 10px; border-radius: 2px; }
.big { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; }
.big .lab { font-size: .76rem; color: var(--ink-2); }
.big.strong { border-color: var(--c-recomb); }
footer { max-width: 1240px; margin: 0 auto; padding: 1.4rem 16px 2.5rem; font-size: .82rem; color: var(--muted); }
@media (max-width: 980px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .controls { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ===================================================================== page layout
   Slim sticky bar (brand, theme) over a sticky input bar; a process strip, one dominant stage (visual left, outputs
   right), then focusing and geometry. */
:root { --tb-h: 54px; --tb-off: 54px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 16px; }
.topbar-inner { min-height: var(--tb-h); flex-wrap: nowrap; padding-block: .35rem; }
.loading { max-width: 1240px; margin: 2rem auto; padding-inline: 16px; font: 500 1rem var(--font-mono); color: var(--muted); }
details.about summary { cursor: pointer; font: 500 .82rem var(--font-body); color: var(--accent); }
details.about[open] { flex-basis: 100%; }
.ctlbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--tb-off)); z-index: 15; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.ctl-inner { display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; align-items: center; padding-block: .5rem; }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; min-width: 0; }
.ctl-k { font: 600 .68rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg.big button { font-size: .96rem; padding: .58rem .9rem; }
.seg.big button[aria-pressed="true"] { font-weight: 600; }
#event-select { font-size: .92rem; padding: .5rem .5rem; max-width: min(100%, 30rem); }
#pane-demo { font-size: 16px; }
.strip { list-style: none; margin: .9rem 0 .9rem; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; }
.strip li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .7rem .55rem; min-width: 0; }
.strip li:not(:last-child)::after { content: "→"; position: absolute; right: -.9rem; top: 50%; transform: translateY(-50%); width: .9rem; text-align: center; color: var(--accent); font: 700 1rem var(--font-body); }
.strip .k { font: 600 .68rem/1.25 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.strip .t { font-size: .84rem; line-height: 1.35; color: var(--ink-2); margin: .2rem 0 .3rem; }
.strip .v { font: 600 .84rem/1.3 var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.strip li.io { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stage { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.stage-side { display: grid; gap: 1rem; min-width: 0; }
.panel.event { border-style: dashed; border-color: var(--event); }
.subtabs { margin-bottom: .55rem; }
.vrow { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; align-items: center; margin-bottom: .55rem; }
.vrow .ctl-k { margin-right: .35rem; }
.fig { min-width: 0; }
.fig .mapbox { max-width: 580px; }
.caption { font-size: .9rem; line-height: 1.5; color: var(--ink-2); margin: .55rem 0 0; max-width: 72ch; }
.caption b { color: var(--ink); font-weight: 600; }
.player { display: flex; align-items: center; gap: .55rem .8rem; flex-wrap: wrap; margin-top: .6rem; }
.pbtn { width: 2.7rem; height: 2.7rem; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 600 1rem/1 var(--font-body); cursor: pointer; display: inline-grid; place-items: center; }
.pbtn.ghost { background: transparent; color: var(--accent); }
.player input[type=range] { flex: 1 1 180px; min-width: 0; accent-color: var(--accent); }
.tread { font: 600 1.3rem/1.15 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.tread-sub { font-size: .82rem; color: var(--muted); }
.tline { margin-top: .4rem; }
.tline canvas { display: block; width: 100%; }
.outs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.outs h3 { grid-column: 1 / -1; margin: 0; }
.out { min-width: 0; }
.out .v { font: 600 clamp(1.45rem, 2.3vw, 1.95rem)/1.1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink); }
.out .l { font-size: .9rem; font-weight: 600; color: var(--ink); margin-top: .15rem; }
.out .s { font-size: .76rem; line-height: 1.35; color: var(--muted); }
.outs .scope-line { grid-column: 1 / -1; font-size: .82rem; color: var(--ink-2); }
.what h3 { margin: 0 0 .35rem; }
.what p { font-size: .97rem; line-height: 1.6; margin: 0; max-width: 64ch; }
.dsec { padding-block: 2.4rem .5rem; }
.dsec h2 { font-size: clamp(1.45rem, 2.4vw, 1.8rem); margin: 0 0 .35rem; }
.dsec .lede { font-size: 1.02rem; color: var(--ink-2); max-width: 74ch; margin: 0 0 1rem; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.trio h3, .geo-card h3 { font-size: 1.02rem; margin: 0 0 .1rem; }
.fig .sub3 { font: .76rem var(--font-mono); color: var(--muted); margin-bottom: .35rem; }
.takeaway { font-size: 1.02rem; line-height: 1.55; border-left: 3px solid var(--accent); padding: .25rem 0 .25rem .85rem; margin: 1.1rem 0 0; max-width: 82ch; }
.geo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; }
.geo-card.hl { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.geo-card .schem svg { display: block; width: 100%; height: auto; }
.geo-card .nums { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .5rem; margin-top: .5rem; font-size: .8rem; align-items: baseline; }
.geo-card .nums .lb { color: var(--ink-2); }
.geo-card .nums .vv { text-align: right; white-space: nowrap; }
.geo-card .nums b { font: 600 .9rem var(--font-mono); font-variant-numeric: tabular-nums; }
.geo-card .nums .d { display: block; font: .72rem var(--font-mono); color: var(--muted); }
.depth canvas { display: block; width: 100%; }
.brand { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; }
.brand b { font-size: clamp(1.15rem, 2vw, 1.5rem); }
.brand .brand-tag { font: 500 clamp(.95rem, 1.5vw, 1.1rem) var(--font-body); color: var(--ink-2); }
.brand-tag .arrow { color: var(--accent); }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .9rem; margin-bottom: .55rem; }
.stage-head .subtabs { margin: 0; }

/* ===================================================================== plot axes, random event, figure notes */
.plot svg text.atitle { font: 12px var(--font-body); fill: var(--ink-2); }
.plot svg text.mark { font: 600 11px var(--font-mono); }
.axnote { font-size: .76rem; line-height: 1.45; color: var(--muted); margin: .35rem 0 0; max-width: 80ch; }
.cbar .cb-empty { display: inline-flex; align-items: center; gap: .25rem; }
.cbar .swatch { display: inline-block; width: 10px; height: 10px; border: 1px solid var(--line); border-radius: 2px; }
.cbar .cb-note { flex-basis: 100%; font-size: .68rem; }
.ctl-ev { gap: .4rem .7rem; }
.ev-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; min-width: 0; }
.ev-pick[hidden] { display: none !important; }
.ctl-ev, .ev-pick { max-width: 100%; min-width: 0; }
#event-select { min-width: 0; text-overflow: ellipsis; }
@media (max-width: 760px) { .ctl-ev { width: 100%; } .ev-pick { width: 100%; } #event-select { width: 100%; max-width: 100%; } }
.rbtn { font: 600 .9rem var(--font-body); color: var(--accent); background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: .5rem .8rem; cursor: pointer; white-space: nowrap; }
.rbtn:hover { background: var(--accent-soft); }
.evid { font: 500 .78rem var(--font-mono); color: var(--event); overflow-wrap: anywhere; user-select: all; }
@media (max-width: 1100px) { .geo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1020px) { .topbar-inner { flex-wrap: wrap; } }
@media (max-width: 980px) { .stage { grid-template-columns: minmax(0, 1fr); } .trio { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .strip { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .strip li { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); gap: .1rem .8rem; align-items: baseline; }
  .strip .t { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .strip li:not(:last-child)::after { content: "↓"; right: auto; left: 1rem; top: auto; bottom: -.95rem; transform: none; }
}
@media (max-width: 760px) { .ctlbar { position: static; } .topbar { position: static; } .topbar-inner { flex-wrap: wrap; } .geo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 600px) {
  .strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: .9rem; padding-bottom: .4rem; }
  .strip li { flex: 0 0 78%; display: block; scroll-snap-align: start; }
  .strip .t { margin: .2rem 0 .3rem; }
  .strip li:not(:last-child)::after { content: "→"; left: auto; right: -.9rem; top: 50%; bottom: auto; transform: translateY(-50%); }
  .ctl { flex-direction: column; align-items: flex-start; }
  .seg.big button { font-size: .84rem; padding: .5rem .45rem; }
  .tw { display: none; }
  .topbar-inner { gap: .3rem .4rem; }
}
/* burst modes and the Electronic Burst view */
.burst-ctl .seg.big button { font-weight: 500; }
.burst-ctl .seg.big button[aria-pressed="true"] { font-weight: 600; }
.ptitle { font: 600 .9rem var(--font-display); margin: .2rem 0 .3rem; color: var(--ink-2); }
.g-plots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.g-plots2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
#pane-elec table.data th, section[id^="el-"] table.data th { white-space: normal; }   /* wide carrier tables: headers wrap, values stay on one line */
#pane-elec .kv dd small, section.block[id^="el-"] .kv dd small { display: block; white-space: normal; }
@media (max-width: 600px) { #pane-elec .kv dd, section.block[id^="el-"] .kv dd { white-space: normal; overflow-wrap: anywhere; } }
@media (max-width: 1180px) { .g-plots { grid-template-columns: minmax(0, 1fr); } }   /* three plots side by side need the desktop stage width */
@media (max-width: 760px) { .g-plots2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .geo-grid { grid-template-columns: minmax(0, 1fr); } .strip li { grid-template-columns: minmax(0, 1fr); } .strip .t { grid-column: 1; grid-row: auto; } .outs { gap: .8rem; } }
/* RadQP header, introduction and control rows: brand left and the burst selector right (the selector wraps below the
   brand when the line is too short); a compact introduction that scrolls normally; gamma energy left and View right
   on the first control row, the single-event controls on the second */
.topbar-inner { flex-wrap: wrap; justify-content: space-between; }
.topbar .burst-ctl { flex: 0 0 auto; max-width: 100%; }
.intro .wrap { padding-block: 1rem .7rem; }
.intro h1 { font-size: clamp(1.15rem, 1.9vw, 1.4rem); line-height: 1.25; color: var(--ink); margin: 0 0 .3rem; }
.intro p { margin: 0; max-width: 80ch; font-size: .98rem; line-height: 1.5; color: var(--ink-2); }
.ctl-main { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.8rem; flex: 1 1 100%; min-width: 0; }
@media (max-width: 760px) { .ctlbar { overflow-x: clip; } }   /* WebKit counts the stacked event picker wider than it is drawn */
