/* IntelligenceISIT — confident, AI-native landing */
:root {
  --bg: #05080f;
  --bg-elevated: #0b1220;
  --bg-card: rgba(14, 22, 38, 0.72);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(94, 234, 212, 0.28);
  /* Soft neutrals — avoid near-white glare on dark UI */
  --text: #b6c2d4;
  --text-muted: #7d8ca3;
  --text-dim: #5b6b82;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --accent-3: #38bdf8;
  --danger: #f472b6;
  --glow: rgba(94, 234, 212, 0.15);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 16px;
  --header-h: 72px;
  --max: 1120px;
  --scrollbar-size: 5px;
  --scrollbar-thumb: rgba(100, 116, 139, 0.42);
  --scrollbar-thumb-hover: rgba(125, 140, 163, 0.55);
  --scrollbar-track: transparent;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Narrow, low-contrast scrollbars (Firefox uses scrollbar-* above) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: #99f6e4;
}

/* Ambient layers */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grid-bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}

#constellation {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
}

.logo:hover {
  color: var(--text);
}

.logo-mark {
  width: 36px;
  height: 36px;
  color: var(--accent);
  flex-shrink: 0;
  display: block;
}

.logo-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.logo:hover .logo-mark {
  filter: drop-shadow(0 0 8px rgba(94, 234, 212, 0.35));
}

.logo-text {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.logo-text strong {
  font-weight: 800;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav a:hover {
  color: var(--text);
}

.nav-cta {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.15), rgba(129, 140, 248, 0.15));
  border: 1px solid var(--border-strong);
  color: var(--text) !important;
}

.nav-cta:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.25), rgba(129, 140, 248, 0.2));
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* Layout */
main {
  position: relative;
  z-index: 1;
}

.section {
  padding: clamp(4rem, 10vw, 7rem) clamp(1.25rem, 4vw, 2.5rem);
  max-width: calc(var(--max) + 5rem);
  margin: 0 auto;
}

.section-head {
  max-width: 720px;
  margin-bottom: 3rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.85rem;
}

.section h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

.section-lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0;
  max-width: 540px;
}

/* Hero — 16×9 media band, copy overlays image, image lags on scroll */
.hero {
  position: relative;
  max-width: calc(var(--max) + 5rem);
  margin: 0 auto;
  padding: calc(var(--header-h) + 1rem) clamp(1.25rem, 4vw, 2.5rem) 0;
}

.hero-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(52vw, 520px);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(94, 234, 212, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.45);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-parallax {
  position: absolute;
  /* Extra height so slow parallax can move without gaps */
  inset: -20% 0;
  will-change: transform;
}

.hero-parallax img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% center;
  transform: scale(1.08);
}

.hero-media-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(5, 8, 15, 0.92) 0%, rgba(5, 8, 15, 0.72) 42%, rgba(5, 8, 15, 0.28) 72%, rgba(5, 8, 15, 0.45) 100%),
    linear-gradient(to top, rgba(5, 8, 15, 0.55) 0%, transparent 50%),
    radial-gradient(ellipse 55% 70% at 72% 42%, rgba(94, 234, 212, 0.14), transparent 60%);
  pointer-events: none;
}

.hero-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: none;
  margin: 0;
  padding: clamp(1.25rem, 3.5vw, 2.5rem);
  padding-right: clamp(1.25rem, 28vw, 12rem);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.card-grid .card.reveal:nth-child(1) { --reveal-delay: 0ms; }
.card-grid .card.reveal:nth-child(2) { --reveal-delay: 70ms; }
.card-grid .card.reveal:nth-child(3) { --reveal-delay: 140ms; }
.card-grid .card.reveal:nth-child(4) { --reveal-delay: 210ms; }
.card-grid .card.reveal:nth-child(5) { --reveal-delay: 280ms; }
.card-grid .card.reveal:nth-child(6) { --reveal-delay: 350ms; }

.stack-rows .stack-row.reveal:nth-child(1) { --reveal-delay: 0ms; }
.stack-rows .stack-row.reveal:nth-child(2) { --reveal-delay: 80ms; }
.stack-rows .stack-row.reveal:nth-child(3) { --reveal-delay: 160ms; }
.stack-rows .stack-row.reveal:nth-child(4) { --reveal-delay: 240ms; }

.steps li.reveal:nth-child(1) { --reveal-delay: 0ms; }
.steps li.reveal:nth-child(2) { --reveal-delay: 90ms; }
.steps li.reveal:nth-child(3) { --reveal-delay: 180ms; }
.steps li.reveal:nth-child(4) { --reveal-delay: 270ms; }

