/* GSF Explorer — Liquid Canvas.
   The scientific plot is the content plane; only command surfaces use glass. */

@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
  src: url("./fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --surface: #101317;
  --glass: rgba(28, 32, 38, 0.86);
  --glass-strong: rgba(24, 28, 33, 0.97);
  --panel-solid: #1a1e23;
  --border: rgba(242, 244, 247, 0.12);
  --border-hi: rgba(242, 244, 247, 0.24);
  --ink: #f0f2f5;
  --ink-2: #b1b7c0;
  --ink-3: #7c848f;
  --focus: #8bacd2;
  --focus-ring: rgba(139, 172, 210, 0.28);
  --selection: rgba(242, 244, 247, 0.10);
  --selection-strong: rgba(242, 244, 247, 0.16);
  --input-bg: rgba(8, 10, 13, 0.44);
  --track: rgba(242, 244, 247, 0.17);
  --row-hover: rgba(242, 244, 247, 0.07);
  --row-alt: rgba(242, 244, 247, 0.025);
  --danger: #f26a7d;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --surface: #f7f8fa;
  --glass: rgba(255, 255, 255, 0.86);
  --glass-strong: rgba(255, 255, 255, 0.97);
  --panel-solid: #ffffff;
  --border: rgba(24, 30, 40, 0.12);
  --border-hi: rgba(24, 30, 40, 0.24);
  --ink: #181d25;
  --ink-2: #4f5864;
  --ink-3: #737d89;
  --focus: #315f8e;
  --focus-ring: rgba(49, 95, 142, 0.20);
  --selection: rgba(24, 30, 40, 0.07);
  --selection-strong: rgba(24, 30, 40, 0.12);
  --input-bg: rgba(245, 246, 248, 0.94);
  --track: rgba(24, 30, 40, 0.16);
  --row-hover: rgba(24, 30, 40, 0.05);
  --row-alt: rgba(24, 30, 40, 0.025);
  --danger: #bd3850;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; width: 100%; height: 100%; }
body {
  overflow: hidden;
  background: var(--surface);
  color: var(--ink);
  font: 400 14.5px/1.4 var(--sans);
  transition: background-color 180ms ease, color 180ms ease;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
#app, .stage { position: fixed; inset: 0; }

/* ---------------------------------------------------------------- canvas */

.chartwrap { position: absolute; inset: 0; }
svg.chart {
  display: block;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
svg.chart.mode-pan { cursor: grab; }
svg.chart.mode-pan:active { cursor: grabbing; }
svg.chart .tick {
  fill: var(--ink-3);
  font: 400 13.5px var(--mono);
}
svg.chart .tickminor {
  fill: var(--ink-3);
  font: 400 11.5px var(--mono);
}
svg.chart .serieslabel {
  fill: var(--ink-2);
  font: 500 12px var(--sans);
}
svg.chart .legendtitle,
svg.chart .legendlabel,
svg.chart .legendchev {
  fill: var(--ink-2);
  font: 500 12px var(--sans);
}
svg.chart .legendtitle { fill: var(--ink); }
svg.chart .legendchev { font-size: 15px; }
svg.chart .legend-toggle { cursor: pointer; outline: none; }
svg.chart .legend-toggle:hover .legendhit { fill: var(--row-hover); }
svg.chart .legend-toggle:focus-visible .legendhit {
  stroke: var(--focus);
  stroke-width: 2px;
}
svg.chart .axistitle {
  fill: var(--ink-2);
  font: 500 13px var(--sans);
}

/* -------------------------------------------------------------- app top */

.appheader {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  pointer-events: none;
}
.wordmark {
  position: absolute;
  top: 18px;
  left: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.wordmark .name {
  flex: none;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.wordmark .tag {
  max-width: 44vw;
  overflow: hidden;
  color: var(--ink-3);
  font: 400 11px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topright {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}
.statuspill,
.iconbtn,
.plottools,
.commandbar,
.displaydock {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
}
.statuspill {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 8px;
  border-radius: 16px;
  padding: 6px 12px;
  color: var(--ink-2);
  font: 400 11px var(--mono);
}
.statuspill .dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #37a96b;
}
.statuspill.busy .dot {
  background: #d3a247;
  animation: status-pulse 1s ease-in-out infinite;
}
@keyframes status-pulse { 50% { opacity: .35; } }
.iconbtn {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 16px;
  color: var(--ink-2);
  cursor: pointer;
}
.iconbtn:hover { color: var(--ink); border-color: var(--border-hi); }
.iconbtn svg { width: 16px; height: 16px; }
.aboutbtn {
  padding: 0;
  font: 600 14px var(--sans);
  letter-spacing: 0;
  text-transform: none;
}

/* --------------------------------------------------------- command layer */

.plottools {
  position: absolute;
  z-index: 25;
  top: 62px;
  left: 50%;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  transform: translateX(-50%);
}
.plottools button {
  position: relative;
  display: grid;
  width: 32px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.plottools button:hover { color: var(--ink); background: var(--row-hover); }
.plottools button.on { color: var(--ink); background: var(--selection-strong); }
.plottools button:disabled { opacity: .35; cursor: default; }
.plottools svg { width: 17px; height: 17px; }
.commandbar {
  position: absolute;
  z-index: 26;
  top: 60px;
  left: 18px;
  display: flex;
  padding: 3px;
  border-radius: 8px;
}
.commandbtn {
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  padding: 5px 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.commandbtn:hover { color: var(--ink); background: var(--row-hover); }
.commandbtn.on { color: var(--ink); background: var(--selection-strong); }

/* ------------------------------------------------------------ tooltips */

.has-tooltip { position: relative; }
.tooltip {
  position: absolute;
  z-index: 120;
  top: calc(100% + 8px);
  left: 50%;
  width: max-content;
  max-width: 180px;
  padding: 5px 8px;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  background: var(--panel-solid);
  color: var(--ink);
  font: 400 12px/1.25 var(--sans);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -2px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.has-tooltip:hover .tooltip,
.has-tooltip:focus-visible .tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.topright .tooltip { left: auto; right: 0; transform: translateY(-2px); }
.topright .has-tooltip:hover .tooltip,
.topright .has-tooltip:focus-visible .tooltip { transform: translateY(0); }

/* ---------------------------------------------------------- display dock */

.displaydock {
  position: absolute;
  z-index: 24;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 68px;
  width: min(980px, calc(100vw - 32px));
  padding: 8px 10px;
  border-radius: 10px;
  transform: translateX(-50%);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.dockcontrol {
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid var(--border);
}
.dockcontrol:first-child { border-left: 0; }
.docklabel,
.displaydock label.field > span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-3);
  font-size: 12px;
}
.quantity-control { flex: 0 0 154px; }
.gamma-control { flex: 1 1 270px; }
.scale-control { flex: 0 0 158px; }
.band-control {
  display: grid;
  flex: 0 0 118px;
  gap: 5px;
  justify-items: start;
}
.style-controls {
  display: grid;
  flex: 0 1 300px;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.style-controls.split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.style-controls > div { min-width: 0; }
.style-controls .sliderrow {
  grid-template-columns: minmax(28px, 1fr) 40px;
  gap: 6px;
}
.style-controls .sliderrow .val {
  min-width: 0;
  font-size: 11px;
}
.docknote {
  display: none;
  color: var(--ink-3);
  font-size: 12px;
}
.gamma-control.disabled .sliderrow { opacity: .34; pointer-events: none; }
.gamma-control.disabled .docknote { display: block; }

/* -------------------------------------------------------------- overlays */

.sheet-scrim { display: none; }
.overlay-surface {
  position: absolute;
  z-index: 55;
  overflow: hidden;
  background: var(--glass-strong);
  border: 1px solid var(--border-hi);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .20);
  animation: surface-in 160ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes surface-in {
  from { opacity: 0; transform: translateY(-5px); }
}
.overlay-surface.rail {
  display: block;
  width: auto;
  max-height: none;
  padding: 0;
}
.series-popover {
  top: 104px;
  left: 18px;
  width: min(340px, calc(100vw - 36px)) !important;
}
.settings-popover {
  top: 104px;
  left: 108px;
  width: min(360px, calc(100vw - 36px)) !important;
}
.export-popover {
  top: 104px;
  left: 218px;
  width: min(360px, calc(100vw - 36px)) !important;
}
/* two classes: must outrank `.overlay-surface.rail { max-height: none }`
   or the panes get NO height cap and clip past short (iPad) viewports */
.overlay-surface.series-popover,
.overlay-surface.settings-popover,
.overlay-surface.export-popover {
  max-height: calc(100vh - 122px);
  /* iPad Safari: 100vh overshoots the VISIBLE viewport (browser chrome),
     leaving the pane bottom unreachable; dvh tracks the real height */
  max-height: calc(100dvh - 122px);
  overflow: hidden !important;
}
.overlay-surface.commandpane {
  display: flex;
  flex-direction: column;
}
.surfacehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 66px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--glass-strong);
}
.surfacehead h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.surfacehead p {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.closebtn {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.closebtn:hover { color: var(--ink); background: var(--row-hover); }
.panebody {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.panescroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 9px;
  scrollbar-width: none;
}
.panescroll::-webkit-scrollbar { display: none; }
.scrollcontent { min-height: 100%; }
.scrollrail {
  position: absolute;
  z-index: 4;
  top: 6px;
  right: 3px;
  bottom: 6px;
  width: 5px;
  border-radius: 3px;
  background: var(--selection);
  opacity: .6;
  pointer-events: none;
}
.scrollrail span {
  position: absolute;
  right: 0;
  width: 5px;
  min-height: 26px;
  border-radius: 3px;
  background: var(--ink-3);
  transition: top 60ms linear, height 100ms ease,
              background-color 120ms ease;
}
.scrollrail.active { opacity: 1; }
.panebody:hover .scrollrail span,
.panescroll:focus-visible + .scrollrail span { background: var(--ink-2); }

/* -------------------------------------------------------- panel sections */

.panel { border-bottom: 1px solid var(--border); }
.panel:last-child { border-bottom: 0; }
.panel > header {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
}
.panel > header:hover { background: var(--row-hover); }
.panel > header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.panel > header .chev {
  color: var(--ink-3);
  font: 400 17px/1 var(--sans);
}
.panel > .body {
  display: grid;
  gap: 12px;
  padding: 2px 16px 16px;
}
.panel.closed > .body { display: none; }
.hinttext {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
}
.monthgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* --------------------------------------------------------------- inputs */

label.field { display: grid; gap: 5px; min-width: 0; }
label.field > span { color: var(--ink-3); font-size: 12.5px; }
select,
input[type="number"],
input[type="month"],
input[type="text"] {
  width: 100%;
  min-height: 34px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  background-color: var(--input-bg);
  color: var(--ink);
  padding: 6px 9px;
  font-size: 14px;
  transition: border-color 120ms ease;
}
select {
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 53%, calc(100% - 9px) 53%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}
input[type="number"] { font-family: var(--mono); }
select:hover, input:hover { border-color: var(--border-hi); }
button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* sliders */
input[type="range"] {
  width: 100%;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--ink-2) var(--fill, 50%),
    var(--track) var(--fill, 50%)
  );
}
input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -6px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--glass-strong);
  border-radius: 50%;
  background: var(--ink);
}
input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--track);
}
input[type="range"]::-moz-range-progress {
  height: 3px;
  background: var(--ink-2);
}
input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid var(--glass-strong);
  border-radius: 50%;
  background: var(--ink);
}
.sliderrow {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  gap: 8px;
}
.sliderrow .val {
  color: var(--ink);
  font: 400 12px var(--mono);
  text-align: right;
}

/* segmented controls */
.seg {
  display: flex;
  width: 100%;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
}
.seg button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 27px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button.on { color: var(--ink); background: var(--selection-strong); }

/* checkboxes and switches */
label.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}
label.check input { accent-color: var(--focus); }
.switchcheck {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}
.switchcheck input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switchtrack {
  position: relative;
  width: 28px;
  height: 16px;
  flex: none;
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  background: var(--track);
}
.switchtrack::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform 130ms ease, background-color 130ms ease;
}
.switchcheck input:checked + .switchtrack {
  background: var(--selection-strong);
}
.switchcheck input:checked + .switchtrack::after {
  background: var(--ink);
  transform: translateX(12px);
}
.switchcheck input:focus-visible + .switchtrack {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ series/model */

.serieslist { display: grid; gap: 3px; }
.seriesrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 35px;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.seriesrow:hover { background: var(--row-hover); }
.seriesrow .swatch {
  width: 18px;
  height: 3px;
  flex: none;
  border-radius: 2px;
  background: var(--c);
}
.seriesrow.off { color: var(--ink-3); }
.seriesrow.off .swatch { opacity: .25; }
.elgrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.elementfield { display: grid; gap: 6px; }
.fieldhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-3);
  font-size: 12.5px;
}
.resetbtn {
  min-height: 28px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.resetbtn:hover:not(:disabled) {
  border-color: var(--border-hi);
  background: var(--row-hover);
  color: var(--ink);
}
.resetbtn:disabled { opacity: .42; cursor: default; }
.elgrid button {
  min-height: 29px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--ink-3);
  font: 500 11px var(--mono);
  cursor: pointer;
}
.elgrid button:hover { color: var(--ink); border-color: var(--border-hi); }
.elgrid button.on {
  color: var(--ink);
  border-color: var(--border-hi);
  background: var(--selection-strong);
}
.modelrow {
  display: flex;
  align-items: center;
  min-height: 36px;
  gap: 9px;
  padding: 5px 7px;
  border-radius: 5px;
}
.modelrow .mname {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modelrow .mdel {
  margin-left: auto;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-3);
  font-size: 19px;
  cursor: pointer;
}
.modelrow .mdel:hover { color: var(--danger); background: var(--row-hover); }
.modelrow[draggable="true"] { cursor: grab; }
.modelrow.dragging { opacity: .4; }
.modelrow.dragover { box-shadow: inset 0 2px 0 var(--focus); }
.modelrow .grip { color: var(--ink-3); font-size: 12px; }

