/* ============================================================
   Section 01 — Wie es funktioniert (4 alternating segments)
   ============================================================ */

.section-segments {
  padding: 140px 0 160px;
}
.section-segments .sec-head {
  margin-bottom: 120px;
}

.seg {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 88px;
  align-items: center;
  padding: 80px 0;
}
.seg + .seg {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}
.seg-reverse {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}
.seg-reverse .seg-viz {
  order: 2;
}
.seg-reverse .seg-copy {
  order: 1;
}

.seg-copy {
  max-width: 440px;
}
.seg-num {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--teal);
  margin-bottom: 20px;
}
.seg-num::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--teal);
  vertical-align: middle;
  margin-right: 10px;
  transform: translateY(-2px);
}
.seg-h {
  font-family: var(--display);
  font-size: clamp(34px, 3.4vw, 46px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0 0 20px;
  text-wrap: balance;
}
.seg-lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 28px;
  text-wrap: pretty;
}
.seg-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.seg-bullets li {
  position: relative;
  padding-left: 28px;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--muted);
}
/* Bullet marker — mirrors Evolution-timeline node styling.
   Inactive: pale teal halo + white-ish core (ring look).
   Active (last word of bullet is .is-on): filled teal with soft glow halo. */
.seg-bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(0, 152, 128, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 152, 128, 0.07);
  transition:
    background 0.45s var(--ease),
    border-color 0.45s var(--ease),
    box-shadow 0.45s var(--ease);
}
.seg-bullets li.is-read::before {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 152, 128, 0.16);
}
.seg-bullets b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 4px;
}

/* ============ App frame (shared chrome) ============ */
.seg-viz {
  position: relative;
  min-width: 0;
}
.app-frame,
.card-stage {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
}
.app-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 40px 80px -30px rgba(15, 20, 32, 0.18),
    0 8px 24px -12px rgba(15, 20, 32, 0.08);
  transform: translateY(0);
  transition:
    transform 0.5s var(--ease),
    box-shadow 0.5s var(--ease);
}
.seg:hover .app-frame {
  transform: translateY(-4px);
  box-shadow:
    0 50px 100px -30px rgba(15, 20, 32, 0.22),
    0 10px 30px -12px rgba(15, 20, 32, 0.1);
}
.af-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.af-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e4e6ec;
}
.af-dot:nth-child(1) {
  background: #ff5f57;
}
.af-dot:nth-child(2) {
  background: #febc2e;
}
.af-dot:nth-child(3) {
  background: #28c840;
}
.af-title {
  margin-left: 10px;
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.005em;
}
.af-status {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(0, 152, 128, 0.5);
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 152, 128, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(0, 152, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 152, 128, 0);
  }
}
.af-body {
  padding: 28px;
  min-height: 440px;
  position: relative;
}

/* ============================================================
   Seg 1 — Upload
   ============================================================ */
.upload-body {
  position: relative;
  padding: 0;
  min-height: 460px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

/* ---- Stage framework ---- */
.up-stage {
  position: absolute;
  inset: 0;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.7s cubic-bezier(0.34, 1.05, 0.5, 1);
}
.up-stage.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.up-stage.is-exit {
  opacity: 0;
  transform: translateY(-14px) scale(0.985);
  transition:
    opacity 0.45s var(--ease),
    transform 0.55s var(--ease);
}

/* ---- Stage 1: Big CTA ---- */
.up-stage-cta {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 28px;
}
.up-stage-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ush-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.ush-title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.big-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(0, 152, 128, 0.32),
    0 0 0 0 rgba(0, 152, 128, 0),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.4s var(--ease);
  animation: bc-pulse 2.6s ease-in-out infinite;
  overflow: hidden;
}
@keyframes bc-pulse {
  0%,
  100% {
    box-shadow:
      0 12px 32px rgba(0, 152, 128, 0.32),
      0 0 0 0 rgba(0, 152, 128, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow:
      0 14px 40px rgba(0, 152, 128, 0.42),
      0 0 0 14px rgba(0, 152, 128, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}
.big-cta .bc-plus {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}
.big-cta .bc-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.25),
    transparent 60%
  );
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}
.big-cta.is-press {
  transform: scale(0.94);
  animation: none;
  box-shadow:
    0 6px 18px rgba(0, 152, 128, 0.3),
    0 0 0 8px rgba(0, 152, 128, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.big-cta.is-press .bc-glow {
  animation: bc-glow-burst 0.7s ease-out;
}
@keyframes bc-glow-burst {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}
.bc-hint {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.005em;
}

/* ---- Stage 2: File picker ---- */
.up-stage-picker {
  gap: 18px;
}
.pk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}
.pk-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.pk-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s var(--ease);
}
.pk-meta.is-live {
  color: var(--teal);
  font-weight: 600;
}

