/* ============================================================
   BESSS — Business English for Semiconductor Equipment Suppliers
   Design system: dark navy (#1A3A5C) / mid blue (#2E75B6)
   ============================================================ */

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

:root {
  --navy:       #1A3A5C;
  --navy-dark:  #0F2238;
  --navy-mid:   #224870;
  --blue:       #2E75B6;
  --blue-light: #4A90D4;
  --blue-pale:  #E8F1FA;
  --accent:     #F0A500;
  --text:       #1C2B3A;
  --text-mid:   #4A5E72;
  --text-light: #7A8FA3;
  --border:     #D0DCE8;
  --bg:         #F5F8FC;
  --white:      #FFFFFF;
  --success:    #2A7A4B;
  --success-bg: #EAF5EE;
  --error:      #B03030;
  --error-bg:   #FBEAEA;
  --sidebar-w:  280px;
  --header-h:   56px;
  --radius:     6px;
  --radius-lg:  10px;
  font-size: 16px;
}

html, body {
  height: 100%;
  font-family: 'Source Serif 4', Georgia, serif;
  color: var(--text);
  background: var(--bg);
}

/* --- Layout --- */
#app { display: flex; height: 100vh; overflow: hidden; }

/* --- Sidebar --- */
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-mid) var(--navy);
}

#sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--navy-mid);
  flex-shrink: 0;
}

#sidebar-header .title {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

#sidebar-header .subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.4;
}

/* Volume tabs */
#vol-tabs {
  display: flex;
  border-bottom: 1px solid var(--navy-mid);
  flex-shrink: 0;
}

.vol-tab {
  flex: 1;
  padding: 10px 4px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.vol-tab:hover { color: rgba(255,255,255,0.75); }
.vol-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Nav sections */
.nav-section { border-bottom: 1px solid var(--navy-mid); }

.nav-section-header {
  width: 100%;
  background: none;
  border: none;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  transition: background 0.15s;
}
.nav-section-header:hover { background: rgba(255,255,255,0.05); }

.nav-chevron {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.2s;
}
.nav-section-header[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }

.nav-items { display: none; }
.nav-items.open { display: block; }

.nav-item {
  width: 100%;
  background: none;
  border: none;
  padding: 7px 18px 7px 28px;
  text-align: left;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 12.5px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  display: block;
  line-height: 1.35;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: rgba(46,117,182,0.35);
  color: #fff;
  border-left: 3px solid var(--blue-light);
  padding-left: 25px;
}

/* --- Main content area --- */
#main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Volume header bar */
#vol-header {
  background: var(--navy-dark);
  color: white;
  padding: 14px 40px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

#vol-header .vol-badge {
  background: var(--blue);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

/* Panel container */
#panels { flex: 1; padding: 36px 40px 60px; max-width: 860px; }

.panel { display: none; }
.panel.active { display: block; }

/* --- Welcome panel --- */
.welcome-hero {
  background: var(--navy);
  color: white;
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  margin-bottom: 28px;
}
.welcome-hero h1 {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 10px;
  line-height: 1.3;
}
.welcome-hero p {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  max-width: 560px;
}

.vol-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.vol-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.vol-card:hover { border-color: var(--blue); box-shadow: 0 2px 12px rgba(46,117,182,0.12); }

.vol-card .num {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 6px;
}
.vol-card h3 { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.vol-card p { font-size: 13px; color: var(--text-mid); line-height: 1.5; }

/* --- Typography --- */
h1, h2, h3 { font-family: 'Source Serif 4', Georgia, serif; }
h2 { font-size: 22px; font-weight: 600; color: var(--navy); margin-bottom: 20px; line-height: 1.25; }
h3 { font-size: 17px; font-weight: 600; color: var(--navy); margin-bottom: 12px; }

p { line-height: 1.75; margin-bottom: 14px; font-size: 15px; }
p:last-child { margin-bottom: 0; }

/* --- Glossary cards --- */
.glossary-search {
  margin-bottom: 24px;
}
.glossary-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
.glossary-search input:focus { outline: none; border-color: var(--blue); }

.glossary-group { margin-bottom: 32px; }
.glossary-group-label {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.term-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
}

.term-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.12s;
}
.term-header:hover { background: var(--blue-pale); }

.term-title {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--navy);
}
.term-num {
  font-size: 11px;
  color: var(--text-light);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  margin-right: 10px;
}
.term-chevron { font-size: 11px; color: var(--text-light); transition: transform 0.2s; }
.term-card.open .term-chevron { transform: rotate(180deg); }

