/* ==========================================================================
   Open6502 — 芯片小课堂 v2
   Light, warm, organic theme: cream background, terracotta/teal accents,
   soft shadows, rounded organic shapes, generous whitespace.
   Scoped to .chip-lab-page so it cannot leak into other pages.
   ========================================================================== */

.chip-lab-page {
  --lab-bg: #faf7f2;
  --lab-bg-soft: #f5f1ea;
  --lab-panel: #ffffff;
  --lab-panel-soft: #f9f6f0;
  --lab-line: #e8e0d4;
  --lab-line-strong: #d9cfc0;
  --lab-text: #2d2a26;
  --lab-text-soft: #5a544e;
  --lab-muted: #8a8178;
  --lab-dim: #a89e92;
  --lab-terra: #c94f32;
  --lab-terra-soft: #c94f32;
  --lab-terra-dim: rgba(201, 79, 50, 0.08);
  --lab-teal: #2a8c7a;
  --lab-teal-dim: rgba(42, 140, 122, 0.08);
  --lab-amber: #d4a04c;
  --lab-amber-dim: rgba(212, 160, 76, 0.1);
  --lab-blue: #5a7fa6;
  --lab-blue-dim: rgba(90, 127, 166, 0.08);
  --lab-violet: #8a6fa8;
  --lab-violet-dim: rgba(138, 111, 168, 0.08);
  --lab-rose: #c25a6e;
  --lab-rose-dim: rgba(194, 90, 110, 0.08);
  --lab-sage: #7a9a6a;
  --lab-sage-dim: rgba(122, 154, 106, 0.1);
  --lab-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --lab-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --lab-radius: 20px;
  --lab-radius-sm: 12px;
  --lab-shadow: 0 2px 8px rgba(45, 42, 38, 0.04), 0 8px 32px rgba(45, 42, 38, 0.06);
  --lab-shadow-lg: 0 4px 16px rgba(45, 42, 38, 0.06), 0 20px 60px rgba(45, 42, 38, 0.08);
  --lab-nav-h: 68px;
  --lab-container: 1180px;
  --lab-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

.chip-lab-page .container {
  width: min(100% - 48px, var(--lab-container));
}

/* ---------- No-JS fallback ---------- */
html:not(.js) .deck-tools,
html:not(.js) .deck-caption {
  display: none;
}

html:not(.js) .deck-stage {
  aspect-ratio: auto;
  min-height: 0;
}

html:not(.js) .slide {
  position: relative;
  display: block;
  min-height: 100vh;
  border-bottom: 1px solid var(--lab-line);
}

/* ---------- Hero ---------- */
.lab-hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 clamp(32px, 5vw, 56px);
  background:
    radial-gradient(800px 500px at 85% -10%, rgba(201, 79, 50, 0.05), transparent 60%),
    radial-gradient(600px 400px at -10% 20%, rgba(42, 140, 122, 0.04), transparent 55%),
    var(--lab-bg);
}

.lab-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.lab-hero .eyebrow {
  color: var(--lab-terra);
}

.lab-hero h1 {
  margin: 16px 0 0;
  font-size: clamp(2.6rem, 5.6vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--lab-text);
}

.lab-hero h1 .hl {
  color: var(--lab-terra);
}

.lab-lede {
  margin-top: 20px;
  max-width: 38em;
  color: var(--lab-text-soft);
  font-size: clamp(0.98rem, 1.25vw, 1.1rem);
  line-height: 1.85;
}

.lab-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.lab-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 999px;
  background: var(--lab-panel);
  color: var(--lab-text-soft);
  font-family: var(--lab-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.lab-pill .dot {
  width: 6px;
  height: 6px;
}

.lab-pill--red {
  border-color: var(--lab-terra);
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.lab-actions .btn--primary {
  background: var(--lab-terra);
  color: #fff;
  box-shadow: 0 4px 16px rgba(201, 79, 50, 0.25);
}

.lab-actions .btn--primary:hover {
  background: #b8452b;
  box-shadow: 0 8px 28px rgba(201, 79, 50, 0.32);
}

.lab-actions .btn--ghost {
  border-color: var(--lab-line-strong);
  background: var(--lab-panel);
  color: var(--lab-text);
}

.lab-actions .btn--ghost:hover {
  border-color: var(--lab-text-soft);
  background: var(--lab-panel-soft);
}

.lab-hero-aside {
  position: relative;
  padding: 26px;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  box-shadow: var(--lab-shadow);
}

.lab-hero-aside::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed var(--lab-line);
  border-radius: calc(var(--lab-radius) - 8px);
  pointer-events: none;
}

.lab-hero-aside .mini-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lab-hero-aside h2 {
  margin-top: 14px;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--lab-text);
}

