/*
  Elemental — Sphaera Operis stylesheet
  Authored by Rowan Valle; Executed by Claude Code
  By Symbiont Systems LLC
*/

/* ── Local font faces — no external dependency ────────────────────── */

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/cinzel-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/poiret-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('assets/fonts/raleway-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/vt323-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Sphaera Operis palette (canonical Aurum Deco) ── */
  --gold1: #f5e6a3;
  --gold2: #d4af37;
  --gold3: #b8960c;
  --gold4: #8b7200;

  --violet1: #c8b8e8;
  --violet2: #9b72cf;
  --violet3: #6a3d9a;

  --cream:    #f0ead6;
  --obsidian: #0a0a0f;
  --onyx:     #131318;
  --charcoal: #1c1c24;

  /* ── Void background gradient ── */
  --void-1: #1a0033;
  --void-2: #0a0015;
  --void-3: #050010;

  /* ── Functional tokens ── */
  --bg:           var(--obsidian);
  --fg:           var(--cream);
  --fg-muted:     rgba(240, 234, 214, 0.82);
  --fg-faint:     rgba(240, 234, 214, 0.62);
  --fg-label:     rgba(212, 175, 55, 0.78);
  --accent:       var(--gold2);
  --accent-soft:  rgba(212, 175, 55, 0.55);
  --accent-glow:  rgba(212, 175, 55, 0.22);
  --line:         rgba(212, 175, 55, 0.55);
  --line-soft:    rgba(212, 175, 55, 0.25);
  --panel:        rgba(10, 0, 25, 0.92);
  --panel-blur:   blur(16px);

  --font-display:    'Cinzel', 'Times New Roman', serif;
  --font-deco:       'Poiret One', 'Cinzel', serif;
  --font-body:       'Raleway', system-ui, sans-serif;
  --font-mono:       'VT323', 'Courier New', monospace;

  --tracking-wide:    0.18em;
  --tracking-wider:   0.28em;
  --tracking-widest:  0.4em;

  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void-2);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  cursor: default;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, var(--void-1) 0%, var(--void-2) 45%, var(--void-3) 85%);
  z-index: 0;
}

canvas {
  display: block;
}

body.hovering { cursor: pointer; }

/* ──────────────────────────────────────────────────────────────────
   Splash screen
   ────────────────────────────────────────────────────────────────── */

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, var(--void-1) 0%, var(--void-2) 50%, var(--void-3) 100%);
  opacity: 1;
  transition: opacity 1.2s var(--ease);
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: 200vw;
  max-width: 4000px;
  height: auto;
  object-fit: contain;
  margin-bottom: 0;
  filter: drop-shadow(0 0 80px rgba(212, 175, 55, 1.0));
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.28));
  }
  15% {
    transform: scale(1.07);
    filter: drop-shadow(0 0 32px rgba(212, 175, 55, 0.55));
  }
  30% {
    transform: scale(1.0);
    filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.28));
  }
  45% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 26px rgba(212, 175, 55, 0.42));
  }
}

.splash-brand {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--gold1);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  margin-bottom: 16px;
  text-shadow: 0 0 18px rgba(212, 175, 55, 0.4);
}

.splash-tagline {
  font-family: var(--font-deco);
  font-size: 15px;
  font-style: italic;
  color: rgba(240, 234, 214, 0.78);
  letter-spacing: 0.1em;
  margin-bottom: 56px;
}

.splash-loading {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gold2);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  animation: pulse-loading 2s ease-in-out infinite;
}

@keyframes pulse-loading {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.95; }
}

/* ──────────────────────────────────────────────────────────────────
   HUD overlay (corner readouts)
   ────────────────────────────────────────────────────────────────── */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.6s var(--ease) 0.4s;
}

.hud[aria-hidden="false"] {
  opacity: 1;
}

.hud-corner {
  position: absolute;
  pointer-events: auto;
  padding: 18px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.6),
    inset 0 0 0 2px var(--line-soft);
}

.hud-tl { top: 24px; left: 24px; min-width: 220px; text-align: center; }
.hud-tr { top: 24px; right: 24px; min-width: 200px; text-align: right; }
.hud-bl { bottom: 24px; left: 24px; min-width: 240px; min-height: 64px; }
.hud-br { bottom: 24px; right: 24px; min-width: 180px; text-align: right; }

