/* ═══════════════════════════════════════════════════════════
   convo.css — the conversational lesson surface

   Design rule that runs through this whole file:
   handwriting carries PERSONALITY (Fred's voice, goals,
   encouragement, margin notes). Quoted SPEECH — model answers,
   example expressions, interview dialogue — is set in a serif
   voice (Lora italic) so it reads like a person talking, not
   chat output. Interactive controls — options, dropdowns, chips
   — stay in a clean, high-legibility face. Learners must read
   business English accurately; a script font would cost them
   spelling.
   ═══════════════════════════════════════════════════════════ */

/* Every other course sets this in its own stylesheet. Without it
   the padded dashboard rows measure wider than the phone screen
   and the page scrolls sideways. */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }

:root {
  --cv-bg:        #08080a;
  --cv-ink:       #e6e2da;   /* body text            */
  --cv-ink-soft:  #a8a29a;   /* secondary text       */
  --cv-hand:      #fcd34d;   /* Fred's handwriting   */
  --cv-gold:      #f59e0b;
  --cv-gold-ink:  #1a1205;
  --cv-good:      #34d399;
  --cv-bad:       #f87171;
  --cv-line:      rgba(255, 255, 255, .09);
  --cv-panel:     rgba(255, 255, 255, .035);
  --font-hand:    'Patrick Hand', 'Comic Sans MS', 'Segoe Print', cursive;
  --font-clean:   'Atkinson Hyperlegible', 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Sora', var(--font-clean);
  --font-voice:   'Lora', Georgia, 'Times New Roman', serif;
}

/* ── Shell ─────────────────────────────────────────────── */
.cv-screen {
  position: fixed;
  inset: 0;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* tracks the real visible viewport — the URL bar
                      must never cover the bottom of the lesson */
  background: var(--cv-bg);
  display: none;
  flex-direction: column;
  z-index: 60;
}
.cv-screen.is-open { display: flex; }

.cv-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--cv-line);
  background: rgba(8, 8, 10, .96);
}
.cv-back {
  flex: 0 0 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 9px;
  border: 1px solid var(--cv-line);
  border-radius: 9px;
  background: transparent;
  color: var(--cv-ink-soft);
  font: 600 .84rem/1 var(--font-clean);
  cursor: pointer;
}
.cv-back:hover { color: var(--cv-ink); border-color: rgba(251, 191, 36, .4); }

.cv-top-mid { flex: 1 1 auto; min-width: 0; }
.cv-top-mid strong {
  display: block;
  font: 700 .9rem/1.25 var(--font-display);
  color: var(--cv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-top-mid span {
  display: block;
  font: 500 .72rem/1.3 var(--font-clean);
  color: var(--cv-ink-soft);
}

/* Author preview flag (#preview in the URL): small amber chip in
   the lesson top bar — this session writes no progress. */
.cv-top-mid .cv-preview-flag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border: 1px solid rgba(251, 191, 36, .55);
  border-radius: 4px;
  color: rgb(252, 211, 77);
  font: 700 .62rem/1.4 var(--font-clean);
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Speed + sound toggles. Non-negotiable: 101 lessons of forced typing
   animation would drive away exactly the learners who care most. */
.cv-speed, .cv-sound {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--cv-line);
  border-radius: 9px;
  background: transparent;
  color: var(--cv-ink-soft);
  font: 600 .76rem/1 var(--font-clean);
  cursor: pointer;
  white-space: nowrap;
}
.cv-speed:hover, .cv-sound:hover { color: var(--cv-hand); border-color: rgba(251, 191, 36, .45); }

/* Back to the previous question. Styled like the speed toggle;
   disabled until there is something to go back to. */
.cv-prev {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--cv-line);
  border-radius: 9px;
  background: transparent;
  color: var(--cv-ink-soft);
  font: 600 .76rem/1 var(--font-clean);
  cursor: pointer;
  white-space: nowrap;
}
.cv-prev:hover:not(:disabled) { color: var(--cv-hand); border-color: rgba(251, 191, 36, .45); }
.cv-prev:disabled { opacity: .4; cursor: default; }

/* ── Transcript ────────────────────────────────────────── */
/* Deliberately never cleared. Learners scroll back to re-read an
   explanation constantly, and wiping the screen destroys that.
   The stream is the only scroller while a lesson is open — the
   page behind stays locked so nothing scrolls invisibly. */
.cv-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Never leak a swipe into the page behind the lesson screen —
     chained scrolling there is invisible and feels like a freeze. */
  overscroll-behavior: contain;
  /* Keep the last line clear of the iPhone home indicator. */
  padding: 20px 16px max(32px, env(safe-area-inset-bottom, 0px));
}
/* Scroll tail: when fully scrolled down, the current question always
   ends well above any browser UI, on every mobile browser. */
