/* ==========================================================================
   Golfshot Tracer Studio — Premium Dark Tactical Design System
   ========================================================================== */

:root {
  color-scheme: dark;
  /* Color Palette */
  --bg-canvas: #090d14;
  --bg-surface: #111722;
  --bg-surface-elevated: #162030;
  --bg-surface-hover: #1c2a3e;
  --border-subtle: #1e2c40;
  --border-active: #38bdf8;

  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.25);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Elevation & Borders */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
}

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Header */
.app-header {
  min-height: 64px;
  height: auto;
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(17, 23, 34, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  min-height: 64px;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.brand-title h1 span {
  color: var(--accent-cyan);
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Main Layout Grid */
.studio-layout {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
}

@media (max-width: 1080px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
}

/* Left Section: Viewport Card */
.viewport-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.viewport-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.view-mode-tabs {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-canvas);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
  max-width: 100%;
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.view-tab:hover {
  color: var(--text-secondary);
}

.view-tab.active {
  background-color: var(--bg-surface-elevated);
  color: var(--accent-cyan);
}

.video-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-dot.active {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

/* Video Stage */
.video-stage {
  flex: 1;
  min-height: 480px;
  background-color: #05070a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.upload-dropzone {
  position: relative;
  width: calc(100% - 32px);
  margin: 16px;
  padding: 28px 28px;
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 229, 255, 0.03);
}

.dropzone-content {
  text-align: center;
  max-width: 820px;
  width: 100%;
}

.drop-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  background-color: var(--bg-surface-elevated);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.upload-dropzone:hover .drop-icon {
  color: var(--accent-cyan);
}

.dropzone-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-content p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dropzone-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.video-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.video-wrapper.split-view video {
  width: 50%;
  height: 100%;
  object-fit: contain;
  border-right: 1px solid var(--border-subtle);
}

/* Processing Overlay */
.processing-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(9, 13, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.spinner-box {
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.radar-pulse {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 0 0 var(--accent-cyan-glow);
  animation: pulse-ring 1.6s cubic-bezier(0.2, 0, 0, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 20px rgba(0, 229, 255, 0);
  }
  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
  }
}

.progress-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.progress-bar-container {
  height: 6px;
  background-color: var(--bg-surface-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00e5ff, #38bdf8);
  transition: width 0.2s ease;
}

.progress-info p {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Playback Control Bar */
.player-controls {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
}

.control-row-timeline {
  margin-bottom: 10px;
}

.timeline-slider {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-surface-elevated);
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

.control-row-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.left-controls, .right-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.speed-selector {
  display: inline-flex;
  background-color: var(--bg-canvas);
  border-radius: var(--radius-sm);
  padding: 2px;
  flex-shrink: 0;
}

.btn-speed {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-speed.active {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
}

/* Right Section: Sidebar Studio */
.studio-sidebar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(9, 13, 20, 0.4);
}

.sidebar-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 14px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sidebar-tab:hover {
  color: var(--text-secondary);
}

.sidebar-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background-color: rgba(0, 229, 255, 0.02);
}

.sidebar-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Settings Controls */
.settings-group {
  margin-bottom: 20px;
}

.group-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.theme-pill {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-pill:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.theme-pill.active {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 229, 255, 0.06);
  color: var(--text-primary);
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.slider-header span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
}

.custom-slider {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-surface-elevated);
  outline: none;
}

.custom-slider::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #f8fafc;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Segmented Radio */
.segment-control {
  display: flex;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.segment-option {
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.segment-option input {
  display: none;
}

.segment-option span {
  display: block;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.segment-option input:checked + span {
  background-color: var(--bg-surface);
  color: var(--accent-cyan);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-title {
  font-size: 13px;
  font-weight: 500;
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-surface-elevated);
  transition: 0.2s;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-secondary);
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

input:checked + .slider-round:before {
  transform: translateX(16px);
  background-color: #090d14;
}

/* Analytics Tab & Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.analytics-chart-box {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.chart-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

#trajectory-canvas {
  width: 100%;
  height: 160px;
  display: block;
}

.export-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00e5ff, #0284c7);
  color: #04101d;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-outline:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-demo-pill {
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
}

.btn-demo-pill:hover {
  background: rgba(0, 229, 255, 0.2);
}

.btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.btn-large {
  padding: 12px 20px;
  font-size: 14px;
}

.full-width {
  width: 100%;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background-color: rgba(9, 13, 20, 0.4);
}

/* ===== Golfshot v2 HITL Studio Additions ===== */
.sample-picker-wrap {
  position: relative;
}

.samples-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 80;
}

.sample-item-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}

.sample-item-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--accent-cyan);
}

.sample-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.sample-item-meta {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.sample-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.dropzone-sample-cards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: left;
}

.dropzone-sample-cards .sample-item-btn {
  background-color: rgba(17, 23, 34, 0.85);
  border: 1px solid var(--border-subtle);
}

.viewport-right-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.diff-filter-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}

.diff-filter-group.is-active {
  border-color: rgba(0, 229, 255, 0.55);
}

.diff-filter-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 5px 0 6px;
  white-space: nowrap;
  user-select: none;
}

.btn-diff-mode {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.btn-diff-mode:hover {
  color: var(--text-primary);
  background-color: rgba(148, 163, 184, 0.12);
}

.btn-diff-mode.active[data-diff-mode="off"] {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-diff-mode.active[data-diff-mode="2f"] {
  background-color: rgba(0, 229, 255, 0.2);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.45);
}

.btn-diff-mode.active[data-diff-mode="3f"] {
  background-color: rgba(16, 185, 129, 0.22);
  color: #34d399;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.5);
}

.hitl-toolbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(9, 13, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background-color: var(--bg-canvas);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-btn:hover {
  color: var(--text-primary);
}

.tool-btn.active {
  background-color: var(--accent-cyan);
  color: #04101d;
}

.tool-btn.danger.active {
  background-color: var(--accent-rose);
  color: #ffffff;
}

.quick-frame-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.nudge-touch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background-color: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.28);
}

.nudge-touch-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.nudge-touch-btns {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nudge-touch-btns .btn-mini {
  min-width: 34px;
  min-height: 28px;
  font-size: 13px;
  font-weight: 700;
}

#btn-nudge-step-toggle.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background-color: rgba(0, 229, 255, 0.14);
}

.btn-mini, .btn-mini-step {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-mini:hover:not(:disabled), .btn-mini-step:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-mini:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#diff-frame-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 12;
  display: none;
}

#annotation-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 15;
}

