/* ==========================================================================
   Earthquake Prediction Engine — Observatory Dark Design System
   ========================================================================== */

:root {
  --bg-primary: #0a0e14;
  --bg-surface: #111722;
  --bg-surface-raised: #182030;
  --bg-surface-hover: #222d42;
  --border-subtle: #243046;
  --border-strong: #3b4d6e;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --ch-ehz: #00ff88;
  --ch-enz: #00d2ff;
  --ch-enn: #ffaa00;
  --ch-ene: #d080ff;

  --alert-critical: #f85149;
  --alert-warning: #f0883e;
  --alert-advisory: #e3b341;
  --alert-info: #58a6ff;

  --env-stadium: #f43f5e;
  --env-concert: #c084fc;
  --env-traffic: #f59e0b;
  --env-human: #10b981;
  --env-wind: #38bdf8;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.observatory-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.observatory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #555;
}

.pulse-indicator.online {
  background-color: #00ff88;
  box-shadow: 0 0 8px #00ff88aa;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.station-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.meta-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.meta-value.highlight {
  color: var(--ch-ehz);
  font-family: var(--font-mono);
}

.meta-value.live {
  color: var(--ch-enz);
  font-family: var(--font-mono);
  font-size: 11px;
}

.meta-value.mono {
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Buttons & Controls
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
}

.btn-secondary {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--ch-enz);
}

.btn-outline-warning {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
}

.btn-outline-warning:hover {
  background: rgba(255,255,255,0.2);
}

/* --------------------------------------------------------------------------
   Warning HUD Banner
   -------------------------------------------------------------------------- */
.warning-hud {
  background: linear-gradient(90deg, #991b1b, #dc2626);
  border-bottom: 2px solid #ef4444;
  padding: 10px 20px;
  animation: slide-down 0.25s ease-out;
  flex-shrink: 0;
  z-index: 100;
}

@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.warning-hud-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.warning-badge {
  background-color: #000;
  color: #ef4444;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.1em;
}

.warning-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0 20px;
}

.warning-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.warning-sub {
  font-size: 12px;
  color: #fecaca;
}

.warning-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.3);
  padding: 4px 12px;
  border-radius: 4px;
  margin-right: 16px;
}

.countdown-label {
  font-size: 9px;
  color: #fca5a5;
  font-weight: 700;
}

.countdown-value {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Incoming Wavefront HUD Banner (USGS External Quakes)
   -------------------------------------------------------------------------- */
.incoming-hud {
  background: linear-gradient(90deg, #075985, #0284c7);
  border-bottom: 2px solid #38bdf8;
  padding: 8px 20px;
  animation: slide-down 0.25s ease-out;
  flex-shrink: 0;
  z-index: 99;
}

.incoming-hud-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.incoming-badge {
  background-color: #000;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.incoming-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0 16px;
}

.incoming-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.incoming-sub {
  font-size: 11px;
  color: #bae6fd;
}

.incoming-countdowns {
  display: flex;
  gap: 10px;
  margin-right: 16px;
}

.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.35);
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.box-label {
  font-size: 8px;
  font-weight: 700;
  color: #7dd3fc;
}

.box-val {
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background-color: var(--bg-surface-raised);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-group {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.tab-btn.active {
  background: var(--bg-primary);
  color: #fff;
  border-color: var(--border-strong);
  font-weight: 600;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-group label {
  font-size: 11px;
  color: var(--text-muted);
}

.form-select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--ch-enz);
}

.channel-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 10px;
}

.ch-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
}

.ch-checkbox.ch-ehz { color: var(--ch-ehz); }
.ch-checkbox.ch-enz { color: var(--ch-enz); }
.ch-checkbox.ch-enn { color: var(--ch-enn); }
.ch-checkbox.ch-ene { color: var(--ch-ene); }

/* --------------------------------------------------------------------------
   Main Content Panels
   -------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-primary);
}

.tab-panel {
  display: none;
  height: 100%;
  width: 100%;
  padding: 6px 10px;
  overflow: hidden;
  box-sizing: border-box;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   Oscilloscope View
   -------------------------------------------------------------------------- */
