/* ==========================================================================
   TRACKED SPATIAL 3D LAB · SKYLEARN DARK MODE DESIGN SYSTEM
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- SKYLEARN COLOR SYSTEM (DARK MODE ADAPTED) --- */
  --bg: #080e1a;
  --panel: #0f172a;
  --panel-elevated: #1e293b;
  --panel-sunken: #0b1222;
  --panel-glass: rgba(15, 23, 42, 0.85);

  /* Primary Sky Blue */
  --sky: #38bdf8;
  --sky-bright: #7dd3fc;
  --sky-deep: #0284c7;
  --sky-soft: rgba(56, 189, 248, 0.12);
  --sky-glow: rgba(56, 189, 248, 0.25);

  /* Sun Yellow / Amber (Achievements & Point B Target) */
  --sun: #fbbf24;
  --sun-bright: #fde047;
  --sun-deep: #d97706;
  --sun-soft: rgba(251, 191, 36, 0.12);
  --sun-glow: rgba(251, 191, 36, 0.3);

  /* Leaf Green (Active Telemetry & Verified Bounds) */
  --leaf: #22c55e;
  --leaf-bright: #4ade80;
  --leaf-deep: #16a34a;
  --leaf-soft: rgba(34, 197, 94, 0.12);

  /* Coral Pink (Gentle Alerts & Clear) */
  --coral: #f87171;
  --coral-soft: rgba(248, 113, 113, 0.14);

  /* Berry Purple (3D Tools & Auxiliary) */
  --berry: #a855f7;
  --berry-bright: #c084fc;
  --berry-soft: rgba(168, 85, 247, 0.14);

  /* Typography Colors */
  --ink: #f8fafc;
  --ink-muted: #94a3b8;
  --ink-subtle: #64748b;
  --ink-faint: #334155;

  /* Borders and Outlines */
  --outline: rgba(148, 163, 184, 0.14);
  --outline-strong: rgba(56, 189, 248, 0.4);
  --outline-sun: rgba(251, 191, 36, 0.35);

  /* Typography Fonts */
  --font-body: 'Atkinson Hyperlegible', ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Nunito', ui-sans-serif, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Radiuses */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.36);
  --shadow-elevated: 0 24px 60px rgba(0, 0, 0, 0.45);
  --shadow-glow-sky: 0 0 24px var(--sky-glow);
  --shadow-glow-sun: 0 0 24px var(--sun-glow);
}

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

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% -5%, rgba(56, 189, 248, 0.12), transparent 45%),
    radial-gradient(circle at 90% 40%, rgba(168, 85, 247, 0.08), transparent 35%),
    linear-gradient(180deg, #09101f 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

/* Ambient glow blobs */
.ambient {
  position: fixed;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}
.ambient-sky { background: var(--sky); top: 10%; left: -200px; }
.ambient-sun { background: var(--sun); bottom: 15%; right: -200px; }
.ambient-berry { background: var(--berry); top: 50%; right: 20%; }

/* Shell Container */
.main-shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 80px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(8, 14, 26, 0.82);
  border-bottom: 1px solid var(--outline);
  padding: 14px 24px;
}

.header-inner {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 32px;
  background: var(--outline);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.badge-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sky-pill { background: var(--sky-soft); color: var(--sky-bright); border: 1px solid rgba(56,189,248,0.25); }
.leaf-pill { background: var(--leaf-soft); color: var(--leaf-bright); border: 1px solid rgba(34,197,94,0.25); }

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  font-size: 0.82rem;
  font-weight: 600;
}
.status-indicator.ready {
  background: var(--leaf-soft);
  border-color: rgba(34, 197, 94, 0.28);
  color: var(--leaf-bright);
}
.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 10px var(--leaf);
  animation: pulse-dot 2s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--sky-bright);
  font-weight: 700;
}

/* ==========================================================================
   HERO CARD
   ========================================================================== */
.hero-card {
  padding: 36px 40px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(11, 18, 34, 0.95));
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-card);
}

.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--sky-soft);
  color: var(--sky-bright);
  border: 1px solid rgba(56, 189, 248, 0.22);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.star-icon, .sun-icon {
  color: var(--sun);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--ink);
}

.hero-lede {
  font-size: 1.15rem;
  color: var(--ink-muted);
  max-width: 860px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.hero-lede strong {
  color: var(--sky-bright);
}

.hero-feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feat-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--outline);
  color: #cbd5e1;
  font-size: 0.84rem;
  font-weight: 600;
  transition: 0.2s ease;
}
.feat-tag:hover {
  background: var(--sky-soft);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--sky-bright);
}

/* ==========================================================================
   CARDS & SECTIONS
   ========================================================================== */