.pk-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.pk-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition:
    background 0.18s var(--ease),
    transform 0.18s var(--ease);
}
.pk-row:last-child {
  border-bottom: none;
}
.pk-row.is-hover {
  background: #f8fafb;
}
.pk-row.is-picked {
  background: #f0fcfa;
  animation: pk-pop 0.35s cubic-bezier(0.34, 1.3, 0.5, 1);
}
.pk-row.is-picked + .pk-row {
  /* keep divider clean next to picked */
}
@keyframes pk-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.012);
  }
  100% {
    transform: scale(1);
  }
}
.pk-ic {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.pk-ic-pdf {
  background: #fde8e4;
  color: #c0392b;
}
.pk-ic-doc {
  background: #e4edfb;
  color: #2456a8;
}
.pk-ic-img {
  background: #e9e4f7;
  color: #5b3ca8;
}
.pk-info {
  flex: 1;
  min-width: 0;
}
.pk-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.pk-meta-s {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pk-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.18s var(--ease);
}
.pk-row.is-picked .pk-check {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  transform: scale(1.1);
}

.pk-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  opacity: 0.35;
  transform: translateY(4px);
  transition: all 0.35s var(--ease);
  pointer-events: none;
}
.pk-submit.is-ready {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  background: var(--teal);
  box-shadow: 0 10px 28px rgba(0, 152, 128, 0.3);
  animation: bc-pulse 2.6s ease-in-out infinite;
}
.pk-submit.is-press {
  transform: scale(0.97);
  animation: none;
  box-shadow: 0 4px 12px rgba(0, 152, 128, 0.25);
}
.pks-arrow {
  font-size: 16px;
}

/* ---- Stage 3: Result ---- */
.up-stage-result {
  gap: 20px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.res-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.res-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal-soft);
  display: grid;
  place-items: center;
  position: relative;
}
.res-spinner i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--teal-soft);
  border-top-color: var(--teal);
  animation: res-spin 1s linear infinite;
}
@keyframes res-spin {
  to {
    transform: rotate(360deg);
  }
}
.res-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.up-stage-result .topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 400px;
  margin: 0 auto;
  padding-top: 8px;
  border-top: none;
}

/* Chip pop */
.chip {
  padding: 7px 14px;
  background: var(--teal-soft);
  color: var(--teal-ink);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.chip-pop {
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
}
.chip-pop.is-shown {
  opacity: 1;
  transform: scale(1);
  animation: chip-bounce 0.5s var(--ease);
}
@keyframes chip-bounce {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ---- Stage 4: Roadmap for this exam ---- */
.up-stage-plan {
  gap: 16px;
  padding: 26px 28px 24px;
}
.plan-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}
.plan-kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 2px;
}
.plan-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.plan-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  margin-top: 2px;
}

.roadmap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
  overflow-y: auto;
  max-height: 360px;
}
.rm-line {
  position: absolute;
  left: 19px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal) 100%);
  opacity: 0.18;
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 0.9s var(--ease);
}
.up-stage-plan.is-drawn .rm-line {
  transform: scaleY(1);
}

.rm-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 0;
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
}
.rm-step.is-shown {
  opacity: 1;
  transform: translateX(0);
}

.rm-node {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px #fff;
  transition: all 0.3s var(--ease);
}
.rm-step.is-shown .rm-node {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.rm-node-goal {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: #fff !important;
  font-size: 14px;
}
.rm-step-goal.is-shown .rm-node-goal {
  box-shadow:
    0 0 0 4px #fff,
    0 6px 18px -4px rgba(0, 152, 128, 0.5);
}

.rm-body {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all 0.25s var(--ease);
}
.rm-step:hover .rm-body {
  border-color: #d9dde6;
  background: #fafbfc;
  transform: translateX(2px);
}
.rm-step-goal .rm-body {
  background: #f0fcfa;
  border-color: rgba(0, 152, 128, 0.25);
}
.rm-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.rm-meta {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ============================================================
   Seg 2 — Card flip (question → answer)
   ============================================================ */
.card-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 8px 0;
  perspective: 1600px;
}

/* Cinematic ambient green glow behind the card — only ignites on correct reveal */
.card-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140%;
  height: 140%;
  transform: translate(-50%, -50%) scale(0.9);
  background: radial-gradient(
    ellipse at center,
    rgba(0, 152, 128, 0.28) 0%,
    rgba(0, 152, 128, 0.1) 35%,
    transparent 65%
  );
  filter: blur(44px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition:
    opacity 0.8s var(--ease),
    transform 1.2s var(--ease);
}
/* Fires only when the card has fully flipped to the correct side */
.card-stage.is-correct::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
  animation: card-celebrate 3.2s ease-out 0.1s;
}
@keyframes card-celebrate {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.3);
  }
  60% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(1.12);
  }
  100% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.08);
  }
}
.flip-card {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1.42 / 1;
}
.flip-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.7, 0.05, 0.3, 1);
}
.flip-card.is-flipped .flip-inner {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.02),
    0 20px 40px -24px rgba(15, 23, 42, 0.18),
    0 2px 6px rgba(15, 23, 42, 0.04);
  padding: 22px 26px 28px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.flip-front {
  padding: 22px 26px 30px;
}
.flip-back {
  transform: rotateY(180deg);
  padding: 22px 26px 24px;
}