.oscilloscope-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.channel-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10.5px;
  flex-shrink: 0;
}

.ch-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ch-tag {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
}

.ch-tag-ehz { background: rgba(0, 255, 136, 0.15); color: var(--ch-ehz); }
.ch-tag-enz { background: rgba(0, 210, 255, 0.15); color: var(--ch-enz); }
.ch-tag-enn { background: rgba(255, 170, 0, 0.15); color: var(--ch-enn); }
.ch-tag-ene { background: rgba(208, 128, 255, 0.15); color: var(--ch-ene); }

.ch-desc {
  color: var(--text-muted);
}

.ch-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.dev-badge {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.dev-badge.dev-normal {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.dev-badge.dev-elevated {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.dev-badge.dev-anomalous {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.ch-metrics b {
  color: var(--text-primary);
}

.canvas-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #0a0e17;
}

.trace-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.symbology-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* Trigger drop flag */
.trigger-flag {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--alert-critical);
  box-shadow: 0 0 6px var(--alert-critical);
  animation: flag-pulse 1s infinite alternate;
}

.trigger-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #000;
  color: #fff;
  border: 1px solid var(--alert-critical);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
  font-weight: 700;
}

@keyframes flag-pulse {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* S-Wave shaded corridor */
.s-wave-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(240, 136, 62, 0.15);
  border-left: 1px dashed var(--alert-warning);
  border-right: 1px dashed var(--alert-warning);
}

/* USGS Theoretical Arrival Flag */
.usgs-flag {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8aa;
}

.usgs-badge {
  position: absolute;
  top: 24px;
  left: 4px;
  background: #0284c7;
  color: #fff;
  border: 1px solid #38bdf8;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
  font-weight: 700;
}

.theor-s-flag {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed #f59e0b;
}

/* --------------------------------------------------------------------------
   Spectrogram View
   -------------------------------------------------------------------------- */
.spectrogram-container, .helicorder-container, .events-container, .radar-container, .urban-container, .phasenet-container, .psd-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.panel-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  flex-shrink: 0;
}

.panel-header-title h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.panel-header-title .panel-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.panel-header-badges {
  display: flex;
  gap: 6px;
}

.meta-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-secondary);
}

.spectrogram-dual-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 6px;
  width: 100%;
  height: 100%;
}

.spec-waveform-wrapper {
  flex: 0.35;
  min-height: 0;
  width: 100%;
  position: relative;
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.spec-waterfall-wrapper {
  flex: 0.65;
  min-height: 0;
  width: 100%;
  position: relative;
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.spec-waveform-canvas, .spectrogram-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.helicorder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.helicorder-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.hud-select {
  background: #111827;
  color: #f1f5f9;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
}

.hud-select:focus {
  border-color: #38bdf8;
}

.helicorder-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.heli-image-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #060913;
}

.heli-live-img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.helicorder-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   STA/LTA & RSAM View
   -------------------------------------------------------------------------- */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.telemetry-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.card-header h4 {
  font-size: 11.5px;
  color: #fff;
}

.threshold-badge, .rsam-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-secondary);
}

.canvas-wrapper-sm {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  position: relative;
}

.stalta-canvas, .rsam-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Hodogram
   -------------------------------------------------------------------------- */
.hodogram-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.hodogram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.hodo-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px;
  overflow: hidden;
}

.hodo-card h4 {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-align: center;
  flex-shrink: 0;
}

.hodo-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Event Table
   -------------------------------------------------------------------------- */
.table-responsive {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: var(--font-mono);
}

.events-table th {
  text-align: left;
  padding: 6px 8px;
  background: var(--bg-surface-raised);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.events-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.events-table th.sortable:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.events-table th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

.events-table th.sortable.sorted {
  color: var(--ch-enz);
  background: rgba(0, 210, 255, 0.08);
  border-bottom: 2px solid var(--ch-enz);
}

.events-table th.sortable.sorted .sort-arrow {
  color: var(--ch-enz);
  opacity: 1;
  font-weight: 800;
}

.events-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Science & Interpretation Guides
   -------------------------------------------------------------------------- */
.science-guide {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 11px;
  flex-shrink: 0;
}

.guide-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 10.5px;
}

