/* ═══════════════════════════════════════════════════════════════════════════
   Germinator AI — CoSE Theme Design System
   Adapted from the COSE (Centre of Space Evolution) brand palette used
   across dr-richard-barker's GitHub Pages projects.
   Features a light/dark toggle matching Material for MkDocs conventions.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CoSE Brand Palette ───────────────────────────────────────────────── */
:root {
  /* CoSE primaries (from cose.css) */
  --cose-blue:          #3B6EA5;
  --cose-blue-light:    #5a8bc0;
  --cose-blue-dark:     #2f5985;
  --cose-teal:          #3FB6A8;
  --cose-teal-light:    #54c9ba;

  /* CoSE logo colours (hexagon) */
  --cose-yellow:        #f5c542;
  --cose-green:         #4caf50;
  --cose-red:           #e57373;
  --cose-orange:        #ff9800;

  /* Plant biology accents for germination */
  --leaf-green:         #4caf50;
  --leaf-dark:          #2e7d32;
  --stem-green:         #66bb6a;
  --seed-brown:         #8d6e63;
  --radicle-white:      #e8f5e9;

  /* Seed state colours (universal) */
  --state-ungerminated: #78909c;
  --state-germinated:   #66bb6a;
  --state-uncertain:    #ffb74d;
  --state-seedling:     #43a047;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Timing */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:    150ms;
  --dur-normal:  250ms;
  --dur-slow:    400ms;
}

/* ─── LIGHT MODE (default) ─────────────────────────────────────────────── */
[data-theme="light"], :root {
  --bg-app:         #f8fafb;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f0f4f8;
  --bg-glass:       rgba(255, 255, 255, 0.75);
  --bg-hover:       rgba(59, 110, 165, 0.06);
  --bg-code:        #f0f4f8;

  --border-subtle:  rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.12);
  --border-focus:   rgba(59, 110, 165, 0.5);

  --text-primary:   #1a2332;
  --text-secondary: #566478;
  --text-muted:     #8a95a5;
  --text-accent:    #3B6EA5;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(59, 110, 165, 0.12);

  --accent-primary:   var(--cose-blue);
  --accent-secondary: var(--cose-teal);
  --accent-warm:      var(--cose-orange);
  --accent-error:     #e53935;
  --accent-info:      var(--cose-blue-light);

  --chart-grid:       rgba(0, 0, 0, 0.06);
  --chart-axis:       rgba(0, 0, 0, 0.2);
  --chart-text:       #566478;

  --header-bg:        var(--cose-blue);
  --header-text:      #ffffff;

  --card-value-color: var(--cose-blue);
}

/* ─── DARK MODE ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-app:         #0d1117;
  --bg-surface:     rgba(22, 27, 34, 0.92);
  --bg-elevated:    rgba(30, 37, 46, 0.92);
  --bg-glass:       rgba(22, 27, 34, 0.65);
  --bg-hover:       rgba(110, 163, 216, 0.08);
  --bg-code:        #161b22;

  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-focus:   rgba(110, 163, 216, 0.5);

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;
  --text-accent:    #6ea3d8;

  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(110, 163, 216, 0.15);

  --accent-primary:   #6ea3d8;
  --accent-secondary: #54c9ba;
  --accent-warm:      #ffb74d;
  --accent-error:     #ef5350;
  --accent-info:      #6ea3d8;

  --chart-grid:       rgba(255, 255, 255, 0.05);
  --chart-axis:       rgba(255, 255, 255, 0.15);
  --chart-text:       #8b949e;

  --header-bg:        #161b22;
  --header-text:      #e6edf3;

  --card-value-color: var(--cose-teal-light);
}

/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background var(--dur-normal) var(--ease-smooth),
              color var(--dur-normal) var(--ease-smooth);
}

/* ─── Glass Effect ─────────────────────────────────────────────────────── */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-subtle);
}

/* ─── Header (CoSE Blue Bar) ───────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  flex-shrink: 0;
  height: 52px;
  transition: background var(--dur-normal) var(--ease-smooth);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  height: 28px;
  width: 28px;
  border-radius: 4px;
}

.logo h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--header-text);
}

.logo .accent {
  background: linear-gradient(135deg, var(--cose-teal), var(--cose-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.version-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 8px;
  border-radius: 100px;
}

[data-theme="dark"] .version-badge {
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.header-nav {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .nav-btn {
  color: var(--text-secondary);
}

[data-theme="dark"] .nav-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
  margin-left: var(--space-sm);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(20deg);
}

[data-theme="dark"] .theme-toggle {
  color: var(--cose-yellow);
  background: var(--bg-elevated);
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--bg-hover);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }

/* ─── Main Layout ──────────────────────────────────────────────────────── */
#app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Upload / Landing State ───────────────────────────────────────────── */
#upload-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-lg);
}