/* ── Masthead — arched title, centered, no panel ──────────────────── */

.masthead {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.hud[aria-hidden="false"] ~ .masthead,
.masthead.visible {
  opacity: 1;
}

.masthead-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold1);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
}

.masthead-tagline {
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 4px;
}

.hud-stat {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
}

.hud-label {
  color: var(--fg-label);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.hud-value {
  color: var(--gold1);
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.35);
}

.hud-element {
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}

.hud-element[aria-hidden="false"] {
  opacity: 1;
}

.hud-element-symbol {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--gold1);
  letter-spacing: 0.04em;
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.5);
  min-width: 40px;
}

.hud-element-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-element-name {
  font-family: var(--font-deco);
  font-size: 14px;
  color: var(--cream);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.hud-element-z {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
}

.hud-control {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-muted);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  line-height: 1.7;
}

.hud-key {
  color: var(--gold1);
  margin-right: 8px;
  font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────────
   Layout selector
   ────────────────────────────────────────────────────────────────── */

.layout-selector {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  pointer-events: auto;
  padding: 14px 22px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.6),
    inset 0 0 0 2px var(--line-soft),
    0 0 30px rgba(212, 175, 55, 0.08);
  opacity: 0;
  transition: opacity 0.6s var(--ease) 0.6s;
}

.layout-selector[aria-hidden="false"] { opacity: 1; }

.layout-selector-title {
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-label);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}

.layout-dropdown-wrap { position: relative; }

.layout-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  background: rgba(10, 0, 25, 0.88);
  border: 1px solid var(--line);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s;
}

.layout-trigger:hover { border-color: var(--gold2); }

.layout-trigger-chevron {
  color: var(--gold2);
  font-size: 12px;
}

.layout-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  max-height: 380px;
  overflow-y: auto;
  background: rgba(10, 0, 20, 0.96);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  scrollbar-color: var(--gold4) rgba(10, 0, 20, 0.4);
  scrollbar-width: thin;
  z-index: 20;
}

.layout-dropdown[aria-hidden="false"] { display: block; }

.layout-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 18px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--cream);
  font-family: var(--font-deco);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.layout-dropdown-item:last-child { border-bottom: none; }

.layout-dropdown-item:hover {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold1);
}

.layout-dropdown-item-active {
  color: var(--gold1);
  background: rgba(212, 175, 55, 0.08);
}

.layout-dropdown-item-active::before {
  content: '◈ ';
  color: var(--gold2);
}

/* ── Property space axis picker ────────────────────────────────── */
.property-axes-panel {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(10, 0, 25, 0.88);
  border: 1px solid var(--line);
}

.property-axes-panel[aria-hidden="false"] { display: block; }

.property-axes-title {
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--gold2);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 8px;
}

.property-axis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.property-axis-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold1);
  min-width: 20px;
  text-align: center;
}

.property-axis-select {
  flex: 1;
  padding: 5px 8px;
  background: rgba(10, 0, 25, 0.9);
  border: 1px solid var(--line-soft);
  color: var(--cream);
  font-family: var(--font-deco);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}

.property-axis-select option {
  background: #0a0a0f;
  color: var(--cream);
}

.property-axes-apply {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--line);
  color: var(--gold1);
  font-family: var(--font-deco);
  font-size: 12px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}

.property-axes-apply:hover {
  background: rgba(212, 175, 55, 0.2);
}

/* ──────────────────────────────────────────────────────────────────
   Series layout controls
   ────────────────────────────────────────────────────────────────── */

.series-controls {
  position: fixed;
  bottom: 80px;
  left: 20px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.series-controls[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.series-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.series-control-row:last-child { margin-bottom: 0; }

.series-label {
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--gold2);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  min-width: 80px;
}

.series-select {
  flex: 1;
  padding: 4px 8px;
  background: rgba(10, 0, 25, 0.9);
  border: 1px solid var(--line-soft);
  color: var(--cream);
  font-family: var(--font-deco);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}

.series-select option {
  background: #0a0a0f;
  color: var(--cream);
}

#series-temp-slider {
  flex: 1;
  accent-color: var(--gold1);
  cursor: pointer;
}

.series-temp-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gold1);
  min-width: 55px;
  text-align: right;
}

/* ── Series orbital hover panel ───────────────────────────────────── */