.reveal-delay { --reveal-delay: 160ms; }

.site-header.is-scrolled {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border-bottom-color: rgba(94, 234, 212, 0.12);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(14, 22, 38, 0.8);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(94, 234, 212, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0);
  }
}

.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.85rem, 4.2vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0 0 0.85rem;
  max-width: 16ch;
  text-shadow: 0 2px 24px rgba(5, 8, 15, 0.65);
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-3) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 34rem;
  color: var(--text-muted);
  font-size: clamp(0.95rem, 1.5vw, 1.08rem);
  margin: 0 0 1.25rem;
  text-shadow: 0 1px 12px rgba(5, 8, 15, 0.8);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  color: #042f2e;
  background: linear-gradient(135deg, #5eead4, #2dd4bf);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.3), 0 12px 40px rgba(45, 212, 191, 0.2);
}

.btn-primary:hover {
  color: #042f2e;
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.5), 0 16px 48px rgba(45, 212, 191, 0.35);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.03);
}

.btn-block {
  width: 100%;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
}

.hero-stats div {
  padding: 0.25rem 0;
}

.hero-stats dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.hero-stats dd {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

/* Trust */
.trust {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
  border-block: 1px solid var(--border);
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.04), transparent);
}

.trust p {
  margin: 0 auto;
  max-width: 40rem;
  font-size: 0.98rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Demos panel */
.section-demos .demo-panel {
  margin-top: 0.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(94, 234, 212, 0.08), transparent 55%),
    var(--bg-card);
  backdrop-filter: blur(14px);
}

.demo-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.demo-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.55);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.demo-status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2);
}

.demo-status-chip[data-status="online"] .demo-status-dot,
.demo-status-chip[data-status="busy"] .demo-status-dot {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.demo-status-chip[data-status="warming"] .demo-status-dot,
.demo-status-chip[data-status="waking"] .demo-status-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
  animation: demo-pulse 1.2s ease-in-out infinite;
}

.demo-status-chip[data-status="offline"] .demo-status-dot {
  background: #64748b;
}

.demo-status-chip[data-status="cooldown"] .demo-status-dot {
  background: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

@keyframes demo-pulse {
  50% { opacity: 0.45; }
}

.demo-status-meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.demo-actions {
  margin-bottom: 1.5rem;
}

.demo-wake-hint {
  margin: 0.65rem 0 0;
  max-width: 36rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.demo-tracks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.demo-track {
  position: relative;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.35);
}

.demo-track h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.1rem;
}