#annotation-overlay.interactive-cursor {
  pointer-events: auto;
  touch-action: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath stroke='%23000000' stroke-opacity='0.85' stroke-width='3' d='M16 2v7M16 23v7M2 16h7M23 16h7'/%3E%3Cpath stroke='%23ffffff' stroke-width='1.4' d='M16 2v7M16 23v7M2 16h7M23 16h7'/%3E%3C/g%3E%3Ccircle cx='16' cy='16' r='2.1' fill='%23000000' fill-opacity='0.85'/%3E%3Ccircle cx='16' cy='16' r='1.3' fill='%23ffffff'/%3E%3C/svg%3E") 16 16, crosshair;
}

#btn-toggle-hide-overlays.active {
  background-color: rgba(0, 229, 255, 0.16);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.compact-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-grid-2 > div {
  min-width: 0;
}

.num-action-row {
  display: flex;
  gap: 6px;
}

.num-input {
  width: 100%;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--accent-rose);
  font-size: 11px;
  cursor: pointer;
}

.anchor-list {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  max-height: 170px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.anchor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 4px;
  background-color: var(--bg-surface-elevated);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.anchor-row:hover {
  border: 1px solid var(--accent-cyan);
}

.anchor-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.anchor-tag.prop {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.anchor-tag.ignored {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
}

.hitl-next-card {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 229, 255, 0.32);
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.08), rgba(15, 23, 42, 0.9));
}

.hitl-next-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.hitl-next-summary {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 10px;
}

.hitl-next-summary b {
  color: var(--text-primary);
}

