/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:          #F5C200;
  --gold-dark:     #C9A000;
  --gold-light:    #FFF8D6;
  --black:         #0F0F0F;
  --dark:          #1A1A1A;
  --mid:           #2E2E2E;
  --surface:       #FAFAF8;
  --white:         #FFFFFF;
  --border:        #E6E6E2;
  --text:          #111111;
  --muted:         #6B6B6B;
  --text-2:        #3F3F3B;
  --subtle:        #9A9A94;
  --border-soft:   #F0F0EC;   /* row dividers inside cards */
  --fill:          #F1F1EE;   /* code chips, skill letters, neutral pills */
  --gold-ink:      #7A5D00;   /* text on --gold-light */
  --gold-soft:     #FFFBEA;   /* lightest gold wash (hero, highlighted card) */
  --bad-ink:       #B42828;   /* red text: late fee, low attendance, delete option */
  --warn-ink:      #8A4B08;   /* amber text: "needs work" comment, hold conclusion */
  --correct-bg:    #EDFAF0;
  --correct-border:#2E9E50;
  --correct-text:  #1B6B34;
  --wrong-bg:      #FDF0F0;
  --wrong-border:  #D03030;
  --wrong-text:    #9B1C1C;
  --warn-bg:       #FEF3C7;
  --warn-border:   #C98A00;
  --warn-text:     #92400E;
  --ipa-color:     #6D5BD0;
  /* Part-of-speech tags on vocab cards (.hw-pos) — n / v / adj / adv; the rest share --pos-x */
  --pos-n: #1E63A8;   --pos-n-bg: #E8F1FB;
  --pos-v: #1F7A43;   --pos-v-bg: #E6F4EC;
  --pos-adj: #B5560B; --pos-adj-bg: #FDEFE3;
  --pos-adv: #7A3FB0; --pos-adv-bg: #F2EAFA;
  --pos-x: #555555;   --pos-x-bg: #EFEFEC;
  --info-text:     #1D5FBF;
  --info-soft:     #E3EDFC;   /* blue wash: practice-mode banner (after-course) */
  --info-line:     #C6D8F5;
  --example-color: #2E6FA3;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     20px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:     0 10px 36px rgba(0,0,0,0.13);
  --t:             0.18s ease;
  /* Course palette — one scale per course (mockup docs/ui/mockups/course-colors-v1.html, P3).
     RL Reading-Listening · SW Speaking-Writing · AI Academic IELTS · FN Foundation · VI VIP.
     --course-XX = line (card top, timetable bar, course calendar) · -bg = chip tint · -tint = event / bar background
     -solid = filled badge with white text (page code, teaching-calendar bar) · -ink = text on the tints + class page title.
     RL card tops use --gold. */
  --course-RL: #D9A800; --course-RL-bg: #FFF1BF; --course-RL-tint: #FFF7D6; --course-RL-solid: #F5C200; --course-RL-ink: #7A5D00;
  /* Teacher colours of the class form's session bar (js/class-form-rows.js COLORS). */
  --tc-1: #3B6FD4; --tc-2: #D9891A; --tc-3: #2E9E50; --tc-4: #9B59B6; --tc-5: #C0504D; --tc-6: #2A9D8F; --tc-7: #8A6A00; --tc-8: #5D6D7E;
  --course-SW: #6F95DC; --course-SW-bg: #E5EEFF; --course-SW-tint: #EAF1FD; --course-SW-solid: #2F6FD6; --course-SW-ink: #1D4F9E;
  --course-AI: #9B7BD6; --course-AI-bg: #EFE7FC; --course-AI-tint: #F1ECFD; --course-AI-solid: #6D4BD1; --course-AI-ink: #5B3A99;
  --course-FN: #3FA7AD; --course-FN-bg: #DDF3F3; --course-FN-tint: #E3F6F3; --course-FN-solid: #17806F; --course-FN-ink: #0F6E64;
  --course-VI: #C96A2B; --course-VI-bg: #FCE6D6; --course-VI-tint: #FCEFE4; --course-VI-solid: #B85C22; --course-VI-ink: #8A4513;
}

html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Arial has no weight above bold: 800/900 (e.g. <strong> inside a bold link →
   "bolder" = 900) gets faux-emboldened and garbles Vietnamese diacritics. */
strong, b { font-weight: 700; }

/* ════════════════════════════════════════
   SHARED – HEADER
════════════════════════════════════════ */
header {
  width: 100%;
  background: var(--white);
  padding: 15px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  border-bottom: 2px solid var(--gold);
}

.logo {
  display: flex;
  align-items: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  text-decoration: none;
}


.header-back {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--t), border-color var(--t);
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.header-back:hover { color: var(--gold-dark); border-color: var(--gold); }
.header-back svg   { width: 14px; height: 14px; flex-shrink: 0; }

/* Multi-level trail that replaces .header-back (setHeaderTrail in js/util.js). */
.header-trail {
  display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end;
  gap: 2px 4px; min-width: 0;
  font-size: 12px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.header-trail__link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none;
  padding: 6px 10px; border-radius: var(--radius); border: 1px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.header-trail__link:hover { color: var(--gold-dark); border-color: var(--gold); }
.header-trail__link.is-near { border-color: var(--border); }
.header-trail__link.is-near:hover { border-color: var(--gold); }
.header-trail__arrow { display: none; }
.header-trail__arrow svg { width: 14px; height: 14px; display: block; }
.header-trail__sep { color: var(--muted); opacity: .5; font-weight: 400; font-size: 14px; }
@media (max-width: 560px) {
  .header-trail__link:not(.is-near), .header-trail__sep { display: none; }
  .header-trail__link.is-near .header-trail__arrow { display: inline-flex; }
}

/* ════════════════════════════════════════
   SHARED – HERO STRIP
════════════════════════════════════════ */
.hero {
  width: 100%;
  background: var(--gold);
  padding: 20px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(0,0,0,0.03) 20px,
    rgba(0,0,0,0.03) 21px
  );
  pointer-events: none;
}
.hero h1 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  position: relative;
}
.hero p {
  font-size: 13px;
  color: var(--dark);
  margin-top: 3px;
  font-weight: 500;
  position: relative;
}
/* Grammar Practice hero — Arial, to match the Arial grammar list below it. */
.hero--grammar h1,
.hero--grammar p {
  font-family: Arial, Helvetica, sans-serif;
}
.hero--grammar h1 { letter-spacing: 0.3px; }

/* ════════════════════════════════════════
   SHARED – MAIN WRAPPER
════════════════════════════════════════ */
main {
  width: 100%;
  max-width: 680px;
  padding: 36px 20px 72px;
  flex: 1;
}

/* ════════════════════════════════════════
   INDEX PAGE
════════════════════════════════════════ */
.index-main { max-width: 600px; }

/* Class section */
.class-section { margin-bottom: 36px; }

.class-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}

.class-badge {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--gold);
  color: var(--black);
  border-radius: 8px;
  padding: 4px 14px;
}

.class-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Class-selection cards (homepage) */
.class-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.class-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 22px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.class-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.class-card:active { transform: translateY(0); }

.class-card-icon {
  width: 56px;
  height: 56px;
  background: var(--gold);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.class-card-icon svg {
  width: 26px;
  height: 26px;
  color: var(--black);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.class-card-body { flex: 1; min-width: 0; }

.class-card-badge {
  display: inline-block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--gold-light);
  color: var(--gold-dark);
  border: 1px solid rgba(245,194,0,0.5);
  border-radius: 6px;
  padding: 2px 9px;
  margin-bottom: 6px;
}

.class-card-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.1px;
  line-height: 1.2;
}

.class-card-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.4;
}

.class-card-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.class-card-arrow {
  color: var(--border);
  flex-shrink: 0;
  transition: color var(--t);
}
.class-card-arrow svg { width: 18px; height: 18px; }
.class-card:hover .class-card-arrow { color: var(--gold-dark); }

/* Empty state (topics page) */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--white);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-xl);
}
.empty-state-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 6px;
}
.empty-state-sub {
  font-size: 14px;
  color: var(--muted);
}

/* Topic rows */
.topic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-section-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--black);
  margin: 28px 0 12px;
}
.list-section-title:first-child { margin-top: 0; }

.topic-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.topic-row:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.topic-row:active { transform: translateY(0); }

.topic-row-day {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--gold-dark);
  background: var(--gold-light);
  border: 1px solid rgba(245,194,0,0.45);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  /* Fixed width so "Week 10"+ badges don't push the icon/title out of line with "Week 9" rows. */
  min-width: 76px;
  text-align: center;
}

.topic-row-icon {
  width: 42px;
  height: 42px;
  background: var(--gold);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topic-row-icon svg {
  width: 20px;
  height: 20px;
  color: var(--black);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topic-row-info { flex: 1; min-width: 0; }

.topic-row-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.1px;
  line-height: 1.2;
}

.topic-row-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topic-row-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.topic-row-arrow {
  color: var(--border);
  flex-shrink: 0;
  transition: color var(--t);
}
.topic-row-arrow svg { width: 16px; height: 16px; }
.topic-row:hover .topic-row-arrow { color: var(--gold-dark); }

.topic-row.locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.topic-row.locked:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: none;
}
.status-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-badge-ongoing {
  color: var(--gold-dark);
  background: var(--gold-light);
  border: 1px solid rgba(245,194,0,0.45);
}
.status-badge-completed {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.topic-row-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topic-row-badge-done {
  color: var(--correct-text);
  background: var(--correct-bg);
  border: 1px solid var(--correct-border);
}

/* Practice tests: Cambridge book -> Test number -> Skill (3-layer grouping) */
.pt-book { display: flex; flex-direction: column; }
.pt-book-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--gold-light);
  border: 1.5px solid rgba(245,194,0,0.45);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color var(--t), box-shadow var(--t);
}
.pt-book-header:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
}
.pt-book-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--black);
  flex: 1;
}
.pt-book-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.pt-book-chevron {
  color: var(--border);
  flex-shrink: 0;
  transition: transform var(--t), color var(--t);
}
.pt-book-chevron svg { width: 16px; height: 16px; display: block; }
.pt-book-header:hover .pt-book-chevron { color: var(--gold-dark); }
.pt-book.is-open .pt-book-chevron { transform: rotate(90deg); }
.pt-book-body {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.pt-book-body:not([hidden]) { display: flex; }

.pt-test-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}
.pt-test-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pt-test-card-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--black);
}
.pt-skill-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.start-mock-btn { width: 100%; margin-top: 12px; }
.pt-skill-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-width: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.pt-skill-pill:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.pt-skill-pill-icon {
  width: 30px;
  height: 30px;
  background: var(--gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pt-skill-pill-icon svg {
  width: 16px;
  height: 16px;
  color: var(--black);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pt-skill-pill-label {
  font-weight: 700;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pt-skill-pill-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.pt-skill-pill.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.pt-skill-pill.is-disabled .pt-skill-pill-icon { background: var(--border); }

@media (max-width: 48rem) {
  .pt-skill-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Homework (topics.html?mode=homework): summary card, then one band per
   week (newest first) with a card per skill. ── */
.hwl { display: flex; flex-direction: column; gap: 18px; }

.hwl-summary {
  display: grid; grid-template-columns: minmax(180px, 260px) 1fr auto; align-items: center; gap: 14px 22px;
  padding: 16px 18px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
}
.hwl-summary__nums { font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.hwl-summary__nums strong { font-size: 22px; color: var(--text); margin-right: 2px; }
.hwl-bar { height: 8px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.hwl-bar i { display: block; height: 100%; border-radius: inherit; background: var(--correct-border); min-width: 0; }

.hwl-continue {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 14px 11px 16px;
  border-radius: var(--radius); background: var(--gold); color: var(--text); text-decoration: none;
  transition: background var(--t), box-shadow var(--t);
}
.hwl-continue:hover { background: #FFD21F; box-shadow: var(--shadow-sm); }
.hwl-continue__k { flex: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.55); }
.hwl-continue__t { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hwl-continue svg { flex: none; width: 16px; height: 16px; }
.hwl-alldone { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--correct-text); }
.hwl-alldone svg { width: 18px; height: 18px; }

.hwl-filter { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.hwl-filter button { border: 0; background: none; padding: 6px 13px; border-radius: 999px; font: 700 13px Arial, Helvetica, sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap; }
.hwl-filter button b { font-weight: 700; margin-left: 3px; color: #9A9A92; }
.hwl-filter button:hover { color: var(--text); }
.hwl-filter button[aria-selected="true"] { background: var(--white); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.hwl-filter button[aria-selected="true"] b { color: var(--gold-dark); }

/* Timeline across the bottom of the summary card. */
.hwl-tl { grid-column: 1 / -1; min-width: 0; padding-top: 14px; border-top: 1px solid var(--border); }
.hwl-tl__legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.hwl-tl__legend span { display: inline-flex; align-items: center; gap: 5px; }
.hwl-tl__legend i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #D5D5CF; background: var(--white); }
.hwl-tl__legend i.is-done { background: var(--correct-border); border-color: var(--correct-border); }
.hwl-tl__legend i.is-progress { background: var(--gold); border-color: var(--gold); }
.hwl-tl__legend i.is-overdue { background: var(--white); border-color: var(--wrong-border); }
.hwl-tl__track { overflow-x: auto; scrollbar-width: thin; padding: 2px 0 4px; }
.hwl-tl__row { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(46px, 1fr)); padding-top: 20px; }
.hwl-tl__line { position: absolute; top: 33px; left: calc(50% / var(--n)); right: calc(50% / var(--n)); height: 4px; border-radius: 999px; background: var(--border); }
.hwl-tl__line i { display: block; height: 100%; border-radius: inherit; background: var(--correct-border); }
.hwl-tl__wk { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0 2px 2px; border: 0; background: none; cursor: pointer; font: inherit; color: var(--muted); }
.hwl-tl__dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--white); border: 2.5px solid #D5D5CF; color: var(--white); font: 800 14px Arial, Helvetica, sans-serif; transition: transform var(--t), box-shadow var(--t); }
.hwl-tl__dot svg { width: 15px; height: 15px; }
.hwl-tl__wk:hover .hwl-tl__dot { transform: scale(1.1); box-shadow: var(--shadow-sm); }
.hwl-tl__wk.is-done .hwl-tl__dot { background: var(--correct-border); border-color: var(--correct-border); }
.hwl-tl__wk.is-progress .hwl-tl__dot { background: var(--gold-light); border-color: var(--gold); }
.hwl-tl__wk.is-overdue .hwl-tl__dot { background: var(--wrong-bg); border-color: var(--wrong-border); color: var(--wrong-border); }
.hwl-tl__wk.is-next .hwl-tl__dot { box-shadow: 0 0 0 4px var(--gold-light), 0 0 0 6px var(--gold); }
.hwl-tl__lbl { font-size: 12px; font-weight: 700; color: var(--mid); }
.hwl-tl__wk.is-next .hwl-tl__lbl { color: var(--text); }
.hwl-tl__here { position: absolute; top: -20px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: var(--text); font-size: 12px; font-weight: 700; white-space: nowrap; }
.hwl-tl__pips { display: flex; gap: 3px; }
.hwl-tl__pips i { width: 7px; height: 7px; border-radius: 2px; border: 1.5px solid var(--sk, #C9C9C2); background: var(--white); }
.hwl-tl__pips i.is-progress { background: var(--sk-soft, var(--gold-light)); }
.hwl-tl__pips i.is-done { background: var(--sk, var(--correct-border)); }
.hwl-week.is-flash .hwl-week__head { animation: hwl-flash 1.2s ease; border-radius: 8px; }
@keyframes hwl-flash { 0%, 40% { background: var(--gold-light); } 100% { background: transparent; } }
.hwl-week { scroll-margin-top: 16px; }

.hwl-weeks { display: flex; flex-direction: column; gap: 22px; }
.hwl-week[hidden], .hwl-item[hidden], .hwl-empty[hidden] { display: none; }
.hwl-week__head { display: flex; align-items: center; gap: 10px; margin: 0 2px 9px; }
.hwl-week__label { margin: 0; font: 700 16px/1.2 Arial, Helvetica, sans-serif; color: var(--text); }
.hwl-week__tag { padding: 2px 9px; border-radius: 999px; background: var(--gold-light); color: var(--gold-ink); font-size: 12px; font-weight: 700; }
.hwl-week__status { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.hwl-week.is-complete .hwl-week__status { color: var(--correct-text); }
.hwl-week__status svg { width: 14px; height: 14px; }
.hwl-dots { display: inline-flex; gap: 4px; }
.hwl-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.hwl-dots i.is-progress { background: var(--gold); }
.hwl-dots i.is-done { background: var(--correct-border); }

.hwl-week__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.hwl-item {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 13px;
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.hwl-item:hover { border-color: var(--sk, var(--gold)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.hwl-item.is-next { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.hwl-item.is-done { background: var(--surface); }
.hwl-item.is-done .hwl-item__title { color: var(--mid); }
.hwl-item__icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--gold); }
.hwl-item__icon svg { width: 19px; height: 19px; color: var(--black); stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hwl-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hwl-item__skill { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sk-ink, var(--muted)); }
.hwl-next-tag { padding: 1px 7px; border-radius: 999px; background: var(--gold); color: var(--text); font-size: 12px; letter-spacing: .04em; }
.hwl-item__title { font-size: 15px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hwl-item__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 5px; }
.hwl-item__meta .due-chip { margin: 0; }
.hwl-item__count { font-size: 12px; color: var(--muted); }
.hwl-item__arrow { flex: none; align-self: center; color: #B5B5B0; transition: color var(--t), transform var(--t); }
.hwl-item__arrow svg { width: 16px; height: 16px; display: block; }
.hwl-item:hover .hwl-item__arrow { color: var(--sk-ink, var(--gold-dark)); transform: translateX(2px); }

.hwl-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.hwl-pill svg { width: 12px; height: 12px; }
.hwl-pill--new { background: var(--border-soft); color: var(--muted); }
.hwl-pill--progress { background: #FFF3C4; color: var(--gold-ink); }
.hwl-pill--done { background: var(--correct-bg); color: var(--correct-text); }

.hwl-empty { margin: 4px 2px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .hwl-summary { grid-template-columns: 1fr; }
  .hwl-filter { justify-self: start; }
}
@media (max-width: 560px) {
  .hwl-item { padding: 12px; gap: 10px; }
  .hwl-item__icon { width: 34px; height: 34px; }
  .hwl-continue { gap: 8px; padding: 10px 12px; }
  .hwl-continue__k { font-size: 12px; padding: 2px 6px; }
}

/* ── Student page header: the breadcrumb lists only the levels above this page
   (the title already names the current page), with a back chevron. Class code
   badge used in page titles (mode.html). ── */
.st-crumb .st-crumb-current, .st-crumb .st-crumb-sep:has(+ .st-crumb-current) { display: none; }
.st-crumb::before { content: '‹'; margin-right: 5px; font-size: 15px; line-height: 1; color: var(--muted); }
.st-crumb:empty::before { content: none; }
/* Class page titles: course colour (RL gold, SW blue, FN teal, AI violet) with
   the class code as a solid badge in front. */
.admin-page-title.page-title--RL { color: var(--course-RL-ink); }
.admin-page-title.page-title--SW { color: var(--course-SW-ink); }
.admin-page-title.page-title--FN { color: var(--course-FN-ink); }
.admin-page-title.page-title--VI { color: var(--course-VI-ink); }
.admin-page-title.page-title--AI { color: var(--course-AI-ink); }
.page-code { display: inline-block; margin-right: 6px; padding: 3px 10px; border-radius: 8px; font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: .02em; vertical-align: 3px; background: var(--gold); color: var(--text); }
.page-code--SW { background: var(--course-SW-solid); color: var(--white); }
.page-code--FN { background: var(--course-FN-solid); color: var(--white); }
.page-code--VI { background: var(--course-VI-solid); color: var(--white); }
.page-code--AI { background: var(--course-AI-solid); color: var(--white); }
/* Student page header spacing: crumb → title → subtitle. */
.admin-page-header .st-crumb { margin-bottom: 8px; }
.admin-page-header .st-crumb:empty { display: none; }
.st-crumb ~ .admin-page-title { line-height: 1.25; }
.st-crumb ~ .admin-page-sub { margin-top: 7px; font-size: 14px; }

.reset-pin-btn {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--t), background var(--t);
}
.reset-pin-btn:hover { border-color: var(--gold); background: var(--gold-light); }
.student-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start; }
.topic-row-sub.email-line { margin-top: 2px; }

/* Create-account panel (admin-students / admin-staff) */
.admin-create { margin-bottom: 22px; }
.admin-create__toggle {
  border: 1.5px solid var(--gold-dark);
  background: var(--gold-light);
  color: var(--black);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.admin-create__toggle:hover { background: var(--gold); }
.admin-create__form {
  margin-top: 12px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  max-width: 460px;
}
.admin-create__form[hidden] { display: none; }
.admin-create__form .name-input,
.admin-create__form select.name-input { margin-bottom: 12px; }
.admin-create__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-create__msg { font-size: 13px; font-weight: 700; margin-top: 6px; }
.admin-create__msg.is-error { color: var(--wrong-text); }
.admin-create .temp-pin-box { margin-top: 12px; }

/* Inline edit form inside a user row */
.user-edit {
  margin-top: 12px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 420px;
}
.user-edit .name-input { margin-bottom: 10px; }
.user-edit__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
.user-edit__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.user-edit__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--gold-light);
  border: 1px solid var(--gold-dark);
  font-size: 12px;
  font-weight: 700;
}
.user-edit__chip-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--wrong-text);
  padding: 0 4px;
}
.reset-pin-result.temp-pin-box {
  white-space: normal;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.7;
}
.temp-pin {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 2px 8px;
}
.copy-pin-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 3px 10px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.copy-pin-btn:hover { border-color: var(--gold); background: var(--gold-light); }
.temp-pin-note { color: var(--muted); font-weight: 400; }
.reset-pin-result {
  font-size: 12px;
  font-weight: 700;
  color: var(--correct-text);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   QUIZ PAGE – PROGRESS
════════════════════════════════════════ */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}
.progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  min-width: 52px;
  text-align: right;
}

/* ── Card ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.28s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Total quiz timer ── */
.total-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--black);
  background: var(--gold);
  border-radius: 99px;
  padding: 8px 24px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, color 0.4s;
}
.total-timer-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.total-timer.warn   { background: #FEF3C7; color: var(--warn-text); }
.total-timer.danger { background: #FEE2E2; color: #991B1B; animation: pulse-timer 0.7s ease-in-out infinite; }
@keyframes pulse-timer {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* ── Card header (tag + timer row) ── */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.card-header .tag { margin-bottom: 4px; }

/* ── Countdown timer ── */
.timer {
  position: relative;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}
.timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}
.timer-ring {
  fill: none;
  stroke: var(--correct-border);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 125.66 125.66;
  transition: stroke-dasharray 0.95s linear, stroke 0.3s;
}
.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--correct-text);
  transition: color 0.3s;
}
.timer-warn   .timer-ring { stroke: #F59E0B; }
.timer-warn   .timer-num  { color: var(--warn-text); }
.timer-danger .timer-ring { stroke: #EF4444; }
.timer-danger .timer-num  { color: #991B1B; }

/* ── Tag ── */
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--gold-light);
  color: var(--gold-dark);
  border: 1px solid rgba(245,194,0,0.5);
  border-radius: 99px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

/* ── Question ── */
.q-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.q-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--black);
  margin-bottom: 26px;
}

/* ── Options ── */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.opt-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  text-align: left;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  transition: border-color var(--t), background var(--t), transform 0.1s;
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--gold-light);
  transform: translateY(-1px);
}
.opt-btn:active:not(:disabled) { transform: translateY(0); }
.opt-btn.selected:not(.correct):not(.wrong) {
  border-color: var(--gold-dark);
  background: var(--gold-light);
  font-weight: 600;
  box-shadow: 0 0 0 1.5px var(--gold-dark) inset;
}
.opt-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct-border);
  color: var(--correct-text);
  font-weight: 600;
}
.opt-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong-border);
  color: var(--wrong-text);
  font-weight: 600;
}
.opt-btn:disabled { cursor: default; transform: none; }

/* ── Feedback ── */
.feedback {
  min-height: 46px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 20px;
  padding: 0 2px;
}
.feedback .label-correct { color: var(--correct-text); font-weight: 700; }
.feedback .label-wrong   { color: var(--wrong-text);   font-weight: 700; }

/* ── Bottom bar ── */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.score-chip {
  font-size: 13px;
  font-weight: 700;
  background: var(--gold);
  color: var(--black);
  border-radius: 99px;
  padding: 6px 14px;
}
/* Large student button (quiz / homework / exam) — same values as .ui-btn--primary.ui-btn--lg */
.next-btn {
  background: var(--gold);
  border-radius: var(--radius);
  border: 1px solid var(--gold-dark);
  min-height: 44px;
  padding: 0 24px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  cursor: pointer;
  transition: background var(--t), transform 0.1s;
}
.next-btn:hover:not(:disabled) { background: var(--gold-dark); transform: translateY(-1px); }
.next-btn:active:not(:disabled) { transform: translateY(0); }
.next-btn:disabled { opacity: 0.32; cursor: default; transform: none; }

/* ════════════════════════════════════════
   QUIZ PAGE – RESULT SCREEN
════════════════════════════════════════ */
.result {
  text-align: center;
  padding: 16px 0 8px;
}
.result-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 6px 24px rgba(245,194,0,0.45);
}
.result-score {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 44px;
  font-weight: 700;
  color: var(--black);
  line-height: 1;
}
.result-total {
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.result-msg {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.result-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.55;
}
.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.restart-btn {
  background: var(--gold);
  color: var(--black);
  border: none;
  border-radius: var(--radius);
  padding: 13px 28px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t);
}
.restart-btn:hover { background: var(--gold-dark); }
.topics-btn {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 28px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  text-decoration: none;
  display: inline-block;
}
.topics-btn:hover { border-color: var(--gold); background: var(--gold-light); }

/* ── Start screen (name entry) ── */
.start-screen {
  text-align: center;
  padding: 20px 0 8px;
}
.start-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.start-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}
.name-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: border-color var(--t);
}
.name-input:focus {
  outline: none;
  border-color: var(--gold);
}