.lab-hero-aside p {
  margin-top: 10px;
  color: var(--lab-text-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.lab-goals {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.lab-goal {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel-soft);
}

.lab-goal b {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.lab-goal span {
  color: var(--lab-text-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.lab-hero-note {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  line-height: 1.6;
}

/* ---------- Deck shell ---------- */
.lab-deck-section {
  padding: 10px 0 clamp(40px, 5vw, 72px);
  scroll-margin-top: calc(var(--lab-nav-h) + 20px);
}

.deck {
  position: relative;
  margin: 0 auto;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-bg);
  box-shadow: var(--lab-shadow-lg);
  overflow: hidden;
}

.deck:fullscreen,
.deck.is-presenting {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: 0;
}

.deck:fullscreen .deck-stage,
.deck.is-presenting .deck-stage {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
}

.deck-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--lab-line);
  background: var(--lab-panel);
}

.deck-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.deck-brand i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lab-terra);
  box-shadow: 0 0 0 4px var(--lab-terra-dim);
}

.deck-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.deck-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 8px;
  background: var(--lab-panel);
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.16s, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

.deck-btn:hover {
  color: var(--lab-text);
  border-color: var(--lab-text-soft);
  background: var(--lab-panel-soft);
  box-shadow: 0 2px 8px rgba(45, 42, 38, 0.06);
}

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

.deck-btn[aria-pressed="true"] {
  color: var(--lab-terra);
  border-color: var(--lab-terra);
  background: var(--lab-terra-dim);
}

.deck-btn--primary {
  color: #fff;
  border-color: transparent;
  background: var(--lab-terra);
}

.deck-btn--primary:hover {
  color: #fff;
  background: #b8452b;
}

.deck-counter {
  min-width: 70px;
  color: var(--lab-text-soft);
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  text-align: center;
  white-space: nowrap;
}

.deck-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 440px;
  background: var(--lab-bg);
  overflow: hidden;
}

.deck-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  aspect-ratio: auto;
}

.slide {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--lab-line-strong) transparent;
}

.slide.is-active {
  display: block;
}

.slide::-webkit-scrollbar {
  width: 8px;
}

.slide::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--lab-line-strong);
}

.slide::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 420px at 88% -8%, rgba(201, 79, 50, 0.06), transparent 62%),
    radial-gradient(560px 380px at -8% 100%, rgba(42, 140, 122, 0.05), transparent 62%),
    linear-gradient(180deg, #faf7f2 0%, #f5f1ea 100%);
}

.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(45, 42, 38, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 42, 38, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
}

.slide-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: clamp(20px, 3.4vw, 48px);
}

.slide-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.slide-topline .slide-index {
  color: var(--lab-muted);
}

.slide-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: clamp(14px, 2.2vw, 24px);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.slide-kicker::before {
  content: "";
  width: 22px;
  height: 1.5px;
  background: currentColor;
}

.slide-title {
  margin-top: 10px;
  font-size: clamp(1.8rem, 3.8vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--lab-text);
}

.slide-lead {
  margin-top: 10px;
  max-width: 72ch;
  color: var(--lab-text-soft);
  font-size: clamp(0.88rem, 1.15vw, 1.02rem);
  line-height: 1.75;
}

.slide-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding-top: clamp(14px, 2vw, 24px);
}

.slide-footnote {
  margin-top: clamp(12px, 2vw, 20px);
  padding-top: 10px;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  line-height: 1.6;
}

.slide-note {
  display: none;
}

/* ---------- Generic cards ---------- */
.lab-card {
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-panel);
  padding: clamp(14px, 1.8vw, 20px);
  box-shadow: var(--lab-shadow);
}

.lab-card--red {
  border-color: rgba(201, 79, 50, 0.25);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(201, 79, 50, 0.06), transparent 70%),
    var(--lab-panel);
}

.lab-card--green {
  border-color: rgba(42, 140, 122, 0.22);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(42, 140, 122, 0.05), transparent 70%),
    var(--lab-panel);
}

.lab-card--blue {
  border-color: rgba(90, 127, 166, 0.22);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(90, 127, 166, 0.05), transparent 70%),
    var(--lab-panel);
}

.lab-card--amber {
  border-color: rgba(212, 160, 76, 0.25);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(212, 160, 76, 0.06), transparent 70%),
    var(--lab-panel);
}

.lab-card--violet {
  border-color: rgba(138, 111, 168, 0.22);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(138, 111, 168, 0.05), transparent 70%),
    var(--lab-panel);
}

.lab-card--rose {
  border-color: rgba(194, 90, 110, 0.22);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(194, 90, 110, 0.05), transparent 70%),
    var(--lab-panel);
}

.lab-card--sage {
  border-color: rgba(122, 154, 106, 0.22);
  background:
    radial-gradient(320px 200px at 100% 0%, rgba(122, 154, 106, 0.06), transparent 70%),
    var(--lab-panel);
}

.lab-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lab-label--green { color: var(--lab-teal); }
.lab-label--blue { color: var(--lab-blue); }
.lab-label--amber { color: var(--lab-amber); }
.lab-label--violet { color: var(--lab-violet); }
.lab-label--rose { color: var(--lab-rose); }
.lab-label--sage { color: var(--lab-sage); }