.series-orbital-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.series-orbital-panel[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.series-orbital-canvas {
  border: 1px solid var(--gold3, #8b7535);
  border-radius: 4px;
  image-rendering: pixelated;
  width: 160px;
  height: 160px;
}

.series-orbital-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--cream);
  text-align: center;
  max-width: 200px;
  word-wrap: break-word;
}


/* ──────────────────────────────────────────────────────────────────
   Hover tooltip
   ────────────────────────────────────────────────────────────────── */

.tooltip {
  position: fixed;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  pointer-events: none;
  z-index: 20;
  transform: translate(-50%, -130%);
  transition: opacity 0.12s var(--ease);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.55),
    0 0 24px rgba(212, 175, 55, 0.12);
}

.tooltip[aria-hidden="false"] { display: flex; }

.tooltip-symbol {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--gold1);
  letter-spacing: 0.05em;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}

.tooltip-name {
  font-family: var(--font-deco);
  font-size: 13px;
  color: var(--cream);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-top: 2px;
}

.tooltip-z {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  margin-top: 3px;
}

/* ──────────────────────────────────────────────────────────────────
   Detail panel (Phase A stub)
   ────────────────────────────────────────────────────────────────── */

.detail-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  transform: translateX(40px);
  width: min(540px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  padding: 0;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-out);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.6),
    inset 0 0 0 2px var(--line-soft),
    0 0 60px rgba(212, 175, 55, 0.12);
  overflow: hidden;
}

.detail-panel[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.detail-content {
  height: 100%;
  overflow-y: auto;
  padding: 0 30px 30px;
  scrollbar-color: var(--gold4) rgba(10, 0, 20, 0.4);
  scrollbar-width: thin;
}

.detail-content::-webkit-scrollbar { width: 6px; }
.detail-content::-webkit-scrollbar-track { background: rgba(10, 0, 20, 0.4); }
.detail-content::-webkit-scrollbar-thumb { background: var(--gold4); border-radius: 3px; }
.detail-content::-webkit-scrollbar-thumb:hover { background: var(--gold3); }

.detail-error {
  color: var(--violet1);
  text-align: center;
  font-family: var(--font-deco);
  padding: 32px;
}

.dp-loading {
  color: var(--fg-faint);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 24px;
  animation: pulse-loading 2s ease-in-out infinite;
}

/* ── Detail panel sticky header ─────────────────────────────────── */
.dp-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(10, 0, 25, 1);
  margin: 0 -30px;
  padding: 28px 30px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  /* Soft fade at bottom edge so it doesn't clip harshly */
  box-shadow: 0 8px 20px rgba(10, 0, 25, 0.95);
  border-bottom: 1px solid var(--line-soft);
}

.dp-symbol {
  display: block;
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 600;
  color: var(--gold1);
  letter-spacing: 0.02em;
  line-height: 1;
  margin: 0;
  text-shadow: 0 0 28px rgba(212, 175, 55, 0.55);
}

.dp-z {
  display: block;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--fg-muted);
  letter-spacing: 0.12em;
  margin-top: 8px;
}

.dp-name {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold1);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin-top: 6px;
  text-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
}

.dp-divider {
  display: block;
  font-family: var(--font-deco);
  font-size: 14px;
  color: var(--gold2);
  letter-spacing: 0.5em;
  margin-top: 14px;
  text-align: center;
}

/* ── Orbital explorer ──────────────────────────────────────────────── */

.orbital-explorer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 8px;
}

.orbital-canvas {
  border: 1px solid var(--gold3, #8b7535);
  border-radius: 4px;
  image-rendering: pixelated;
  width: 200px;
  height: 200px;
}

.orbital-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  max-width: 240px;
}

.orbital-toggle {
  font-family: var(--font-mono, 'VT323', monospace);
  font-size: 14px;
  padding: 2px 7px;
  border: 1px solid var(--gold3, #8b7535);
  border-radius: 3px;
  background: transparent;
  color: var(--fg-faint, #888);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.3;
}

.orbital-toggle.active {
  background: var(--gold1, #d4af37);
  color: var(--bg-deep, #0d0a14);
  border-color: var(--gold1, #d4af37);
}

.orbital-toggle:hover {
  border-color: var(--gold1, #d4af37);
}

.dp-footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  font-family: var(--font-deco);
  font-size: 13px;
  color: var(--fg-faint);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ── Domain section ─────────────────────────────────────────────── */
.dp-section {
  margin-top: 18px;
  border: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.18);
}

.dp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.06) 0%, rgba(212, 175, 55, 0.02) 100%);
  border-bottom: 1px solid var(--line-soft);
  user-select: none;
}

.dp-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold1);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
  flex: 1;
}

