:root {
  --bg: #0a0a0b;
  --bg-2: #121214;
  --ink: #f4f4f5;
  --mute: #8a8a90;
  --mute-2: #8a8a90;
  --line: rgba(244, 244, 245, 0.12);
  --purple: #6b5ce0;
  --purple-soft: #a89bff;
  --purple-dim: rgba(107, 92, 224, 0.14);
  --purple-glow: rgba(107, 92, 224, 0.22);
  --card: #161618;
  --radius: 20px;
  --font: "Instrument Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pad: clamp(1rem, 4vw, 2rem);
  --mx: 0.5;
  --my: 0.45;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .horizon, .grid-floor, .sun, .cursor-glow, .ab::before, .stars-canvas { animation: none !important; }
  .cursor-glow { display: none !important; }
  .grid-floor { background-position: 0 0 !important; }
  body.reduce-motion .stars-canvas { display: none !important; }
}

a { color: var(--purple-soft); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; height: auto; }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--purple); color: #fff; padding: 0.7rem 1rem;
}
.skip:focus { left: var(--pad); top: var(--pad); }

/* Stage */
.stage {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: var(--bg);
}
.horizon {
  position: absolute; left: -25%; right: -25%; top: 40%; height: 42%;
  background:
    radial-gradient(ellipse 70% 55% at calc(50% + (var(--mx) - 0.5) * 40px) 0%,
      rgba(107, 92, 224, 0.16), transparent 72%),
    linear-gradient(180deg, transparent 0%, rgba(107, 92, 224, 0.05) 45%, rgba(10, 10, 11, 0.96) 100%);
  transition: background-position 0.4s var(--ease);
  animation: horizon-breathe 12s ease-in-out infinite;
}
@keyframes horizon-breathe {
  0%, 100% { opacity: 0.82; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.08); }
}
.sun {
  position: absolute;
  left: calc(50% + (var(--mx) - 0.5) * 28px);
  top: calc(36% + (var(--my) - 0.5) * 18px);
  width: min(210px, 40vw); height: min(105px, 20vw);
  transform: translate(-50%, -42%);
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, rgba(168, 155, 255, 0.26), rgba(107, 92, 224, 0.07) 75%, transparent);
  opacity: 0.42;
  mask-image: repeating-linear-gradient(to bottom, #000 0 2px, transparent 2px 6px);
  transition: left 0.5s var(--ease), top 0.5s var(--ease);
  animation: sun-breathe 10s ease-in-out infinite;
}
@keyframes sun-breathe {
  0%, 100% { opacity: 0.34; transform: translate(-50%, -42%) scale(1); }
  50% { opacity: 0.5; transform: translate(-50%, -44%) scale(1.04); }
}
.grid-floor {
  position: absolute; left: -12%; right: -12%; bottom: -6%; height: 46%;
  background-image:
    linear-gradient(rgba(107, 92, 224, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 92, 224, 0.11) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: 0 0;
  transform: perspective(560px) rotateX(64deg) translateX(calc((var(--mx) - 0.5) * -18px));
  transform-origin: center top;
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 68%, transparent);
  opacity: 0.34;
  transition: transform 0.45s var(--ease);
  animation: grid-scroll 28s linear infinite;
  will-change: background-position;
}
@keyframes grid-scroll {
  from { background-position: 0 0; }
  to { background-position: 0 56px; }
}
.stars-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.55; pointer-events: none;
}
body.stage-paused .grid-floor,
body.stage-paused .horizon,
body.stage-paused .sun {
  animation-play-state: paused !important;
}
.scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, transparent 0 4px, rgba(255, 255, 255, 0.012) 4px 5px
  );
  opacity: 0.32;
}
.vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.58) 100%);
}

@media (max-width: 720px) {
  .grid-floor { animation-duration: 40s; opacity: 0.28; }
  .horizon { animation-duration: 16s; }
  .sun { animation-duration: 14s; }
  .stars-canvas { opacity: 0.4; }
}

.cursor-glow {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(107, 92, 224, 0.12), transparent 68%);
  transform: translate(-50%, -50%);
  left: 50%; top: 40%;
  opacity: 0.7; transition: left 0.35s var(--ease), top 0.35s var(--ease);
  will-change: left, top;
}

.app {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; flex-direction: column;
}

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 18px var(--pad) 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.65rem;
  text-decoration: none; color: var(--ink); font-weight: 600;
  letter-spacing: -0.02em;
}
.brand img {
  width: 34px; height: 34px; border-radius: 8px;
}
.brand span { font-size: 0.95rem; }
.brand small {
  font-weight: 500; font-size: 0.68rem; color: var(--mute);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.progress {
  display: flex; align-items: center; gap: 1rem;
  font-size: 0.75rem; color: var(--mute); letter-spacing: 0.04em;
}
.progress-track {
  width: min(140px, 26vw); height: 3px; border-radius: 99px;
  background: rgba(244, 244, 245, 0.1); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--purple), var(--purple-soft));
  border-radius: inherit; transition: width 0.55s var(--ease);
}

.lesson {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 2.75rem) var(--pad) 2rem;
}
.panel {
  width: min(780px, 100%);
  display: none;
  animation: rise 0.48s var(--ease-out, var(--ease)) both;
}
.panel.active { display: block; }
.panel[data-step="0"] { width: min(860px, 100%); }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--purple-soft); font-weight: 600; margin-bottom: 1rem;
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 14px var(--purple-glow);
}
h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
h1 { font-size: clamp(2.45rem, 8.2vw, 4.6rem); margin-bottom: 1rem; }
h1 em, h2 em { font-style: italic; color: var(--purple-soft); }
h2 { font-size: clamp(1.75rem, 5vw, 2.7rem); margin-bottom: 0.75rem; }
h1:focus, h2:focus { outline: none; }
.lede {
  color: var(--mute); font-size: clamp(1rem, 2.3vw, 1.15rem);
  max-width: 36rem; margin-bottom: 1.6rem;
}

.ab {
  position: relative; border-radius: var(--radius); padding: 1.5px;
  background: var(--card);
}
.ab::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--a, 0deg),
    transparent 0 58%,
    var(--purple) 64%,
    var(--purple-soft) 70%,
    transparent 76%,
    transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.42; animation: spin 14s linear infinite;
}
@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --a: 360deg; } }
.ab-inner {
  position: relative; border-radius: calc(var(--radius) - 1px);
  background: linear-gradient(165deg, #1a1a1d, #121214);
  padding: clamp(1.15rem, 3vw, 1.65rem);
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 0.35rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.8rem 1.4rem; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: transform 0.22s var(--ease), background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.25s;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 3px; }
.btn:disabled, .btn[disabled] { opacity: 0.35; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary {
  background: var(--ink); color: var(--bg);
  box-shadow: 0 0 0 0 rgba(244, 244, 245, 0);
}
.btn-primary:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 8px 28px rgba(107, 92, 224, 0.22);
}
.btn-ghost {
  border: 1px solid var(--line); color: var(--ink); background: transparent;
}
.btn-ghost:hover { border-color: var(--purple); color: var(--purple-soft); }

/* Intro layout with portrait */
.intro-grid {
  display: grid; gap: 1.25rem; align-items: center;
  grid-template-columns: 1fr;
}
.intro-grid .portrait { order: -1; }
@media (min-width: 501px) {
  .intro-grid {
    grid-template-columns: 1.25fr 0.75fr; gap: 2.25rem;
  }
  .intro-grid .portrait { order: 0; }
}
.portrait {
  position: relative; justify-self: center; width: min(168px, 42vw);
}
@media (min-width: 501px) {
  .portrait { width: min(280px, 70vw); }
}
.portrait .frame {
  position: relative; border-radius: 22px; overflow: hidden;
  aspect-ratio: 751 / 770; background: #121214;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(107, 92, 224, 0.35),
    0 0 28px rgba(107, 92, 224, 0.18);
}
/* Soft feather behind / around hair edge */
.portrait .frame::before {
  content: ""; position: absolute; inset: -6% -4% -2%;
  background:
    radial-gradient(ellipse 70% 55% at 50% 28%, rgba(18, 18, 20, 0.0) 40%, rgba(10, 10, 11, 0.55) 100%),
    radial-gradient(ellipse 90% 70% at 50% 8%, rgba(107, 92, 224, 0.12), transparent 70%);
  z-index: 0; pointer-events: none;
}
.portrait .frame img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; object-position: center top;
  filter: none;
}
.portrait .frame::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(180deg, transparent 62%, rgba(10, 10, 11, 0.35) 100%);
  pointer-events: none;
}
.portrait .ring {
  position: absolute; inset: -10px; border-radius: 30px;
  border: 1px solid rgba(107, 92, 224, 0.28);
  pointer-events: none;
  animation: breathe 5.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.015); }
}

.choices { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .choices.two { grid-template-columns: 1fr 1fr; } }
.choice {
  text-align: left; width: 100%;
  border-radius: 16px; padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease), box-shadow 0.25s;
}
.choice:hover, .choice:focus-visible {
  border-color: rgba(107, 92, 224, 0.55); background: var(--purple-dim);
  outline: none; transform: translateY(-1px);
}
.choice[aria-pressed="true"] {
  border-color: var(--purple); background: var(--purple-dim);
  box-shadow: 0 0 0 1px var(--purple), 0 12px 36px rgba(107, 92, 224, 0.12);
}
.choice .k {
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--mute); margin-bottom: 0.35rem; font-weight: 600;
}
.choice .t { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.25rem; }
.choice .d { color: var(--mute); font-size: 0.9rem; }

.feedback {
  margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 14px;
  border: 1px solid rgba(107, 92, 224, 0.35); background: var(--purple-dim);
  color: var(--ink); display: none;
}
.feedback.show { display: block; animation: fb-in 0.4s var(--ease-out, var(--ease)); }
@keyframes fb-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.feedback strong { color: var(--purple-soft); font-weight: 600; }

.fuse { display: grid; gap: 1rem; margin-top: 0.35rem; }
.pieces {
  display: flex; flex-wrap: wrap; gap: 0.65rem; min-height: 52px; align-items: center;
}
.piece {
  min-height: 48px; padding: 0.7rem 1.1rem; border-radius: 14px;
  border: 1px dashed rgba(244, 244, 245, 0.25);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600; user-select: none; touch-action: none;
  cursor: grab; transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}
.piece:active { cursor: grabbing; }
.piece.build { border-color: rgba(107, 92, 224, 0.55); color: var(--purple-soft); }
.piece.used { display: none; }
.piece:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.piece.selected { box-shadow: 0 0 0 2px var(--purple); }