.hitl-next-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.hitl-next-actions .btn {
  justify-content: center;
  text-align: center;
  font-size: 11px;
  padding: 6px 8px;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 11px;
  padding: 8px;
  text-align: center;
}

/* ===== Guided Workflow Bar, Onboarding & Polish (v2.1) ===== */
.workflow-guide-wrap {
  max-width: 1600px;
  width: 100%;
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflow-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  gap: 10px;
  overflow-x: auto;
}

.wf-step {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.45;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.wf-step.active,
.wf-step.done {
  opacity: 1;
}

.wf-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wf-step.active .wf-num {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #04101d;
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.wf-step.done .wf-num {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #04101d;
}

.wf-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.wf-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.wf-sep {
  flex: 1;
  min-width: 16px;
  height: 1px;
  background-color: var(--border-subtle);
}

.coach-banner {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.08), rgba(17, 23, 34, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.coach-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coach-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: rgba(0, 229, 255, 0.16);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
  white-space: nowrap;
}

.coach-text {
  font-size: 12.5px;
  color: var(--text-primary);
}

.btn-compact {
  padding: 6px 12px;
  font-size: 12px;
}

.view-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.hitl-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.hitl-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-context-hint {
  font-size: 11.5px;
  color: var(--text-secondary);
  background-color: rgba(17, 23, 34, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

.onboarding-steps {
  margin: 16px 0 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: left;
}

.onboarding-card {
  background-color: rgba(17, 23, 34, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.ob-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.ob-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.dropzone-autocheck {
  justify-content: center;
  margin-bottom: 14px;
  color: var(--text-primary);
  white-space: normal;
  text-align: left;
}

.footer-post-analysis {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-row-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(4, 8, 15, 0.78);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.help-modal {
  max-width: 760px;
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.help-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.help-modal-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.help-modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.help-step-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.help-step-card {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.help-step-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.help-step-card h4 {
  font-size: 13px;
  margin-bottom: 4px;
}

.help-step-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.help-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shortcut-pill {
  font-size: 11px;
  color: var(--text-secondary);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.shortcut-pill kbd {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
}

.help-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.studio-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--accent-cyan);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 250;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.studio-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .workflow-guide-wrap {
    padding: 0 14px;
  }
  .onboarding-steps,
  .dropzone-sample-cards,
  .help-step-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Experiments & Benchmark Lab (/experiments.html)
   ========================================================================== */

.exp-container {
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mono {
  font-family: var(--font-mono);
}

.exp-muted, .muted {
  color: var(--text-muted);
}

.em { color: var(--accent-emerald); }
.am { color: var(--accent-amber); }
.rs { color: var(--accent-rose); }

.exp-run-banner {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.exp-run-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.exp-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.exp-run-title {
  font-size: 13px;
  font-weight: 600;
}

.exp-run-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.exp-run-bar-wrap {
  width: 240px;
  height: 7px;
  background-color: var(--bg-canvas);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.exp-run-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  transition: width 0.35s ease;
}

/* Row 1: KPI Cards */
.exp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.exp-kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.exp-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.exp-kpi-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-em { color: var(--accent-emerald); }
.kpi-am { color: var(--accent-amber); }
.kpi-rs { color: var(--accent-rose); }

.exp-kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Panels */
.exp-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exp-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.exp-panel-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.exp-panel-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.exp-chip-info {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  white-space: nowrap;
}

/* Row 2: Diagnostic Grid */
.exp-diag-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
}

.exp-phase-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exp-phase-row {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 13px;
}

.exp-phase-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.exp-phase-name {
  font-size: 13px;
  font-weight: 600;
}

.exp-phase-range {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: 6px;
}

.exp-phase-stats {
  font-size: 12px;
  color: var(--text-primary);
}

.exp-bar-track, .exp-mini-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-surface-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.exp-mini-track {
  height: 4px;
  margin-top: 4px;
}

.exp-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.exp-bar-fill.em { background-color: var(--accent-emerald); }
.exp-bar-fill.am { background-color: var(--accent-amber); }
.exp-bar-fill.rs { background-color: var(--accent-rose); }

.exp-phase-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.exp-pivots-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.exp-pivot-card {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exp-pivot-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.exp-pivot-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exp-pivot-title-wrap h3 {
  font-size: 13px;
  font-weight: 600;
}

.exp-prio-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.exp-prio-badge.p0 { background: rgba(244, 63, 94, 0.2); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.45); }
.exp-prio-badge.p1 { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45); }
.exp-prio-badge.p2 { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }

.exp-metric-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  background-color: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.exp-pivot-diag {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.exp-pivot-action {
  font-size: 12px;
  color: #cbd5e1;
  background-color: rgba(0, 229, 255, 0.05);
  border-left: 2px solid var(--accent-cyan);
  padding: 6px 9px;
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
}

.exp-pivot-chips {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.exp-video-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: var(--bg-surface-elevated);
  color: var(--accent-cyan);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}

.exp-video-chip:hover {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 229, 255, 0.12);
}

/* Row 3: Workspace Grid */
.exp-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.exp-panel.exp-table-panel {
  min-width: 0;
  overflow: hidden;
}

.exp-panel.exp-inspector-panel {
  min-width: 0;
}

.exp-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.exp-filter-tabs {
  display: flex;
  gap: 6px;
}

.exp-filter-btn {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.exp-filter-btn.active {
  background-color: rgba(0, 229, 255, 0.12);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.exp-sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.exp-select {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
}

.exp-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 2px;
}

.exp-table-scroll::-webkit-scrollbar,
.exp-verify-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.exp-table-scroll::-webkit-scrollbar-track,
.exp-verify-wrap::-webkit-scrollbar-track {
  background: rgba(9, 13, 20, 0.5);
  border-radius: 999px;
  margin: 4px;
}

.exp-table-scroll::-webkit-scrollbar-thumb,
.exp-verify-wrap::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.38);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.exp-table-scroll::-webkit-scrollbar-thumb:hover,
.exp-verify-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.48);
  border-color: rgba(0, 229, 255, 0.35);
}

.exp-table-scroll::-webkit-scrollbar-thumb:active,
.exp-verify-wrap::-webkit-scrollbar-thumb:active {
  background: rgba(0, 229, 255, 0.72);
}

.exp-table-scroll::-webkit-scrollbar-corner,
.exp-verify-wrap::-webkit-scrollbar-corner {
  background: transparent;
}

@supports not selector(::-webkit-scrollbar) {
  .exp-table-scroll,
  .exp-verify-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.45) rgba(9, 13, 20, 0.5);
  }
}

.exp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.exp-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--bg-surface);
  box-shadow: inset 0 -1px 0 var(--border-subtle);
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.exp-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(30, 44, 64, 0.6);
  vertical-align: middle;
}

.exp-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.exp-row:hover {
  background-color: var(--bg-surface-hover);
}

.exp-row.selected {
  background-color: rgba(0, 229, 255, 0.1);
}

.exp-vid-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.exp-health-pill {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.exp-health-pill.excellent { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.exp-health-pill.good { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.exp-health-pill.attention { background: rgba(244, 63, 94, 0.18); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.45); }

.exp-mode-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.exp-row-actions {
  display: flex;
  gap: 5px;
}

.exp-studio-link {
  text-decoration: none;
  color: var(--accent-cyan) !important;
  display: inline-flex;
  align-items: center;
}

/* Visual Inspector */
.exp-inspector-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.exp-inspector-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
}

.exp-inspector-top h2 {
  font-size: 16px;
  font-weight: 700;
}

.exp-inspector-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.exp-inspector-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exp-insp-tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.exp-insp-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.exp-zoom-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.btn-zoom {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-zoom:hover {
  color: var(--text-primary);
}

.btn-zoom.active {
  background: rgba(0, 229, 255, 0.16);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.45);
}

.exp-only-enlarged {
  display: none;
}

.exp-panel.exp-inspector-panel.is-enlarged .exp-only-enlarged {
  display: inline-flex;
}

.exp-stage-enlarge-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(9, 13, 20, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.exp-stage-enlarge-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(9, 13, 20, 0.96);
}

.exp-frame-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.exp-media-stage {
  background-color: #05070a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  height: 360px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.exp-split-wrap {
  width: 100%;
  height: 100%;
  display: flex;
}

.exp-video-pane {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-subtle);
}

.exp-video-pane:last-child {
  border-right: none;
}

.exp-video-pane video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
}

.exp-pane-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(9, 13, 20, 0.8);
}

.exp-pane-badge.cyan { color: var(--accent-cyan); border: 1px solid rgba(0, 229, 255, 0.45); }
.exp-pane-badge.gold { color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.45); }