.dp-section-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  margin-left: 8px;
  letter-spacing: 0.05em;
}

.dp-section-chevron {
  color: var(--gold2);
  font-size: 12px;
  margin-left: 8px;
}

.dp-collapsed .dp-section-body { display: none; }

.dp-section-body {
  padding: 8px 14px 14px;
}

.dp-subsection-title {
  font-family: var(--font-deco);
  font-size: 13px;
  color: var(--gold1);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin: 14px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--line-soft);
}

.dp-subsection-title:first-child { margin-top: 4px; }

.dp-section-note {
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-muted);
  font-style: italic;
  text-align: center;
  margin: 10px 0 6px;
}

.dp-section-inline-divider {
  text-align: center;
  font-family: var(--font-deco);
  font-size: 13px;
  color: var(--gold3);
  letter-spacing: 0.4em;
  margin: 14px 0 6px;
}

.dp-extra-list {
  margin-top: 6px;
}

.dp-extra-list summary {
  cursor: pointer;
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-label);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 6px 0;
  list-style: none;
}

.dp-extra-list summary::-webkit-details-marker { display: none; }
.dp-extra-list summary::before { content: '▸ '; color: var(--gold2); }
.dp-extra-list[open] summary::before { content: '▾ '; }

.dp-extra-list-body {
  padding-left: 12px;
}

.dp-narrative {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  color: var(--cream);
  margin: 8px 0 14px;
}

/* ── Sourced row ────────────────────────────────────────────────── */
.so-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}

.so-row:last-child { border-bottom: none; }

.so-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.so-label {
  font-family: var(--font-deco);
  color: var(--gold1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  flex-shrink: 0;
}

.so-label-block {
  font-family: var(--font-deco);
  color: var(--gold1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  margin-bottom: 6px;
}

.so-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-body);
  color: var(--cream);
  font-weight: 400;
  text-align: right;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.so-value.muted { color: var(--fg-faint); font-style: italic; }

.so-value-text {
  color: var(--cream);
}

.so-unit {
  color: var(--fg-muted);
  font-size: 13px;
  margin-left: 2px;
}

.so-source-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}

.so-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 1px 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold2);
  letter-spacing: 0.05em;
  transition: color 0.15s, border-color 0.15s;
}

.so-toggle:hover {
  color: var(--gold1);
  border-color: var(--line);
}

.so-source-badge {
  text-transform: uppercase;
}

.so-disputed {
  color: var(--violet1);
  margin-right: 2px;
}

.so-chevron {
  font-size: 12px;
}

.so-sources {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(212, 175, 55, 0.04);
  border-left: 2px solid var(--gold3);
}

.so-source-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  font-size: 12px;
  font-family: var(--font-mono);
}

.so-source-row + .so-source-row {
  border-top: 1px dotted var(--line-soft);
}

.so-source-name {
  color: var(--fg-label);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.so-source-value {
  color: var(--cream);
  text-align: right;
}

.so-year {
  color: var(--fg-faint);
  margin-left: 4px;
}

.so-note {
  display: block;
  color: var(--fg-faint);
  font-size: 12px;
  font-style: italic;
  font-family: var(--font-deco);
}

/* Bare row (non-sourced) */
.so-row-bare .so-source-tag,
.so-row-bare .so-toggle { display: none; }

/* Chip list */
.so-row-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.so-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.so-chip {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--cream);
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 3px 8px;
  letter-spacing: 0.02em;
}

/* ── Isotope table ──────────────────────────────────────────────── */
.isotope-table-wrap {
  margin-top: 6px;
  overflow-x: auto;
}

.isotope-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
}

.isotope-table thead th {
  text-align: left;
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  font-weight: normal;
}

.isotope-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px dotted var(--line-soft);
  color: var(--cream);
}

.isotope-table tbody tr:hover { background: rgba(212, 175, 55, 0.06); }

