/* ── Lessonpills AI — Renderer Styles ──────────────────────────────────────── */

:root {
  --brand:       #4F46E5;
  --brand-dark:  #3730A3;
  --brand-light: #EEF2FF;
  --brand-mid:   #818CF8;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --surface-3:   #F1F5F9;
  --border:      #E2E8F0;
  --text:        #0F172A;
  --text-2:      #475569;
  --text-3:      #94A3B8;
  --success:     #16A34A;
  --success-bg:  #F0FDF4;
  --error:       #DC2626;
  --error-bg:    #FEF2F2;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.lesson-header {
  background: #3d3d8f;
  color: #fff;
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.header-left  { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.header-logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.header-logo-img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: block;
}
.header-logo-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  opacity: .95;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}
.header-sep   { width: 1px; height: 20px; background: rgba(255,255,255,.25); flex-shrink: 0; }
.header-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .95; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.cefr-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 99px; background: rgba(255,255,255,.2); color: #fff;
}
.source-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,.75);
  text-decoration: none; padding: 4px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.12); transition: background .15s;
}
.source-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.source-btn svg  { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Phase nav ──────────────────────────────────────────────────────────────── */
.phase-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 56px;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}
.phase-nav::-webkit-scrollbar { display: none; }
.phase-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 0 18px; height: 44px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-3); cursor: pointer; border: none; background: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  white-space: nowrap; transition: color .15s, border-color .15s, background .15s;
  text-transform: uppercase;
}
.phase-tab:hover { color: var(--text-2); }
.phase-tab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--brand-light); }
.phase-num {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-3);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.phase-tab.active .phase-num { background: var(--brand-light); color: var(--brand); }
.phase-tab-icon { font-size: 16px; vertical-align: middle; line-height: 1; opacity: .7; }

/* ── Body ───────────────────────────────────────────────────────────────────── */
.lesson-body { max-width: 960px; margin: 0 auto; padding: 40px 32px 80px; }

/* ── Phase block ─────────────────────────────────────────────────────────────  */
.phase-block { display: none; }
.phase-block.active { display: block; }

/* Phase title card — sits above section cards */
.phase-title-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
  padding: 28px 24px;
  margin-bottom: 0;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.phase-title-card-left { display: flex; align-items: center; gap: 14px; }
.phase-title-icon { font-size: 22px; color: var(--brand); line-height: 1; flex-shrink: 0; }
.phase-title-text { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.phase-duration-badge {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 9px; white-space: nowrap; flex-shrink: 0;
}

.watch-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--brand-light); border: none; cursor: pointer;
  transition: background .15s;
}
.watch-link:hover { background: #dde5ff; }

/* ── Section card ────────────────────────────────────────────────────────────  */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 26px 28px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.phase-title-card + .section-card {
  border-top: none;
}
.section-card:last-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
}
.section-card:only-of-type {
  border-radius: 0 0 var(--radius) var(--radius);
}
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px;
  background: var(--brand-light); color: var(--brand);
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Instructions ────────────────────────────────────────────────────────────  */
.instr-box {
  background: var(--brand-light); border-left: 3px solid var(--brand);
  padding: 12px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 18px;
}

/* ── Question list ───────────────────────────────────────────────────────────  */
.question-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.question-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; line-height: 1.55;
}
.q-num { font-size: 12px; font-weight: 700; color: var(--brand); flex-shrink: 0; min-width: 18px; margin-top: 1px; }