.lab-card h3 {
  margin-top: 7px;
  font-size: clamp(0.98rem, 1.35vw, 1.14rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--lab-text);
}

.lab-card p {
  margin-top: 6px;
  color: var(--lab-text-soft);
  font-size: clamp(0.76rem, 0.95vw, 0.84rem);
  line-height: 1.65;
}

.lab-note {
  display: block;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 79, 50, 0.2);
  border-radius: 10px;
  background: var(--lab-terra-dim);
  color: var(--lab-text-soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

.lab-note strong {
  color: var(--lab-terra);
}

.lab-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lab-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lab-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* ---------- Slide 1: Cover ---------- */
.slide--cover .slide-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(16px, 3vw, 44px);
  align-items: center;
  padding-top: clamp(24px, 3.4vw, 52px);
  padding-bottom: clamp(24px, 3.4vw, 52px);
}

.slide--cover h1 {
  margin-top: 14px;
  font-size: clamp(2.5rem, 5.4vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  color: var(--lab-text);
}

.slide--cover h1 .hl {
  color: var(--lab-terra);
}

.slide--cover .cover-sub {
  margin-top: 18px;
  color: var(--lab-text-soft);
  font-size: clamp(0.95rem, 1.25vw, 1.1rem);
  line-height: 1.6;
}

.slide--cover .cover-desc {
  margin-top: 8px;
  color: var(--lab-muted);
  font-size: clamp(0.8rem, 1vw, 0.92rem);
  line-height: 1.6;
}

.slide--cover .cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.slide--cover .cover-meta span {
  padding: 6px 10px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 999px;
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
}

.cover-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
}

.cover-art svg {
  width: min(100%, 460px);
  height: auto;
  overflow: visible;
}

/* ---------- Slide 2: Where ---------- */
.where-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.where-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-panel);
  box-shadow: var(--lab-shadow);
}

.where-card .icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 12px;
  background: var(--lab-panel-soft);
  color: var(--lab-teal);
}

.where-card .icon svg {
  width: 24px;
  height: 24px;
}

.where-card h3 {
  font-size: 0.92rem;
  color: var(--lab-text);
}

.where-card p {
  margin-top: 2px;
  color: var(--lab-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.where-card:nth-child(1) .icon { color: var(--lab-blue); }
.where-card:nth-child(2) .icon { color: var(--lab-teal); }
.where-card:nth-child(3) .icon { color: var(--lab-terra); }
.where-card:nth-child(4) .icon { color: var(--lab-amber); }
.where-card:nth-child(5) .icon { color: var(--lab-rose); }
.where-card:nth-child(6) .icon { color: var(--lab-sage); }

/* ---------- Slide 3: Chip anatomy ---------- */
.chip-anatomy {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: stretch;
}

.chip-anatomy-art {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--lab-line);
  border-radius: 16px;
  background: var(--lab-panel-soft);
}

.chip-anatomy-art svg {
  width: min(100%, 440px);
  height: auto;
}

.chip-anatomy-cards {
  display: grid;
  gap: 10px;
}

.anatomy-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-panel);
}

.anatomy-item .swatch {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
}

.anatomy-item h3 {
  font-size: 0.94rem;
  color: var(--lab-text);
}

.anatomy-item p {
  margin-top: 3px;
  color: var(--lab-text-soft);
  font-size: 0.74rem;
  line-height: 1.5;
}

/* ---------- Slide 4: Sand ---------- */
.sand-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
}

.sand-step {
  position: relative;
  padding: 14px 16px 14px 14px;
  border: 1px solid var(--lab-line);
  border-right: 0;
  background: var(--lab-panel);
}

.sand-step:first-child { border-radius: 14px 0 0 14px; }
.sand-step:last-child { border-right: 1px solid var(--lab-line); border-radius: 0 14px 14px 0; }

.sand-step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  z-index: 2;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--lab-line-strong);
  border-right: 1px solid var(--lab-line-strong);
  transform: translateY(-50%) rotate(45deg);
  background: var(--lab-panel);
}

.sand-step:last-child::after { display: none; }

