.lab-page {
  --lab-ink: #07111f;
  --lab-paper: rgba(255, 255, 255, 0.78);
  --lab-line: rgba(15, 23, 42, 0.1);
  --lab-soft: #5b6b82;
  --lab-glow: rgba(37, 99, 235, 0.18);
}

html[data-theme="dark"] .lab-page {
  --lab-ink: #e8eef8;
  --lab-paper: rgba(10, 16, 28, 0.72);
  --lab-line: rgba(148, 163, 184, 0.2);
  --lab-soft: #9aa8bd;
  --lab-glow: rgba(96, 165, 250, 0.16);
}

.lab-page .navbar-brand span {
  letter-spacing: 0.01em;
}

.lab-shell {
  width: min(1180px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding-bottom: 3.5rem;
}

.lab-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 1.4rem;
  align-items: stretch;
  margin-bottom: 1.1rem;
}

.lab-hero-copy h1 {
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 1.12;
  margin: 0.15rem 0 0.7rem;
}

.lab-hero-copy .lead {
  max-width: 42rem;
  margin-bottom: 1.1rem;
}

.lab-chip-row,
.lab-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.lab-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  font-size: 0.82rem;
}

.lab-hero .btn-accent {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f2937;
  font-weight: 700;
}

.lab-hero .btn-accent:hover {
  background: #fbbf24;
  border-color: #fbbf24;
  color: #111827;
}

.lab-side {
  display: grid;
  gap: 0.7rem;
}

.lab-note {
  border-radius: 20px;
  padding: 1rem 1.05rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(219, 234, 254, 0.9);
}

.lab-note strong {
  display: block;
  color: #fff;
  margin-bottom: 0.25rem;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 1rem;
}

.lab-stage,
.lab-rail {
  border: 1px solid var(--lab-line);
  background: var(--lab-paper);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(10px);
}

.lab-stage {
  border-radius: 26px;
  padding: 1rem;
  min-height: 34rem;
}

.lab-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.lab-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.2rem;
}

.lab-stage-title {
  margin: 0;
  font-size: 1.35rem;
}

.lab-stage-blurb,
.lab-prompt {
  color: var(--lab-soft);
  margin: 0.35rem 0 0;
}

.lab-prompt {
  font-size: 0.92rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: var(--muted-box);
  border: 1px solid var(--lab-line);
}

.lab-prompt span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 0.25rem;
}

.lab-viewer {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  min-height: 18.5rem;
  background: #0b1220;
  border: 1px solid rgba(15, 23, 42, 0.2);
}

.lab-viewer img,
.lab-viewer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lab-empty-media,
.lab-art {
  min-height: 18.5rem;
  height: 100%;
}

.lab-audio {
  display: grid;
  place-items: center;
  gap: 0.8rem;
  min-height: 18.5rem;
  padding: 1.2rem;
  color: #dbeafe;
}

.lab-wave {
  width: min(100%, 28rem);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.lab-wave i {
  width: 4px;
  height: 18px;
  border-radius: 99px;
  background: #93c5fd;
  animation: lab-wave 1.1s ease-in-out infinite;
  animation-play-state: paused;
}

.lab-wave.is-playing i {
  animation-play-state: running;
}

.lab-wave i:nth-child(odd) { animation-delay: -0.2s; }
.lab-wave i:nth-child(3n) { height: 42px; }
.lab-wave i:nth-child(4n) { height: 28px; animation-delay: -0.45s; }
.lab-wave i:nth-child(5n) { height: 54px; }

@keyframes lab-wave {
  0%, 100% { transform: scaleY(0.45); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

.lab-audio audio {
  width: min(100%, 28rem);
}

.lab-transcript {
  width: min(100%, 28rem);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(147, 197, 253, 0.2);
  color: #e2e8f0;
  font-size: 0.92rem;
}

.compare {
  position: relative;
  min-height: 18.5rem;
  height: 100%;
  --pos: 52%;
  user-select: none;
}

.compare-layer {
  position: absolute;
  inset: 0;
}

.compare-before {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.compare img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-label {
  position: absolute;
  top: 0.8rem;
  z-index: 2;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
}

.compare-label.is-before { left: 0.8rem; }
.compare-label.is-after { right: 0.8rem; }

.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}

.compare-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25);
  z-index: 3;
  pointer-events: none;
}

.compare-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
}

.lab-art {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.16), transparent 28%),
    linear-gradient(160deg, #0f172a, #1e3a8a 55%, #0b1220);
}