.cv-stream::after { content: ""; display: block; height: 64px; }
.cv-inner { max-width: 660px; margin: 0 auto; }

/* One vertical rhythm for the whole lesson: every beat sits exactly
   12px below the previous one. Boxes, tables, flows and sort pools
   carry no extra top margin — the beat wrapper owns all spacing. */
.cv-beat { margin: 0 0 12px; animation: cv-rise .5s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes cv-rise {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

/* Fred's handwriting — Patrick Hand: a print-style handwriting face
   chosen for legibility (learners must decode every word), unbolded,
   in a paler gold so it sits lighter on the black. Never bold it;
   synthetic bolding is what made it muddy. */
.cv-hand-line {
  font: 400 1.35rem/1.35 var(--font-hand);
  color: #fde68a;
  letter-spacing: .2px;
}

/* Teaching text */
.cv-say {
  font: 400 .92rem/1.58 var(--font-clean);
  color: var(--cv-ink);
}
.cv-say strong { font-weight: 700; color: #fff; }
.cv-say em { font-style: italic; color: var(--cv-ink-soft); }

/* Blinking pen cursor while a line is being written */
.cv-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -.14em;
  background: var(--cv-hand);
  animation: cv-blink 1s steps(1) infinite;
}
@keyframes cv-blink { 50% { opacity: 0; } }

/* ── Example blocks (always clean font) ────────────────── */
.cv-box {
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--cv-line);
  border-left: 3px solid rgba(251, 191, 36, .5);
  border-radius: 10px;
  background: var(--cv-panel);
}
.cv-ex {
  /* Quoted model language: serif italic "voice" so it reads as
     spoken English, not AI output. Slightly larger than body text
     because this is the language the learner is here to absorb. */
  font: italic 400 1rem/1.6 var(--font-voice);
  color: var(--cv-ink);
}
.cv-ex + .cv-ex { margin-top: 7px; }
.cv-ex b { font-weight: 700; color: #fff; }
.cv-ex .cv-mark { font-weight: 700; margin-right: 7px; }
.cv-ex.good .cv-mark { color: var(--cv-good); }
.cv-ex.bad  .cv-mark { color: var(--cv-bad); }
.cv-ex.bad  { color: var(--cv-ink-soft); }
.cv-ex-note {
  display: block;
  margin-top: 3px;
  font: 400 .82rem/1.45 var(--font-clean);
  color: var(--cv-ink-soft);
}

/* ── Goals, written one line at a time with a drawn tick ── */
.cv-goals { margin: 0; padding: 0; list-style: none; }
.cv-goals li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
  font: 400 1.2rem/1.4 var(--font-hand);
  color: #fde68a;
  animation: cv-rise .3s ease both;
}
.cv-goals svg { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 5px; }
.cv-goals svg path {
  stroke: var(--cv-good);
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: cv-draw .42s .12s ease forwards;
}
@keyframes cv-draw { to { stroke-dashoffset: 0; } }

/* ── Learner controls ──────────────────────────────────── */
.cv-prompt {
  margin: 0 0 9px;
  font: 600 .93rem/1.5 var(--font-display);
  color: #fff;
}

/* Section headings (recap categories, etc.) - distinct from question prompts */
.cv-section-head {
  margin: 18px 0 8px;
  font: 700 1rem/1.4 var(--font-clean);
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #93c5fd;
}
.cv-section-head::before {
  content: "\25A0";
  display: inline-block;
  margin-right: 8px;
  font-size: .6rem;
  vertical-align: middle;
  color: #93c5fd;
}
.cv-beat:first-child .cv-section-head { margin-top: 0; }
.cv-opts { display: flex; flex-direction: column; gap: 7px; }

/* ── Question card ─────────────────────────────────────── */
/* Modern dark-quiz pattern: a neutral elevated surface with gold
   reserved for the eyebrow tag and interaction states, so the card
   reads as a container and the question stays the brightest element. */
.cv-qa {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: #111118;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
}
/* Inside the card, secondary context (extra instructions, dialogue
   continuation) stays quiet. The situation that sets the scene is a
   blue header — the first thing the learner reads, before the white
   question — clearly a different role, never gold. */
.cv-qa .cv-say { font: 400 .92rem/1.6 var(--font-clean); color: #c6c1b8; }
.cv-qa .cv-say strong { font-weight: 700; color: #fff; }
.cv-qa .cv-say-scene {
  margin: 0 0 13px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(96, 165, 250, .09);
  border-left: 3px solid rgba(96, 165, 250, .6);
  font: 500 1rem/1.5 var(--font-clean);
  color: #93c5fd;
}
.cv-qa .cv-say-scene strong { color: #bfdbfe; }
.cv-qa .cv-say-q { font-family: var(--font-display); font-size: 1.02rem; font-weight: 650; color: #fff; }
.cv-qa .cv-prompt { font-family: var(--font-display); font-size: 1.02rem; font-weight: 650; color: #fff; }

/* The final screen: two deliberate actions, styled as a pair —
   the primary completion in green, the jump onward as a quiet
   secondary. Centered text: these are actions, not answers. */
.cv-end-opts { gap: 9px; }
.cv-end-opts .cv-opt {
  text-align: center;
  font-weight: 650;
}
.cv-end-opts .cv-end-done {
  border-color: rgba(52, 211, 153, .55);
  background: rgba(52, 211, 153, .12);
  color: #6ee7b7;
}
.cv-end-opts .cv-end-done:hover:not(:disabled) {
  background: rgba(52, 211, 153, .22);
  border-color: rgba(52, 211, 153, .8);
}
.cv-end-opts .cv-end-next {
  border-color: rgba(252, 211, 77, .45);
  background: rgba(252, 211, 77, .08);
  color: #fde68a;
}
.cv-end-opts .cv-end-next:hover:not(:disabled) {
  background: rgba(252, 211, 77, .16);
  border-color: rgba(252, 211, 77, .7);
}
.cv-end-opts .cv-opt.is-chosen { opacity: .55; }

.cv-opt {
  width: 100%;
  text-align: left;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  color: var(--cv-ink);
  font: 500 .9rem/1.45 var(--font-clean);
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .14s;
}
/* Options inside question cards (quiz choices) carry the answer in a
   single tap — one step up from the compact base so they read first. */
.cv-qa .cv-opt { font-size: 1rem; }
.cv-opt:hover:not(:disabled) {
  background: rgba(252, 211, 77, .07);
  border-color: rgba(252, 211, 77, .55);
  transform: translateX(2px);
}
.cv-opt:disabled { cursor: default; opacity: .5; }
.cv-opt.is-picked  { opacity: 1; }
/* Opinion answers and profile answers have no right or wrong, so they
   are marked in gold. Green and red are reserved for scored questions,
   otherwise a green tick on "it looks fine to me" teaches the wrong thing. */
.cv-opt.is-chosen {
  border-color: rgba(251, 191, 36, .85);
  background: rgba(251, 191, 36, .16);
  color: #fff;
}
.cv-opt.is-correct {
  border-color: var(--cv-good);
  background: rgba(52, 211, 153, .16);
  color: var(--cv-good);
}
.cv-opt.is-correct::before { content: "\2713\00a0"; font-weight: 700; }
.cv-opt.is-wrong {
  border-color: var(--cv-bad);
  background: rgba(248, 113, 113, .16);
  color: var(--cv-bad);
}
.cv-opt.is-wrong::before { content: "\2717\00a0"; font-weight: 700; }
.cv-opt .cv-opt-tag { font-weight: 700; margin-right: 7px; color: var(--cv-hand); }

/* Fred's answer to the option chosen — OUTSIDE the card, joined to
   it by a short vertical line, in Fred's handwriting so a far-away
   scan separates the teacher's voice (gold script) from the question
   (white print). Bold target language inside the feedback stays in
   the clean face: a script font would cost spelling accuracy. */
.cv-reply {
  margin: 2px 0 14px 18px;
  padding: 2px 0 2px 15px;
  border-left: 2px solid rgba(252, 211, 77, .5);
}
.cv-reply .cv-say {
  font: 400 1.18rem/1.45 var(--font-hand);
  color: #fde68a;
}
.cv-reply .cv-say strong {
  /* The target expression: clean print on a solid gold chip (dark
     ink on gold, like a highlighter), so the learner can scan the
     explanation and land on the language being taught without
     reading the whole sentence. Amber-on-amber was one flat hue. */
  font: 700 .95rem/1.5 var(--font-clean);
  color: var(--cv-gold-ink);
  background: var(--cv-hand);
  padding: 1px 7px 2px;
  border-radius: 7px;
}
/* The form to AVOID — flagged by "not / never / don't / avoid" — is
   a red chip; the flag word itself is red emphasis, no chip. */
.cv-reply .cv-say strong.cv-no {
  color: #fca5a5;
  background: rgba(248, 113, 113, .14);
}
.cv-reply .cv-say strong.cv-no-word {
  color: #fca5a5;
  background: none;
  padding: 0;
}
/* Green tick / red cross leading each feedback line: the learner
   sees whether the line confirms or corrects before reading it. */
.cv-reply .cv-fb-ok, .cv-reply .cv-fb-no {
  font: 700 1rem/1 var(--font-clean);
  margin-right: 3px;
}
.cv-reply .cv-fb-ok { color: var(--cv-good); }
.cv-reply .cv-fb-no { color: var(--cv-bad); }

/* ── Reorder task ─────────────────────────────────────── */
.cv-order { display: flex; flex-direction: column; gap: 7px; }
.cv-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  background: var(--cv-panel);
  color: var(--cv-ink);
  font: 400 .88rem/1.4 var(--font-clean);
  cursor: grab;
  user-select: none;
}
.cv-chip[draggable="true"]:active { cursor: grabbing; }
.cv-chip.is-drag { opacity: .4; }
.cv-chip.is-over { border-color: var(--cv-hand); }
.cv-chip-num {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(251, 191, 36, .18);
  color: var(--cv-hand);
  font: 700 .76rem/1 var(--font-clean);
}
.cv-chip-move {
  margin-left: auto;
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}
.cv-chip-move button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--cv-line);
  border-radius: 7px;
  background: transparent;
  color: var(--cv-ink-soft);
  font-size: .8rem;
  cursor: pointer;
  line-height: 1;
}
.cv-chip-move button:hover:not(:disabled) { color: var(--cv-hand); border-color: rgba(251,191,36,.45); }
.cv-chip-move button:disabled { opacity: .25; cursor: default; }

/* ── Gap fill ─────────────────────────────────────────── */
.cv-gaps {
  padding: 12px 14px;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  background: var(--cv-panel);
  /* Interview dialogue: serif italic voice, screenplay feel. The
     dropdowns inside stay in the clean face — they are controls. */
  font: italic 400 1rem/2.05 var(--font-voice);
  color: var(--cv-ink);
}
.cv-gap {
  display: inline-block;
  min-width: 92px;
  margin: 0 3px;
  padding: 5px 8px;
  border: 1px solid rgba(251, 191, 36, .45);
  border-radius: 8px;
  background: #12110e;
  color: var(--cv-hand);
  font: 600 .93rem/1.2 var(--font-clean);
  cursor: pointer;
}
.cv-gap.is-correct { border-color: var(--cv-good); color: var(--cv-good); }
.cv-gap.is-wrong   { border-color: var(--cv-bad);  color: var(--cv-bad); }

/* ── Free-text build ──────────────────────────────────── */
.cv-build {
  padding: 15px 16px;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  background: var(--cv-panel);
  font: 400 1.02rem/2.2 var(--font-clean);
  color: var(--cv-ink);
}
.cv-fill {
  display: inline-block;
  min-width: 132px;
  margin: 0 3px;
  padding: 5px 9px;
  border: 0;
  border-bottom: 2px solid rgba(251, 191, 36, .5);
  background: transparent;
  color: var(--cv-hand);
  font: 600 .97rem/1.3 var(--font-clean);
}
.cv-fill:focus { outline: none; border-bottom-color: var(--cv-hand); }
.cv-fill::placeholder { color: rgba(168, 162, 154, .5); font-weight: 400; }

/* ── Primary action ───────────────────────────────────── */
.cv-go {
  margin-top: 12px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #fcd34d, var(--cv-gold));
  color: var(--cv-gold-ink);
  font: 800 .88rem/1 var(--font-clean);
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(245, 158, 11, .3);
}
.cv-go:hover { transform: translateY(-1px); }
.cv-go:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
.cv-go.is-quiet {
  background: transparent;
  border: 1px solid var(--cv-line);
  color: var(--cv-ink-soft);
  box-shadow: none;
  font-weight: 600;
}

/* ── Summary card, drawn as if on paper ───────────────── */
.cv-summary {
  padding: 20px 22px;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 14px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(251, 191, 36, .07), transparent 60%),
    rgba(255, 255, 255, .03);
}
.cv-summary h4 {
  margin: 0 0 10px;
  font: 400 1.3rem/1.25 var(--font-hand);
  color: #fde68a;
}
.cv-summary ol { margin: 0; padding-left: 20px; }
.cv-summary li {
  margin-bottom: 6px;
  font: 400 1.15rem/1.42 var(--font-hand);
  color: #f0e9d8;
}

/* ── Notebook confirmation ────────────────────────────── */
.cv-note-save {
  padding: 14px 16px;
  border: 1px dashed rgba(251, 191, 36, .38);
  border-radius: 10px;
  background: rgba(251, 191, 36, .05);
}
.cv-note-save p {
  margin: 0 0 9px;
  font: 600 .83rem/1.4 var(--font-clean);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cv-hand);
}
.cv-note-save ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.cv-note-save li {
  padding: 6px 11px;
  border: 1px solid var(--cv-line);
  border-radius: 20px;
  background: rgba(0, 0, 0, .3);
  font: 500 .88rem/1.3 var(--font-clean);
  color: var(--cv-ink);
}

/* ── Typing indicator ─────────────────────────────────── */
.cv-dots { display: flex; gap: 5px; padding: 5px 0; }
.cv-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cv-ink-soft);
  animation: cv-bounce 1.1s infinite ease-in-out;
}
.cv-dots i:nth-child(2) { animation-delay: .16s; }
.cv-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes cv-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: .35; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Gold highlight + underline marks ──────────────────── */
/* `text` renders as a gold marker-style highlight; __text__ as an
   underline. Both exist so rules can be anchored visually inside a
   sentence instead of needing a paragraph of explanation. */