.sand-step .sn {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.sand-step h3 {
  margin-top: 5px;
  font-size: 0.86rem;
  color: var(--lab-text);
}

.sand-step p {
  margin-top: 3px;
  color: var(--lab-muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.sand-bottom {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: center;
  margin-top: 16px;
}

.wafer-art {
  display: grid;
  place-items: center;
  min-height: 200px;
}

.wafer-art svg {
  width: min(100%, 240px);
  height: auto;
}

.fact-list {
  display: grid;
  gap: 8px;
}

.fact-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.fact-item i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--lab-terra);
}

.fact-item:nth-child(2) i { background: var(--lab-teal); }
.fact-item:nth-child(3) i { background: var(--lab-amber); }

.fact-item p {
  color: var(--lab-text-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.fact-item strong { color: var(--lab-text); }

/* ---------- Slide 5: SoC city ---------- */
.soc-city {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.soc-node {
  position: relative;
  padding: 14px 14px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-panel);
  text-align: center;
  box-shadow: var(--lab-shadow);
}

.soc-node h3 { font-size: 0.94rem; color: var(--lab-text); }
.soc-node p { margin-top: 3px; color: var(--lab-muted); font-size: 0.68rem; line-height: 1.45; }
.soc-node .tag {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  border: 1px solid var(--lab-line);
  border-radius: 5px;
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
}

.soc-node--cpu { border-color: rgba(201, 79, 50, 0.3); background: var(--lab-terra-dim); }
.soc-node--ppu { border-color: rgba(90, 127, 166, 0.28); background: var(--lab-blue-dim); }
.soc-node--apu { border-color: rgba(212, 160, 76, 0.28); background: var(--lab-amber-dim); }
.soc-node--ram { border-color: rgba(42, 140, 122, 0.28); background: var(--lab-teal-dim); }
.soc-node--bus { border-color: rgba(194, 90, 110, 0.28); background: var(--lab-rose-dim); }
.soc-node--io { border-color: rgba(138, 111, 168, 0.28); background: var(--lab-violet-dim); }

.soc-bus-strip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 34px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lab-terra-dim), var(--lab-blue-dim));
  color: var(--lab-text-soft);
  font-family: var(--lab-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.soc-bus-strip::before,
.soc-bus-strip::after {
  content: "";
  width: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lab-line-strong), transparent);
}

.soc-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.soc-roles span {
  padding: 5px 9px;
  border: 1px solid var(--lab-line);
  border-radius: 999px;
  color: var(--lab-muted);
  font-size: 0.68rem;
}

/* ---------- Slide 6: XiangShan intro ---------- */
.xs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  align-items: stretch;
}

.xs-quote {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.xs-big {
  font-size: clamp(1.25rem, 2.35vw, 1.85rem);
  line-height: 1.38;
  letter-spacing: -0.02em;
  color: var(--lab-text);
}

.xs-big strong { color: var(--lab-terra); }

.xs-quote > p:last-child {
  color: var(--lab-text-soft);
  font-size: 0.8rem;
  line-height: 1.65;
}

.xs-facts {
  display: grid;
  gap: 8px;
}

.xs-fact {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.xs-fact b {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.58rem;
  font-weight: 700;
}

.xs-fact h3 { font-size: 0.86rem; color: var(--lab-text); }
.xs-fact p { margin-top: 2px; color: var(--lab-muted); font-size: 0.68rem; line-height: 1.45; }

.xs-lineage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  color: var(--lab-muted);
}

.xs-lineage span {
  padding: 6px 10px;
  border: 1px solid var(--lab-line);
  border-radius: 7px;
  background: var(--lab-panel);
}

.xs-lineage .is-hot {
  color: var(--lab-terra);
  border-color: var(--lab-terra);
  background: var(--lab-terra-dim);
}

.xs-lineage i { color: var(--lab-dim); font-style: normal; }

/* ---------- Slide 7: Three loops ---------- */
.loop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.loop-card {
  --loop-accent: var(--lab-terra);
  position: relative;
  padding: 14px 14px 12px;
  border: 1px solid var(--lab-line);
  border-top: 3px solid var(--loop-accent);
  border-radius: 14px;
  background: var(--lab-panel);
  box-shadow: var(--lab-shadow);
  overflow: hidden;
}

.loop-card--middle { --loop-accent: var(--lab-blue); }
.loop-card--outer { --loop-accent: var(--lab-teal); }

.loop-ring {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border: 1.5px solid var(--loop-accent);
  border-radius: 50%;
  background: var(--lab-panel-soft);
  text-align: center;
  line-height: 1.05;
}

.loop-ring b {
  display: block;
  color: var(--loop-accent);
  font-family: var(--lab-mono);
  font-size: 0.92rem;
}

.loop-ring span {
  display: block;
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.5rem;
}

.loop-card h3 { font-size: 1rem; color: var(--lab-text); }
.loop-card > p { margin-top: 4px; color: var(--lab-muted); font-size: 0.72rem; line-height: 1.5; }

.loop-goal {
  margin-top: 9px;
  padding: 8px 10px;
  border-left: 2px solid var(--loop-accent);
  background: var(--lab-panel-soft);
  color: var(--lab-text-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.loop-kid {
  margin-top: 7px;
  color: var(--lab-dim);
  font-size: 0.64rem;
  line-height: 1.4;
}

/* ---------- Slide 8: Seven gates ---------- */
.gate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 16px;
  align-items: stretch;
}

.gate-list {
  display: grid;
  gap: 7px;
}

.gate-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.gate-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 26px;
  border-radius: 7px;
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.gate-row:nth-child(2) .gate-badge { background: var(--lab-amber-dim); color: var(--lab-amber); }
.gate-row:nth-child(3) .gate-badge { background: var(--lab-blue-dim); color: var(--lab-blue); }
.gate-row:nth-child(4) .gate-badge { background: var(--lab-teal-dim); color: var(--lab-teal); }
.gate-row:nth-child(5) .gate-badge { background: var(--lab-violet-dim); color: var(--lab-violet); }
.gate-row:nth-child(6) .gate-badge { background: var(--lab-rose-dim); color: var(--lab-rose); }
.gate-row:nth-child(7) .gate-badge { background: var(--lab-sage-dim); color: var(--lab-sage); }

.gate-row h3 { font-size: 0.8rem; line-height: 1.25; color: var(--lab-text); }
.gate-row p { margin-top: 1px; color: var(--lab-muted); font-size: 0.66rem; line-height: 1.4; }

.gate-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.gate-rules {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.gate-rules li {
  position: relative;
  padding-left: 12px;
  color: var(--lab-text-soft);
  font-size: 0.72rem;
  line-height: 1.5;
}

.gate-rules li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lab-amber);
}

.gate-rules b { color: var(--lab-text); }

.gate-quote {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-amber);
  font-family: var(--lab-mono);
  font-size: 0.66rem;
  line-height: 1.5;
}

