:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: #19232d;
  background: #fff;
  --panel: #fff;
  --border: #cbd4dc;
  --muted: #465462;
  --accent: #246c8c;
}
* { box-sizing: border-box; }
body { margin: 0; }
.page-header { border-bottom: 1px solid var(--border); background: #f6f8fa; }
.header-inner, main { max-width: 1580px; margin: auto; padding: 24px clamp(16px, 4vw, 48px); }
.header-inner, .section-heading, .dataset-controls, .map-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.header-inner, .section-heading { justify-content: space-between; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 38px); letter-spacing: -.04em; }
h2 { font-size: 26px; letter-spacing: -.025em; }
h3 { font-size: 18px; font-weight: 650; }
p, footer { color: var(--muted); font-size: 16px; line-height: 1.5; }
.section-heading p { margin-top: 4px; }
label { font-size: 16px; color: var(--muted); }
.dataset-controls label { display: grid; gap: 6px; }
select, button, input[type=number] {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  padding: 6px 8px;
  font: inherit;
}
button { cursor: pointer; font-size: 16px; }
button:hover, select:hover { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--accent); vertical-align: middle; margin: 0 5px 0 0; }
input[type=number] { width: 80px; }
.status { margin: 8px 0 12px; min-height: 1.5em; }
.status.error { color: #a8231c; }
.maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 295px), 1fr)); gap: 14px; }
.maps--pgc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.map, .spectrum { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.map { overflow: hidden; }
.map-header, .map-options { padding: 10px 12px; }
.map-header { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-header span { color: var(--muted); font-size: 14px; }
.map canvas { display: block; width: 100%; aspect-ratio: 1.24; background: #f5f7f9; cursor: crosshair; touch-action: none; }
.maps--pgc .map canvas { aspect-ratio: 2.35; }
.map canvas:active { cursor: grabbing; }
.readout { min-height: 36px; padding: 7px 12px; font: 14px/1.4 ui-monospace, monospace; }
.map-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 50px; border-top: 1px solid var(--border); }
.map-options label { display: flex; gap: 4px; align-items: center; font-size: 14px; }
.map-options input { width: 64px; }
.map-options select, .map-options input { padding: 4px; font-size: 14px; }
.colorbar { height: 9px; margin: 0 12px; border-radius: 3px; }
.colorbar-ticks { display: flex; justify-content: space-between; margin: 4px 12px 8px; font-size: 14px; }
.bpt-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 14px; color: var(--muted); }
.bpt-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.bpt-plots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bpt-plots figure { margin: 0; min-width: 0; }
.bpt-square { position: relative; aspect-ratio: 1; }
.bpt-plot { position: absolute; inset: 0; }
.bpt-plots figcaption { padding: 0 10px 8px; }
.bpt-plots figcaption i { width: 16px; height: 0; border-radius: 0; border-top: 2px solid; vertical-align: middle; }
#bpt-link { color: var(--accent); font-size: 16px; }
.spectrum { margin-top: 24px; padding: 16px; }
.parameters { display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.parameters div { display: grid; gap: 4px; }
.parameters span { color: var(--muted); font-size: 15px; }
.parameters strong { font-size: 16px; font-weight: 600; }
#plot { width: 100%; min-height: 410px; }
footer { margin: 16px 0 0; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
@media (max-width: 1000px) {
  .bpt-plots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .maps--pgc { grid-template-columns: minmax(0, 1fr); }
  .bpt-plots { grid-template-columns: minmax(0, 1fr); }
}