/* --- Front card --- */
.qc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.qc-topic {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
}
.qc-diff {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.qc-diff-easy {
  color: var(--teal);
}
.qc-diff-medium {
  color: #d9a400;
}
.qc-diff-hard {
  color: #d85a3e;
}

.qc-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qc-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.003em;
}
.qc-text-sub {
  color: var(--ink);
}
/* .math span is a wrapper that contains raw $...$ LaTeX for KaTeX to render */
.math {
  display: inline;
  color: inherit;
}
.math sub {
  font-style: normal;
  font-size: 0.75em;
}
/* keep KaTeX-rendered math aligned nicely with surrounding text */
.katex {
  font-size: 1em !important;
}

.qc-graph {
  margin-top: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  padding-bottom: 6px;
}
.qc-graph svg {
  width: 96%;
  max-width: 380px;
  height: auto;
}
.qc-curve {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: qc-draw 1.6s var(--ease) 0.3s forwards;
}
@keyframes qc-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Given values + formula row */
.qc-givens {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.qc-given .math,
.qc-formula .math {
  color: var(--ink);
  opacity: 0.72;
}
.qc-sep {
  color: var(--muted-2);
  margin: 0 3px;
}
.qc-formula {
  color: var(--muted-2);
  font-size: 12px;
  flex-shrink: 0;
}

/* Hint toggle */
.qc-hint-toggle {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted-2);
  cursor: pointer;
  align-self: flex-start;
  transition: color 0.2s var(--ease);
}
.qc-hint-toggle:hover {
  color: var(--muted);
}
.qc-hint-chev {
  transition: transform 0.2s var(--ease);
}
.qc-hint-toggle.is-open .qc-hint-chev {
  transform: rotate(90deg);
}

/* --- Back card --- */
.qb-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.qb-ok {
  color: var(--teal);
}
.qb-no {
  color: #d85a3e;
}
.qb-ic {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.qb-no .qb-ic {
  background: #d85a3e;
}

.qb-feedback {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 14px;
}

.qb-steps-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.qb-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qb-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
}
.qb-step.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.qb-step-num {
  flex-shrink: 0;
  width: 18px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  padding-top: 2px;
  letter-spacing: 0.04em;
  text-align: right;
}
.qb-step-body {
  flex: 1;
  min-width: 0;
}
.qb-step-title {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.qb-step-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

/* --- Answer bar --- */
/* Segment 2: standalone bar sitting below the flashcard. */
.ans-bar {
  position: relative;
  margin: 24px auto 0;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-height: 54px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.02),
    0 8px 20px -14px rgba(15, 23, 42, 0.12);
  transition:
    box-shadow 0.5s var(--ease),
    border-color 0.5s var(--ease);
}
/* Segment 3: tutor chat's ans-bar uses the same standalone styling as Segment 2. */
.ans-bar.is-ready {
  border-color: rgba(0, 152, 128, 0.35);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.02),
    0 12px 32px -12px rgba(0, 152, 128, 0.28),
    0 0 0 4px rgba(0, 152, 128, 0.08);
}
.ans-hint {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f0f3f7;
  color: #94a3b8;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ans-input {
  position: relative;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--ink);
  padding: 4px 0;
  min-height: 22px;
  display: flex;
  align-items: center;
}
.ans-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  color: #b0b8c4;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}
.ans-input.is-typing .ans-placeholder,
.ans-input.has-text .ans-placeholder,
.ans-input.is-ready .ans-placeholder,
.ans-input.is-focused .ans-placeholder,
.ans-input:has(.ans-typed:not(:empty)) .ans-placeholder {
  opacity: 0;
}
.ans-typed {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  color: var(--ink);
  white-space: pre;
  font-size: 14px;
}
.ans-caret {
  display: none;
  width: 1.5px;
  height: 16px;
  background: var(--teal);
  margin-left: 1px;
  animation: ans-blink 0.9s step-end infinite;
}
.ans-input.is-typing .ans-caret {
  display: inline-block;
}
/* On send: typed text + caret fade out before the user bubble pops in. */
.ans-input.is-sent .ans-typed,
.ans-input.is-sent .ans-caret {
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}
@keyframes ans-blink {
  50% {
    opacity: 0;
  }
}
.ans-send {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition:
    background 0.3s var(--ease),
    color 0.3s var(--ease),
    transform 0.2s var(--ease),
    box-shadow 0.4s var(--ease);
}
.ans-send svg {
  display: block;
  position: relative;
  z-index: 2;
  transition: transform 0.3s cubic-bezier(0.34, 1.3, 0.5, 1);
}
.ans-send::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at center,
    rgba(0, 152, 128, 0.5),
    rgba(0, 152, 128, 0) 70%
  );
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease);
}
.ans-send.is-ready {
  background: var(--teal);
  color: #fff;
  box-shadow:
    0 8px 24px -6px rgba(0, 152, 128, 0.55),
    0 0 0 0 rgba(0, 152, 128, 0.5);
  animation: send-pulse 1.8s ease-in-out 3;
}
.ans-send.is-ready::before {
  opacity: 1;
  transform: scale(1.8);
  animation: send-glow 2.4s ease-in-out 2;
}
.ans-send.is-ready svg {
  animation: send-float 1.6s ease-in-out 3;
}
@keyframes send-pulse {
  0%,
  100% {
    box-shadow:
      0 8px 24px -6px rgba(0, 152, 128, 0.55),
      0 0 0 0 rgba(0, 152, 128, 0.45);
  }
  50% {
    box-shadow:
      0 10px 28px -4px rgba(0, 152, 128, 0.7),
      0 0 0 10px rgba(0, 152, 128, 0);
  }
}
@keyframes send-glow {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1.6);
  }
  50% {
    opacity: 0.8;
    transform: scale(2.2);
  }
}
@keyframes send-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1.5px);
  }
}
.ans-send.is-press {
  transform: scale(0.88);
  animation: none;
}
.ans-send.is-press svg {
  transform: translateY(-3px) scale(0.9);
}
.ans-send.is-launch svg {
  animation: send-launch 0.7s cubic-bezier(0.5, 0.05, 0.3, 1) forwards;
}
@keyframes send-launch {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  40% {
    transform: translateY(-6px) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translateY(-30px) scale(0.6);
    opacity: 0;
  }
}