/* ---------- Slide 9: Four tools ---------- */
.magic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.magic-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 14px;
}

.magic-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  font-weight: 700;
}

.magic-card:nth-child(2) .magic-num { background: var(--lab-blue-dim); color: var(--lab-blue); }
.magic-card:nth-child(3) .magic-num { background: var(--lab-teal-dim); color: var(--lab-teal); }
.magic-card:nth-child(4) .magic-num { background: var(--lab-amber-dim); color: var(--lab-amber); }

.magic-card h3 { font-size: 0.92rem; color: var(--lab-text); }
.magic-card p { margin-top: 3px; color: var(--lab-muted); font-size: 0.72rem; line-height: 1.5; }

.magic-quote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  padding: 12px 15px;
  border: 1px solid rgba(201, 79, 50, 0.22);
  border-radius: 12px;
  background: var(--lab-terra-dim);
}

.magic-quote p {
  color: var(--lab-text-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.magic-quote b { color: var(--lab-terra); }
.magic-quote span {
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  white-space: nowrap;
}

/* ---------- Slide 10: Open6502 mapping ---------- */
.map-list {
  display: grid;
  gap: 9px;
}

.map-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.map-tag {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.map-row:nth-child(2) .map-tag { color: var(--lab-blue); }
.map-row:nth-child(3) .map-tag { color: var(--lab-teal); }

.map-row h3 { font-size: 0.82rem; color: var(--lab-text); }
.map-row p { margin-top: 2px; color: var(--lab-muted); font-size: 0.68rem; line-height: 1.45; }

.xs-score {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.score-big {
  color: var(--lab-amber);
  font-family: var(--lab-mono);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
}

.score-big span { color: var(--lab-muted); font-size: 0.68rem; }

.xs-bars {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.xs-bar-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.xs-bar-row span { color: var(--lab-text-soft); font-size: 0.64rem; }

.xs-bar-row i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--lab-teal);
}

.xs-bar-row:nth-child(2) i { background: var(--lab-blue); }
.xs-bar-row:nth-child(3) i { background: var(--lab-amber); }
.xs-bar-row:nth-child(4) i { background: var(--lab-terra); }

.xs-bar-row em {
  color: var(--lab-muted);
  font-family: var(--lab-mono);
  font-size: 0.58rem;
  font-style: normal;
  text-align: right;
}

/* ---------- Slide 11: RTL ---------- */
.rtl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 16px;
  align-items: stretch;
}

.code-block {
  overflow: auto;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 12px;
  background: #f5f2ec;
  color: #4a4540;
  font-family: var(--lab-mono);
  font-size: clamp(0.64rem, 0.9vw, 0.76rem);
  line-height: 1.75;
  tab-size: 2;
}

.code-block .c-kw { color: var(--lab-terra); }
.code-block .c-fn { color: var(--lab-blue); }
.code-block .c-num { color: var(--lab-amber); }
.code-block .c-com { color: var(--lab-muted); }
.code-block .c-str { color: var(--lab-teal); }

.rtl-points {
  display: grid;
  gap: 9px;
}

.rtl-point {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px 11px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.rtl-point .k {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.rtl-point p { color: var(--lab-text-soft); font-size: 0.76rem; line-height: 1.5; }

.waveform {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.waveform svg { width: 100%; height: auto; }

/* ---------- Slide 12: Simulation ---------- */
.sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: center;
}

.sim-flow {
  display: grid;
  gap: 10px;
}

.sim-box {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--lab-line);
  border-radius: 11px;
  background: var(--lab-panel);
}

.sim-box .n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
}

.sim-box h3 { font-size: 0.86rem; color: var(--lab-text); }
.sim-box p { margin-top: 2px; color: var(--lab-muted); font-size: 0.68rem; }

.sim-arrow {
  justify-self: center;
  width: 1.5px;
  height: 14px;
  background: var(--lab-line-strong);
  position: relative;
}

.sim-arrow::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--lab-line-strong);
  border-bottom: 1.5px solid var(--lab-line-strong);
  transform: translateX(-50%) rotate(45deg);
}