.cv-hl {
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(251, 191, 36, .22);
  color: #fde68a;
  font-weight: 600;
}
.cv-say u, .cv-box u { text-decoration-color: rgba(251, 191, 36, .8); text-underline-offset: 3px; }

/* ── Rule table ────────────────────────────────────────── */
.cv-table {
  width: 100%;
  margin: 0;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--cv-panel);
}
.cv-table th, .cv-table td {
  padding: 7px 10px;
  text-align: left;
  font: 400 .86rem/1.45 var(--font-clean);
  color: var(--cv-ink);
  border-bottom: 1px solid var(--cv-line);
  vertical-align: top;
}
.cv-table tr:last-child th, .cv-table tr:last-child td { border-bottom: 0; }
.cv-table th {
  background: rgba(251, 191, 36, .12);
  font: 600 .73rem/1.4 var(--font-clean);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cv-hand);
}
.cv-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }
.cv-table td b { color: #fff; }
.cv-table td .cv-mark { font-weight: 700; margin-right: 6px; }
.cv-table td.good .cv-mark { color: var(--cv-good); }
.cv-table td.bad  .cv-mark { color: var(--cv-bad); }

/* ── Flow: steps joined by arrows ──────────────────────── */
.cv-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  background: var(--cv-panel);
}
.cv-flow-step {
  padding: 6px 11px;
  border: 1px solid rgba(251, 191, 36, .4);
  border-radius: 9px;
  background: rgba(251, 191, 36, .07);
  color: #fde68a;
  font: 500 .84rem/1.35 var(--font-clean);
}
.cv-flow-arrow {
  color: var(--cv-gold);
  font: 700 .92rem/1 var(--font-clean);
  user-select: none;
}