/* Cursor inside card stage */
.card-stage {
  position: relative;
}
.card-stage .sim-cursor {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(var(--cx, -200px), var(--cy, -200px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
  transition:
    transform 0.75s cubic-bezier(0.5, 0.05, 0.3, 1),
    opacity 0.25s var(--ease);
}
.card-stage .sim-cursor.quick {
  transition:
    transform 0.45s cubic-bezier(0.5, 0.05, 0.3, 1),
    opacity 0.25s var(--ease);
}
.card-stage .sim-cursor.no-anim {
  transition: none;
}
.card-stage .sim-cursor.is-show {
  opacity: 1;
  visibility: visible;
}
.card-stage .sim-cursor.is-press .sc-ring {
  transform: scale(1);
  opacity: 0.35;
}

/* ============================================================
   Seg 3 — Tutor nachfragen auf der Karte
   ============================================================ */
.tutor-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 8px 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
}
.tcard {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.02),
    0 20px 40px -24px rgba(15, 23, 42, 0.18),
    0 2px 6px rgba(15, 23, 42, 0.04);
  padding: 0;
  overflow: hidden;
  transition: box-shadow 0.5s var(--ease);
  /* Same size as Seg-02 .flip-card. Fixed via aspect-ratio so the card
     matches the question-card proportions exactly and never resizes. */
  width: 100%;
  aspect-ratio: 1.42 / 1;
  display: flex;
  flex-direction: column;
}
.tcard-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 28px 14px;
  flex: 1 1 auto;
  min-height: 0;
  /* Pure animation surface — no user scrolling. Content is positioned by JS via
     opacity/transform, not scrollTop. Page scroll must pass through. */
  overflow: hidden;
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 14px,
    #000 calc(100% - 14px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 14px,
    #000 calc(100% - 14px),
    transparent 100%
  );
}

.tc-verdict {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tc-verdict-h {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #3a5cc4;
}
.tc-feedback {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}
.tc-steps-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 6px;
}
.tc-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tc-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.tc-step-num {
  flex-shrink: 0;
  width: 16px;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  padding-top: 2px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tc-step-body {
  flex: 1;
  min-width: 0;
}
.tc-step-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.003em;
  margin-bottom: 4px;
}
.tc-step-math {
  font-size: 13.5px;
  color: var(--ink);
}

/* Chat stack + bubbles */
.tc-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Chat sits BELOW verdict/steps by default (so "Fast richtig" stays at the top
     of the card). In answer-mode, verdict+steps fade out and the tutor reply
     expands — the chat then dominates the card. */
  margin-top: auto;
}
/* Hide empty chat container's gap/space until a bubble has actually appeared. */
.tc-chat:not(:has(.tc-bubble.is-shown, .tc-tutor-inline.is-shown)) {
  display: none;
}
.tc-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.35s var(--ease),
    transform 0.4s var(--ease);
}
.tc-bubble.is-shown {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tc-bubble-user {
  align-self: flex-end;
  background: #0f172a;
  color: #fff;
  border-bottom-right-radius: 4px;
  font-style: normal;
}
.tc-bubble-user .tc-bubble-text {
  color: #fff;
  font-size: 13.5px;
}

/* ---- Tutor reply — INLINE layout (no bubble wrap) ---- */
.tc-tutor-inline {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.35s var(--ease),
    transform 0.4s var(--ease);
}
.tc-tutor-inline.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.tc-tutor-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-tutor-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
}
.tc-tutor-name {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}
.tc-tutor-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}
.tc-tutor-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #94a3b8;
  animation: tc-dot 1.1s ease-in-out infinite;
}
.tc-tutor-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.tc-tutor-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes tc-dot {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
.tc-tutor-inline.is-done .tc-tutor-dots {
  display: none;
}
.tc-tutor-text {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-tutor-text span[data-tc-ans-line] {
  display: block;
}

/* --- Fixed-ish chat input at bottom of card --- */
.tc-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
  position: relative;
}
.tc-input::before {
  /* attention glow — pulses to draw the eye */
  content: "";
  position: absolute;
  inset: 6px 8px;
  border-radius: 12px;
  box-shadow: 0 0 0 0 rgba(0, 152, 128, 0);
  pointer-events: none;
  transition: box-shadow 0.4s var(--ease);
}
.tc-input.is-attn::before {
  animation: tc-attn 1.6s ease-in-out 2;
}
@keyframes tc-attn {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 152, 128, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 152, 128, 0.18);
  }
}
.tc-input-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--teal);
  flex-shrink: 0;
}
.tc-input-field {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 22px;
  font-size: 13.5px;
  color: var(--ink);
}
.tc-input-placeholder {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.tc-input.is-focused .tc-input-placeholder,
.tc-input.is-typing .tc-input-placeholder,
.tc-input.is-sent .tc-input-placeholder {
  opacity: 0;
}

.tc-input-typed {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  color: var(--ink);
}
.tc-input-caret {
  display: none;
  width: 1.5px;
  height: 15px;
  background: var(--teal);
  margin-left: 1px;
  animation: ans-blink 0.9s step-end infinite;
}
.tc-input.is-focused .tc-input-caret,
.tc-input.is-typing .tc-input-caret {
  display: inline-block;
}

.tc-input-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  border: none;
  cursor: pointer;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.15s var(--ease);
  flex-shrink: 0;
}
.tc-input.is-typing .tc-input-send,
.tc-input.is-ready .tc-input-send {
  background: var(--teal);
  color: #fff;
}
.tc-input.is-ready .tc-input-send {
  animation: tc-send-pulse 1.1s ease-in-out infinite;
}
@keyframes tc-send-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 152, 128, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(0, 152, 128, 0);
  }
}
.tc-input.is-sent .tc-input-send {
  transform: translateY(-4px) scale(0.92);
  opacity: 0.5;
}