.slot {
  min-height: 120px; border-radius: var(--radius);
  border: 1.5px dashed rgba(107, 92, 224, 0.4);
  background: rgba(107, 92, 224, 0.06);
  display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; justify-content: center;
  padding: 1rem; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.slot.hot {
  background: rgba(107, 92, 224, 0.14);
  border-color: var(--purple);
  box-shadow: 0 0 36px rgba(107, 92, 224, 0.16);
}
.slot.done {
  border-style: solid; border-color: var(--purple);
  background: rgba(107, 92, 224, 0.12);
}
.slot .hint { color: var(--mute); font-size: 0.9rem; pointer-events: none; }
.slot .chip {
  padding: 0.55rem 0.9rem; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 600;
}
.slot .chip.purple { background: var(--purple); color: #fff; }
.slot .plus { color: var(--mute); font-size: 1.2rem; }

/* Workflow simplify */
.workflow {
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.wf-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem; align-items: center;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--line);
  transition: opacity 0.35s, max-height 0.4s, padding 0.35s, background 0.2s;
}
.wf-row:last-child { border-bottom: none; }
.wf-row .n {
  font-size: 0.7rem; color: var(--mute); font-variant-numeric: tabular-nums; width: 1.4rem;
}
.wf-row .label { font-size: 0.95rem; }
.wf-row .badge {
  font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute-2); border: 1px solid var(--line); padding: 0.2rem 0.45rem; border-radius: 999px;
}
.wf-row.cuttable .badge { color: var(--purple-soft); border-color: rgba(107, 92, 224, 0.35); }
.wf-row.gone {
  opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border: none; overflow: hidden;
}
.wf-row.kept { background: rgba(107, 92, 224, 0.08); }
.wf-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.stack { display: grid; gap: 0.75rem; }
.stack .label {
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--purple-soft); font-weight: 600;
}
.metric {
  font-family: var(--serif); font-size: clamp(1.55rem, 4vw, 2.05rem);
  letter-spacing: -0.02em;
}
.metric span { color: var(--mute); font-size: 0.55em; }

.mission {
  display: grid; gap: 1rem;
}
@media (min-width: 700px) {
  .mission { grid-template-columns: 160px 1fr; align-items: start; }
}
.mission .mini-port {
  width: 140px; border-radius: 18px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(107, 92, 224, 0.3);
}
.mission .mini-port img {
  width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center top;
  filter: none;
}
.mission .mini-port {
  position: relative;
  box-shadow: 0 0 0 1px rgba(107, 92, 224, 0.35), 0 0 20px rgba(107, 92, 224, 0.14);
}
.mission .mini-port::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 70%, rgba(10, 10, 11, 0.25) 100%);
  pointer-events: none;
}

.builds { display: grid; gap: 0.7rem; }
@media (min-width: 640px) { .builds { grid-template-columns: 1fr 1fr 1fr; } }
.build-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 1rem;
  background: rgba(255, 255, 255, 0.02); min-height: 148px;
  display: flex; flex-direction: column; gap: 0.45rem;
  transition: border-color 0.2s, transform 0.25s var(--ease), background 0.2s;
}
.build-card:hover {
  border-color: rgba(107, 92, 224, 0.45);
  transform: translateY(-2px);
  background: rgba(107, 92, 224, 0.06);
}
.build-card h3 { font-size: 1rem; font-weight: 600; }
.build-card p { color: var(--mute); font-size: 0.86rem; flex: 1; }
.build-card .meta {
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--purple-soft); border-top: 1px solid var(--line); padding-top: 0.55rem;
}

.archive-line { margin-top: 1rem; font-size: 0.88rem; color: var(--mute); }
.archive-line a { color: var(--ink); }

.form { display: grid; gap: 0.85rem; }
.field { display: grid; gap: 0.35rem; }
.field label {
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mute); font-weight: 600;
}
.field input, .field textarea {
  width: 100%; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); padding: 0.8rem 0.95rem;
  outline: none; resize: vertical; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(107, 92, 224, 0.15);
}
.form-status { min-height: 1.2em; font-size: 0.9rem; color: var(--purple-soft); }

.diploma { text-align: center; padding: 0.25rem 0 0.5rem; }
.diploma .seal,
.diploma .seal-portrait {
  width: clamp(88px, 14dvh, 120px);
  height: clamp(88px, 14dvh, 120px);
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(168, 155, 255, 0.45);
  box-shadow:
    0 0 0 4px rgba(107, 92, 224, 0.14),
    0 0 36px rgba(107, 92, 224, 0.35);
  flex-shrink: 0;
}
.diploma .seal img,
.diploma .seal-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.diploma .eyebrow { justify-content: center; }

.nav-lesson {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap;
}
.nav-lesson .ghost-link {
  color: var(--mute); font-size: 0.88rem; text-decoration: none;
}
.nav-lesson .ghost-link:hover { color: var(--ink); }

footer {
  padding: 0.85rem var(--pad) 1.15rem;
  border-top: 1px solid transparent;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem;
  color: var(--mute); font-size: 0.75rem; opacity: 0.55;
}
body.at-end footer { opacity: 0.9; border-top-color: var(--line); }

.drag-ghost {
  position: fixed; z-index: 50; pointer-events: none;
  padding: 0.7rem 1.1rem; border-radius: 14px;
  background: var(--purple); color: #fff; font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%); opacity: 0.95;
}

/* dossier styles moved to .dossier-root modal below */
.chips { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.75rem; }
.chip-tag {
  font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.45rem 0.85rem; border-radius: 999px; border: 1px solid var(--line);
  color: var(--mute);
}


/* ===== Longer bio dossier (modal) ===== */
.dossier-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  pointer-events: none;
  visibility: hidden;
}
.dossier-root[hidden] { display: none; }
.dossier-root.is-open {
  display: flex;
  pointer-events: auto;
  visibility: visible;
}
.dossier-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 250ms var(--ease-out, var(--ease));
}
.dossier-root.is-open .dossier-backdrop { opacity: 1; }
.dossier-root.is-closing .dossier-backdrop {
  opacity: 0;
  transition-duration: 220ms;
}

.dossier-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(86dvh, 860px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #121214;
  border: 1px solid rgba(244, 244, 245, 0.14);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(107, 92, 224, 0.12);
  padding: clamp(1.35rem, 3vw, 2rem) clamp(1.35rem, 3vw, 2.1rem) clamp(1.5rem, 3vw, 2.15rem);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition:
    opacity 380ms var(--ease-out, var(--ease)) 60ms,
    transform 380ms var(--ease-out, var(--ease)) 60ms;
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 92, 224, 0.5) transparent;
}
.dossier-root.is-open .dossier-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.dossier-root.is-closing .dossier-panel {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition-duration: 220ms;
  transition-delay: 0ms;
}

.dossier-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--mute);
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  z-index: 2;
}
.dossier-close:hover,
.dossier-close:focus-visible {
  color: var(--ink);
  background: rgba(244, 244, 245, 0.06);
  border-color: var(--line);
  outline: none;
}