.term-body { display: none; padding: 0 18px 18px; }
.term-card.open .term-body { display: block; }

.term-def {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 14px;
  padding-top: 4px;
}

.term-example {
  background: var(--blue-pale);
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  font-style: italic;
  color: #2C5280;
  margin-bottom: 14px;
  line-height: 1.7;
}

.term-tips {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  color: #5C4A00;
  background: #FFF8EC;
  border: 1px solid #F0D88A;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  line-height: 1.65;
}
.term-tips strong { color: #3A2F00; font-weight: 700; }

.collocations-label {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 8px;
}

.collocation {
  margin-bottom: 12px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  line-height: 1.7;
}
.collocation .phrase {
  display: inline-block;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--white);
  background: var(--blue);
  padding: 1px 7px;
  border-radius: 3px;
  margin-bottom: 4px;
  margin-right: 4px;
  letter-spacing: 0.01em;
}

/* --- Situation panels --- */
.pretask-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.pretask-box h3 { margin-bottom: 16px; }

.focus-item { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.focus-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.focus-term {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  background: var(--navy);
  display: inline-block;
  padding: 2px 9px;
  border-radius: 3px;
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.focus-note {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.7;
}

.register-alert {
  background: #FFF8EC;
  border: 1px solid #F0D88A;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}
.register-alert strong { display: block; color: var(--accent); font-family: 'IBM Plex Sans', sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }

.email-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.email-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.7;
}
.email-header strong { color: var(--text); }
.email-body { padding: 20px 24px; font-size: 14.5px; line-height: 1.8; }
.email-body p { margin-bottom: 12px; }
.email-body strong {
  font-weight: 600;
  color: var(--navy);
  background: rgba(46,117,182,0.10);
  padding: 1px 4px;
  border-radius: 3px;
  font-style: normal;
}

.register-notes {
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
  font-size: 13.5px;
  line-height: 1.7;
}
.register-notes h4 {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.register-notes ul { list-style: none; }
.register-notes li { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.register-notes li:last-child { border-bottom: none; }
.register-notes li::before { content: '—'; margin-right: 8px; color: var(--blue-light); }

.dialogue {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.dialogue h3 { margin-bottom: 6px; }
.dialogue-context {
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-mid);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.dialogue-turn { margin-bottom: 16px; }
.dialogue-turn:last-child { margin-bottom: 0; }
.speaker {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  margin-bottom: 3px;
}
.speaker.kyowa { color: var(--navy); }
.line {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text);
}

/* Audio placeholder */
.audio-placeholder {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-light);
}
.audio-placeholder audio { flex: 1; height: 32px; }
.audio-placeholder .audio-label { white-space: nowrap; }

/* Section divider */
.section-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 32px 0;
}

/* --- Exercise blocks --- */
.exercise-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.exercise-header {
  background: var(--navy-dark);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.exercise-header .ex-label {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.exercise-header .ex-title {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: white;
}
.exercise-body { padding: 24px; }
.exercise-instruction {
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 20px;
  line-height: 1.6;
  font-style: italic;
}

/* Gap fill */
.gap-fill-text {
  font-size: 15px;
  line-height: 2.2;
  margin-bottom: 20px;
}
.gap {
  display: inline-block;
  min-width: 160px;
  border-bottom: 2px solid var(--blue);
  margin: 0 4px;
  vertical-align: bottom;
  position: relative;
}
.gap input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px;
  width: 100%;
  color: var(--navy);
  padding: 2px 4px;
}
.gap.correct { border-bottom-color: var(--success); }
.gap.incorrect { border-bottom-color: var(--error); }
.gap-note {
  display: none;
  font-size: 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  padding: 3px 6px;
  border-radius: 4px;
  margin-top: 2px;
  position: absolute;
  left: 0;
  top: 100%;
  white-space: nowrap;
  z-index: 10;
}
.gap.correct .gap-note { display: block; background: var(--success-bg); color: var(--success); }
.gap.incorrect .gap-note { display: block; background: var(--error-bg); color: var(--error); }

/* Quiz */
.quiz-question { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.quiz-question:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.quiz-q {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.12s, background 0.12s;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
}
.quiz-option:hover:not(.answered) { border-color: var(--blue); background: var(--blue-pale); }
.quiz-option .opt-letter {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-light);
  flex-shrink: 0;
  padding-top: 1px;
}
.quiz-option.correct { border-color: var(--success); background: var(--success-bg); }
.quiz-option.correct .opt-letter { color: var(--success); }
.quiz-option.incorrect { border-color: var(--error); background: var(--error-bg); }
.quiz-option.incorrect .opt-letter { color: var(--error); }
.quiz-feedback {
  font-size: 13px;
  font-style: italic;
  margin-top: 6px;
  display: none;
  color: var(--text-mid);
}
.quiz-option.correct .quiz-feedback,
.quiz-option.incorrect .quiz-feedback { display: block; }

/* Word bank */
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.wb-chip {
  background: white;
  border: 1px solid var(--blue);
  color: var(--navy);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: grab;
  user-select: none;
  transition: background 0.12s;
}
.wb-chip:hover { background: var(--blue-pale); }
.wb-chip.used { opacity: 0.35; cursor: default; }

/* Sequencing */
.seq-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.seq-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: grab;
  transition: border-color 0.12s, box-shadow 0.12s;
  font-size: 14px;
  line-height: 1.6;
}
.seq-item:hover { border-color: var(--blue); }
.seq-item.dragging { opacity: 0.4; }
.seq-item.over { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(46,117,182,0.2); }
.seq-handle {
  font-size: 16px;
  color: var(--text-light);
  flex-shrink: 0;
  padding-top: 1px;
  cursor: grab;
}
.seq-speaker {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  margin-bottom: 3px;
  flex-shrink: 0;
  width: 52px;
}
.seq-text { flex: 1; }
.seq-item.correct { border-color: var(--success); background: var(--success-bg); }
.seq-item.incorrect { border-color: var(--error); background: var(--error-bg); }

/* Matching */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.match-phrases { display: flex; flex-direction: column; gap: 8px; }
.match-functions { display: flex; flex-direction: column; gap: 8px; }
.match-phrase {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  font-style: italic;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.match-phrase:hover:not(.matched) { border-color: var(--blue); background: var(--blue-pale); }
.match-phrase.selected { border-color: var(--blue); background: var(--blue-pale); }
.match-phrase.correct { border-color: var(--success); background: var(--success-bg); }
.match-phrase.incorrect { border-color: var(--error); background: var(--error-bg); }
.match-fn {
  background: var(--navy);
  color: white;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  gap: 10px;
  align-items: center;
}
.match-fn:hover:not(.matched) { background: var(--navy-mid); }
.match-fn .fn-letter {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
}
.match-fn.matched { opacity: 0.5; }
.match-note {
  display: none;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-mid);
  margin-top: 6px;
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius);
}
.match-phrase.correct .match-note { display: block; }

/* Error correction */
.error-email {
  font-size: 14.5px;
  line-height: 1.9;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.err-select {
  border: none;
  border-bottom: 2px solid var(--error);
  background: var(--error-bg);
  color: var(--error);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  margin: 0 3px;
  max-width: 300px;
}
.err-select.correct { border-bottom-color: var(--success); background: var(--success-bg); color: var(--success); }

/* Rewrite task */
.rewrite-weak {
  background: var(--error-bg);
  border: 1px solid #E0AEAE;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.8;
}
.rewrite-weak h4 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--error);
  margin-bottom: 10px;
}
.rewrite-area {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  line-height: 1.75;
  resize: vertical;
  color: var(--text);
  margin-bottom: 14px;
}
.rewrite-area:focus { outline: none; border-color: var(--blue); }
.model-answer { display: none; }
.model-answer.shown { display: block; }
.model-answer-content {
  background: var(--success-bg);
  border: 1px solid #A8D5B8;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.8;
}
.model-answer-content h4 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success);
  margin-bottom: 10px;
}
.annotation-list { margin-top: 16px; }
.annotation {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  margin-bottom: 8px;
  line-height: 1.55;
}
.annotation-num {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 700;
  color: var(--success);
  flex-shrink: 0;
  width: 20px;
}