.upload-area {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 280px;
}

.drop-zone {
  width: 100%;
  max-width: 640px;
  padding: var(--space-2xl) var(--space-xl);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-normal) var(--ease-smooth);
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(59, 110, 165, 0.06), transparent 70%);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-smooth);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
  opacity: 1;
}

.drop-zone-content { position: relative; z-index: 1; }

.upload-icon {
  margin-bottom: var(--space-md);
  opacity: 0.6;
  transition: transform var(--dur-normal) var(--ease-out);
}

.drop-zone:hover .upload-icon { transform: translateY(-4px); }

.drop-zone h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.drop-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.drop-subhint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-formats {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.format-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.03em;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-secondary); }

/* ─── Tutorial / Guide Section ─────────────────────────────────────────── */
.tutorial-section {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.tutorial-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  text-align: center;
}

.tutorial-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
}

.tutorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-smooth);
}

.tutorial-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tutorial-card .card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.tutorial-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.tutorial-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tutorial-card ul {
  margin: var(--space-sm) 0 0;
  padding-left: 1.2em;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.tutorial-card li {
  margin-bottom: 2px;
}

.tutorial-card code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent-primary);
}

.demo-cta {
  text-align: center;
  margin-top: var(--space-xl);
}

.btn-demo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--cose-blue), var(--cose-teal));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 110, 165, 0.3);
  transition: all var(--dur-fast) var(--ease-smooth);
}

.btn-demo:hover {
  box-shadow: 0 4px 16px rgba(59, 110, 165, 0.4);
  transform: translateY(-1px);
}

/* ─── Workspace ────────────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-md);
  padding: var(--space-md);
  overflow: hidden;
}

/* ─── Viewer Panel ─────────────────────────────────────────────────────── */
.viewer-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.tool-btn {
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
}
.tool-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.tool-btn.active { color: var(--text-primary); background: rgba(59, 110, 165, 0.12); }

.opacity-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.opacity-control input[type="range"] { width: 80px; accent-color: var(--accent-primary); }

.canvas-container {
  flex: 1;
  position: relative;
  background: #0a0e14;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.canvas-container canvas {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
#overlay-canvas {
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ─── Seed Tooltip ─────────────────────────────────────────────────────── */
.seed-tooltip {
  position: absolute; z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: tooltipIn var(--dur-fast) var(--ease-out);
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tooltip-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-xs); padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}
.seed-id { font-weight: 600; font-size: 0.8rem; }
.seed-state {
  font-size: 0.7rem; font-weight: 500;
  padding: 1px 6px; border-radius: 100px;
  background: var(--state-germinated); color: #000;
}
.tooltip-row {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; padding: 2px 0; color: var(--text-secondary);
}
.tooltip-row span:last-child { font-family: var(--font-mono); color: var(--text-primary); }

/* ─── Results Panel ────────────────────────────────────────────────────── */
.results-panel {
  display: flex; flex-direction: column; gap: var(--space-md);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.summary-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm);
}
.card {
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  transition: transform var(--dur-fast) var(--ease-out);
}
.card:hover { transform: translateY(-2px); }
.card-value {
  font-size: 1.6rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--card-value-color); line-height: 1.2;
}
.card-label {
  font-size: 0.7rem; color: var(--text-muted); margin-top: var(--space-xs);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ─── Chart Panel ──────────────────────────────────────────────────────── */
.chart-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-md);
}
.chart-header h3 { font-size: 0.9rem; font-weight: 600; }
.chart-controls { display: flex; gap: var(--space-xs); align-items: center; }

.chip {
  padding: 3px 10px; font-size: 0.7rem; font-weight: 500;
  color: var(--text-muted); background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); border-radius: 100px;
  cursor: pointer; transition: all var(--dur-fast) var(--ease-smooth);
}
.chip:hover { color: var(--text-secondary); border-color: var(--border-default); }
.chip.active {
  color: var(--text-primary);
  background: rgba(59, 110, 165, 0.12);
  border-color: rgba(59, 110, 165, 0.3);
}

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--text-muted); background: none;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--dur-fast) var(--ease-smooth);
}
.icon-btn:hover {
  color: var(--text-primary); background: var(--bg-hover);
  border-color: var(--border-default);
}

.chart-canvas { width: 100%; height: 200px; border-radius: var(--radius-sm); }

.hill-params {
  display: flex; flex-wrap: wrap; gap: var(--space-sm);
  font-size: 0.7rem; font-family: var(--font-mono); color: var(--text-muted);
  margin-top: var(--space-sm); padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

/* ─── QC Panel ─────────────────────────────────────────────────────────── */
.qc-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.qc-panel summary { cursor: pointer; list-style: none; }
.qc-panel summary h3 {
  font-size: 0.85rem; font-weight: 600;
  display: flex; align-items: center; gap: var(--space-sm);
}
.qc-panel summary h3::before {
  content: '▸'; font-size: 0.7rem; color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease-smooth);
}
.qc-panel[open] summary h3::before { transform: rotate(90deg); }
.qc-grid { display: grid; gap: var(--space-sm); margin-top: var(--space-md); }
.qc-item { display: flex; justify-content: space-between; font-size: 0.8rem; }
.qc-label { color: var(--text-secondary); }
.qc-value { font-family: var(--font-mono); font-weight: 500; }