.demo-track p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.demo-badge {
  display: inline-block;
  margin-top: 0.85rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.demo-footnote {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

@media (max-width: 800px) {
  .demo-tracks {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.card {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(94, 234, 212, 0.08);
}

.card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  margin-bottom: 1.1rem;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.15);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* AI panel */
.section-ai {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.ai-panel {
  max-width: calc(var(--max) + 5rem);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.ai-copy p {
  color: var(--text-muted);
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
}

.checklist li {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.75rem;
  color: var(--text);
  font-size: 0.98rem;
  border-bottom: 1px solid var(--border);
}

.checklist li:last-child {
  border-bottom: none;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.6);
}

.terminal {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #070b14;
  box-shadow:
    0 0 0 1px rgba(94, 234, 212, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.terminal-bar span:nth-child(1) {
  background: #f87171;
}
.terminal-bar span:nth-child(2) {
  background: #fbbf24;
}
.terminal-bar span:nth-child(3) {
  background: #34d399;
}

.terminal-bar em {
  margin-left: auto;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.terminal-body {
  margin: 0;
  padding: 1.25rem 1.35rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text);
}

.t-muted {
  color: var(--text-dim);
}
.t-cmd {
  color: var(--accent);
}
.t-str {
  color: #a5b4fc;
}
.t-ok {
  color: #34d399;
}
.t-num {
  color: #fbbf24;
}

/* Steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.steps li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
}

.steps li:last-child {
  border-bottom: none;
}

.step-num {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--accent);
  padding-top: 0.15rem;
}

.steps h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}

.steps p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Stack */
.section-stack {
  background: radial-gradient(ellipse 80% 50% at 50% 100%, rgba(129, 140, 248, 0.08), transparent);
}

.stack-rows {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stack-row {
  padding: 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.6);
}

.stack-row h3 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 1rem;
}

.stack-row ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stack-row li {
  padding: 0.4rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.stack-row li:last-child {
  border-bottom: none;
}

/* Quote */
.quote-section {
  text-align: center;
}

.quote-section blockquote {
  margin: 0 auto;
  max-width: 42rem;
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, rgba(94, 234, 212, 0.06), rgba(129, 140, 248, 0.08));
}

.quote-section p {
  font-family: var(--display);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.quote-section footer {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Contact */
.contact-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 80% at 0% 0%, rgba(94, 234, 212, 0.1), transparent 50%),
    var(--bg-elevated);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.contact-meta {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.contact-meta li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.contact-meta span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.contact-meta a {
  color: var(--text);
  font-weight: 500;
}

.contact-meta a:hover {
  color: var(--accent);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  color: var(--text);
  background: rgba(5, 8, 15, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--text-dim);
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.form-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: calc(var(--max) + 5rem);
  margin: 0 auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 2.5rem) 3rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

.footer-brand p {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: flex-end;
  align-items: start;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Responsive */
@media (max-width: 960px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ai-panel,
  .contact-card,
  .stack-rows {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.25rem 1.25rem;
    background: rgba(5, 8, 15, 0.96);
    border-bottom: 1px solid var(--border);
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-cta {
    margin-top: 0.75rem;
    text-align: center;
  }

  .nav-toggle {
    display: flex;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .steps li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .hero h1 {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .hero {
    padding-top: calc(var(--header-h) + 0.75rem);
  }

  .hero-stage {
    /* Still cinematic, slightly taller than strict 16:9 on narrow phones so copy fits */
    aspect-ratio: 4 / 3;
    max-height: none;
  }

  .hero-inner {
    padding-right: clamp(1rem, 4vw, 1.5rem);
    justify-content: flex-end;
  }

  .hero-lead {
    display: none; /* keep overlay compact; lead reappears below via stats + sections */
  }

  .hero-parallax img {
    object-position: 70% center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .pulse,
  .card:hover {
    transform: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-parallax {
    transform: none !important;
  }
}

/* ========== Unlisted lab demo (/lab/demo) ========== */
.lab-demo-page {
  min-height: 100vh;
  /* Lab needs room for full-width code workspace (not the marketing max-width) */
  --lab-max: 1480px;
}

.lab-header {
  gap: 1rem;
}

.lab-header .lab-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.lab-jump {
  display: none;
  flex: 1;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.88rem;
}

.lab-jump a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}

.lab-jump a:hover {
  color: var(--accent);
  border-bottom-color: rgba(94, 234, 212, 0.45);
}

@media (min-width: 720px) {
  .lab-jump {
    display: flex;
  }
}

.lab-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: rgba(251, 191, 36, 0.08);
}

.lab-path {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lab-main {
  position: relative;
  z-index: 1;
  max-width: min(var(--lab-max), 100%);
  margin: 0 auto;
  padding: 1.5rem clamp(1.25rem, 3vw, 2.75rem) 3rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lab-banner {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.07);
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.lab-banner code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--accent);
}

.lab-panel {
  padding: clamp(1.15rem, 2.5vw, 1.65rem);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(94, 234, 212, 0.07), transparent 55%),
    var(--bg-card);
  backdrop-filter: blur(14px);
  margin-bottom: 1.15rem;
}

.lab-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.lab-panel-head h1 {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  letter-spacing: -0.02em;
}

.lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0 1.1rem;
}

.lab-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1.25rem;
  margin: 0;
}

.lab-kv div {
  min-width: 0;
}

.lab-kv dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 0.15rem;
}

.lab-kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.lab-log {
  margin: 0.85rem 0 0;
  min-height: 1.25em;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.lab-log[data-error="1"] {
  color: #f9a8d4;
}

/* Stacked full-width demo zones (speech, then code) — not a 50/50 grid */
.lab-section {
  margin-bottom: 1.5rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.lab-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.45rem;
}

.lab-section-head h2 {
  margin: 0.1rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  letter-spacing: -0.02em;
}

.lab-section--code {
  border-color: rgba(129, 140, 248, 0.28);
  background:
    radial-gradient(100% 70% at 100% 0%, rgba(129, 140, 248, 0.1), transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(94, 234, 212, 0.05), transparent 50%),
    var(--bg-card);
}

.lab-card-lead {
  margin: 0 0 1.15rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 70ch;
}

.lab-placeholder {
  margin: 0;
  padding: 1.25rem 1rem;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

/* Speech: compose + result side-by-side only when wide; still its own full section */
.lab-speech-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
}

@media (min-width: 960px) {
  .lab-speech-layout {
    /* Result column ~10% wider than prior 0.8fr share (was 1.2 / 0.8). */
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    align-items: start;
  }
}

.lab-speech-result .lab-job {
  margin-top: 0;
}

.lab-job--always:not([hidden]) + .lab-placeholder,
.lab-job--always:not([hidden]) ~ .lab-placeholder {
  display: none;
}

.lab-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.lab-field--flush {
  margin-bottom: 0;
}

.lab-field-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.lab-field-hint .mono {
  color: var(--text-muted);
  font-size: 0.8em;
}

.lab-field input,
.lab-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.65);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  resize: vertical;
}

.lab-field input:focus,
.lab-field textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.lab-textarea-lg {
  min-height: 10rem;
  line-height: 1.55;
}

/* Short optional fields (control instruction, etc.) — ~2–3 lines */
.lab-textarea-sm {
  min-height: 0;
  height: 4.6em;
  max-height: 4.6em;
  line-height: 1.4;
  resize: vertical;
}

.lab-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.lab-field-row--speech {
  grid-template-columns: minmax(8rem, 14rem);
}

.lab-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

/* ---- Code workspace (full width, thread-style) ---- */
.code-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.code-composer {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.45);
  overflow: hidden;
}

.code-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.65);
}

.code-pane-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.code-composer-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.code-prompt-input {
  /* Compact composer — room goes to the model reply below */
  min-height: 5.25rem;
  max-height: 11rem;
  height: 6.5rem;
  margin: 0;
  padding: 0.65rem 0.9rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: var(--mono) !important;
  font-size: 0.88rem !important;
  line-height: 1.45 !important;
  resize: vertical;
}

.code-prompt-input:focus {
  box-shadow: none !important;
}

.code-context-details {
  border-top: 1px solid var(--border);
  padding: 0;
}

.code-context-details summary {
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}

.code-context-details summary::-webkit-details-marker {
  display: none;
}

.code-context-details summary::before {
  content: "▸ ";
  color: var(--accent-2);
  font-family: var(--mono);
}

.code-context-details[open] summary::before {
  content: "▾ ";
}

.code-context-body {
  padding: 0 1rem 0.85rem;
}

.code-composer-actions {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.code-thread {
  min-height: min(55vh, 28rem);
}

.code-thread-live {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lab-job--thread {
  margin-top: 0;
}

.code-turn {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-turn--user {
  border-color: rgba(94, 234, 212, 0.22);
  flex: 0 0 auto;
}

.code-turn--assistant {
  border-color: rgba(129, 140, 248, 0.28);
  /* Primary reading surface — tall by default */
  min-height: min(58vh, 36rem);
  flex: 1 1 auto;
}

.code-turn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.7);
  flex: 0 0 auto;
}

.code-turn-role {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.code-turn--assistant .code-turn-role {
  color: #a5b4fc;
}

/* Submitted prompt echo — compact */
.code-turn-body {
  margin: 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 7rem;
  overflow: auto;
  background: transparent;
}

/*
 * Model reply pane — must stay tall even with short content.
 * High-specificity id so generic .lab-output max-height cannot collapse it.
 */
#code-output.code-turn-output,
.code-turn-output.lab-output.lab-markdown {
  display: block !important;
  flex: 1 1 auto;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #070b14 !important;
  padding: 1.1rem 1.2rem !important;
  /* Force readable viewport: ~half the window, never a one-liner strip */
  min-height: min(58vh, 36rem) !important;
  height: min(58vh, 36rem);
  max-height: min(78vh, 48rem) !important;
  overflow: auto !important;
  box-sizing: border-box;
  white-space: normal;
  font-family: var(--font);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text);
}

.lab-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

.lab-select {
  display: block;
  width: 100%;
  max-width: 12rem;
  margin-top: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.65);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: auto;
}

.lab-select:focus {
  outline: 2px solid rgba(94, 234, 212, 0.35);
  outline-offset: 1px;
  border-color: rgba(94, 234, 212, 0.45);
}

.lab-job {
  margin-top: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.4);
}

.lab-job-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.lab-job-status {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.lab-job-status[data-status="succeeded"] {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

.lab-job-status[data-status="failed"] {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.4);
}

.lab-job-status[data-status="queued"],
.lab-job-status[data-status="running"],
.lab-job-status[data-status="waking"],
.lab-job-status[data-status="warming"] {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

.lab-job-detail {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Token usage + frontier cloud cost equivalents (lab demos) */
.lab-usage-cost {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.45);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.lab-usage-cost-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.lab-usage-cost-head strong {
  font-weight: 600;
}

.lab-usage-cost-note {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  opacity: 0.85;
  line-height: 1.35;
}

.lab-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.lab-cost-table th,
.lab-cost-table td {
  text-align: left;
  padding: 0.28rem 0.4rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.lab-cost-table th {
  font-weight: 600;
  color: var(--text);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lab-cost-table td.num,
.lab-cost-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono, ui-monospace, monospace);
}

.lab-cost-table .lab-cost-total {
  font-weight: 600;
  color: var(--text);
}

.lab-session-warning {
  margin: 0.35rem 0 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  font-size: 0.85rem;
  line-height: 1.4;
}

.lab-session-warning[data-level="critical"] {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

/* ---- Agent multi-turn chat (outer scroll + composer under latest reply) ---- */
.agent-session {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.4);
  overflow: hidden;
}

.agent-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.75);
}

.agent-export-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.agent-export-status {
  font-size: 0.75rem;
  color: var(--accent, #5eead4);
  margin-left: 0.25rem;
}

.agent-export-status[data-state="error"] {
  color: #fecaca;
}

.agent-export-capture {
  /* Full transcript height for html2canvas (parent still scrolls) */
  min-width: 0;
}

.agent-session-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.7);
}

.agent-session-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-left: auto;
}

.agent-session-scroll {
  /* Outer session scroll — turns + job status + composer stack inside */
  max-height: min(72vh, 42rem);
  min-height: min(42vh, 22rem);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem 1rem;
  scroll-behavior: smooth;
}

.agent-thread-empty {
  margin: 0.25rem 0 0.15rem;
}

.agent-turns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.agent-turn {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.4);
  /* Full width of chat column — no big left/right chat offsets */
  width: 100%;
  max-width: none;
  align-self: stretch;
}