/* ── Vocab grid ──────────────────────────────────────────────────────────────  */
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.vocab-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.vocab-card:hover { border-color: var(--brand-mid); box-shadow: var(--shadow); }
.vocab-term { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -.01em; }
.vocab-pos  { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.vocab-def  { font-size: 14px; color: var(--text-2); line-height: 1.55; margin-bottom: 10px; }
.vocab-ex   { font-size: 13px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 8px; line-height: 1.5; }
.vocab-ex-label { font-weight: 700; color: var(--text-2); }

/* ── Exercise block ──────────────────────────────────────────────────────────  */
.ex-block { margin-bottom: 40px; margin-top: 32px; }
.ex-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 2px solid var(--brand-light);
}
.ex-num {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--brand); white-space: nowrap; flex-shrink: 0;
  padding: 3px 9px; border-radius: 99px;
}
.ex-type-label { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.ex-instr { font-size: 15px; color: var(--text-2); margin-bottom: 12px; line-height: 1.55; font-weight: 500; }

/* ── Match / halves ──────────────────────────────────────────────────────────  */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 7px; }
.match-col { display: flex; flex-direction: column; gap: 6px; }
.match-item {
  padding: 10px 14px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; cursor: grab;
  display: flex; align-items: flex-start; gap: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.match-item:hover { border-color: var(--brand-mid); box-shadow: var(--shadow); }
.match-item.dragging { opacity: .4; cursor: grabbing; }
.match-item.correct { border-color: var(--success); background: var(--success-bg); cursor: default; }
.match-item.wrong   { border-color: var(--error);   background: var(--error-bg);   cursor: default; }
.match-id { font-size: 11px; font-weight: 700; color: var(--brand); flex-shrink: 0; min-width: 16px; }

/* Definition drop zones */
.def-drop-zone {
  min-height: 44px; padding: 10px 14px;
  background: var(--surface-3); border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--text-3);
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  transition: border-color .15s, background .15s;
}
.def-drop-zone.drag-over { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.def-drop-zone.filled    { background: var(--surface-2); border-style: solid; border-color: var(--border); color: var(--text); }
.def-drop-zone.correct   { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.def-drop-zone.wrong     { border-color: var(--error);   background: var(--error-bg);   color: var(--error); }
.dz-badge {
  font-size: 11px; font-weight: 700; color: var(--brand);
  background: var(--brand-light); border-radius: 3px;
  padding: 1px 5px; white-space: nowrap;
  display: none;
}
.dz-badge--filled { display: inline-block; }
.def-drop-zone.correct .dz-badge { background: var(--success-bg); color: var(--success); }
.def-drop-zone.wrong   .dz-badge { background: var(--error-bg);   color: var(--error); }
.dz-id   { font-size: 11px; font-weight: 700; color: var(--brand-mid); white-space: nowrap; }
.dz-text { color: inherit; line-height: 1.4; }

/* ── Categorization ──────────────────────────────────────────────────────────  */
.cat-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cat-item {
  padding: 10px 14px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; cursor: grab;
  display: flex; align-items: flex-start; gap: 8px;
  transition: border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.cat-item:hover { border-color: var(--brand-mid); box-shadow: var(--shadow); }
.cat-item.dragging { opacity: .4; }
.cat-item.correct { border-color: var(--success); background: var(--success-bg); cursor: default; }
.cat-item.wrong   { border-color: var(--error);   background: var(--error-bg);   cursor: default; }

.cat-bins { display: flex; gap: 10px; margin-bottom: 4px; }
.cat-bin {
  flex: 1; min-height: 80px; border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm); padding: 10px;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.cat-bin.drag-over { border-color: var(--brand); background: var(--brand-light); }
.cat-bin-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 8px; }
.cat-bin-items { display: flex; flex-direction: column; gap: 5px; }
.cat-bin-chip {
  padding: 7px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-2);
}

/* ── MCQ ─────────────────────────────────────────────────────────────────────  */
.mcq-list { display: flex; flex-direction: column; gap: 18px; }
.mcq-question { font-size: 15px; font-weight: 600; margin-bottom: 9px; line-height: 1.45; }
.mcq-options  { display: flex; flex-direction: column; gap: 5px; }
.mcq-option {
  padding: 11px 16px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; cursor: pointer;
  display: flex; align-items: flex-start; gap: 9px;
  transition: border-color .15s, background .15s;
}
.mcq-option:hover { border-color: var(--brand-mid); background: var(--brand-light); }
.mcq-option.correct { border-color: var(--success); background: var(--success-bg); cursor: default; }
.mcq-option.wrong   { border-color: var(--error);   background: var(--error-bg);   cursor: default; }
.mcq-letter { font-size: 11px; font-weight: 700; color: var(--brand); flex-shrink: 0; min-width: 14px; margin-top: 1px; }
.mcq-explanation {
  font-size: 14px; color: var(--text-2); margin-top: 8px;
  padding: 10px 14px; background: var(--brand-light); border-radius: var(--radius-sm);
  display: none;
}
.mcq-explanation.show { display: block; }

/* ── Cloze ───────────────────────────────────────────────────────────────────  */
.cloze-passage {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px 24px; font-size: 15px; line-height: 2.3;
}
.cloze-input {
  display: inline-block; border: none; border-bottom: 2px solid var(--brand-mid);
  background: transparent; font-family: inherit; font-size: 15px;
  color: var(--text); padding: 0 4px; min-width: 80px; text-align: center;
  outline: none; transition: border-color .2s;
}
.cloze-input:focus { border-bottom-color: var(--brand); }
.cloze-input.correct { border-bottom-color: var(--success); color: var(--success); }
.cloze-input.wrong   { border-bottom-color: var(--error);   color: var(--error); }

/* ── Grammar feature ─────────────────────────────────────────────────────────  */
.grammar-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 18px; overflow: hidden;
  background: var(--surface);
}
.grammar-box-top {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.grammar-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 6px;
}
.grammar-name  { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 10px; line-height: 1.25; }
.grammar-expl  {
  font-size: 15px; color: var(--text-2); line-height: 1.7;
  max-width: 680px; font-style: normal;
}

.grammar-examples {
  padding: 18px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.grammar-examples-label {
  font-size: 10px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 4px;
}
/* A pair (wrong+correct) or standalone example */
.grammar-example-row {
  display: flex; flex-direction: column; gap: 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.grammar-example-row:has(.grammar-ex-wrong) {
  border-left-color: var(--error);
}
.grammar-example-row:has(.grammar-ex-plain):not(:has(.grammar-ex-wrong)) {
  border-left-color: var(--brand-mid);
}
.grammar-ex-wrong,
.grammar-ex-correct,
.grammar-ex-plain {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 15px; line-height: 1.6; padding: 3px 0;
}
.grammar-ex-wrong   { color: var(--error); }
.grammar-ex-correct { color: var(--success); }
.grammar-ex-plain   { color: var(--text); }
.grammar-ex-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; line-height: 1.5;
}
.grammar-ex-badge--wrong   { background: var(--error-bg);   color: var(--error); }
.grammar-ex-badge--correct { background: var(--success-bg); color: var(--success); }
.grammar-ex-badge--plain   { background: var(--brand-light); color: var(--brand); font-weight: 700; }
.grammar-ex-note {
  font-size: 13px; color: var(--text-3);
  padding: 2px 0 6px; line-height: 1.5;
}

/* ── Search & find ───────────────────────────────────────────────────────────  */
.search-examples { display: flex; flex-direction: column; gap: 7px; }
.search-example {
  padding: 11px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--brand-mid); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 15px; line-height: 1.6; color: var(--text-2);
}

/* ── Transformation ──────────────────────────────────────────────────────────  */
.transform-list { display: flex; flex-direction: column; gap: 10px; }
.transform-item { padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.transform-original { font-size: 15px; color: var(--text-2); margin-bottom: 8px; }
.transform-input {
  width: 100%; border: none; border-bottom: 1px solid var(--border);
  background: transparent; font-family: inherit; font-size: 15px;
  color: var(--text); padding: 4px 0; outline: none; transition: border-color .2s;
}
.transform-input:focus { border-bottom-color: var(--brand); }
.transform-answer { font-size: 14px; color: var(--success); margin-top: 7px; display: none; font-weight: 600; }
.transform-answer.show { display: block; }

/* ── Functional phrases ──────────────────────────────────────────────────────  */
.phrases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 18px; }
.phrase-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.phrase-text  { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.phrase-usage { font-size: 13px; color: var(--text-3); }

/* ── Reading source block (article lessons) ─────────────────────────────────  */
.reading-source-block {
  margin-bottom: 16px;
}
.reading-source-header {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px;
}
.reading-source-favicon {
  flex-shrink: 0; display: block; border-radius: 2px;
}
.reading-source-link {
  font-weight: 600; color: var(--brand); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reading-source-link:hover { text-decoration: underline; }
.reading-source-title { font-weight: 600; color: var(--text-2); }
.reading-adapted-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-light);
  padding: 2px 7px; border-radius: 99px;
}
.reading-source-block .reading-text {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: none;
  margin-bottom: 0;
}