/* Cursor on tutor stage */
.tutor-stage .sim-cursor {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(var(--cx, -200px), var(--cy, -200px));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
  transition:
    transform 0.75s cubic-bezier(0.5, 0.05, 0.3, 1),
    opacity 0.25s var(--ease);
}
.tutor-stage .sim-cursor.quick {
  transition:
    transform 0.45s cubic-bezier(0.5, 0.05, 0.3, 1),
    opacity 0.25s var(--ease);
}
.tutor-stage .sim-cursor.no-anim {
  transition: none;
}
.tutor-stage .sim-cursor.is-show {
  opacity: 1;
  visibility: visible;
}
.tutor-stage .sim-cursor.is-press .sc-ring {
  transform: scale(1);
  opacity: 0.35;
}

/* ============================================================
   Seg 4 — 3D
   ============================================================ */
.three-body {
  padding: 0;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center, #f9fcfc 0%, #eef3f7 100%);
}
.three-stage {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 1000px;
}
.three-orbit {
  position: absolute;
  width: 260px;
  height: 260px;
  border: 1px dashed rgba(0, 152, 128, 0.22);
  border-radius: 50%;
  animation: tc-spin 22s infinite linear;
  transform-style: preserve-3d;
  transform: rotateX(70deg);
}
.three-orbit-2 {
  width: 340px;
  height: 340px;
  border-style: solid;
  border-color: rgba(0, 152, 128, 0.1);
  animation-duration: 35s;
  animation-direction: reverse;
}
@keyframes tc-spin {
  to {
    transform: rotateX(70deg) rotate(360deg);
  }
}

.three-cube {
  position: relative;
  width: 110px;
  height: 110px;
  transform-style: preserve-3d;
  animation: cube-rot 14s infinite linear;
}
@keyframes cube-rot {
  0% {
    transform: rotateX(-15deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(-15deg) rotateY(360deg);
  }
}
.tc-face {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 152, 128, 0.82),
    rgba(0, 152, 128, 0.55)
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 30px rgba(0, 60, 50, 0.2);
}
.tc-f1 {
  transform: translateZ(55px);
}
.tc-f2 {
  transform: rotateY(180deg) translateZ(55px);
}
.tc-f3 {
  transform: rotateY(90deg) translateZ(55px);
}
.tc-f4 {
  transform: rotateY(-90deg) translateZ(55px);
}
.tc-f5 {
  transform: rotateX(90deg) translateZ(55px);
}
.tc-f6 {
  transform: rotateX(-90deg) translateZ(55px);
}

.three-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 90px;
  background: linear-gradient(180deg, rgba(15, 20, 32, 0) 0%, var(--ink) 100%);
  transform: translate(-50%, 50px);
  pointer-events: none;
}
.three-arrow::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid var(--ink);
}

.three-lbl {
  position: absolute;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  animation: lbl-float 3s infinite var(--ease);
}
.three-lbl-1 {
  top: 32%;
  left: 18%;
  animation-delay: 0.2s;
}
.three-lbl-2 {
  top: 42%;
  right: 14%;
  animation-delay: 0.7s;
}
.three-lbl-3 {
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
@keyframes lbl-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
.three-lbl-result {
  animation-name: lbl-float-c;
}
@keyframes lbl-float-c {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -4px);
  }
}