.agent-turn--user {
  border-color: rgba(94, 234, 212, 0.22);
  background: rgba(94, 234, 212, 0.05);
  border-left: 3px solid rgba(94, 234, 212, 0.55);
}

.agent-turn--assistant {
  border-color: rgba(148, 163, 184, 0.18);
  border-left: 3px solid rgba(148, 163, 184, 0.4);
}

.agent-turn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.agent-turn-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 0;
  display: block;
}

.agent-turn-src-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
}

.agent-turn-src-btn:hover {
  color: var(--text);
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(94, 234, 212, 0.08);
}

.agent-turn-src-btn[aria-pressed="true"] {
  color: #042f2e;
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(94, 234, 212, 0.75);
}

/* Planning / chain-of-thought — before the answer, distinct from reply prose */
.agent-thinking {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background:
    linear-gradient(135deg, rgba(167, 139, 250, 0.08), transparent 55%),
    rgba(15, 12, 28, 0.65);
}

.agent-thinking-summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c4b5fd;
  user-select: none;
  margin: 0 0 0.35rem;
}

.agent-thinking-summary::-webkit-details-marker {
  display: none;
}

.agent-thinking-summary::before {
  content: "▸ ";
  font-family: var(--mono);
  color: rgba(196, 181, 253, 0.75);
}