.pin-input-wrap { position: relative; }
.pin-input-wrap .name-input { padding-right: 44px; }
.pin-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
  transition: color var(--t);
}
.pin-toggle-btn:hover { color: var(--text); }
.pin-toggle-btn svg { width: 19px; height: 19px; }
.start-error {
  color: var(--wrong-text);
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
}
/* Large student button — same values as .ui-btn--primary.ui-btn--lg (44px, 15px, r 10px) */
.start-btn {
  display: flex; align-items: center; justify-content: center; width: fit-content;
  margin: 22px auto 0;
  background: var(--gold);
  color: var(--black);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 0 28px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t), transform 0.1s;
}
.start-btn:hover { background: var(--gold-dark); }
.start-btn:active { transform: translateY(1px); }
a.start-btn { text-decoration: none; }

.start-screen-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.start-screen-actions .start-btn { margin: 0; }
.start-btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.start-btn-secondary:hover { background: var(--surface); border-color: var(--gold); }

.start-switch {
  margin-top: 16px;
  font-size: 13px;
}
.start-switch a {
  color: var(--muted);
  text-decoration: underline;
  transition: color var(--t);
}
.start-switch a:hover { color: var(--gold-dark); }

/* ── Roster selection screen ── */
.roster-card { max-width: 420px; margin: 0 auto; }
.roster-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
  margin: 20px 0 8px;
}
.roster-label:first-child { margin-top: 0; }
.roster-select {
  display: block;
  width: 100%;
  margin: 0;
  text-align: left;
}
.roster-select:disabled { opacity: 0.55; cursor: not-allowed; }
.roster-error {
  color: var(--wrong-text);
  font-size: 12px;
  font-weight: 600;
  margin-top: 14px;
  text-align: center;
}

/* ── Loading state ── */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   HOMEWORK PAGE
════════════════════════════════════════ */
/* Arial is the official IELTS typeface (paper and computer-delivered) —
   match it here, and for quiz-main below, so homework/quiz content reads
   consistently with the practice-test module's exam-shell instead of the
   site's own Barlow branding. Scoped to these content areas only; the
   shared header/hero/nav chrome stays on-brand. */
.homework-main,
.quiz-main {
  font-family: Arial, Helvetica, sans-serif;
}

.homework-main { max-width: none; padding-left: 32px; padding-right: 32px; }

.hw-card { margin-bottom: 24px; }

/* ── Vocabulary section ── */
.hw-vocab-header {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.6;
}
.hw-star { color: var(--gold-dark); }

/* Highlighted key-vocabulary words */
.hw-kw-list { margin-bottom: 16px; line-height: 2.1; }
.hw-kw {
  display: inline-block;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-weight: 600;
  font-size: 13.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin: 2px 1px;
}

/* Vocab exercise split panes (definitions left, questions right) */
.reading-panes--vocab { height: auto; min-height: 0; max-height: 74vh; margin-bottom: 6px; }
.vocab-pane--defs     { width: var(--split); flex: 0 0 auto; }
.vocab-pane--exercise { flex: 1 1 auto; }
.vocab-pane--defs .vocab-list { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.vocab-pane--exercise .hw-exercise-title { margin-top: 0; }
@media (max-width: 48rem) {
  .vocab-pane--defs, .vocab-pane--exercise { width: 100%; flex: 0 0 auto; max-height: 48vh; }
}

.vocab-list {
  list-style: none;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1.5px dashed var(--border);
}
.vocab-item {
  position: relative;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
}
.vocab-item:last-child { margin-bottom: 0; }
.vocab-item::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-dark);
}
.vocab-item strong { color: var(--black); }
.vocab-type  { color: var(--muted); font-style: italic; }
.vocab-ipa   { color: var(--ipa-color); font-weight: 600; }
.vocab-meaning { color: var(--text); }
.vocab-example {
  display: block;
  margin-top: 3px;
  color: var(--example-color);
}

/* Boxed like the practice-test's .exam-group-instructions — background:
   white (not --surface) so it stands out against the panes' own --surface
   background above, the same way exam-group-instructions stands out
   against its plain page background. */
.hw-exercise-num {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-dark);
  margin: 0 0 6px;
}

/* Grammar summary / "new knowledge" panel (before the exercises) */
.hw-summary-box {
  background: var(--white);
  border: 2px solid var(--correct-border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
  scroll-margin-top: 68px;
}
.hw-summary-box__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--correct-bg);
  border: none;
  cursor: pointer;
  text-align: left;
}
.hw-summary-box__title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--correct-text);
}
.hw-summary-box__chev {
  color: var(--correct-text);
  font-size: 13px;
  transition: transform var(--t);
}
.hw-summary-box.is-collapsed .hw-summary-box__chev { transform: rotate(-90deg); }
.hw-summary-box.is-collapsed .hw-summary-box__body { display: none; }
.hw-summary-box__body { padding: 14px 18px 4px; }
.hw-gs-intro { font-size: 15.5px; color: var(--text); margin: 0 0 12px; line-height: 1.6; }
.hw-gs-group { margin-bottom: 16px; }
.hw-gs-group:last-child { margin-bottom: 8px; }
.hw-gs-heading {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--correct-text);
  margin: 0 0 6px;
}
.hw-gs-list { margin: 0; padding-left: 20px; }
.hw-gs-list li {
  font-size: 15.5px;
  line-height: 1.6;
  margin-bottom: 9px;
  color: var(--text);
}
/* Theory examples: one sentence per row (js/homework.js renderExamples). */
.hw-gs-eg {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hw-gs-eg__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 6px 4px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-style: italic;
  color: #1e63a8;
  font-size: 14.5px;
  line-height: 1.5;
}
.hw-gs-list li .hw-gs-eg__row { margin-bottom: 0; font-size: 14.5px; }
.hw-gs-eg__mk { flex: none; width: 12px; font-style: normal; font-weight: 800; font-size: 13px; color: var(--muted); }
.hw-gs-eg__txt { flex: 1; min-width: 0; overflow-wrap: break-word; }
.hw-gs-eg__row .hw-gs-speak { margin-left: auto; }
.hw-gs-eg__row--not { color: var(--wrong-text); background: var(--wrong-bg); border-color: #F2C9C9; }
.hw-gs-eg__row--not .hw-gs-eg__mk { color: var(--wrong-text); }
.hw-gs-eg strong { color: #143f6b; font-style: normal; }
.hw-gs-eg__row--not strong { color: var(--wrong-text); }
.hw-gs-not { color: var(--bad-ink); font-weight: 600; }

/* Vietnamese gloss — muted second line under an English rule / intro. */
.hw-gs-vi {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: #6a6f77;
  border-left: 2px solid var(--gold-dark);
  padding-left: 9px;
}
p.hw-gs-intro.hw-gs-vi { margin-top: -6px; margin-bottom: 12px; }
.hw-gs-heading-vi {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #6a6f77;
  letter-spacing: 0;
}

/* Vocabulary Practice's "Key vocabulary" box only (skill.type === 'vocabulary',
   see renderGrammarSummary's `opts.vocab` in js/homework.js). Grammar's box
   is untouched — same .hw-summary-box shell, but keeps the plain <ul><li>
   layout above, never the tabs/cards below. */
.hw-summary-box--vocab .hw-summary-box__body { padding-bottom: 16px; }

/* Section tabs (book sections A/B/C) — only rendered when a vocab summary
   has more than one group, so its sections are switched one at a time
   instead of stacked in one long scroll. */
.hw-vocab-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hw-vocab-tab {
  display: flex; align-items: center; gap: 8px; font: inherit; text-align: left;
  padding: 5px 14px 5px 5px; border-radius: 999px; border: 1.5px solid var(--correct-border);
  background: var(--white); cursor: pointer;
}
.hw-vocab-tab:hover { background: var(--correct-bg); }
.hw-vocab-tab.is-active { background: var(--correct-border); border-color: var(--correct-border); }
.hw-vocab-tab__letter {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--correct-bg); color: var(--correct-text);
  font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 12.5px;
}
.hw-vocab-tab.is-active .hw-vocab-tab__letter { background: var(--white); color: var(--correct-border); }
.hw-vocab-tab__label { display: flex; align-items: baseline; gap: 6px; line-height: 1.3; white-space: nowrap; }
.hw-vocab-tab__label { font-size: 13.5px; font-weight: 700; color: var(--text); text-transform: capitalize; }
.hw-vocab-tab__label-vi { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: none; }
.hw-vocab-tab__label-vi::before { content: "· "; }
.hw-vocab-tab.is-active .hw-vocab-tab__label,
.hw-vocab-tab.is-active .hw-vocab-tab__label-vi { color: var(--white); }

/* Vocab points as cards instead of a bulleted <ul> — an image-reference
   point (a map/diagram/photo) loses its bullet marker instead of looking
   like a stray list item, and a "spotlight: …" point (an established
   convention across every vocab/*.js file, not new markup) gets its own
   tip callout instead of blending into the surrounding rules. */
.hw-gs-points { display: flex; flex-direction: column; gap: 10px; }
.hw-gs-point { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.hw-gs-point__rule { font-size: 15.5px; line-height: 1.6; color: var(--text); }
.hw-gs-point--image { background: transparent; border: none; padding: 0; }
.hw-gs-point--spotlight { background: var(--gold-light); border-color: var(--gold-dark); }
.hw-gs-point__tip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--gold-dark); margin-bottom: 6px;
}

/* A plain "word · word · word" point (tryWordListChips in js/homework.js)
   becomes a flashcard-style grid instead of one dense dot-joined line — the
   chip itself is the card, so the point wrapper goes transparent like the
   image variant above. */
.hw-gs-point--list { background: transparent; border: none; padding: 0; }
.hw-gs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hw-gs-chip {
  display: flex; flex-direction: column; gap: 5px; flex: 1 1 130px;
  background: var(--white); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 9px 12px;
}
.hw-gs-chip__en { font-size: 14px; font-weight: 700; color: var(--black); }
.hw-gs-chip__ipa { display: block; font-size: 12.5px; font-weight: 600; color: var(--ipa-color); }
.hw-gs-chip__vi { font-size: 12px; color: var(--muted); }
.hw-gs-point--list .hw-gs-vi { margin-top: 10px; }
.hw-gs-spot-terms { margin-top: 10px; }
.hw-gs-spot-terms .hw-gs-chip { flex: 0 1 auto; border-color: var(--gold-dark); }
.hw-gs-point--list .hw-gs-eg { margin-top: 10px; }
.hw-gs-point__label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.hw-gs-point__label-vi { font-weight: 600; text-transform: none; letter-spacing: 0; }

/* Part-of-speech tag after a vocab card's word (point.pos) + one legend line
   above the cards. Mockup docs/ui/mockups/vocab-pos-tags-v1.html (A). */
.hw-pos {
  display: inline-block; vertical-align: 1px; margin-left: 5px; padding: 0 5px;
  border-radius: 5px; font-size: 12px; font-weight: 700; font-style: normal; line-height: 17px;
  white-space: nowrap; color: var(--pos-x); background: var(--pos-x-bg); cursor: help;
}
.hw-pos + .hw-pos { margin-left: 3px; }
.hw-pos--n   { color: var(--pos-n);   background: var(--pos-n-bg); }
.hw-pos--v   { color: var(--pos-v);   background: var(--pos-v-bg); }
.hw-pos--adj { color: var(--pos-adj); background: var(--pos-adj-bg); }
.hw-pos--adv { color: var(--pos-adv); background: var(--pos-adv-bg); }
/* Legend = <summary> of a <details>; opening it shows the "how to read" guide
   (mockup docs/ui/mockups/vocab-pos-guide-v1.html). */