.three-controls {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.tc-btn {
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.tc-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
  .section-segments {
    padding: 64px 0 80px;
  }
  .section-segments .sec-head {
    margin-bottom: 48px;
  }
  /* Tighter vertical rhythm on phones: goal is to see the END of one segment's
     copy AND the START of the next segment's animation on one screen. Was
     ~136px of dead space between sections, now ~56px. */
  .seg {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 36px 0;
  }
  .seg + .seg {
    margin-top: 0;
  }
  .seg-reverse {
    grid-template-columns: 1fr;
  }
  /* Mobile order: seg-num → animation → heading/lede/bullets.
     The num sits on top so the user sees "02" before the new animation starts,
     signalling a new section. We dissolve seg-copy via display:contents so
     seg-num, seg-h, seg-lede, seg-bullets become direct grid items of .seg
     and can be ordered independently of seg-viz. */
  .seg-copy,
  .seg-reverse .seg-copy {
    display: contents;
    max-width: 100%;
  }
  .seg-num {
    order: -2;
    margin-bottom: 10px;
  }
  .seg-h {
    order: -1;
    margin-bottom: 20px;
  }
  .seg-viz,
  .seg-reverse .seg-viz {
    order: 0;
    margin-bottom: 24px;
  }
  /* Mobile: nur Titel. Lede + Bullets ausblenden, damit Animation atmet. */
  .seg-lede,
  .seg-bullets {
    display: none;
  }
  .af-body {
    min-height: 380px;
    padding: 20px;
  }
  .chat-body {
    min-height: 380px;
  }
  .three-body {
    min-height: 400px;
  }
}

/* ---- Phone: cards size to the tallest animation state (measured by JS) ----
   Desktop aspect 1.42:1 is too squat for ~400px-wide viewports AND content
   differs per state. We drop aspect-ratio on mobile; card-sizer.js measures
   the max content height across all animation states and pins card height to
   it — so the card never resizes mid-animation. */
@media (max-width: 640px) {
  .card-stage {
    padding: 12px 2px 0;
  }
  .flip-card {
    aspect-ratio: auto;
    min-height: 460px; /* fallback before card-sizer.js measures */
  }
  .flip-face {
    padding: 18px 18px 22px;
  }
  .flip-front {
    padding: 18px 18px 22px;
  }
  .flip-back {
    padding: 18px 18px 20px;
  }
  .qc-text {
    font-size: 13px;
    line-height: 1.5;
  }
  .qc-graph {
    margin-top: 6px;
    padding-bottom: 2px;
  }
  .qc-graph svg {
    max-width: 320px;
  }

  .tutor-stage {
    padding: 12px 2px 0;
  }
  .tcard {
    aspect-ratio: auto;
    min-height: 460px; /* fallback before card-sizer.js measures */
  }
  .tcard-inner {
    padding: 18px 20px 12px;
    gap: 10px;
  }
  .tc-feedback {
    font-size: 13px;
    line-height: 1.5;
  }
  .tc-step-math {
    font-size: 13px;
  }
}

/* ============================================================
   Simulated cursor (Upload demo) — cinematic
   ============================================================ */
.app-frame {
  position: relative;
}

.sim-cursor {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  transform: translate(var(--cx, 0px), var(--cy, 0px));
  transition: transform 0.75s cubic-bezier(0.5, 0.05, 0.15, 1);
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  will-change: transform;
}
.sim-cursor.is-show {
  opacity: 1;
}
.sim-cursor.no-anim {
  transition: none;
}
.sim-cursor.quick {
  transition: transform 0.45s cubic-bezier(0.5, 0.05, 0.15, 1);
}

.sim-cursor .sc-arrow {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.35))
    drop-shadow(0 0 1px rgba(0, 0, 0, 0.4));
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
  transform-origin: 4px 2px;
}
.sim-cursor.is-press .sc-arrow {
  transform: scale(0.82);
}

.sc-ring {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 152, 128, 0.25);
  border: 2px solid rgba(0, 152, 128, 0.6);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}
.sim-cursor.is-press .sc-ring {
  animation: sc-ring 0.7s ease-out;
}
@keyframes sc-ring {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(5);
    opacity: 0;
  }
}

/* Sparks burst */
.sparks {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 25;
  width: 0;
  height: 0;
}
.sparks.is-burst i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(0, 152, 128, 0.6);
  animation: spark-fly 0.8s ease-out forwards;
}
.sparks.is-burst i:nth-child(1) {
  --ang: -50deg;
  --dist: 60px;
}
.sparks.is-burst i:nth-child(2) {
  --ang: -20deg;
  --dist: 70px;
}
.sparks.is-burst i:nth-child(3) {
  --ang: 15deg;
  --dist: 58px;
}
.sparks.is-burst i:nth-child(4) {
  --ang: 60deg;
  --dist: 65px;
}
.sparks.is-burst i:nth-child(5) {
  --ang: -100deg;
  --dist: 50px;
}
.sparks.is-burst i:nth-child(6) {
  --ang: 130deg;
  --dist: 55px;
}
@keyframes spark-fly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(
        calc(cos(var(--ang)) * var(--dist)),
        calc(sin(var(--ang)) * var(--dist))
      )
      scale(0.3);
  }
}

/* ============================================================
   Segment 04 — 3D Pyramid (three.js)
   ============================================================ */