.iso-stable { color: var(--gold1); font-weight: 600; }
.iso-row-stable { background: rgba(212, 175, 55, 0.04); }
.iso-a { color: var(--gold2); font-weight: 600; }

/* ── Ionic radii table ──────────────────────────────────────────── */
.ionic-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 6px;
}

.ionic-table thead th {
  text-align: left;
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  font-weight: normal;
}

.ionic-table tbody td {
  padding: 4px 7px;
  border-bottom: 1px dotted var(--line-soft);
  color: var(--cream);
}

/* ── Spectrum visualizer ────────────────────────────────────────── */
.spectrum-wrap {
  margin: 8px 0;
}

.spectrum-svg {
  width: 100%;
  height: 64px;
  display: block;
}

.spectrum-caption {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.spectral-list {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.spectral-line-row {
  display: grid;
  grid-template-columns: 100px 60px 1fr;
  gap: 8px;
  padding: 3px 0;
  color: var(--cream);
  border-bottom: 1px dotted var(--line-soft);
}

.spectral-wl { color: var(--gold1); }
.spectral-class { color: var(--fg-muted); }
.spectral-intensity { color: var(--fg-faint); text-align: right; }

/* ── X-ray table ────────────────────────────────────────────────── */
.xray-table, .nmr-table, .abundance-table, .producer-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 6px;
}

.xray-table th, .nmr-table th, .abundance-table th, .producer-table th {
  text-align: left;
  font-family: var(--font-deco);
  font-size: 12px;
  color: var(--fg-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  font-weight: normal;
}

.xray-table td, .nmr-table td, .abundance-table td, .producer-table td {
  padding: 4px 7px;
  border-bottom: 1px dotted var(--line-soft);
  color: var(--cream);
}

/* ── End-use bars ───────────────────────────────────────────────── */
.enduse-list {
  margin-top: 6px;
}

.enduse-row {
  display: grid;
  grid-template-columns: 1fr 80px 36px;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}

.enduse-label {
  font-family: var(--font-body);
  color: var(--cream);
}

.enduse-bar {
  display: block;
  height: 4px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--line-soft);
  position: relative;
}

.enduse-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold3), var(--gold1));
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}

.enduse-pct {
  font-family: var(--font-mono);
  color: var(--gold2);
  text-align: right;
  font-size: 12px;
}

/* ── Anomaly list ───────────────────────────────────────────────── */
.anomaly-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
}

.anomaly-list li {
  position: relative;
  padding: 6px 0 6px 16px;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--cream);
  line-height: 1.5;
  border-bottom: 1px dotted var(--line-soft);
}

.anomaly-list li::before {
  content: '◆';
  position: absolute;
  left: 0;
  top: 6px;
  color: var(--gold2);
  font-size: 12px;
}

.anomaly-list li:last-child { border-bottom: none; }

/* Stepped corners */
.detail-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--gold2);
  border-style: solid;
  border-width: 0;
}
.detail-corner-tl { top: -1px; left: -1px;  border-top-width: 2px; border-left-width: 2px; }
.detail-corner-tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.detail-corner-bl { bottom: -1px; left: -1px;  border-bottom-width: 2px; border-left-width: 2px; }
.detail-corner-br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.detail-close {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 10;
  background: none;
  border: none;
  color: var(--gold2);
  font-size: 28px;
  line-height: 1;
  font-family: var(--font-deco);
  cursor: pointer;
  padding: 4px 10px;
  transition: color 0.2s var(--ease);
}

.detail-close:hover { color: var(--gold1); }

/* ──────────────────────────────────────────────────────────────────
   Commentary — annotations, glossary, citations (Phase B.5)
   ────────────────────────────────────────────────────────────────── */

/* ── Annotation markers (inline on data rows) ──────────────────── */
.annotation-markers {
  display: inline-flex;
  gap: 2px;
  margin-left: 8px;
  vertical-align: middle;
}

.annotation-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  transition: opacity 0.15s;
}

.annotation-marker:hover .annotation-mark { color: var(--gold1); }

.annotation-mark {
  font-size: 12px;
  color: var(--gold2);
  transition: color 0.15s;
}

.annotation-marker[aria-expanded="true"] .annotation-mark {
  color: var(--gold1);
}

