/* ═══════════════════════════════════════════════════════════
   Stratosonde Balloon Catalog — Main Stylesheet
   v2 — No sidebar, full-width, collapsible dashboard
   ═══════════════════════════════════════════════════════════ */
@import url('tokens.css');
@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700|jetbrains-mono:400,500');

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
table { border-collapse: collapse; width: 100%; }
input, button, select { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-active); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT — Full-width, no sidebar
   ═══════════════════════════════════════════════════════════ */
#app-shell {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header"
    "main";
  height: 100vh;
  width: 100vw;
}

/* ── Header ──────────────────────────────────────────────── */
#site-header {
  grid-area: header;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-6);
  gap: var(--sp-4);
  z-index: 100;
  flex-wrap: wrap;
  min-height: var(--header-height);
}
.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
#site-header h1 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}
.header-center {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
  min-width: 0;
  justify-content: center;
}
.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Balloon selector in header ──────────────────────────── */
.balloon-selector-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
#balloon-select {
  padding: var(--sp-1) var(--sp-3);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  min-width: 240px;
  max-width: 400px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
#balloon-select:focus { border-color: var(--accent); }
#balloon-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}
#search-input {
  width: 120px;
  padding: var(--sp-1) var(--sp-3);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  outline: none;
  transition: border-color var(--transition);
}
#search-input:focus { border-color: var(--accent); width: 180px; }
#search-input::placeholder { color: var(--text-muted); }

/* ── Filter tags ─────────────────────────────────────────── */
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.filter-tag {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.filter-tag:hover { background: var(--bg-hover); color: var(--text-secondary); }
.filter-tag.active { background: var(--accent-bg); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════════════════ */
#main-content {
  grid-area: main;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Welcome panel ───────────────────────────────────────── */
#welcome-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
}
.welcome-content h2 {
  font-size: var(--font-size-2xl);
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}
.welcome-content p {
  max-width: 480px;
  margin: 0 auto var(--sp-6);
}
.welcome-stats {
  display: flex;
  gap: var(--sp-6);
  justify-content: center;
}
.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-6);
}
.stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}
.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Detail panel ────────────────────────────────────────── */
#detail-panel { display: none; flex-direction: column; }
#detail-panel.active { display: flex; }

/* ── Detail Header ───────────────────────────────────────── */
.detail-header {
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.detail-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
}
.detail-meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 2px;
}
.detail-tags {
  display: flex;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}
.detail-tag {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-bg);
  color: var(--accent);
}

/* ── Timeline bar ────────────────────────────────────────── */
#timeline-bar {
  padding: var(--sp-2) var(--sp-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.timeline-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.timeline-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition);
}
.timeline-btn:hover { border-color: var(--accent); color: var(--accent); }
.timeline-btn.active { background: var(--accent); color: var(--bg-page); border-color: var(--accent); }

#timeline-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-elevated);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
#timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56,189,248,0.4);
}
#timeline-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.timeline-time {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  min-width: 80px;
  text-align: right;
}

/* ── Readout bar ─────────────────────────────────────────── */
.readout-bar {
  display: flex;
  gap: var(--sp-6);
  margin-top: var(--sp-1);
  flex-wrap: wrap;
}
.readout-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
}
.readout-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.readout-value {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--accent);
}
.ref-frame-item {
  gap: var(--sp-2);
}
.ref-frame-input {
  width: 52px;
  padding: 1px 4px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  text-align: center;
}
.ref-frame-input:focus { border-color: var(--accent); outline: none; }