.dossier-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.15rem;
  padding-right: 2.5rem;
}
.dossier-avatar {
  width: clamp(88px, 12dvh, 96px);
  height: clamp(88px, 12dvh, 96px);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(168, 155, 255, 0.45);
  box-shadow:
    0 0 0 4px rgba(107, 92, 224, 0.14),
    0 0 28px rgba(107, 92, 224, 0.32);
}
.dossier-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.dossier-titles h3 {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 2.4vw + 0.6vh, 2.45rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 0.2rem;
  color: var(--ink);
}
.dossier-role {
  margin: 0;
  color: var(--purple-soft);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.dossier-body p {
  color: #c8c8ce;
  font-size: clamp(1.05rem, 0.4vw + 0.95rem, 1.125rem);
  line-height: 1.55;
  margin: 0 0 0.85rem;
}
.dossier-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1.1rem 0 1.15rem;
}
.dossier-stat {
  background: rgba(244, 244, 245, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.dossier-stat-val {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.dossier-stat-label {
  font-size: 0.72rem;
  color: var(--mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dossier-root .chips {
  gap: 0.55rem;
  margin-top: 0.25rem;
}
.dossier-root .chip-tag {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.85rem;
  color: #bdbdc4;
  border-color: rgba(244, 244, 245, 0.16);
}

.dossier-stagger {
  opacity: 0;
  transform: translateY(8px);
}
.dossier-root.is-open .dossier-stagger {
  animation: dossier-stagger-in 320ms var(--ease-out, var(--ease)) forwards;
}
.dossier-root.is-open .dossier-head.dossier-stagger { animation-delay: 140ms; }
.dossier-root.is-open .dossier-body > .dossier-stagger:nth-child(1) { animation-delay: 190ms; }
.dossier-root.is-open .dossier-body > .dossier-stagger:nth-child(2) { animation-delay: 240ms; }
.dossier-root.is-open .dossier-body > .dossier-stagger:nth-child(3) { animation-delay: 290ms; }
.dossier-root.is-open .dossier-body > .dossier-stats { animation-delay: 340ms; }
.dossier-root.is-open .dossier-body > .chips { animation-delay: 390ms; }
@keyframes dossier-stagger-in {
  to { opacity: 1; transform: none; }
}
.dossier-root.is-closing .dossier-stagger {
  animation: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

@media (max-width: 500px) {
  .dossier-root.is-open {
    align-items: flex-end;
    padding: 0;
  }
  .dossier-panel {
    width: 100%;
    max-height: min(92dvh, 920px);
    border-radius: 22px 22px 0 0;
    transform: translateY(28px) scale(1);
    transition:
      opacity 340ms var(--ease-out, var(--ease)) 40ms,
      transform 380ms var(--ease-out, var(--ease)) 40ms;
    padding: 1.25rem 1.15rem 1.75rem;
  }
  .dossier-root.is-open .dossier-panel {
    transform: translateY(0);
  }
  .dossier-root.is-closing .dossier-panel {
    transform: translateY(24px);
  }
  .dossier-stats { grid-template-columns: 1fr; }
  .dossier-head { gap: 0.85rem; }
  .dossier-avatar { width: 88px; height: 88px; }
}

@media (min-width: 501px) and (max-height: 640px) {
  .dossier-panel {
    max-height: calc(100dvh - 1.5rem);
    padding: 1rem 1.15rem 1.15rem;
  }
  .dossier-avatar { width: 72px; height: 72px; }
  .dossier-titles h3 { font-size: 1.55rem; }
  .dossier-body p { font-size: 1.05rem; margin-bottom: 0.55rem; }
  .dossier-stats { margin: 0.7rem 0 0.75rem; gap: 0.45rem; }
  .dossier-stat { padding: 0.5rem 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .dossier-backdrop,
  .dossier-panel {
    transition: opacity 180ms ease !important;
    transform: none !important;
  }
  .dossier-stagger {
    animation: none !important;
    transition: opacity 180ms ease !important;
    transform: none !important;
  }
  .dossier-root.is-open .dossier-stagger { opacity: 1; }
}

.flash {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(107, 92, 224, 0.12), transparent 60%);
  opacity: 0; transition: opacity 0.45s var(--ease-out, var(--ease));
}
.flash.on { opacity: 1; }

@media (max-width: 500px) {
  .btn-row .btn { width: 100%; }
  .nav-lesson { flex-direction: column-reverse; align-items: stretch; }
  .nav-lesson .btn { width: 100%; }
  .panel[data-step="6"] .contact-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .panel[data-step="6"] .contact-copy,
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .contact-actions.nav-lesson {
    grid-column: auto;
    grid-row: auto;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    margin-top: 1rem;
    width: 100%;
  }
  .panel[data-step="6"] .contact-actions .btn { width: 100%; }
  .brand span { display: none; }
  .mission { grid-template-columns: 1fr; }
  .mission .mini-port { width: 110px; }
}

/* beat 05 mobile tighten */
@media (max-width: 500px) {
  .panel[data-step="5"] .ab-inner { padding: 0.85rem 0.95rem; }
  .panel[data-step="5"] .build-card { padding: 0.85rem 0.95rem; }
  .panel[data-step="5"] .stack { margin-bottom: 0.85rem !important; gap: 0.65rem; }
  .panel[data-step="5"] h2 { margin-bottom: 0.75rem; }
}

/* beat 05 phone tighten */
@media (max-width: 640px) {
  .panel[data-step="5"] .ab-inner { padding: 0.7rem 0.8rem; }
  .panel[data-step="5"] .stack { margin-bottom: 0.7rem !important; gap: 0.5rem; }
  .panel[data-step="5"] .metric { font-size: 1.35rem; }
  .panel[data-step="5"] .build-card {
    min-height: 0;
    padding: 0.75rem 0.8rem;
    gap: 0.3rem;
  }
  .panel[data-step="5"] .build-card h3 { font-size: 0.95rem; }
  .panel[data-step="5"] .build-card p { font-size: 0.82rem; }
  .panel[data-step="5"] .builds { gap: 0.55rem; }
  .panel[data-step="5"] h2 { font-size: clamp(1.35rem, 6vw, 1.7rem); margin-bottom: 0.6rem; }
  .panel[data-step="5"] .lede,
  .panel[data-step="5"] > p { margin-bottom: 0.65rem; }
}

/* Contact box */
.contact-copy { position: relative; padding-right: 3.1rem; }
.contact-line {
  color: var(--mute);
  margin: 0 0 0.55rem;
  max-width: 36rem;
}
.contact-line-follow { margin-bottom: 0; }
.linkedin-mark {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--mute);
  text-decoration: none;
  transition: color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.linkedin-mark:hover,
.linkedin-mark:focus-visible {
  color: var(--purple-soft);
  background: rgba(107, 92, 224, 0.12);
}
.linkedin-mark:focus-visible {
  outline: 2px solid var(--purple-soft);
  outline-offset: 2px;
}
.linkedin-mark svg { display: block; width: 28px; height: 28px; }
.contact-grid { display: grid; gap: 1rem; }

.chip-tag-quiet {
  color: var(--mute);
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
  font-weight: 500;
}
.chip-note {
  margin-left: 0.35rem;
  font-size: 0.68em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute-2);
  opacity: 0.9;
}

/* ========== Fit devices (tablet+desktop, min-width 501px): no page scroll, every beat fits 100dvh ========== */
@media (min-width: 501px) {
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  .app {
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .bar {
    position: relative;
    top: auto;
    flex-shrink: 0;
    padding: 1rem var(--pad);
    min-height: 58px;
    align-items: center;
  }
  .brand img { width: 34px; height: 34px; }
  .lesson {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    /* Stretch panel to the lesson area so the content block fills the viewport */
    place-items: stretch center;
    align-content: stretch;
    justify-items: center;
    padding: clamp(0.15rem, 0.5dvh, 0.45rem) var(--pad);
  }
  .panel {
    width: min(920px, 100%);
    max-height: 100%;
    height: auto;
    display: none;
  }
  .panel.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Fill the lesson (viewport minus bar/footer) */
    height: 100%;
    min-height: 100%;
    max-height: 100%;
  }
  .panel[data-step="0"] { width: min(1100px, 100%); }
  .panel[data-step="4"] { width: min(1080px, 100%); }
  .panel[data-step="5"] { width: min(980px, 100%); }
  .panel[data-step="6"] { width: min(960px, 100%); }

  footer {
    flex-shrink: 0;
    padding: 0.4rem var(--pad) 0.55rem;
    font-size: 0.7rem;
    min-height: 1.6rem;
  }

  .eyebrow { margin-bottom: 0.4rem; font-size: 0.7rem; }
  /* Dramatic headings */
  h1 {
    font-size: clamp(2.35rem, 5vw + 1.2vh, 4.25rem);
    margin-bottom: 0.55rem;
    line-height: 1.02;
  }
  h2 {
    font-size: clamp(2rem, 4.2vw + 1vh, 3.75rem);
    margin-bottom: 0.45rem;
    line-height: 1.05;
  }
  /* Body / lede: readable, lighter mute, roomy measure */
  .lede {
    font-size: clamp(1.0625rem, 1.8dvh + 0.55vw, 1.25rem); /* ≥17px; ~19-20 at 1440 */
    margin-bottom: 0.75rem;
    max-width: 70ch;
    line-height: 1.45;
    color: #b4b4ba;
  }
  .btn { min-height: 44px; padding: 0.6rem 1.2rem; font-size: 0.95rem; }
  /* Breathing room above nav on every beat */
  .nav-lesson {
    margin-top: 0;
    padding-top: clamp(2rem, 4dvh, 2.5rem); /* ≥32px breathing room above Back/Keep going */
    flex-shrink: 0;
  }
  .feedback { margin-bottom: 0; }
  .feedback.show { margin-bottom: 0; }
  .btn-row { margin-top: clamp(1.5rem, 3dvh, 2.25rem); }

  /* Choice cards: 16-18px text */
  .choice .t { font-size: clamp(1rem, 1.1dvh + 0.25vw, 1.125rem); }
  .choice .d { font-size: clamp(1rem, 1.05dvh + 0.2vw, 1.0625rem); color: #a8a8ae; }
  .choice { padding: clamp(0.85rem, 1.6dvh, 1.15rem) 1rem; }
  .choices { gap: 0.85rem; }
  .feedback {
    padding: 0.85rem 1rem;
    margin-top: 0.85rem;
    font-size: clamp(0.95rem, 1.1dvh + 0.2vw, 1.05rem);
  }

  /* Hero: tall portrait filling short windows */
  .intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
    gap: clamp(1rem, 3vw, 2.25rem);
    align-items: center;
  }
  .portrait {
    width: min(420px, 55dvh, 38vw);
    max-width: 100%;
    justify-self: end;
  }
  .portrait .frame { max-height: min(420px, 58dvh); }
  .portrait .frame img { max-height: min(420px, 58dvh); width: 100%; object-fit: cover; object-position: center top; }
  .portrait .frame { border-radius: 20px; }
  .portrait .ring { inset: -10px; border-radius: 28px; }
  .panel[data-step="0"] .lede { max-width: 62ch; }

  /* Cards / metrics */
  .ab-inner { padding: clamp(0.85rem, 1.8dvh, 1.25rem); }
  .build-card {
    min-height: 0;
    padding: clamp(0.75rem, 1.5dvh, 1rem) 0.9rem;
    gap: 0.35rem;
  }
  .build-card h3 { font-size: clamp(1rem, 1.1dvh + 0.2vw, 1.1rem); }
  .build-card p {
    font-size: clamp(0.9375rem, 1dvh + 0.15vw, 1.05rem);
    color: #a8a8ae;
  }
  .panel[data-step="5"] .stack {
    margin-bottom: 0.55rem !important;
    gap: 0.65rem;
    grid-template-columns: 1fr 1fr;
  }
  .panel[data-step="5"] .builds { gap: 0.55rem; grid-template-columns: 1fr 1fr 1fr; }
  .panel[data-step="5"] > p,
  .panel[data-step="5"] .builds-intro {
    margin-bottom: 0.45rem;
    font-size: clamp(0.95rem, 1.05dvh + 0.15vw, 1.05rem);
    color: #b4b4ba;
  }
  .panel[data-step="5"] h2 { margin-bottom: 0.35rem; }
  .panel[data-step="5"] .build-card p {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    font-size: clamp(0.875rem, 0.95dvh + 0.2vw, 0.9375rem); /* 14-15px */
  }
  .panel[data-step="5"] .metric-note {
    display: block;
    font-size: clamp(0.9375rem, 1dvh + 0.15vw, 1rem); /* 15-16px */
    color: #a8a8ae;
    margin-top: 0.25rem;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .archive-line { margin-top: 0.55rem; font-size: 0.9rem; }
  .metric { font-size: clamp(1.35rem, 2.8dvh, 1.85rem); }
  .label { font-size: 0.68rem; margin-bottom: 0.2rem; }
  .ab-inner p { font-size: clamp(0.95rem, 1.05dvh + 0.15vw, 1.05rem); color: #a8a8ae; }

  /* Mission / beat 04: tall portrait column + readable copy */
  .mission {
    display: grid;
    grid-template-columns: minmax(180px, 0.4fr) minmax(0, 1fr);
    gap: clamp(1rem, 2.5vw, 1.75rem);
    align-items: stretch;
    flex: 0 1 auto;
    min-height: 0;
  }
  .mission .mini-port {
    width: 100%;
    max-width: 360px;
    height: auto;
    min-height: 100%;
    max-height: 360px;
    align-self: stretch;
    border-radius: 20px;
  }
  .mission .mini-port img {
    width: 100%;
    height: 100%;
    min-height: 220px;
    max-height: 360px;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: center top;
  }
  .mission .lede {
    margin-bottom: 0.65rem !important;
    max-width: 68ch;
  }
  .mission p {
    font-size: clamp(1.0625rem, 1.8dvh + 0.55vw, 1.25rem);
    line-height: 1.45;
    color: #b4b4ba;
    max-width: 68ch;
    margin-bottom: 0.7rem !important;
  }
  .mission p:last-child { margin-bottom: 0 !important; }
  .panel[data-step="4"] > .eyebrow,
  .panel[data-step="4"] > h2 { flex-shrink: 0; }

  /* Fuse / workflow */
  .slot { min-height: 96px; padding: 0.75rem; }
  .wf-row { padding: 0.65rem 0.9rem; }
  .wf-row .label { font-size: 1rem; }
  .piece { min-height: 46px; padding: 0.6rem 1rem; font-size: 0.95rem; }
  .fuse-live, .fuse-result, #fuse-result, .result-box {
    margin-bottom: 0;
  }

  /* Graduate + contact */
  .diploma { padding: 0; flex-shrink: 0; }
  .diploma .seal,
  .diploma .seal-portrait {
    width: clamp(88px, 14dvh, 120px);
    height: clamp(88px, 14dvh, 120px);
    margin: 0 auto 0.55rem;
  }
  .diploma .lede {
    margin-bottom: 0.5rem !important;
    font-size: clamp(1.0625rem, 1.8dvh + 0.55vw, 1.2rem);
    max-width: 62ch;
    color: #b4b4ba;
  }
  .panel[data-step="6"] .contact-box {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .panel[data-step="6"] .contact-box .ab-inner,
  .panel[data-step="6"] .contact-box .contact-grid {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }
  .panel[data-step="6"] .form {
    min-height: 0;
    overflow: hidden;
  }
  .panel[data-step="6"] .ab-inner {
    padding: clamp(0.65rem, 1.4dvh, 1.05rem) clamp(0.75rem, 1.5dvh, 1.15rem);
  }
  .contact-grid {
    grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.2fr);
    grid-template-rows: 1fr auto;
    gap: 0.55rem 1.1rem;
    align-items: stretch;
  }
  .panel[data-step="6"] .contact-copy {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    padding-right: 2.5rem;
  }
  .panel[data-step="6"] .form {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: stretch;
  }
  /* Desktop: pin Back + Open bio into left column bottom; no separate nav row */
  .panel[data-step="6"] .contact-actions.nav-lesson {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.65rem 0.85rem;
    margin-top: 0.75rem;
    padding-top: 0;
    width: 100%;
  }
  .panel[data-step="6"] .contact-actions .ghost-link {
    order: -1; /* Back before bio visually beside/above pill if wrap */
    font-size: 0.85rem;
  }
  .panel[data-step="6"] .contact-actions .btn-ghost {
    /* clear secondary pill */
    border-color: rgba(167, 139, 250, 0.45);
    color: var(--purple-soft, #c4b5fd);
  }
  .contact-copy { padding-right: 2.5rem; }
  .ab-inner .contact-line,
  .contact-copy .contact-line {
    font-size: 1rem; /* 16px, Louby: contact lede readable */
    margin-bottom: 0.55rem; /* gap between the two sentences */
    line-height: 1.35;
    color: #b4b4ba;
  }
  .form { gap: 0.35rem; }
  .field input, .field textarea { padding: 0.4rem 0.65rem; }
  .field textarea { min-height: clamp(3.25rem, 9dvh, 5.5rem); max-height: 6rem; resize: none; }
  .field label { font-size: 0.6rem; }
  .panel[data-step="6"] .contact-actions.nav-lesson { margin-top: 0.75rem; padding-top: 0; }
  .panel[data-step="6"] h2 { margin-bottom: 0.3rem; }

  /* dossier modal handled globally */

  /* Single-line beat headings on desktop (h2 only; hero h1 keeps intentional break) */
  h2 {
    white-space: nowrap;
  }
  /* Long titles get a tighter width-fit clamp so they stay one line */
  .panel[data-step="1"] h2 { font-size: clamp(1.85rem, 3.6vw + 0.9vh, 3.4rem); }
  .panel[data-step="3"] h2 { font-size: clamp(1.85rem, 3.6vw + 0.9vh, 3.4rem); }
  .panel[data-step="4"] h2 { font-size: clamp(1.9rem, 3.8vw + 0.9vh, 3.5rem); }
  .panel[data-step="5"] h2 {
    font-size: clamp(1.55rem, 2.9vw + 0.7vh, 2.65rem);
    margin-bottom: 0.55rem;
  }
  .panel[data-step="6"] h2 { font-size: clamp(1.9rem, 3.8vw + 0.9vh, 3.5rem); }

  .mission-body {
    font-size: clamp(1.0625rem, 1.8dvh + 0.55vw, 1.25rem);
    line-height: 1.45;
    color: #b4b4ba;
    max-width: 68ch;
    margin-bottom: 0.7rem;
  }
  .metric-note {
    color: #a8a8ae;
    font-size: clamp(0.95rem, 1.05dvh + 0.15vw, 1.05rem);
    margin-top: 0.3rem;
  }
  .builds-intro {
    color: #b4b4ba;
    font-size: clamp(1rem, 1.1dvh + 0.2vw, 1.1rem);
    margin-bottom: 0.65rem;
  }
  /* Beat 05 stat callouts */
  .panel[data-step="5"] .metric {
    font-size: clamp(1.75rem, 3.2dvh + 0.4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }
  .panel[data-step="5"] .build-card h3 {
    font-size: clamp(1.05rem, 1.15dvh + 0.2vw, 1.125rem); /* ~17px */
  }
  .panel[data-step="5"] .build-card p {
    font-size: clamp(0.875rem, 0.95dvh + 0.15vw, 0.95rem); /* ~14-15px */
    color: #a8a8ae;
  }
  .panel[data-step="5"] .metric-note {
    font-size: clamp(1rem, 1.1dvh + 0.15vw, 1.05rem); /* ~16px */
  }
}

@media (min-width: 501px) and (max-height: 800px) {
  .bar { padding: 18px var(--pad) 1rem; min-height: 58px; }
  .lesson { padding-top: 0.12rem; padding-bottom: 0.12rem; }
  h1 { font-size: clamp(2.1rem, 4.8vw + 1.1vh, 3.6rem); }
  h2 { font-size: clamp(1.95rem, 4.2vw + 1vh, 3.4rem); }
  .panel[data-step="5"] h2 { font-size: clamp(1.45rem, 2.7vw + 0.6vh, 2.4rem); }
  .portrait { width: min(380px, 52dvh, 36vw); }
  .mission .mini-port { max-width: min(300px, 42dvh); min-height: min(240px, 40dvh); height: auto; max-height: min(320px, 44dvh); }
  .mission .mini-port img { min-height: min(240px, 40dvh); max-height: min(320px, 44dvh); }
  .diploma .lede { display: block; overflow: visible; -webkit-line-clamp: unset; }
  .panel[data-step="5"] .archive-line { display: none; }
  .choice .d { display: block; overflow: visible; -webkit-line-clamp: unset; }
  .nav-lesson { padding-top: 0; margin-top: max(1.75rem, 28px); }
  .btn-row { margin-top: clamp(1.75rem, 3.2dvh, 2.1rem); }
  .panel.active { height: 100%; min-height: 100%; }
}

@media (min-width: 501px) and (max-height: 700px) {
  .eyebrow { margin-bottom: 0.25rem; }
  h1, h2 { font-size: clamp(1.95rem, 4.2vw + 1vh, 3.1rem); margin-bottom: 0.3rem; }
  .panel[data-step="5"] h2 { font-size: clamp(1.35rem, 2.5vw + 0.5vh, 2.1rem); }
  .lede, .mission-body { margin-bottom: 0.45rem; font-size: clamp(1.0625rem, 1.5dvh + 0.2vw, 1.125rem); }
  .portrait { width: min(320px, 55dvh, 34vw); }
  .btn { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.9rem; }
  .contact-grid { gap: 0.5rem 0.9rem; }
  .field textarea { min-height: 3.25rem; max-height: 4rem; }
  .diploma .seal, .diploma .seal-portrait {
    width: clamp(88px, 14dvh, 120px);
    height: clamp(88px, 14dvh, 120px);
    margin-bottom: 0.45rem;
  }
  .mission .mini-port { max-width: min(250px, 42dvh); min-height: min(220px, 40dvh); height: auto; max-height: min(260px, 44dvh); }
  .mission .mini-port img { min-height: min(220px, 40dvh); max-height: min(260px, 44dvh); }
  .panel[data-step="5"] .metric { font-size: clamp(1.6rem, 3.5dvh, 2rem); }
  .panel[data-step="5"] .builds { gap: 0.4rem; }
  .panel[data-step="5"] .stack { margin-bottom: 0.4rem !important; }
  .panel[data-step="5"] .build-card p {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }
  .panel[data-step="5"] .metric-note {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    font-size: 0.9375rem;
  }
  .slot { min-height: 72px; }
  .wf-row { padding: 0.45rem 0.7rem; }
  .nav-lesson { padding-top: 0; margin-top: max(1.75rem, 28px); }
  .btn-row { margin-top: 1.75rem; }
  footer { padding: 0.3rem var(--pad) 0.4rem; }
  .choice { padding: 0.7rem 0.85rem; }
  .panel.active { height: 100%; min-height: 100%; }
  /* Graduate: compress form so it fits */
  .panel[data-step="6"] .diploma .lede {
    display: block; overflow: visible; -webkit-line-clamp: unset;
    font-size: clamp(0.95rem, 1.4dvh + 0.15vw, 1.05rem); margin-bottom: 0.35rem !important;
  }
  .panel[data-step="6"] .diploma .seal,
  .panel[data-step="6"] .diploma .seal-portrait {
    width: clamp(80px, 15dvh, 104px);
    height: clamp(80px, 15dvh, 104px);
    margin-bottom: 0.35rem;
  }
  .panel[data-step="6"] .field textarea { min-height: 3.25rem; max-height: 4rem; }
  .panel[data-step="6"] .contact-line { display: block; font-size: 0.875rem; margin-bottom: 0.55rem; }
  .panel[data-step="6"] .contact-line-follow { margin-bottom: 0; }
  .panel[data-step="6"] .ab-inner { padding: 0.5rem 0.65rem; }
  .panel[data-step="6"] .form { gap: 0.25rem; }
  .panel[data-step="6"] .contact-actions.nav-lesson { margin-top: 0.75rem; padding-top: 0; }
  .panel[data-step="5"] .metric { font-size: clamp(1.75rem, 4.2dvh, 2.05rem); }
}

/* Graduate fit for laptop-short heights */
@media (min-width: 501px) and (max-height: 760px) {
  .panel[data-step="6"] .diploma .seal,
  .panel[data-step="6"] .diploma .seal-portrait {
    width: clamp(84px, 15dvh, 110px);
    height: clamp(84px, 15dvh, 110px);
    margin-bottom: 0.4rem;
  }
  .panel[data-step="6"] .diploma .lede {
    display: block; overflow: visible; -webkit-line-clamp: unset;
    font-size: clamp(0.95rem, 1.4dvh + 0.15vw, 1.05rem); margin-bottom: 0.35rem !important;
  }
  .panel[data-step="6"] .field textarea { min-height: 3.25rem; max-height: 4rem; }
  .panel[data-step="6"] .contact-line { display: block; font-size: 0.875rem; margin-bottom: 0.55rem; }
  .panel[data-step="6"] .contact-line-follow { margin-bottom: 0; }
  .panel[data-step="6"] .ab-inner { padding: 0.55rem 0.7rem; }
  .panel[data-step="6"] .form { gap: 0.3rem; }
  .panel[data-step="6"] .contact-actions.nav-lesson { margin-top: 0.75rem; padding-top: 0; }
}


@media (min-width: 501px) and (max-height: 640px) {
  .brand span { display: none; }
  h1, h2 { font-size: clamp(1.9rem, 4vw + 0.9vh, 2.65rem); margin-bottom: 0.18rem; }
  .panel[data-step="5"] h2 { font-size: clamp(1.2rem, 2.2vw + 0.4vh, 1.75rem); margin-bottom: 0.25rem; }
  .portrait { width: min(240px, 50dvh, 30vw); }
  .intro-grid { gap: 0.7rem; grid-template-columns: minmax(0, 1.25fr) minmax(150px, 0.7fr); }
  .diploma .lede { display: block; overflow: visible; -webkit-line-clamp: unset; }
  /* contact lines stay visible; linkedin <a> is first-child, not a line */
  /* Beat 05: keep eyebrow + metric notes + full card copy; 2+3 grid */
  .panel[data-step="5"] .eyebrow { display: inline-flex; margin-bottom: 0.2rem; font-size: 0.62rem; }
  .panel[data-step="5"] .stack {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.35rem !important;
  }
  .panel[data-step="5"] .builds { grid-template-columns: 1fr 1fr 1fr; gap: 0.35rem; }
  .panel[data-step="5"] .builds-intro {
    display: block;
    font-size: 0.9375rem; /* 15px */
    margin-bottom: 0.3rem;
    line-height: 1.35;
  }
  .panel[data-step="5"] .archive-line { display: none; }
  .panel[data-step="5"] .ab-inner { padding: 0.45rem 0.55rem; }
  .panel[data-step="5"] .metric { font-size: clamp(1.35rem, 3.8dvh, 1.7rem); }
  .panel[data-step="5"] .metric-note {
    display: block;
    font-size: 0.9375rem; /* 15px */
    line-height: 1.3;
    margin-top: 0.2rem;
    overflow: visible;
    -webkit-line-clamp: unset;
  }
  .panel[data-step="5"] .label { font-size: 0.58rem; margin-bottom: 0.1rem; }
  .panel[data-step="5"] .build-card { padding: 0.4rem 0.5rem; gap: 0.2rem; }
  .panel[data-step="5"] .build-card h3 { font-size: 0.95rem; }
  .panel[data-step="5"] .build-card p {
    display: block;
    font-size: 0.9375rem; /* 15px */
    line-height: 1.3;
    overflow: visible;
    -webkit-line-clamp: unset;
  }
  .panel[data-step="5"] .build-card .meta { font-size: 0.65rem; }
  .mission { grid-template-columns: minmax(140px, 0.38fr) minmax(0, 1fr); gap: 0.7rem; align-items: stretch; }
  .mission .mini-port {
    max-width: min(250px, 48dvh);
    min-height: min(220px, 42dvh);
    height: auto;
    max-height: min(250px, 48dvh);
  }
  .mission .mini-port img { min-height: min(220px, 42dvh); max-height: min(250px, 48dvh); }
  .nav-lesson { padding-top: 0; margin-top: max(1.75rem, 28px); }
  .btn-row { margin-top: 1.75rem; }
  .feedback { margin-top: 0.5rem; }
  .form-status { min-height: 0.85em; font-size: 0.85rem; }
  .btn { min-height: 36px; padding: 0.35rem 0.8rem; }
  .panel.active { height: 100%; min-height: 100%; }
  /* Beat 06 short: inline headshot + heading, hide eyebrow, real nav gap, 2-line textarea */
  .panel[data-step="6"] .diploma {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    row-gap: 0.2rem;
    align-items: center;
    text-align: left;
    margin-bottom: 0.15rem;
  }
  .panel[data-step="6"] .diploma .eyebrow { display: none; }
  .panel[data-step="6"] .diploma .seal,
  .panel[data-step="6"] .diploma .seal-portrait {
    grid-row: 1 / span 2;
    grid-column: 1;
    width: 56px;
    height: 56px;
    margin: 0;
    align-self: center;
  }
  .panel[data-step="6"] .diploma h2 {
    grid-column: 2;
    grid-row: 1;
    font-size: clamp(1.2rem, 2.1vw + 0.4vh, 1.7rem);
    margin: 0;
    white-space: nowrap;
  }
  .panel[data-step="6"] .diploma .lede {
    grid-column: 2;
    grid-row: 2;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    font-size: 0.875rem;
    margin: 0 !important;
    line-height: 1.3;
    max-width: none;
    text-align: left;
  }
  .panel[data-step="6"] .field textarea {
    min-height: 3.25rem; /* >= 2 lines at 16px/1.5 */
    max-height: 4rem;
  }
  .panel[data-step="6"] .field input { padding: 0.35rem 0.55rem; }
  .panel[data-step="6"] .contact-copy p:not(.speech-text):not(.note-label):not(.note-name):not(.note-email):not(.note-msg) {
    display: block;
    font-size: 0.875rem; /* 16px */
    line-height: 1.4;
  }
  .panel[data-step="6"] .contact-line {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.55rem; /* gap between the two sentences */
  }
  .panel[data-step="6"] .contact-line-follow { margin-bottom: 0; }
  .panel[data-step="6"] .ab-inner { padding: 0.4rem 0.6rem; }
  .panel[data-step="6"] .form { gap: 0.25rem; }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    margin-top: 0.5rem;
    padding-top: 0;
    position: relative;
    z-index: 2;
  }
  .panel[data-step="6"] .linkedin-mark { margin-bottom: 0.35rem; }
  .panel[data-step="6"] .linkedin-mark svg { width: 22px; height: 22px; }
  .panel[data-step="6"] .contact-box { flex: 0 1 auto; }
  .panel[data-step="6"] .field { margin: 0; }
  .panel[data-step="6"] .form .btn { min-height: 34px; padding: 0.35rem 0.8rem; }
}

@media (min-width: 501px) and (max-height: 520px) {
  .panel[data-step="6"] .diploma .seal,
  .panel[data-step="6"] .diploma .seal-portrait {
    width: 56px; height: 56px;
  }
  .panel[data-step="6"] .diploma { grid-template-columns: 56px minmax(0, 1fr); }
  .panel[data-step="6"] .contact-actions.nav-lesson { margin-top: 0.75rem; padding-top: 0; }
  .panel[data-step="6"] .field textarea { min-height: 3.25rem; max-height: 3.8rem; }
}



@media (min-width: 501px) and (max-height: 480px) {
  /* Extremely short: drop builds-intro only */
  .panel[data-step="5"] .builds-intro { display: none; }
}


/* NO-SCROLL FIT RULE: phones (max-width:500px) may scroll; tablet+desktop never scroll (page or inner). */
  body {
    height: auto;
  }
  .shell, .lesson {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .panel.active {
    height: auto;
    min-height: 0;
  }
}


/* Fit devices: dossier must not scroll; compress content */
@media (min-width: 501px) {
  .dossier-panel {
    overflow-x: hidden;
    overflow-y: hidden;
    max-height: calc(100dvh - 2rem);
  }
  .dossier-body { max-height: none; overflow: hidden; }
}
@media (min-width: 501px) and (max-height: 700px) {
  .dossier-body p:nth-child(n+3) { display: none; }
  .dossier-stats { grid-template-columns: repeat(3, 1fr); }
  .dossier-stat:nth-child(n+4) { display: none; }
}
@media (min-width: 501px) and (max-height: 520px) {
  .dossier-avatar { width: 56px; height: 56px; }
  .dossier-body p:nth-child(n+2) { display: none; }
  .dossier-stats { display: none; }
}


/* Phone only: allow page scroll */
@media (max-width: 500px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .app { height: auto; min-height: 100dvh; max-height: none; overflow: visible; }
  .lesson { overflow: visible; }
  .dossier-panel { overflow-y: auto; }
}


/* ===== Contact whimsy shared (concepts A/B/C) ===== */
.contact-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple-soft);
  font-weight: 600;
  margin: 0 0 0.45rem;
}
.btn-li {
  margin-top: 0.85rem;
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: var(--purple-soft);
  background: rgba(107, 92, 224, 0.08);
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  width: fit-content;
}
.btn-li:hover {
  border-color: var(--purple-soft);
  background: rgba(107, 92, 224, 0.16);
  color: var(--ink);
}
.btn-send {
  justify-self: stretch;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 8px 28px rgba(107, 92, 224, 0.28);
  font-weight: 650;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn-send:hover:not(:disabled) {
  background: #7a6be8;
  box-shadow: 0 10px 32px rgba(107, 92, 224, 0.4);
  transform: translateY(-1px);
}
.btn-send:active:not(:disabled) {
  transform: scale(0.985) translateY(0);
  background: #5a4bc9;
}
.btn-send:focus-visible {
  outline: 2px solid var(--purple-soft);
  outline-offset: 3px;
}
.btn-send.is-sending {
  opacity: 0.85;
  cursor: progress;
}
.btn-send.is-success {
  background: #3d9b6e;
  box-shadow: 0 8px 24px rgba(61, 155, 110, 0.28);
}
.btn-send.is-error {
  background: #a35454;
  box-shadow: 0 8px 24px rgba(163, 84, 84, 0.25);
}
.btn-send .ico-plane { transition: transform 0.35s var(--ease); }
.btn-send:hover:not(:disabled) .ico-plane { transform: translate(2px, -2px) rotate(8deg); }
.panel[data-step="6"] .field label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #c2c2c8;
}
.panel[data-step="6"] .field input,
.panel[data-step="6"] .field textarea {
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  border-radius: 14px;
}
.panel[data-step="6"] .contact-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-right: 0.5rem;
  min-height: 0;
}
.panel[data-step="6"] .contact-copy .linkedin-mark { display: none; }
.form-status.is-error { color: #f0a8a8; }
.form-status.is-success { color: #9dd4b5; }

/* Headshot soft react */
.diploma .seal-portrait.is-happy {
  box-shadow:
    0 0 0 4px rgba(107, 92, 224, 0.22),
    0 0 42px rgba(107, 92, 224, 0.5);
  transform: scale(1.03);
  transition: box-shadow 0.6s var(--ease), transform 0.6s var(--ease);
}
.contact-seal {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(168, 155, 255, 0.45);
  box-shadow: 0 0 20px rgba(107, 92, 224, 0.28);
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}
.contact-seal img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.contact-seal.is-happy {
  box-shadow: 0 0 28px rgba(107, 92, 224, 0.55);
  transform: scale(1.04);
  transition: box-shadow 0.55s var(--ease), transform 0.55s var(--ease);
}

/* Paper plane fly (A) */
.plane-stage, .sat-stage, .env-fly {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: visible;
}
.form-whimsy { position: relative; }
.paper-plane {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: 28px;
  height: 28px;
  color: var(--purple-soft);
  opacity: 0;
  offset-path: path("M 0,0 C 40,-40 120,-80 200,-140");
  offset-distance: 0%;
}
.paper-plane.go {
  opacity: 1;
  animation: plane-fly 1.35s var(--ease) forwards;
}
@keyframes plane-fly {
  0% { offset-distance: 0%; opacity: 1; transform: rotate(-12deg) scale(1); }
  70% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; transform: rotate(18deg) scale(0.85); }
}

/* Chat (B) */
.form-chat .chat-prompt {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.2dvh, 1.45rem);
  color: var(--ink);
  margin: 0 0 0.65rem;
  line-height: 1.25;
}
.chat-progress { display: flex; gap: 0.4rem; margin-bottom: 0.55rem; }
.chat-progress .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(244,244,245,0.18);
  transition: background 0.3s, transform 0.3s;
}
.chat-progress .dot.is-on {
  background: var(--purple-soft);
  transform: scale(1.15);
}
.chat-actions {
  display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; margin-top: 0.35rem;
}
.chat-actions .btn-send { flex: 1 1 auto; width: auto; min-width: 140px; }
.sat-bit {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--purple-soft);
  box-shadow: 0 0 12px rgba(168,155,255,0.7);
  opacity: 0;
}
.sat-bit.go { animation: sat-drift 1.5s var(--ease) forwards; }
@keyframes sat-drift {
  0% { opacity: 0; transform: translate(0,0) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(120px, -90px) scale(1); }
}

/* Envelope (C) */
.composer { display: flex; flex-direction: column; gap: 0.65rem; min-height: 0; }
.btn-envelope {
  width: 100%;
  min-height: 64px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(107,92,224,0.2), rgba(107,92,224,0.06));
  border: 1px dashed rgba(168,155,255,0.45);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.85rem;
  font-weight: 650;
  transition: border-color 0.25s, background 0.25s, transform 0.22s var(--ease);
}
.btn-envelope:hover {
  border-style: solid;
  border-color: var(--purple-soft);
  background: rgba(107, 92, 224, 0.18);
  transform: translateY(-1px);
}
.btn-envelope:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: 3px; }
.env-visual {
  position: relative; width: 36px; height: 26px; flex-shrink: 0;
}
.env-body {
  position: absolute; inset: 8px 0 0; border-radius: 3px;
  background: var(--purple); opacity: 0.9;
}
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background: var(--purple-soft);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  transform-origin: top center;
  transition: transform 0.45s var(--ease);
}
.composer.is-open .env-flap { transform: rotateX(180deg); opacity: 0.7; }
.composer.is-open .btn-envelope { display: none; }
.composer-fields {
  animation: env-open 0.45s var(--ease);
}
@keyframes env-open {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.env-letter {
  position: absolute; right: 8%; bottom: 18%;
  width: 22px; height: 16px; border-radius: 2px;
  background: #f4f4f5; opacity: 0;
}
.env-letter.go { animation: env-launch 1.25s var(--ease) forwards; }
@keyframes env-launch {
  0% { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(130px, -110px) rotate(12deg) scale(0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .paper-plane.go, .sat-bit.go, .env-letter.go { animation: none !important; opacity: 0; }
  .composer-fields { animation: none !important; }
  .btn-send:hover:not(:disabled) .ico-plane { transform: none; }
  .diploma .seal-portrait.is-happy,
  .contact-seal.is-happy { transform: none; }
}

/* Fit: keep contact actions inside card, denser on short */
@media (min-width: 501px) {
  .panel[data-step="6"] .contact-grid {
    grid-template-columns: minmax(160px, 0.85fr) minmax(220px, 1.25fr);
  }
  .panel[data-step="6"] .form { gap: 0.45rem; }
  .panel[data-step="6"] .btn-send { min-height: 44px; }
}
@media (min-width: 501px) and (max-height: 640px) {
  .panel[data-step="6"] .contact-kicker { margin-bottom: 0.25rem; }
  .panel[data-step="6"] .contact-line { font-size: 0.875rem; margin-bottom: 0.35rem; }
  .panel[data-step="6"] .btn-li { min-height: 40px; margin-top: 0.45rem; padding: 0.4rem 0.9rem; }
  .panel[data-step="6"] .field textarea { min-height: 2.8rem; max-height: 3.6rem; }
  .contact-seal { width: 48px; height: 48px; }
  .form-chat .chat-prompt { font-size: 1.05rem; }
}
@media (min-width: 501px) and (max-height: 500px) {
  .panel[data-step="6"] .diploma .seal-portrait { width: 48px; height: 48px; }
  .panel[data-step="6"] .contact-line-follow { display: none; }
  .panel[data-step="6"] .field label { font-size: 0.7rem; }
  .btn-envelope { min-height: 52px; }
}
@media (max-width: 500px) {
  .panel[data-step="6"] .contact-grid {
    grid-template-columns: 1fr;
  }
  .panel[data-step="6"] .contact-copy,
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .composer,
  .panel[data-step="6"] .contact-actions.nav-lesson {
    grid-column: auto;
    grid-row: auto;
  }
}


@media (min-width: 501px) {
  .panel[data-step="6"] .composer {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: stretch;
    min-height: 0;
  }
  .panel[data-step="6"] .form-chat {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* Ensure hidden wins over .btn/.form display rules */
[hidden],
.form[hidden],
.cq-step[hidden],
.btn[hidden],
#chat-back[hidden],
#send-btn[hidden],
#chat-next[hidden] {
  display: none !important;
}

/* Concept B: only one primary action visible at a time */
.concept-b .chat-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
}
.concept-b .chat-actions #chat-back:not([hidden]) {
  grid-column: 1;
}
.concept-b .chat-actions #chat-next:not([hidden]),
.concept-b .chat-actions #send-btn:not([hidden]) {
  grid-column: 2;
}

/* Concept C: collapsed should feel like a destination, not an empty column */
.concept-c .composer:not(.is-open) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}
.concept-c .btn-envelope {
  min-height: 88px;
  font-size: 1.05rem;
  border-radius: 22px;
}
.concept-c .composer.is-open .composer-fields {
  display: grid;
  gap: 0.45rem;
}