.exp-verify-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 6px;
}

.exp-verify-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
}

.exp-media-stage.is-zoomed .exp-verify-wrap {
  overflow: hidden;
}

.exp-media-stage.is-panning .exp-video-pane video,
.exp-media-stage.is-panning .exp-verify-wrap img {
  transition: none;
}

.exp-media-stage.is-zoomed,
.exp-media-stage.is-zoomed .exp-video-pane video,
.exp-media-stage.is-zoomed .exp-verify-wrap img {
  cursor: grab;
}

.exp-media-stage.is-panning,
.exp-media-stage.is-panning .exp-video-pane video,
.exp-media-stage.is-panning .exp-verify-wrap img {
  cursor: grabbing;
}

.exp-media-missing {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.exp-player-controls {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.exp-chart-card {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.exp-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.exp-chart-title {
  font-size: 12px;
  font-weight: 600;
}

.exp-chart-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 10px;
}

.exp-chart-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.leg-dot.cyan { background-color: var(--accent-cyan); }
.leg-dot.gold { background-color: #fbbf24; }
.leg-dot.rose { background-color: var(--accent-rose); }

#exp-error-chart {
  width: 100%;
  display: block;
  cursor: crosshair;
}

.exp-clip-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.exp-subcard {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.exp-subcard-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.exp-clip-phases {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.exp-clip-phase-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.exp-source-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background-color: var(--bg-surface-elevated);
  margin-bottom: 8px;
}

.exp-src-seg {
  height: 100%;
}

.exp-source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.exp-source-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}

.exp-filter-tabs {
  flex-wrap: wrap;
}

.exp-group-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.exp-group-tag.gt {
  background: rgba(0, 229, 255, 0.14);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
}

.exp-group-tag.field {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.32);
}

/* Enlarged Theater Modal for Visual Inspector */
body.exp-modal-open {
  overflow: hidden;
}

.exp-inspector-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(4, 7, 13, 0.84);
  backdrop-filter: blur(5px);
}