/* ─── Export Bar ────────────────────────────────────────────────────────── */
.export-bar { display: flex; gap: var(--space-sm); }
.btn-primary, .btn-secondary {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font-size: 0.8rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--dur-fast) var(--ease-smooth);
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--cose-blue), var(--cose-teal));
  box-shadow: 0 2px 8px rgba(59, 110, 165, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(59, 110, 165, 0.4);
  transform: translateY(-1px);
}
.btn-secondary {
  color: var(--text-secondary); background: var(--bg-elevated);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ─── Timeline ─────────────────────────────────────────────────────────── */
.timeline-section {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
  flex-shrink: 0; height: 48px;
}
.timeline-controls { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; }
.timeline-label {
  font-size: 0.8rem; font-family: var(--font-mono); font-weight: 500;
  min-width: 60px; color: var(--accent-primary);
}
.timeline-track {
  flex: 1; height: 6px; background: var(--bg-elevated);
  border-radius: 3px; position: relative; cursor: pointer;
}
.timeline-fill {
  height: 100%; background: linear-gradient(90deg, var(--cose-blue), var(--cose-teal));
  border-radius: 3px; width: 0%;
  transition: width var(--dur-fast) var(--ease-smooth);
}
.timeline-scrubber {
  position: absolute; top: 50%; left: 0%;
  width: 14px; height: 14px;
  background: var(--accent-primary);
  border: 2px solid var(--bg-app);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab; z-index: 5;
  transition: box-shadow var(--dur-fast) var(--ease-smooth);
}
.timeline-scrubber:hover { box-shadow: 0 0 0 4px rgba(59, 110, 165, 0.2); }
.timeline-scrubber:active { cursor: grabbing; }
.timeline-info {
  flex-shrink: 0; font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono);
}

/* ─── Processing Overlay ───────────────────────────────────────────────── */
.processing-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
  z-index: 1000;
}
.processing-card {
  text-align: center;
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-xl);
  min-width: 300px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  margin: 0 auto var(--space-md);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: var(--space-xs); }
.processing-card p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: var(--space-md); }
.progress-bar { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cose-blue), var(--cose-teal));
  width: 0%; transition: width var(--dur-normal) var(--ease-smooth);
}

/* ─── Utilities ────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.panel { background: var(--bg-surface); }

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

/* ─── Footer ───────────────────────────────────────────────────────────── */
.app-footer {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-sm); padding: var(--space-sm) var(--space-lg);
  font-size: 0.7rem; color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.app-footer a {
  color: var(--accent-primary); text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .results-panel { max-height: 40vh; }
  .summary-cards { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  .summary-cards { grid-template-columns: 1fr 1fr; }
  #app-header { padding: var(--space-sm) var(--space-md); }
  .workspace { padding: var(--space-sm); }
  .tutorial-cards { grid-template-columns: 1fr; }
}

/* ─── CoSE embed mode (?embed=1) ───────────────────────────────────────── */
.cose-embed #app-header,
.cose-embed .app-footer,
.cose-embed .topbar,
.cose-embed .sitebar,
.cose-embed .map-scrim,
.cose-embed .cose-theme-btn,
.cose-embed .map-toggle,
.cose-embed .cose-brand { display: none !important; }

/* ─── Video-extraction options form ───────────────────────────────────── */
.form-card { text-align: left; min-width: 320px; }
.form-card h3 { text-align: center; }
.form-filename {
  font-size: 0.75rem; color: var(--text-muted); text-align: center;
  margin-bottom: var(--space-md); word-break: break-all;
}
.form-row { margin-bottom: var(--space-md); }
.form-row label {
  display: block; font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.form-row input[type="number"] {
  width: 100%; padding: 8px 10px; font-size: 0.85rem;
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
}
.form-row input[type="number"]:focus {
  outline: none; border-color: var(--border-focus);
}
.form-actions { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); }

/* ─── Entrance Animations ──────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeSlideUp var(--dur-slow) var(--ease-out) both; }
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 60ms; }
.card:nth-child(3) { animation-delay: 120ms; }
.card:nth-child(4) { animation-delay: 180ms; }
.chart-panel { animation: fadeSlideUp var(--dur-slow) var(--ease-out) 200ms both; }
.qc-panel { animation: fadeSlideUp var(--dur-slow) var(--ease-out) 300ms both; }