.agent-thinking[open] > .agent-thinking-summary::before {
  content: "▾ ";
}

/* Live thinking uses the same bubble as final Thinking; soft pulse only */
.agent-turn--thinking-live {
  animation: agent-think-pulse 2.4s ease-in-out infinite;
}

.agent-turn--thinking-live .agent-thinking {
  max-height: min(42vh, 20rem);
  overflow: auto;
}

@keyframes agent-think-pulse {
  0%,
  100% {
    border-color: rgba(167, 139, 250, 0.22);
  }
  50% {
    border-color: rgba(167, 139, 250, 0.48);
  }
}

.agent-thinking-body {
  margin: 0;
  /* Soft “thinking” look: italic serif-ish, keep real newlines */
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    "Times New Roman", Georgia, serif;
  font-style: italic;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.55;
  color: #c4b5fd;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.92;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(36vh, 18rem);
  overflow: auto;
}

.agent-turn-source {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background: rgba(5, 8, 15, 0.65);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: min(50vh, 28rem);
  overflow-y: auto;
}

.agent-turn.is-showing-source {
  border-color: rgba(251, 191, 36, 0.35);
}

.agent-turn .code-turn-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
}

.agent-job-inline {
  flex-shrink: 0;
}

.agent-tools-head {
  margin-top: 0.65rem;
  font-size: 0.78rem;
}