.exp-inspector-backdrop.visible {
  display: block;
}

.exp-panel.exp-inspector-panel.is-enlarged {
  position: fixed;
  inset: 14px;
  z-index: 220;
  margin: 0;
  padding: 16px 20px;
  gap: 10px;
  border-color: rgba(0, 229, 255, 0.38);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.exp-panel.exp-inspector-panel.is-enlarged .exp-media-stage {
  flex: 1;
  min-height: 0;
  height: auto;
}

.exp-panel.exp-inspector-panel.is-enlarged .exp-clip-subgrid {
  display: none;
}

.exp-panel.exp-inspector-panel.is-enlarged.hide-enlarged-chart .exp-chart-card {
  display: none;
}

@media (max-width: 1360px) {
  .exp-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .exp-diag-grid,
  .exp-workspace-grid {
    grid-template-columns: 1fr;
  }
  .exp-panel.exp-table-panel {
    max-height: 560px;
  }
}

@media (max-width: 720px) {
  .exp-kpi-grid,
  .exp-clip-subgrid {
    grid-template-columns: 1fr;
  }
  .exp-panel.exp-inspector-panel.is-enlarged {
    inset: 6px;
    padding: 12px;
  }
}

/* ===== Iterative Manual Annotation Queue (Experiments + Studio) ===== */
.exp-annotation-panel {
  border-color: rgba(0, 229, 255, 0.24);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(11, 16, 27, 0.98));
}