.pyramid-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3.2;
  border-radius: 18px;
  background-color: #f8fafb;
  /* Grid that fades out toward edges via radial-gradient mask on a ::before layer */
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow:
    0 30px 60px -30px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.pyramid-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    /* grid — minor lines */
    linear-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.055) 1px, transparent 1px),
    /* grid — major lines (every 5) */
    linear-gradient(rgba(15, 23, 42, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.11) 1px, transparent 1px);
  background-size:
    28px 28px,
    28px 28px,
    140px 140px,
    140px 140px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(
    65% 60% at 50% 50%,
    #000 40%,
    transparent 92%
  );
  mask-image: radial-gradient(65% 60% at 50% 50%, #000 40%, transparent 92%);
  pointer-events: none;
  z-index: 0;
}
.pyramid-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    55% 45% at 50% 95%,
    rgba(0, 152, 128, 0.08),
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}
.pyr-canvas,
.pyr-labels {
  z-index: 1;
}

.pyr-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: grab;
}
.pyr-canvas:active {
  cursor: grabbing;
}

/* CSS2D label layer — sits above the canvas, children are positioned absolutely
   by CSS2DRenderer */
.pyr-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Per-convention label: no background, text-shadow for legibility */
.pyr-lbl {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.8),
    0 0 4px rgba(255, 255, 255, 0.6);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.pyr-lbl-amber {
  color: #b45309;
}
.pyr-lbl-blue {
  color: #0369a1;
}
.pyr-lbl-pink {
  color: #be185d;
}
.pyr-lbl-purple {
  color: #6d28d9;
}
.pyr-lbl-apex {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
}