/* Scenario */
.scenario-text {
  background: var(--blue-pale);
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 14.5px;
  line-height: 1.75;
  margin-bottom: 20px;
  font-style: italic;
}
.scenario-options { display: flex; flex-direction: column; gap: 10px; }
.scenario-option {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.scenario-option:hover:not(.answered) { border-color: var(--blue); background: var(--blue-pale); }
.scenario-option .opt-head {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.scenario-option .opt-body { font-size: 14px; line-height: 1.65; font-style: italic; }
.scenario-option .opt-rationale {
  display: none;
  margin-top: 10px;
  font-size: 13px;
  font-style: normal;
  color: var(--text-mid);
  line-height: 1.6;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.scenario-option.correct { border-color: var(--success); background: var(--success-bg); }
.scenario-option.correct .opt-head { color: var(--success); }
.scenario-option.incorrect { border-color: var(--error); background: var(--error-bg); }
.scenario-option.incorrect .opt-head { color: var(--error); }
.scenario-option.correct .opt-rationale,
.scenario-option.incorrect .opt-rationale { display: block; }

/* Functional language (Vol III) */
.function-section { margin-bottom: 28px; }
.function-section h3 { margin-bottom: 14px; }
.phrase-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  padding: 14px 18px;
}
.phrase-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 6px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.phrase-note { font-size: 13.5px; color: var(--text-mid); line-height: 1.6; }

.cultural-note {
  background: var(--navy);
  color: rgba(255,255,255,0.8);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.75;
}
.cultural-note strong {
  display: block;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 700;
}

/* Buttons */
.btn {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: none;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-light); }
.btn-secondary { background: var(--bg); color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--blue); }
.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* Score display — handled by append block below */