/* ── Sort: categorize items into buckets ───────────────── */
.cv-sort-buckets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 0;
}
.cv-sort-bucket {
  min-height: 64px;
  padding: 10px 11px;
  border: 1px dashed rgba(251, 191, 36, .38);
  border-radius: 10px;
  background: rgba(251, 191, 36, .04);
  transition: border-color .14s, background .14s;
}
.cv-sort-bucket.is-open {
  border-color: rgba(251, 191, 36, .9);
  background: rgba(251, 191, 36, .1);
}
.cv-sort-bucket h5 {
  margin: 0 0 8px;
  font: 600 .72rem/1.3 var(--font-clean);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cv-hand);
}
.cv-sort-bucket .cv-sort-in { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.cv-sort-pool { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cv-sort-pool:empty { display: none; }
.cv-sort-item {
  padding: 6px 10px;
  border: 1px solid rgba(251, 191, 36, .4);
  border-radius: 18px;
  background: rgba(251, 191, 36, .07);
  color: var(--cv-ink);
  font: 500 .84rem/1.3 var(--font-clean);
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .14s;
}
.cv-sort-item:hover { background: rgba(251, 191, 36, .15); }
.cv-sort-item.is-picked {
  border-color: #fde68a;
  background: rgba(251, 191, 36, .22);
  color: #fff;
  transform: translateY(-1px);
}
.cv-sort-item.is-wrong {
  border-color: var(--cv-bad);
  background: rgba(248, 113, 113, .14);
}
.cv-sort-item.is-set { cursor: default; }
.cv-sort-item.is-set.is-correct {
  border-color: var(--cv-good);
  background: rgba(52, 211, 153, .12);
}

/* ── Screens format ─────────────────────────────────────
   Additive styles for the objective screens format: the
   segmented progress bar, the goal header chip and the
   tick cards that gate each screen. Nothing here modifies
   the locked typography or scroll settings. */

/* Segmented progress bar, fixed between the top bar and
   the stream. Each segment doubles as its screen's card counter:
   a yellow fill grows with every answered card (sorted expressions
   count too) and settles at full green when the screen is done. */
.cv-progress {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid var(--cv-line);
}
.cv-progress-seg {
  position: relative;
  flex: 1 1 0;
  height: 18px;
  padding: 6px 0 7px;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, .12);
  background-clip: content-box;
  cursor: pointer;
  overflow: hidden;
  transition: background-color .3s ease, box-shadow .3s ease;
}
.cv-progress-seg:hover { background-color: rgba(255, 255, 255, .3); }
.cv-progress-seg-fill {
  position: absolute;
  top: 6px;
  bottom: 7px;
  left: 0;
  width: 0%;
  border-radius: 3px;
  background: var(--cv-hand);
  transition: width .35s ease, background-color .3s ease;
}
.cv-progress-seg.is-now {
  background-color: rgba(252, 211, 77, .14);
  box-shadow: 0 0 8px rgba(252, 211, 77, .35);
}
.cv-progress-seg.is-done .cv-progress-seg-fill { background: var(--cv-good); }

/* Goal header chip shown at the top of each objective screen. */
.cv-obj-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
  padding: 11px 14px;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 10px;
  background: rgba(251, 191, 36, .07);
}
.cv-obj-tag {
  font: 700 .72rem/1.3 var(--font-display);
  color: var(--cv-hand);
  letter-spacing: .8px;
  text-transform: uppercase;
}