/* Soft idle wink on seal (calm, infrequent) — disabled under reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .panel[data-step="6"].active .diploma .seal-portrait {
    animation: seal-breathe 6.5s var(--ease) infinite;
  }
}
@keyframes seal-breathe {
  0%, 100% { box-shadow: 0 0 0 4px rgba(107, 92, 224, 0.14), 0 0 36px rgba(107, 92, 224, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(107, 92, 224, 0.2), 0 0 42px rgba(107, 92, 224, 0.42); }
}
@media (prefers-reduced-motion: reduce) {
  .panel[data-step="6"].active .diploma .seal-portrait { animation: none !important; }
}

/* Refinement pass: chat bubble + calmer whimsy */
.concept-b .chat-prompt {
  position: relative;
  background: rgba(107, 92, 224, 0.1);
  border: 1px solid rgba(168, 155, 255, 0.22);
  border-radius: 16px 16px 16px 6px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.75rem;
}
.concept-b .chat-prompt::before {
  content: "";
  position: absolute;
  left: 14px; bottom: -6px;
  width: 10px; height: 10px;
  background: rgba(107, 92, 224, 0.1);
  border-left: 1px solid rgba(168, 155, 255, 0.22);
  border-bottom: 1px solid rgba(168, 155, 255, 0.22);
  transform: rotate(-45deg);
}
.concept-b .contact-copy {
  justify-content: space-between;
  height: 100%;
}
.concept-b .contact-copy .btn-li { margin-top: auto; margin-bottom: 0.35rem; }
@media (min-width: 501px) and (max-height: 560px) {
  .concept-b .contact-seal { display: none; } /* diploma seal already present; save height */
  .concept-b .chat-prompt { padding: 0.5rem 0.75rem; font-size: 1rem; }
  .concept-b .chat-prompt::before { display: none; }
}