.hw-pos-box { margin: 0 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.hw-pos-legend {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 10px; cursor: pointer;
}
.hw-pos-legend::-webkit-details-marker { display: none; }
.hw-pos-legend b { color: var(--text); }
.hw-pos-legend .hw-pos, .hw-pos-guide .hw-pos { margin: 0 4px 0 0; cursor: default; }
.hw-pos-help { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }
.hw-pos-help svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.hw-pos-box[open] .hw-pos-help svg { transform: rotate(180deg); }
.hw-pos-guide { border-top: 1px solid var(--border); padding: 10px 12px 12px; color: var(--text); font-size: 13px; }
.hw-pos-guide__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; }
.hw-pos-guide h5 { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.hw-pos-guide__row { display: grid; grid-template-columns: 52px 1fr; gap: 6px; align-items: baseline; padding: 3px 0; }
.hw-pos-guide__row .hw-pos { justify-self: start; }
.hw-pos-guide__name { font-weight: 700; }
.hw-pos-guide__name [lang="vi"] { font-weight: 400; color: var(--muted); }
.hw-pos-guide__eg { display: block; font-size: 12.5px; font-style: italic; color: var(--pos-n); }
.hw-pos-guide__tips { margin-top: 10px; padding: 8px 10px; background: var(--white); border: 1px solid var(--border); border-radius: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; font-size: 12.5px; color: var(--muted); }
.hw-pos-guide__tips b { display: block; color: var(--text); margin-bottom: 2px; }
body:not(.hw-vi-off) .hw-pos-en { display: none; }
@media (max-width: 1100px) { .hw-pos-guide__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .hw-pos-guide__tips { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .hw-pos-guide__grid { grid-template-columns: 1fr; } }

/* A "<strong>term</strong> (note) = definition · <strong>term2</strong> = ..."
   point (tryDefinitionList) — one row per term instead of every definition
   run together in one paragraph. */
.hw-gs-defs { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.hw-gs-def {
  flex: 1 1 240px;
  background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.hw-gs-def__head { margin-bottom: 2px; }
.hw-gs-def__term { font-size: 14.5px; font-weight: 700; color: var(--black); }
.hw-gs-def__note { font-size: 12.5px; font-style: italic; color: var(--muted); }
.hw-gs-def__pron { white-space: nowrap; margin-left: 4px; }
.hw-gs-def__ipa { font-size: 12.5px; font-weight: 600; color: var(--ipa-color); }
.hw-gs-def__eg { font-size: 13.5px; font-style: italic; color: #1e63a8; margin-bottom: 4px; }
.hw-gs-def__body { font-size: 14.5px; line-height: 1.55; color: var(--text); }
/* VI meaning sits before the EN definition, same size + colour (vocab-view-toggle-v1, 29/11/2026) */
.hw-gs-def__vi { font-size: 14.5px; line-height: 1.55; color: var(--text); }
.hw-gs-def__vi + .hw-gs-def__body { margin-top: 2px; }
/* AWL cards: word family under the definition (scripts/awl-ex-build.mjs) */
.hw-gs-def__fam { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.hw-gs-def__fam strong { color: var(--text); font-weight: 600; }

/* Key vocabulary — Table view + hide-to-self-test (js/vocab-view.js) */
.hw-vt { display: none; width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: var(--white); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 14px; }
body.hw-vv-table .hw-vv-cards { display: none; }
body.hw-vv-table .hw-vt { display: table; }
.hw-gs-points { counter-reset: hwvt; }
.hw-vt tbody tr { counter-increment: hwvt; }
.hw-vt td.hw-vt__n::before { content: counter(hwvt); }
.hw-vt th { background: var(--surface); font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.hw-vt td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.hw-vt tbody tr:last-child td { border-bottom: 0; }
.hw-vt tbody tr:hover td { background: var(--surface); }
.hw-vt .hw-vt__n { width: 36px; text-align: right; color: var(--muted); font-size: 12px; }
.hw-vt .hw-vt__term { width: 24%; }
.hw-vt .hw-vt__pron { width: 20%; }
.hw-vt .hw-vt__vi { width: 24%; }
.hw-vt--nodef .hw-vt__vi { width: auto; }
.hw-vt .hw-gs-def__eg { margin-bottom: 2px; }
body.hw-vv-hide-term .hw-vv-term:not(.is-peek),
body.hw-vv-hide-mean .hw-vv-mean:not(.is-peek) { filter: blur(5px); cursor: pointer; user-select: none; }
@media (max-width: 560px) {
  body.hw-vv-table .hw-vt { display: block; }
  .hw-vt thead { display: none; }
  .hw-vt tbody, .hw-vt tr, .hw-vt td { display: block; width: auto; }
  .hw-vt tr { padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .hw-vt tr:last-child { border-bottom: 0; }
  .hw-vt td { padding: 0; border: 0; }
  .hw-vt td.hw-vt__n { display: none; }
  .hw-vt td.hw-vt__term, .hw-vt td.hw-vt__pron { display: inline; }
  .hw-vt td.hw-vt__pron { margin-left: 6px; }
  .hw-vt td.hw-vt__vi { margin-top: 2px; }
}

/* "1 … 2 … 3 …" numbered sentences in one point (splitNumberedSentences) —
   one row per sentence, Vietnamese under each. */
.hw-gs-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hw-gs-step {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--white); border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.hw-gs-step__n {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: var(--white); background: var(--gs-step, #5B8DEF);
}
.hw-gs-step__body { min-width: 0; padding-top: 1px; }
.hw-gs-step__en { font-size: 14.5px; line-height: 1.55; color: var(--text); }
.hw-gs-step__vi { margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.hw-gs-point--c1 { --gs-step: #5B8DEF; } .hw-gs-point--c2 { --gs-step: #2E9E6B; } .hw-gs-point--c3 { --gs-step: #D97706; }
.hw-gs-point--c4 { --gs-step: #DB5A8C; } .hw-gs-point--c5 { --gs-step: #6D5BD0; } .hw-gs-point--c6 { --gs-step: #0EA5A5; }

/* Speaker button next to an IPA transcription — plays the word via the
   browser's speechSynthesis (js/homework.js speakEnglish). is-speaking is
   toggled for the duration of the utterance as a lightweight play cue. */
.hw-gs-speak {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--muted); padding: 0; margin-left: 2px;
  line-height: 1; cursor: pointer; vertical-align: middle; font-style: normal;
}
.hw-gs-speak .hw-ico { width: 14px; height: 14px; }
.hw-gs-speak:hover { color: var(--text); border-color: var(--border); background: var(--white); }
.hw-gs-eg__row .hw-gs-speak { width: 26px; height: 26px; border-color: var(--border); background: var(--white); }
.hw-gs-speak.is-speaking { color: var(--text); border-color: var(--gold-dark); animation: hw-gs-speak-pulse .5s ease-in-out infinite alternate; }
@keyframes hw-gs-speak-pulse { from { transform: scale(1); } to { transform: scale(1.2); } }

/* Each word-list/definition-list point cycles through a fixed accent palette
   (see renderSummaryPoint's colorClass in js/homework.js) so consecutive
   chip/pill rows read as distinct vocab clusters instead of one undivided
   block of identical grey-bordered cards. */
.hw-gs-point--c1 .hw-gs-chip, .hw-gs-point--c1 .hw-gs-def { border-color: #5B8DEF; }
.hw-gs-point--c2 .hw-gs-chip, .hw-gs-point--c2 .hw-gs-def { border-color: #2E9E6B; }
.hw-gs-point--c3 .hw-gs-chip, .hw-gs-point--c3 .hw-gs-def { border-color: #D97706; }
.hw-gs-point--c4 .hw-gs-chip, .hw-gs-point--c4 .hw-gs-def { border-color: #DB5A8C; }
.hw-gs-point--c5 .hw-gs-chip, .hw-gs-point--c5 .hw-gs-def { border-color: var(--ipa-color); }
.hw-gs-point--c6 .hw-gs-chip, .hw-gs-point--c6 .hw-gs-def { border-color: #0EA5A5; }
.hw-exercise-nav__chip--summary {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--correct-text);
}
.hw-exercise-nav__chip--summary:hover { border-color: var(--correct-border); }
.exam-question-group .hw-exercise-num { margin-bottom: 8px; }

/* Example line — its own row, highlighted. */
.hw-example {
  margin: 0 0 14px;
  padding: 9px 13px;
  background: var(--gold-light);
  border-left: 3px solid var(--gold-dark);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.hw-example strong { color: var(--gold-dark); }
.hw-example em { font-style: italic; }

.hw-exercise-title {
  margin-bottom: 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.hw-exercise-title + .hw-example { margin-top: -6px; }
.hw-questions-range {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 4px;
}
.hw-instructions {
  font-style: normal;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  font-weight: 500;
}
.hw-instructions strong { font-weight: 700; }
.hw-instructions-vi {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #6a6f77;
  font-weight: 500;
  font-style: normal;
  border-left: 2px solid var(--gold-dark);
  padding-left: 9px;
}
.hw-instructions-vi strong { font-weight: 700; color: #565b63; }
.exam-group-instructions p.hw-instructions-vi { margin-bottom: 0; }

/* Top-of-exercise title for a listening section (e.g. "Section 1") — kept
   separate from the small .hw-questions-range label above so shrinking that
   one to match .exam-group-range didn't also shrink this heading. Boxed
   like the practice-test's .exam-section-header. */
.hw-listening-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--black);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.hw-exercise-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.hw-question-list {
  list-style: none;
}
.hw-question-list .question-block {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: background var(--t);
}
.hw-question-list .question-block.correct   { background: var(--correct-bg); }
.hw-question-list .question-block.incorrect { background: var(--wrong-bg); }

/* ── Cloze passage (word bank + inline blanks) ── */
.hw-wordbank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1.5px dashed var(--border);
  font-size: 14px;
}
.wordbank-word {
  display: inline-block;
  padding: 3px 12px;
  background: var(--gold-light);
  border: 1px solid var(--gold-dark);
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
}
.wordbank-used {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface);
  border-color: var(--border);
}

.cloze-text {
  font-size: 14px;
  line-height: 2.6;
  color: var(--text);
}
.cloze-blank {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.cloze-blank.correct .q-input   { border-color: var(--correct-border); background: var(--correct-bg); }
.cloze-blank.incorrect .q-input { border-color: var(--wrong-border); background: var(--wrong-bg); }
.cloze-blank .q-mark { font-size: 14px; }

/* Exam-format reading questions inside homework (matching drag-drop, MCQ /
   TFNG radios) — the shared .exam-* classes carry most of the look; these
   fill the gaps the homework context needs. */
.hw-exercise.exam-question-group { margin-top: 28px; }
.hw-exercise .question-block.correct   { background: var(--correct-bg); border-color: var(--correct-border); }
.hw-exercise .question-block.incorrect { background: var(--wrong-bg);   border-color: var(--wrong-border); }
.exam-mc-option.exam-mc-option--correct { color: var(--correct-text); font-weight: 700; }
.exam-mc-option.exam-mc-option--wrong span { color: var(--wrong-text); text-decoration: line-through; }
.exam-mc-radio, .exam-mc-checkbox { accent-color: var(--gold-dark); }
.exam-multi-block .exam-mc-options { margin-top: 0; }

/* Reveal feedback: separate the correction/explanation from the choices. */
.exam-question-group .question-block.correct .q-mark,
.exam-question-group .question-block.incorrect .q-mark {
  display: block;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  white-space: normal;
}
.exam-matching-row-hw .q-mark { white-space: normal; }
.hw-explain {
  display: block;
  margin-top: 5px;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

/* ── Grammar / Vocabulary Practice library (js/practice-library.js + js/library-words.js) ──
   Mockups practice-library-v2.html + library-tabs-search-v1.html. Desktop: Level tabs, then
   Section | Units columns; ≤860px: level buttons + section accordion, one scroll area. */
.pl-main.index-main { max-width: none; width: 100%; padding: 18px 24px 44px; }
.pl-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pl-search { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0 12px; margin: 0 0 14px; }
.pl-search:focus-within { border-color: var(--gold-dark); }
.pl-search svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.pl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 11px 0; font: inherit; font-size: 14px; color: var(--text); }
.pl-search__n { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pl-search kbd { font-family: inherit; font-weight: 600; font-size: 12px; line-height: 1; color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 3px 7px; }

.pl-cards { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin: 0 0 16px; }
.pl-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.pl-card--main { --c: var(--course-SW); --c-tint: var(--course-SW-tint); --c-solid: var(--course-SW-solid); --c-ink: var(--course-SW-ink);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; border-color: var(--c); border-left: 5px solid var(--c-solid); background: var(--c-tint); }
/* Continue card colour = level of the unit (mockup library-tabs-search-v1 § A0); tabs stay gold. */
.pl-card--main.pl-lv--basic { --c: var(--course-FN); --c-tint: var(--course-FN-tint); --c-solid: var(--course-FN-solid); --c-ink: var(--course-FN-ink); }
.pl-card--main.pl-lv--advanced { --c: var(--course-AI); --c-tint: var(--course-AI-tint); --c-solid: var(--course-AI-solid); --c-ink: var(--course-AI-ink); }
.pl-card--main.pl-lv--awl { --c: var(--course-VI); --c-tint: var(--course-VI-tint); --c-solid: var(--course-VI-solid); --c-ink: var(--course-VI-ink); }
.pl-card__ic { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--white); border: 2px solid var(--c-solid); color: var(--c-solid); display: flex; align-items: center; justify-content: center; }
.pl-card__ic svg { width: 16px; height: 16px; margin-left: 2px; }
.pl-card__body { flex: 1 1 200px; min-width: 0; }
.pl-card--main .pl-card__acts { margin: 0 0 0 auto; }
.plib-btn.pl-card__go { background: var(--white); border: 1.5px solid var(--c-solid); color: var(--c-ink); font-weight: 800; }
.plib-btn.pl-card__go:hover { background: var(--c-tint); }
.pl-card__k { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--gold-dark); margin: 0 0 4px; }
.pl-card--main .pl-card__k { color: var(--c-ink); }
.pl-card__title { font-size: 16px; font-weight: 800; color: var(--black); }
.pl-card__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pl-card__acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.pl-card__row { display: flex; align-items: center; gap: 8px; padding: 6px 0; text-decoration: none; color: var(--text); font-size: 13px; }
.pl-card__row + .pl-card__row { border-top: 1px solid var(--border); }
.pl-card__row:hover .pl-card__t { text-decoration: underline; }
.pl-card__t { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-card__more { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--info-text); text-decoration: none; }
/* Practice Library button (was .pl-btn — clashed with placement.css). Same values as .ui-btn / --primary. */
.plib-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 700; text-decoration: none; border: 1px solid var(--border); background: var(--white); color: var(--black); }
.plib-btn svg { width: 14px; height: 14px; }
.plib-btn--gold { background: var(--gold); border-color: var(--gold-dark); }
.plib-btn--gold:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.pl-chip { border: 0; border-radius: 999px; padding: 4px 10px; font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1.4; cursor: pointer; }
.pl-chip--late { background: #FDE8E8; color: var(--bad-ink); }
.pl-chip--low { background: var(--wrong-bg); color: var(--wrong-text); }
.pl-narrow { display: none; }

.pl-cols { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 14px; align-items: start; }
/* Level tabs (mockup § A): gold = selected; a separator before the last tab (AWL / Bảng tra cứu). */
.pl-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.pl-tab { display: flex; align-items: baseline; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font: inherit; font-weight: 700; font-size: 13.5px; color: var(--black); cursor: pointer; }
.pl-tab:hover { border-color: var(--gold); }
.pl-tab small { font-size: 12px; font-weight: 600; color: var(--muted); }
.pl-tab.is-on { border-color: var(--gold); background: var(--gold-light); }
.pl-tab .pl-mine { align-self: center; }
.pl-tabs__sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.pl-tabs__end, .pl-xacts { display: flex; gap: 6px; }
.pl-tabs__end { margin-left: auto; }
.pl-xacts { margin: -4px 0 10px; }
.pl-mine--in { align-self: auto; margin-left: 6px; padding: 0 7px; vertical-align: 1px; }
/* Tab AWL: eye toggles the word list, words link to awl.html#w-… */
.pl-col__link { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--gold-ink); text-decoration: none; white-space: nowrap; }
.pl-col__link:hover { text-decoration: underline; }
.pl-eye { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.pl-eye.is-on { color: var(--gold-ink); }
.pl-eye svg { width: 16px; height: 16px; }
.pl-wq { margin: 2px 4px 8px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface); }
.pl-wq__b { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; padding: 4px 0; }
.pl-wq__b b { font-size: 13px; color: var(--muted); }
.pl-wq__b p { margin: 0; font-size: 14px; line-height: 1.8; }
.pl-wq__b a { color: var(--black); font-weight: 600; text-decoration: none; white-space: nowrap; }
.pl-wq__b a:hover { text-decoration: underline; }
.pl-unit__n .ui-ico { width: 14px; height: 14px; }
/* Tab Bảng tra cứu (Grammar): one card per table, one row per group. */
.pl-refs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pl-ref { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pl-ref__h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pl-ref__head { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.pl-ref__t { font-size: 15px; font-weight: 800; color: var(--black); text-decoration: none; }
.pl-ref__t:hover { text-decoration: underline; }
.pl-ref__s { font-size: 12px; font-weight: 600; color: var(--muted); }
.pl-ref__acts { display: flex; gap: 6px; }
.pl-ref__g { display: flex; align-items: center; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--text); }
.pl-ref__g + .pl-ref__g { border-top: 1px solid var(--border); }
.pl-ref__g:hover { background: var(--surface); }
.pl-ref__g:hover .pl-unit__arrow { color: var(--gold-dark); }
.pl-ref__main { flex: 1; min-width: 0; }
.pl-ref__gt { display: block; font-size: 13.5px; font-weight: 700; color: var(--black); }
.pl-ref__ex { display: block; font-size: 12.5px; color: var(--muted); }
.pl-ref__n { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
/* Search results: groups Bài · Từ (mockup § C). */
.pl-res-g { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pl-results .pl-res-g:first-child { border-top: 0; }
.pl-res-g a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 700; font-size: 13px; color: var(--gold-ink); text-decoration: none; }
.pl-wrow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 9px 14px; text-decoration: none; color: var(--text); }
.pl-wrow + .pl-wrow { border-top: 1px solid var(--border); }
.pl-wrow:hover { background: var(--surface); }
.pl-wrow:hover .pl-unit__arrow { color: var(--gold-dark); }
.pl-wrow__w { font-size: 14px; font-weight: 800; color: var(--black); }
.pl-wrow__forms { font-size: 13px; font-weight: 600; color: var(--mid); }
.pl-wrow__ipa { font-size: 12.5px; font-weight: 600; color: var(--ipa-color); }
.pl-wrow__vi { font-size: 13px; }
.pl-wrow__via { font-size: 12px; color: var(--muted); }
.pl-wrow__end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pl-wrow__tag--awl { background: var(--gold-light); border-color: var(--gold); color: var(--gold-ink); }
.pl-wrow mark { background: var(--gold-light); color: inherit; border-radius: 3px; padding: 0 1px; }
.pl-col { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.pl-results { max-height: none; }
.pl-col__h { display: flex; gap: 8px; align-items: center; padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--mid); background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pl-col__h span { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.pl-col__list { overflow-y: auto; padding: 6px; flex: 1; }
.pl-it { width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 9px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.pl-it:hover { background: var(--surface); }
.pl-it.is-on { background: var(--gold-light); box-shadow: inset 3px 0 0 var(--gold); }
.pl-it__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pl-it__name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--black); line-height: 1.3; }
.pl-it__meta { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pl-it__n { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); font-size: 12px; font-weight: 700; color: var(--mid); }
.pl-mine { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: var(--black); white-space: nowrap; }
.pl-bar { display: block; height: 4px; border-radius: 4px; background: var(--border-soft); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--correct-border); border-radius: 4px; }

.pl-unit { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px; border-radius: 8px; }
.pl-unit + .pl-unit { border-top: 1px solid var(--border); }
.pl-unit:hover { background: var(--surface); }
.pl-unit.is-draft { opacity: .6; }
.pl-unit__n { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); font-size: 12px; font-weight: 700; color: var(--mid); }
.pl-unit__n.is-done { background: var(--correct-border); border-color: var(--correct-border); color: var(--white); }
.pl-unit__main { flex: 1 1 180px; min-width: 0; text-decoration: none; color: inherit; }
/* Score, questions, arrow: one group that drops under the title when the column is narrow. */
.pl-unit__meta { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.pl-unit__main::after { content: ""; position: absolute; inset: 0; }   /* whole row clickable */
.pl-unit__title { display: block; font-size: 13.5px; font-weight: 700; color: var(--black); line-height: 1.3; }
.pl-unit__sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-unit__q { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pl-unit__soon { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.pl-unit__arrow { color: var(--border); flex-shrink: 0; }
.pl-unit__arrow svg { width: 15px; height: 15px; display: block; }
.pl-unit:hover .pl-unit__arrow { color: var(--gold-dark); }
.pl-unit .mp-pct, .pl-unit .due-chip { white-space: nowrap; }
.pl-res-sec { padding: 10px 10px 4px; font-size: 12px; font-weight: 800; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .03em; }
.pl-unit mark, .pl-res-sec mark { background: var(--gold-light); color: inherit; border-radius: 3px; padding: 0 1px; }
.pl-empty { padding: 24px 16px; font-size: 13px; color: var(--muted); text-align: center; }

.pl-seg { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.pl-seg button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1.3; color: var(--black); cursor: pointer; }
.pl-seg button small { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pl-seg button.is-on { border-color: var(--gold); background: var(--gold-light); }
.pl-acc { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 8px; }
.pl-acc__h { width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 12px; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.pl-acc__h svg { width: 15px; height: 15px; color: var(--muted); transition: transform var(--t); flex-shrink: 0; }
.pl-acc.is-open .pl-acc__h svg { transform: rotate(180deg); }
.pl-acc__b { border-top: 1px solid var(--border); padding: 4px 6px; }

/* "Chọn bài để giao" (option C): tick box per unit + bar at the bottom of the screen. */
.pl-pick.is-on { border-color: var(--gold); background: var(--gold-light); }
.pl-pick svg { width: 14px; height: 14px; }
.pl-unit.is-pick { cursor: pointer; }
.pl-unit.is-sel { background: var(--gold-light); }
.pl-chk { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.5px solid #B8B8B2; border-radius: 4px; background: var(--white); color: transparent; }
.pl-chk svg { width: 12px; height: 12px; }
.pl-unit.is-sel .pl-chk { background: var(--gold); border-color: var(--gold-dark); color: var(--black); }
.pl-selbar { position: sticky; bottom: 12px; z-index: 30; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border: 1px solid #EBD27A; border-radius: var(--radius); background: var(--gold-light); color: var(--text); box-shadow: var(--shadow-md); } /* light like .ui-bulkbar */
.pl-selbar__n { font-size: 14px; font-weight: 700; margin-right: auto; }
.pl-selbar__clear { border: 0; background: none; color: var(--gold-ink, #7A5D00); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.pl-selbar__clear:hover { color: var(--text); }

@media (max-width: 860px) {
  .pl-main.index-main { padding: 14px 16px 40px; }
  .pl-refs { grid-template-columns: 1fr; }
  .pl-ref__open { display: none; }   /* phone: the card title opens the table */
  .pl-wrow__via, .pl-wrow__ipa { display: none; }
  .pl-cards { grid-template-columns: 1fr; gap: 10px; }
  .pl-card--list { display: none; }
  .pl-card--list.is-open { display: block; }
  .pl-narrow { display: inline-block; }
  .pl-wide, .pl-search kbd { display: none; }
  .pl-unit__sub, .pl-unit__q, .pl-unit__arrow { display: none; }
  }

/* Bottom exercise-navigation bar */
.hw-exercise-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--white);
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.09);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.hw-exercise-nav__label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.hw-exercise-nav__chip {
  flex-shrink: 0;
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.hw-exercise-nav__chip:hover { border-color: var(--gold); }
.hw-exercise-nav__chip.is-current {
  background: var(--gold);
  border-color: var(--gold-dark);
  color: var(--black);
}
body.has-exercise-nav main { padding-bottom: 88px; }
body.has-exercise-nav .hw-submit-bar { margin-bottom: 10px; }
.hw-grammar-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.hw-grammar-result .score-chip { font-size: 15px; }
.hw-grammar-result__actions { display: flex; gap: 10px; flex-wrap: wrap; }
a.next-btn { display: inline-block; text-decoration: none; }
.next-btn--ghost { background: var(--white); border: 1px solid var(--border); }
.next-btn--ghost:hover:not(:disabled) { background: var(--surface); border-color: var(--gold-dark); }

/* Grammar & Vocabulary Practice: "Check" under each exercise, then its score. */
.hw-ex-check {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.hw-ex-check__btn { padding: 8px 20px; }
.hw-ex-check__hint { font-size: 13px; color: var(--muted); }
.hw-ex-check__score {
  font-size: 14px; font-weight: 700; padding: 5px 14px; border-radius: 99px;
  border: 1.5px solid currentColor;
}
.hw-ex-check__score.is-perfect { color: var(--correct-text); background: var(--correct-bg); }
.hw-ex-check__score.is-good    { color: var(--warn-text);    background: var(--warn-bg); }
.hw-ex-check__score.is-low     { color: var(--wrong-text);   background: var(--wrong-bg); }
.hw-exercise.is-checked .exam-heading-chip { pointer-events: none; opacity: 0.55; }
.hw-exercise.is-checked .exam-heading-dropzone__clear { display: none; }

/* Moving between Grammar & Vocabulary Practice units (js/unit-nav.js, option A). */
.un-step { display: flex; align-items: center; gap: 10px; flex: 1 1 420px; min-width: 0; max-width: 640px; }
.un-step[hidden], .un-bottom[hidden] { display: none; }
.un-pos { font-size: 13px; font-weight: 800; color: var(--mid); white-space: nowrap; }
.un-narrow { display: none; }
.un-dots { flex: 1; min-width: 60px; display: flex; gap: 3px; }
.un-dot { flex: 1; height: 12px; max-width: 28px; border-radius: 3px; background: var(--border); }
.un-dot:hover { outline: 2px solid var(--gold-dark); outline-offset: 1px; }
.un-dot.is-good { background: var(--correct-border); }
.un-dot.is-ok   { background: var(--gold); }
.un-dot.is-low  { background: var(--wrong-border); }
.un-dot.is-cur  { background: var(--gold); box-shadow: inset 0 0 0 2px var(--black); }
.un-icon, .un-all { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 9px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); color: var(--black); font-family: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.un-icon svg, .un-all svg { width: 15px; height: 15px; }
.un-icon:hover, .un-all:hover { border-color: var(--gold-dark); background: var(--gold-light); }
.un-icon.is-off { opacity: .35; pointer-events: none; }
.un-bottom { margin: 28px 0 8px; }
.un-next { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--gold); background: var(--gold-light); border-radius: var(--radius); }
.un-next__main { flex: 1; min-width: 0; }
.un-next__k { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--gold-ink); }
.un-new { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--gold-light); color: var(--gold-ink, #7A5D00); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.un-next__t { font-size: 16px; font-weight: 800; color: var(--black); margin-top: 2px; }
.un-next__s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.un-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; background: var(--gold); color: var(--black); font-size: 14px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.un-btn:hover { background: var(--gold-dark); }
.un-btn svg, .un-prev svg, .un-back svg { width: 14px; height: 14px; }
.un-prev { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--muted); text-decoration: none; }
.un-prev:hover { color: var(--black); text-decoration: underline; }
.un-drawer__n { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.un-list { display: flex; flex-direction: column; }
.un-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; text-decoration: none; color: var(--text); }
.un-row + .un-row { border-top: 1px solid var(--border); }
.un-row:hover { background: var(--surface); }
.un-row.is-cur { background: var(--gold-light); }
.un-row__n { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); font-size: 12px; font-weight: 700; color: var(--mid); }
.un-row__n.is-done { background: var(--correct-border); border-color: var(--correct-border); color: var(--white); }
.un-row__t { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; }
.un-row__here { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.un-pct { display: inline-block; min-width: 42px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center; }
.un-pct--good { background: var(--correct-bg); color: var(--correct-text); }
.un-pct--ok   { background: var(--gold-light); color: var(--gold-ink); }
.un-pct--low  { background: var(--wrong-bg); color: var(--wrong-text); }
.un-back { display: inline-flex; align-items: center; gap: 4px; margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--info-text); text-decoration: none; }
@media (max-width: 40rem) {
  .un-step { flex-basis: 100%; gap: 8px; }
  .un-wide, .un-wide-flex { display: none; }
  .un-narrow { display: inline; }
  .un-all { padding: 0; }
  .un-next { flex-wrap: wrap; }
}
/* Centre the tick/dot against the option text (incl. wrapped lines). */
.hw-exercise .exam-mc-option { align-items: center; }
.hw-exercise .exam-mc-option input { flex-shrink: 0; }
/* Homework matching rows: prompt on its own line, then a full-width drop
   pill below — every pill lines up on the same left edge, and nothing is
   clipped in the narrow reading pane. */
.exam-matching-row-hw .exam-q-prompt { margin: 0 0 8px; }
.exam-matching-row-hw .exam-heading-dropzone { max-width: 26rem; }
.hw-exam-locked .exam-heading-chip { pointer-events: none; opacity: 0.55; }
.hw-exam-locked .exam-heading-dropzone__clear { display: none; }

/* Dot after the question number (matching / MCQ / TFNG / vocab drag-drop). */
.hw-exercise .exam-q-number::after { content: "."; }

/* Give the reading instruction block more room to breathe. */
.hw-exercise .exam-group-instructions {
  padding: 14px 18px; margin-bottom: 20px; line-height: 1.7; font-size: 13.5px;
}
.hw-exercise .exam-group-range { font-size: 14px; margin-bottom: 6px; }
.hw-exercise .exam-tfng-legend { margin: 16px 2px 18px; }

/* Make the draggable option chips stand out from the card. */
.hw-exercise .exam-heading-chip {
  background: var(--gold-light); border-color: var(--gold-dark); font-weight: 600; color: var(--text);
}
.hw-exercise .exam-heading-chip:hover { background: var(--gold); border-color: var(--gold-dark); }
.hw-exercise .exam-heading-chip.is-selected {
  background: var(--gold); border-color: var(--gold-dark); box-shadow: 0 0 0 2px var(--gold-light);
}
.exam-vocab-wordbank { margin-bottom: 18px; }

/* Gap-fill sentence list (word bank + numbered sentences) */
.hw-gapfill-list { padding-left: 24px; margin: 0; }
.hw-gapfill-list li { margin: 2px 0; padding-left: 4px; }
.hw-gapfill-list li::marker { font-weight: 700; color: var(--text); }
.hw-gapfill-example { margin: 0 0 10px; color: var(--text); font-size: 14px; }


/* ── Listening exercises (audio + notes/table completion) ── */
.hw-exercise { scroll-margin-top: 68px; }
.hw-exercise + .hw-exercise {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1.5px dashed var(--border);
}
/* Boxed row like the practice-test's .exam-audio-bar — the control inside
   stays the native <audio controls> element (scrub/pause included; this is
   untimed practice, not the exam, so nothing about playback changes). */
.hw-audio-bar {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 14px;
  margin: 4px 0 20px;
}
.hw-audio {
  width: 100%;
  height: 40px;
}

/* ── Speaking exercises (record / upload audio) ── */
.speaking-question { flex-wrap: wrap; }
.speaking-controls {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.speaking-control {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 700;
}
.speaking-record-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--wrong-border);
  background: var(--white);
  color: var(--wrong-text);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.speaking-record-btn:hover:not(:disabled) { background: var(--wrong-bg); }
.speaking-record-btn.speaking-recording {
  background: var(--wrong-text);
  color: var(--white);
  animation: speaking-pulse 1.4s ease-in-out infinite;
}
.speaking-record-btn:disabled { opacity: 0.4; cursor: default; }
.speaking-record-btn.speaking-countdown {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: var(--white);
  opacity: 1;
  font-variant-numeric: tabular-nums;
}
@keyframes speaking-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(155, 28, 28, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(155, 28, 28, 0); }
}
.speaking-timer {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 40px;
}
.speaking-upload-label {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.speaking-upload-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
}
.speaking-feedback-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--gold-dark);
  background: var(--white);
  color: var(--gold-dark);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.speaking-feedback-btn:hover:not(:disabled) { background: var(--gold-light); }
.speaking-feedback-btn:disabled { opacity: 0.4; cursor: default; }
.speaking-status {
  width: 100%;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.speaking-status-error { color: var(--wrong-text); }
.speaking-preview { width: 100%; margin-top: 8px; }
.speaking-preview audio { width: 100%; height: 36px; }

/* Sound-drill prompt (pronunciation-practice speaking questions): a section
   heading followed by a responsive grid of IPA-symbol/example-word rows.
   Arial throughout — better, more reliable IPA glyph rendering than the
   site's display font (Barlow), and the plain readability this content
   needs. The IPA symbol reuses --ipa-color, the same accent already used
   for phonetic transcriptions in Vocabulary Practice (see .vocab-ipa). */
.sound-drill-heading {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-dark);
  margin-bottom: 8px;
}
.sound-drill-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.sound-drill-list--single {
  grid-template-columns: 1fr;
  gap: 14px;
}
.sound-drill-block {
  display: block;
}
.sound-drill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.sound-drill-ipa {
  flex-shrink: 0;
  min-width: 60px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(109, 91, 208, 0.14);
  color: var(--ipa-color);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 20px;
}
.sound-drill-words {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  color: var(--text);
}
.sound-drill-sentence {
  display: block;
  margin-top: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-style: italic;
  color: var(--text);
}

.notes-instructions {
  margin-top: 22px;
  margin-bottom: 10px;
}
.hw-exercise .notes-instructions:first-of-type { margin-top: 0; }

.notes-heading {
  font-weight: 700;
  font-size: 14px;
  color: var(--black);
  margin-bottom: 6px;
}

/* Boxed like the practice-test's .exam-note-box / .exam-note-box-title —
   wraps a notes-heading + notes-list pair (js/homework.js's
   renderNotesBlock / the reading "notes" question type). */
.hw-content-box {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  margin-bottom: 12px;
}
.hw-content-box .notes-heading {
  margin: 0;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  text-align: center;
  padding: 8px 12px;
}
.hw-content-box .notes-list,
.hw-content-box .notes-sublist {
  padding: 8px 14px;
  margin: 0;
}

.notes-list {
  list-style: none;
}
.notes-list li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 2.4;
  color: var(--text);
  margin-bottom: 4px;
}
/* Prose rows (Q&A quiz etc.): no bullet, no hanging indent, tighter
   leading so a line that wraps past several {N} blanks reads as one
   sentence rather than two stranded fragments. */
.notes-list--plain li { padding-left: 0; line-height: 1.9; margin-bottom: 12px; }
.notes-list--plain li::before { display: none; }
.notes-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.notes-sublist {
  list-style: none;
  margin-top: 4px;
}
.notes-sublist li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  line-height: 2.4;
  color: var(--text);
  margin-bottom: 4px;
}
.notes-sublist li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.filter-bar .q-input { margin: 0; }
.filter-bar .topics-btn { margin-left: auto; padding: 9px 20px; font-size: 13px; }

/* Boxed + horizontally-scrollable like the practice-test's .exam-table-box /
   .exam-table-scroll, so a wide table can't clip off the edge of a narrow
   question pane with no way to reach the missing columns. */
.hw-table-box {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  margin-bottom: 12px;
}
.hw-table-scroll { overflow-x: auto; }
.hw-table-box .hw-table { margin-bottom: 0; }

.hw-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 14px;
}
.hw-table th,
.hw-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.hw-table th {
  background: var(--surface);
  font-weight: 700;
  color: var(--black);
}
.hw-table td { line-height: 2.2; }
.hw-table td.hw-table-label { font-weight: 700; }
.hw-table-box .exam-note-box-title { border-bottom: 1.5px solid var(--border); }

/* variant "compare" — two-sided sentence tables (Test → Findings). */
.hw-table--compare { table-layout: fixed; font-size: 15px; }
.hw-table--compare th,
.hw-table--compare td { border: 0; padding: 14px 18px; }
.hw-table--compare th {
  background: var(--gold-light);
  border-bottom: 2px solid var(--gold);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
}
.hw-table--compare td { line-height: 2; }
.hw-table--compare tbody tr + tr td { border-top: 1px solid var(--border); }
.hw-table--compare td:first-child { background: var(--surface); }
.hw-table--compare th + th,
.hw-table--compare td + td { border-left: 1px solid var(--border); }
@media (max-width: 560px) {
  .hw-table--compare thead { display: none; }
  .hw-table--compare,
  .hw-table--compare tbody,
  .hw-table--compare tr,
  .hw-table--compare td { display: block; width: 100%; }
  .hw-table--compare td + td { border-left: 0; }
  .hw-table--compare tbody tr + tr { border-top: 2px solid var(--gold); }
  .hw-table--compare tbody tr + tr td { border-top: 0; }
  .hw-table--compare td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.6;
  }
}

/* ── Appendix lookup pages (irregular-verbs.html, irregular-nouns.html) ──
   One comfortable table per group (not several squeezed side by side),
   sticky search/jump toolbar under the site header, sticky column headings
   under the toolbar, and stacked row cards on phones. --ref-header-h and
   --ref-toolbar-h are measured by js/reference.js. */
.ref-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px 72px;
  font-family: Arial, Helvetica, sans-serif;
}

.ref-toolbar {
  position: sticky;
  top: var(--ref-header-h, 62px);
  z-index: 5;
  display: grid;
  gap: 12px;
  padding: 18px 0 14px;
  margin-bottom: 8px;
  background: var(--surface);
  box-shadow: 0 10px 12px -12px rgba(0, 0, 0, 0.18);
}
.ref-search { position: relative; }
.ref-search input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.ref-search input:focus {
  outline: none;
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px var(--gold-light);
}
.ref-search input::-webkit-search-cancel-button { display: none; }
.ref-search__icon {
  position: absolute; left: 15px; top: 50%;
  width: 18px; height: 18px; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.ref-search__clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: none; border-radius: 50%;
  background: var(--surface); color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.ref-search__clear:hover { background: var(--border); color: var(--black); }
.ref-search__clear[hidden] { display: none; }

.ref-jump { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 14px;
  font-size: 13.5px; font-weight: 700;
  color: var(--black); text-decoration: none;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  transition: border-color var(--t), background var(--t);
}
.ref-chip:hover { border-color: var(--gold-dark); background: var(--gold-light); }
.ref-chip__count {
  min-width: 26px; padding: 2px 7px;
  font-size: 12px; text-align: center;
  color: var(--muted); background: var(--surface);
  border-radius: 999px;
}
.ref-toolbar__meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  font-size: 13px;
  /* Same inset as the table cells and group headings, so the count and the
     other-page link line up with the column text below. */
  padding: 0 24px;
}
.ref-status { color: var(--muted); font-weight: 600; }
.ref-switch { color: var(--gold-dark); font-weight: 700; text-decoration: none; }
.ref-switch:hover { text-decoration: underline; }
.ref-toolbar__links { display: inline-flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }

.ref-group {
  margin-top: 28px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--ref-header-h, 62px) + var(--ref-toolbar-h, 150px) + 12px);
}
.ref-group[hidden] { display: none; }
.ref-group__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 20px 24px 16px;
}
.ref-group__title { margin: 0; font-size: 19px; font-weight: 700; color: var(--black); line-height: 1.3; }
.ref-group__example { margin: 6px 0 0; font-size: 14px; color: var(--example-color); font-weight: 600; }
.ref-group__count {
  flex-shrink: 0; padding: 4px 12px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface); border-radius: 999px; white-space: nowrap;
}

/* border-collapse: separate so the sticky <th> keeps its bottom border. */
.ref-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15.5px; }
.ref-table thead th {
  position: sticky;
  top: calc(var(--ref-header-h, 62px) + var(--ref-toolbar-h, 150px));
  z-index: 1;
  padding: 10px 24px;
  text-align: left;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ref-table td {
  padding: 13px 24px;
  vertical-align: middle;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
}
.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table tbody tr:last-child td:first-child { border-bottom-left-radius: 14px; }
.ref-table tbody tr:last-child td:last-child { border-bottom-right-radius: 14px; }
.ref-table tbody tr { transition: background var(--t); }
/* Words that follow the same rule share one tint, opened by a label row.
   Four soft tints cycle so neighbouring rules always look different. */
.ref-band--1 { --band: #FFFBEA; --band-strong: #F7E7A6; --band-ink: #7A5C00; }
.ref-band--2 { --band: #EEF5FC; --band-strong: #C7DDF3; --band-ink: #245A8C; }
.ref-band--3 { --band: #EFF8F1; --band-strong: #C6E6CD; --band-ink: #2D6B3C; }
.ref-band--4 { --band: #F5F1FC; --band-strong: #DCD0F3; --band-ink: #5B3F9A; }
.ref-row { background: var(--band); }
.ref-row td:first-child { box-shadow: inset 4px 0 0 var(--band-strong); }
.ref-rule th {
  padding: 9px 24px 7px;
  text-align: left;
  background: var(--band);
  border-top: 2px solid var(--band-strong);
  border-bottom: 1px solid var(--band-strong);
  box-shadow: inset 4px 0 0 var(--band-strong);
}
.ref-rule[hidden] { display: none; }
.ref-rule__label { font-size: 13px; font-weight: 700; color: var(--band-ink); letter-spacing: 0.01em; }
.ref-rule__count {
  margin-left: 8px; padding: 1px 8px;
  font-size: 12px; font-weight: 700; color: var(--band-ink);
  background: var(--band-strong); border-radius: 999px;
}
.ref-table tbody tr.ref-row:hover { background: var(--white); }
/* Deep link from the library word search (#w-word): the row flashes gold (js/reference.js, js/awl.js). */
.ref-row.is-flash, .awl-row.is-flash { animation: ref-flash 2s ease; }
@keyframes ref-flash { 0%, 50% { background: var(--gold-light); } 100% { background: var(--band, transparent); } }
.ref-table tbody tr[hidden] { display: none; }

.ref-table--verbs thead th:nth-child(1) { width: 24%; }
.ref-table--verbs thead th:nth-child(2),
.ref-table--verbs thead th:nth-child(3) { width: 21%; }
.ref-table--nouns thead th:nth-child(1),
.ref-table--nouns thead th:nth-child(2) { width: 30%; }

.ref-base { white-space: nowrap; }
.ref-base__word { font-weight: 700; color: var(--black); }
.ref-form { font-weight: 600; color: var(--example-color); }
.ref-table--verbs .ref-form--2 { color: var(--ipa-color); }
.ref-meaning { color: var(--mid); font-size: 14.5px; }
.ref-note {
  display: block; margin-top: 3px;
  font-size: 12px; font-weight: 500; color: var(--muted); white-space: normal;
}
.ref-table mark { background: var(--gold); color: inherit; border-radius: 3px; padding: 0 1px; }

.ref-speak {
  margin-left: 8px; padding: 2px 4px;
  font-size: 14px; line-height: 1;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; opacity: 0.55;
  transition: opacity var(--t), background var(--t);
}
.ref-speak:hover, .ref-speak:focus-visible { opacity: 1; background: var(--surface); }

.ref-empty { padding: 48px 0; text-align: center; font-size: 15px; color: var(--muted); }

/* Phones: each row becomes a small card — word on top, forms side by side,
   meaning underneath — instead of a four-column table squeezed to 360px. */
@media (max-width: 40rem) {
  .ref-main { padding: 0 14px 56px; }
  .ref-toolbar { position: static; box-shadow: none; padding-top: 12px; gap: 10px; }
  .ref-group { scroll-margin-top: calc(var(--ref-header-h, 62px) + 12px); }
  .ref-chip { font-size: 12.5px; padding: 6px 7px 6px 11px; }
  .ref-group__head { padding: 16px 16px 12px; }
  .ref-toolbar__meta { padding: 0 16px; }
  .ref-group__title { font-size: 17px; }
  .ref-table thead { display: none; }
  .ref-table tbody tr.ref-rule { display: block; }
  .ref-table tbody tr.ref-rule[hidden] { display: none; }
  .ref-rule th { display: block; width: auto; padding: 9px 16px 7px; }
  .ref-row { box-shadow: inset 4px 0 0 var(--band-strong); }
  .ref-row td:first-child { box-shadow: none; }
  .ref-table, .ref-table tbody { display: block; }
  .ref-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
  }
  .ref-table td { display: block; padding: 0; border: none; }
  .ref-table .ref-base { grid-column: 1 / -1; font-size: 17px; }
  .ref-table .ref-meaning { grid-column: 1 / -1; }
  .ref-table--nouns .ref-form { grid-column: 1 / -1; }
  .ref-table .ref-form::before {
    content: attr(data-label);
    display: block;
    font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--muted);
  }
}

/* ── Progress table (progress.html) ── */
/* This page's table wants the whole width between the sidebar and the screen
   edge, so drop the shared 1200px content cap here. */
.progress-page .admin-content { max-width: none; padding-left: 24px; padding-right: 24px; }

.hw-table-scroll--tall { max-height: 72vh; overflow-y: auto; }

.progress-table {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}
.progress-table th,
.progress-table td {
  white-space: nowrap;          /* keep every value on one line; the box scrolls */
  vertical-align: middle;
  padding: 9px 14px;
}
.progress-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gold);
  color: var(--black);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-color: var(--gold-dark);
}
.progress-table th.ui-th-sort:hover,
.progress-table th.ui-th-sort:is([aria-sort="ascending"], [aria-sort="descending"]) { background: var(--gold-dark); }
.progress-table th.ui-th-sort:focus-visible { outline-color: var(--black); }
.progress-table th.ui-th-sort::after { color: var(--black); }

.progress-table td { line-height: 1.45; }
.progress-table tbody tr:nth-child(even) { background: var(--surface); }
.progress-table tbody tr:hover { background: var(--gold-light); }
.progress-table tbody tr.is-flagged { background: var(--wrong-bg); }
.progress-table tbody tr.is-flagged:hover { background: #f7dede; }

.progress-student-name { font-weight: 700; }
.progress-student-id { color: var(--muted); font-size: 12px; }

.progress-status--done { color: var(--correct-text); font-weight: 700; }
.progress-status--wip  { color: var(--muted); font-weight: 700; }
.progress-dim { color: var(--muted); }

.progress-duration { font-variant-numeric: tabular-nums; }
.progress-flag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--wrong-text);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}
.progress-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
}

/* Column show/hide menu */
.filter-bar .progress-cols { position: relative; margin-left: auto; }
.filter-bar .progress-cols .topics-btn,
.filter-bar .progress-cols + .topics-btn { margin-left: 0; }
.progress-cols__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 190px;
  padding: 6px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.progress-cols__menu[hidden] { display: none; }
.progress-cols__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  font: 13px/1.2 Arial, Helvetica, sans-serif;
  color: var(--text);
  cursor: pointer;
  border-radius: 7px;
}
.progress-cols__item:hover { background: var(--surface); }
.progress-cols__item input { accent-color: var(--gold-dark); }

/* ── Homework-completion report (homework-report.html) ── */
/* Same full-width treatment as progress.html — the week grid needs all the
   room it can get. */
.hwreport-page .admin-content { max-width: none; padding-left: 24px; padding-right: 24px; }

.hwreport-search { min-width: 200px; }

.hwreport-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 2px 0 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12.5px;
  color: var(--muted);
}
.hwreport-legend__item { display: flex; align-items: center; gap: 6px; }
.hwreport-legend__item .hwreport-icon { flex-shrink: 0; }

.hwreport-icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }
.hwreport-icon--not-attempted { color: var(--border); }
.hwreport-icon--in-progress   { color: var(--warn-border); }
.hwreport-icon--completed     { color: var(--correct-border); }
.hwreport-icon--completed-retry { color: var(--correct-border); }
.hwreport-icon--completed-retry .hwreport-icon__badge { fill: var(--warn-border); }
.hwreport-dash { color: var(--border); font-weight: 700; }

.hwreport-table {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  border-collapse: collapse;
}
.hwreport-table th,
.hwreport-table td {
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--border);
}
.hwreport-table thead th {
  position: sticky;
  background: var(--gold);
  color: var(--black);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-color: var(--gold-dark);
  z-index: 2;
}
/* Two-row header: week-group row pinned at the very top, skill-label row
   pinned right beneath it — both rows share a fixed height (see .hwreport-th)
   so the second row's offset can be hardcoded instead of measured in JS. */
.hwreport-th--week  { top: 0; height: 30px; box-sizing: border-box; }
.hwreport-th--skill { top: 30px; height: 26px; box-sizing: border-box; font-size: 12px; cursor: help; }

.hwreport-name-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--white);
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}
thead .hwreport-name-col { z-index: 3; } /* top-left corner: above both the sticky header and sticky column */
.hwreport-table tbody tr:nth-child(even) .hwreport-name-col { background: var(--surface); }
.hwreport-table tbody tr:hover .hwreport-name-col { background: var(--gold-light); }

.hwreport-table tbody tr:nth-child(even) { background: var(--surface); }
.hwreport-table tbody tr:hover { background: var(--gold-light); }

/* A cell with an attempt behind it is a link to the review page. */
.hwreport-table td:has(.hwreport-cell-link) { padding: 0; }
.hwreport-cell-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 34px;
  padding: 8px 10px;
  box-sizing: border-box;
  border-radius: 4px;
  text-decoration: none;
}
.hwreport-cell-link:hover {
  background: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold-dark);
}

