/* ============================================================
   CAPPUCCINO — Universal Lesson CSS
   Covers two lesson types:
     • article  — linear scroll (h2/h3 headings)
     • tabbed   — Claude-generated tabbed layouts
   Strips Claude's own <style> block at render time and
   redefines everything here in neobrutalist style.
   ============================================================ */

/* ── Claude CSS Variable Bridge ─────────────────────────────
   Defines the tokens Claude's output uses so inline styles
   that reference var(--color-*) still resolve correctly,
   but in our palette.
   ─────────────────────────────────────────────────────────── */
:root {
  --color-background-primary:    #FAFAFA;
  --color-background-secondary:  #F2F0E8;
  --color-background-tertiary:   #E8E5DC;
  --color-text-primary:          #0A0A0A;
  --color-text-secondary:        #3A3A3A;
  --color-text-tertiary:         #777777;
  --color-border-primary:        #0A0A0A;
  --color-border-secondary:      #BBBBBB;
  --color-border-tertiary:       #E0DDD5;
  --border-radius-sm:            2px;
  --border-radius-md:            3px;
  --border-radius-lg:            4px;
  --font-sans:                   'Inter', system-ui, sans-serif;
}

/* ── Lesson Page Shell ───────────────────────────────────── */
.lesson-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--gap);
  display: grid;
  grid-template-columns: 250px 1fr 210px;
  gap: var(--gap);
  align-items: start;
}

/* ── Sidebar TOC ─────────────────────────────────────────── */
.lesson-sidebar {
  position: sticky;
  top: 72px;
}

.toc-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toc-header {
  background: var(--black);
  color: var(--white);
  padding: 11px 16px;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.toc-list { list-style: none; padding: 6px 0; }

.toc-list li a {
  display: block;
  padding: 7px 16px;
  font-size: 0.81rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.08s, border-color 0.08s;
  line-height: 1.3;
}
.toc-list li a:hover  { background: var(--off); border-left-color: #aaa; }
.toc-list li a.active { background: var(--off); border-left-color: var(--black); font-weight: 700; }

/* Tabbed sidebar: tab buttons act as nav */
.toc-list li button.toc-tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.81rem;
  font-weight: 500;
  border: none;
  border-left: 3px solid transparent;
  background: none;
  cursor: pointer;
  transition: background 0.08s, border-color 0.08s;
  line-height: 1.3;
}
.toc-list li button.toc-tab-btn:hover  { background: var(--off); border-left-color: #aaa; }
.toc-list li button.toc-tab-btn.active { background: var(--off); border-left-color: var(--black); font-weight: 700; }

.toc-progress-wrap {
  padding: 12px 16px;
  border-top: 1.5px solid #e0ddd5;
}
.toc-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-head);
  margin-bottom: 6px;
}
.toc-progress-bar {
  height: 7px;
  background: #e0ddd5;
  border: 1.5px solid var(--black);
  border-radius: 999px;
  overflow: hidden;
}
.toc-progress-fill {
  height: 100%;
  background: var(--black);
  border-radius: 999px;
  transition: width 0.35s;
}

/* ── Right Rail ──────────────────────────────────────────── */
.lesson-rail {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.rail-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.rail-card h4 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  opacity: 0.45;
  margin-bottom: 10px;
}

.key-terms { list-style: none; }
.key-terms li {
  font-size: 0.82rem;
  padding: 5px 0;
  border-bottom: 1px solid #e0ddd5;
  display: flex;
  gap: 6px;
}
.key-terms li::before { content: '→'; font-weight: 800; flex-shrink: 0; }
.key-terms li:last-child { border-bottom: none; }

.next-lesson-card {
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  display: block;
}
.next-lesson-card:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.next-lesson-card:active { transform: translate(1px,1px);   box-shadow: var(--shadow-sm); }
.next-lesson-card .nl-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.55; margin-bottom: 5px; }
.next-lesson-card .nl-title { font-family: var(--font-head); font-weight: 800; font-size: 0.9rem; line-height: 1.25; }

/* ── Lesson Main ─────────────────────────────────────────── */
.lesson-main { min-width: 0; }