/* ── Annotation body (expanded below the row) ──────────────────── */
.annotation-body {
  padding: 16px 18px 18px;
  margin: 6px 0 8px;
  background: rgba(212, 175, 55, 0.04);
  border-left: 2px solid var(--gold2);
  border-bottom: 1px solid var(--line-soft);
  animation: annotation-fadein 0.25s var(--ease);
}

@keyframes annotation-fadein {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.annotation-error {
  color: var(--violet1);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Commentary prose (shared between annotations and glossary) ── */
.commentary-prose {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.72;
  color: var(--cream);
  max-width: 52ch;
}

.commentary-prose p { margin: 0; }
.commentary-prose p + p { margin-top: 12px; }

.commentary-lede {
  font-size: 14px;
  line-height: 1.68;
  font-weight: 400;
}

.commentary-h1, .commentary-h2 {
  font-family: var(--font-display);
  color: var(--gold1);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
  margin: 0 0 10px;
}
.commentary-h1 { font-size: 16px; font-weight: 500; }
.commentary-h2 { font-size: 14px; font-weight: 500; }
.commentary-h3 { font-family: var(--font-deco); font-size: 13px; color: var(--fg-label); margin: 14px 0 6px; letter-spacing: var(--tracking-wide); text-transform: uppercase; }

.commentary-hr {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 16px 0;
}

.commentary-quote {
  border-left: 2px solid var(--gold3);
  padding: 8px 14px;
  margin: 10px 0;
  font-style: italic;
  color: var(--fg-muted);
}

.commentary-prose em { font-style: italic; }
.commentary-prose strong { font-weight: 600; color: var(--gold1); }
.commentary-prose code { font-family: var(--font-mono); font-size: 12px; color: var(--violet1); background: rgba(106, 61, 154, 0.1); padding: 1px 4px; border-radius: 2px; }

.commentary-link {
  color: var(--gold2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  transition: color 0.15s, border-color 0.15s;
}
.commentary-link:hover { color: var(--gold1); border-color: var(--gold2); }

.commentary-glossary-link {
  color: var(--gold2);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold3);
  cursor: pointer;
  transition: color 0.15s;
}
.commentary-glossary-link:hover { color: var(--gold1); }

/* ── Citation markers and references ───────────────────────────── */
.commentary-cite-marker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gold2);
  cursor: default;
  vertical-align: super;
  line-height: 1;
  margin: 0 1px;
}

.commentary-references {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.commentary-references-title {
  font-family: var(--font-deco);
  font-size: 13px;
  color: var(--fg-label);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.commentary-references-list {
  padding-left: 24px;
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.commentary-reference {
  margin-bottom: 6px;
}

.cite-title { font-style: italic; }
.cite-journal { }
.cite-doi {
  color: var(--gold3);
  font-size: 12px;
  text-decoration: none;
  word-break: break-all;
}
.cite-doi:hover { color: var(--gold1); }
.cite-note {
  font-size: 12px;
  color: var(--fg-faint);
  font-style: italic;
  margin-top: 2px;
}

/* ── Glossary panel ────────────────────────────────────────────── */
.glossary-panel {
  position: fixed;
  top: 24px;
  left: 24px;
  bottom: 24px;
  width: min(520px, 90vw);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  padding: 0;
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-30px);
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-out);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.6),
    inset 0 0 0 2px var(--line-soft),
    0 0 50px rgba(212, 175, 55, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.glossary-panel[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.glossary-corner {
  position: absolute;
  width: 18px; height: 18px;
  border-color: var(--gold2);
  border-style: solid; border-width: 0;
}
.glossary-corner-tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.glossary-corner-tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.glossary-corner-bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.glossary-corner-br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.glossary-close {
  position: absolute; top: 8px; right: 14px;
  background: none; border: none;
  color: var(--gold2); font-size: 26px; line-height: 1;
  font-family: var(--font-deco); cursor: pointer;
  padding: 4px 10px; z-index: 2;
  transition: color 0.2s;
}
.glossary-close:hover { color: var(--gold1); }

.glossary-header {
  padding: 30px 28px 16px;
  flex-shrink: 0;
}

.glossary-title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 500;
  color: var(--gold1);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
  margin-bottom: 14px;
}

.glossary-search {
  width: 100%;
  padding: 9px 14px;
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.15s;
}
.glossary-search:focus { border-color: var(--gold2); }
.glossary-search::placeholder { color: var(--fg-faint); }

.glossary-back {
  display: block;
  padding: 8px 28px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--gold2);
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
  flex-shrink: 0;
}
.glossary-back:hover { color: var(--gold1); }
.glossary-back[aria-hidden="true"] { display: none; }

.glossary-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 24px;
  scrollbar-color: var(--gold4) rgba(10, 0, 20, 0.4);
  scrollbar-width: thin;
}