.hw-review-banner {
  background: var(--gold-light);
  border: 1.5px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  text-align: center;
}

.hwreport-student-id { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }

.hwreport-summary-col { white-space: nowrap; }
.hwreport-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 5.5rem;
}
.hwreport-summary__frac { font-weight: 700; font-size: 12px; }
.hwreport-summary__bar {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.hwreport-summary__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 99px;
}

/* BTVN v2 (mockup docs/ui/mockups/btvn-v2.html, 2026-11-11): Học sinh · Đã nộp ·
   % đúng pinned on the left (left offsets set in js/pages/homework-report.js),
   % correct per cell, "cần chú ý" reasons under the name. ≥ 85% green, < 65% red. */
.hwreport-table .hwreport-name-col { width: 230px; min-width: 230px; max-width: 230px; box-sizing: border-box; white-space: normal; font-weight: 400; }
.hwr-nm { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.hwr-nm a { font-weight: 700; color: #2b4fa8; text-decoration: none; }
.hwr-nm a:hover { text-decoration: underline; }
.hwr-risks { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; text-decoration: none; }
.hwr-risk { display: flex; align-items: center; gap: 7px; color: var(--bad-ink); font-size: 12px; line-height: 1.4; white-space: nowrap; }
.hwr-risk i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #E5121C; }
.hwr-risks:hover .hwr-risk { text-decoration: underline; }
.hwreport-table .hwr-done, .hwreport-table .hwr-acc { position: sticky; z-index: 1; background: var(--white); white-space: nowrap; }
.hwreport-table thead .hwr-done, .hwreport-table thead .hwr-acc { z-index: 3; }
.hwreport-table .hwr-done { min-width: 66px; }
.hwreport-table .hwr-acc { min-width: 58px; font-weight: 700; box-shadow: inset -2px 0 0 var(--border); }
.hwreport-table tbody tr:nth-child(even) :is(.hwr-done, .hwr-acc) { background: var(--surface); }
.hwreport-table tbody tr:hover :is(.hwr-done, .hwr-acc) { background: var(--gold-light); }
.hwr-acc.is-hi { color: var(--correct-text); }
.hwr-acc.is-lo { color: #E5121C; }
.hwr-frac { font-size: 13px; }
.hwr-bar { display: block; height: 3px; margin-top: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.hwr-bar i { display: block; height: 100%; background: var(--gold); }
.hwr-pc { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 22px; padding: 0 4px; box-sizing: border-box; border-radius: 6px; font-size: 13px; font-weight: 400; color: var(--text-2); }
.hwr-pc.is-hi { background: #DDF3E4; color: var(--correct-text); }
.hwr-pc.is-lo { background: #FDE8E8; color: #E5121C; }
.hwr-pc.is-retry::after { content: ""; position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-border); border: 1px solid var(--white); }
.hwr-legend-note { color: var(--muted); }
.hwreport-table tfoot td { font-weight: 700; background: var(--surface); }
.hwreport-table tfoot .hwreport-name-col { background: var(--surface); }
/* BTVN & Quiz v3 (mockup docs/ui/mockups/btvn-v3.html): one card, 3 tabs (Tổng quan · Theo tuần · Dạng câu hỏi). */
.hwr-card { padding: 0; overflow: hidden; }
.hwr-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.hwr-extra { display: contents; }
.hwr-wk { font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
.hwr-wk b { color: var(--text); }
.hwr-linkbtn { border: 0; background: none; padding: 0; color: var(--info-text); font: 700 13px Arial, Helvetica, sans-serif; cursor: pointer; }
.hwr-linkbtn:hover { text-decoration: underline; }
.hwr-kpis { padding: 12px 16px 0; margin-bottom: 12px; }
.hwr-card .hwr-box { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.hwr-card .hwr-legend { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); }
.hwr-pct { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.hwreport-table .hwr-sep { border-left: 2px solid var(--border); }
.hwreport-table .ui-th-sort { cursor: pointer; }
.hwreport-table .is-cur { background: var(--gold-light); }
.hwreport-table thead th.is-cur { background: var(--gold-dark); }
.hwreport-table .hwr-done { min-width: 84px; white-space: nowrap; }
.hwreport-table:not(.hwr-pin) .hwr-done { position: static; }
.hwr-cw { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.2; }
.hwr-v { font-size: 12px; color: var(--sk-vocabulary-ink); font-weight: 700; }
.hwr-sk { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 5px; background: var(--sk-soft); color: var(--sk-ink); font-size: 12px; font-weight: 700; text-align: center; text-transform: none; }
.hwq-chip.is-hi { background: var(--correct-bg); } .hwq-chip.is-hi b { color: var(--correct-text); }
.hwq-none { font-size: 12px; color: var(--muted); }
.hwq-wrap--top { border-top: 0; }
.hwq-st--types td.hwq-tl { min-width: 200px; white-space: normal; }
.hwq-st--types .hwq-gap2 { border-left: 2px solid var(--border); }
.hwq-st--types .hwq-nm2 { position: sticky; left: 0; z-index: 1; min-width: 170px; background: var(--white); }
.hwq-st--types thead .hwq-nm2, .hwq-st--types tfoot td { background: var(--surface); }
.hwq-st--types tfoot td { font-weight: 700; }
.hwr-card .hwq-full > summary { display: block; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--info-text); cursor: pointer; }
.hwr-card .hwq-full > summary:hover { text-decoration: underline; }
/* admin.css pads every thead th 10px, which made the week row taller than the
   30px the skill row is pinned under — the two header rows overlapped. */
.admin-content .hwreport-table thead :is(.hwreport-th--week, .hwreport-th--skill) { padding-top: 0; padding-bottom: 0; }
.hwreport-table thead .hwreport-name-col { z-index: 4; }
/* Phones: only the name column stays pinned; Đã nộp / % đúng scroll with the weeks
   (three pinned columns took ~355px of a 375px screen). */
@media (max-width: 860px) {
  .hwreport-table .hwreport-name-col { width: 136px; min-width: 136px; max-width: 136px; padding: 8px; box-shadow: inset -2px 0 0 var(--border); }
  .hwreport-table .hwr-risk { white-space: normal; }
  .hwreport-table :is(tbody, tfoot) :is(.hwr-done, .hwr-acc) { position: static; }
  .hwreport-table thead :is(.hwr-done, .hwr-acc) { left: auto !important; z-index: 2; }
  .hwreport-table .hwr-acc { box-shadow: none; }
}

/* "Dạng câu hỏi cần lưu ý" (js/hw-question-types.js) */
.hwq { margin-top: 16px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; font-family: Arial, Helvetica, sans-serif; }
.hwq summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; list-style: none; cursor: pointer; }
.hwq summary::-webkit-details-marker { display: none; }
.hwq h3 { margin: 0; font-size: 15px; color: var(--text); }
.hwq summary:hover h3 { text-decoration: underline; }
.hwq-chev { display: inline-block; width: 14px; color: var(--muted); font-size: 12px; transition: transform .15s; }
.hwq[open] .hwq-chev { transform: rotate(90deg); }
.hwq-muted { color: var(--muted); font-size: 12px; }
.hwq-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 12px 16px 6px; }
.hwq-class { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 4px 16px 12px; }
.hwq-k { font-size: 12px; color: var(--muted); margin-right: -8px; }
.hwq-sum { font-size: 13px; } .hwq-sum b { font-size: 18px; color: var(--text); } .hwq-sum b.is-hi { color: var(--correct-text); } .hwq-sum b.is-lo { color: #E5121C; }
.hwq-sep { width: 1px; height: 22px; background: var(--border); }
.hwq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hwq-chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; cursor: help; }
.hwq-chip b { font-size: 12px; }
.hwq-chip.is-lo { background: #FDE8E8; } .hwq-chip.is-lo b { color: #E5121C; }
.hwq-chip.is-mid { background: var(--gold-light); } .hwq-chip.is-mid b { color: var(--gold-ink); }
.hwq-ok { font-size: 12px; color: var(--correct-text); }
.hwq-more { background: var(--border-soft); color: var(--muted); }
.hwq-thin { font-weight: 400; }
.hwq-st { width: 100%; border-collapse: collapse; font: 13px Arial, Helvetica, sans-serif; }
.hwq-st th, .hwq-st td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft, #EDEDE8); text-align: left; vertical-align: middle; }
.hwq-st th { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.hwq-st .hwq-n { width: 96px; text-align: center; white-space: nowrap; }
.hwq-st td a { font-weight: 700; color: #2b4fa8; text-decoration: none; } .hwq-st td a:hover { text-decoration: underline; }
.hwq .hwq-full > summary { display: block; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 700; color: #2b4fa8; cursor: pointer; }
.hwq .hwq-full > summary:hover { text-decoration: underline; }
@media (max-width: 560px) { .hwq-st .hwq-n { width: 56px; padding: 8px 4px; } .hwq-st th, .hwq-st td { padding-left: 8px; padding-right: 8px; } }
.hwq-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.hwq-mx { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font: 13px Arial, Helvetica, sans-serif; }
.hwq-mx th, .hwq-mx td { padding: 6px 4px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border-soft, #EDEDE8); text-align: center; white-space: nowrap; }
.hwq-mx thead th { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; }
.hwq-mx .hwq-ty { min-width: 56px; cursor: help; }
.hwq-mx .hwq-grp { color: var(--text); }
.hwq-grp--r { background: #EEF3FD !important; } .hwq-grp--l { background: #F3EEFB !important; } .hwq-grp--o { background: var(--gold-light) !important; }
.hwq-mx .hwq-nm { position: sticky; left: 0; z-index: 1; min-width: 170px; padding: 6px 12px; background: var(--white); text-align: left; box-shadow: inset -2px 0 0 var(--border); }
.hwq-mx thead .hwq-nm { z-index: 2; background: var(--surface); }
.hwq-mx .hwq-nm a { font-weight: 700; color: #2b4fa8; text-decoration: none; }
.hwq-mx .hwq-nm a:hover { text-decoration: underline; }
.hwq-mx .hwq-gap { border-left: 2px solid #C9C9C2; }
.hwq-mx .hwq-ov { background: var(--gold-soft); font-weight: 700; }
.hwq-mx tfoot td { background: var(--surface); font-weight: 700; }
.hwq-pc { display: inline-block; min-width: 40px; padding: 2px 4px; border-radius: 6px; color: var(--text-2); }
.hwq-pc.is-hi { background: #DDF3E4; color: var(--correct-text); } .hwq-pc.is-lo { background: #FDE8E8; color: #E5121C; }
.hwq-dash { color: #C4C4BC; }
@media (max-width: 860px) { .hwq-mx .hwq-nm { min-width: 120px; max-width: 136px; white-space: normal; } }
.hwq-foot { margin: 0; padding: 8px 16px 12px; border-top: 1px solid var(--border); font-size: 12px; line-height: 1.7; color: var(--muted); }
.hwq-foot b { color: var(--text); }
.hwq--empty { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .hwq summary { flex-wrap: wrap; }
}

.q-number {
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.q-prompt {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.q-mark {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.q-mark .label-correct { color: var(--correct-text); }
.q-mark .label-wrong   { color: var(--wrong-text); }
.q-mark .label-correct-answer { color: var(--correct-text); font-weight: 700; }
.q-mark .label-correct-hint { color: var(--correct-text); font-weight: 700; }
.q-mark .label-suggested { color: var(--correct-text); white-space: normal; }
.ungraded-suggestion { display: none; }

/* Translation-style ungraded questions: the prompt sentence and the answer
   each get their own full-width row instead of being crammed onto one line
   with a narrow inline input — a full sentence needs room to be read back. */
.hw-question-list .question-block.ungraded-question-block { display: block; }
.q-prompt-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.q-answer-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.q-answer-label {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.q-answer-editable {
  flex: 1;
  width: 100%;
  margin: 0;
  min-height: 40px;
  line-height: 1.5;
  font-family: Arial, Helvetica, sans-serif;
  cursor: text;
  /* The student's own typed answer needs to read as distinctly "theirs" next
     to the plain-black prompt text and label — a dedicated color plus a
     bolder weight, not just the shared --text default every other line uses.
     !important because .q-input's own `color: var(--text)` (below, same
     1-class specificity) comes later in the file and would otherwise win. */
  color: var(--ipa-color) !important;
  font-weight: 600;
}
.q-answer-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
/* input.blank-input's own :focus rule (see below) is tag-qualified to <input>,
   so this contenteditable <div> needs its own copy to match that same look. */
.q-answer-editable:focus { outline: none; border-color: var(--gold-dark); box-shadow: inset 0 -2px 0 0 var(--gold); }
/* Flips to a red box once AI feedback finds a mistake inside it, so the
   student notices at a glance that this answer needs a revisit. The :focus
   variant is needed too — .q-input:focus (below) ties this rule's
   specificity and comes later in the file, so without it a focused mistake
   box would flash back to the plain gold focus border. */
.q-answer-editable.has-mistakes,
.q-answer-editable.has-mistakes:focus {
  border-color: var(--wrong-border) !important;
  background: var(--wrong-bg);
}
/* Flips to green instead once AI feedback comes back clean — same reasoning
   and the same !important/:focus pairing as the mistake state above. */
.q-answer-editable.is-correct,
.q-answer-editable.is-correct:focus {
  border-color: var(--correct-border) !important;
  background: var(--correct-bg);
}
.q-answer-editable.is-locked {
  background: var(--surface);
  color: var(--muted) !important;
  cursor: default;
}
/* Tag-qualified so it reliably beats .ai-mark's `background: none` (below,
   same specificity as a bare .hw-mark-mistake class and later in the file). */
mark.hw-mark-mistake {
  color: var(--wrong-text);
  background: rgba(208, 48, 48, 0.12);
  border-bottom-color: var(--wrong-border);
}
.ungraded-question-block .q-mark {
  display: block;
  white-space: normal;
  margin-top: 12px;
}

.ai-feedback {
  width: 100%;
  margin-top: 14px;
}
.ai-feedback:empty { margin-top: 0; }
.ai-feedback-loading {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}
.ai-feedback-answer {
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-mark {
  background: none;
  padding: 0 1px;
  border-bottom: 2px solid;
  cursor: help;
}
.ai-mark-grammar     { border-color: var(--wrong-border); color: var(--wrong-text); }
.ai-mark-word-choice { border-color: var(--ipa-color); color: var(--ipa-color); }
.ai-feedback-overall {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  font-style: italic;
  color: var(--info-text);
}
.ai-feedback-issues {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--info-text);
}
.ai-feedback-issues li { margin-bottom: 8px; }
.ai-feedback-issues li:last-child { margin-bottom: 0; }

/* ── Writing practice-test results: essay/feedback split + task/criteria tabs ── */
.wtr-summary { margin-bottom: 16px; }
.wtr-band-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--gold-light); border: 1.5px solid var(--gold-dark);
  font-weight: 600; color: var(--text); font-size: 14px;
}
.wtr-band-chip strong { color: var(--gold-dark); font-size: 17px; }

.wtr-task-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.wtr-task-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  background: var(--white); font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; color: var(--muted); transition: border-color var(--t), background var(--t);
}
.wtr-task-tab:hover { border-color: var(--gold); }
.wtr-task-tab.is-active { border-color: var(--gold-dark); background: var(--gold-light); color: var(--text); }
.wtr-task-tab__band { font-weight: 700; color: var(--gold-dark); }

/* Question (prompt + Task 1's source data tables) and the student's own
   answer read as two visually distinct blocks, not one continuous wall of
   text — a divider plus an explicit "Your Answer" label separates them, so
   a student can tell at a glance which part is the source material to
   compare their reported data against and which part is what they wrote. */
.wtr-question-block { padding-bottom: 16px; border-bottom: 1.5px solid var(--border); margin-bottom: 16px; }
.wtr-essay-prompt { color: var(--muted); font-size: 0.93em; line-height: 1.6; white-space: pre-wrap; margin-bottom: 10px; }
.wtr-answer-label {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  font-size: 12px; margin: 0 0 8px; color: var(--muted);
}
.wtr-essay { font-size: 15px; line-height: 1.8; white-space: pre-wrap; }
.wtr-essay-empty { color: var(--muted); font-style: italic; }

.wtr-feedback-band { font-size: 26px; font-weight: 700; color: var(--gold-dark); font-family: Arial, Helvetica, sans-serif; }
.wtr-feedback-overall { margin-top: 6px; color: var(--text); line-height: 1.6; font-size: 14px; white-space: pre-wrap; }

.wtr-crit-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 14px; padding-top: 14px; border-top: 1.5px solid var(--border); }
.wtr-crit-tab {
  padding: 6px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--white); font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--muted); text-align: center; line-height: 1.4;
}
.wtr-crit-tab:hover { border-color: var(--gold); }
.wtr-crit-tab__band { display: block; font-size: 15px; font-weight: 700; color: var(--gold-dark); }
.wtr-crit-tab.is-active { border-color: var(--gold-dark); background: var(--gold-light); color: var(--text); }
.wtr-crit-panel { font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }

.wtr-pending { color: var(--muted); }
.wtr-pending .start-btn { margin-top: 10px; }

.q-input {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px 10px;
  vertical-align: middle;
  transition: border-color var(--t);
}
.q-input:focus { outline: none; border-color: var(--gold); }
select.q-input { cursor: pointer; }
/* Zero out the shared .q-input's vertical margin here specifically:
   inline text-flow blanks (note/table/summary-completion) don't need it,
   and it inflates the surrounding paragraph's line-height well beyond a
   plain-text line, visibly pushing that line lower than a sibling cell/
   line with no input in it (e.g. a table row's label column). */
input.blank-input {
  width: 160px; text-align: center; margin-top: 0; margin-bottom: 0;
  background: var(--white);
  border: 1.5px solid #8f8f88;
  box-shadow: inset 0 -2px 0 0 var(--gold-light);
}
input.blank-input:focus { border-color: var(--gold-dark); box-shadow: inset 0 -2px 0 0 var(--gold); }
input.blank-input { max-width: 100%; }
input.blank-input[style*="--blank-ch"] { width: calc(var(--blank-ch) * 1ch + 24px); text-align: left; }
/* Table exercises whose blanks take a whole sentence (e.g. "rewrite with get"):
   let each blank fill its cell instead of the fixed 160px word-sized box. */
.hw-table--wide-blanks .cloze-blank { display: flex; align-items: center; gap: 6px; }
.hw-table--wide-blanks .cloze-blank input.blank-input { width: 100%; min-width: 12rem; text-align: left; }
input.blank-input::placeholder { color: var(--muted); font-weight: 700; opacity: 1; }

/* Multiple fully separate reading passages stacked in one homework (e.g.
   two unrelated texts): each .reading-panes-block is a complete, independent
   passage+questions pane pair; a rule + gap sets the later ones apart from
   the one before. */
.reading-panes-block--divided {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1.5px solid var(--border);
}

/* ── Reading section: resizable, independently-scrolling two-column layout ── */
.reading-panes {
  --split: 50%;
  display: flex;
  align-items: stretch;
  height: 70vh;
  min-height: 420px;
  max-height: 800px;
}
/* Boxed like the practice-test's .exam-reading-panes__left/__right, just on
   --surface instead of --white since these sit inside an already-white
   .hw-card and need to read as distinct sub-panels rather than blend in. */
.reading-pane {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.reading-pane select.q-input { max-width: 100%; }
.reading-pane--passage {
  width: var(--split);
  flex: 0 0 auto;
}
.reading-pane--questions {
  flex: 1 1 auto;
}
.reading-panes-divider {
  flex: 0 0 auto;
  width: 10px;
  /* No negative overlap: the panes are now boxed with their own border, so
     the divider sits in the gap between the two boxes instead of on top of
     their padding. */
  margin: 0;
  cursor: col-resize;
  position: relative;
  z-index: 1;
  touch-action: none;
}
.reading-panes-divider::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background: var(--border);
  border-radius: 2px;
}
.reading-panes-divider:hover::after,
.reading-panes-divider.is-dragging::after { background: var(--gold); }
.reading-panes.is-resizing { cursor: col-resize; user-select: none; }

@media (max-width: 48rem) {
  .reading-panes { flex-direction: column; height: auto; min-height: 0; max-height: none; gap: 12px; }
  .reading-pane--passage,
  .reading-pane--questions { width: 100%; flex: 0 0 auto; max-height: 48vh; }
  .reading-panes-divider { display: none; }
}

.reading-pane--questions .hw-exercise { margin-bottom: 26px; }
.reading-pane--questions .hw-exercise:last-child { margin-bottom: 0; }

/* Listening block with an image (e.g. map/plan labelling): image on the
   left, its questions on the right, when there's enough width; stacked
   below 48rem, same breakpoint as .reading-panes. */
.hw-listening-split {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}
.hw-listening-split__image { flex: 0 0 42%; max-width: 42%; }
.hw-listening-split__image .hw-exercise-image {
  width: 100%;
  height: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
}
.hw-listening-split__content { flex: 1 1 auto; min-width: 0; }
@media (max-width: 48rem) {
  .hw-listening-split { flex-direction: column; }
  .hw-listening-split__image { flex: 0 0 auto; max-width: 100%; }
}

/* ── Writing: one sentence per step of a process diagram (exercise layout "steps",
   homework/sw2-week1-writing.js). The diagram stays in view beside the questions;
   each step is a card: number · verb · the diagram's labels as chips, then the answer. ── */
.hw-steps { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; margin-top: 6px; }
.hw-steps__fig { position: sticky; top: 16px; margin: 0; min-width: 0; }
.hw-steps__fig a { display: block; border-radius: 12px; }
.hw-steps__fig a:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 3px; }
.hw-steps__fig .hw-exercise-image { width: 100%; max-height: calc(100vh - 80px); object-fit: contain; margin: 0; background: #fff; cursor: zoom-in; }
.hw-steps__fig figcaption { margin-top: 6px; font-size: 12px; color: var(--subtle); text-align: center; }
.hw-steps__qs { min-width: 0; }
.hw-steps .hw-question-list { display: grid; gap: 10px; }
.hw-steps .hw-question-list .question-block.hw-step { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--white); }
.hw-steps .hw-question-list .question-block.hw-step:focus-within { border-color: var(--gold-dark); box-shadow: 0 0 0 3px var(--gold-light); }
.hw-step .q-prompt-row { align-items: center; gap: 10px; flex-wrap: nowrap; }
.hw-step .q-number { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--gold-light); color: var(--gold-ink); font-size: 13px; }
.hw-step .q-prompt { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.hw-step__verb { font-size: 15px; font-weight: 700; color: var(--text); }
.hw-step__labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.hw-step__label { padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12px; color: var(--text-2); }
.hw-step .q-answer-row { margin-top: 10px; }
.hw-step .q-answer-label { display: none; }
.hw-step .ai-feedback:not(:empty) { margin-top: 10px; }
@media (max-width: 860px) {
  .hw-steps { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hw-steps__fig { position: static; }
  .hw-steps__fig .hw-exercise-image { max-height: 60vh; }
}

/* Base font-size for the whole passage pane, driven by the A-/A/A+ control
   (js/homework.js's initPassageFontControl) — same --passage-font-scale
   variable and calc() the exam's .exam-passage-pane uses, so the two pages'
   font-size math matches exactly (css/style.css:2337). Title stays a fixed
   size, matching .exam-passage-title, which doesn't scale either. */
.reading-pane--passage { font-size: calc(14px * var(--passage-font-scale)); }

.hw-passage-intro {
  font-size: 0.93em;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.passage-title {
  /* Arial, not the site's decorative 'Barlow Condensed' — matches
     .exam-passage-title's plain "exam form" look. */
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  margin-bottom: 16px;
}
.passage-paragraph {
  font-size: 1em;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 14px;
}
.para-label { color: var(--gold-dark); margin-right: 4px; }

/* Passage text-size control (A-/A/A+), mirroring the practice-test's
   #exam-settings-panel buttons — see js/homework.js's
   initPassageFontControl(), which drives the --passage-font-scale variable
   .reading-pane--passage's font-size reads above. */
.hw-font-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.hw-font-control__label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
}
.hw-font-btn {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  transition: background var(--t), border-color var(--t);
}
.hw-font-btn:hover { background: var(--gold-light); border-color: var(--gold); }

/* ── Per-section score summary ── */
.hw-summary:not(:empty) {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1.5px dashed var(--border);
}

/* ── Submit bar ── */
.hw-submit-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
}
.hw-completed-note {
  font-weight: 700;
  color: var(--text);
  text-align: center;
  width: 100%;
}
.hw-submit-error {
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--wrong-text);
  text-align: right;
}

/* ════════════════════════════════════════
   ADMIN SHELL (sidebar layout for staff pages)
════════════════════════════════════════ */
.admin-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--white);
  color: var(--text);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-sidebar-brand {
  padding: 22px 20px 4px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.2px;
}

.admin-nav { flex: 1; overflow-y: auto; }
.admin-nav-section-title {
  padding: 14px 20px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9A9A92;
}
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--mid);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--t), color var(--t);
}
.admin-nav-link svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.admin-nav-link:hover { background: var(--surface); color: var(--black); }
.admin-nav-link.active {
  background: var(--gold-light);
  color: var(--black);
  border-left-color: var(--gold-dark);
  font-weight: 700;
}

.admin-sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}

/* Collapsible sidebar (js/admin-shell.js).
   Desktop: html.sb-rail = icon-only rail. Phone (≤ 860px): off-canvas drawer
   opened from .admin-topbar (html.sb-open), with a backdrop. */
.admin-sidebar { transition: width .2s ease; z-index: 40; }
.admin-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 10px; }
.admin-sidebar-head .admin-sidebar-brand { white-space: nowrap; }
.admin-brand-short { display: none; color: var(--gold-dark); }
.admin-sidebar-toggle, .admin-sidebar-close, .admin-topbar-menu {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--mid); cursor: pointer;
  transition: background var(--t), color var(--t), transform .2s ease;
}
.admin-sidebar-toggle { margin-top: 18px; }
.admin-sidebar-toggle:hover, .admin-sidebar-close:hover, .admin-topbar-menu:hover,
.admin-sidebar-toggle:focus-visible, .admin-sidebar-close:focus-visible, .admin-topbar-menu:focus-visible { background: var(--gold-light); border-color: var(--gold); color: var(--black); outline: none; }
.admin-sidebar-toggle svg, .admin-sidebar-close svg, .admin-topbar-menu svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.admin-sidebar-close, .admin-topbar, .admin-backdrop { display: none; }
.admin-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 861px) {
  html.sb-rail .admin-sidebar { width: 64px; }
  html.sb-rail .admin-sidebar-head { flex-direction: column; padding: 0; gap: 8px; }
  html.sb-rail .admin-sidebar-brand { padding: 20px 0 0; text-align: center; }
  html.sb-rail .admin-brand-full,
  html.sb-rail .admin-nav-section-title, html.sb-rail .admin-nav-label { display: none; }
  html.sb-rail .admin-brand-short { display: inline; }
  html.sb-rail .admin-sidebar-toggle { margin: 0 0 12px; transform: rotate(180deg); }
  html.sb-rail .admin-nav-link { justify-content: center; padding: 11px 0; }
  html.sb-rail .admin-nav-link svg { width: 19px; height: 19px; }
}

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .admin-topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    height: 52px; padding: 0 12px; background: var(--white); color: var(--text); border-bottom: 1.5px solid var(--border);
  }
  .admin-topbar .admin-sidebar-brand { padding: 0; font-size: 19px; }
  .admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(280px, 84vw); z-index: 90;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: none;
  }
  html.sb-open .admin-sidebar { transform: none; box-shadow: 8px 0 30px rgba(0,0,0,0.35); }
  .admin-sidebar-toggle { display: none; }
  .admin-sidebar-close { display: inline-flex; margin-top: 16px; }
  .admin-backdrop { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.45); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  html.sb-open .admin-backdrop { opacity: 1; pointer-events: auto; }
  html.sb-open { overflow: hidden; }
  .admin-nav-link { padding: 11px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .admin-sidebar, .admin-backdrop, .admin-sidebar-toggle { transition: none; }
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-content {
  padding: 28px 32px 60px;
  max-width: 1200px;
  width: 100%;
}

.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.admin-page-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 23px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.1px;
}
.admin-page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.admin-user-chip {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 4px;
}
.admin-user-chip strong { color: var(--text); }