/* Highlighted term links */
.term-link {
  color: var(--blue);
  border-bottom: 1px dashed var(--blue);
  cursor: pointer;
  text-decoration: none;
}
.term-link:hover { color: var(--navy); border-bottom-style: solid; }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  #panels { padding: 24px 20px 48px; }
  .vol-cards { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: 1fr; }
}

/* Quoted phrases inside register notes */
.register-notes li em,
.register-notes em {
  font-style: normal;
  color: #A8D0F0;
  font-weight: 600;
}

/* Strong phrases inside dialogue lines */
.line strong {
  color: var(--blue-light);
  font-weight: 600;
  background: rgba(74,144,212,0.12);
  padding: 1px 3px;
  border-radius: 2px;
}

/* Score display improvement */
.score-display {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
}
.score-display.shown { display: block; }
.score-display.pass { background: var(--success-bg); color: var(--success); border: 1px solid #A8D5B8; }
.score-display.fail { background: #FFF3CD; color: #7A5500; border: 1px solid #F0D080; }

/* Error correction — weak phrase display */
.err-weak {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14.5px;
  color: var(--error);
  text-decoration: line-through;
  text-decoration-color: var(--error);
  background: var(--error-bg);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ===== AI Practice Tools (sidebar section) ===== */
#nav-tools {
  margin-top: 18px;
  padding: 14px 0 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.nav-tools-label {
  padding: 0 18px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
a.nav-tool-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 18px;
  text-decoration: none;
}
.tool-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy-dark);
  background: var(--accent);
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 12px;
}

/* ===== Collapsible sidebar (toggle everywhere) ===== */
#sidebar {
  transition: width 0.22s ease, min-width 0.22s ease;
}
#sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}
#sidebar-toggle {
  position: fixed;
  top: 12px;
  left: calc(var(--sidebar-w) - 19px);
  z-index: 50;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius, 6px);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: background 0.15s ease, left 0.22s ease;
}
/* When sidebar is collapsed, park the toggle at the left screen edge */
#sidebar-toggle.collapsed {
  left: 12px;
}
#sidebar-toggle:hover { background: var(--navy-mid, #1b3a5c); }
/* Keep panel content clear of the fixed toggle button */
#panels { scroll-padding-top: 56px; }
@media (max-width: 768px) {
  /* Closed by default on small screens for a clean mobile view */
  #panels { padding-top: 60px; }
}

/* ===== Landing page walkthrough video ===== */
.welcome-video {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border, #e2e2e2);
}
.welcome-video h2 {
  margin: 0 0 4px;
}
.welcome-video p {
  margin: 0 0 16px;
  color: var(--text-muted, #555);
}
.welcome-video video {
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: var(--radius, 6px);
  background: #000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  display: block;
}

/* --- Listening dialogue reveal toggle --- */
.dialogue-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.dialogue-toggle {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  background: var(--blue-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  transition: background .15s;
}
.dialogue-toggle:hover { background: #dcebf8; }
.dialogue-toggle[aria-expanded="true"] { background: var(--navy); color: var(--white); border-color: var(--navy); }
.dialogue-toggle-hint {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 12.5px;
  color: var(--text-light);
}