/* ── Readout tooltip ─────────────────────────────────────── */
.readout-item.has-tip {
  position: relative;
  cursor: help;
}
.readout-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: 1.55;
  white-space: normal;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: none;
}
.readout-tip b { color: var(--accent); }
.readout-item.has-tip:hover .readout-tip { display: block; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD — Collapsible, height-capped
   ═══════════════════════════════════════════════════════════ */
.dashboard-wrap {
  flex-shrink: 0;
  position: relative;
}
.dashboard-collapse-btn {
  display: block;
  width: 100%;
  background: var(--bg-elevated);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  padding: 3px var(--sp-4);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.dashboard-collapse-btn:hover { color: var(--accent); background: var(--bg-hover); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  height: 38vh;
  min-height: 240px;
  max-height: 420px;
  transition: height 0.3s ease, min-height 0.3s ease, max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}
.dashboard-grid.collapsed {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}
/* Dashboard right panel — switchable content per tab */
.dashboard-right-content { display: none; height: 100%; }
.dashboard-right-content.active { display: flex; flex-direction: column; height: 100%; }
.dashboard-right-content .panel-body { flex: 1; min-height: 0; }
.panel-body-scroll { overflow-y: auto; }
.dp-plot { width: 100%; height: 48%; min-height: 140px; }
#dp-dot-detail { height: 100%; }
.dashboard-right-panel { display: flex; flex-direction: column; }

.dashboard-panel {
  background: var(--bg-page);
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-1) var(--sp-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.panel-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.panel-controls {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}
.panel-controls label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.panel-controls input[type="checkbox"] {
  accent-color: var(--accent);
}
.panel-controls select {
  padding: 1px 4px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-xs);
  cursor: pointer;
}
.e-input-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.e-input-label input {
  padding: 1px 4px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
}
.panel-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Three.js canvas container + background image */
#viewer-container {
  width: 100%;
  height: 100%;
  position: relative;
}
#viewer-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  position: relative;
  z-index: 2;
}
.viewer-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.35;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.viewer-bg-image.hidden-photo {
  opacity: 0 !important;
}

/* 2D overlay canvas for dot selection */
.overlay-2d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;  /* transparent by default (3D mode) */
  cursor: default;
}
.overlay-2d.active {
  pointer-events: auto;   /* clickable in 2D mode */
  cursor: crosshair;
}

/* 2D mode: hide the Three.js canvas */
#viewer-container.mode-2d canvas:not(.overlay-2d) {
  opacity: 0 !important;
  pointer-events: none !important;
}
#viewer-container.mode-2d .viewer-bg-image {
  opacity: 1 !important;
}

/* 2D mode toggle label styling */
.mode-toggle-label {
  font-weight: 600;
  color: var(--accent) !important;
}
.mode-toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Strain legend */
.strain-legend {
  position: absolute;
  bottom: var(--sp-2);
  left: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(12,18,32,0.85);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--font-size-xs);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.legend-gradient {
  width: 80px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--strain-compression), var(--strain-zero), var(--strain-tension));
}
.legend-label { color: var(--text-muted); }

/* Plotly container */
#timeseries-plot {
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════ */
.tabs-row {
  display: flex;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: var(--sp-2) var(--sp-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Tab content panels */
.tab-panels {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.tab-panel { display: none; padding: var(--sp-6); }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.card h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  color: var(--text-primary);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

/* ── Data tables ─────────────────────────────────────────── */
.data-table th {
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table .numeric {
  font-family: var(--font-mono);
  text-align: right;
}

/* Key-value pair table (specs, results, conditions) */
.kv-table { width: 100%; }
.kv-table td:first-child {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  padding: var(--sp-1) var(--sp-2);
  width: 45%;
  white-space: nowrap;
}
.kv-table td:last-child {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  padding: var(--sp-1) var(--sp-2);
}

/* ── Code block ──────────────────────────────────────────── */
.code-block {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  overflow-x: auto;
  white-space: pre;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
}

/* ── Download links ──────────────────────────────────────── */
.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.download-link:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  text-decoration: none;
}
.download-icon { font-size: 1rem; }

/* ── Plotly charts in tabs ───────────────────────────────── */
.plot-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  margin-bottom: var(--sp-4);
  height: 340px;
  min-height: 240px;
  max-height: 400px;
  overflow: hidden;
}
.plot-container .js-plotly-plot {
  border-radius: var(--radius);
  width: 100% !important;
  height: 100% !important;
}

/* ── Stress inline inputs ────────────────────────────────── */
.stress-input-inline {
  margin-bottom: var(--sp-3);
}
.stress-input-inline label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.stress-input-inline input {
  padding: 2px 6px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

/* ═══════════════════════════════════════════════════════════
   COMPARISON TABLE (bottom section)
   ═══════════════════════════════════════════════════════════ */
#comparison-section {
  padding: var(--sp-6);
}
#comparison-section h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--sp-2);
}
#comparison-section .muted {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--sp-4);
}
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
#comparison-table {
  width: 100%;
  font-size: var(--font-size-sm);
}
#comparison-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
#comparison-table th:hover { color: var(--text-secondary); }
#comparison-table th.sort-asc::after { content: ' ↑'; color: var(--accent); }
#comparison-table th.sort-desc::after { content: ' ↓'; color: var(--accent); }
#comparison-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
#comparison-table tbody tr { cursor: pointer; }
#comparison-table tbody tr:hover td { background: var(--bg-hover); }
#comparison-table tbody tr:nth-child(even) td { background: var(--bg-surface); }
#comparison-table tbody tr:nth-child(even):hover td { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
footer {
  padding: var(--sp-4) var(--sp-6);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.hidden { display: none !important; }
.loading {
  text-align: center;
  padding: var(--sp-8);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }
  .dashboard-panel {
    min-height: 240px;
  }
  .header-center {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }
  #balloon-select { min-width: 180px; }
}