/* Subtabs under an admin page header — e.g. Tiến độ's "Lịch sử làm bài" /
   "BTVN theo tuần" — each an actual page link (not a JS-toggled pane), the
   active one styled per-page since only that page knows which it is. */
.admin-subtabs { display: flex; gap: 22px; margin: -12px 0 22px; border-bottom: 1.5px solid var(--border); }
.admin-subtab {
  font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none;
  padding: 9px 4px 10px; margin-bottom: -1.5px; border-bottom: 2.5px solid transparent;
}
.admin-subtab:hover { color: var(--text); }
.admin-subtab.is-active { color: var(--black); border-bottom-color: var(--gold-dark); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 560px) {
  .options          { grid-template-columns: 1fr; }
  .card             { padding: 24px 18px 20px; }
  .q-text           { font-size: 16px; }
  .logo             { font-size: 26px; }
  header            { padding: 13px 18px; }
  .hero             { padding: 16px 20px; }
  .result-actions   { flex-direction: column; align-items: stretch; }
  .restart-btn,
  .topics-btn       { text-align: center; }
}

@media (max-width: 860px) {
  .reading-panes          { flex-direction: column; }
  .reading-pane           { padding: 0; }
  .reading-pane--passage  { border-right: none; border-bottom: 1.5px solid var(--border); padding-bottom: 20px; margin-bottom: 20px; }
  .hw-submit-bar          { flex-direction: column; align-items: stretch; }

  .admin-content   { padding: 20px 16px 40px; }
}

/* ════════════════════════════════════════
   TEST FEEDBACK PAGE (public, no login required)
════════════════════════════════════════ */
.feedback-main { max-width: 780px; }

/* ── Hero: avatar + name + test badge ── */
.feedback-hero-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
}
.feedback-avatar {
  flex-shrink: 0;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--gold-light);
  color: var(--gold-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 1px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-md);
}
.feedback-hero-name {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 5vw, 36px);
  color: var(--black);
  line-height: 1.1;
}
.feedback-hero-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--black);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
@media (max-width: 560px) {
  .feedback-hero-inner { flex-direction: column; text-align: center; }
}

/* ── Task card ── */
.feedback-task-card {
  margin-bottom: 32px;
  padding-top: 28px;
  border-top: 4px solid var(--gold);
}

.feedback-task-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.feedback-task-badge {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 17px;
}
.feedback-task-title {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 23px;
  letter-spacing: 0.2px;
  color: var(--black);
}

.feedback-prompt-box {
  background: var(--gold-light);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.feedback-prompt-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-dark);
  margin-bottom: 4px;
}
.feedback-prompt-text {
  font-style: italic;
  color: var(--mid);
  font-size: 14px;
  line-height: 1.6;
}

.feedback-section { margin-top: 24px; }
.feedback-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dark);
  margin-bottom: 12px;
}
.feedback-section-label::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--gold);
}

/* ── Essay with highlighted errors ── */
.feedback-essay {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.feedback-essay-para {
  line-height: 1.9;
  font-size: 15px;
  margin-bottom: 14px;
}
.feedback-essay-para:last-child { margin-bottom: 0; }
.feedback-error {
  background: none;
  color: var(--wrong-text);
  font-weight: 700;
  border-bottom: 2px solid var(--wrong-border);
  padding-bottom: 1px;
}

/* ── Corrections: wrong/right comparison cards ── */
.feedback-corrections {
  display: grid;
  gap: 10px;
}
.feedback-correction-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.feedback-correction-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.feedback-correction-wrong { background: var(--wrong-bg); color: var(--wrong-text); text-decoration: line-through; }
.feedback-correction-right { background: var(--correct-bg); color: var(--correct-text); font-weight: 700; }
.feedback-badge {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  margin-top: 1px;
  text-decoration: none;
}
.feedback-badge-wrong { background: var(--wrong-border); }
.feedback-badge-right { background: var(--correct-border); }

/* ── Scores: criteria chips + band summary ── */
.feedback-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.feedback-score-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.feedback-score-chip-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-transform: uppercase;
}
.feedback-score-chip-value {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--dark);
  line-height: 1.3;
}
.feedback-score-chip-name {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.feedback-score-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.feedback-score-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--mid);
  border-bottom: 1px solid var(--border);
}
.feedback-score-summary-row:last-child { border-bottom: none; }
.feedback-score-summary-final {
  background: linear-gradient(135deg, #3D2B00, #5C3F00);
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
}

/* ── Teacher's note ── */
.feedback-teacher-note {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold-dark);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 18px 20px;
}
.feedback-comment-block { margin-bottom: 18px; }
.feedback-comment-block:last-child { margin-bottom: 0; }
.feedback-comment-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 10px;
}
.feedback-comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feedback-comment-item {
  position: relative;
  padding-left: 18px;
  line-height: 1.75;
  font-size: 14.5px;
  color: var(--text);
}
.feedback-comment-item::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-dark);
}

/* ── Print-friendly ── */
@media print {
  header, .feedback-hero-badge { break-inside: avoid; }
  .feedback-task-card { break-inside: avoid; box-shadow: none; }
  body { background: var(--white); }
}

/* ════════════════════════════════════════════════════════════ */
/* PRACTICE TEST — realistic on-computer exam simulator          */
/* Ported from ielts-practice-test's global.css. All new classes  */
/* here use an `exam-` prefix to avoid colliding with existing    */
/* homework classes of the same conceptual name (e.g. the plain   */
/* .reading-panes/.passage-title/.para-label used by homework's   */
/* two-column reading layout) — `.q-input`, `.blank-input`, and   */
/* `.question-block` are the only classes intentionally shared,   */
/* since their existing styling is exactly what practice-test     */
/* wants too.                                                     */
/* ════════════════════════════════════════════════════════════ */

:root {
  --passage-font-scale: 1;
}

.exam-shell[hidden] { display: none; }
.exam-shell {
  /* Arial is the official IELTS typeface, on paper and on computer — match
     it here rather than the site's own Barlow branding, so the practice
     test reads like the real exam. */
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: calc(100vh - 64px); /* header above it is ~64px */
}

.exam-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--dark);
  color: var(--white);
}
.exam-topbar__title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.exam-mode-badge {
  margin-left: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 2px 8px;
  vertical-align: middle;
}
.exam-timer {
  font-variant-numeric: tabular-nums;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.12);
}
.exam-timer--flash {
  background: var(--wrong-border);
  animation: exam-flash 1s step-start infinite;
}
@keyframes exam-flash { 50% { background: #8f1a1a; } }

.exam-icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: inherit;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
}
.exam-icon-btn:hover { background: rgba(255,255,255,0.12); }
#exam-submit {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--black);
  font-weight: 700;
}
#exam-submit:hover { background: var(--gold-dark); border-color: var(--gold-dark); }

.exam-settings-wrapper { position: relative; }
.exam-settings-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 950;
  min-width: 160px;
}
.exam-settings-panel[hidden] { display: none; }
.exam-settings-panel__label { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.exam-settings-panel__controls { display: flex; gap: 8px; }
.exam-settings-panel__controls button {
  flex: 1;
  padding: 5px 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
}
.exam-settings-panel__controls button:hover { background: var(--gold-light); border-color: var(--gold); }

.exam-content {
  flex: 1;
  max-width: none; /* override the site-wide `main { max-width: 680px }` narrow-column rule */
  width: 100%;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.exam-bottombar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: var(--white);
  border-top: 1.5px solid var(--border);
}
.exam-nav-arrow {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: border-color var(--t);
}
.exam-nav-arrow:hover { border-color: var(--gold); }
.exam-nav-arrow:disabled { opacity: 0.4; cursor: not-allowed; }

.exam-navigator { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.exam-navigator__group-label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold-dark);
  margin-left: 6px;
}
.exam-navigator__group-label:first-child { margin-left: 0; }

/* Only the part containing the current question expands to show its
   individual number buttons — every other part collapses to a small
   "Part N — x of y" summary chip, matching the real IELTS-on-computer
   navigator (clicking a collapsed chip jumps to and expands that part). */
.exam-navigator__part { display: flex; align-items: center; gap: 6px; }
.exam-navigator__part-buttons { display: none; flex-wrap: wrap; gap: 6px; }
.exam-navigator__part.is-active .exam-navigator__part-buttons { display: flex; }
.exam-navigator__part:not(.is-active) .exam-navigator__group-label { display: none; }
.exam-navigator__part-summary {
  display: flex; align-items: center; gap: 6px;
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 5px 10px; cursor: pointer; font-family: Arial, Helvetica, sans-serif;
  transition: border-color var(--t);
}
.exam-navigator__part-summary:hover { border-color: var(--gold); }
.exam-navigator__part.is-active .exam-navigator__part-summary { display: none; }
.exam-navigator__part-summary-label {
  font-weight: 700; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--gold-dark);
}
.exam-navigator__part-summary-count { font-size: 12px; color: var(--muted); }
.exam-navigator__item {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: Arial, Helvetica, sans-serif;
  transition: background var(--t), border-color var(--t);
}
.exam-navigator__item.is-flagged { border-radius: 50%; border-color: var(--wrong-border); }
.exam-navigator__item.is-current { outline: 2px solid var(--gold-dark); outline-offset: 1px; font-weight: 700; }
.exam-navigator__item.is-answered { background: var(--correct-bg); border-color: var(--correct-border); }
.exam-navigator__item.is-locked { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.exam-navigator__item.is-result-correct    { background: var(--correct-bg); border-color: var(--correct-border); }
.exam-navigator__item.is-result-incorrect  { background: var(--wrong-bg);   border-color: var(--wrong-border); }
.exam-navigator__item.is-result-partial    { background: var(--gold-light); border-color: var(--gold-dark); }
.exam-navigator__item.is-result-unanswered { background: var(--surface);    border-color: var(--border); }

.question-block.correct     { border-color: var(--correct-border); background: var(--correct-bg); }
.question-block.incorrect   { border-color: var(--wrong-border);   background: var(--wrong-bg); }
.question-block.partial     { border-color: var(--gold-dark);      background: var(--gold-light); }
.question-block.unanswered  { border-color: var(--border);         background: var(--surface); }

.exam-result-note { font-size: 12px; font-weight: 700; margin-left: 8px; }
.exam-result-note.is-correct { color: var(--correct-text); }
.exam-result-note.is-incorrect,
.exam-result-note.is-partial { color: var(--wrong-text); }
.exam-result-note.is-unanswered { color: var(--muted); }
p.exam-result-note { margin: 6px 0 0; display: block; }

.q-input:disabled { background: var(--surface); color: var(--muted); }

.exam-review-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 600;
  cursor: pointer;
}
.exam-review-btn.is-active { background: var(--wrong-border); color: var(--white); border-color: var(--wrong-border); }

/* ── Reading: split-pane passage/questions layout ── */
.exam-reading-panes { --split: 50%; display: flex; flex: 1; min-height: 0; }
.exam-reading-panes__left  { width: var(--split); flex: 0 0 auto; }
.exam-reading-panes__right { flex: 1 1 auto; }
.exam-reading-panes__left,
.exam-reading-panes__right {
  overflow-y: auto;
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  min-width: 12rem;
}
.exam-reading-panes__divider {
  flex: 0 0 auto;
  width: 10px;
  margin: 0 -1px;
  cursor: col-resize;
  position: relative;
  z-index: 1;
  touch-action: none;
}
.exam-reading-panes__divider::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px;
  transform: translateX(-50%); background: var(--border); border-radius: 2px;
}
.exam-reading-panes__divider:hover::after,
.exam-reading-panes__divider.is-dragging::after { background: var(--gold); }
.exam-reading-panes.is-resizing { cursor: col-resize; user-select: none; }

@media (max-width: 48rem) {
  .exam-topbar { flex-wrap: wrap; row-gap: 8px; }
  .exam-content { overflow-y: auto; }
  .exam-reading-panes { flex-direction: column; }
  .exam-reading-panes__left,
  .exam-reading-panes__right { width: 100%; flex: 0 0 auto; max-height: 48vh; }
  .exam-reading-panes__divider { display: none; }
  .exam-navigator { justify-content: center; }
}

.exam-part-banner, .exam-passage-pane, .exam-questions-pane { display: none; }
.exam-part-banner.is-active, .exam-passage-pane.is-active, .exam-questions-pane.is-active { display: block; }

/* Writing: gray "Part N" instructions banner, mimicking the real IELTS-on-
   computer test's top-of-screen task banner (spans both panes, above the
   split). */
.exam-part-banner {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.exam-part-banner__title { font-weight: 700; font-size: 16px; margin: 0 0 4px; color: var(--text); }
.exam-part-banner__instructions { margin: 0; color: var(--text); }

.exam-writing-lead { margin-bottom: 10px; }
.exam-writing-prompt { font-weight: 700; line-height: 1.7; white-space: pre-wrap; margin-bottom: 10px; }
.exam-writing-instructions { line-height: 1.7; margin-bottom: 10px; }

.wt-essay-box {
  display: block;
  width: 100%;
  height: 320px;
  min-height: 140px;
  max-height: 70vh;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}
.wt-wordcount { margin-top: 8px; text-align: right; }
.exam-passage-pane { font-size: calc(14px * var(--passage-font-scale)); }
.exam-passage-label {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  font-size: 15px; margin: 0 0 10px; color: var(--gold-dark);
}
/* em, not px: these need to track .exam-passage-pane's font-size, which is
   the one that actually responds to the A-/A/A+ passage-text-size control
   (--passage-font-scale). A fixed px size here would silently opt back out
   of that scaling no matter what the control is set to. */
.exam-passage-instructions { color: var(--muted); font-size: 0.93em; margin-bottom: 10px; }
.exam-passage-standfirst { font-size: 0.93em; line-height: 1.7; color: var(--muted); margin-bottom: 10px; }
.exam-passage-title {
  font-family: Arial, Helvetica, sans-serif; font-size: 22px; font-weight: 700;
  color: var(--black); text-align: center; margin: 14px 0 18px;
}
.exam-passage-image {
  display: block; max-width: 100%; height: auto; margin: 0 auto 18px;
  border-radius: 12px; border: 1px solid var(--border);
}
.exam-passage-paragraph { font-size: 1em; line-height: 1.7; color: var(--text); margin-bottom: 14px; }
.exam-para-label { color: var(--gold-dark); margin-right: 10px; font-weight: 700; }
.exam-glossary {
  margin-top: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 16px;
}
.exam-glossary-title {
  font-weight: 700;
  font-size: 0.79em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-dark);
  margin-bottom: 8px;
}
.exam-glossary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-glossary-list li {
  font-size: 0.89em;
  line-height: 1.6;
  color: var(--muted);
}
.exam-glossary-list strong { color: var(--text); font-style: italic; }