.section-card {
  padding: 36px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease;
}

.section-header {
  margin-bottom: 28px;
}

.step-badge {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.step-num {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--sky-soft);
  color: var(--sky);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  flex-shrink: 0;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}

.step-desc {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ==========================================================================
   STEP 1: UPLOAD & SAMPLES
   ========================================================================== */
.upload-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.drop-zone {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, 0.08), transparent 70%);
  cursor: pointer;
  transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 24px;
  text-align: center;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--sky);
  background-color: var(--sky-soft);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow-sky);
}
.drop-zone input { display: none; }

.upload-art {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.upload-svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--sky);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.drop-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
  max-width: 320px;
}

.upload-cta-pill {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--sky);
  color: #04101e;
  font-weight: 800;
  font-size: 0.84rem;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
  transition: 0.2s ease;
}
.drop-zone:hover .upload-cta-pill {
  transform: scale(1.04);
}

/* Selected File Card */
.selected-file-card {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-soft);
}
.selected-file-card video {
  width: 140px;
  height: 84px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #000;
}
.selected-file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.selected-file-info strong {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-file-info span {
  font-size: 0.84rem;
  color: var(--ink-muted);
}
.file-ready-tag {
  color: var(--leaf-bright);
  font-size: 0.8rem;
  font-weight: 700;
}

.icon-circle-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s ease;
}
.icon-circle-button:hover {
  background: var(--coral-soft);
  color: var(--coral);
  border-color: rgba(248, 113, 113, 0.3);
}

/* Demo Samples Library */
.sample-library-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.sample-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sample-panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.sample-hint {
  font-size: 0.8rem;
  color: var(--sky-bright);
  font-weight: 700;
  background: var(--sky-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.samples-carousel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px 6px 6px 2px;
}
.samples-carousel::-webkit-scrollbar {
  width: 6px;
}
.samples-carousel::-webkit-scrollbar-track {
  background: var(--panel-sunken);
  border-radius: var(--radius-pill);
}
.samples-carousel::-webkit-scrollbar-thumb {
  background: var(--sky-deep);
  border-radius: var(--radius-pill);
}

.sample-card-item {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: left;
  position: relative;
}
.sample-card-item:hover {
  border-color: var(--sky);
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 18px var(--sky-glow);
}
.sample-card-item.active {
  border-color: var(--sun);
  background: linear-gradient(180deg, var(--panel-elevated) 0%, rgba(251, 191, 36, 0.1) 100%);
  box-shadow: 0 0 0 2px var(--sun), 0 10px 28px rgba(0,0,0,0.6);
}
.sample-thumb-wrap {
  position: relative;
  aspect-ratio: 16/10;
  background: #02050c;
  overflow: hidden;
}
.sample-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.sample-card-item:hover .sample-thumb-wrap img {
  transform: scale(1.08);
}
.sample-duration-pill {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: rgba(8, 14, 26, 0.92);
  border: 1px solid var(--outline);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sky-bright);
}
.sample-badge-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  background: rgba(8, 14, 26, 0.88);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--sun-bright);
  border: 1px solid rgba(251, 191, 36, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sample-meta-wrap {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel-elevated);
}
.sample-id-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sample-pts-info {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sample-action-hint {
  color: var(--sky-bright);
  font-size: 0.7rem;
  font-weight: 700;
}

.sample-skeleton {
  font-size: 0.85rem;
  color: var(--ink-muted);
  padding: 20px;
  text-align: center;
  grid-column: 1 / -1;
}

/* Guidelines Row */
.guidelines-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--outline);
}
.guide-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.guide-badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sky-soft);
  color: var(--sky);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.guide-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.guide-text strong {
  font-size: 0.88rem;
  color: var(--ink);
}
.guide-text span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Buttons */
.big-friendly-button {
  width: 100%;
  min-height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 32px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #2563eb 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
  transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
}
.big-friendly-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 12px 32px rgba(2, 132, 199, 0.45);
}
.big-friendly-button:active:not(:disabled) {
  transform: scale(0.97);
}
.big-friendly-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.5);
}
.big-friendly-button.compact-btn {
  width: auto;
  min-height: 48px;
  font-size: 0.95rem;
  padding: 0 22px;
}

.btn-arrow {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.secondary-pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.secondary-pill-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sky);
  color: var(--sky-bright);
}
.secondary-pill-button:active {
  transform: scale(0.97);
}
.secondary-pill-button.compact {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.icon-pill-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--coral-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--coral);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: 0.2s ease;
}
.icon-pill-button:hover {
  background: rgba(248, 113, 113, 0.22);
}