.sim-side {
  display: grid;
  gap: 10px;
}

.sim-side .lab-card p { font-size: 0.78rem; }

/* ---------- Slide 13: DiffTest ---------- */
.verify-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.verify-panel {
  padding: 14px;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-panel);
}

.verify-panel h3 { font-size: 0.98rem; color: var(--lab-text); }

.verify-panel .sub {
  margin-top: 2px;
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.verify-panel p {
  margin-top: 7px;
  color: var(--lab-muted);
  font-size: 0.74rem;
  line-height: 1.55;
}

.verify-eq {
  display: grid;
  place-items: center;
  align-self: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--lab-teal);
  border-radius: 50%;
  background: var(--lab-teal-dim);
  color: var(--lab-teal);
  font-family: var(--lab-mono);
  font-size: 1.35rem;
  font-weight: 700;
}

.verify-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 11px;
}

.verify-stat {
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.verify-stat b {
  display: block;
  color: var(--lab-teal);
  font-family: var(--lab-mono);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.verify-stat span {
  display: block;
  margin-top: 2px;
  color: var(--lab-muted);
  font-size: 0.64rem;
  line-height: 1.4;
}

/* ---------- Slide 14: Backend ---------- */
.tapeout-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.tapeout-step {
  position: relative;
  padding: 14px 16px 14px 14px;
  border: 1px solid var(--lab-line);
  border-right: 0;
  background: var(--lab-panel);
}

.tapeout-step:first-child { border-radius: 14px 0 0 14px; }
.tapeout-step:last-child { border-right: 1px solid var(--lab-line); border-radius: 0 14px 14px 0; }

.tapeout-step::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  z-index: 2;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--lab-line-strong);
  border-right: 1px solid var(--lab-line-strong);
  transform: translateY(-50%) rotate(45deg);
  background: var(--lab-panel);
}

.tapeout-step:last-child::after { display: none; }

.tapeout-step .n { color: var(--lab-terra); font-family: var(--lab-mono); font-size: 0.6rem; font-weight: 700; }
.tapeout-step h3 { margin-top: 4px; font-size: 0.86rem; color: var(--lab-text); }
.tapeout-step p { margin-top: 3px; color: var(--lab-muted); font-size: 0.68rem; line-height: 1.5; }
.tapeout-step .out {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 6px;
  border: 1px solid var(--lab-line);
  border-radius: 5px;
  color: var(--lab-text-soft);
  font-family: var(--lab-mono);
  font-size: 0.56rem;
}

/* ---------- Slide 15: Fab ---------- */
.fab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 18px;
  align-items: center;
}

.fab-steps {
  display: grid;
  gap: 9px;
}

.fab-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel);
}

.fab-step .n {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.58rem;
  font-weight: 700;
}

.fab-step h3 { font-size: 0.84rem; color: var(--lab-text); }
.fab-step p { margin-top: 2px; color: var(--lab-muted); font-size: 0.68rem; line-height: 1.45; }

.fab-art {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--lab-line);
  border-radius: 14px;
  background: var(--lab-panel-soft);
}

.fab-art svg {
  width: min(100%, 360px);
  height: auto;
}

.fab-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.fab-fact {
  padding: 8px 10px;
  border: 1px solid var(--lab-line);
  border-radius: 9px;
  background: var(--lab-panel);
}

.fab-fact b {
  display: block;
  color: var(--lab-text);
  font-family: var(--lab-mono);
  font-size: 0.72rem;
}

.fab-fact span {
  display: block;
  margin-top: 1px;
  color: var(--lab-dim);
  font-size: 0.6rem;
  line-height: 1.35;
}

/* ---------- Slide 16: What can you do ---------- */
.do-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.do-card {
  padding: 12px 13px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-panel);
}

.do-card .n { color: var(--lab-terra); font-family: var(--lab-mono); font-size: 0.58rem; font-weight: 700; }
.do-card h3 { margin-top: 3px; font-size: 0.86rem; color: var(--lab-text); }
.do-card p { margin-top: 2px; color: var(--lab-muted); font-size: 0.66rem; line-height: 1.45; }

.superpowers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.superpowers span {
  padding: 5px 9px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 999px;
  color: var(--lab-text-soft);
  font-size: 0.7rem;
}

.superpowers span::before {
  content: "✦";
  margin-right: 5px;
  color: var(--lab-amber);
}

/* ---------- Slide 17: Quiz ---------- */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz-card {
  padding: 12px 13px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-panel);
}