.cv-obj-label {
  font: 600 .95rem/1.45 var(--font-clean);
  color: #fff;
}

/* Tick card gating a screen on "objective achieved". */
.cv-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 20px 18px 22px;
  border: 1px solid rgba(52, 211, 153, .35);
  border-radius: 14px;
  background: rgba(52, 211, 153, .06);
  text-align: center;
}
.cv-gate-tick {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(52, 211, 153, .16);
  border: 2px solid var(--cv-good);
  font: 700 26px/1 var(--font-display);
  color: var(--cv-good);
  animation: cv-pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes cv-pop { from { transform: scale(.4); opacity: 0; } }
.cv-gate-lead {
  margin: 0;
  font: 400 .88rem/1.5 var(--font-clean);
  color: var(--cv-ink-soft);
}
.cv-gate-text {
  margin: 0;
  font: 600 .95rem/1.5 var(--font-clean);
  color: #fff;
}
.cv-gate-btn {
  margin-top: 6px;
  padding: 12px 26px;
  border: none;
  border-radius: 10px;
  background: var(--cv-hand);
  color: var(--cv-gold-ink);
  font: 700 .85rem/1 var(--font-display);
  letter-spacing: .6px;
  cursor: pointer;
}
.cv-gate-btn:hover { filter: brightness(1.08); }

/* ═══ Locked gates, locked screens ═══
   A gate (or the end card's buttons) stays shut while the screen
   above it still owes responses: dimmed, inert, and a tap points
   the learner at the unfinished cards instead of moving on. */
.cv-gate.is-locked .cv-gate-btn {
  background: rgba(255, 255, 255, .1);
  color: var(--cv-ink-soft);
  cursor: not-allowed;
}
.cv-gate.is-locked .cv-gate-btn:hover { filter: none; }
.is-end-locked .cv-opt {
  opacity: .45;
  cursor: not-allowed;
}
.is-end-locked .cv-opt:hover:not(:disabled) {
  background: rgba(255, 255, 255, .03);
  border-color: rgba(255, 255, 255, .11);
  transform: none;
}
.cv-lock-hint {
  margin-top: 10px;
  font: 500 .85rem/1.45 var(--font-clean);
  color: var(--cv-hand);
  text-align: center;
}
/* Stepper segments not yet earned: flat, dim, inert. */
.cv-progress-seg.is-locked {
  background-color: rgba(255, 255, 255, .07);
  cursor: not-allowed;
}
.cv-progress-seg.is-locked:hover { background-color: rgba(255, 255, 255, .07); }

/* ═══ Retake a finished lesson ═══
   A completed lesson reopens as a read-back; this is the way back
   in, at the bottom of each question screen. */
.cv-retake {
  display: block;
  margin: 10px auto 0;
  padding: 12px 24px;
  border: 1px solid rgba(251, 191, 36, .45);
  border-radius: 10px;
  background: rgba(251, 191, 36, .08);
  color: var(--cv-hand);
  font: 700 .8rem/1 var(--font-display);
  letter-spacing: .6px;
  cursor: pointer;
}
.cv-retake:hover { filter: brightness(1.15); }

/* Multi-select picked state (reuses .cv-opt states for check/cross). */
.cv-opt.is-picked {
  border-color: var(--cv-hand);
  background: rgba(251, 191, 36, .16);
}

/* Matching rows: left item + dropdown partner. */
.cv-match { display: flex; flex-direction: column; gap: 8px; }
.cv-match-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--cv-line);
  border-radius: 10px;
  background: var(--cv-panel);
}
.cv-match-item {
  flex: 1 1 auto;
  font: 600 .87rem/1.4 var(--font-clean);
  color: var(--cv-ink);
}
.cv-match-row .cv-gap { flex: 0 0 auto; max-width: 55%; }