.text-pill-button {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 0.86rem;
  padding: 10px 16px;
  cursor: pointer;
  transition: 0.2s ease;
}
.text-pill-button:hover {
  color: var(--ink);
}

.error-message {
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius-md);
  background: var(--coral-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
  font-size: 0.9rem;
}

/* ==========================================================================
   STEP 2: PROGRESS CARD
   ========================================================================== */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.progress-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.spinner-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: conic-gradient(var(--sky), var(--sun), var(--berry), transparent 75%);
  padding: 4px;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
.spinner-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--panel);
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-details {
  flex: 1;
}
.step-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--sky);
  text-transform: uppercase;
}
.progress-percent {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.8rem;
  color: var(--sun);
}

.progress-track-wrapper {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--panel-sunken);
  overflow: hidden;
}
.progress-bar-fill {
  width: 10%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--sky), var(--leaf), var(--sun));
  transition: width 0.48s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-steps-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.step-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.step-chip.active {
  background: var(--sky-soft);
  color: var(--sky-bright);
  border-color: rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   STEP 3: RESULTS WORKSPACE & MEASUREMENT HUD
   ========================================================================== */
.results-workspace {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--outline);
  padding-bottom: 20px;
}

.workspace-badge {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--sky);
}
.workspace-title {
  font-size: 1.4rem;
  font-weight: 800;
}

.tab-pill-group {
  display: flex;
  background: var(--panel-sunken);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--outline);
}
.tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab-pill.active {
  background: var(--panel-elevated);
  color: var(--sky-bright);
  box-shadow: var(--shadow-soft);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Measurement Mode Tool Settings Bar */
.tool-settings-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tool-group-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.tool-buttons {
  display: flex;
  gap: 6px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--outline);
  background: var(--panel-elevated);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sky);
}
.tool-btn.active {
  background: var(--sky);
  color: #031122;
  border-color: var(--sky-bright);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
}

.layer-toggles {
  display: flex;
  gap: 8px;
}
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--outline);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
  transition: 0.2s ease;
}
.toggle-chip input {
  accent-color: var(--sky);
  cursor: pointer;
}
.toggle-chip:hover {
  border-color: var(--sky);
  color: var(--ink);
}

.unit-selector {
  display: flex;
  background: var(--panel-elevated);
  border-radius: var(--radius-pill);
  border: 1px solid var(--outline);
  padding: 3px;
}
.unit-btn {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}
.unit-btn.active {
  background: var(--sun);
  color: #2b1700;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.3);
}

/* ==========================================================================
   VIDEO & INTERACTIVE HUD CANVAS CONTAINER
   ========================================================================== */
.video-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.video-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.video-panel.input-panel { border-color: rgba(56, 189, 248, 0.25); }
.video-panel.mesh-panel { border-color: rgba(251, 191, 36, 0.25); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel-elevated);
  border-bottom: 1px solid var(--outline);
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tag-sky { background: var(--sky-soft); color: var(--sky-bright); border: 1px solid rgba(56, 189, 248, 0.25); }
.tag-sun { background: var(--sun-soft); color: var(--sun-bright); border: 1px solid rgba(251, 191, 36, 0.25); }
.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.time-readout, .scale-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
}
.scale-badge { color: var(--sun); }

.viewport-stage {
  position: relative;
  aspect-ratio: 16/9;
  background: #02050b;
  overflow: hidden;
  cursor: crosshair;
}

.viewport-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 10;
}

.canvas-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--outline);
  color: var(--sky-bright);
  font-size: 0.78rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: float-hint 3s infinite ease-in-out;
}
@keyframes float-hint {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -3px); }
}

.three-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  background: #040813;
}

.depth-legend {
  position: absolute;
  bottom: 10px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(8, 14, 26, 0.88);
  border: 1px solid var(--outline);
  z-index: 20;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}
.legend-bar {
  width: 70px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #e6527a, #845ef7, #22c55e, #38bdf8);
}

/* ==========================================================================
   TIMELINE SCRUBBER CARD
   ========================================================================== */
.timeline-scrubber-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
}

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

.scrubber-btn {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}
.scrubber-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sky);
}

.scrubber-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--sky);
  color: #031122;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
  transition: 0.2s ease;
}
.scrubber-play-btn:hover {
  transform: scale(1.08);
}

.speed-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.speed-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-right: 4px;
}
.speed-btn {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--outline);
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}
.speed-btn.active {
  background: var(--sky-soft);
  color: var(--sky-bright);
  border-color: rgba(56, 189, 248, 0.35);
}

.scrubber-slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.timeline-range {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--panel-elevated);
  outline: none;
  cursor: pointer;
  accent-color: var(--sky);
}

.current-time-display {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--sky-bright);
}

