:root {
  --bg: #06140f;
  --panel: #0b1c17;
  --panel-2: #0f271f;
  --line: #1d4b3d;
  --line-hi: #38d985;
  --text: #d9ffe9;
  --muted: #87a898;
  --hot: #e6ff6a;
  --cyan: #00e5ff;
  --red: #ff5b73;
  --orange: #ffb000;
  --violet: #b38cff;
  --font-sans: "Familjen Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    linear-gradient(90deg, rgba(56, 217, 133, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(56, 217, 133, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 35% 30%, rgba(0, 229, 255, 0.10), transparent 38%),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto;
  color: var(--text);
  font-family: var(--font-sans);
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.iso-strip, .iso-foot {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 20, 15, 0.92);
  color: var(--muted);
  font: 12px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.iso-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: center;
  min-height: 38px;
}
.brand {
  color: var(--line-hi);
  font-weight: 700;
  letter-spacing: 0.18em;
}
.scope { color: var(--text); }
nav { display: flex; gap: 14px; }

.iso-shell {
  min-height: calc(100vh - 86px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}
.stage {
  position: relative;
  min-height: calc(100vh - 86px);
  overflow: hidden;
}
#nuclide-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.hud {
  position: absolute;
  left: 18px;
  top: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font: 12px var(--font-mono);
  pointer-events: none;
}
.hud-title {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(6, 20, 15, 0.72);
  padding: 7px 9px;
}
.hud-count {
  color: var(--hot);
  border: 1px solid rgba(230, 255, 106, 0.45);
  background: rgba(6, 20, 15, 0.72);
  padding: 7px 9px;
}
.tooltip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line-hi);
  background: rgba(3, 12, 9, 0.92);
  color: var(--text);
  font: 12px var(--font-mono);
  pointer-events: none;
  box-shadow: 0 0 18px rgba(56, 217, 133, 0.2);
}

.panel {
  border-left: 1px solid var(--line);
  background: rgba(11, 28, 23, 0.94);
  min-height: calc(100vh - 86px);
  padding: 18px;
  overflow: auto;
}
.panel-section {
  border-bottom: 1px solid rgba(56, 217, 133, 0.2);
  padding: 0 0 16px;
  margin: 0 0 16px;
}
.panel-section:last-child { border-bottom: 0; }
.panel-section.compact { padding-bottom: 14px; }
.eyebrow, .section-title, .query-label {
  margin: 0 0 8px;
  color: var(--line-hi);
  font: 11px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}
.lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.select-line, .check-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font: 13px var(--font-mono);
  margin: 8px 0;
}
.check-line { justify-content: flex-start; }
/* Tint the dynamically-injected breeding toggle's checkbox cyan to match the
   U-238 -> Pu-239 overlay color drawn in the 3D scene (0x00e5ff). */
#breeding-overlay { accent-color: var(--cyan); }
select, input, textarea, button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: 13px var(--font-mono);
}
select, input { min-height: 32px; padding: 4px 7px; }
textarea {
  width: 100%;
  resize: vertical;
  padding: 8px;
  line-height: 1.35;
}
button {
  min-height: 34px;
  padding: 7px 10px;
  cursor: pointer;
}
button:hover {
  border-color: var(--line-hi);
  color: var(--hot);
}
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
/* One-click focus presets (T5): two-up grid of buttons, each enables an overlay,
   traces it, and flies the camera to frame it. Matches the .button-row rhythm
   and the project mono font; swatch dot mirrors the 3D overlay color. */
.preset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.preset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: 12px var(--font-mono);
  cursor: pointer;
}
.preset-btn:hover {
  border-color: var(--line-hi);
  color: var(--hot);
}
.preset-swatch {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  box-shadow: 0 0 8px currentColor;
}
.preset-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slice-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font: 11px var(--font-mono);
}
.mini-note {
  margin: 8px 0 0;
  color: var(--muted);
  font: 11px/1.4 var(--font-mono);
}
.transport-row {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(96px, 1.1fr);
  gap: 8px;
  align-items: stretch;
  margin: 10px 0;
}
.transport-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font: 10px var(--font-mono);
  text-transform: uppercase;
}
.time-scrub {
  width: 100%;
  min-height: 28px;
  padding: 0;
  accent-color: var(--hot);
}
.time-scrub:disabled {
  opacity: 0.42;
}
.query-label + textarea {
  min-height: 96px;
}
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 11px var(--font-mono);
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  box-shadow: 0 0 10px currentColor;
}
.detail .empty {
  margin: 0;
  color: var(--muted);
  font: 13px var(--font-mono);
}
.detail-card {
  display: grid;
  gap: 8px;
}
.detail-title {
  color: var(--hot);
  font: 700 22px var(--font-mono);
}
.kv {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  color: var(--muted);
  font: 12px var(--font-mono);
}
.kv strong {
  color: var(--text);
  font-weight: 500;
}
.wiki-link {
  display: inline-flex;
  justify-content: center;
  border: 1px solid var(--line-hi);
  padding: 7px 10px;
  color: var(--line-hi);
  font: 12px var(--font-mono);
}
.transient-chip {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(230, 255, 106, 0.42);
  color: var(--hot);
  padding: 4px 7px;
  font: 11px var(--font-mono);
}
/* Shell-closure (magic-number) pill in the detail card (T6). Default singly-magic
   reads in the chart accent green; doubly-magic gets the brighter --hot border +
   glow so the rarest, most-stable nuclides (Pb-208, Ca-40, ...) visibly pop. */
.magic-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line-hi);
  border-radius: 2px;
  color: var(--line-hi);
  padding: 2px 7px;
  font: 11px var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.magic-badge.doubly {
  border-color: var(--hot);
  color: var(--hot);
  box-shadow: 0 0 10px rgba(230, 255, 106, 0.35);
}

/* Fixture-honesty caption under the transient controls (T7). Muted, italic, and
   left-rule-marked so it reads as a non-licensed-data caveat, not a result. Only
   shown (via the .hidden attr toggled in JS) while a preset is active; the text
   is sourced from the transient dataset's own source.note. */
.fixture-chip {
  margin: 8px 0 0;
  padding: 6px 9px;
  border-left: 2px solid rgba(135, 168, 152, 0.55);
  color: var(--muted);
  background: rgba(15, 39, 31, 0.45);
  font: italic 11px/1.4 var(--font-mono);
  letter-spacing: 0.02em;
}
.fixture-chip[hidden] { display: none; }

/* Overlay declutter toggle row (T7): a compact stack of checkboxes that hide/show
   the magic-number guides, the breeding ladder, and the decay-chain lines for a
   clean demo scatter. Reuses the existing .check-line rhythm from the markup. */
.overlay-toggles {
  display: grid;
  gap: 4px;
}
.overlay-toggles .section-title {
  margin: 0 0 4px;
}
.overlay-toggles .check-line {
  margin: 2px 0;
}

@media (max-width: 980px) {
  .iso-shell { grid-template-columns: 1fr; }
  .stage { min-height: 62vh; }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: auto;
  }
}
@media (max-width: 620px) {
  .iso-strip {
    align-items: flex-start;
    flex-direction: column;
  }
  .hud {
    left: 10px;
    right: 10px;
    align-items: flex-start;
    flex-direction: column;
  }
  .legend { grid-template-columns: 1fr; }
  .transport-row { grid-template-columns: 1fr; }
  .preset-row { grid-template-columns: 1fr; }
}