/* Hero */
.lesson-hero {
  background: var(--black);
  color: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 30px 36px;
  margin-bottom: var(--gap);
}
.lesson-hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lesson-hero h1 {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.lesson-hero h1 em { color: var(--yellow); font-style: normal; }
.lesson-hero .lesson-desc { margin-top: 10px; font-size: 0.9rem; opacity: 0.6; max-width: 580px; line-height: 1.6; }
.lesson-meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  opacity: 0.55;
  font-family: var(--font-head);
  font-weight: 600;
}
.lesson-meta-row span { display: flex; align-items: center; gap: 5px; }

/* ── Lesson Body wrapper ─────────────────────────────────── */
.lesson-body {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  overflow: hidden;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  ARTICLE LESSON STYLES (linear scroll, h2/h3 headings) ║
   ╚══════════════════════════════════════════════════════════╝ */

.lesson-body.lesson-article { font-size: 0.95rem; line-height: 1.75; color: #1a1a1a; }

.lesson-article h2 {
  font-size: 1.5rem;
  margin: 2.2em 0 0.7em;
  padding-bottom: 0.4em;
  border-bottom: 2.5px solid var(--black);
  scroll-margin-top: 80px;
}
.lesson-article h2:first-child { margin-top: 0; }
.lesson-article h3 { font-size: 1.1rem; margin: 1.8em 0 0.5em; scroll-margin-top: 80px; }
.lesson-article h4 { font-size: 0.9rem; margin: 1.4em 0 0.4em; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.6; }
.lesson-article p  { margin-bottom: 1.1em; }

.lesson-article ul, .lesson-article ol { list-style: none; margin: 0.8em 0 1.1em; padding-left: 0; }
.lesson-article ul li { position: relative; padding: 4px 0 4px 22px; border-bottom: 1px solid #f0ede6; }
.lesson-article ul li:last-child { border-bottom: none; }
.lesson-article ul li::before { content: '▸'; position: absolute; left: 2px; top: 7px; font-size: 0.75em; font-weight: 800; }
.lesson-article ol { counter-reset: ol-c; }
.lesson-article ol li { counter-increment: ol-c; position: relative; padding: 6px 0 6px 32px; border-bottom: 1px solid #f0ede6; }
.lesson-article ol li:last-child { border-bottom: none; }
.lesson-article ol li::before { content: counter(ol-c); position: absolute; left: 0; top: 6px; width: 22px; height: 22px; background: var(--black); color: var(--white); font-family: var(--font-head); font-size: 0.7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; border-radius: 2px; }

.lesson-article code { font-family: var(--font-mono); font-size: 0.85em; background: #f0ede6; border: 1.5px solid #d6d2c8; padding: 1px 5px; border-radius: 3px; }
.lesson-article pre { background: #0f1117; border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin: 1.4em 0; overflow-x: auto; position: relative; }
.lesson-article pre code { display: block; padding: 20px 22px; font-family: var(--font-mono); font-size: 0.83rem; line-height: 1.65; color: #e2e8f0; background: none; border: none; padding-top: 30px; }
.lesson-article pre .kw  { color: #FF79C6; }
.lesson-article pre .fn  { color: #50FA7B; }
.lesson-article pre .str { color: #F1FA8C; }
.lesson-article pre .num { color: #BD93F9; }
.lesson-article pre .cm  { color: #6272A4; }
.lesson-article pre .tp  { color: #8BE9FD; }

.lesson-article blockquote { margin: 1.4em 0; padding: 14px 18px; background: var(--off); border: var(--border); border-left: 5px solid var(--black); border-radius: var(--radius); }
.lesson-article blockquote p { margin-bottom: 0; color: #444; font-style: italic; }

.lesson-article table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 0.88rem; border: var(--border); box-shadow: var(--shadow); }
.lesson-article th { background: var(--black); color: var(--white); font-family: var(--font-head); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 14px; text-align: left; }
.lesson-article td { padding: 9px 14px; border-bottom: 1.5px solid #e0ddd5; vertical-align: top; }
.lesson-article tr:last-child td { border-bottom: none; }
.lesson-article tr:nth-child(even) td { background: var(--off); }
.lesson-article hr { border: none; border-top: 2.5px solid var(--black); margin: 2em 0; }
.lesson-article a { color: var(--black); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.lesson-article a:hover { background: var(--yellow); }

/* Code copy button */
.code-wrap { position: relative; }
.code-lang { position: absolute; top: 8px; left: 14px; font-family: var(--font-mono); font-size: 0.63rem; color: #6272A4; text-transform: uppercase; letter-spacing: 0.07em; }
.code-copy-btn { position: absolute; top: 7px; right: 8px; font-family: var(--font-head); font-size: 0.67rem; font-weight: 700; padding: 3px 9px; background: rgba(255,255,255,0.08); color: #888; border: 1px solid rgba(255,255,255,0.15); border-radius: 3px; cursor: pointer; transition: background 0.1s; }
.code-copy-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Article callouts */
.callout { margin: 1.4em 0; padding: 14px 18px; border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; gap: 14px; align-items: flex-start; }
.callout-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }
.callout-body p { margin-bottom: 0; font-size: 0.9rem; }
.callout-title { font-family: var(--font-head); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.callout.note    { background: #e8f0ff; border-color: var(--blue); }
.callout.tip     { background: #e8fff0; border-color: #00b865; }
.callout.warning { background: #fff8e8; border-color: var(--orange); }
.callout.danger  { background: #ffe8e8; border-color: var(--coral); }
.callout.key     { background: var(--yellow); border-color: var(--black); box-shadow: var(--shadow); }

.key-concept { margin: 1.6em 0; padding: 20px 24px; background: var(--black); color: var(--white); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.key-concept .kc-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--yellow); margin-bottom: 7px; }
.key-concept h3 { font-size: 1.05rem; margin-bottom: 7px; }
.key-concept p  { font-size: 0.88rem; opacity: 0.72; line-height: 1.6; margin-bottom: 0; }

.objectives-box { margin-bottom: 2em; padding: 18px 22px; background: var(--off); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.objectives-box h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.45; margin-bottom: 10px; }
.objectives-box ul li { padding: 5px 0 5px 26px; border-bottom: 1px solid #e0ddd5; font-size: 0.88rem; }
.objectives-box ul li::before { content: '✓'; color: #1a7a3c; font-weight: 900; left: 0; top: 5px; }
.objectives-box ul li:last-child { border-bottom: none; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  TABBED LESSON STYLES (Claude chat HTML output)        ║
   ╚══════════════════════════════════════════════════════════╝ */

/* Outer wrap Claude adds */
.lesson-tabbed .wrap { /* intentionally no extra margin */ }

/* ── Tab bar ── */
.lesson-tabbed .tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: var(--border);
}

.lesson-tabbed .tab {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 15px;
  border: var(--border);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s, background 0.08s, color 0.08s;
  white-space: nowrap;
}
.lesson-tabbed .tab:hover  { transform: translate(-1px,-1px); box-shadow: var(--shadow); }
.lesson-tabbed .tab.active { background: var(--black); color: var(--white); box-shadow: var(--shadow); }

/* ── Panels ── */
.lesson-tabbed .panel { display: none; }
.lesson-tabbed .panel.active { display: block; }

/* ── Section title ── */
.lesson-tabbed .section-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0ddd5;
}

/* ── Cards ── */
.lesson-tabbed .card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 12px;
}
.lesson-tabbed .card h3 {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.lesson-tabbed .card p,
.lesson-tabbed .card li { font-size: 0.875rem; color: #333; line-height: 1.65; }
.lesson-tabbed .card ul { padding-left: 1.1rem; margin-top: 6px; list-style: disc; }
.lesson-tabbed .card ul li { border-bottom: none; padding: 2px 0; }

/* Limitation / ok helper classes I added to the lesson file */
.lesson-tabbed .card-limit { font-size: 0.8rem; margin-top: 8px; color: #b03030; }
.lesson-tabbed .card-ok    { font-size: 0.8rem; margin-top: 8px; color: #1a7a3c; }

/* ── Grids ── */
.lesson-tabbed .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lesson-tabbed .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Inline cell styles Claude uses (factor cells, q-cells, etc.) ──
   These are hit via inline style="background:var(--color-background-secondary)…"
   The variable bridge at :root handles those. We add structural helpers: */
.lesson-tabbed .factor-cell,
.lesson-tabbed [style*="color-background-secondary"] {
  border: 1.5px solid #e0ddd5;
  border-radius: var(--radius);
}

/* ── Question cells (3-colour grid) ── */
.lesson-tabbed .q-cell {
  padding: 12px 14px;
  border: var(--border);
  border-radius: var(--radius);
}
.lesson-tabbed .q-cell.q-blue   { background: #E6F1FB; border-color: #85B7EB; }
.lesson-tabbed .q-cell.q-green  { background: #E1F5EE; border-color: #5DCAA5; }
.lesson-tabbed .q-cell.q-purple { background: #EEEDFE; border-color: #AFA9EC; }

.lesson-tabbed .q-cell-title { font-weight: 700; font-size: 0.875rem; margin-bottom: 4px; }
.lesson-tabbed .q-cell-body  { font-size: 0.8rem; opacity: 0.75; line-height: 1.55; }
.lesson-tabbed .q-cell-list  { font-size: 0.8rem; padding-left: 1rem; margin-top: 6px; list-style: disc; }

/* ── Accent box ── */
.lesson-tabbed .accent-box {
  border-left: 4px solid var(--black);
  background: var(--off);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.65;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Definition term ── */
.lesson-tabbed .def-term { font-weight: 800; color: var(--black); }

/* ── Tags ── */
.lesson-tabbed .tag {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 2px;
  margin-right: 4px;
  margin-bottom: 4px;
  border: 1.5px solid currentColor;
}
.lesson-tabbed .tag-hl   { background: #EEEDFE; color: #3C3489; }
.lesson-tabbed .tag-key  { background: #E1F5EE; color: #085041; }
.lesson-tabbed .tag-diag { background: #FAEEDA; color: #633806; }

/* ── SVG diagrams ── */
.lesson-tabbed .ppc-svg,
.lesson-tabbed .cfm-svg {
  width: 100%;
  max-width: 520px;
  display: block;
  margin: 16px auto;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  background: var(--white);
}

/* ── Flashcards ── */
.lesson-tabbed .flash-q {
  background: var(--off);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.08s;
  user-select: none;
}
.lesson-tabbed .flash-q:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow); }
.lesson-tabbed .flash-q.open   { background: var(--yellow); box-shadow: var(--shadow); }
.lesson-tabbed .flash-q .q-text { font-size: 0.9rem; font-weight: 600; }
.lesson-tabbed .flash-q .q-text::after { content: ' ▾'; color: #888; font-size: 0.75em; font-weight: 400; }
.lesson-tabbed .flash-q.open .q-text::after { content: ' ▴'; color: #333; }
.lesson-tabbed .flash-q .answer {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid rgba(0,0,0,0.15);
  font-size: 0.87rem;
  line-height: 1.65;
  color: #222;
}
.lesson-tabbed .flash-q.open .answer { display: block; }

/* ── Internal progress bar (some Claude lessons include one) ── */
.lesson-tabbed .progress-bar {
  height: 5px;
  background: #e0ddd5;
  border-radius: 999px;
  overflow: hidden;
  border: 1.5px solid var(--black);
  margin-top: 6px;
}
.lesson-tabbed .progress-fill { height: 100%; background: var(--black); border-radius: 999px; }

/* ══════════════════════════════════════════════════════════
   CLASS NAME ALIASES
   Claude uses different shorthand class names across lessons.
   Unit 1: .flash-q / .answer / .q-text / .section-title / .accent-box / .tag-hl
   Unit 2+: .fq / .ans / .qt / .stitle / .ab / .hl
   We alias every variant here so all uploads work without editing.
   ══════════════════════════════════════════════════════════ */

/* Section title alias (.stitle → .section-title) */
.lesson-tabbed .stitle {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0ddd5;
}

/* Accent box alias (.ab → .accent-box) */
.lesson-tabbed .ab {
  border-left: 4px solid var(--black);
  background: var(--off);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.65;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Tag aliases (.hl / .key / .diag / .calc → .tag-*) */
.lesson-tabbed .tag.hl,
.lesson-tabbed .tag.hl   { background: #EEEDFE; color: #3C3489; border-color: #AFA9EC; }
.lesson-tabbed .tag.key  { background: #E1F5EE; color: #085041; border-color: #5DCAA5; }
.lesson-tabbed .tag.diag { background: #FAEEDA; color: #633806; border-color: #EF9F27; }
.lesson-tabbed .tag.calc { background: #FAECE7; color: #993C1D; border-color: #F0997B; }

/* Standalone shorthand tags (not nested under .tag) */
.lesson-tabbed .hl   { display:inline-block; font-family:var(--font-head); font-size:0.67rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:2px 8px; border-radius:2px; border:1.5px solid #AFA9EC; background:#EEEDFE; color:#3C3489; margin-right:3px; margin-bottom:3px; }
.lesson-tabbed .key  { display:inline-block; font-family:var(--font-head); font-size:0.67rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:2px 8px; border-radius:2px; border:1.5px solid #5DCAA5; background:#E1F5EE; color:#085041; margin-right:3px; margin-bottom:3px; }
.lesson-tabbed .diag { display:inline-block; font-family:var(--font-head); font-size:0.67rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:2px 8px; border-radius:2px; border:1.5px solid #EF9F27; background:#FAEEDA; color:#633806; margin-right:3px; margin-bottom:3px; }
.lesson-tabbed .calc { display:inline-block; font-family:var(--font-head); font-size:0.67rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:2px 8px; border-radius:2px; border:1.5px solid #F0997B; background:#FAECE7; color:#993C1D; margin-right:3px; margin-bottom:3px; }

/* Pill variant (rounded tag) */
.lesson-tabbed .pill {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Formula / code display */
.lesson-tabbed .formula {
  background: var(--off);
  border: var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--black);
  margin: 8px 0;
  display: block;
}

/* ── Flashcard aliases (.fq / .ans / .qt → .flash-q / .answer / .q-text) ── */
.lesson-tabbed .fq {
  background: var(--off);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.08s;
  user-select: none;
}
.lesson-tabbed .fq:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow); }
.lesson-tabbed .fq.open   { background: var(--yellow); box-shadow: var(--shadow); }

.lesson-tabbed .fq .qt { font-size: 0.9rem; font-weight: 600; }
.lesson-tabbed .fq .qt::after { content: ' ▾'; color: #888; font-size: 0.75em; font-weight: 400; }
.lesson-tabbed .fq.open .qt::after { content: ' ▴'; color: #333; }

.lesson-tabbed .fq .ans {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid rgba(0,0,0,0.15);
  font-size: 0.87rem;
  line-height: 1.65;
  color: #222;
}
.lesson-tabbed .fq.open .ans { display: block; }

/* ── Responsive grid collapse ── */
@media (max-width: 640px) {
  .lesson-tabbed .grid2,
  .lesson-tabbed .grid3 { grid-template-columns: 1fr; }
}

/* ── Bottom Nav ──────────────────────────────────────────── */
.lesson-nav { display: flex; gap: var(--gap); margin-top: var(--gap); }
.lesson-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.lesson-nav-btn:hover  { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }
.lesson-nav-btn:active { transform: translate(1px,1px);   box-shadow: var(--shadow-sm); }
.lesson-nav-btn.next   { background: var(--black); color: var(--white); justify-content: flex-end; }
.nav-btn-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; opacity: 0.5; }
.nav-btn-title { font-family: var(--font-head); font-size: 0.9rem; font-weight: 800; margin-top: 2px; }

/* ── Responsive: Lesson shell ────────────────────────────── */
@media (max-width: 1100px) {
  .lesson-page { grid-template-columns: 220px 1fr; }
  .lesson-rail { display: none; }
}
@media (max-width: 768px) {
  .lesson-page { grid-template-columns: 1fr; }
  .lesson-sidebar { display: none; }
  .lesson-body { padding: 20px 18px; }
  .lesson-hero { padding: 22px 20px; }
  .lesson-nav { flex-direction: column; }
}