.agent-composer {
  flex-shrink: 0;
  margin-top: 0.15rem;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  background: rgba(5, 8, 15, 0.65);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.06);
}

.agent-composer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.4rem 0.75rem 0.15rem;
}

.agent-enter-send-check {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
  gap: 0.35rem;
}

.agent-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.25rem 0.55rem 0.55rem 0.45rem;
}

.agent-composer-field {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.agent-prompt-input {
  min-height: 2.75rem !important;
  max-height: 9rem !important;
  height: auto !important;
  padding: 0.55rem 0.65rem !important;
  border-radius: 8px !important;
}

/* Compact play-style send (not a large primary pill) */
.agent-send-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0 0 0.15rem;
  padding: 0;
  border: 1px solid rgba(94, 234, 212, 0.45);
  border-radius: 50%;
  background: rgba(94, 234, 212, 0.12);
  color: #5eead4;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
    transform 0.08s ease;
}

.agent-send-btn:hover:not(:disabled) {
  background: rgba(94, 234, 212, 0.22);
  border-color: rgba(94, 234, 212, 0.7);
  color: #99f6e4;
}

.agent-send-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.agent-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.agent-send-btn:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.65);
  outline-offset: 2px;
}

.agent-send-icon {
  display: block;
  /* Optical center for play triangle */
  margin-left: 2px;
}

.agent-composer.is-busy {
  opacity: 0.85;
}

.agent-composer.is-busy .agent-prompt-input {
  opacity: 0.75;
}

.agent-composer.is-busy .agent-send-btn {
  opacity: 0.4;
  pointer-events: none;
}

/* ---- Tabbed lab shell ---- */
.lab-header--tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 12rem;
}

.lab-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.lab-tab:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.lab-tab.is-active,
.lab-tab[aria-selected="true"] {
  color: #5eead4;
  border-bottom-color: #5eead4;
  background: rgba(94, 234, 212, 0.06);
}

.lab-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.lab-session-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.06);
  min-width: 4.5rem;
}

.lab-session-clock[data-state="idle"] {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.35);
}

.lab-session-clock[data-state="critical"] {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.1);
}

.lab-session-clock-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.lab-session-clock-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fde68a;
}

.lab-session-clock[data-state="idle"] .lab-session-clock-value {
  color: var(--text-dim);
}

.lab-session-clock[data-state="critical"] .lab-session-clock-value {
  color: #fecaca;
}

.lab-main--tabs {
  max-width: 1200px;
}

/* Agent needs a wider middle chat column for clean You/Agent turns */
.lab-section--agent {
  max-width: none;
}

.lab-main--tabs:has(#panel-agent:not([hidden])) {
  max-width: min(1480px, 96vw);
}

.lab-tab-panel[hidden] {
  display: none !important;
}

