
  :root {
    --bg: #f7f5f0;
    --surface: #ffffff;
    --surface-2: #f0ede5;
    --border: #e2dfd6;
    --text: #1b2230;
    --text-soft: #5a6072;
    --module: #2b59c3;
    --module-soft: #e4ecfb;
    --safer: #1f7a4d;
    --safer-soft: #e3f2ea;
    --caution: #b56b00;
    --caution-soft: #fbf0dc;
    --risky: #a93232;
    --risky-soft: #f8e6e3;
    --focus: var(--module);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(20,28,46,0.04), 0 8px 24px rgba(20,28,46,0.06);
    --motion-fast: 160ms;
    --motion-mid: 280ms;
    --base-size: 17px;
  }
  /* Module palettes */
  [data-module="sarcasm_lab"]      { --module: #2b59c3; --module-soft: #e4ecfb; }
  [data-module="read_the_room"]    { --module: #b8651c; --module-soft: #fbeede; }
  [data-module="conversation_gym"] { --module: #166f63; --module-soft: #d8efea; }
  [data-module="repair_coach"]     { --module: #a23862; --module-soft: #f9e3ec; }

  [data-contrast="high"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f0f0f0;
    --border: #000000;
    --text: #000000;
    --text-soft: #1a1a1a;
    --safer: #0f5a36;
  }
  [data-motion="reduced"] * {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, sans-serif;
    font-size: var(--base-size);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }
  /* Column layout so the site footer sits at the bottom even on short pages. */
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  main { flex: 1; width: 100%; }
  .site-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    text-align: center;
    color: var(--text-soft);
    font-size: 0.82rem;
  }
  button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
  }
  button:focus-visible, [tabindex="0"]:focus-visible, select:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
  header.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 5;
    flex-wrap: wrap;
  }
  .brand {
    display: flex;
    align-items: center;
  }
  .brand-logo {
    display: block;
    height: 68px;
    width: auto;
    /* The logo file sits on a white field; multiply keeps it seamless on
       the white topbar and on any tinted surface behind it. */
    mix-blend-mode: multiply;
  }
  .module-pill {
    background: var(--module-soft);
    color: var(--module);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
  }
  .picker {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 500;
  }
  .topbar-spacer { flex: 1; }
  .icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--motion-fast), border-color var(--motion-fast);
  }
  .icon-btn:hover { background: var(--surface-2); border-color: var(--text-soft); }

  main {
    max-width: 1080px;
    margin: 24px auto 80px;
    padding: 0 24px;
  }

  .prelude-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
  }
  .prelude-label {
    color: var(--text-soft);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 12px;
  }
  .prelude-skill {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0 0 16px;
    line-height: 1.3;
  }
  .rule-card {
    position: relative;
    background: var(--surface-2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
    padding: 15px 18px;
    margin: 40px 0 16px;
  }
  .difficulty-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0 24px;
  }
  .difficulty-chip {
    background: var(--surface-2);
    color: var(--text-soft);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 500;
  }
  .difficulty-chip.active {
    background: var(--module);
    color: white;
  }

  .scene-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    margin-top: 8px;
  }
  @media (max-width: 820px) {
    .scene-grid { grid-template-columns: 1fr; }
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
  }
  /* Folder-tab card grammar: the label sits in a small colored tab on the
     card's top edge; the card keeps a square top-left corner so they merge. */
  .card-tab {
    position: absolute;
    bottom: 100%;
    left: 16px;
    margin: 0;
    color: white;
    background: var(--module);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 13px 3px;
    border-radius: 8px 8px 0 0;
    line-height: 1.5;
    white-space: nowrap;
  }
  .card h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.005em;
  }
  .card h3 {
    margin: 0 0 10px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-soft);
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .scene-image-wrap {
    margin: 0 0 18px;
    padding: 0;
  }
  .scene-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: block;
  }
  .scene-image-note {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 6px;
    font-style: italic;
  }
  .scene-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
  }
  .speaker-line {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 16px;
  }
  .speaker-line .who {
    font-size: 0.82rem;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 4px;
  }
  .speaker-line .line {
    font-style: italic;
    font-size: 1.05rem;
  }
  .audio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.88rem;
    color: var(--text-soft);
  }
  .audio-btn {
    background: var(--module-soft);
    color: var(--module);
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.85rem;
  }
  .audio-btn:hover { filter: brightness(0.96); }
  .audio-caption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-soft);
    display: none;
  }
  [data-captions="on"] .audio-caption { display: block; }

  .cue-list { display: flex; flex-direction: column; gap: 10px; }
  .cue {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
  }
  .cue-tag {
    flex: 0 0 auto;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    height: max-content;
    border: 1px solid var(--border);
  }
  .cue-body { font-size: 0.95rem; }
  .cue-uncertain { color: var(--caution); font-size: 0.82rem; margin-top: 2px; }

  .choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
  }
  .choice {
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    color: var(--text);
    transition: border-color var(--motion-fast), background var(--motion-fast), transform var(--motion-fast);
    display: flex;
    gap: 12px;
    align-items: flex-start;
  }
  .choice:hover { border-color: var(--module); background: var(--module-soft); }
  .choice:active { transform: scale(0.998); }
  .choice .label {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
  }
  .choice .text { flex: 1; font-size: 1.02rem; line-height: 1.45; }
  .choice.unsure {
    background: transparent;
    border-style: dashed;
    color: var(--text-soft);
  }
  .choice.unsure:hover { background: var(--surface-2); }
  .choice.unsure .label { background: transparent; border: 1.5px dashed var(--text-soft); }

  .reaction-card {
    position: relative;
    margin-top: 46px;
    padding: 20px 22px;
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    box-shadow: var(--shadow);
  }
  .reaction-card .card-tab { background: var(--text-soft); }
  .reaction-card.safer .card-tab { background: var(--safer); }
  .reaction-card.risky .card-tab { background: var(--risky); }
  .reaction-card.caution .card-tab { background: var(--caution); }

  .coach-card {
    margin-top: 20px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .coach-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
  }
  .coach-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--module);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.92rem;
  }
  .coach-name { font-weight: 700; }
  .coach-tag {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-soft);
    background: var(--surface-2);
    padding: 3px 10px;
    border-radius: 999px;
  }
  .coach-section {
    margin: 12px 0;
    padding: 14px 16px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
  }
  .coach-section-label {
    font-size: 0.78rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 6px;
  }
  .coach-section.safer { background: var(--safer-soft); }
  .coach-section.safer .coach-section-label { color: var(--safer); }
  .coach-section.caution { background: var(--caution-soft); }
  .coach-section.caution .coach-section-label { color: var(--caution); }

  .repair-card {
    position: relative;
    margin-top: 46px;
    padding: 20px 22px;
    background: var(--safer-soft);
    border: 1px solid #c4dfd0;
    border-radius: 0 var(--radius) var(--radius) var(--radius);
  }
  .repair-card h3.card-tab { background: var(--safer); }
  .repair-script {
    background: var(--surface);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-style: italic;
    font-size: 1.04rem;
  }
  .repair-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

  .mission-card {
    position: relative;
    margin-top: 46px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    box-shadow: var(--shadow);
  }
  .mission-body { font-size: 1.02rem; }
  .mission-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

  .progress-card {
    margin-top: 20px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .skill-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .skill-row:last-child { border-bottom: none; }
  .skill-name { flex: 1; font-weight: 500; }
  .skill-meter {
    flex: 0 0 140px;
    height: 8px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
  }
  .skill-fill {
    height: 100%;
    background: var(--safer);
    transition: width var(--motion-mid);
  }
  .skill-delta {
    flex: 0 0 auto;
    font-size: 0.82rem;
    color: var(--safer);
    font-weight: 600;
  }
  .skill-delta.neutral { color: var(--text-soft); }

  .saved-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: white;
    background: var(--module);
    border-radius: 999px;
    vertical-align: middle;
  }
  .saved-badge[hidden] { display: none; }
  .saved-section { margin-top: 22px; }
  .saved-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    font-weight: 700;
    margin: 0 0 10px;
  }
  .saved-item {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
  }
  .saved-item-meta {
    font-size: 0.78rem;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 8px;
  }
  .saved-item-body { font-size: 0.98rem; }
  .saved-item-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
  .saved-empty {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 0.95rem;
  }
  .link-btn {
    background: transparent;
    border: none;
    color: var(--module);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .link-btn:hover { filter: brightness(0.9); }
  .link-btn.danger { color: var(--risky); }

  .primary-btn {
    background: var(--module);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 22px;
    font-weight: 600;
    font-size: 0.98rem;
    transition: filter var(--motion-fast), transform var(--motion-fast);
  }
  .primary-btn:hover { filter: brightness(0.92); }
  .primary-btn:active { transform: scale(0.99); }
  .secondary-btn {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 20px;
    font-weight: 600;
    font-size: 0.94rem;
  }
  .secondary-btn:hover { background: var(--surface-2); border-color: var(--text-soft); }
  .ghost-btn {
    background: transparent;
    color: var(--text-soft);
    border: none;
    padding: 8px 12px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .ghost-btn:hover { color: var(--text); }

  .button-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
  }

  .stage { display: none; }
  .stage.active { display: block; animation: fade var(--motion-mid) ease-out; }
  @keyframes fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity var(--motion-fast);
    pointer-events: none;
  }
  .toast.show { opacity: 1; }

  .drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.18);
    display: none;
    z-index: 20;
  }
  .drawer-mask.open { display: block; }
  .drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(380px, 90vw);
    background: var(--surface);
    box-shadow: -8px 0 32px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform var(--motion-mid);
    z-index: 21;
    padding: 24px;
    overflow-y: auto;
  }
  .drawer.open { transform: translateX(0); }
  .drawer h2 { margin-top: 0; font-size: 1.1rem; }
  .drawer .field {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .drawer .field:last-child { border-bottom: none; }
  .drawer label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .drawer .field-desc {
    font-size: 0.84rem;
    color: var(--text-soft);
    margin-top: 4px;
  }
  .switch {
    width: 42px;
    height: 24px;
    background: var(--border);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background var(--motion-fast);
    flex-shrink: 0;
  }
  .switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--motion-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  }
  .switch.on { background: var(--module); }
  .switch.on::after { transform: translateX(18px); }

  .footer-note {
    margin-top: 40px;
    padding: 16px 20px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-soft);
    text-align: center;
  }
  .footer-note strong { color: var(--text); }

  .stage-indicator {
    display: flex;
    gap: 6px;
    margin: 20px 0 4px;
  }
  .step-dot {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    transition: background var(--motion-mid);
  }
  .step-dot.done { background: var(--safer); }
  .step-dot.current { background: var(--module); }

  /* -------- Baseline test mode -------- */
  .baseline-btn {
    border-color: var(--module);
    color: var(--module);
    font-weight: 600;
  }
  body[data-mode="baseline"] .baseline-btn {
    background: var(--module);
    color: white;
    border-color: var(--module);
  }
  body[data-mode="baseline"] .baseline-btn::before {
    content: "● ";
    font-size: 0.7em;
  }
  .test-banner {
    margin: 16px 0 4px;
    padding: 14px 18px;
    background: var(--module-soft);
    border-radius: var(--radius);
    border: 1px solid var(--module);
    display: none;
    align-items: center;
    gap: 14px;
  }
  body[data-mode="baseline"] .test-banner { display: flex; }
  .test-banner-label {
    font-weight: 700;
    color: var(--module);
    font-size: 0.92rem;
  }
  .test-banner-progress {
    flex: 1;
    color: var(--text-soft);
    font-size: 0.88rem;
  }
  .test-banner-exit {
    background: transparent;
    border: 1px solid var(--module);
    color: var(--module);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 600;
  }

  .confidence-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
    margin-top: 20px;
  }
  .confidence-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 16px;
  }
  @media (max-width: 640px) {
    .confidence-row { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  }
  .confidence-btn {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--motion-fast), background var(--motion-fast);
  }
  .confidence-btn:hover { border-color: var(--module); background: var(--module-soft); }
  .confidence-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--module);
    line-height: 1;
  }
  .confidence-label {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 6px;
  }

  .results-summary {
    margin-top: 20px;
  }
  .results-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .results-row:last-child { border-bottom: none; }
  .results-scenario { font-weight: 500; }
  .results-scenario-sub { font-size: 0.82rem; color: var(--text-soft); margin-top: 2px; }
  .results-tone {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
  }
  .results-tone.safer { background: var(--safer-soft); color: var(--safer); }
  .results-tone.caution { background: var(--caution-soft); color: var(--caution); }
  .results-tone.risky { background: var(--risky-soft); color: var(--risky); }
  .results-tone.unsure { background: var(--surface-2); color: var(--text-soft); }
  .results-confidence {
    font-size: 0.85rem;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
  }
  .recommend-card {
    margin-top: 18px;
    padding: 16px 18px;
    background: var(--module-soft);
    border-radius: var(--radius-sm);
  }
  .recommend-card h4 {
    margin: 0 0 8px;
    color: var(--module);
    font-size: 0.95rem;
  }

  /* -------- Home link + home screen -------- */
  .nav-link {
    background: transparent;
    border: none;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast);
  }
  .nav-link:hover { background: var(--surface-2); color: var(--text); }
  /* Home is an anchor (it leaves the app for the intro page); match the buttons. */
  a.nav-link { text-decoration: none; display: inline-block; }
  /* Groups lay out with the same gap as the bar itself, so desktop looks
     unchanged; on small screens each group becomes its own tidy row. */
  .topbar-nav, .topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  /* When the bar needs two rows on mid-width screens, the actions row
     hugs the right edge instead of dangling at the left. */
  .topbar-actions { margin-left: auto; }
  @media (max-width: 760px) {
    .topbar { padding: 10px 14px 12px; gap: 8px 10px; }
    .brand { width: 100%; justify-content: center; }
    .brand-logo { height: 52px; }
    .topbar-nav {
      width: 100%;
      justify-content: center;
      gap: 4px;
    }
    .nav-link { padding: 6px 14px; }
    .topbar-spacer { display: none; }
    .topbar-actions {
      width: 100%;
      justify-content: center;
      flex-wrap: wrap;
      gap: 8px;
    }
    .icon-btn { font-size: 0.82rem; padding: 7px 11px; }
    /* On scenario pages the module pill and picker share one row. */
    .module-pill { flex-shrink: 0; }
    .picker { flex: 1; min-width: 0; }
  }

  /* Gentle staged arrival on a cold load of the practice gallery, matching
     the intro page's entrance. body.entering is added at init only when
     motion is allowed, and removed once the stagger has finished. */
  @keyframes gallery-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  body.entering .home-hero h1,
  body.entering .home-hero p,
  body.entering .home-module-card,
  body.entering .home-baseline,
  body.entering .home-image-note {
    animation: gallery-rise 900ms cubic-bezier(0.22, 0.7, 0.3, 1) both;
  }
  body.entering .home-hero p { animation-delay: 120ms; }
  body.entering .home-module-card:nth-child(1) { animation-delay: 220ms; }
  body.entering .home-module-card:nth-child(2) { animation-delay: 320ms; }
  body.entering .home-module-card:nth-child(3) { animation-delay: 420ms; }
  body.entering .home-module-card:nth-child(4) { animation-delay: 520ms; }
  body.entering .home-baseline { animation-delay: 640ms; }
  body.entering .home-image-note { animation-delay: 720ms; }

  .home-hero { padding: 16px 0 4px; }
  .home-hero h1 {
    font-size: 1.8rem;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }
  .home-hero p {
    color: var(--text-soft);
    font-size: 1.05rem;
    margin: 0;
    max-width: 620px;
  }
  .home-modules {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-top: 24px;
  }
  @media (max-width: 720px) { .home-modules { grid-template-columns: 1fr; } }
  .home-module-card {
    position: relative;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 0;
    margin-top: 25px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform var(--motion-fast), box-shadow var(--motion-fast);
  }
  .home-module-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,28,46,0.1); }
  .home-module-card[data-module-start="sarcasm_lab"] .card-tab { background: #2b59c3; }
  .home-module-card[data-module-start="read_the_room"] .card-tab { background: #b8651c; }
  .home-module-card[data-module-start="conversation_gym"] .card-tab { background: #166f63; }
  .home-module-card[data-module-start="repair_coach"] .card-tab { background: #a23862; }
  .home-module-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: var(--surface-2);
    border-radius: 0 calc(var(--radius) - 1px) 0 0;
  }
  .home-module-body { padding: 14px 18px 16px; }
  .home-module-teaser { color: var(--text); font-size: 0.97rem; font-style: italic; margin-bottom: 5px; }
  .home-module-desc { color: var(--text-soft); font-size: 0.88rem; line-height: 1.5; font-weight: 500; }
  .home-module-pill {
    display: inline-block;
    margin-top: 10px;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
  }
  .home-module-card[data-module-start="sarcasm_lab"] .home-module-pill { background: #e4ecfb; color: #2b59c3; }
  .home-module-card[data-module-start="read_the_room"] .home-module-pill { background: #fbeede; color: #b8651c; }
  .home-module-card[data-module-start="conversation_gym"] .home-module-pill { background: #d8efea; color: #166f63; }
  .home-module-card[data-module-start="repair_coach"] .home-module-pill { background: #f9e3ec; color: #a23862; }
  .home-image-note {
    margin-top: 12px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-style: italic;
  }
  .home-baseline {
    margin-top: 22px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
  }
  .home-baseline-title { font-weight: 600; }
  .home-baseline-desc { color: var(--text-soft); font-size: 0.9rem; }
  .home-baseline-spacer { flex: 1; }

  /* -------- Multi-turn flow (conversations across several steps) -------- */
  body[data-flow="multi"] #speaker-line,
  body[data-flow="multi"] .audio-row,
  body[data-flow="multi"] #audio-caption,
  body[data-flow="multi"] .scene-grid > aside,
  body[data-flow="multi"] #coach-retry { display: none; }
  body[data-flow="multi"] .scene-grid { grid-template-columns: 1fr; }
  .scene-context {
    display: block;
    color: var(--text-soft);
    margin-bottom: 12px;
    font-size: 1rem;
  }
  .turn-note {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--module-soft);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    color: var(--text);
  }
  /* Back / Next navigation for multi-turn scenarios */
  #turn-nav { display: none; }
  body[data-flow="multi"] #turn-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
  }
  /* Guided multi-turn uses "Try another choice"; the manual back button is unused. */
  #reaction-back { display: none; }
  .secondary-btn:disabled,
  .secondary-btn:disabled:hover {
    opacity: 0.4;
    cursor: default;
    background: transparent;
    border-color: var(--border);
  }
  .choice.prev-pick {
    border-color: var(--module);
    background: var(--module-soft);
  }
  .choice.prev-pick .label {
    background: var(--module);
    color: white;
  }
  .choice.tried { opacity: 0.5; }