/* Related fill-ins stacked one sentence per line. */
.cv-gaps-wrap { display: flex; flex-direction: column; gap: 12px; }

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .cv-stream    { padding: 16px 13px max(28px, env(safe-area-inset-bottom, 0px)); }
  .cv-hand-line { font-size: 1.5rem; }
  .cv-say       { font-size: .89rem; }
  .cv-goals li  { font-size: 1.34rem; }
  .cv-summary li{ font-size: 1.22rem; }
  .cv-gaps, .cv-build { font-size: .89rem; line-height: 2.05; }
  .cv-top-mid span { display: none; }
  .cv-table th, .cv-table td { padding: 6px 8px; font-size: .81rem; }
  .cv-progress  { padding: 8px 13px; gap: 6px; }
  .cv-gate-btn  { padding: 12px 22px; }
}

/* Respect the system setting. Somebody who has asked their OS to
   reduce motion should not be made to watch text type itself. */
@media (prefers-reduced-motion: reduce) {
  .cv-beat, .cv-goals li { animation: none; }
  .cv-goals svg path { animation: none; stroke-dashoffset: 0; }
  .cv-caret { animation: none; }
}

/* ═══ New-format recap: self-assessed phrase bank ═══
   Same card language as the rest of the course: the phrase
   sits in an example line, the two choices reuse .cv-opt.
   Single row per item: phrase on the left, [ I know it ] /
   [ Need practice ] side by side to its right. */