.lab-field-hint-inline {
  font-style: normal;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Agent: stats gutter wide enough for price list + chat middle */
.agent-layout {
  display: grid;
  grid-template-columns: minmax(15.5rem, 18.5rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: min(72vh, 44rem);
}

@media (max-width: 860px) {
  .agent-layout {
    grid-template-columns: 1fr;
  }
}

.agent-gutter {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 15, 0.55);
  padding: 0.75rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
}

.agent-gutter-title {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.agent-gutter-meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.agent-gutter-kv {
  margin: 0.25rem 0 0;
  display: grid;
  gap: 0.25rem;
}

.agent-gutter-kv div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  padding: 0.15rem 0;
}

.agent-gutter-kv dt {
  color: var(--text-dim);
  margin: 0;
}

.agent-gutter-kv dd {
  margin: 0;
  text-align: right;
}

.agent-gutter-note {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.agent-gutter-costs {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  min-width: 0;
}

.agent-gutter-cost-line {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.agent-gutter-cost-line--free {
  color: var(--accent, #5eead4);
}

.agent-gutter-cost-line--frontier {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Stacked price cards — readable in a sidebar (no 4-col crush) */
.agent-cost-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agent-cost-item {
  margin: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(5, 8, 15, 0.4);
}

.agent-cost-name {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.agent-cost-rates {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.25rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.agent-cost-rates span {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.agent-cost-rates .lbl {
  font-family: var(--font);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  opacity: 0.85;
}

.agent-cost-rates .val {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.agent-cost-rates .val--total {
  color: var(--accent, #5eead4);
  font-weight: 600;
}

.agent-gutter-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding-top: 0.5rem;
}

.agent-layout .agent-session {
  min-height: min(72vh, 44rem);
  display: flex;
  flex-direction: column;
  min-width: 0; /* allow wide middle to shrink cleanly */
}

.agent-layout .agent-session-scroll {
  flex: 1 1 auto;
  max-height: min(74vh, 48rem);
}

/* Compact in-flight badges only — no GUIDs / JSON in the turn stream */
.agent-job-inline {
  padding: 0.4rem 0.55rem;
  border-style: dashed;
}

.agent-job-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.agent-job-inline .lab-job-status {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.55);
}

.agent-job-inline .lab-job-status[data-status="running"],
.agent-job-inline .lab-job-status[data-status="queued"],
.agent-job-inline .lab-job-status[data-status="waking"],
.agent-job-inline .lab-job-status[data-status="warming"] {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

.agent-job-inline .lab-job-status[data-status="failed"],
.agent-job-inline .lab-job-status[data-status="expired"],
.agent-job-inline .lab-job-status[data-status="cancelled"] {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.agent-job-inline .lab-wake-pipe {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  gap: 0;
}

.agent-job-inline .lab-wake-stage {
  font-size: 0.72rem;
}

.agent-job-inline .lab-job-detail {
  font-size: 0.78rem;
  color: #fecaca;
  margin: 0.3rem 0 0;
}

.agent-tools-details {
  margin-top: 0.35rem;
}

.agent-tools-details summary {
  cursor: pointer;
  list-style: none;
  margin: 0;
  font-size: 0.75rem;
}

.agent-tools-details summary::-webkit-details-marker {
  display: none;
}

.agent-tools-details[open] summary {
  margin-bottom: 0.25rem;
}

/* Speech waveform */
.speech-waveform {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 72px;
  margin: 0.55rem 0 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  background: rgba(5, 8, 15, 0.65);
}

.speech-waveform--snip {
  height: 48px;
  margin: 0.35rem 0 0.25rem;
}

.lab-audio {
  width: 100%;
  margin-top: 0.65rem;
  /* Native <audio> chrome is bright white; darken + mute contrast into the theme */
  color-scheme: dark;
  accent-color: var(--accent);
  border-radius: 8px;
  background: rgba(8, 12, 20, 0.85);
  /* Soften default UA whites without crushing the waveform scrubber */
  filter: brightness(0.78) contrast(0.92) saturate(0.9);
  opacity: 0.92;
}

.lab-audio:hover,
.lab-audio:focus {
  opacity: 1;
  filter: brightness(0.84) contrast(0.94) saturate(0.95);
}

.lab-audio--snip {
  margin-top: 0.25rem;
  height: 2rem;
}

/* Recent speech clips (last N) */
.speech-snips {
  margin-top: 0.75rem;
}

.speech-snips-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.speech-snips-head .lab-subhead {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.speech-snips-cap {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.speech-snips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(70vh, 34rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.speech-snip {
  margin: 0;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background: rgba(5, 8, 15, 0.45);
}

.speech-snip.is-latest {
  border-color: rgba(94, 234, 212, 0.35);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.08);
}

.speech-snip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.speech-snip-voice {
  font-weight: 600;
  color: var(--accent, #5eead4);
}

.speech-snip-ago {
  color: var(--text-muted);
}

.speech-snip-playstate {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-dim);
  background: rgba(15, 23, 42, 0.55);
}

.speech-snip-playstate[data-state="playing"] {
  color: #042f2e;
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(94, 234, 212, 0.85);
}

.speech-snip-playstate[data-state="paused"] {
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.speech-snip-playstate[data-state="ended"] {
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.25);
}

.speech-snip-playstate[data-state="blocked"],
.speech-snip-playstate[data-state="error"] {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
}

.speech-snip-playstate[data-state="loading"] {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.35);
}

.speech-snip-id {
  margin-left: auto;
  opacity: 0.65;
  font-size: 0.72rem;
}

.speech-snip-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  /* Collapsed height ~2–3 lines; scroll to read full prompt */
  max-height: 4.35em;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  scrollbar-gutter: stable;
  white-space: pre-wrap;
  word-break: break-word;
}

.lab-job-hint[data-state="error"] {
  color: #fecaca;
}

.lab-job-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.lab-wake-pipe {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  background: rgba(94, 234, 212, 0.05);
  font-size: 0.8rem;
}

.lab-wake-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.lab-wake-stage {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5eead4;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.35);
}

.lab-wake-pipe[data-stage="enqueued"] .lab-wake-stage,
.lab-wake-pipe[data-stage="wol_sent"] .lab-wake-stage {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

.lab-wake-pipe[data-stage="gpu_online"] .lab-wake-stage {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

.lab-wake-pipe[data-stage="wol_skipped"] .lab-wake-stage,
.lab-wake-pipe[data-stage="doorbell_stale"] .lab-wake-stage {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.4);
}

.lab-wake-detail {
  color: var(--text-muted);
  flex: 1 1 12rem;
}

.lab-output {
  margin: 0.5rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #070b14;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow: auto;
  max-height: 22rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Markdown-rendered code job results (full workspace room) */
.lab-markdown {
  font-family: var(--sans, var(--font, "DM Sans", system-ui, sans-serif));
  font-size: 0.98rem;
  line-height: 1.6;
  white-space: normal;
  color: var(--text);
}

.lab-markdown > :first-child {
  margin-top: 0;
}

.lab-markdown > :last-child {
  margin-bottom: 0;
}

.lab-markdown p {
  margin: 0.55rem 0;
}

.lab-markdown h1,
.lab-markdown h2,
.lab-markdown h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.85rem 0 0.4rem;
  color: var(--text);
}

.lab-markdown h1 { font-size: 1.15rem; }
.lab-markdown h2 { font-size: 1.05rem; }
.lab-markdown h3 { font-size: 0.98rem; }

.lab-markdown ul,
.lab-markdown ol {
  margin: 0.45rem 0;
  padding-left: 1.25rem;
}

.lab-markdown table,
.lab-md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin: 0.65rem 0;
}

.lab-md-table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior: contain;
  margin: 0.55rem 0;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 8, 15, 0.45);
}

.lab-md-table-wrap .lab-md-table {
  margin: 0;
  min-width: 28rem;
}

.lab-md-table th,
.lab-md-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  border-right: 1px solid rgba(148, 163, 184, 0.08);
}

.lab-md-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text);
  background: rgba(15, 23, 42, 0.65);
  white-space: nowrap;
}

.lab-md-table td {
  color: var(--text-muted);
  word-break: break-word;
}

.lab-md-table tr:last-child td {
  border-bottom: 0;
}

.lab-markdown li {
  margin: 0.2rem 0;
}

.lab-markdown a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lab-markdown code {
  font-family: var(--mono);
  font-size: 0.84em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.12);
  color: #a5f3fc;
}

.lab-markdown pre {
  margin: 0.75rem 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1117;
  overflow: auto;
  max-height: min(60vh, 32rem);
}

.lab-markdown pre code,
.lab-markdown pre code.hljs {
  display: block;
  padding: 0.95rem 1.1rem;
  border: 0;
  background: transparent;
  /* Let highlight.js token colors win; fallback if CDN failed */
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre;
  word-break: normal;
  tab-size: 2;
}

.lab-markdown pre code.hljs {
  color: inherit;
}

/* Slightly denser tokens on dark lab chrome */
.lab-markdown .hljs {
  background: transparent;
}

/* Fenced code inside the tall reply pane scrolls inside the outer pane */
#code-output.lab-markdown pre,
.code-turn-output.lab-markdown pre {
  max-height: none;
}

.lab-markdown blockquote {
  margin: 0.55rem 0;
  padding: 0.15rem 0 0.15rem 0.85rem;
  border-left: 3px solid rgba(94, 234, 212, 0.35);
  color: var(--text-muted);
}

.lab-markdown hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0;
}

.lab-output--dim {
  color: var(--text-dim);
  max-height: 14rem;
}

.lab-output--log {
  max-height: 16rem;
  min-height: 6rem;
}

.lab-footnote {
  margin: 0.5rem 0 2rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.lab-subhead {
  margin: 1rem 0 0.4rem;
  font-family: var(--display);
  font-size: 0.95rem;
}

.lab-tool-timeline {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: 12rem;
  overflow: auto;
}

.lab-tool-timeline li {
  margin: 0.2rem 0;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn-speech-gen {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-speech-icon {
  flex: 0 0 auto;
  display: block;
  opacity: 0.9;
}

.btn-speech-gen:disabled {
  opacity: 0.55;
  cursor: wait;
}

.mono {
  font-family: var(--mono);
}

@media (max-width: 860px) {
  .lab-kv {
    grid-template-columns: 1fr;
  }

  .lab-field-row {
    grid-template-columns: 1fr;
  }
}