mark.exam-highlight { background: #FFF59D; padding: 0 1px; }
mark.exam-note-mark {
  background: var(--gold-light);
  border-bottom: 2px dotted var(--gold-dark);
  padding: 0 1px;
  cursor: pointer;
}

.exam-question-group + .exam-question-group {
  border-top: 2px solid var(--border); margin-top: 22px; padding-top: 22px;
}
.exam-group-instructions {
  color: var(--muted); background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; line-height: 1.6; font-size: 13px;
}
.exam-group-instructions p { margin: 0; }
.exam-group-instructions__nb { margin-top: 6px !important; color: var(--gold-dark); }
.exam-group-range {
  font-weight: 700;
  font-style: normal;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 4px;
}
.exam-tfng-legend { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.exam-tfng-legend__row { display: flex; gap: 16px; font-size: 13px; }
.exam-tfng-legend__label { flex: 0 0 6.5rem; font-weight: 700; font-style: italic; }

.question-block {
  padding: 8px 12px; margin-bottom: 12px; border: 1.5px solid transparent;
  border-radius: var(--radius); position: relative;
}
.question-block .exam-q-prompt { line-height: 1.6; font-size: 15.5px; }
.question-block p.exam-q-prompt { margin: 0 0 14px; }
.question-block.is-current-question { border-color: var(--gold-dark); background: var(--gold-light); }
/* Grouped-block types (note/summary/table/flow-chart completion) highlight
   the individual field for the current question instead of the whole box. */
.is-current-question.q-input,
.is-current-question.blank-input,
.exam-heading-dropzone.is-current-question {
  border-color: var(--gold-dark); box-shadow: 0 0 0 3px var(--gold-light);
}
.exam-q-number { font-weight: 700; margin-right: 8px; }
/* Hanging indent: the number sits in a fixed-width slot and wrapped lines
   line up under the question text, not under the number. */
.exam-q-hang { padding-left: 2.1em; text-indent: -2.1em; }
.exam-q-hang .exam-q-number { display: inline-block; min-width: 1.6em; margin-right: .5em; text-indent: 0; }
.exam-q-hang input, .exam-q-hang .exam-heading-dropzone { text-indent: 0; }

.exam-summary-title { margin: 0 0 16px; font-size: 15px; text-align: center; }
.exam-summary-paragraph { line-height: 2.6; font-size: 14px; }

/* Row + wrap (not a fixed column) so short options (✓/✗, T/F, S/D, TRUE/FALSE/NOT
   GIVEN) sit side by side and only wrap to a new line when they don't fit —
   cuts a lot of scrolling on option-heavy exercises. Long sentence-style
   options still end up one per row since they simply don't fit next to
   another long option. */
.exam-mc-options { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px 28px; margin-top: 12px; }
.exam-mc-option { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; font-size: 15.5px; flex: 0 1 auto; }

/* No lead-in prompt (e.g. "pick the better phrasing" pairs) — the question
   number sits inline with the options instead of on its own empty line. */
.exam-mc-options--no-prompt { margin-top: 0; align-items: center; }
.exam-mc-options--no-prompt .exam-q-number { font-size: 15.5px; }

/* Practice tests: sentence-style multiple-choice answers stack one per line,
   like the real exam (TRUE/FALSE/NOT GIVEN rows stay side by side). */
#exam-content-root .exam-mc-options:not(.exam-tfng-options) { flex-direction: column; flex-wrap: nowrap; gap: 10px; }

.mc-symbol { font-weight: 700; }
.mc-symbol--tick { color: var(--correct-text, #1a7f37); }
.mc-symbol--cross { color: var(--wrong-text, #c62828); }

/* Plain multiple-choice groups flow into up to 3 CSS columns instead of one
   long vertical list — a newspaper-style flow (not a fixed grid) so a
   question with a longer prompt just takes more height in its own column
   rather than forcing every column to match its width. */
.exam-mc-grid { column-count: 3; column-gap: 24px; }
.exam-mc-grid .question-block { break-inside: avoid; }
@media (max-width: 60rem) {
  .exam-mc-grid { column-count: 2; }
}
@media (max-width: 40rem) {
  .exam-mc-grid { column-count: 1; }
}

.exam-context-menu {
  position: absolute; z-index: 1000; background: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; min-width: 9rem;
}
.exam-context-menu button {
  background: none; border: none; text-align: left; padding: 8px 12px;
  cursor: pointer; font: inherit; font-family: Arial, Helvetica, sans-serif;
}
.exam-context-menu button:hover { background: var(--surface); }
.exam-context-menu__icon { display: inline-block; width: 1.2em; text-align: center; margin-right: 6px; color: var(--gold-dark); font-weight: 700; }

.exam-note-popup {
  position: absolute; z-index: 1000; background: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 10px; width: 240px;
}
.exam-note-popup__textarea {
  width: 100%; min-height: 80px; resize: vertical; font: inherit;
  font-family: Arial, Helvetica, sans-serif; font-size: 13px;
  padding: 8px; border: 1.5px solid var(--border); border-radius: var(--radius);
  box-sizing: border-box;
}
.exam-note-popup__actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.exam-note-popup__actions button {
  font: inherit; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px;
  padding: 6px 12px; border-radius: var(--radius); cursor: pointer; border: 1.5px solid var(--border);
}
.exam-note-popup__actions button:first-child { background: var(--gold); border-color: var(--gold); color: var(--black); font-weight: 700; }
.exam-note-popup__actions button:last-child { background: var(--white); color: var(--wrong-text); }

/* ── Submit / review-before-submit overlay ── */
.exam-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 900;
}
.exam-overlay[hidden] { display: none; }
.exam-overlay__panel {
  background: var(--white); border-radius: var(--radius-lg); padding: 24px;
  max-width: 40rem; width: 90%; max-height: 80vh; display: flex; flex-direction: column; gap: 14px;
}
.exam-overlay__panel h2 { font-family: Arial, Helvetica, sans-serif; font-size: 22px; }
.exam-overlay__summary { font-size: 14px; color: var(--text); font-weight: 600; }
.exam-overlay__scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.exam-overlay__grid { display: flex; flex-wrap: wrap; gap: 6px; }
.exam-overlay__actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ── Per-question-type results breakdown ── */
.exam-breakdown__heading {
  font-family: Arial, Helvetica, sans-serif; font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin: 0 0 4px;
}
.exam-breakdown__row {
  padding: 8px 0; border-top: 1px solid var(--border);
}
.exam-breakdown__row:first-of-type { border-top: none; }
.exam-breakdown__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.exam-breakdown__label { font-size: 14px; font-weight: 600; }
.exam-breakdown__score { font-size: 13px; color: var(--muted); white-space: nowrap; }
.exam-breakdown__bar {
  margin-top: 6px; height: 6px; border-radius: 3px; background: var(--gold-light); overflow: hidden;
}
.exam-breakdown__bar-fill { height: 100%; border-radius: 3px; background: var(--gold-dark); }
.exam-breakdown__row.is-good .exam-breakdown__bar-fill { background: #2e7d32; }
.exam-breakdown__row.is-mid  .exam-breakdown__bar-fill { background: #b8860b; }
.exam-breakdown__row.is-weak .exam-breakdown__bar-fill { background: var(--bad-ink); }
.exam-breakdown__tip {
  margin: 8px 0 2px; font-size: 13px; line-height: 1.5; color: var(--text);
  background: var(--gold-light); border-radius: 8px; padding: 8px 10px;
}
.exam-overlay__back, .exam-overlay__confirm { width: auto; height: auto; padding: 10px 20px; font-size: 14px; }

/* ── Post-submit transcript (listening review) ── */
.exam-transcript { margin-top: 20px; border-top: 2px solid var(--border); padding-top: 14px; }
.exam-transcript__toggle {
  width: auto; height: auto; padding: 8px 14px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); cursor: pointer;
}
.exam-transcript__toggle:hover { background: var(--gold-light); border-color: var(--gold-dark); }
.exam-transcript__body {
  margin-top: 12px; max-height: 420px; overflow-y: auto; padding-right: 6px;
  font-size: 14px; line-height: 1.6;
}
.exam-transcript__line { margin: 0 0 10px; }
.exam-transcript__line.is-answer {
  background: var(--gold-light); border-left: 3px solid var(--gold-dark);
  padding: 8px 10px; border-radius: 0 6px 6px 0;
}
.exam-transcript__sp { font-weight: 700; }
.exam-transcript__q {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--white);
  background: var(--gold-dark); border-radius: 4px; padding: 1px 5px; margin-right: 6px;
  vertical-align: 1px;
}

/* ── Volume control (listening topbar) ── */
.volume-control { display: flex; align-items: center; gap: 6px; color: var(--white); }
.exam-volume-icon { font-size: 15px; line-height: 1; }
.exam-volume-slider {
  -webkit-appearance: none; appearance: none; width: 7rem; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.3); outline: none; cursor: pointer;
}
.exam-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--white); cursor: pointer;
}
.exam-volume-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--white); border: none; cursor: pointer;
}

/* ── Listening layout ── */
.exam-listening-shell { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; gap: 20px; }
/* One part visible at a time — navigate with Next / the navigator's part
   chips, exactly like the real IELTS-on-computer player. switchSection()
   toggles .is-active; every other pane stays in the DOM (so answer capture,
   drag-and-drop wiring and grading still see all questions) but is hidden. */