.guide-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.guide-chevron {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.science-guide.collapsed .guide-chevron {
  transform: rotate(-90deg);
}

.science-guide.collapsed .guide-content {
  display: none;
}

.guide-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 14, 23, 0.85);
}

.guide-col h5 {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guide-col p {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 0;
}

.guide-col b {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   ML Dataset & Annotation Panel
   -------------------------------------------------------------------------- */
.ml-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow-y: auto;
  padding: 4px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ch-enz);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   ML Dataset & Review Studio
   -------------------------------------------------------------------------- */
.ml-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.ml-review-studio {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.studio-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.studio-time-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.studio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-raised);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-size: 11px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-info {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.range-info b {
  color: var(--text-primary);
}

.review-canvas-container {
  position: relative;
  width: 100%;
  height: 240px;
  background: #030712;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
}

.review-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.review-selection-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

.selection-box {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 210, 255, 0.18);
  border-left: 2px solid #00d2ff;
  border-right: 2px solid #00d2ff;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4px;
}

.selection-label {
  background: #00d2ff;
  color: #030712;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.review-tag-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.precision-tag-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-title {
  font-size: 11px;
  font-weight: 700;
  color: #00d2ff;
  margin-right: 4px;
}

.btn-tag-mini {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tag-mini:hover {
  background: rgba(0, 210, 255, 0.2);
  border-color: #00d2ff;
  color: #fff;
}

.custom-crop-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Action Buttons in Catalog Table */
.btn-action-inspect {
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.4);
  color: #00d2ff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-right: 4px;
}

.btn-action-inspect:hover {
  background: rgba(0, 210, 255, 0.3);
  color: #fff;
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.4);
}

.btn-action-delete {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* --------------------------------------------------------------------------
   Waveform Snippet Inspector Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.snippet-modal {
  background: #0b101e;
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: 10px;
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 210, 255, 0.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.modal-subtitle {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-traces-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.modal-trace-card {
  background: #030712;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.modal-trace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
}

.modal-trace-metric {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.modal-canvas-wrap {
  width: 100%;
  height: 90px;
  background: #030712;
}

.modal-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.modal-features-card {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px 16px;
}

.modal-features-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.feat-item {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.feat-label {
  color: var(--text-secondary);
}

.feat-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #00ff88;
}

.btn-tag {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tag:hover {
  background: var(--bg-surface-hover);
  border-color: var(--ch-ehz);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.15);
}

.btn-tag:active {
  transform: translateY(0);
  background: rgba(0, 255, 136, 0.2);
}

.ml-custom-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px 16px;
}

.custom-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.form-item-wide {
  flex: 1;
  min-width: 220px;
}

.form-input {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-sans);
  outline: none;
}

.form-input:focus {
  border-color: var(--ch-enz);
}

.btn-primary {
  background: #0284c7;
  color: #fff;
  border: 1px solid #38bdf8;
  padding: 6px 14px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #0369a1;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.ml-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-num {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--ch-ehz);
  margin-top: 4px;
}

.stat-desc {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   8. Epicenter Radar & Faults Map
   -------------------------------------------------------------------------- */
.radar-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.radar-map-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.radar-leaflet-map {
  width: 100%;
  height: 100%;
  background: #060911;
}

.radar-hud-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.radar-hud-card {
  background: rgba(10, 14, 23, 0.88);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hud-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.hud-val {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
  margin-top: 2px;
}

.hud-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.radar-hud-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.radar-status-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}

.badge-normal {
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-elevated {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-weird {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse-border 1.5s infinite alternate;
}

.radar-hud-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
}

.radar-breakdown-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
}

.radar-breakdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.radar-legend-card {
  padding: 8px 10px;
}

.radar-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.legend-row b {
  color: var(--text-primary);
}

/* Leaflet Layer Switcher Control */
.leaflet-control-layers {
  background: rgba(15, 23, 42, 0.92) !important;
  border: 1px solid var(--border-subtle) !important;
  backdrop-filter: blur(10px) !important;
  border-radius: 6px !important;
  color: #f8fafc !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  padding: 6px 10px !important;
}

.leaflet-control-layers-toggle {
  background-color: rgba(15, 23, 42, 0.92) !important;
  border-radius: 4px !important;
  border: 1px solid var(--border-subtle) !important;
}

.leaflet-control-layers-base label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Epicenter Radar Top Floating Basemap View Selector
   -------------------------------------------------------------------------- */
.radar-floating-basemap-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 15, 26, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.3);
  backdrop-filter: blur(12px);
  padding: 5px 10px;
  border-radius: 30px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.15);
  z-index: 1000;
  pointer-events: auto;
}