/* ------------------------------------------------------- export + buttons */

.subhead {
  margin-top: 2px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.panel .body > .subhead:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.btnrow { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.btnrow .seg { width: auto; flex: 1 1 auto; }
button.action {
  min-height: 34px;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
button.action:hover { background: var(--row-hover); }
button.action.primary { background: var(--selection-strong); }
button.action:disabled { opacity: .45; cursor: default; }
.csvrow input[type="number"] { width: 72px; }

/* ------------------------------------------------------- hover + messages */

.hoverbox {
  position: absolute;
  z-index: 40;
  min-width: 178px;
  padding: 8px 10px;
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  background: var(--glass-strong);
  font: 400 11.5px var(--mono);
  pointer-events: none;
}
.hoverbox .hx { margin-bottom: 5px; color: var(--ink-2); }
.hoverbox .hrow {
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.75;
}
.hoverbox .hrow .swatch {
  width: 10px;
  height: 3px;
  flex: none;
  border-radius: 2px;
}
.hoverbox .hrow .n { color: var(--ink-2); }
.hoverbox .hrow .v { margin-left: auto; color: var(--ink); }
.hoverbox .hrow .mtag { color: var(--ink-3); font-size: 10px; }
.toast {
  position: absolute;
  z-index: 90;
  right: 16px;
  bottom: 16px;
  max-width: 52ch;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: #431b23;
  color: #ffe5e9;
  padding: 10px 14px;
  font: 400 12px var(--mono);
}

/* --------------------------------------------------------------- modals */

.modalback {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, .62);
}
.modal {
  display: flex;
  width: min(900px, calc(100vw - 40px));
  max-height: min(84vh, 760px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  border-radius: 9px;
  background: var(--panel-solid);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal > header {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.modal > header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal > header > button:last-child {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
}
.modal > .mbody { overflow: auto; padding: 14px 18px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font: 400 11.5px var(--mono);
}
table.data th, table.data td {
  padding: 5px 10px;
  text-align: right;
  white-space: nowrap;
}
table.data th {
  position: sticky;
  top: -14px;
  border-bottom: 1px solid var(--border-hi);
  background: var(--panel-solid);
  color: var(--ink-2);
  font-weight: 500;
}
table.data tr:nth-child(2n) td { background: var(--row-alt); }
.about { color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.about strong { color: var(--ink); }
.about h4 {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.about pre {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--input-bg);
  padding: 10px 12px;
  color: var(--ink-2);
  font: 400 11px var(--mono);
}
.cite { margin-bottom: 14px; }
.cite .citehead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}
.cite .citehead strong { color: var(--ink); font-size: 13px; }
.cite .citehead a {
  color: var(--focus);
  font: 500 11.5px var(--mono);
  text-decoration: none;
}
.cite .citehead a:hover { text-decoration: underline; }
.cite .citehead button { margin-left: auto; }
.cite pre { margin: 0; }

/* --------------------------------------------------------------- splash */

#splash {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--surface);
}
#splash .name { font-size: 28px; font-weight: 600; }
#splash .tag { color: var(--ink-3); font: 400 12px var(--sans); }
#splash .stage { min-height: 16px; color: var(--ink-2); font: 400 12px var(--mono); }
#splash .bar {
  width: 240px;
  height: 2px;
  overflow: hidden;
  border-radius: 1px;
  background: var(--track);
}
#splash .bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  background: var(--ink-2);
  animation: load-slide 1.3s ease-in-out infinite;
}
@keyframes load-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(350%); }
}
#splash .hint {
  max-width: 42ch;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 980px) {
  .wordmark { top: 15px; left: 14px; }
  .wordmark .tag { display: none; }
  .topright { top: 10px; right: 10px; }
  .statuspill { max-width: 130px; overflow: hidden; }
  .statuspill > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .plottools { top: 55px; }
  .commandbar {
    top: 94px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  .commandbtn { padding-inline: 11px; }
  .displaydock {
    bottom: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: calc(100vw - 16px);
    min-height: 144px;
    gap: 8px 0;
    padding: 9px 8px;
  }
  .dockcontrol {
    width: auto;
    min-width: 0;
    padding: 0 9px;
  }
  .quantity-control,
  .scale-control { flex: none; }
  .quantity-control { border-left: 0; }
  .gamma-control {
    grid-column: 1 / -1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 6px;
  }
  .band-control {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 0;
  }
  .style-controls {
    grid-column: 2;
    grid-row: 3;
    padding-right: 3px;
  }
  .sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 49;
    display: block;
    background: rgba(5, 7, 10, .42);
    animation: fade-in 150ms ease;
  }
  @keyframes fade-in { from { opacity: 0; } }
  .overlay-surface,
  .overlay-surface.rail,
  .series-popover,
  .settings-popover,
  .export-popover {
    position: fixed;
    z-index: 55;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px !important;
    width: auto !important;
    height: min(78vh, 700px);
    max-height: min(78vh, 700px);
    border-radius: 10px;
    animation: sheet-in 190ms cubic-bezier(.2, .8, .2, 1);
  }
  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(18px); }
  }
  svg.chart .tick { font-size: 12.5px; }
  svg.chart .tickminor { font-size: 11px; }
  svg.chart .serieslabel,
  svg.chart .legendtitle,
  svg.chart .legendlabel { font-size: 11px; }
  .hoverbox { display: none; }
}

@media (max-width: 430px) {
  body { font-size: 14px; }
  .statuspill { max-width: 106px; padding-inline: 9px; }
  .wordmark .name { font-size: 15px; }
  .plottools { top: 52px; }
  .commandbar { top: 92px; bottom: auto; }
  .displaydock { min-height: 142px; }
  .seg button { font-size: 12px; }
  .switchcheck { font-size: 12px; }
  .switchcheck.compact span:last-child { display: none; }
  .modal {
    width: calc(100vw - 16px);
    max-height: 88vh;
  }
  .modal > header { align-items: flex-start; }
  .modal > header h3 { max-width: 58vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