/* ==========================================================================
   TELEMETRY DASHBOARD
   ========================================================================== */
.telemetry-dashboard {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 18px;
}

.telemetry-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-metric-card {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(8, 14, 28, 0.95));
}

.telemetry-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.metric-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.star-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sun-soft);
  color: var(--sun);
  font-size: 1.4rem;
  border: 1.5px solid rgba(251, 191, 36, 0.3);
  box-shadow: var(--shadow-glow-sun);
}

.metric-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--sky);
}

.metric-hero-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.metric-hero-value strong {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.metric-unit {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--sun);
}

.validity-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--leaf-soft);
  color: var(--leaf-bright);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.72rem;
  font-weight: 700;
}
.val-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--leaf);
}

.vector-deltas-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.delta-box {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
}
.delta-box.delta-depth {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.08);
}
.delta-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
}
.delta-val {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}
.delta-depth .delta-val {
  color: var(--berry-bright);
}

/* Point A / B Telemetry Cards */
.point-a-card { border-color: rgba(56, 189, 248, 0.25); }
.point-b-card { border-color: rgba(251, 191, 36, 0.25); }

.point-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.point-pin {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
}
.pin-a { background: var(--sky); color: #021122; box-shadow: var(--shadow-glow-sky); }
.pin-b { background: var(--sun); color: #2a1600; box-shadow: var(--shadow-glow-sun); }

.point-header strong {
  font-size: 0.95rem;
  display: block;
}
.point-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.coords-list {
  display: grid;
  gap: 8px;
}
.coord-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: var(--panel-sunken);
  font-size: 0.84rem;
}
.coord-row span {
  color: var(--ink-muted);
}
.coord-row strong {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
}
.coord-row.highlight-z strong {
  color: var(--sky-bright);
}
.point-b-card .coord-row.highlight-z strong {
  color: var(--sun-bright);
}

/* ==========================================================================
   WAVEFORM CHART CARD
   ========================================================================== */
.waveform-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.waveform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.waveform-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chart-icon { font-size: 1.3rem; }
.waveform-title-row strong { font-size: 1rem; }
.chart-sub { font-size: 0.8rem; color: var(--ink-muted); display: block; }

.waveform-stats {
  display: flex;
  gap: 8px;
}
.stat-pill {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.stat-pill b {
  font-family: var(--font-mono);
  color: var(--sky-bright);
}

.waveform-canvas-container {
  width: 100%;
  height: 140px;
  background: var(--panel-sunken);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline);
  overflow: hidden;
}
#waveformCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   PRESETS CARD & CALIBRATION
   ========================================================================== */
.presets-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-sunken);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}
.presets-header span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.preset-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.preset-pill-btn:hover {
  background: var(--sky-soft);
  border-color: var(--sky);
  color: var(--sky-bright);
  transform: translateY(-2px);
}

/* Calibration Card */
.calibration-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.22);
  flex-wrap: wrap;
}
.calib-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.calib-icon { font-size: 1.6rem; }
.calib-left strong { font-size: 0.94rem; color: var(--sun); }
.calib-left p { font-size: 0.82rem; color: var(--ink-muted); }

.calib-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.calib-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-sunken);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline);
  font-size: 0.84rem;
}
.calib-input-wrap input {
  width: 70px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  outline: none;
  text-align: center;
}

/* Summary Metrics */
.summary-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.summary-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
}
.sum-label { font-size: 0.78rem; color: var(--ink-muted); }
.sum-val { font-size: 1.15rem; font-weight: 800; font-family: var(--font-mono); color: var(--ink); }
.leaf-text { color: var(--leaf-bright); font-family: var(--font-body); }

/* Export & Actions */
.export-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Industrial Notice */
.industrial-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: rgba(251, 191, 36, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.notice-symbol {
  font-size: 1.3rem;
  color: var(--sun);
  flex-shrink: 0;
}
.notice-text {
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.5;
}
.notice-text strong {
  color: var(--sun-bright);
}

/* Footer */
.app-footer {
  padding: 30px 24px;
  border-top: 1px solid var(--outline);
  text-align: center;
  color: var(--ink-subtle);
  font-size: 0.8rem;
}
.footer-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Helper Utilities */
.hidden { display: none !important; }

/* Responsive adjustments */
@media (max-width: 960px) {
  .upload-grid, .video-workspace, .telemetry-dashboard, .summary-metrics-grid {
    grid-template-columns: 1fr;
  }
  .guidelines-row {
    grid-template-columns: 1fr;
  }
  .vector-deltas-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .main-shell {
    width: calc(100% - 24px);
    padding-top: 16px;
  }
  .hero-card, .section-card {
    padding: 24px 20px;
  }
}