/* Ultra-short fit (tablet/desktop ~400px tall): compress hard, never scroll */
@media (min-width: 501px) and (max-height: 420px) {
  .bar { min-height: 48px; padding: 18px var(--pad) 0.25rem; }
  .brand img { width: 26px; height: 26px; }
  footer { padding: 0.15rem var(--pad) 0.25rem; font-size: 0.6rem; min-height: 1rem; }
  .lesson { padding: 0.1rem var(--pad); }
  .eyebrow { display: none; }
  h2 { font-size: clamp(1.15rem, 3.2vw, 1.6rem) !important; margin-bottom: 0.15rem !important; }
  .lede { font-size: 0.9rem !important; margin-bottom: 0.25rem !important; line-height: 1.25; }
  .panel[data-step="0"] .lede { /* clamp removed; hide on short via whimsy-glance */ }
  .choice .d { display: none; }
  .choice { padding: 0.45rem 0.7rem; }
  .piece { min-height: 34px; padding: 0.35rem 0.7rem; font-size: 0.85rem; }
  .wf-row { padding: 0.3rem 0.55rem; }
  .panel[data-step="5"] .builds-intro { display: none; }
  .panel[data-step="5"] .metric-note { display: none; }
  .panel[data-step="5"] .build-card p { display: none; }
  .panel[data-step="5"] .build-card { padding: 0.4rem 0.55rem; }
  .panel[data-step="5"] .stack { gap: 0.35rem; }
  .diploma .seal-portrait { width: 40px !important; height: 40px !important; margin-bottom: 0.2rem !important; }
  .panel[data-step="6"] .contact-line-follow { display: none; }
  .panel[data-step="6"] .contact-kicker { display: none; }
  .panel[data-step="6"] .contact-seal { display: none; }
  .panel[data-step="6"] .field textarea { min-height: 2.2rem; max-height: 2.6rem; }
  .panel[data-step="6"] .btn-li { min-height: 34px; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
  .panel[data-step="6"] .btn-send { min-height: 36px; }
  .panel[data-step="6"] .contact-actions .btn-ghost { min-height: 34px; padding: 0.3rem 0.7rem; font-size: 0.8rem; }
  .nav-lesson { padding-top: 0.35rem !important; margin-top: 0.35rem !important; }
  .btn { min-height: 36px; padding: 0.35rem 0.85rem; font-size: 0.85rem; }
  .form-chat .chat-prompt { font-size: 0.95rem; padding: 0.4rem 0.6rem; }
  .panel[data-step="1"] .feedback { max-height: 2.2rem; overflow: hidden; }
  .panel[data-step="4"] .mini-port { display: none; }
}

/* Ultra-short fit: keep >=16px logo margin */
@media (min-width: 501px) and (max-height: 420px) {
  .bar {
    min-height: 48px;
    padding: 18px var(--pad) 0.25rem;
  }
}

/* Landscape phones (short + wide handset): may scroll; undo fit lock */
@media (max-width: 926px) and (max-height: 450px) and (min-aspect-ratio: 1/1) {
  html, body {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  .app {
    height: auto !important;
    min-height: 100dvh;
    max-height: none !important;
    overflow: visible !important;
  }
  .lesson { overflow: visible !important; }
  .bar {
    min-height: 52px;
    padding: 0.75rem var(--pad);
  }
  .panel[data-step="5"] .metric-note { display: block; }
  .panel[data-step="5"] .build-card p { display: -webkit-box; }
}

@media (max-width: 926px) and (max-height: 450px) and (min-aspect-ratio: 1/1) {
  .bar {
    min-height: 56px;
    padding: 18px var(--pad) 0.55rem !important;
  }
  .brand { margin: 0; }
  .panel[data-step="0"] .lede,
  .diploma .lede,
  .lede {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    max-height: none !important;
  }
}

/* Narrow tablets (501-760): single-column fit, still NO page scroll */
@media (min-width: 501px) and (max-width: 760px) {
  html, body, .app {
    height: 100%;
    height: 100dvh;
    overflow: hidden !important;
  }
  .lesson { overflow: hidden !important; }
  .panel { width: min(100%, 100%); }
  .panel[data-step="6"] .contact-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto;
  }
  .panel[data-step="6"] .contact-copy,
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .composer,
  .panel[data-step="6"] .contact-actions.nav-lesson {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
  .panel[data-step="6"] .contact-seal { display: none; }
  .panel[data-step="6"] .contact-line-follow { display: none; }
  .panel[data-step="5"] .stack { grid-template-columns: 1fr !important; }
  .panel[data-step="5"] .build-card p { display: none; }
  .panel[data-step="5"] .metric-note { display: none; }
  .panel[data-step="5"] .builds-intro { display: none; }
  .choice .d { display: none; }
  .mission { grid-template-columns: 1fr !important; }
  .mission .mini-port { display: none; }
  .intro-grid { grid-template-columns: 1fr !important; }
  .intro-grid .portrait { width: min(120px, 30vw); }
  h2 { font-size: clamp(1.35rem, 4vw, 2rem) !important; white-space: nowrap; }
  .lede { font-size: 0.95rem !important; }
  .dossier-panel {
    max-height: calc(100dvh - 1rem);
    overflow: hidden !important;
    padding: 0.85rem 1rem 1rem;
  }
  .dossier-body p:nth-child(n+2) { display: none; }
  .dossier-stats { display: none; }
  .dossier-avatar { width: 64px; height: 64px; }
  .chips .chip-tag:nth-child(n+4) { display: none; }
}
@media (min-width: 501px) and (max-width: 760px) and (max-height: 700px) {
  .diploma .seal-portrait { width: 52px !important; height: 52px !important; }
  .panel[data-step="6"] .contact-kicker { display: none; }
  .panel[data-step="6"] .field textarea { min-height: 2.4rem; max-height: 3rem; }
  .form-chat .chat-prompt { font-size: 1rem; padding: 0.45rem 0.65rem; }
  .btn-envelope { min-height: 56px; }
}
@media (min-width: 501px) and (max-width: 760px) and (max-height: 520px) {
  .eyebrow { display: none; }
  .diploma .seal-portrait { width: 40px !important; height: 40px !important; }
  .panel[data-step="0"] .portrait { display: none; }
  .panel[data-step="1"] .feedback { display: none; }
  .nav-lesson { padding-top: 0.4rem !important; margin-top: 0.4rem !important; }
}
/* Dossier: never inner-scroll on any fit device */
@media (min-width: 501px) {
  .dossier-panel { overflow: hidden !important; }
}
@media (min-width: 761px) and (max-height: 900px) {
  .dossier-body p:nth-child(n+3) { display: none; }
  .dossier-stat:nth-child(n+4) { display: none; }
}
@media (min-width: 761px) and (max-height: 700px) {
  .dossier-body p:nth-child(n+2) { display: none; }
  .dossier-stats { display: none; }
  .chips .chip-tag:nth-child(n+5) { display: none; }
}
/* Narrow short beat06 crush */

@media (min-width: 501px) and (max-width: 760px) and (max-height: 480px) {
  .panel[data-step="6"] .diploma .lede { display: none !important; }
  .panel[data-step="6"] .diploma .eyebrow { display: none; }
  .panel[data-step="6"] .contact-line-follow { display: none !important; }
  .panel[data-step="6"] .contact-kicker { display: none; }
  .panel[data-step="6"] .contact-line { font-size: 0.875rem; margin-bottom: 0.25rem; }
  .panel[data-step="6"] .btn-li { min-height: 32px; padding: 0.25rem 0.65rem; margin-top: 0.25rem; }
  .panel[data-step="6"] .ab-inner { padding: 0.4rem 0.5rem; }
  .form-chat .chat-prompt { font-size: 0.95rem; padding: 0.35rem 0.55rem; margin-bottom: 0.3rem; }
  .panel[data-step="6"] .field label { font-size: 0.65rem; }
  .panel[data-step="6"] .field input,
  .panel[data-step="6"] .field textarea { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
  .panel[data-step="6"] .field textarea { min-height: 2rem; max-height: 2.4rem; }
  .panel[data-step="6"] .btn-send { min-height: 34px; }
  .panel[data-step="5"] .build-card { padding: 0.3rem 0.45rem; }
  .panel[data-step="5"] .metric { font-size: 1.05rem; }
}
@media (min-width: 501px) and (max-width: 760px) and (max-height: 420px) {
  .panel[data-step="6"] h2 { font-size: 1.1rem !important; }
  .panel[data-step="6"] .diploma .seal-portrait { width: 36px !important; height: 36px !important; margin-bottom: 0.15rem !important; }
  .chat-progress { display: none; }
  .panel[data-step="6"] .contact-actions.nav-lesson { margin-top: 0.25rem; gap: 0.35rem; }
}

/* Last-resort crush: narrow tablets under 460px tall */
@media (min-width: 501px) and (max-width: 760px) and (max-height: 460px) {
  .panel[data-step="6"] .diploma .seal-portrait { display: none !important; }
  .panel[data-step="6"] .contact-copy {
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    max-height: 1.5rem;
    overflow: hidden;
    margin: 0;
    padding: 0 !important;
  }
  .panel[data-step="6"] .contact-copy .btn-li,
  .panel[data-step="6"] .contact-copy .contact-kicker,
  .panel[data-step="6"] .contact-copy .contact-seal,
  .panel[data-step="6"] .contact-copy .contact-line-follow { display: none !important; }
  .panel[data-step="6"] .contact-line:not(.speech-text) {
    font-size: 0.875rem;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .panel[data-step="6"] .contact-line.speech-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .panel[data-step="6"] .form-chat { gap: 0.25rem; }
  .panel[data-step="6"] .chat-prompt { margin-bottom: 0.2rem !important; }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    margin-top: 0.2rem !important;
    padding-top: 0 !important;
  }
  .bar { min-height: 44px; padding: 18px var(--pad) 0.15rem; }
  footer { min-height: 0.9rem; padding: 0.1rem var(--pad); font-size: 0.55rem; }
}

/* Prevent chat Next from overlapping contact-actions on narrow short fit */
@media (min-width: 501px) and (max-width: 760px) {
  .panel[data-step="6"] .contact-grid {
    align-items: stretch;
    align-content: start;
  }
  .panel[data-step="6"] .form-chat {
    justify-content: flex-start !important;
    flex: 0 1 auto;
    max-height: none;
    overflow: visible;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    position: relative;
    z-index: 3;
    margin-top: 0.5rem !important;
    padding-top: 0.35rem;
    background: linear-gradient(180deg, transparent, #121214 30%);
  }
}
@media (min-width: 501px) and (max-width: 760px) and (max-height: 560px) {
  .panel[data-step="6"] .form-chat .chat-prompt { margin-bottom: 0.35rem; }
  .panel[data-step="6"] .chat-actions .btn-send,
  .panel[data-step="6"] .chat-actions #chat-next {
    min-height: 40px;
  }
  .panel[data-step="6"] .contact-box .ab-inner {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
  .panel[data-step="6"] .contact-grid {
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    gap: 0.35rem;
  }
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .form-chat {
    flex: 0 0 auto;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    flex: 0 0 auto;
    margin-top: 0.25rem !important;
  }
}

/* Narrow tablet contact: flex-column when short; tall uses 2-col grid below */
@media (min-width: 501px) and (max-width: 760px) and (max-height: 639px) {
  .panel[data-step="6"] .contact-box .ab-inner {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    height: auto !important;
    min-height: 0;
  }
  .panel[data-step="6"] .contact-grid {
    display: flex !important;
    flex-direction: column;
    height: auto !important;
    min-height: 0;
    gap: 0.45rem;
    flex: 1 1 auto;
  }
  .panel[data-step="6"] .contact-copy,
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .form-chat,
  .panel[data-step="6"] .composer {
    flex: 0 0 auto;
    width: 100%;
  }
  .panel[data-step="6"] .form-chat {
    justify-content: flex-start !important;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    margin-top: 0.35rem !important;
    width: 100%;
  }
}


/* Short narrow tablets: ultra-compress contact so everything fits without scroll */
@media (min-width: 501px) and (max-width: 760px) and (max-height: 639px) {
  .panel[data-step="6"] .diploma {
    padding: 0.2rem 0.35rem 0.15rem !important;
    margin-bottom: 0.2rem !important;
  }
  .panel[data-step="6"] .diploma-kicker { font-size: 0.58rem !important; }
  .panel[data-step="6"] .diploma-title {
    font-size: clamp(0.95rem, 2.8vw, 1.2rem) !important;
    margin: 0.05rem 0 !important;
  }
  .panel[data-step="6"] .diploma-meta { font-size: 0.6rem !important; gap: 0.15rem !important; }
  .panel[data-step="6"] .diploma-meta img { width: 1.1rem !important; height: 1.1rem !important; }
  .panel[data-step="6"] .contact-box {
    padding: 0.35rem 0.45rem !important;
  }
  .panel[data-step="6"] .contact-box .ab-inner {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    gap: 0.25rem !important;
  }
  .panel[data-step="6"] .contact-grid {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    gap: 0.25rem !important;
    height: auto !important;
  }
  .panel[data-step="6"] .contact-copy {
    flex: 0 0 auto !important;
  }
  .panel[data-step="6"] .contact-copy h2 {
    font-size: clamp(0.95rem, 2.6vw, 1.15rem) !important;
    margin: 0 0 0.1rem !important;
  }
  .panel[data-step="6"] .contact-copy p:not(.speech-text):not(.note-label):not(.note-name):not(.note-email):not(.note-msg) {
    font-size: 0.875rem;
    line-height: 1.25 !important;
    margin: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .panel[data-step="6"] .contact-copy .speech-text {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    font-size: clamp(0.95rem, 1.4vh + 0.35rem, 1.1rem) !important;
    line-height: 1.35 !important;
    margin: 0 !important;
  }
  .panel[data-step="6"] .form-chat,
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .composer {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    justify-content: flex-start !important;
    gap: 0.25rem !important;
  }
  .panel[data-step="6"] .chat-thread {
    max-height: 4.2rem !important;
    padding: 0.25rem !important;
    gap: 0.2rem !important;
  }
  .panel[data-step="6"] .chat-bubble {
    font-size: 0.7rem !important;
    padding: 0.28rem 0.45rem !important;
  }
  .panel[data-step="6"] .chat-prompt {
    font-size: 0.68rem !important;
    margin: 0 !important;
  }
  .panel[data-step="6"] .chat-field input,
  .panel[data-step="6"] .chat-field textarea {
    font-size: 0.78rem !important;
    padding: 0.35rem 0.5rem !important;
    min-height: 0 !important;
  }
  .panel[data-step="6"] .chat-field textarea { min-height: 2.2rem !important; max-height: 3rem !important; }
  .panel[data-step="6"] .chat-actions .btn {
    min-height: 2rem !important;
    padding: 0.35rem 0.7rem !important;
    font-size: 0.78rem !important;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    flex: 0 0 auto !important;
    margin-top: 0.15rem !important;
    padding-top: 0.15rem !important;
  }
  .panel[data-step="6"] .contact-actions .btn {
    min-height: 1.9rem !important;
    padding: 0.3rem 0.65rem !important;
    font-size: 0.75rem !important;
  }
  .panel[data-step="6"] .form-plane .field label,
  .panel[data-step="6"] .composer-label {
    font-size: 0.65rem !important;
  }
  .panel[data-step="6"] .form-plane input,
  .panel[data-step="6"] .form-plane textarea,
  .panel[data-step="6"] .composer-input,
  .panel[data-step="6"] .composer-textarea {
    font-size: 0.78rem !important;
    padding: 0.3rem 0.45rem !important;
  }
  .panel[data-step="6"] .form-plane textarea { min-height: 2.4rem !important; }
}

/* CRITICAL: single-col narrow must not let contact-copy height:100% crush the form */
@media (min-width: 501px) and (max-width: 760px) and (max-height: 639px) {
  .concept-b .contact-copy,
  .panel[data-step="6"] .contact-copy {
    height: auto !important;
    max-height: none !important;
    justify-content: flex-start !important;
    flex: 0 0 auto !important;
    gap: 0.15rem !important;
    padding-right: 0 !important;
  }
  .concept-b .contact-copy .btn-li,
  .panel[data-step="6"] .contact-copy .btn-li {
    margin-top: 0.2rem !important;
    margin-bottom: 0 !important;
    min-height: 1.7rem !important;
    padding: 0.25rem 0.55rem !important;
    font-size: 0.72rem !important;
  }
  .panel[data-step="6"] .contact-line-follow { display: none !important; }
  .panel[data-step="6"] .contact-kicker { font-size: 0.62rem !important; margin: 0 !important; }
  .panel[data-step="6"] .contact-line {
    font-size: 0.875rem;
    line-height: 1.2 !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
  }
  .panel[data-step="6"] .diploma .seal-portrait {
    width: 36px !important;
    height: 36px !important;
    margin-bottom: 0.1rem !important;
  }
  .panel[data-step="6"] .diploma {
    padding: 0.15rem 0.3rem !important;
    margin-bottom: 0.15rem !important;
    gap: 0.1rem !important;
  }
  .panel[data-step="6"] .form-chat,
  .panel[data-step="6"] .form {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    gap: 0.2rem !important;
  }
  .panel[data-step="6"] .contact-box {
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .panel[data-step="6"] .cq-step input,
  .panel[data-step="6"] .cq-step textarea,
  .panel[data-step="6"] .field input,
  .panel[data-step="6"] .field textarea {
    font-size: 0.78rem !important;
    padding: 0.3rem 0.45rem !important;
  }
  .panel[data-step="6"] .cq-step textarea,
  .panel[data-step="6"] .field textarea {
    min-height: 2rem !important;
    max-height: 2.6rem !important;
  }
  .panel[data-step="6"] .chat-prompt {
    font-size: 0.78rem !important;
    padding: 0.25rem 0.4rem !important;
    margin: 0 0 0.15rem !important;
  }
  .panel[data-step="6"] .chat-progress { margin-bottom: 0.15rem !important; }
  .panel[data-step="6"] .chat-actions {
    gap: 0.25rem !important;
  }
  .panel[data-step="6"] .chat-actions .btn,
  .panel[data-step="6"] .chat-actions #chat-next {
    min-height: 1.85rem !important;
    padding: 0.28rem 0.6rem !important;
    font-size: 0.75rem !important;
  }
  .panel[data-step="6"] .form-status { font-size: 0.65rem !important; margin: 0 !important; }
}


@media (min-width: 501px) and (max-width: 760px) and (max-height: 559px) {
  .panel[data-step="6"] .contact-copy .btn-li { display: none !important; }
  .panel[data-step="6"] .diploma .seal-portrait { display: none !important; }
}

/* 2-col narrow tall: must beat the 501-760 single-col !important rules */
@media (min-width: 501px) and (max-width: 760px) and (min-height: 640px) {
  .panel[data-step="6"] .contact-box .ab-inner.contact-grid,
  .panel[data-step="6"] .contact-box .ab-inner,
  .panel[data-step="6"] .contact-grid {
    display: grid !important;
    grid-template-columns: minmax(120px, 0.85fr) minmax(160px, 1.25fr) !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    height: 100% !important;
    gap: 0.35rem 0.65rem !important;
    align-items: stretch !important;
    flex-direction: unset !important;
  }
  .panel[data-step="6"] .contact-copy {
    grid-column: 1 !important;
    grid-row: 1 !important;
    height: auto !important;
    max-height: 100% !important;
    justify-content: flex-start !important;
    align-self: start !important;
    overflow: hidden !important;
  }
  .panel[data-step="6"] .form,
  .panel[data-step="6"] .form-chat,
  .panel[data-step="6"] .composer {
    grid-column: 2 !important;
    grid-row: 1 / -1 !important;
    min-height: 0 !important;
    align-self: stretch !important;
    overflow: hidden !important;
    height: auto !important;
  }
  .panel[data-step="6"] .contact-actions.nav-lesson {
    grid-column: 1 !important;
    grid-row: 2 !important;
    margin-top: 0.35rem !important;
    background: none !important;
    width: auto !important;
  }
  .panel[data-step="6"] .form-chat {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
  }
  .concept-b .contact-copy .btn-li {
    margin-top: 0.35rem !important;
  }
  .panel[data-step="6"] .contact-copy .btn-li {
    position: relative;
    z-index: 2;
  }
}

/* Assert floor: body copy on fit devices must stay >=13.5px */
@media (min-width: 501px) {
  .panel[data-step="6"] .contact-line,
  .panel[data-step="6"] .contact-copy p:not(.speech-text):not(.note-label):not(.note-name):not(.note-email):not(.note-msg),
  .lede, .mission-body, .builds-intro, .metric-note {
    font-size: max(0.875rem, 13.5px) !important;
  }
}

/* Short fit: stop flex-centering from spilling kids outside .lesson (lesson-clip) */
@media (min-width: 501px) and (max-height: 480px) {
  .panel.active {
    justify-content: flex-start !important;
    overflow: hidden !important;
  }
  .eyebrow { margin-bottom: 0.15rem !important; font-size: 0.62rem !important; }
  .panel[data-step="1"] h2 {
    font-size: clamp(1.25rem, 2.8vw + 0.6vh, 1.85rem) !important;
    margin-bottom: 0.2rem !important;
  }
  .panel[data-step="1"] .lede {
    font-size: 0.875rem !important;
    margin-bottom: 0.35rem !important;
  }
  .panel[data-step="1"] .choice {
    padding: 0.35rem 0.65rem !important;
  }
  .panel[data-step="1"] .choice .d {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    font-size: 0.8rem !important;
  }
  .panel[data-step="1"] .feedback {
    max-height: 2.4rem !important;
    overflow: hidden !important;
    font-size: 0.8rem !important;
    margin: 0.35rem 0 !important;
    padding: 0.35rem 0.55rem !important;
  }
  .panel[data-step="1"] .nav-lesson {
    margin-top: auto !important;
    padding-top: 0.25rem !important;
  }
  .panel[data-step="0"] h1 {
    font-size: clamp(1.6rem, 3.5vw + 0.8vh, 2.4rem) !important;
  }
  .panel[data-step="0"] .lede {
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