/* ── Reading text ────────────────────────────────────────────────────────────  */
.reading-text {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 20px 24px; font-size: 15px; line-height: 1.85; margin-bottom: 16px; color: var(--text);
}
.discussion-list { display: flex; flex-direction: column; gap: 8px; }
.discussion-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px;
}
.discussion-arrow { color: var(--brand-mid); font-size: 12px; flex-shrink: 0; margin-top: 2px; }

/* ── Production task ─────────────────────────────────────────────────────────  */
.scenario-box {
  background: var(--brand); color: #fff;
  padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 15px; line-height: 1.65;
}
.scenario-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .6; margin-bottom: 6px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.role-card  { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.role-name  { font-size: 15px; font-weight: 700; color: var(--brand); margin-bottom: 10px; }
.role-field { margin-bottom: 7px; }
.role-field-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.role-field-text  { font-size: 14px; color: var(--text-2); line-height: 1.5; }

.req-section {
  background: var(--brand-light); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.req-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); display: flex; align-items: center; margin-bottom: 2px; }
.req-group { display: flex; flex-direction: column; gap: 6px; }
.req-group-label { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.req-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.req-chip { font-size: 12px; font-weight: 600; padding: 4px 11px; background: #fff; border: 1px solid var(--brand-mid); border-radius: 99px; color: var(--brand); }
.req-chip--count { opacity: .7; }

.debrief-list { display: flex; flex-direction: column; gap: 7px; }
.debrief-item { padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; display: flex; gap: 10px; }

/* ── Swap ────────────────────────────────────────────────────────────────────  */
.swap-para {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 22px; font-size: 15px; line-height: 2.2; margin-bottom: 14px;
}
.swap-target {
  display: inline; background: var(--brand-light); border-bottom: 2px solid var(--brand-mid);
  padding: 0 3px; cursor: pointer; font-weight: 600; color: var(--brand);
  transition: background .15s;
}
.swap-target:hover { background: #dde5ff; }
.swap-target.correct { background: var(--success-bg); border-bottom-color: var(--success); color: var(--success); }
.swap-target.wrong   { background: var(--error-bg);   border-bottom-color: var(--error);   color: var(--error); }
.swap-options { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 4px; }
.swap-opt {
  padding: 6px 14px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 99px; font-size: 14px; cursor: pointer; transition: border-color .15s;
}
.swap-opt:hover { border-color: var(--brand); color: var(--brand); }
.swap-opt.sel  { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.swap-opt.used { opacity: .35; pointer-events: none; }

/* ── Error correction ─────────────────────────────────────────────────────────────  */
.errcorr-list { display: flex; flex-direction: column; gap: 14px; }
.errcorr-item {
  padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.errcorr-original {
  font-size: 15px; color: var(--text-2); font-style: italic;
  margin-bottom: 9px; line-height: 1.6;
  padding: 10px 14px; background: var(--error-bg); border-radius: var(--radius-sm);
  border-left: 3px solid var(--error);
}
.errcorr-input {
  width: 100%; border: none; border-bottom: 2px solid var(--brand-mid);
  background: transparent; font-family: inherit; font-size: 15px;
  color: var(--text); padding: 4px 0; outline: none; transition: border-color .2s;
}
.errcorr-input:focus { border-bottom-color: var(--brand); }
.errcorr-input.correct { border-bottom-color: var(--success); color: var(--success); }
.errcorr-input.wrong   { border-bottom-color: var(--error);   color: var(--error); }
.errcorr-note {
  font-size: 13px; color: var(--text-3); margin-top: 8px; display: none; line-height: 1.5;
  padding: 7px 10px; background: var(--brand-light); border-radius: var(--radius-sm);
}
.errcorr-note.show { display: block; }
.errcorr-tag { font-weight: 700; color: var(--error); margin-right: 6px; }

/* ── Sentence ordering ──────────────────────────────────────────────────────────  */
.sord-items { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }
.sord-item {
  padding: 11px 14px; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; cursor: grab;
  display: flex; align-items: flex-start; gap: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.sord-item:hover { border-color: var(--brand-mid); box-shadow: var(--shadow); }
.sord-item.dragging { opacity: .4; cursor: grabbing; }
.sord-item.correct { border-color: var(--success); background: var(--success-bg); cursor: default; }
.sord-item.wrong   { border-color: var(--error);   background: var(--error-bg);   cursor: default; }
.sord-handle { font-size: 18px; color: var(--text-3); flex-shrink: 0; margin-top: 1px; cursor: grab; }
.sord-text { line-height: 1.55; }
.sord-answer {
  margin-top: 14px; padding: 14px 16px;
  background: var(--success-bg); border: 1px solid var(--success);
  border-radius: var(--radius-sm);
}
.sord-ans-row {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 15px; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.06); color: var(--text-2);
}
.sord-ans-row:last-child { border-bottom: none; }

/* ── True / False / Not Given ───────────────────────────────────────────────  */
.tfng-list { display: flex; flex-direction: column; gap: 14px; }
.tfng-item {
  padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tfng-statement { font-size: 15px; font-weight: 500; margin-bottom: 11px; line-height: 1.55; color: var(--text); }
.tfng-options { display: flex; gap: 7px; flex-wrap: wrap; }
.tfng-btn {
  padding: 7px 20px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 99px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
  color: var(--text-2);
}
.tfng-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.tfng-btn.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); cursor: default; }
.tfng-btn.wrong   { border-color: var(--error);   background: var(--error-bg);   color: var(--error);   cursor: default; }
.tfng-explanation {
  font-size: 14px; color: var(--text-2); margin-top: 10px; display: none; line-height: 1.55;
  padding: 10px 14px; background: var(--brand-light); border-radius: var(--radius-sm);
}
.tfng-explanation.show { display: block; }

/* ── Buttons ─────────────────────────────────────────────────────────────────  */
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px;
  background: var(--surface-3); color: var(--text-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary:hover { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px;
  background: transparent; color: var(--text-3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--text-2); color: var(--text-2); }
.btn-reset { margin-left: auto; }

/* ── Phase continue ──────────────────────────────────────────────────────────  */
.phase-continue {
  display: flex; justify-content: flex-end;
  padding-top: 24px; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.btn-continue {
  display: inline-flex; align-items: center;
  padding: 11px 22px;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.btn-continue:hover { background: var(--brand-dark); box-shadow: 0 4px 14px rgba(79,70,229,.35); }

/* ── Reset All button (header) ───────────────────────────────────────────────  */
.reset-all-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px;
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.reset-all-btn:hover { background: rgba(255,255,255,.25); }

/* ── Print button + dropdown ─────────────────────────────────────────────────  */
.print-wrap { position: relative; flex-shrink: 0; }
.print-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
}
.print-btn:hover,
.print-dropdown.open ~ .print-btn { background: rgba(255,255,255,.28); }
.print-btn .material-icons { font-size: 18px; line-height: 1; }

.print-dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 200px; z-index: 9999; overflow: hidden;
}
.print-dropdown.open { display: block; }
.print-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px 14px;
  background: none; border: none; cursor: pointer;
  text-align: left; font-family: inherit;
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.print-option:last-child { border-bottom: none; }
.print-option:hover { background: var(--brand-light); }
.print-option .material-icons { font-size: 18px; color: var(--brand); flex-shrink: 0; }
.print-option strong { display: block; font-size: 13px; color: var(--text); font-weight: 600; }
.print-option span   { font-size: 11px; color: var(--text-3); }

/* ── Loading / error states ──────────────────────────────────────────────────  */
.state-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 12px; text-align: center; padding: 40px; }
.state-title { font-size: 18px; font-weight: 700; color: var(--text); }
.state-sub   { font-size: 14px; color: var(--text-3); }

.spinner { width: 36px; height: 36px; border: 3px solid var(--brand-light); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }

/* Print footer — hidden on screen, shown only during @media print */
.print-footer { display: none; }

/* ── Notes box (print-only; also shown inside PDF render container) ─────────  */
.notes-box {
  display: none;
}
#pdf-render-container .notes-box {
  display: block;
  margin-top: 10pt;
  border: 0.5pt solid #ccc;
  border-radius: 3pt;
  padding: 6pt 8pt 4pt;
}
#pdf-render-container .notes-box-label {
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #aaa;
  display: block;
  margin-bottom: 4pt;
}
#pdf-render-container .notes-box-lines {
  background-image: repeating-linear-gradient(
    to bottom, transparent, transparent 17pt, #ddd 17pt, #ddd 18pt
  );
  min-height: 72pt;
  width: 100%;
}
@media print {
  .notes-box {
    display: block !important;
    margin-top: 10pt;
    border: 0.5pt solid #ccc;
    border-radius: 3pt;
    padding: 6pt 8pt 4pt;
    break-inside: avoid;
  }
  body.print-answer-key .notes-box {
    display: none !important;
  }
  .notes-box-label {
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    display: block;
    margin-bottom: 4pt;
  }
  .notes-box-lines {
    /* 4 ruled lines at ~18pt each */
    background-image:
      repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 17pt,
        #ddd 17pt,
        #ddd 18pt
      );
    min-height: 72pt; /* 4 lines */
    width: 100%;
  }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Material Icons sizing ───────────────────────────────────────────────────  */
.material-icons { font-size: inherit; vertical-align: middle; line-height: 1; }

/* ── YouTube panel ───────────────────────────────────────────────────────────  */
.yt-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0; margin-bottom: 28px;
  box-shadow: var(--shadow); overflow: hidden;
}
.yt-embed-wrap {
  width: 100%; border-radius: 0; overflow: hidden;
  aspect-ratio: 16/9; background: #000;
}
.yt-embed { width: 100%; height: 100%; display: block; }