.quiz-card .q {
  color: var(--lab-text);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.45;
}

.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.quiz-options span {
  padding: 3px 8px;
  border: 1px solid var(--lab-line);
  border-radius: 6px;
  color: var(--lab-muted);
  font-size: 0.62rem;
}

.quiz-toggle {
  margin-top: 8px;
  padding: 0;
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quiz-answer {
  margin-top: 6px;
  color: var(--lab-teal);
  font-size: 0.68rem;
  line-height: 1.45;
}

.quiz-answer[hidden] { display: none; }

/* ---------- Slide 18: Closing ---------- */
.slide--closing .slide-inner {
  justify-content: center;
  text-align: center;
  align-items: center;
}

.slide--closing .slide-kicker {
  margin-top: 0;
}

.slide--closing .slide-kicker::before {
  display: none;
}

.slide--closing h2 {
  max-width: 18em;
  margin-top: 14px;
  font-size: clamp(1.9rem, 4vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--lab-text);
}

.slide--closing .quote {
  max-width: 46em;
  margin-top: 14px;
  color: var(--lab-muted);
  font-size: clamp(0.86rem, 1.1vw, 1rem);
  line-height: 1.8;
}

.closing-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.closing-links a {
  padding: 9px 13px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 9px;
  color: var(--lab-text-soft);
  font-family: var(--lab-mono);
  font-size: 0.68rem;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.closing-links a:hover {
  color: var(--lab-text);
  border-color: var(--lab-text-soft);
  background: var(--lab-panel-soft);
}

.closing-sig {
  margin-top: 24px;
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Deck footer / notes / overview ---------- */
.deck-progress {
  height: 3px;
  background: var(--lab-line);
}

.deck-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--lab-terra), var(--lab-amber));
  transition: width 0.28s var(--lab-ease);
}

.deck-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-muted);
  font-size: 0.7rem;
  background: var(--lab-panel);
}

.deck-caption .hint {
  color: var(--lab-dim);
  font-family: var(--lab-mono);
  font-size: 0.58rem;
  white-space: nowrap;
}

.deck-notes {
  padding: 14px 16px;
  border-top: 1px solid var(--lab-line);
  background: var(--lab-panel-soft);
}

.deck-notes[hidden] { display: none; }

.deck-notes .notes-label {
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.deck-notes p {
  margin-top: 5px;
  color: var(--lab-text-soft);
  font-size: 0.78rem;
  line-height: 1.65;
}

.deck-overview {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(45, 42, 38, 0.35);
  backdrop-filter: blur(12px);
}

.deck-overview[hidden] { display: none; }

.deck-overview-panel {
  width: min(880px, 100%);
  max-height: 82vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--lab-line);
  border-radius: 18px;
  background: var(--lab-panel);
  box-shadow: var(--lab-shadow-lg);
}

.deck-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.deck-overview-head h2 { font-size: 1.1rem; color: var(--lab-text); }

.deck-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.deck-overview-grid button {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--lab-line);
  border-radius: 10px;
  background: var(--lab-panel-soft);
  color: var(--lab-text-soft);
  text-align: left;
  font-size: 0.72rem;
  line-height: 1.4;
  transition: border-color 0.16s, background 0.16s, color 0.16s, box-shadow 0.16s;
}

.deck-overview-grid button:hover {
  border-color: var(--lab-terra);
  background: var(--lab-terra-dim);
  color: var(--lab-text);
  box-shadow: 0 2px 8px rgba(201, 79, 50, 0.08);
}

.deck-overview-grid b {
  flex: none;
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.6rem;
}

/* ---------- Page sections below the deck ---------- */
.lab-section {
  padding: clamp(36px, 5vw, 64px) 0;
}

.lab-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.lab-section-head h2 {
  margin-top: 8px;
  font-size: clamp(1.55rem, 2.8vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--lab-text);
}