.glossary-entry-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(212, 175, 55, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  color: var(--cream);
  cursor: pointer;
  text-align: left;
  margin-bottom: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.glossary-entry-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--line);
}

.glossary-entry-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--gold1);
  letter-spacing: 0.06em;
}

.glossary-entry-tags {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
}

.glossary-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 28px 28px;
  scrollbar-color: var(--gold4) rgba(10, 0, 20, 0.4);
  scrollbar-width: thin;
}

.glossary-content[aria-hidden="true"] { display: none; }

.glossary-loading, .glossary-error {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-faint);
  letter-spacing: 0.1em;
  padding: 32px;
}

/* ── Search ────────────────────────────────────────────────────── */
.search-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 12;
  width: min(300px, 40vw);
  opacity: 0;
  transition: opacity 0.4s var(--ease) 0.5s;
}

.search-container[aria-hidden="false"] { opacity: 1; }

.search-input {
  width: 100%;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.03em;
  outline: none;
  transition: border-color 0.15s;
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.5),
    0 0 30px rgba(212, 175, 55, 0.06);
}

.search-input:focus {
  border-color: var(--gold2);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.5),
    0 0 40px rgba(212, 175, 55, 0.12);
}

.search-input::placeholder {
  color: var(--fg-faint);
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.search-results {
  display: none;
  flex-direction: column;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow:
    inset 0 0 0 1px rgba(10, 0, 20, 0.5),
    0 0 30px rgba(212, 175, 55, 0.08);
  max-height: 360px;
  overflow-y: auto;
}

.search-results[aria-hidden="false"] { display: flex; }

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  color: var(--cream);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  width: 100%;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result-active { background: rgba(212, 175, 55, 0.08); }

.search-result-symbol {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold1);
  min-width: 36px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.search-result-name {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--cream);
  flex: 1;
}

.search-result-z {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

/* ── HUD color mode toggle ─────────────────────────────────────── */
.hud-color-toggle {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

/* ── Custom overlay dropdown ────────────────────────────────────── */
.hud-color-toggle { position: relative; }

.overlay-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  background: rgba(10, 0, 25, 0.88);
  border: 1px solid var(--line);
  color: var(--cream);
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s;
}

.overlay-trigger:hover { border-color: var(--gold2); }

.overlay-trigger-chevron {
  color: var(--gold2);
  font-size: 12px;
  margin-left: 10px;
}

.overlay-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(10, 0, 20, 0.96);
  border: 1px solid var(--line);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  scrollbar-color: var(--gold4) rgba(10, 0, 20, 0.4);
  scrollbar-width: thin;
  z-index: 20;
}

.overlay-dropdown[aria-hidden="false"] { display: block; }

.overlay-dropdown::-webkit-scrollbar { width: 5px; }
.overlay-dropdown::-webkit-scrollbar-track { background: rgba(10, 0, 20, 0.4); }
.overlay-dropdown::-webkit-scrollbar-thumb { background: var(--gold4); }

.overlay-group-header {
  padding: 10px 14px 5px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--gold2);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  border-top: 1px solid var(--line-soft);
}

.overlay-group-header:first-child { border-top: none; }

.overlay-item {
  display: block;
  width: 100%;
  padding: 7px 14px 7px 24px;
  background: none;
  border: none;
  color: var(--cream);
  font-family: var(--font-deco);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.overlay-item:hover {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold1);
}

.overlay-item-active {
  color: var(--gold1);
  background: rgba(212, 175, 55, 0.08);
}

.overlay-item-active::before {
  content: '◈ ';
  color: var(--gold2);
}