/* "Zum Drehen ziehen" hint */
.pyr-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 9px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 6px 14px -8px rgba(15, 23, 42, 0.15);
  z-index: 6;
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
}
.pyr-hint.is-hidden {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

/* Result pill */
.pyr-result {
  position: absolute;
  left: 22px;
  bottom: 72px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 30px -10px rgba(15, 23, 42, 0.15);
  min-width: 220px;
  z-index: 5;
}
.pyr-result-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.pyr-result-label {
  font-family: var(--display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--teal);
}
.pyr-result-eq {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.pyr-result-eq i {
  font-style: normal;
  color: var(--teal);
}
.pyr-result-sub {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #64748b;
  letter-spacing: -0.01em;
}
.pyr-result-sub b {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}
.pyr-k {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
}
.pyr-k-a {
  background: rgba(0, 152, 128, 0.14);
  color: #006052;
}
.pyr-k-h {
  background: rgba(239, 68, 68, 0.14);
  color: #991b1b;
}

@media (max-width: 720px) {
  .pyr-result {
    left: 14px;
    bottom: 14px;
    padding: 10px 12px;
    min-width: 180px;
  }
  .pyr-result-eq {
    font-size: 12px;
  }
  .pyr-result-sub {
    font-size: 11px;
  }
  .pyr-hint {
    top: 12px;
    right: 12px;
    font-size: 10px;
    padding: 5px 9px;
  }
  .pyr-lbl {
    font-size: 12px;
  }
}

/* ---- Fade-out-up for verdict + steps when tutor answer is expanding ---- */
.tcard-inner .tc-verdict,
.tcard-inner .tc-feedback,
.tcard-inner .tc-steps-label,
.tcard-inner .tc-steps {
  opacity: 1;
  transform: translateY(0);
  max-height: 999px;
  transition:
    opacity 0.5s var(--ease),
    transform 0.55s var(--ease),
    max-height 0.55s var(--ease),
    margin 0.5s var(--ease);
  transform-origin: top center;
}
.tcard-inner.is-answer-mode .tc-verdict,
.tcard-inner.is-answer-mode .tc-feedback,
.tcard-inner.is-answer-mode .tc-steps-label,
.tcard-inner.is-answer-mode .tc-steps {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin: 0 !important;
  overflow: hidden;
  pointer-events: none;
}
/* In answer-mode the other blocks collapse to 0, so the chat must no longer
   be pushed to the bottom by margin-top:auto — anchor it back to the top.
   Also zero the parent flex gap (applies between every sibling even when
   collapsed, which would otherwise leave ~56px of phantom space). */
.tcard-inner.is-answer-mode {
  gap: 0;
  padding-top: 14px;
  padding-bottom: 10px;
  transition:
    gap 0.5s var(--ease),
    padding-top 0.5s var(--ease),
    padding-bottom 0.5s var(--ease);
}
.tcard-inner.is-answer-mode .tc-chat {
  margin-top: 0;
}

/* ---- Tutor sketch (parallel circuit) — inline, no background container ---- */
.tc-sketch {
  background: transparent;
  border: none;
  padding: 0;
  margin: 2px 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 0.55s var(--ease),
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    margin 0.4s var(--ease);
}
.tc-tutor-inline.is-done .tc-sketch {
  max-height: 175px;
  opacity: 1;
  transform: translateY(0);
}
.tc-sketch svg {
  width: 100%;
  height: auto;
  display: block;
  max-height: 170px;
}

/* --- wire draw-in (stroke-dash animation) --- */
.tcs-wire-top,
.tcs-wire-right,
.tcs-wire-bot {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}
.tc-tutor-inline.is-done .tcs-wire-top {
  animation: tcs-draw 0.7s ease-out 0.25s forwards;
}
.tc-tutor-inline.is-done .tcs-wire-right {
  animation: tcs-draw 0.6s ease-out 0.95s forwards;
}
.tc-tutor-inline.is-done .tcs-wire-bot {
  animation: tcs-draw 0.7s ease-out 1.55s forwards;
}
@keyframes tcs-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* --- static parts: staggered fade-in --- */
.tcs-title,
.tcs-battery,
.tcs-r1,
.tcs-r2,
.tcs-nodes,
.tcs-nodes2,
.tcs-formula,
.tcs-result {
  opacity: 0;
  transform: translateY(3px);
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease);
}
.tc-tutor-inline.is-done .tcs-title {
  opacity: 1;
  transform: none;
  transition-delay: 0.05s;
}
.tc-tutor-inline.is-done .tcs-battery {
  opacity: 1;
  transform: none;
  transition-delay: 0.15s;
}
.tc-tutor-inline.is-done .tcs-r1 {
  opacity: 1;
  transform: none;
  transition-delay: 1.1s;
}
.tc-tutor-inline.is-done .tcs-r2 {
  opacity: 1;
  transform: none;
  transition-delay: 1.4s;
}
.tc-tutor-inline.is-done .tcs-nodes {
  opacity: 1;
  transform: none;
  transition-delay: 2.15s;
}
.tc-tutor-inline.is-done .tcs-nodes2 {
  opacity: 1;
  transform: none;
  transition-delay: 2.15s;
}
.tc-tutor-inline.is-done .tcs-formula {
  opacity: 1;
  transform: none;
  transition-delay: 3.5s;
}
.tc-tutor-inline.is-done .tcs-result {
  opacity: 1;
  transform: none;
  transition-delay: 3.8s;
}

/* --- Electrons (current flow) — move along the circuit path --- */
.tcs-e {
  opacity: 0;
  filter: drop-shadow(0 0 3px rgba(0, 152, 128, 0.55));
}
.tc-tutor-inline.is-done .tcs-e1 {
  animation: tcs-flow1 2.4s linear 2.3s infinite;
}
.tc-tutor-inline.is-done .tcs-e2 {
  animation: tcs-flow2 2.4s linear 2.6s infinite;
}
.tc-tutor-inline.is-done .tcs-e3 {
  animation: tcs-flow1 2.4s linear 2.9s infinite;
}

/* electron takes the R1 (upper-left) branch — follows the wire path exactly.
   Geometry: +terminal(50,62) → up to (50,40) → right along top rail → down
   through R1 at x=130 → left along bottom rail → up to -terminal(50,72). */
@keyframes tcs-flow1 {
  0% {
    transform: translate(50px, 62px);
    opacity: 0;
  }
  4% {
    opacity: 1;
  }
  /* up the battery lead */
  8% {
    transform: translate(50px, 40px);
    opacity: 1;
  }
  /* right along top rail to R1 node */
  22% {
    transform: translate(130px, 40px);
    opacity: 1;
  }
  /* down through R1 to bottom node */
  46% {
    transform: translate(130px, 160px);
    opacity: 1;
  }
  /* left along bottom rail back to battery */
  72% {
    transform: translate(50px, 160px);
    opacity: 1;
  }
  /* up the return lead to -terminal */
  96% {
    transform: translate(50px, 72px);
    opacity: 1;
  }
  100% {
    transform: translate(50px, 72px);
    opacity: 0;
  }
}
/* electron takes the R2 (right) branch — same loop but branches at x=200. */
@keyframes tcs-flow2 {
  0% {
    transform: translate(50px, 62px);
    opacity: 0;
  }
  4% {
    opacity: 1;
  }
  /* up the battery lead */
  6% {
    transform: translate(50px, 40px);
    opacity: 1;
  }
  /* right along top rail past R1 node all the way to R2 node */
  26% {
    transform: translate(200px, 40px);
    opacity: 1;
  }
  /* down through R2 to bottom */
  50% {
    transform: translate(200px, 160px);
    opacity: 1;
  }
  /* left along bottom rail back to battery */
  80% {
    transform: translate(50px, 160px);
    opacity: 1;
  }
  /* up the return lead to -terminal */
  96% {
    transform: translate(50px, 72px);
    opacity: 1;
  }
  100% {
    transform: translate(50px, 72px);
    opacity: 0;
  }
}

/* Answer text reveal */
.tc-tutor-text span[data-tc-ans-line] {
  display: block;
  opacity: 0;
  transform: translateY(3px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
  margin: 0;
}
.tc-tutor-inline.is-done .tc-tutor-text span[data-tc-ans-line="1"] {
  opacity: 1;
  transform: none;
  transition-delay: 2.5s;
}
.tc-tutor-inline.is-done .tc-tutor-text span[data-tc-ans-line="2"] {
  opacity: 1;
  transform: none;
  transition-delay: 3.3s;
}
.tc-tutor-inline.is-done .tc-tutor-text span[data-tc-ans-line="3"] {
  opacity: 1;
  transform: none;
  transition-delay: 4s;
}