.lab-art::after {
  content: attr(data-caption);
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.art-tts { background: linear-gradient(145deg, #042f2e, #0f766e 48%, #082f49); }
.art-asr { background: linear-gradient(145deg, #0b1f33, #0369a1 50%, #0f172a); }
.art-t2v { background: linear-gradient(145deg, #1e1b4b, #4f46e5 46%, #0f172a); }
.art-i2v { background: linear-gradient(145deg, #3b0764, #7c3aed 48%, #1e1b4b); }
.art-multiref { background: linear-gradient(145deg, #4a044e, #db2777 42%, #1e1b4b); }
.art-watermark { background: linear-gradient(145deg, #1c1917, #b45309 50%, #111827); }
.art-clothing { background: linear-gradient(145deg, #4c0519, #be123c 46%, #1f2937); }
.art-faceswap { background: linear-gradient(145deg, #082f49, #0284c7 48%, #0f172a); }
.art-adgen { background: linear-gradient(145deg, #7c2d12, #ea580c 46%, #111827); }

.art-orb,
.art-frame,
.art-mark,
.art-face,
.art-dress,
.art-poster {
  position: absolute;
  border-radius: 24px;
  pointer-events: none;
}

.art-orb {
  width: 42%;
  height: 42%;
  right: 10%;
  top: 16%;
  background: radial-gradient(circle, rgba(255,255,255,0.55), rgba(147,197,253,0.05) 70%);
  filter: blur(2px);
}

.art-frame {
  inset: 18% 12% 22% 12%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.08);
}

.art-mark {
  right: 12%;
  top: 16%;
  width: 28%;
  height: 18%;
  background: repeating-linear-gradient(-18deg, rgba(255,255,255,0.55) 0 10px, transparent 10px 18px);
  opacity: 0.55;
}

.art-face {
  width: 28%;
  aspect-ratio: 1;
  left: 18%;
  top: 28%;
  border-radius: 50%;
  background: linear-gradient(180deg, #fecaca, #fb7185);
  box-shadow: 18vw 6vh 0 0 rgba(125, 211, 252, 0.85);
}

.art-dress {
  width: 36%;
  height: 46%;
  left: 32%;
  bottom: 12%;
  background: linear-gradient(180deg, #e2e8f0, #0f172a);
  clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.art-poster {
  inset: 14% 28% 14% 28%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 30%),
    linear-gradient(180deg, #14532d 0 38%, #ecfccb 38% 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.lab-rail {
  border-radius: 26px;
  padding: 0.9rem;
}

.lab-filter-row {
  margin-bottom: 0.75rem;
}

.lab-filter {
  border: 1px solid var(--lab-line);
  background: transparent;
  color: var(--text-main);
  border-radius: 999px;
  min-height: 34px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
}

.lab-filter.is-active,
.lab-filter:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.lab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  max-height: min(68vh, 42rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.show-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--lab-line);
  background: rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  padding: 0.45rem;
  color: inherit;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

html[data-theme="dark"] .show-card {
  background: rgba(15, 23, 42, 0.55);
}

.show-card:hover,
.show-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: var(--card-raise);
}

.show-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  min-height: 72px;
  background: #0f172a;
}

.show-thumb img,
.show-thumb video,
.show-thumb .lab-art {
  position: absolute;
  inset: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.show-thumb .lab-art::after {
  display: none;
}

.show-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.show-card p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--lab-soft);
}

.show-tag {
  display: inline-flex;
  margin-top: 0.28rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-primary);
  font-weight: 700;
}

.lab-hint {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: var(--lab-soft);
}

.lab-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.lab-sample {
  border: 1px solid var(--lab-line);
  background: transparent;
  color: var(--text-main);
  border-radius: 999px;
  min-height: 32px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
}

.lab-sample.is-active,
.lab-sample:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.lab-refs {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.7rem 0.7rem 0;
}

.lab-refs img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.lab-i2v {
  display: grid;
  grid-template-columns: minmax(120px, 0.38fr) minmax(0, 1fr);
  min-height: 18.5rem;
}

.lab-i2v-still,
.lab-i2v-video {
  min-height: 18.5rem;
}

.lab-i2v-still {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  padding: 0.7rem;
  color: #dbeafe;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lab-i2v-still img,
.lab-i2v-video video,
[data-video-wrap] video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lab-i2v-still img {
  border-radius: 14px;
  min-height: 12rem;
  object-fit: cover;
}

@media (max-width: 991.98px) {
  .lab-hero,
  .lab-layout {
    grid-template-columns: 1fr;
  }

  .lab-stage {
    min-height: 0;
  }

  .lab-grid {
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .show-card {
    grid-template-columns: 1fr;
  }

  .show-thumb {
    min-height: 110px;
  }

  .lab-i2v {
    grid-template-columns: 1fr;
  }

  .lab-i2v-still,
  .lab-i2v-video {
    min-height: 0;
  }
}

@media (max-width: 575.98px) {
  .lab-shell {
    width: min(100% - 1rem, 1180px);
  }

  .lab-grid {
    grid-template-columns: 1fr;
  }

  .hero-kpi-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