.exp-annot-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.exp-rescore-btn {
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.exp-rescore-btn:hover {
  border-color: #34d399;
  background-color: rgba(16, 185, 129, 0.12);
}

.exp-pending-rescore-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.38);
  background: rgba(16, 185, 129, 0.08);
  font-size: 12px;
  color: #d1fae5;
}

.exp-pending-rescore-strip code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(9, 13, 20, 0.6);
  padding: 1px 5px;
  border-radius: 4px;
  color: #6ee7b7;
}

.exp-annotation-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 10px;
}

.exp-annot-card {
  background-color: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.exp-annot-card:hover {
  border-color: rgba(0, 229, 255, 0.45);
  transform: translateY(-1px);
}

.exp-annot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exp-annot-card-id {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exp-annot-reason {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.exp-annot-detail {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.exp-annot-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.exp-annot-card-actions .btn-annot-go {
  text-decoration: none;
}

.exp-group-tag.gt-saved {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.studio-queue-bar {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.08), rgba(15, 23, 42, 0.94));
  border: 1px solid rgba(0, 229, 255, 0.32);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-queue-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.studio-queue-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.16);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
  white-space: nowrap;
}

.studio-queue-status {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.studio-queue-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.studio-queue-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.studio-queue-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

.studio-queue-chip.active {
  background-color: rgba(0, 229, 255, 0.16);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

.studio-queue-chip.saved {
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.studio-queue-chip.active.saved {
  background-color: rgba(16, 185, 129, 0.18);
  border-color: #34d399;
  color: #6ee7b7;
}

.studio-queue-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-queue-actions a {
  text-decoration: none;
}

/* ===== Global No-Wrap Safeguards & Responsive Mobile Layout (v2.14) ===== */
.segment-option span,
.theme-pill,
.exp-filter-btn,
.btn-zoom,
.exp-frame-pill,
.exp-pane-badge,
.exp-mode-tag,
.exp-health-pill,
.studio-queue-chip {
  white-space: nowrap;
  flex-shrink: 0;
}

.exp-pivots-list {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.exp-annotation-cards {
  grid-template-columns: repeat(auto-fill, minmax(min(235px, 100%), 1fr));
}

.exp-table-scroll {
  -webkit-overflow-scrolling: touch;
}

.help-modal {
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.help-modal-body {
  overflow-y: auto;
  min-height: 0;
}

@media (max-width: 1080px) {
  .studio-layout {
    padding: 14px;
    gap: 16px;
  }
  .header-container {
    padding: 10px 14px;
  }
  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .app-header {
    position: sticky;
  }
  .header-container {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand {
    gap: 9px;
  }
  .brand-icon {
    width: 32px;
    height: 32px;
  }
  .brand-title h1 {
    font-size: 14px;
    letter-spacing: 0.05em;
  }
  .brand-tagline {
    display: none;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .header-actions .btn {
    padding: 7px 10px;
    font-size: 12px;
    gap: 6px;
  }
  .header-actions .btn svg {
    width: 14px;
    height: 14px;
  }

  .workflow-guide-wrap {
    margin-top: 10px;
    padding: 0 10px;
    gap: 8px;
  }
  .workflow-stepper {
    padding: 8px 10px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .workflow-stepper::-webkit-scrollbar {
    display: none;
  }
  .wf-sub {
    display: none;
  }
  .wf-num {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .wf-title {
    font-size: 11.5px;
  }
  .wf-sep {
    min-width: 10px;
  }

  .coach-banner {
    padding: 8px 10px;
    gap: 8px;
  }
  .coach-left {
    flex-wrap: wrap;
    gap: 6px;
  }
  .coach-text {
    font-size: 12px;
  }
  .coach-right {
    width: 100%;
  }
  .coach-right .btn {
    width: 100%;
  }

  .studio-queue-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .studio-queue-left {
    width: 100%;
    gap: 6px;
  }
  .studio-queue-chips {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .studio-queue-actions {
    width: 100%;
    justify-content: space-between;
  }

  .studio-layout {
    padding: 10px;
    gap: 12px;
  }
  .viewport-header {
    padding: 8px 10px;
    gap: 8px;
  }
  .view-mode-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .view-tab {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
    font-size: 11.5px;
  }
  .viewport-right-meta {
    width: 100%;
    gap: 6px 8px;
    justify-content: flex-start;
  }

  .hitl-toolbar {
    padding: 8px 10px;
  }
  .hitl-toolbar-top {
    gap: 6px;
  }
  .tool-mode-group {
    width: 100%;
  }
  .tool-btn {
    padding: 6px 9px;
    font-size: 11.5px;
  }
  .quick-frame-actions {
    width: 100%;
  }
  .quick-frame-actions .btn-mini {
    flex: 1;
    min-height: 32px;
    text-align: center;
  }
  .tool-context-hint {
    font-size: 11px;
    padding: 5px 8px;
  }

  .video-stage {
    min-height: 280px;
  }
  .video-stage.has-video {
    height: 54dvh;
    min-height: 300px;
    max-height: 520px;
  }
  .upload-dropzone {
    width: calc(100% - 16px);
    margin: 8px;
    padding: 18px 14px;
  }
  .dropzone-buttons {
    flex-wrap: wrap;
  }
  .dropzone-buttons .btn {
    flex: 1 1 180px;
  }

  .video-wrapper.split-view {
    flex-direction: column;
  }
  .video-wrapper.split-view video {
    width: 100%;
    height: 50%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .video-wrapper.split-view video:last-child {
    border-bottom: none;
  }

  .player-controls {
    padding: 10px 10px;
  }
  .left-controls {
    width: 100%;
    justify-content: space-between;
  }
  .right-controls {
    width: 100%;
    justify-content: space-between;
  }
  .btn-icon {
    width: 36px;
    height: 36px;
  }
  .btn-mini-step {
    min-height: 34px;
    min-width: 36px;
    padding: 5px 8px;
    font-size: 12px;
  }
  .btn-speed {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 11.5px;
  }
  .time-display {
    width: 100%;
    margin-left: 0;
    text-align: center;
    font-size: 11.5px;
    padding-top: 2px;
  }

  .sidebar-content {
    padding: 14px;
  }
  .sidebar-footer {
    padding: 12px 14px;
  }
  .sidebar-tab {
    padding: 12px 6px;
    font-size: 11.5px;
  }

  .samples-dropdown {
    position: fixed;
    top: calc(100% + 6px);
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 68dvh;
    overflow-y: auto;
  }

  .modal-backdrop {
    padding: 10px;
  }
  .help-modal-header {
    padding: 12px 14px;
  }
  .help-modal-body {
    padding: 12px 14px;
  }
  .studio-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
  }

  /* Experiments Dashboard Mobile */
  .exp-container {
    padding: 12px 10px 28px;
    gap: 12px;
  }
  .exp-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .exp-kpi-card {
    padding: 11px 12px;
  }
  .exp-kpi-value {
    font-size: 17px;
  }
  .exp-panel {
    padding: 12px;
    gap: 10px;
  }
  .exp-panel-header,
  .exp-inspector-top,
  .exp-run-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .exp-run-bar-wrap {
    width: 100%;
  }
  .exp-annot-header-actions,
  .exp-inspector-actions {
    justify-content: flex-start;
  }
  .exp-insp-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  .exp-insp-right-controls {
    justify-content: space-between;
  }
  .exp-media-stage {
    height: 400px;
  }
  .exp-split-wrap {
    flex-direction: column;
  }
  .exp-video-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .exp-video-pane:last-child {
    border-bottom: none;
  }
  .exp-clip-subgrid {
    grid-template-columns: 1fr;
  }
  .exp-panel.exp-inspector-panel.is-enlarged {
    inset: 6px;
    padding: 10px;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .exp-kpi-grid {
    grid-template-columns: 1fr;
  }
  .footer-row-secondary,
  .hitl-next-actions,
  .compact-grid-2 {
    grid-template-columns: 1fr;
  }
  .header-actions .btn {
    flex: 1 1 auto;
  }
  .nudge-touch-btns .btn-mini {
    min-width: 40px;
    min-height: 34px;
  }
}