.cv-recap-item {
  margin: 6px 0;
  animation: cv-rise .3s ease both;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cv-recap-item .cv-ex {
  flex: 1 1 auto;
  min-width: 0;
}
.cv-recap-opts {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 0;
}
.cv-recap-opts .cv-opt {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
  text-align: center;
  padding: 7px 12px;
}
/* Very narrow screens: let the row wrap instead of squeezing. */
@media (max-width: 460px) {
  .cv-recap-item { flex-wrap: wrap; }
}

/* ═══ Sorting board ═══
   Two live columns pinned above the card list: expressions the
   learner files as [ I know ] (green) or [ Need practice ] (gold)
   fly into their column as a chip; tapping a chip files the
   expression back into the list. Sticky so the buckets stay in
   view while the list scrolls. */
.cv-recap-board {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  background: #0a0a0c;
  border: .666667px solid var(--cv-line, rgba(255, 255, 255, .09));
  border-radius: 10px;
}
.cv-recap-col {
  min-width: 0;
  border: .666667px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cv-recap-col.is-know { border-color: rgba(74, 222, 128, .28); }
.cv-recap-col.is-practice { border-color: rgba(251, 191, 36, .28); }
.cv-recap-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font: 700 .72rem/1.3 var(--font-display);
  letter-spacing: .8px;
  text-transform: uppercase;
}
.cv-recap-col.is-know .cv-recap-col-head { color: var(--cv-good, #4ade80); }
.cv-recap-col.is-practice .cv-recap-col-head { color: var(--cv-hand, #fcd34d); }
.cv-recap-count {
  font: 700 .72rem/1.3 var(--font-display);
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}
.cv-recap-chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 32vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cv-recap-chip {
  font: 500 .78rem/1.35 var(--font-clean);
  text-align: left;
  color: var(--cv-ink, #e6e2da);
  background: rgba(255, 255, 255, .05);
  border: .666667px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  animation: cv-chip-in .25s ease both;
}
.cv-recap-chip:hover {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .09);
}
@keyframes cv-chip-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
.cv-recap-empty {
  font: 400 .74rem/1.4 var(--font-clean);
  color: rgba(230, 226, 218, .38);
  padding: 2px 4px;
}
/* Narrow screens: stack the two columns. */
@media (max-width: 460px) {
  .cv-recap-board { grid-template-columns: 1fr; }
  .cv-recap-chips { max-height: 22vh; }
}

/* ═══ Transition voice ═══
   "Now let's add your employer.", "Let's try a different workplace
   situation." — connective lines that link one card to the next.
   Third voice on the screen: Caveat handwriting in soft parchment,
   distinct from the teacher's gold Patrick Hand, the blue scene
   headers, and the grey explanation body. Lives OUTSIDE the cards
   (qaCard absorption stops at cv-link). */
.cv-link {
  font: 600 1.1rem/1.45 var(--font-clean);
  color: #cdb992;
  letter-spacing: .01em;
}

/* ═══════════════════════════════════════════════════════════
   Motion & polish — the modern layer.
   Everything here lives inside prefers-reduced-motion:
   no-preference, so a learner who has asked their OS for calm
   keeps the plain, quiet surface the course was built on.
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {

  /* The lesson screen itself opens with a soft fade. */
  .cv-screen.is-open { animation: cv-screen-in .35s ease both; }
  .cv-screen.is-open .cv-top { animation: cv-top-in .45s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes cv-screen-in { from { opacity: 0; } }
  @keyframes cv-top-in { from { opacity: 0; transform: translateY(-12px); } }

  /* Ambient aurora: three very faint colour fields drifting far
     behind the transcript. Pure garnish — z-index -1 keeps it
     under every line of text. */
  .cv-stream::before {
    content: "";
    position: fixed;
    inset: -25%;
    z-index: -1;
    pointer-events: none;
    background:
      radial-gradient(42% 34% at 18% 12%, rgba(251, 191, 36, .055), transparent 70%),
      radial-gradient(36% 30% at 82% 78%, rgba(52, 211, 153, .05), transparent 70%),
      radial-gradient(30% 26% at 68% 18%, rgba(96, 165, 250, .05), transparent 70%);
    animation: cv-aurora 24s ease-in-out infinite alternate;
  }
  @keyframes cv-aurora {
    from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
    to   { transform: translate3d(1.5%, 1.5%, 0) scale(1.07); }
  }

  /* Question cards arrive with weight: a bigger rise than plain
     text beats and a faint gold ambience once they land. */
  .cv-qa {
    animation: cv-card-in .55s cubic-bezier(.22, 1, .36, 1) both;
    background: linear-gradient(180deg, #13131b, #0f0f16);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 0 44px rgba(251, 191, 36, .05);
  }
  @keyframes cv-card-in {
    from { opacity: 0; transform: translateY(26px) scale(.97); }
  }

  /* Options cascade in with a small left-to-right stagger. */
  .cv-opts .cv-opt {
    animation: cv-opt-in .45s cubic-bezier(.22, 1, .36, 1) both;
  }
  .cv-opts .cv-opt:nth-child(2) { animation-delay: .06s; }
  .cv-opts .cv-opt:nth-child(3) { animation-delay: .12s; }
  .cv-opts .cv-opt:nth-child(4) { animation-delay: .18s; }
  .cv-opts .cv-opt:nth-child(5) { animation-delay: .24s; }
  .cv-opts .cv-opt:nth-child(n + 6) { animation-delay: .3s; }
  @keyframes cv-opt-in {
    from { opacity: 0; transform: translateX(-12px); }
  }

  /* Hover: the option lifts instead of nudging sideways. */
  .cv-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  }
  .cv-opt:active:not(:disabled) { transform: translateY(0) scale(.985); }

  /* Right: a green ring ripples out. Wrong: a firm horizontal
     shake. Same treatment for gap dropdowns and sort chips. */
  .cv-opt.is-correct { animation: cv-good-pulse .7s cubic-bezier(.2, .7, .3, 1) both; }
  .cv-gap.is-correct { animation: cv-good-pulse .6s cubic-bezier(.2, .7, .3, 1) both; }
  @keyframes cv-good-pulse {
    from { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
    to   { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  }
  .cv-opt.is-wrong, .cv-gap.is-wrong, .cv-sort-item.is-wrong {
    animation: cv-shake .4s cubic-bezier(.36, .07, .19, .97) both;
  }
  @keyframes cv-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
  }

  /* The green tick / red cross leads its feedback line with a pop. */
  .cv-reply .cv-fb-ok, .cv-reply .cv-fb-no {
    display: inline-block;
    animation: cv-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
  }

  /* Gold check button: a light sheen sweeps across on hover. */
  .cv-go:not(.is-quiet) { position: relative; overflow: hidden; }
  .cv-go:not(.is-quiet)::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -70%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .4), transparent);
    transform: skewX(-18deg);
    transition: left .55s ease;
  }
  .cv-go:not(.is-quiet):hover:not(:disabled)::after { left: 125%; }
  .cv-go:active:not(:disabled) { transform: translateY(0) scale(.97); }

  /* The current progress segment breathes. */
  .cv-progress-seg.is-now { animation: cv-seg-pulse 2.4s ease-in-out infinite; }
  @keyframes cv-seg-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(252, 211, 77, .3); }
    50%      { box-shadow: 0 0 16px rgba(252, 211, 77, .8); }
  }

  /* Celebration cards: the tick pops, plus a ring that keeps
     radiating while the learner decides to move on. */
  .cv-gate { animation: cv-gate-in .5s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes cv-gate-in { from { opacity: 0; transform: scale(.94); } }
  .cv-gate-tick { position: relative; }
  .cv-gate-tick::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid rgba(52, 211, 153, .55);
    animation: cv-ring 1.8s cubic-bezier(.2, .6, .35, 1) infinite;
  }
  @keyframes cv-ring {
    from { transform: scale(1); opacity: .8; }
    to   { transform: scale(1.65); opacity: 0; }
  }

  /* The caret carries a faint glow while the teacher writes. */
  .cv-caret { box-shadow: 0 0 8px rgba(252, 211, 77, .7); }

  /* Recap section markers pop in after their heading. */
  .cv-section-head::before {
    animation: cv-pop .4s .15s cubic-bezier(.2, 1.4, .4, 1) both;
  }

  /* Keyboard users get a gold focus ring. */
  .cv-opt:focus-visible, .cv-gap:focus-visible, .cv-fill:focus-visible,
  .cv-go:focus-visible, .cv-gate-btn:focus-visible, .cv-chip-move button:focus-visible,
  .cv-speed:focus-visible, .cv-sound:focus-visible,
  .cv-prev:focus-visible, .cv-back:focus-visible {
    outline: 2px solid rgba(252, 211, 77, .7);
    outline-offset: 2px;
  }
}