.exam-section-pane { display: none; flex-direction: column; flex-shrink: 0; }
.exam-section-pane.is-active { display: flex; }
.exam-section-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 12px 16px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; flex-shrink: 0;
}
.exam-section-pane.is-active .exam-section-header { background: var(--gold-light); border-color: var(--gold); }
.exam-section-header__meta { display: flex; flex-direction: column; gap: 4px; }
.exam-section-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--gold-dark); background: var(--gold-light); border: 1px solid var(--gold-dark);
  border-radius: 3px; padding: 2px 6px; display: inline-block;
}
.exam-section-context { margin: 0; font-size: 13px; color: var(--text); font-style: italic; }
.exam-audio-bar { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.exam-audio-play-btn {
  background: var(--gold); color: var(--black); border: none; border-radius: var(--radius);
  padding: 7px 16px; cursor: pointer; font-size: 13px; font-weight: 700; white-space: nowrap;
  font-family: Arial, Helvetica, sans-serif; transition: background var(--t);
}
.exam-audio-play-btn:hover { background: var(--gold-dark); }
.exam-audio-play-btn:disabled { opacity: 0.7; cursor: default; }
.exam-audio-status { font-size: 12px; color: var(--muted); min-width: 6rem; }
.exam-section-questions { padding: 8px 8px 4px; }

/* ── Speaking practice-test: cue card, prep countdown, Part 3 topic groups ── */
.exam-cue-card {
  border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--white);
  padding: 18px 20px; margin-bottom: 16px;
}
.exam-cue-card__topic { font-weight: 700; font-size: 15px; margin: 0 0 10px; }
.exam-cue-card__say { font-weight: 700; margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.exam-cue-card__points { margin: 0 0 10px; padding-left: 20px; }
.exam-cue-card__points li { margin-bottom: 4px; }
.exam-cue-card__final { margin: 0; font-style: italic; }
.exam-prep { margin-bottom: 16px; }
.exam-prep__countdown {
  font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 22px;
  color: var(--gold-dark); margin-bottom: 8px;
}
.exam-prep__skip {
  background: none; border: 1.5px solid var(--border); border-radius: 999px;
  padding: 6px 16px; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
}
.exam-prep__skip:hover { background: var(--surface); }
.exam-part3-topic { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }
.exam-part3-topic:first-child { margin-top: 0; }
.exam-overlay__band { font-weight: 700; color: var(--gold-dark); }

/* Form-completion */
.exam-form-completion-block {
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  background: var(--white); margin-bottom: 12px;
}
.exam-form-title { margin: 0 0 12px; font-size: 15px; text-align: center; border-bottom: 1.5px solid var(--border); padding-bottom: 8px; }
.exam-form-rows { display: table; width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.exam-form-row { display: table-row; }
.exam-form-label { display: table-cell; padding-right: 16px; vertical-align: middle; white-space: nowrap; }
.exam-form-label .exam-q-number {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  font-size: 12px; font-weight: 700; color: var(--white); background: var(--gold-dark);
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.exam-form-field-name { font-weight: 600; font-size: 14px; }
.exam-form-row .blank-input { display: table-cell; width: 14rem; vertical-align: middle; }

/* Note-completion box */
.exam-note-box.question-block { padding: 0; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.exam-note-box-title {
  background: var(--surface); border-bottom: 1.5px solid var(--border); text-align: center;
  font-weight: 700; font-size: 15px; letter-spacing: 0.04em; padding: 8px 12px;
}
.exam-note-box-body { padding: 4px 12px 8px; }

/* Flow chart — a titled stack of step cards joined by drawn arrow
   connectors (reading + listening share this markup). */
.exam-flow-chart { max-width: 640px; margin: 0 auto; padding: 2px 0 6px; }
.exam-flow-chart .exam-note-box-title {
  background: var(--gold-light); border: 1.5px solid var(--gold); border-radius: var(--radius);
  margin-bottom: 14px; padding: 10px 14px;
}
.exam-flow-step {
  position: relative; background: var(--white); text-align: center; line-height: 2.1; font-size: 15.5px;
  border: 1.5px solid var(--border); border-left: 4px solid var(--gold); border-radius: var(--radius);
  padding: 12px 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.exam-flow-arrow { position: relative; height: 38px; }
.exam-flow-arrow::before {           /* connector line between the cards */
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px;
  margin-left: -1px; background: var(--gold);
}
.exam-flow-arrow::after {            /* round badge with a down chevron */
  content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%; background: var(--gold-light) center / 16px 16px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A88600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  border: 1.5px solid var(--gold); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
/* Letter-box flow charts: chip strip above the boxes, blanks are inline
   drop pills that grow to fit the dropped-in word. */
.exam-flow-chart-options { margin-bottom: 8px; text-align: left; }
.exam-flow-step .exam-heading-dropzone--inline { white-space: normal; }
.exam-flow-step .exam-heading-dropzone--inline .exam-heading-dropzone__text { white-space: normal; }
.exam-note-section-header { margin: 10px 0 2px; }
.exam-note-section-header strong { font-size: 14px; }
/* Absolute-positioned dot + padding-left indent, not flex — a flex row
   with interleaved text nodes and inline blank-input children shrinks each
   text run into its own fragile narrow column once content needs to wrap,
   instead of flowing as one normal paragraph. */
.exam-note-bullet-line { position: relative; padding-left: 16px; }
.exam-note-bullet-dot { position: absolute; left: 0; top: 0.65em; font-size: 17px; line-height: 1; }

/* Table-completion — a genuine gridded table (row label + one or more
   content columns), matching the real test's ruled table rather than
   note-completion's flowing box. */
.exam-table-box.question-block { padding: 0; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* Wide tables (e.g. a 4-column comparison) can exceed the question pane's
   width — scroll the table horizontally rather than silently clipping
   columns off the edge with no way to reach them. */
.exam-table-scroll { overflow-x: auto; }
.exam-table-completion { width: 100%; min-width: 460px; border-collapse: collapse; }
.exam-table-completion th,
.exam-table-completion td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
}
.exam-table-completion th {
  background: var(--surface);
  font-weight: 700;
  text-align: center;
}
.exam-table-completion .exam-table-label { font-weight: 700; white-space: normal; }
/* Answer boxes shrink with their column, so wide (4-5 column) tables fit
   the question pane instead of forcing a sideways scroll. */
.exam-table-completion input.blank-input { width: 100%; max-width: 160px; min-width: 64px; }
.exam-table-completion .exam-summary-paragraph { margin: 0 0 6px; line-height: 1.6; }
.exam-table-completion .exam-summary-paragraph:last-child { margin-bottom: 0; }
.exam-table-completion .exam-table-label { line-height: 1.6; }
.exam-table-completion .exam-note-section-header { margin: 8px 0 2px; }
.exam-table-completion .exam-note-section-header:first-child { margin-top: 0; }

/* Diagram-labelling — image with a numbered list of blanks below it */
.exam-diagram-item { margin-bottom: 20px; }
.exam-diagram-image {
  display: block; max-width: min(100%, 580px); height: auto; margin: 0 auto 14px;
  border-radius: 12px; border: 1px solid var(--border);
  padding: 10px; background: var(--surface); box-sizing: border-box;
}
.exam-diagram-questions .exam-diagram-question { margin-bottom: 10px; }

/* Matching-information grid — paragraph letters as column headers, one
   radio per (question, letter) cell, matching the real test's layout. */
.exam-matching-grid-header,
.exam-matching-grid-row {
  display: grid;
  align-items: center;
}
.exam-matching-grid-header {
  border-bottom: 2px solid var(--text);
  padding-bottom: 8px;
  margin-bottom: 4px;
  font-weight: 700;
}
.exam-matching-grid-row {
  border-bottom: 1.5px solid var(--border);
  padding: 10px 0;
}
.exam-matching-grid-row:last-child { border-bottom: none; }
.exam-matching-grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  min-height: 28px;
  text-align: center;
}
.exam-matching-grid-cell.exam-matching-grid-qnum,
.exam-matching-grid-cell.exam-matching-grid-prompt,
.exam-matching-grid-cell.exam-matching-grid-corner {
  justify-content: flex-start;
  text-align: left;
}
.exam-matching-grid-header-cell,
.exam-matching-grid-radio-cell {
  border-left: 1.5px solid var(--border);
}
.exam-matching-grid-qnum { font-weight: 700; }
.exam-matching-grid-prompt { font-size: 13.5px; line-height: 1.5; }
.exam-matching-grid-radio-cell input { margin: 0; }

/* Matching headings — drag-and-drop, verified against the real
   IELTS-on-computer interface (demo-ielts.inspera.com). */
.exam-heading-list {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 8px;
}
.exam-heading-list > .exam-matching-options-title { flex-basis: 100%; }
.exam-heading-chip {
  background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 13.5px; line-height: 1.4; cursor: grab; user-select: none;
  transition: border-color var(--t), background var(--t);
}
.exam-heading-chip:hover { border-color: var(--gold); }
.exam-heading-chip.is-selected { border-color: var(--gold-dark); background: var(--gold-light); }
.exam-heading-chip.is-placed { display: none; }

.exam-heading-dropzone {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--gold-dark); border-radius: var(--radius);
  background: var(--gold-light); padding: 8px 12px; margin-bottom: 10px;
  min-height: 20px; cursor: pointer;
}
.exam-heading-dropzone.is-dragover { background: var(--gold); border-style: solid; }
/* Empty state centres the bare question number (the zero-width anchor span
   sitting beside it would otherwise get pushed apart by space-between);
   the filled state restores space-between to split [answer text, clear button]. */
.exam-heading-dropzone.is-filled {
  justify-content: space-between;
  border-style: solid; border-color: var(--border); background: var(--white); cursor: default;
}
/* Summary-completion blanks sit mid-sentence, so the dropzone needs to
   flow inline with the surrounding text instead of stacking as a block.
   Width is shrink-to-fit (not fixed) so a longer dropped-in phrase widens
   the pill instead of wrapping onto a second line inside it; only the
   empty placeholder state gets a min-width so it doesn't look cramped. */
.exam-heading-dropzone--inline {
  display: inline-flex; vertical-align: middle; justify-content: center;
  max-width: 100%; padding: 3px 10px; margin: 0 3px; min-height: 0; gap: 0;
}
.exam-heading-dropzone--inline:not(.is-filled) { min-width: 44px; }
/* The base .exam-heading-dropzone's gap:8px is meant to space the filled
   state's [answer text, clear button] pair — restore it only there, since
   in the empty state it also (uselessly) gapped the zero-width anchor span
   away from the placeholder number, pushing it visibly off-center. */
.exam-heading-dropzone--inline.is-filled { justify-content: space-between; gap: 8px; }
.exam-heading-dropzone__placeholder {
  font-family: Arial, Helvetica, sans-serif; font-weight: 700; color: var(--text);
}
.exam-heading-dropzone__text { font-size: 13.5px; font-weight: 600; cursor: grab; white-space: nowrap; }
.exam-heading-dropzone__clear {
  background: none; border: none; cursor: pointer; color: var(--muted); font-size: 16px;
  line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.exam-heading-dropzone__clear:hover { color: var(--wrong-text); }

/* Matching type */
.exam-matching-options-box {
  display: inline-block; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 16px; background: var(--surface); min-width: 18rem;
}
.exam-matching-options-title { font-weight: 700; text-align: center; margin-bottom: 6px; font-size: 14px; }
.exam-matching-option-row { display: flex; gap: 12px; padding: 2px 0; font-size: 14px; }
.exam-matching-option-letter { font-weight: 700; min-width: 1.2rem; }
.exam-matching-questions { display: flex; flex-direction: column; gap: 8px; }
.exam-matching-row { display: flex; align-items: center; gap: 12px; }
.exam-matching-item-label { flex: 1; font-size: 14px; }
.exam-matching-select { font: inherit; padding: 4px 8px; min-width: 6rem; }

/* Matching — drag-and-drop rows (letter chips from .exam-heading-list drop
   into the pill beside each question). Reuses the .exam-heading-* mechanism
   and styles; only the compact one-line row layout is new here. */
.exam-matching-dnd-row {
  display: grid; grid-template-columns: auto minmax(6rem, 13rem) minmax(160px, 24rem);
  align-items: start; justify-content: start; gap: 10px 12px; margin-bottom: 10px;
}
.exam-matching-dnd-row .exam-q-number { padding-top: 9px; }
.exam-matching-dnd-row .exam-q-prompt { font-size: 14px; line-height: 1.4; padding-top: 9px; }
/* Empty target is a wide, obvious drop area; once filled it shrink-wraps to
   the option text (wrapping onto extra lines rather than overflowing). */
.exam-matching-dnd-row .exam-heading-dropzone { margin-bottom: 0; min-width: 160px; min-height: 38px; }
.exam-matching-dnd-row .exam-heading-dropzone.is-filled { min-width: 0; }
.exam-matching-dnd-row .exam-heading-dropzone__text { white-space: normal; text-align: left; cursor: grab; }
.exam-matching-dnd-row .exam-result-note { grid-column: 2 / -1; }
.exam-heading-list.is-locked .exam-heading-chip,
.exam-heading-dropzone.is-locked { cursor: default; }
.exam-heading-dropzone.is-locked .exam-heading-dropzone__text { cursor: default; }
.exam-heading-dropzone.is-locked .exam-heading-dropzone__clear { display: none; }

.exam-review-mode-banner {
  background: var(--correct-bg); border: 1.5px solid var(--correct-border); border-radius: var(--radius);
  padding: 8px 16px; margin-bottom: 12px; font-size: 14px; color: var(--correct-text);
  font-weight: 700; text-align: center; flex-shrink: 0;
}

/* ════════════════════════════════════════
   TEACHER GRADING (grade.html, grading-queue.html) + STUDENT REVIEW (my-reviews.html)
════════════════════════════════════════ */
.grade-page .admin-content { max-width: none; padding-left: 28px; padding-right: 28px; }
.gr-note--warn { background: #FDF3F3 !important; border-color: #E9A6A6 !important; color: #8A1F1F; }
.gr-back { display: inline-block; font-size: 12.5px; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
.gr-back:hover { color: var(--gold-dark); }
.gr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.gr-filters { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.gr-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gr-filters select, .gr-filters input { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 10px; font: inherit; font-size: 13px; background: var(--white); color: var(--text); min-width: 160px; }

.gr-table-wrap { padding: 0; overflow-x: auto; }
.gr-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gr-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 13px 16px; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.gr-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.gr-table tr:last-child td { border-bottom: 0; }
.gr-open { margin: 0; padding: 7px 16px; font-size: 12px; display: inline-block; text-decoration: none; white-space: nowrap; }

.gr-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.gr-chip--none      { background: #F1F1EE; color: var(--muted); }
.gr-chip--draft     { background: var(--warn-bg); color: var(--warn-text); }
.gr-chip--published { background: var(--correct-bg); color: var(--correct-text); }
.gr-chip--dismissed { background: var(--wrong-bg); color: var(--wrong-text); }

.gr-toolbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 14px; padding: 10px 16px; margin-bottom: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.gr-toolbar-left, .gr-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gr-btn { font: inherit; font-size: 13px; font-weight: 700; padding: 9px 18px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--white); color: var(--text); cursor: pointer; }
.gr-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-light); }
.gr-btn--primary { background: var(--gold); border-color: var(--gold); color: var(--black); }
.gr-btn--primary:hover:not(:disabled) { background: var(--gold-dark); border-color: var(--gold-dark); }
.gr-btn:disabled { opacity: .55; cursor: default; }
.gr-status { font-size: 12.5px; color: var(--muted); }
.gr-status--error { color: var(--wrong-text); font-weight: 600; }
.gr-note { background: var(--gold-light); border: 1px solid var(--gold); border-radius: 10px; padding: 10px 16px; font-size: 13px; margin-bottom: 18px; }

.gr-section { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.gr-section--summary { padding: 0; border: 0; background: transparent; box-shadow: none; margin-top: 44px; }
.gr-h { font-size: 17px; font-weight: 700; margin-bottom: 16px; color: var(--black); }

/* speaking recordings */
.gr-rec { padding: 18px 0; border-bottom: 1px solid var(--border); }
.gr-rec:first-of-type { padding-top: 0; }
.gr-rec:last-child { border-bottom: 0; padding-bottom: 0; }
.gr-rec-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.gr-rec-tag { flex: none; background: var(--gold-light); color: var(--gold-ink); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.gr-rec-prompt { font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.gr-audio { width: 100%; max-width: 460px; height: 40px; display: block; margin-bottom: 12px; }
.gr-rec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .gr-rec-cols { grid-template-columns: 1fr; } }
.gr-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 0 0 6px; }

/* inline-editable text: read view + textarea on demand */
.gr-rich { position: relative; }
.gr-rich-view { font-size: 14.5px; line-height: 1.7; padding-right: 60px; white-space: normal; }
.gr-ph { color: #9a9a95; font-style: italic; }
.gr-edit { position: absolute; top: 0; right: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; cursor: pointer; opacity: .75; }
.gr-rich:hover .gr-edit { opacity: 1; border-color: var(--gold); color: var(--black); }
.gr-text { width: 100%; padding: 11px 13px; border: 1.5px solid var(--gold-dark); border-radius: 10px; font: inherit; font-size: 14px; line-height: 1.65; resize: vertical; min-height: 72px; background: var(--white); color: var(--text); box-shadow: 0 0 0 3px var(--gold-light); }
.gr-text:focus { outline: none; }

/* writing: tabs + panes */
.gr-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.gr-tab { font: inherit; font-size: 14px; font-weight: 700; padding: 10px 20px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--white); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 10px; }
.gr-tab:hover { border-color: var(--gold); color: var(--text); }
.gr-tab.is-active { background: var(--gold); border-color: var(--gold); color: var(--black); }
.gr-tab-band { background: var(--gold); color: var(--black); font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.gr-pane { display: none; }
.gr-pane.is-active { display: block; }
.gr-writing-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }
.gr-essay-col { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1100px) { .gr-writing-grid { grid-template-columns: 1fr; } .gr-essay-col { position: static; max-height: none; } }
.gr-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.gr-card-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin-bottom: 10px; }
.gr-question { font-size: 14px; line-height: 1.65; background: var(--surface); border-radius: 10px; padding: 12px 14px; }
.gr-wc { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.gr-wc--low { color: var(--wrong-text); }
.gr-essay { font-size: 15px; line-height: 1.85; color: #222; }
.gr-issues-empty { font-size: 13px; color: var(--muted); }
.gr-issue { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.55; }
.gr-issue:last-child { border-bottom: 0; padding-bottom: 0; }
.gr-issue-main { flex: 1; }
.gr-issue-arrow { color: var(--muted); }
.gr-issue-fix { color: var(--correct-text); font-weight: 700; }
.gr-issue-why { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.gr-issue-rm { flex: none; border: 0; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.gr-issue-rm:hover { background: var(--wrong-bg); color: var(--wrong-text); }

.gr-rubric-col { display: flex; flex-direction: column; gap: 14px; }
.gr-score { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.gr-band { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 10px; font: inherit; font-size: 15px; font-weight: 700; background: var(--white); min-width: 62px; }
.gr-band--wide { min-width: 180px; font-size: 13px; font-weight: 600; margin-left: 8px; }

/* Drag-bar score input (bandSlider in js/grade.js): a native range input for real
   drag/keyboard support, its own chrome hidden via -webkit/-moz-appearance. Track
   fill is a progress-style red→amber→green gradient up to the current value, then
   plain grey — set per-instance via the --track-fill custom property (JS), which
   both the base element's background and ::-moz-range-track read, since Firefox
   ignores the base element's own background for range track rendering. A floating
   value badge tracks the thumb, and a 1-9 tick row sits below. */
.gr-slider-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
/* margin-top lines the label up with the track's own vertical center (the
   track sits 28px, .gr-slider's padding-top, down from the row top — not the
   row's full height, which also includes the badge above and tick row below). */
.gr-slider-label { flex: none; margin-top: 28px; font-size: 14px; font-weight: 700; color: #16305f; line-height: 14px; }
.gr-slider { position: relative; flex: 1; padding-top: 28px; }
.gr-slider-input {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 14px; margin: 0; border-radius: 999px;
  background: var(--track-fill, #DCDCD5);
  outline: none; cursor: pointer;
}
.gr-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; margin-top: -5px; border-radius: 50%;
  background: var(--white); border: 3px solid #16305f; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab;
}
.gr-slider-input::-moz-range-track { height: 14px; border-radius: 999px; background: var(--track-fill, #DCDCD5); }
.gr-slider-input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--white); border: 3px solid #16305f; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab; }
.gr-slider.is-unset .gr-slider-input::-webkit-slider-thumb,
.gr-slider.is-unset .gr-slider-input::-moz-range-thumb { border-color: #9aa0ab; }
.gr-slider-input:active::-webkit-slider-thumb, .gr-slider-input:active::-moz-range-thumb { cursor: grabbing; }
.gr-slider-input:focus-visible::-webkit-slider-thumb, .gr-slider-input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(22,48,95,.18), 0 1px 4px rgba(0,0,0,.25); }
.gr-slider-badge {
  position: absolute; top: 0; transform: translateX(-50%);
  min-width: 24px; padding: 2px 8px; border-radius: 999px; text-align: center;
  color: var(--white); font-size: 12.5px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.2); pointer-events: none;
}
.gr-slider-ticks { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 1px; }
.gr-slider-ticks span { font-size: 12px; font-weight: 600; color: var(--muted); }

/* Collapsible "Đề bài" card — flex-shrink:0 for the same reason as
   .gr-card--essay above: overflow:hidden on a flex item inside the
   height-constrained .gr-essay-col would otherwise let flexbox collapse it
   toward zero height instead of the column scrolling normally. */
.gr-card--collapsible { padding: 0; overflow: hidden; flex-shrink: 0; }
.gr-card-label--toggle {
  all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 18px; margin: 0; border-radius: 14px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); cursor: pointer;
}
.gr-card-label--toggle:hover { background: var(--surface); }
.gr-chevron { width: 14px; height: 14px; flex: none; transition: transform .15s ease; }
.gr-card--collapsible.is-collapsed .gr-card-label--toggle { border-radius: 14px; }
.gr-card--collapsible.is-collapsed .gr-chevron { transform: rotate(-90deg); }
.gr-card-body { padding: 0 18px 16px; }
.gr-card--collapsible.is-collapsed .gr-card-body { display: none; }
.gr-override { display: block; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 10px; }

/* shared review pieces (teacher + student) */
.rv-crit { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.rv-crit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rv-crit-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-light); color: var(--gold-ink, #7A5D00); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.rv-crit-title { flex: 1; font-size: 15px; font-weight: 700; color: var(--black); }
.rv-crit-title em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 13.5px; }
.rv-pill { flex: none; background: #EAEDF4; color: #16305f; font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.rv-note { font-size: 14.5px; line-height: 1.7; border-radius: 10px; padding: 11px 14px; margin-top: 8px; }
.rv-note--good { background: #F1FAF4; color: var(--correct-text); }
.rv-note--bad  { background: #FDF3F3; color: var(--bad-ink); }
.rv-note-label { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.rv-note .gr-rich-view { padding-right: 62px; }
mark.rv-q { background: #FFF1B8; color: #222; padding: 1px 4px; border-radius: 4px; font-weight: 600; }
mark.rv-err { background: #FDE8E8; color: var(--bad-ink); text-decoration: underline wavy var(--bad-ink); text-underline-offset: 3px; padding: 0 2px; border-radius: 3px; font-weight: 600; cursor: help; }

.rv-summary { background: var(--gold-soft); border: 1.5px solid #F0D98A; border-radius: 18px; padding: 26px 28px; text-align: center; }
.rv-summary-kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .6px; color: #B7791F; margin-bottom: 8px; }
.rv-summary-band { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 16px; }
.rv-summary-band span { font-size: 22px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #16305f; }
.rv-summary-band strong {
  display: flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #F5C200, #E8770C);
  font-size: 38px; font-weight: 700; line-height: 1; color: var(--white);
  box-shadow: 0 6px 16px rgba(232,119,12,.35), inset 0 0 0 4px rgba(255,255,255,.4);
}
.rv-summary-text { text-align: left; max-width: 760px; margin: 0 auto 8px; font-size: 14.5px; line-height: 1.75; }
.rv-summary-chart { display: flex; align-items: flex-start; justify-content: center; gap: 24px; flex-wrap: wrap; border-top: 1px solid #F0D98A; margin-top: 16px; padding-top: 14px; }
.rv-chart { flex: 1 1 420px; max-width: 540px; }
.rv-chart-title { font-size: 14px; font-weight: 700; color: #16305f; margin-bottom: 2px; }
.rv-radar { width: 100%; max-width: 540px; height: auto; }
.rv-radar-ring { fill: none; stroke: #D9D6C9; stroke-width: 1; }
.rv-radar-area { fill: rgba(22,48,95,.16); stroke: #16305f; stroke-width: 2; }
.rv-radar-label { font-size: 12px; font-weight: 600; fill: #333; }
.rv-radar-score { font-size: 13px; font-weight: 700; fill: #B7501B; }
.rv-radar-tick { font-size: 12px; fill: #9a9a8f; }
.rv-summary-formula {
  display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center;
  gap: 4px; font-size: 15px; color: var(--text-2); margin-bottom: 16px;
  padding: 9px 18px; background: var(--white); border: 1.5px solid #F0D98A; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.rv-summary-formula b { color: #B7501B; font-size: 15.5px; }
.rv-summary-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 10px; }

.rv-figure { max-width: 100%; height: auto; border-radius: 10px; margin-top: 12px; border: 1px solid var(--border); }
.rv-table-title { font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.rv-table-wrap { overflow-x: auto; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rv-table th { background: var(--border-soft); text-align: left; padding: 7px 10px; border: 1px solid var(--border); }
.rv-table td { padding: 7px 10px; border: 1px solid var(--border); }

/* student list + page */
.mr-main .card + .card { margin-top: 18px; }
.mr-main .gr-card { margin-top: 14px; }
.mr-main .rv-crit { margin-top: 12px; }
.mr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.mr-row:last-child { border-bottom: 0; }
.mr-row:hover { background: var(--gold-light); }
.mr-row-band { font-size: 28px; font-weight: 700; }

/* Essay homework (exercise.essay) */
.essay-input { display: block; width: 100%; margin-top: 10px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font: inherit; font-size: 15px; line-height: 1.65; resize: vertical; min-height: 220px; }
.essay-input:focus { outline: none; border-color: var(--gold-dark); box-shadow: inset 0 -2px 0 0 var(--gold); }
.essay-input:disabled { background: var(--surface); color: var(--muted); }
.essay-wordcount { font-size: 12.5px; color: var(--muted); margin-top: 4px; text-align: right; }
.essay-wordcount--low { color: var(--wrong-text); }

/* The student's own writing: a strong navy header + border so it stands apart from the prompt and issue cards */
/* flex-shrink:0 matters here: .gr-essay-col is a height-constrained flex column, and this
   card's overflow:hidden (needed to clip the label's bleed-to-edge corners) would otherwise
   let flexbox collapse it toward zero height instead of letting the column scroll — clipping
   the essay text itself rather than showing a scrollbar. */
.gr-card--essay { border: 2px solid #16305f; padding-top: 0; overflow: hidden; flex-shrink: 0; }
.gr-card--essay .gr-card-label { background: var(--gold-light); color: var(--text); border-bottom: 1px solid #EBD27A; margin: 0 -18px 14px; padding: 11px 18px; font-size: 12.5px; letter-spacing: .5px; }
.gr-card--essay .gr-card-label .gr-wc { color: var(--gold-ink, #7A5D00); font-weight: 700; }
.gr-card--essay .gr-card-label .gr-wc--low { color: var(--bad, #E5121C); }

/* Writing integrity signals (roadmap #14) — small amber flag, only shown when a paste
   happened; sits against the essay card's dark navy header, same family as .gr-chip--draft. */
.gr-integrity-flag {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; padding: 2px 9px;
  border-radius: 999px; background: var(--warn-bg); color: var(--warn-text);
  font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; cursor: help; vertical-align: middle;
}

/* Sidebar groups (js/admin-shell.js): titled sections; a hairline between them in rail mode, where titles are hidden. */
.admin-nav-group + .admin-nav-group { margin-top: 4px; }
@media (min-width: 861px) {
  html.sb-rail .admin-nav-group + .admin-nav-group { margin: 6px 14px 0; padding-top: 6px; border-top: 1px solid var(--border); }
  html.sb-rail .admin-nav-group + .admin-nav-group .admin-nav-link { margin-left: -14px; margin-right: -14px; }
}

/* placement-test.html — public, no-login placement test wizard (#10). */
.pt-card { max-width: 720px; text-align: left; }
.pt-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.pt-meter { flex: 1; height: 7px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.pt-meter span { display: block; height: 100%; border-radius: 999px; background: var(--gold-dark, #C9A000); }
.pt-progress span:last-child { flex: none; font-size: 12.5px; font-weight: 700; color: var(--mid, #555); white-space: nowrap; }
.pt-passage p { line-height: 1.6; margin: 0 0 14px; }
.pt-context { font-style: italic; color: var(--muted, #6B6B6B); margin: 0 0 10px; }
.pt-audio { width: 100%; margin-bottom: 16px; }
.pt-group { margin: 20px 0; }
.pt-instructions { font-weight: 700; margin-bottom: 10px; }
.pt-note p { line-height: 1.9; margin: 2px 0; }
.pt-q { margin-bottom: 14px; }
.pt-q__num { font-weight: 700; margin-right: 6px; }
.pt-q__prompt { display: block; margin-bottom: 6px; }
.pt-answer, .pt-blank { padding: 8px 10px; border: 1.5px solid var(--border, #D8D8D2); border-radius: 8px; font-size: 14px; width: 220px; max-width: 100%; }
.pt-blank { display: inline-block; width: 140px; margin: 0 2px; }
.pt-radio { display: inline-flex; align-items: center; gap: 5px; margin: 0 16px 6px 0; font-weight: 400; cursor: pointer; }
.pt-essay { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border, #D8D8D2); border-radius: 8px; font: 14px/1.5 inherit; resize: vertical; }
.pt-wordcount { font-size: 12.5px; color: var(--muted, #6B6B6B); margin: 6px 0 14px; }
.pt-actions { display: flex; gap: 10px; align-items: center; }
.pt-btn--ghost { background: transparent; color: var(--mid, #555); border: 1.5px solid var(--border, #D8D8D2); }
.pt-btn--ghost:hover { background: var(--surface, #F7F7F2); }
.pt-result__overall { text-align: center; margin: 10px 0 20px; }
.pt-result__overall span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted, #6B6B6B); text-transform: uppercase; letter-spacing: .04em; }
.pt-result__overall strong { font-size: 40px; line-height: 1.2; }
.pt-result__list { display: flex; flex-direction: column; gap: 1px; background: var(--white, #fff); border: 1.5px solid var(--border, #D8D8D2); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.pt-result__row { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border, #D8D8D2); }
.pt-result__row:last-child { border-bottom: 0; }
.pt-result__course { font-size: 16px; }
.pt-result__comment { background: var(--surface, #F7F7F2); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; }
.pt-muted { color: var(--muted, #6B6B6B); font-size: 12.5px; font-style: italic; }

/* Offline banner (roadmap #18) — js/util.js toggles this on navigator online/offline. */
#offline-banner {
  position: fixed; left: 50%; bottom: 16px; z-index: 9999; transform: translateX(-50%);
  background: var(--warn-bg, #FEF3C7); color: var(--warn-text, #92400E); border: 1.5px solid var(--warn-border, #C98A00);
  border-radius: 999px; padding: 8px 16px; font: 600 12.5px Arial, Helvetica, sans-serif; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
#offline-banner[hidden] { display: none; }

/* Pronunciation detail (roadmap #15) — ReviewUI.pronHtml on grade.html / my-reviews.html */
.pr-box { margin-top: 10px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); }
.pr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 8px; }
.pr-title { font-weight: 700; font-size: 13px; margin-right: 4px; }
.pr-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--border-soft); color: #555; }
.pr-chip b { font-size: 13px; color: var(--dark); }
.pr-chip.is-ok { background: #E7F6EC; } .pr-chip.is-warn { background: #FEF0C7; } .pr-chip.is-bad { background: #FDE8E8; }
.pr-words { font-size: 14px; line-height: 1.9; margin-bottom: 8px; }
.pr-w { padding: 1px 2px; border-radius: 4px; }
.pr-w.is-bad { background: #FDE8E8; color: var(--bad-ink); text-decoration: underline wavy #E5121C; text-underline-offset: 3px; }
.pr-w.is-warn { background: #FEF0C7; color: #8A4B08; }
.pr-sounds { margin-bottom: 6px; }
.pr-sound { font-size: 13px; margin: 3px 0; }
.pr-tip { color: var(--muted); }
.pr-legend { font-size: 12px; color: #888; }
.pr-legend .pr-w { text-decoration: none; }
.pr-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.pr-trend { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-trend th { text-align: left; font-size: 12px; color: #888; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.pr-trend td { padding: 6px 8px; border-bottom: 1px solid var(--border-soft); }
.pr-down { color: #15803D; font-weight: 700; } .pr-up { color: var(--bad-ink); font-weight: 700; }

/* Writing Task 1 chart image (practice-test-writing.js: task.image) */
.wt-figure { margin: 14px 0 0; }
.wt-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--white); }

/* Rejected-save notice (js/util.js showSaveError) — e.g. session expired on submit */
#save-error {
  position: fixed; left: 50%; bottom: 16px; z-index: 10000; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  background: #FDE8E8; color: #8A1C1C; border: 1.5px solid #E5121C;
  border-radius: 12px; padding: 10px 12px 10px 16px; font: 600 13px Arial, Helvetica, sans-serif; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
#save-error[hidden] { display: none; }
.save-error__retry {
  flex-shrink: 0; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  background: var(--bad-ink); color: var(--white); font: 700 13px Arial, Helvetica, sans-serif;
}
.save-error__retry:disabled { opacity: .6; cursor: default; }

/* ── Result marking inside homework / practice exercises ──
   No boxed or tinted rows: a slim coloured bar on the left marks each row,
   the answer box itself turns green/red (the wrong answer struck through),
   and the correction sits right after the box as a green pill. */
.hw-exercise .question-block:not(.cloze-blank).correct,
.hw-exercise .question-block:not(.cloze-blank).incorrect {
  background: none; border: 0; border-radius: 0;
  border-left: 3px solid var(--correct-border); padding-left: 14px;
}
.hw-exercise .question-block:not(.cloze-blank).incorrect { border-left-color: var(--wrong-border); }
.hw-exercise .cloze-blank.question-block.correct,
.hw-exercise .cloze-blank.question-block.incorrect { background: none; border-color: transparent; }
.hw-exercise .question-block.correct .q-input   { border-color: var(--correct-border); background: var(--correct-bg); color: var(--correct-text); }
.hw-exercise .question-block.incorrect .q-input { border-color: var(--wrong-border); background: var(--wrong-bg); color: var(--wrong-text); }
.hw-exercise .question-block.incorrect.is-revealed input.q-input { text-decoration: line-through; text-decoration-thickness: 1.5px; }
/* Keep the mark next to the answer box instead of pushed to the far edge. */
.hw-exercise .hw-question-list .q-prompt { flex: 0 1 auto; }
.hw-exercise .hw-question-list .q-mark:has(.hw-explain:not(.hw-explain--fold)) { flex-basis: 100%; white-space: normal; }
.hw-exercise .hw-question-list .q-mark:has(.hw-explain--fold) { white-space: normal; }
.hw-exercise .q-mark .label-correct { font-size: 15px; }
.hw-exercise .q-mark .label-correct-hint {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--correct-bg); border: 1px solid var(--correct-border);
  color: var(--correct-text); font-size: 13px; font-weight: 700;
  /* A long answer wraps inside the pill instead of running off the page. */
  white-space: normal; overflow-wrap: anywhere; max-width: 100%; box-sizing: border-box;
}
.hw-exercise .q-mark .label-correct-hint::before { content: "✓"; flex: none; }
.hw-exercise .hw-question-list .q-mark { max-width: 100%; min-width: 0; }
/* Inside a fixed-layout table (.hw-table--compare), .q-mark's own nowrap
   (line 3017) is inherited by .hw-explain too, so the whole citation stays
   on one unbroken line and overflows the narrow cell into the next row/
   column. Reset it at the source, plus the pill's own explicit nowrap. */
.hw-table .q-mark { white-space: normal; }
.hw-table .q-mark .label-correct-hint { white-space: normal; }

/* Words the question points at (in italics) — underlined in gold so they
   stand out from the rest of the sentence. */
.hw-exercise .hw-question-list .q-prompt em,
.hw-exercise .hw-gapfill-list li em {
  font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--gold);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}

/* Vocabulary tabs: "continue to the next tab" link under a tab's exercises. */
.hw-next-tab {
  display: flex; align-items: center; gap: 14px; width: 100%;
  margin: 28px 0 8px; padding: 14px 18px;
  background: var(--correct-bg); border: 1.5px solid var(--correct-border); border-radius: var(--radius-lg);
  font: inherit; text-align: left; cursor: pointer; transition: background var(--t), transform var(--t);
}
.hw-next-tab:hover { background: #dff3e5; transform: translateY(-1px); }
.hw-next-tab__kicker {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--correct-text);
}
.hw-next-tab__title { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 15px; font-weight: 700; color: var(--text); text-transform: capitalize; }
.hw-next-tab__title .hw-vocab-tab__letter { background: var(--correct-border); color: var(--white); }
.hw-next-tab__arrow { font-size: 20px; font-weight: 700; color: var(--correct-border); }

/* ── Light lesson header (homework / grammar / vocabulary / quiz pages) ──
   Matches the rest of the app's page headers: left-aligned, sentence-case
   title, small gold kicker above, muted subtitle; unit pager on the right. */
.hero.hero--light { background: none; padding: 28px 32px 6px; text-align: left; overflow: visible; }
.hero.hero--light::before { display: none; }
.hero--light .hero__inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.hero--narrow .hero__inner { max-width: 680px; margin: 0 auto; }
.hero--light .hero__text { min-width: 0; flex: 1 1 360px; }
.hero__kicker {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-dark); margin-bottom: 6px;
}
.hero.hero--light h1 {
  display: flex; align-items: center; gap: 10px;
  font-size: 26px; line-height: 1.25; letter-spacing: -0.2px; text-transform: none; color: var(--black);
}
.hero__num {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px;
  background: var(--gold); color: var(--black); font-size: 17px; font-weight: 700;
}
.hero.hero--light p { font-size: 14px; color: var(--muted); margin-top: 6px; font-weight: 400; }

@media (max-width: 560px) {
  .hero.hero--light { padding: 20px 16px 4px; }
  .hero.hero--light h1 { font-size: 21px; }
}

/* ── Compact lesson header (homework.html + AWL / irregular reference pages) ──
   Mockup docs/ui/mockups/lesson-header-compact-v1.html A (Andie 29/11/2026):
   full trail left in the header (no kicker), title on one line + buttons right
   (#hw-act: Đáp án / Giao bài / Tải PDF), subtitle, then the full-width unit bar. */
.header--lesson { justify-content: flex-start; gap: 18px; }
.header--lesson .header-trail { justify-content: flex-start; flex: 1; font-size: 13px; letter-spacing: 0; text-transform: none; }
.header--lesson .header-trail__link { padding: 5px 6px; }
.header--lesson .header-trail__link.is-near { border-color: transparent; color: var(--mid); }
.header--lesson .header-trail__link.is-near:hover { border-color: var(--gold); }
.header-trail__cur { padding: 5px 6px; color: var(--mid); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hero.hero--lesson { padding: 18px 32px 0; }
.hero__row { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.hero.hero--lesson h1 { flex: 1 1 380px; min-width: 0; font-size: 24px; }
.hero--lesson .hero__num { min-width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
.hero__act { display: flex; gap: 8px; margin-left: auto; }
.hero__act:empty { display: none; }
.hero.hero--lesson p { font-size: 13.5px; margin-top: 4px; }
.hero--lesson .hero__row:has(.hero__num) + p { padding-left: 42px; }
.hero--lesson .un-step { flex: none; max-width: none; margin: 14px 0 0; padding: 8px 10px 8px 14px; background: var(--white); border: 1px solid var(--border); border-radius: 10px; }
.hero--lesson .un-dot { max-width: none; height: 10px; }
.un-sep { width: 1px; height: 22px; background: var(--border); flex: none; }
/* ‹ › stay on phones in the bar (the old pager hid them under 40rem). */
.hero--lesson .un-step .un-wide-flex { display: inline-flex; }
.hero--lesson + .homework-main { padding-top: 20px; }
/* Reference pages: header lines up with the centred .ref-main column. */
.hero.hero--lesson:has(+ .ref-main) { max-width: 1040px; margin: 0 auto; padding: 18px 28px 6px; }
@media (max-width: 560px) {
  .header--lesson { gap: 10px; }
  .header--lesson .header-trail { justify-content: flex-end; }
  .header--lesson .header-trail__link.is-near { border-color: var(--border); }
  .header-trail__cur { display: none; }
  .hero.hero--lesson { padding: 14px 16px 0; }
  .hero.hero--lesson:has(+ .ref-main) { padding: 14px 14px 4px; }
  .hero.hero--lesson h1 { flex-basis: 100%; font-size: 19px; }
  .hero--lesson .hero__num { min-width: 28px; height: 28px; font-size: 14px; }
  .hero--lesson .hero__row:has(.hero__num) + p { padding-left: 38px; }
  .hero--lesson h1:has(.hero__num) + .hero__act { margin-left: 38px; }
  .hero__act { margin-left: 0; }
  .hero--lesson .un-step { margin-top: 12px; padding: 6px 8px 6px 10px; gap: 8px; }
  .hero--lesson .un-sep { display: none; }
}

/* ── Skill colours ── one fixed hue per skill, used everywhere a skill is shown
   (student homework/practice lists, staff reports, charts, print reports).
   CVD-safe categorical set; report-print.css keeps a copy of the tokens for
   the print pages, and util.js skillColor() reads them for SVG charts.
   --sk = the hue (dots, bars, chart lines), --sk-ink = text/icons on a tint,
   --sk-soft = tinted background. Overall bands stay gold. */
:root {
  --sk-reading:       #2a78d6; --sk-reading-ink:       #1c5aa8; --sk-reading-soft:       #eaf2fc;
  --sk-listening:     #1baf7a; --sk-listening-ink:     #0f7a54; --sk-listening-soft:     #e6f7f0;
  --sk-writing:       #eb6834; --sk-writing-ink:       #b4441a; --sk-writing-soft:       #fdeee7;
  --sk-speaking:      #6250d6; --sk-speaking-ink:      #4636a8; --sk-speaking-soft:      #efedfb;
  --sk-grammar:       #e87ba4; --sk-grammar-ink:       #b23f6c; --sk-grammar-soft:       #fcedf3;
  --sk-vocabulary:    #eda100; --sk-vocabulary-ink:    #8a5d00; --sk-vocabulary-soft:    #fdf4dc;
  --sk-pronunciation: #008300; --sk-pronunciation-ink: #006400; --sk-pronunciation-soft: #e5f3e5;
}
.sk--reading       { --sk: var(--sk-reading);       --sk-ink: var(--sk-reading-ink);       --sk-soft: var(--sk-reading-soft); }
.sk--listening     { --sk: var(--sk-listening);     --sk-ink: var(--sk-listening-ink);     --sk-soft: var(--sk-listening-soft); }
.sk--writing       { --sk: var(--sk-writing);       --sk-ink: var(--sk-writing-ink);       --sk-soft: var(--sk-writing-soft); }
.sk--speaking      { --sk: var(--sk-speaking);      --sk-ink: var(--sk-speaking-ink);      --sk-soft: var(--sk-speaking-soft); }
.sk--grammar       { --sk: var(--sk-grammar);       --sk-ink: var(--sk-grammar-ink);       --sk-soft: var(--sk-grammar-soft); }
.sk--vocabulary    { --sk: var(--sk-vocabulary);    --sk-ink: var(--sk-vocabulary-ink);    --sk-soft: var(--sk-vocabulary-soft); }
.sk--pronunciation { --sk: var(--sk-pronunciation); --sk-ink: var(--sk-pronunciation-ink); --sk-soft: var(--sk-pronunciation-soft); }
/* Icon tile (homework sections, practice-test pills, profile chips): tint + coloured icon. */
.sk-ico { background: var(--sk-soft) !important; color: var(--sk-ink); }
.sk-ico svg { color: var(--sk-ink) !important; stroke: currentColor; }
/* Small label pill with a dot: "● Reading". */
.sk-tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 7px; border-radius: 999px; background: var(--sk-soft); border: 1px solid color-mix(in srgb, var(--sk) 35%, var(--white)); color: var(--sk-ink); font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.sk-tag::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--sk); }
/* Coloured skill name in table headers / labels, no pill. */
.sk-text { color: var(--sk-ink); }
.pt-skill-pill.sk--reading:hover, .pt-skill-pill.sk--listening:hover, .pt-skill-pill.sk--writing:hover, .pt-skill-pill.sk--speaking:hover { border-color: var(--sk); }

/* ── Brand logo (js/brand.js) in the sidebar, the rail, the phone top bar and the page header. ── */
.admin-sidebar-brand { font-size: 21px; }
.admin-brand-full { display: block; }
.admin-brand-short brand-logo { width: 26px; height: 26px; }
.admin-topbar .admin-sidebar-brand { font-size: 19px; }
.logo { font-size: 26px; }
@media (max-width: 560px) { .logo { font-size: 22px; } }

/* ── Staff answer key on Grammar/Vocabulary Practice units (teacher/admin only). ── */
.hw-key-panel { position: fixed; inset: 0; z-index: 400; }
.hw-key-panel__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, .28); }
.hw-key-panel__box { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%); display: flex; flex-direction: column; background: var(--white); box-shadow: var(--shadow-lg); animation: hw-key-in .18s ease; }
@keyframes hw-key-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.hw-key-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); background: var(--gold-light); }
.hw-key-panel__head strong { display: block; font-size: 17px; color: var(--text); }
.hw-key-panel__head span { display: block; margin-top: 3px; font-size: 12px; color: var(--gold-ink); }
.hw-key-panel__x { flex: none; width: 32px; height: 32px; border: 1.5px solid var(--gold); border-radius: 8px; background: var(--white); color: var(--mid); font-size: 20px; line-height: 1; cursor: pointer; }
.hw-key-panel__x:hover { border-color: var(--gold-dark); color: var(--text); }
.hw-key-panel__body { flex: 1; overflow-y: auto; padding: 8px 20px 28px; }
.hw-key-sec { padding: 16px 0 6px; border-bottom: 1px solid var(--border); }
.hw-key-sec:last-child { border-bottom: 0; }
.hw-key-sec h3 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.hw-key-sec__i { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hw-key-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hw-key-row { display: flex; gap: 10px; align-items: flex-start; }
.hw-key-row__n { flex: none; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--mid); display: inline-flex; align-items: center; justify-content: center; }
.hw-key-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hw-key-row__q { font-size: 13px; color: var(--mid); line-height: 1.45; }
.hw-key-row__a { align-self: flex-start; padding: 2px 9px; border-radius: 6px; background: var(--correct-bg); color: var(--correct-text); font-size: 13.5px; font-weight: 700; line-height: 1.45; }
.hw-key-row__a--open { background: var(--gold-light); color: var(--gold-ink); font-weight: 600; }
.hw-key-row__e { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.hw-key-row__e s { color: var(--wrong-text); } .hw-key-row__e strong { color: var(--correct-text); }
.user-edit__checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 6px; font-size: 14px; } .user-edit__checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* Theory between the exercises of a mixed worksheet (AIM7 tutorials) */
.hw-theory { margin: 0 0 24px; }
.hw-theory__title { margin: 8px 0 12px; font-size: 18px; font-weight: 700; }
.hw-theory__note { margin: 0 0 12px; font-size: 15px; line-height: 1.6; }
.hw-theory .hw-table-box { margin-bottom: 12px; }

/* Tutorial tabs: one exercise at a time */
.hw-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1.5px solid var(--border); scroll-margin-top: 80px; }
.hw-tabs__list { display: flex; flex-wrap: wrap; gap: 6px; }
.hw-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); color: var(--mid); font: inherit; font-size: 14px; font-weight: 700; text-transform: capitalize; cursor: pointer; }
.hw-tab:hover { border-color: var(--gold); background: var(--gold-light); }
.hw-tab.is-active { border-color: var(--gold); background: var(--gold); color: var(--black); }
.hw-tab__tick { font-size: 13px; }
.hw-tab__tick[hidden] { display: none; }
.hw-key-switch { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; cursor: pointer; }
.hw-tab-pane[hidden] { display: none; }
.hw-tab-nav { display: flex; justify-content: flex-end; gap: 10px; width: 100%; }
.hw-tab-prev { padding: 10px 18px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font: inherit; font-weight: 700; cursor: pointer; }
.hw-tab-prev:hover { border-color: var(--gold); background: var(--gold-light); }
.hw-key-val { display: none; }
.show-key .hw-key-val { display: inline-block; margin: 2px 0 2px 6px; padding: 1px 8px; border-radius: 6px; background: var(--gold-light); color: var(--gold-ink); font-size: 14px; font-weight: 700; }
.show-key .hw-key-val--block { display: block; margin: 0 0 14px; padding: 8px 12px; font-weight: 400; line-height: 1.6; }
.hw-tab-pane .speaking-upload-label { padding: 0; border: 0; background: none; color: var(--mid); font-size: 13px; font-weight: 400; text-decoration: underline; cursor: pointer; }
.hw-tab-pane .speaking-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hw-tab-pane .speaking-record-btn { min-height: 44px; padding: 0 22px; font-size: 15px; font-weight: 700; }
.hw-draft-note { margin: 0 0 14px; padding: 9px 13px; border-radius: 8px; background: var(--gold-light); color: var(--gold-ink); font-size: 14px; font-weight: 600; }
.hw-tab__draft { font-size: 12px; font-weight: 700; color: var(--gold-ink); }
.hw-tutor-fb { flex-basis: 100%; width: 100%; margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--gold); border-radius: 6px; background: var(--gold-light); font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }

/* Writing editor: js/doc-editor.js */
.doc-ed { min-height: 56px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.doc-ed:focus { border-color: var(--gold); outline: none; }
.doc-ed--readonly { background: var(--surface); }
.doc-ed p, .doc-ed div { margin: 0 0 6px; }
.doc-ed h1 { margin: 0 0 8px; font-size: 24px; }
.doc-ed h2 { margin: 0 0 8px; font-size: 20px; }
.doc-ed ins { color: var(--correct-text); text-decoration: underline; }
.doc-ed del { color: var(--bad-ink); text-decoration: line-through; }
.doc-ed [data-cid] { background: var(--gold-light); border-bottom: 2px solid var(--gold); }
.q-answer-row[hidden] { display: none; }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.doc-cards { display: flex; flex-direction: column; gap: 8px; }
.doc-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font-size: 13.5px; line-height: 1.5; }
.doc-card--note { border-color: transparent; background: var(--gold-light); }
.doc-card textarea { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; resize: vertical; }
.doc-card__x { align-self: flex-start; padding: 2px 0; border: 0; background: none; color: var(--mid); font: inherit; font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.doc-card__acts { display: flex; gap: 8px; }
.doc-card__acts button { flex: 1; min-height: 44px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font: inherit; font-weight: 700; cursor: pointer; }
.doc-card__acts button:first-child { border-color: var(--gold); background: var(--gold); color: var(--black); }
.doc-tb { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 14px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--white); box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.08)); font-size: 13.5px; }
.doc-tb__sep { width: 1px; height: 24px; margin: 0 3px; background: var(--border); }
.doc-tb select { height: 36px; padding: 0 6px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--white); font: inherit; }
.doc-tb__btn { min-width: 36px; height: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font: inherit; cursor: pointer; }
.doc-tb__btn:hover { background: var(--gold-light); }
.doc-tb__btn--comment { border: 1.5px solid var(--gold); background: var(--gold-light); font-weight: 700; }
.doc-tb__modes { display: inline-flex; gap: 2px; padding: 2px; border: 1.5px solid var(--border); border-radius: 8px; }
.doc-tb__modes button { height: 32px; padding: 0 11px; border: 0; border-radius: 6px; background: none; font: inherit; font-weight: 700; cursor: pointer; }
.doc-tb__modes button.is-active { background: var(--gold); color: var(--black); }
.doc-tb__color { position: relative; display: inline-flex; align-items: center; height: 36px; padding: 0 9px; border-radius: 6px; font-weight: 700; color: var(--bad-ink); text-decoration: underline; cursor: pointer; }
.doc-tb__color--hl { background: #FFE680; color: var(--text); text-decoration: none; font-weight: 600; }
.doc-tb__color input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.doc-tb--view > :not(.doc-tb__modes) { display: none; }
@media (max-width: 860px) { .doc-row { grid-template-columns: 1fr; } }

/* ── Dropdown arrow: the same chevron on every native <select>, on every page.
   !important because page rules set `background` / `padding` shorthands that would
   otherwise wipe it. .rs-pick (report editor) draws its own blue arrow. */
select:not([multiple]):not([size]):not(.rs-pick) {
  -webkit-appearance: none; appearance: none;
  padding-right: 26px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 8px center !important; background-size: 14px 14px !important;
}

/* ══ Grammar / Vocabulary Practice UI v1 (docs/ui/mockups/practice-ui-v1.html) ══ */

/* Line icons (HW_ICON in js/homework.js) */
.hw-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.hw-star { display: inline-flex; align-items: center; }

/* Summary header: collapse toggle + EN / EN+VI switch */
.hw-summary-box__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: var(--correct-bg); padding-right: 12px; }
.hw-summary-box__head .hw-summary-box__toggle { flex: 1 1 220px; width: auto; }
.hw-vi-switch, .hw-vv-switch { display: inline-flex; flex: none; margin: 6px 0 6px auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--white); }
.hw-vv-switch { margin: 6px 0; }
.hw-vi-switch button, .hw-vv-switch button {
  border: 0; background: var(--white); color: var(--muted); cursor: pointer;
  padding: 5px 11px; font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.hw-vi-switch button + button, .hw-vv-switch button + button { border-left: 1px solid var(--border); }
.hw-vi-switch button.is-on, .hw-vv-switch button.is-on { background: var(--gold-light); color: var(--gold-ink); }
body.hw-vi-off #hw-area [lang="vi"],
body.hw-vi-off .hw-drawer [lang="vi"] { display: none !important; }

/* Grammar theory: each group is a card; 2+ columns on wide screens */
.hw-gs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 14px; align-items: start; margin-bottom: 12px; }
.hw-gs-grid .hw-gs-group { margin: 0; }
.hw-gs-card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; overflow-wrap: break-word; }
.hw-gs-card .hw-gs-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: 16.5px; }
.hw-gs-heading__n {
  display: inline-flex; align-items: center; justify-content: center; align-self: center;
  width: 22px; height: 22px; border-radius: 6px; background: var(--gold); color: var(--black);
  font-size: 12px; font-weight: 800; flex: none;
}
.hw-gs-card img, .hw-drawer img { max-width: 100%; height: auto; }
.hw-gs-card .hw-table-scroll, .hw-drawer .hw-table-scroll { max-width: 100%; overflow-x: auto; }

/* Revealed answer: explanation with a label; folded for right answers */
.hw-explain__label {
  display: inline-block; margin-right: 6px; font-size: 12px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.hw-explain strong { color: var(--correct-text); }
.hw-explain s { color: var(--wrong-text); }
details.hw-explain--fold { display: inline-block; vertical-align: middle; margin: 0 0 0 8px; max-width: 100%; }
details.hw-explain--fold summary {
  cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 700; color: var(--muted);
  padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--white);
}
details.hw-explain--fold summary::-webkit-details-marker { display: none; }
details.hw-explain--fold summary::before { content: "+ "; }
details.hw-explain--fold[open] { display: block; margin: 6px 0 0; }
details.hw-explain--fold[open] summary { display: inline-block; margin-bottom: 4px; }
details.hw-explain--fold[open] summary::before { content: "– "; }
.hw-more-answers {
  margin-left: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: underline dotted;
}
.hw-more-answers:hover { color: var(--text); }

/* Two-step check */
.q-mark .label-retry { color: var(--wrong-text); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.hw-fixed { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hw-exercise .question-block.is-blank:not(.cloze-blank) { border-left-color: var(--warn-border); }
.question-block.is-blank .q-input:not([type="hidden"]),
.question-block.is-blank .exam-heading-dropzone { border-color: var(--warn-border) !important; background: var(--warn-bg) !important; }
.exam-multi-block.is-blank { outline: 2px solid var(--warn-border); outline-offset: 2px; border-radius: 8px; }
.hw-blank-warn {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; width: 100%;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
  border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600;
}
.hw-blank-warn span { margin-right: auto; }
.hw-blank-warn .next-btn { padding: 6px 14px; }
.hw-submit-bar:has(.hw-blank-warn) { flex-wrap: wrap; gap: 10px; }

/* Exercise nav: chip colour = first-check result, gold line = progress */
.hw-exercise-nav__chip { position: relative; }
.hw-exercise-nav__chip.is-perfect { background: var(--correct-bg); border-color: var(--correct-border); color: var(--correct-text); }
.hw-exercise-nav__chip.is-good    { background: var(--warn-bg);    border-color: var(--warn-border);    color: var(--warn-text); }
.hw-exercise-nav__chip.is-low     { background: var(--wrong-bg);   border-color: var(--wrong-border);   color: var(--wrong-text); }
.hw-exercise-nav__chip.is-perfect::before { content: "✓"; margin-right: 3px; font-size: 12px; }
.hw-exercise-nav__chip.is-current { box-shadow: 0 0 0 2px var(--gold); }
.hw-exercise-nav__chip.has-progress::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-dark) var(--p, 0%), var(--border) var(--p, 0%));
}
.hw-exercise-nav__sum { flex-shrink: 0; margin-left: auto; padding-left: 8px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.hw-exercise-nav__theory {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.hw-exercise-nav__theory:hover { border-color: var(--gold-dark); }
@media (max-width: 560px) {
  .hw-exercise-nav__sum { display: none; }
  .hw-exercise-nav__theory { margin-left: auto; }
  .hw-exercise-nav__theory span { display: none; }
}

/* Theory drawer (right panel; bottom sheet on phones) */
.hw-drawer-wrap { position: fixed; inset: 0; z-index: 1000; }
.hw-drawer-wrap[hidden] { display: none; }
.hw-drawer-scrim { position: absolute; inset: 0; background: rgba(15, 15, 15, 0.35); }
.hw-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  display: flex; flex-direction: column; background: var(--white);
  box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
}
.hw-drawer__head {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 8px 10px; flex: none;
  padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); background: var(--white);
}
.hw-drawer__title { flex: 1 1 0; min-width: 0; font-weight: 800; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-drawer__close {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); cursor: pointer;
}
.hw-drawer__close:hover { border-color: var(--gold-dark); }
.hw-drawer__body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px 16px 24px; overflow-wrap: break-word; }
.hw-summary-box--drawer { border: 0; border-radius: 0; margin: 0; overflow: visible; }
.hw-summary-box--drawer .hw-summary-box__body { padding: 0; }
.hw-summary-box--drawer .hw-gs-grid { grid-template-columns: minmax(0, 1fr); }
.hw-summary-box--drawer .hw-vocab-tab__label { white-space: normal; }
body.hw-drawer-open { overflow: hidden; }
@media (max-width: 560px) {
  .hw-drawer { top: auto; left: 0; width: 100%; height: 85vh; border-left: 0; border-radius: 16px 16px 0 0; }
}

/* End of the set */
.hw-practice-end { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px; width: 100%; }
.hw-practice-end__big { font-size: 26px; font-weight: 800; color: var(--text); }
.hw-practice-end__pct { margin-left: 6px; font-size: 15px; font-weight: 700; color: var(--muted); }
.hw-practice-end__sub { font-size: 13px; color: var(--muted); }
.hw-practice-end__bars { display: flex; align-items: flex-end; gap: 4px; height: 36px; }
.hw-practice-end__bars i { width: 14px; border-radius: 3px; }
.hw-practice-end__bars i.is-perfect { background: var(--correct-border); }
.hw-practice-end__bars i.is-good    { background: var(--warn-border); }
.hw-practice-end__bars i.is-low     { background: var(--wrong-border); }
.hw-practice-end__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 560px) { .hw-practice-end__actions { margin-left: 0; width: 100%; } }

/* "Làm lại câu sai" banner */
.hw-review-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 16px;
  padding: 10px 14px; border: 1px solid var(--warn-border); border-radius: 12px; background: var(--warn-bg); color: var(--warn-text); font-size: 14px;
}
.hw-review-banner .next-btn { margin-left: auto; padding: 6px 14px; }

/* iPhone zooms the page in when a field with text < 16px gets focus, and stays
   zoomed. Touch phones/tablets: every typing field gets 16px (2026-11-11). */
@media (max-width: 860px) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { font-size: 16px !important; }
}

/* ── Tooltip: one look app-wide (js/util.js, data-tip; mockup docs/ui/mockups/tooltips-v1.html) ── */
.ui-tip { position: fixed; z-index: 1000; max-width: 280px; padding: 7px 11px; text-align: left; pointer-events: none;
  background: var(--white); color: var(--text, #1F1F1B); border: 1px solid var(--border, #E4E2DA); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.10); font: 400 12.5px/1.5 Arial, Helvetica, sans-serif; }
.ui-tip[hidden] { display: none; }
.ui-tip::before { content: ''; position: absolute; left: var(--ax, 14px); top: -6px; width: 10px; height: 10px; background: var(--white);
  border-left: 1px solid var(--border, #E4E2DA); border-top: 1px solid var(--border, #E4E2DA); transform: rotate(45deg); }
.ui-tip.is-above::before { top: auto; bottom: -6px; transform: rotate(225deg); }
.ui-tip--note { border-left: 3px solid var(--gold-dark, #C9A000); }
.ui-tip__h { margin-bottom: 3px; font-size: 12px; font-weight: 700; color: var(--muted, #6B6B63); }
.ui-tip__t { white-space: pre-wrap; overflow-wrap: anywhere; }
.ui-tip__f { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--gold-dark, #C9A000); }

/* ── Toast (UI.toast in js/util.js): light, never dark. Bottom-centre, stacked; tone = ok (default) / warn / bad ── */
.ui-toasts { position: fixed; left: 50%; bottom: 24px; z-index: 1100; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.ui-toast { display: inline-flex; align-items: center; gap: 8px; max-width: min(460px, calc(100vw - 32px)); padding: 10px 16px; border: 1px solid var(--border); border-left: 4px solid var(--ok, #1B7A3A); border-radius: 8px;
  background: var(--white); color: var(--text); font: 400 13px/1.45 Arial, Helvetica, sans-serif; box-shadow: 0 6px 20px rgba(0,0,0,.10); pointer-events: auto; transition: opacity .3s, transform .3s; }
.ui-toast--warn { border-left-color: var(--gold-dark); }
.ui-toast--bad { border-left-color: var(--bad, #E5121C); }
.ui-toast.is-out { opacity: 0; transform: translateY(6px); }

/* ── Dialog: <dialog class="ui-dialog"><div class="ui-dialog__head">…</div><div class="ui-dialog__body">…</div><div class="ui-dialog__foot">buttons</div></dialog>
   UI.confirm / UI.alert (js/util.js) build one of these. Drawer = the same on the right edge: <dialog class="ui-dialog ui-drawer">. ── */
.ui-dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; padding: 0; border: 0; border-radius: var(--r-lg, 12px);
  background: var(--white); color: var(--text); box-shadow: var(--shadow-lg); font: 400 var(--fs-md, 14px)/1.5 Arial, Helvetica, sans-serif; overflow: auto; }
.ui-dialog::backdrop { background: var(--backdrop, rgba(17,24,39,.35)); }
.ui-dialog--wide { width: min(760px, calc(100vw - 32px)); }
.ui-dialog__ack { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); cursor: pointer; }
.ui-dialog__ack input { margin: 2px 0 0; flex: none; }
.ui-dialog__type { margin-top: 12px; color: var(--text); }
.ui-dialog__type b { padding: 1px 6px; border-radius: 4px; background: var(--surface); font-family: ui-monospace, Menlo, monospace; }
.ui-dialog__type input { display: block; width: 100%; margin-top: 6px; }
.ui-dialog__head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px 4px; }
.ui-dialog__title { margin: 0; font-size: var(--fs-lg, 16px); font-weight: 700; }
.ui-dialog__x { margin: -4px -8px 0 auto; }
.ui-dialog__body { padding: 4px 20px 4px; color: var(--text-2, #3F3F3B); white-space: pre-line; }
.ui-dialog__body:empty { display: none; }
.ui-dialog__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 20px; }
/* Foot buttons carry .ui-btn; repeated here because ~30 learner pages do not load ui.css */
.ui-dialog__foot > button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); color: var(--text); font: 700 13px Arial, Helvetica, sans-serif; cursor: pointer; }
.ui-dialog__foot > button:hover { border-color: var(--gold); background: var(--gold-light); }
.ui-dialog__foot > button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold-light); border-color: var(--gold-dark); }
.ui-dialog__foot > .ui-btn--primary { background: var(--gold); border-color: var(--gold-dark); color: var(--black); }
.ui-dialog__foot > .ui-btn--primary:hover { background: var(--gold-dark); }
.ui-dialog__foot .ui-btn--danger.is-strong:hover { background: #C40F18; border-color: #C40F18; }
.ui-dialog__in { box-sizing: border-box; min-height: 36px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; font: 400 14px Arial, Helvetica, sans-serif; }
.ui-dialog__in:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px var(--gold-light); }
.ui-dialog__foot .ui-btn--danger.is-strong { background: var(--bad, #E5121C); border-color: var(--bad, #E5121C); color: var(--white); }
.ui-dialog__in { width: 100%; margin-top: 10px; } /* sizing above */
.ui-drawer { width: min(560px, 100vw); height: 100vh; max-height: none; margin: 0 0 0 auto; border-radius: 0; border-left: 1px solid var(--border); }

/* Shared line icon (UI.icon) — base repeated from ui.css for pages that do not load it */
svg.ui-ico { width: 16px; height: 16px; flex: none; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.ui-ico.is-fill { fill: currentColor; }   /* filled star (rating, suggestion) */
/* Inline icon inside a line of text / a status dot (was ✓ ✗ ⚠ ★ text) */
:is(.label-correct, .label-wrong, .rep-sent-at, .hs-added, .xp-status, .xp-legend, .rp-cmt__p, .rv-note, .sh-stars, .ui-tip) svg.ui-ico, :is(.pr-status__dot, .rs-step__dot, .rs-check__dot) > svg.ui-ico { width: 14px; height: 14px; vertical-align: -2px; }
/* Warning / check icon leading a sentence (was ⚠ / ✓ text) */
:is(.tc-pop__hol, .pg-outdated span, .pg-sum__stale, .pg-outdated-tag, .cf-warn li, .lv-lpstatus) > svg.ui-ico:first-child { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }

/* ── Practice after a course ends (js/after-course.js, mockup course-practice-after-end-v1 §B–D) ──
   Worksheet + quiz (style.css only) and the homework list of an ended course (topics.html). */
.pa-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-soft); color: var(--info-text); font-size: 14px; text-align: left; }
.pa-banner b { color: inherit; }
.quiz-main > .pa-banner { margin-bottom: 12px; }
.hw-submit-bar.pa-bar-done { display: block; }
.pa-panel { text-align: left; }
.result .pa-panel { margin-top: 18px; }
.pa-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pa-res > div { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--white); }
.pa-res .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pa-res .v { font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.pa-res .s { font-size: 12px; color: var(--muted); }
.pa-res .is-off { background: var(--surface); }
.pa-res .is-now { border-color: var(--gold-dark); background: var(--gold-light); }
.pa-hist { margin-top: 12px; font-size: 13px; color: var(--muted); }
.pa-hist span { display: inline-block; margin-right: 12px; }
.pa-acts { justify-content: flex-start; margin-top: 14px; }
.pa-cap { display: block; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.hw-submit-bar .pa-cap { margin: 0 auto 0 0; padding-right: 12px; }
.speaking-controls .pa-ai-q { margin: 0; }
.pa-up { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--correct-text); }
.pa-dn { margin-left: 4px; font-size: 12px; font-weight: 700; color: var(--wrong-text); }
.pa-note { margin-bottom: 14px; }
.pa-seg { margin-bottom: 10px; }
.pa-list th, .pa-list td { white-space: nowrap; vertical-align: middle; }
.pa-list td.t { white-space: normal; min-width: 220px; }
.pa-list td.t small { display: block; color: var(--muted); font-size: 12px; }
.pa-num { font-variant-numeric: tabular-nums; }
.pa-sub { display: block; font-size: 12px; color: var(--muted); }
.pa-wk { color: var(--muted); font-size: 13px; }
@media (max-width: 860px) { .pa-res { grid-template-columns: 1fr; } }


/* Writing câu: the teacher's grading on the homework page (js/hw-teacher-review.js, mockup hw-sentence-grading-v1 § E) */
.hw-gv { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--gold); border-radius: 10px; background: var(--gold-light); font-size: 14px; }
.hw-gv__h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.hw-gv__by { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.hw-gv__txt { margin-top: 4px; white-space: pre-line; }
.hw-gv-wait { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.hw-gv-note { margin-top: 6px; padding: 5px 8px; border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; background: var(--gold-light); font-size: 13px; }