.lab-section-head p {
  max-width: 44em;
  color: var(--lab-muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.lab-section-head .lab-label { margin-bottom: 0; }

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.teacher-card {
  padding: 20px;
  border: 1px solid var(--lab-line);
  border-radius: 16px;
  background: var(--lab-panel);
}

.teacher-card .n { color: var(--lab-terra); font-family: var(--lab-mono); font-size: 0.66rem; font-weight: 700; }
.teacher-card h3 { margin-top: 6px; font-size: 1rem; color: var(--lab-text); }
.teacher-card p { margin-top: 5px; color: var(--lab-muted); font-size: 0.8rem; line-height: 1.65; }
.teacher-card ul { margin-top: 8px; display: grid; gap: 4px; }
.teacher-card li {
  position: relative;
  padding-left: 14px;
  color: var(--lab-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}
.teacher-card li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lab-terra);
}

.quiz-bank {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiz-bank details {
  padding: 14px 15px;
  border: 1px solid var(--lab-line);
  border-radius: 12px;
  background: var(--lab-panel);
}

.quiz-bank summary {
  cursor: pointer;
  color: var(--lab-text-soft);
  font-size: 0.82rem;
  line-height: 1.5;
  list-style: none;
}

.quiz-bank summary::-webkit-details-marker { display: none; }

.quiz-bank summary::before {
  content: "Q";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 6px;
  background: var(--lab-terra-dim);
  color: var(--lab-terra);
  font-family: var(--lab-mono);
  font-size: 0.56rem;
  font-weight: 700;
  vertical-align: 1px;
}

.quiz-bank details p {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--lab-line);
  color: var(--lab-teal);
  font-size: 0.76rem;
  line-height: 1.55;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.glossary-item {
  padding: 12px 13px;
  border: 1px solid var(--lab-line);
  border-radius: 11px;
  background: var(--lab-panel);
}

.glossary-item dt {
  color: var(--lab-text);
  font-family: var(--lab-mono);
  font-size: 0.7rem;
  font-weight: 700;
}

.glossary-item dd {
  margin-top: 3px;
  color: var(--lab-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.lab-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid rgba(201, 79, 50, 0.22);
  border-radius: 20px;
  background:
    radial-gradient(480px 280px at 100% 0%, rgba(201, 79, 50, 0.08), transparent 70%),
    var(--lab-panel);
}

.lab-cta h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  color: var(--lab-text);
}

.lab-cta p {
  margin-top: 5px;
  color: var(--lab-muted);
  font-size: 0.82rem;
}

.lab-cta .lab-actions {
  margin-top: 0;
  flex: none;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .slide.is-active .slide-kicker,
  .slide.is-active .slide-title,
  .slide.is-active .slide-lead,
  .slide.is-active .slide-body,
  .slide.is-active .slide-footnote {
    animation: lab-rise 0.46s var(--lab-ease) both;
  }

  .slide.is-active .slide-title { animation-delay: 0.04s; }
  .slide.is-active .slide-lead { animation-delay: 0.08s; }
  .slide.is-active .slide-body { animation-delay: 0.12s; }
  .slide.is-active .slide-footnote { animation-delay: 0.16s; }
}

@keyframes lab-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .lab-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .lab-hero-aside { max-width: 640px; }

  .slide--cover .slide-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .cover-art { min-height: 240px; }
  .cover-art svg { width: min(80%, 340px); }

  .where-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip-anatomy { grid-template-columns: minmax(0, 1fr); }
  .chip-anatomy-art { max-height: 240px; overflow: hidden; }
  .chip-anatomy-art svg { width: min(100%, 320px); }
  .xs-grid, .rtl-grid, .sim-grid, .fab-grid, .open-grid { grid-template-columns: minmax(0, 1fr); }
  .glossary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .deck-stage {
    aspect-ratio: auto;
    min-height: 0;
  }

  .slide {
    position: relative;
    min-height: min(78vh, 680px);
  }

  .slide:not(.is-active) { display: none; }
  .slide.is-active { display: block; }

  .step-grid, .do-grid, .where-grid, .teacher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sand-flow, .tapeout-flow { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .sand-step, .tapeout-step { border-right: 1px solid var(--lab-line); border-radius: 12px; }
  .sand-step::after, .tapeout-step::after { display: none; }
  .sand-bottom { grid-template-columns: minmax(0, 1fr); }
  .verify-panels { grid-template-columns: minmax(0, 1fr); }
  .verify-eq { justify-self: center; }
  .quiz-grid { grid-template-columns: minmax(0, 1fr); }
  .fab-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-cta { align-items: flex-start; flex-direction: column; }
  .loop-grid, .magic-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .chip-lab-page .container { width: min(100% - 30px, var(--lab-container)); }

  .deck-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .deck-tools { width: 100%; justify-content: flex-start; }
  .deck-brand { font-size: 0.58rem; }
  .deck-btn { height: 30px; font-size: 0.58rem; }
  .deck-caption { align-items: flex-start; flex-direction: column; gap: 4px; }
  .deck-caption .hint { display: none; }

  .slide-inner { padding: 20px; }
  .slide-topline { font-size: 0.56rem; }
  .slide-title { font-size: clamp(1.55rem, 8.5vw, 2.1rem); }
  .slide-lead { font-size: 0.82rem; }

  .lab-grid-3, .teacher-grid, .step-grid, .do-grid, .where-grid, .quiz-bank { grid-template-columns: minmax(0, 1fr); }
  .glossary-grid { grid-template-columns: minmax(0, 1fr); }
  .fab-facts { grid-template-columns: minmax(0, 1fr); }
  .deck-overview-grid { grid-template-columns: minmax(0, 1fr); }
  .status-row { grid-template-columns: 88px minmax(0, 1fr) 34px; }
  .chip-art .float-tag { display: none; }
  .slide--cover h1 { font-size: clamp(2.1rem, 11vw, 3rem); }
}
EOF