.basemap-bar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
  margin-right: 4px;
  user-select: none;
}

.basemap-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

.basemap-pill:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

.basemap-pill.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3) 0%, rgba(14, 165, 233, 0.4) 100%);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Epicenter Radar Left-Side Dynamic Events Drawer
   -------------------------------------------------------------------------- */
.radar-events-drawer {
  position: absolute;
  top: 12px;
  left: 54px;
  bottom: 12px;
  width: 330px;
  max-width: calc(100vw - 380px);
  background: rgba(10, 15, 26, 0.90);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.radar-events-drawer.collapsed {
  width: 38px;
  cursor: pointer;
}

.drawer-collapsed-bar {
  display: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  width: 100%;
  height: 100%;
  padding: 16px 4px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
}

.drawer-collapsed-bar:hover {
  background: rgba(56, 189, 248, 0.1);
}

.radar-events-drawer.collapsed .drawer-collapsed-bar {
  display: flex;
}

.radar-events-drawer.collapsed .drawer-header,
.radar-events-drawer.collapsed .drawer-events-list {
  display: none;
}

.drawer-header {
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-title-group {
  display: flex;
  flex-direction: column;
}

.drawer-title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.drawer-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.drawer-historic-toggle {
  display: flex;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-filter-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.drawer-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.drawer-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.drawer-tab.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.drawer-tab[data-filter="historic"].active {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.hud-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: #fbbf24;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}

.hud-checkbox {
  accent-color: #f59e0b;
  cursor: pointer;
  width: 13px;
  height: 13px;
}

/* Historic Starburst Markers */
.historic-starburst-marker {
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  overflow: visible !important;
  z-index: 9999 !important;
}

.historic-starburst-svg {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  overflow: visible !important;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 4px #ef4444);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: starburstPulse 2.8s ease-in-out infinite alternate;
}

@keyframes starburstPulse {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.18); filter: drop-shadow(0 0 16px rgba(239, 68, 68, 1.0)) drop-shadow(0 0 6px #fbbf24); }
}

.historic-starburst-marker:hover .historic-starburst-svg {
  transform: scale(1.35) !important;
  filter: drop-shadow(0 0 20px rgba(239, 68, 68, 1.0)) drop-shadow(0 0 8px #ffffff) !important;
}

.mag-historic {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.3) 0%, rgba(239, 68, 68, 0.35) 100%);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}

.drawer-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  font-family: var(--font-mono);
}

.drawer-subtitle {
  font-size: 8.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.drawer-badge {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-sort-group {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.hud-select-sm {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-subtle);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 3px 6px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.hud-input-sm {
  flex: 1;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-subtle);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 3px 8px;
  border-radius: 4px;
  outline: none;
}

.hud-input-sm:focus {
  border-color: #38bdf8;
}

.drawer-events-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-loading, .drawer-empty {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.radar-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.radar-event-item:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.radar-event-item.active-item {
  background: rgba(14, 165, 233, 0.18);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.event-mag-badge {
  min-width: 46px;
  height: 38px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.event-mag-num {
  font-size: 13px;
  line-height: 1;
}

.event-mag-tag {
  font-size: 7.5px;
  opacity: 0.8;
  margin-top: 2px;
}

.mag-strong {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}

.mag-moderate {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.5);
}

.mag-minor {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.5);
}

.mag-micro {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
}

.event-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-place {
  font-size: 11px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.event-dist {
  color: #94a3b8;
}

.event-time {
  color: #00ff88;
}

.event-zone-tag {
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  align-self: flex-start;
  border: 1px solid transparent;
}

.legend-line {
  width: 18px;
  height: 0px;
  border-top: 2px solid #fff;
  display: inline-block;
}

.line-hayward {
  border-color: #ef4444;
  border-style: dashed;
}

.line-sanandreas {
  border-color: #f59e0b;
  border-style: solid;
}

.line-calaveras {
  border-color: #d97706;
  border-style: dashed;
}

.line-regional {
  border-color: #38bdf8;
  border-style: dashed;
}

.legend-section-title {
  font-size: 8px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.dot-micro {
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

.dot-minor {
  background: #eab308;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

.dot-light {
  background: #f97316;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.dot-strong {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.legend-zone-swatch {
  width: 14px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.swatch-geysers {
  background: rgba(245, 158, 11, 0.25);
  border: 1px dashed #f59e0b;
}

.swatch-longvalley {
  background: rgba(236, 72, 153, 0.25);
  border: 1px dashed #ec4899;
}

.swatch-salton {
  background: rgba(6, 182, 212, 0.25);
  border: 1px dashed #06b6d4;
}

.swatch-parkfield {
  background: rgba(16, 185, 129, 0.25);
  border: 1px dashed #10b981;
}

/* Cluster Zone Leaflet Popups */
.cluster-zone-popup .leaflet-popup-content-wrapper {
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7) !important;
}

.cluster-zone-popup .leaflet-popup-tip {
  background: #0f172a !important;
}

/* --------------------------------------------------------------------------
   9. Urban Profiler & Cultural Noise
   -------------------------------------------------------------------------- */
.env-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 1200px) {
  .env-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.env-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.env-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.env-title-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.env-title-group h4 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-sub {
  font-size: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-badge {
  font-size: 8.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.env-meter-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.env-meter-fill {
  height: 100%;
  background: var(--ch-ehz);
  border-radius: 3px;
  transition: width 0.25s ease;
}

#envCardStadium { border-top: 3px solid var(--env-stadium); }
#envFillStadium { background: var(--env-stadium) !important; }

#envCardConcert { border-top: 3px solid var(--env-concert); }
#envFillConcert { background: var(--env-concert) !important; }

#envCardTraffic { border-top: 3px solid var(--env-traffic); }
#envFillTraffic { background: var(--env-traffic) !important; }

#envCardHuman { border-top: 3px solid var(--env-human); }
#envFillHuman { background: var(--env-human) !important; }

#envCardWind { border-top: 3px solid var(--env-wind); }
#envFillWind { background: var(--env-wind) !important; }

.env-details {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.env-details b {
  color: var(--text-primary);
}

.env-canvas-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-wrapper-sm {
  flex: 1;
  min-height: 0;
  position: relative;
}

.env-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   10. AI PhaseNet & Wave Picker
   -------------------------------------------------------------------------- */
.phasenet-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.phasenet-meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.phasenet-canvas-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.phase-canvas-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 8px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.phase-label {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-bottom: 2px;
  flex-shrink: 0;
}

.phase-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   11. Peterson Noise Model
   -------------------------------------------------------------------------- */
.psd-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.psd-canvas-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 6px;
}

.psd-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   12. Seismic Sonification
   -------------------------------------------------------------------------- */
.sonification-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sonification-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.son-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.form-range {
  cursor: pointer;
  accent-color: var(--ch-ehz);
}

.son-visualizer-wrapper {
  flex: 1;
  min-height: 0;
  background: #050814;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.son-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.observatory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  height: 24px;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sep {
  color: var(--border-subtle);
}

.status-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #00ff88;
}

.status-indicator-dot.online {
  box-shadow: 0 0 4px #00ff88;
}

/* ==========================================================================
   Public Observatory Mode (11mosswood.us)
   ========================================================================== */
body.public-mode #simUsgsBtn,
body.public-mode #simTriggerBtn,
body.public-mode #audioToggle,
body.public-mode .tab-btn[data-tab="sonification"],
body.public-mode .tab-btn[data-tab="ml"],
body.public-mode #tab-sonification,
body.public-mode #tab-ml {
  display: none !important;
}