.hud-color-btn {
  background: none;
  border: 1px solid var(--line-soft);
  color: var(--fg-faint);
  font-family: var(--font-deco);
  font-size: 12px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.hud-color-btn:hover {
  color: var(--gold2);
  border-color: var(--line);
}

.hud-color-btn.active {
  color: var(--gold1);
  border-color: var(--gold2);
  background: rgba(212, 175, 55, 0.1);
}

/* ── HUD glossary button ───────────────────────────────────────── */
.hud-glossary-btn {
  display: inline-block;
  background: none;
  border: 1px solid var(--line);
  color: var(--gold2);
  font-family: var(--font-deco);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 4px 10px;
  cursor: pointer;
  margin-top: 10px;
  transition: color 0.15s, border-color 0.15s;
}
.hud-glossary-btn:hover {
  color: var(--gold1);
  border-color: var(--gold2);
}

/* ──────────────────────────────────────────────────────────────────
   Reduced motion
   ────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .splash, .hud, .layout-selector, .detail-panel, .tooltip {
    transition: none;
  }
  .splash-logo {
    animation: none;
  }
  .splash-loading {
    animation: none;
  }
}

/* ── Mobile gear — hidden on desktop ───────────────────────────────── */
.mobile-gear,
.mobile-gear-panel {
  display: none;
}

/* ──────────────────────────────────────────────────────────────────
   Mobile — scene + title + search + gear. Nothing else.
   ────────────────────────────────────────────────────────────────── */

@media (pointer: coarse) {
  /* Touch device — phone or tablet, any orientation. Kill all HUD corners */
  .hud-corner { display: none; }

  /* Masthead: just "Elemental", no tagline, centered top */
  .masthead { top: 12px; }
  .masthead-title {
    font-size: 18px;
    letter-spacing: 0.3em;
  }
  .masthead-tagline { display: none; }

  /* Search: bottom center, thumb-accessible */
  .search-container {
    top: auto;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(280px, 80vw);
  }
  .search-input {
    padding: 10px 16px;
    font-size: 14px;
    text-align: center;
  }
  .search-results {
    bottom: 100%;
    top: auto;
    margin-bottom: 4px;
  }

  /* Gear icon: top-right corner */
  .mobile-gear {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 25;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-soft);
    border-radius: 50%;
    background: var(--panel);
    backdrop-filter: var(--panel-blur);
    color: var(--gold2);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s var(--ease);
  }
  .mobile-gear:active { opacity: 0.6; }

  /* Gear panel: slides down from top-right */
  .mobile-gear-panel {
    position: fixed;
    top: 58px;
    right: 12px;
    z-index: 24;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: var(--panel-blur);
    padding: 14px 16px;
    min-width: 240px;
    max-width: 85vw;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .mobile-gear-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .mobile-gear-panel .layout-selector-title,
  .mobile-gear-panel .series-label {
    font-size: 11px;
  }

  /* Show gear icon and panel on mobile */
  .mobile-gear { display: flex; }
  .mobile-gear-panel { display: block; }

  /* Everything inside the gear panel is visible and reset from desktop positioning */
  .mobile-gear-panel .layout-selector,
  .mobile-gear-panel .layout-selector[aria-hidden="true"] {
    display: block !important;
    position: static !important;
    transform: none !important;
    padding: 0 !important;
    margin-bottom: 12px;
    background: none !important;
    border: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .mobile-gear-panel .series-controls,
  .mobile-gear-panel .series-controls[aria-hidden="true"] {
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin-top: 12px;
    background: none !important;
    border: none !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .mobile-gear-panel #hud-color-toggle {
    margin-top: 12px;
  }
  .mobile-gear-panel .hud-glossary-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid var(--line);
    color: var(--gold1);
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    cursor: pointer;
  }

  /* Series orbital hover panel — redundant on mobile */
  .series-orbital-panel { display: none; }

  /* Tooltip — hide on mobile (tap opens detail panel) */
  .tooltip { display: none; }

  /* Detail panel — full screen */
  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    right: 0;
  }
  .detail-content {
    padding: 16px 18px 24px;
  }
  .dp-symbol { font-size: 56px; }
  .dp-name { font-size: 18px; }

  /* Glossary panel — full screen */
  .glossary-panel {
    width: 100vw;
    max-width: 100vw;
  }

  /* Orbital explorer — compact */
  .orbital-explorer { padding: 10px 0 6px; }
  .orbital-canvas { width: 160px; height: 160px; }
  .orbital-toggles { max-width: 220px; }
  .orbital-toggle { font-size: 12px; padding: 2px 5px; }

  /* Splash logo — fit screen */
  .splash-logo { width: 95vw; max-width: 95vw; }
}