/* ── Below-video two-column row ─────────────────────────────────────────────  */
.yt-below-row {
  display: flex; align-items: stretch;
  border-top: 1px solid var(--border);
  min-height: 200px;
}
/* Left: link + QR */
.yt-below-left {
  flex: 0 0 190px;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 0;
}
.yt-meta-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3); margin-bottom: 6px;
}
.yt-link-row {
  display: flex; align-items: center; gap: 5px;
}
.yt-link {
  font-size: 11px; color: var(--brand); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none; flex: 1;
}
.yt-link:hover { text-decoration: underline; }
.yt-copy-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  background: none; border: none;
  color: var(--text-3); cursor: pointer; transition: color .15s;
}
.yt-copy-btn:hover { color: var(--brand); }
.yt-qr-wrap { margin-top: 16px; }
.yt-qr {
  display: block; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-top: 6px;
  width: 120px; height: 120px;
}
.qr-fallback {
  width: 120px; height: 120px; background: var(--surface-3); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-3); text-align: center; padding: 6px; margin-top: 6px;
}

/* Right: transcript */
.yt-below-right {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: #fff;
}

/* ── Transcript accordion ────────────────────────────────────────────────────  */
.tx-accordion {
  display: flex; flex-direction: column; flex: 1;
  background: #fff;
  overflow: hidden;
}
.tx-toggle-row {
  display: flex; align-items: stretch;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tx-toggle {
  flex: 1; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; cursor: pointer;
  padding: 11px 16px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  transition: background .15s;
}
.tx-toggle:hover { background: #edf0f3; }
.tx-toggle-left { display: flex; align-items: center; gap: 7px; }
.tx-yt-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 0 14px;
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-decoration: none;
  border-left: 1px solid var(--border);
  transition: color .15s, background .15s;
  white-space: nowrap; flex-shrink: 0;
}
.tx-yt-btn:hover { color: #FF0000; background: #fff5f5; }
.tx-line-count {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  background: var(--surface-3); padding: 1px 7px; border-radius: 99px;
}
.tx-chevron { font-size: 11px; color: var(--text-3); transition: transform .2s; }
.tx-body {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
}
.tx-body::-webkit-scrollbar { width: 4px; }
.tx-body::-webkit-scrollbar-track { background: transparent; }
.tx-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.tx-body::-webkit-scrollbar-thumb:hover { background: var(--brand-mid); }
.tx-line {
  display: flex; gap: 12px; align-items: baseline;
  padding: 7px 16px; border-bottom: 1px solid #f4f5f7;
  transition: background .1s;
}
.tx-line:hover { background: var(--brand-light); }
.tx-ts {
  font-size: 10px; font-weight: 700; color: var(--brand); white-space: nowrap;
  flex-shrink: 0; font-family: 'Courier New', monospace;
  background: var(--brand-light); border: none; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; line-height: 1.6;
  transition: background .15s, color .15s;
}
.tx-ts:hover { background: var(--brand); color: #fff; }
.tx-text { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.tx-plain { padding: 12px 16px; font-size: 14px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; }

/* Search bar at bottom of transcript */
.tx-search-bar {
  flex-shrink: 0;
  display: flex; align-items: center;
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 0;
}
.tx-search-wrap {
  flex: 1; position: relative; display: flex; align-items: center;
}
.tx-search-icon {
  position: absolute; left: 12px;
  display: flex; align-items: center;
  color: var(--text-3); pointer-events: none; font-size: 14px;
  transition: color .15s;
}
.tx-search-input {
  width: 100%; border: none; border-radius: 0;
  padding: 10px 80px 10px 36px; font-family: inherit; font-size: 12px;
  outline: none; background: #fff; transition: background .15s;
  color: var(--text); border-bottom: 2px solid transparent;
}
.tx-search-input:focus { background: var(--brand-light); border-bottom-color: var(--brand); }
.tx-search-wrap:focus-within .tx-search-icon { color: var(--brand); }
.tx-search-count {
  position: absolute; right: 12px;
  font-size: 11px; color: var(--text-3); white-space: nowrap; pointer-events: none;
}

/* ── YouTube watch button ──────────────────────────────────────────────────────  */
.yt-watch-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  text-decoration: none; padding: 5px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .15s, color .15s; white-space: nowrap;
}
.yt-watch-btn:hover { border-color: var(--brand-mid); color: var(--brand); }
.yt-watch-btn-logo { width: 13px; height: 13px; flex-shrink: 0; display: block; fill: currentColor; }

/* ── Search highlight ────────────────────────────────────────────────────────  */
mark { background: #fef08a; color: var(--text); border-radius: 2px; padding: 0 1px; }

/* ── Responsive ──────────────────────────────────────────────────────────────  */
@media (max-width: 600px) {
  .lesson-header { padding: 0 16px; }
  .phase-nav { padding: 0 12px; }
  .lesson-body { padding: 20px 16px 60px; }
  .match-grid, .role-cards { grid-template-columns: 1fr; }
  .header-title { display: none; }
  .cat-bins { flex-direction: column; }
  .yt-below-row { flex-wrap: wrap; }
  .yt-below-center { order: -1; flex-basis: 100%; }
  .reset-all-btn { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   Renders all phases sequentially on paper. Interactive chrome is hidden.
   Fills answer inputs are shown as blank write-on lines.
   ════════════════════════════════════════════════════════════════════════════ */
@media print {

  /* ── Page setup ──────────────────────────────────────────────────────────── */
  /* Suppress browser default header/footer; reserve bottom margin for ours   */
  @page {
    size: A4;
    margin: 16mm 18mm 28mm;
    /* Remove browser-injected URL / date lines */
    margin-header: 0; margin-footer: 0;
  }
  @page :first { margin-top: 13mm; }

  /* ── Prevent widowed/orphaned headings only — not body text ─────────────── */
  /* Relaxed: only keep headings pinned to their content, not every element   */
  body { orphans: 2; widows: 2; }
  .phase-title-card,
  .ex-header,
  .grammar-box-top,
  .match-col-label { page-break-after: avoid; break-after: avoid; }

  /* Keep small atomic units together (single rows / cards, not whole grids)  */
  .question-item,
  .vocab-card,
  .mcq-item,
  .match-item,
  .def-drop-zone,
  .grammar-example-row,
  .phrase-card,
  .role-card,
  .tx-line { page-break-inside: avoid; break-inside: avoid; }

  /* Phase blocks always start on their own page (except first) */
  .phase-block + .phase-block { page-break-before: always; break-before: always; }

  /* ── Custom footer: centered branding + right-aligned page number ────────── */
  .print-footer {
    display: flex !important;
    position: fixed;
    bottom: 6mm; left: 18mm; right: 18mm;
    align-items: center;
    font-family: Georgia, serif;
    font-size: 7.5pt;
    color: #aaa;
    pointer-events: none;
    z-index: 9999;
    border-top: 0.5pt solid #ddd;
    padding-top: 3mm;
  }
  .print-footer-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5pt;
  }
  .print-footer-brand img {
    width: 13pt; height: 13pt;
    border-radius: 3pt;
    opacity: .5;
  }
  .print-footer-pages {
    position: absolute;
    right: 0;
    font-size: 7.5pt;
    color: #bbb;
  }
  .print-footer-pages::after { content: 'Page ' counter(page); }

  /* ── Reveal all phases ───────────────────────────────────────────────────── */
  .phase-block,
  .phase-block.active { display: block !important; }

  /* ── Hide interactive / nav chrome ──────────────────────────────────────── */
  .lesson-header,
  .phase-nav,
  .phase-continue,
  .btn-row,
  .swap-options,
  .yt-embed-wrap,
  .tx-search-bar,
  .tx-chevron,
  .tx-yt-btn,
  .yt-copy-btn,
  .yt-watch-btn,
  .watch-link,
  .mcq-explanation { display: none !important; }

  /* ── Base typography ─────────────────────────────────────────────────────── */
  body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 10.5pt;
    line-height: 1.55;
    color: #000;
    background: #fff;
  }

  /* ── Layout reset ────────────────────────────────────────────────────────── */
  .lesson-body {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* ── Print header (replaces sticky nav header) ───────────────────────────── */
  .lesson-body::before {
    content: attr(data-title);
    display: block;
    font-family: Georgia, serif;
    font-size: 7.5pt;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 0.5pt solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 14pt;
  }

  /* ── Phase title card ────────────────────────────────────────────────────── */
  .phase-title-card {
    display: flex;
    align-items: baseline;
    gap: 10pt;
    border: none;
    border-bottom: 1.5pt solid #000;
    border-radius: 0;
    padding: 0 0 5pt;
    margin-bottom: 12pt;
    margin-top: 0;
    box-shadow: none;
    background: transparent;
  }
  .phase-title-icon { display: none; }
  .phase-title-text {
    font-family: Georgia, serif;
    font-size: 15pt;
    font-weight: 700;
    color: #000;
    letter-spacing: -.01em;
    line-height: 1.15;
  }
  .phase-duration-badge {
    font-size: 8pt;
    font-family: inherit;
    color: #555;
    background: none;
    border: 0.5pt solid #aaa;
    border-radius: 0;
    padding: 1pt 5pt;
  }

  /* ── Section card ────────────────────────────────────────────────────────── */
  .section-card {
    border: none;
    border-top: 0.5pt solid #ccc;
    border-radius: 0;
    padding: 10pt 0;
    margin-bottom: 0;
    box-shadow: none;
    background: transparent;
  }
  .section-header { margin-bottom: 7pt; }
  .section-badge {
    font-size: 7pt;
    background: none;
    color: #444;
    border: 0.5pt solid #aaa;
    border-radius: 0;
    padding: 1pt 4pt;
  }
  .section-title { font-size: 11pt; font-weight: 700; color: #000; }

  /* ── Instruction box ─────────────────────────────────────────────────────── */
  .instr-box {
    border-left: 2.5pt solid #555;
    background: none;
    padding: 3pt 8pt;
    margin-bottom: 8pt;
    font-size: 9.5pt;
    color: #222;
    border-radius: 0;
  }

  /* ── Discussion questions ────────────────────────────────────────────────── */
  .question-list { gap: 4pt; }
  .question-item {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    padding: 5pt 8pt;
    background: none;
    font-size: 10.5pt;
  }
  .q-num { color: #333; }

  /* ── Vocab grid ──────────────────────────────────────────────────────────── */
  .vocab-grid { grid-template-columns: repeat(2, 1fr); gap: 5pt; margin-bottom: 10pt; }
  .vocab-card {
    border: 0.5pt solid #ccc;
    padding: 7pt 9pt;
    background: none;
    border-radius: 0;
  }
  .vocab-term { font-size: 13pt; font-weight: 700; color: #000; margin-bottom: 2pt; }
  .vocab-pos  { font-size: 7.5pt; color: #555; margin-bottom: 4pt; }
  .vocab-def  { font-size: 9.5pt; color: #222; margin-bottom: 5pt; }
  .vocab-ex   { font-size: 8.5pt; color: #555; padding-top: 5pt; border-top: 0.5pt solid #ddd; }

  /* ── Exercise blocks ─────────────────────────────────────────────────────── */
  .ex-block { margin-bottom: 14pt; }
  .ex-header {
    border-bottom: 1pt solid #ccc;
    padding-bottom: 4pt;
    margin-bottom: 8pt;
  }
  .ex-num {
    background: none;
    color: #000;
    border: 0.75pt solid #000;
    border-radius: 0;
    font-size: 7.5pt;
    padding: 1pt 5pt;
  }
  .ex-type-label { font-size: 13pt; color: #000; }
  .ex-instr { font-size: 9.5pt; color: #333; margin-bottom: 6pt; font-weight: 400; }

  /* ── Match / halves ──────────────────────────────────────────────────────── */
  .match-grid { grid-template-columns: 1fr 1fr; gap: 8pt; }
  .match-col-label { font-size: 7.5pt; color: #555; margin-bottom: 4pt; }
  .match-item {
    border: 0.5pt solid #bbb;
    border-radius: 0;
    background: none;
    font-size: 9.5pt;
    padding: 4pt 7pt;
    cursor: default;
  }
  .match-id { color: #444; }
  /* Drop zones: show as numbered blank lines */
  .def-drop-zone {
    border: none;
    border-bottom: 0.75pt solid #888;
    border-radius: 0;
    background: none;
    min-height: 18pt;
    padding: 2pt 4pt;
    font-size: 9.5pt;
    gap: 5pt;
  }
  .dz-id    { color: #555; font-size: 8pt; }
  .dz-badge { display: none !important; }

  /* ── Categorisation ──────────────────────────────────────────────────────── */
  .cat-items { gap: 3pt; margin-bottom: 8pt; }
  .cat-item {
    border: 0.5pt solid #bbb;
    border-radius: 0;
    background: none;
    font-size: 9.5pt;
    padding: 3pt 7pt;
    cursor: default;
  }
  .cat-bins { gap: 6pt; }
  .cat-bin {
    border: 0.75pt dashed #aaa;
    border-radius: 0;
    min-height: 50pt;
    background: none;
    padding: 6pt 8pt;
  }
  .cat-bin-label { font-size: 8pt; color: #444; margin-bottom: 4pt; }

  /* ── MCQ ─────────────────────────────────────────────────────────────────── */
  .mcq-list { gap: 10pt; }
  .mcq-question { font-size: 10.5pt; font-weight: 600; margin-bottom: 5pt; }
  .mcq-options  { gap: 2pt; }
  .mcq-option {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    font-size: 9.5pt;
    padding: 3pt 7pt;
    cursor: default;
  }
  .mcq-letter { color: #333; }

  /* ── Cloze ───────────────────────────────────────────────────────────────── */
  .cloze-passage {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    padding: 9pt 11pt;
    font-size: 10.5pt;
    line-height: 2.2;
  }
  /* Replace interactive input with a visible blank underline */
  .cloze-input {
    border: none;
    border-bottom: 0.75pt solid #000;
    background: transparent;
    font-size: 9.5pt;
    min-width: 65pt;
    color: transparent; /* hide any typed value */
    padding: 0 2pt;
  }

  /* ── Grammar box ─────────────────────────────────────────────────────────── */
  .grammar-box {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    margin-bottom: 10pt;
  }
  .grammar-box-top { border-bottom: 0.5pt solid #ccc; padding: 7pt 10pt 6pt; }
  .grammar-label   { font-size: 7.5pt; color: #555; margin-bottom: 3pt; }
  .grammar-name    { font-size: 12pt; color: #000; margin-bottom: 5pt; }
  .grammar-expl    { font-size: 9.5pt; color: #222; max-width: 100%; }
  .grammar-examples { padding: 7pt 10pt; gap: 8pt; }
  .grammar-examples-label { font-size: 7.5pt; color: #666; }
  .grammar-example-row {
    border-left: 2pt solid #aaa;
    padding-left: 7pt;
  }
  .grammar-example-row:has(.grammar-ex-wrong) { border-left-color: #b00; }
  .grammar-ex-wrong   { color: #b00; font-size: 9.5pt; }
  .grammar-ex-correct { color: #060; font-size: 9.5pt; }
  .grammar-ex-plain   { color: #000; font-size: 9.5pt; }
  .grammar-ex-badge { font-size: 7.5pt; padding: 0 4pt; border-radius: 0; }
  .grammar-ex-badge--wrong   { background: none; color: #b00; border: 0.5pt solid #b00; }
  .grammar-ex-badge--correct { background: none; color: #060; border: 0.5pt solid #060; }
  .grammar-ex-badge--plain   { background: none; color: #333; border: 0.5pt solid #999; }
  .grammar-ex-note   { font-size: 8.5pt; color: #555; }

  /* ── Search & find ───────────────────────────────────────────────────────── */
  .search-example {
    border: none;
    border-left: 2pt solid #888;
    background: none;
    border-radius: 0;
    font-size: 9.5pt;
    padding: 3pt 7pt;
    color: #222;
  }

  /* ── Transformation ──────────────────────────────────────────────────────── */
  .transform-item {
    border: none;
    border-top: 0.5pt solid #ddd;
    border-radius: 0;
    background: none;
    padding: 6pt 0;
  }
  .transform-original { font-size: 9.5pt; color: #333; margin-bottom: 4pt; }
  /* Write-on line */
  .transform-input {
    border: none;
    border-bottom: 0.75pt solid #000;
    background: transparent;
    font-size: 9.5pt;
    width: 100%;
    padding: 1pt 0;
    color: transparent;
  }
  .transform-answer { display: none !important; }

  /* ── Error correction ─────────────────────────────────────────────────────── */
  .errcorr-original {
    font-size: 10.5pt;
    font-style: italic;
    color: #555;
    margin-bottom: 4pt;
  }
  .errcorr-input {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    width: 100%;
    padding: 3pt 5pt;
    font-size: 10.5pt;
  }
  .errcorr-note {
    font-size: 8.5pt;
    color: #555;
    margin-top: 3pt;
    display: none;
  }
  .errcorr-note.show { display: block; }
  .errcorr-tag { font-weight: 700; color: #c00; margin-right: 4pt; }

  /* ── Sentence ordering ───────────────────────────────────────────────────── */
  .sord-item {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    padding: 4pt 7pt;
    margin-bottom: 4pt;
    font-size: 10pt;
  }
  .sord-handle { display: none; }
  .sord-answer {
    border: 0.5pt solid #ccc;
    border-left: 2.5pt solid #060;
    background: none;
    padding: 5pt 8pt;
    margin-top: 8pt;
  }
  .sord-ans-row {
    font-size: 9.5pt;
    padding: 2pt 0;
    border-bottom: 0.25pt solid #eee;
  }

  /* ── True/False/NG ───────────────────────────────────────────────────────── */
  .tfng-statement {
    font-size: 10.5pt;
    margin-bottom: 4pt;
  }
  .tfng-options {
    display: flex;
    gap: 6pt;
    margin-bottom: 4pt;
  }
  .tfng-btn {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    font-size: 8.5pt;
    padding: 1pt 7pt;
    cursor: default;
  }
  .tfng-explanation {
    font-size: 8.5pt;
    color: #555;
    display: none;
  }
  .tfng-explanation.show { display: block; }

  /* ── Contextual swap ─────────────────────────────────────────────────────── */
  .swap-para {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    font-size: 10.5pt;
    line-height: 2;
    padding: 7pt 9pt;
  }
  /* Highlighted swap targets become underlined blanks */
  .swap-target {
    background: none;
    border-bottom: 0.75pt solid #000;
    color: transparent; /* hide value if already selected */
    font-weight: 400;
    padding: 0 2pt;
    min-width: 48pt;
    display: inline-block;
  }
  /* Word bank: show options as a comma-separated sentence */
  .swap-options {
    display: block !important;
    margin-top: 6pt;
    font-size: 8.5pt;
    color: #555;
  }
  .swap-opt {
    display: inline;
    border: none;
    background: none;
    border-radius: 0;
    padding: 0;
    font-size: 8.5pt;
    color: #555;
    cursor: default;
  }
  .swap-opt::after { content: ",  "; }
  .swap-opt:last-child::after { content: ""; }
  .swap-opt.used,
  .swap-opt.sel { opacity: 1; pointer-events: none; }

  /* ── Functional phrases ──────────────────────────────────────────────────── */
  .phrases-grid { grid-template-columns: repeat(2, 1fr); gap: 5pt; }
  .phrase-card {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    padding: 5pt 7pt;
  }
  .phrase-text  { font-size: 10.5pt; font-weight: 600; color: #000; }
  .phrase-usage { font-size: 8.5pt; color: #555; }

  /* ── Reading text ────────────────────────────────────────────────────────── */
  .reading-text {
    border: none;
    border-left: 2.5pt solid #555;
    border-radius: 0;
    background: none;
    font-size: 10.5pt;
    line-height: 1.7;
    padding: 4pt 10pt;
  }
  .discussion-item {
    border: 0.5pt solid #ddd;
    border-radius: 0;
    background: none;
    font-size: 9.5pt;
    padding: 4pt 7pt;
  }

  /* ── Production / speaking task ──────────────────────────────────────────── */
  .scenario-box {
    background: none;
    color: #000;
    border: 1.5pt solid #000;
    border-radius: 0;
    padding: 7pt 10pt;
    font-size: 10pt;
  }
  .scenario-label { color: #555; }
  .role-cards { grid-template-columns: 1fr 1fr; gap: 7pt; margin-bottom: 10pt; }
  .role-card {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    background: none;
    padding: 6pt 8pt;
  }
  .role-name        { color: #000; font-size: 10pt; margin-bottom: 5pt; }
  .role-field-label { font-size: 7.5pt; color: #555; }
  .role-field-text  { font-size: 9.5pt; color: #222; }
  .req-section {
    background: none;
    border: 0.5pt solid #ccc;
    border-radius: 0;
    padding: 5pt 8pt;
    margin-bottom: 8pt;
  }
  .req-section-label { color: #000; font-size: 8.5pt; }
  .req-chip {
    background: none;
    border: 0.5pt solid #777;
    border-radius: 0;
    color: #000;
    font-size: 8.5pt;
    padding: 1pt 6pt;
  }
  .debrief-item {
    border: 0.5pt solid #ddd;
    border-radius: 0;
    background: none;
    font-size: 9.5pt;
    padding: 4pt 7pt;
  }

  /* ── Watch panel: video hidden, show link + QR side by side ──────────────── */
  .yt-panel {
    border: 0.5pt solid #ccc;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 12pt;
  }
  .yt-below-row  { flex-direction: row; min-height: 0; border-top: none; }
  .yt-below-left {
    flex: none;
    flex-direction: row;
    align-items: flex-start;
    gap: 14pt;
    padding: 8pt 10pt;
    border-right: none;
    background: none;
  }
  .yt-qr-wrap { margin-top: 0; }
  .yt-qr { width: 72pt; height: 72pt; border: 0.5pt solid #ccc; border-radius: 0; }
  .yt-meta-label { font-size: 7pt; color: #777; margin-bottom: 3pt; }
  .yt-link { font-size: 8.5pt; color: #000; text-decoration: underline; white-space: normal; }
  .yt-below-right { display: none !important; }

  /* ── Transcript (inside Watch panel) ────────────────────────────────────── */
  .tx-body { max-height: none; overflow: visible; }
  .tx-line { padding: 3pt 0; border-bottom: 0.25pt solid #eee; }
  .tx-ts {
    font-size: 7.5pt;
    background: none;
    border: 0.5pt solid #ccc;
    color: #555;
    border-radius: 0;
    padding: 0 3pt;
    cursor: default;
  }
  .tx-text { font-size: 9pt; color: #222; }
  .tx-toggle-row { display: none; }

  /* ── Answer key mode (body.print-answer-key) ─────────────────────────────── */
  /* Cloze gaps: show the correct answer in the blank */
  body.print-answer-key .cloze-input {
    color: #060 !important;
    font-weight: 700;
    border-bottom-color: #060;
  }
  /* Transformation: show the answer line below each prompt */
  body.print-answer-key .transform-input {
    color: #060 !important;
    font-weight: 700;
    border-bottom-color: #060;
  }
  /* Swap targets: show the correct word */
  body.print-answer-key .swap-target {
    color: #060 !important;
    font-weight: 700;
    border-bottom-color: #060;
    background: none;
  }
  /* MCQ: highlight the correct option */
  body.print-answer-key .mcq-option[data-correct] {
    /* Handled via JS attribute matching below is impractical; use a marker */
  }
  /* Match drop-zones: pre-fill with term ID (shown as badge) */
  body.print-answer-key .dz-badge { display: inline-block !important; }
  /* MCQ correct option highlighted green */
  body.print-answer-key .mcq-option.ak-correct {
    border-color: #060;
    background: #f0fdf4;
    font-weight: 600;
  }
  body.print-answer-key .mcq-option.ak-correct .mcq-letter { color: #060; }
  /* Label the answer key */
  body.print-answer-key .print-footer-brand::before {
    content: 'ANSWER KEY  ·  ';
    font-weight: 700;
    color: #c00;
    letter-spacing: .06em;
  }

  /* ── Misc ────────────────────────────────────────────────────────────────── */
  mark { background: none; }
  a    { color: #000; text-decoration: underline; }
  .print-dropdown,
  .print-btn { display: none !important; }
}

/* ── Audio panel ──────────────────────────────────────────────────────────── */
.audio-embed-wrap {
  width: 100%;
  padding: 16px 0 8px;
}
.audio-player {
  width: 100%;
  border-radius: 8px;
  accent-color: var(--accent);
  background: var(--card-bg);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.audio-panel .yt-below-row {
  margin-top: 12px;
}
.tx-audio-para {
  margin: 0 0 10px;
  line-height: 1.65;
  font-size: 13px;
  color: var(--text-2);
}
.tx-audio-para:last-child { margin-bottom: 0; }
.video-cell.has-audio {
  color: #8b5cf6;
  font-size: 11px;
}