/* ═══════════════════════════════════════════════════════════
   BLOB TABLE — Marker inspector
   ═══════════════════════════════════════════════════════════ */
.blob-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.blob-filter-input {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: var(--font-size-sm);
  font-family: var(--font-mono);
  width: 100px;
}
.blob-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}
.blob-summary {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  flex: 1;
}
.blob-btn {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  white-space: nowrap;
}
.blob-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text-primary);
}
.blob-table-scroll {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.blob-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.blob-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.blob-table th {
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.blob-th-sort {
  cursor: pointer;
  user-select: none;
}
.blob-th-sort:hover {
  color: var(--accent);
}
.blob-th-action {
  width: 36px;
  text-align: center;
}
.blob-table td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
}
.blob-td-action {
  text-align: center;
  width: 36px;
}
.blob-row {
  cursor: pointer;
  transition: background 0.15s;
}
.blob-row:hover {
  background: rgba(56, 189, 248, 0.06);
}
.blob-row-selected {
  background: rgba(56, 189, 248, 0.12) !important;
  box-shadow: inset 3px 0 0 var(--accent);
}
.blob-row-hidden {
  opacity: 0.45;
}
.blob-row-hidden td {
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.15);
}
.blob-row-flash {
  animation: blob-flash 1.5s ease-out;
}
@keyframes blob-flash {
  0%   { background: rgba(251, 191, 36, 0.25); }
  100% { background: transparent; }
}
.blob-flag-short {
  border-left: 2px solid #fbbf24;
}
.blob-flag-outlier {
  border-left: 2px solid #f87171;
}
.blob-val-warn {
  color: #fbbf24 !important;
}
.blob-val-danger {
  color: #f87171 !important;
  font-weight: 600;
}
.blob-frac {
  color: var(--text-muted);
  font-size: 10px;
}
.blob-toggle-btn,
.blob-focus-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--text-secondary);
  line-height: 1;
}
.blob-toggle-btn:hover,
.blob-focus-btn:hover {
  background: rgba(255,255,255,0.08);
}
.blob-toggle-hidden {
  color: #f87171;
  opacity: 0.7;
}

/* Toast */
.blob-toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--accent);
  color: #fff;
  padding: 6px 18px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.blob-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   CAMERA VIEW — Video frame viewer
   ═══════════════════════════════════════════════════════════ */
.camera-view-wrap {
  border-top: 1px solid var(--border);
  background: var(--bg-page);
}
.camera-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-1) var(--sp-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.camera-canvas {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #000;
  display: block;
}

/* ═══════════════════════════════════════════════════════════
   BURST PHASE — Timeline highlight
   ═══════════════════════════════════════════════════════════ */
.timeline-controls {
  position: relative;
}
.burst-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: rgba(248, 113, 113, 0.5);
  border-radius: 0 3px 3px 0;
  pointer-events: none;
  z-index: 1;
}
.readout-item.burst-phase .readout-value {
  color: #f87171 !important;
}
.readout-item.burst-phase .readout-label {
  color: #f87171 !important;
}
/* Phase badge in readout */
.phase-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}
.phase-badge-burst {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}
.phase-badge-inflation {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
}

/* ═══ Blob Strain Tab ════════════════════════════════════════ */
.blob-strain-summary {
  display: flex;
  gap: 24px;
  padding: 10px 0 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.blob-strain-summary strong {
  color: var(--accent);
}
.blob-strain-table {
  width: 100%;
  font-size: 0.82rem;
}
.blob-strain-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding: 6px 8px;
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.blob-strain-table tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(30,45,69,0.3);
}
.blob-strain-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}
