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

:root {
  --font-body: 'Noto Sans', 'Noto Sans Khmer', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg:       #0e0e10;
  --bg2:      #16161a;
  --bg3:      #1e1e24;
  --bg4:      #26262e;
  --border:   rgba(255,255,255,0.08);
  --border2:  rgba(255,255,255,0.14);

  --text:     #e8e8f0;
  --text2:    #9090a8;
  --text3:    #5a5a70;

  --teal:     #1D9E75;
  --teal-l:   #E1F5EE;
  --blue:     #378ADD;
  --blue-l:   #E6F1FB;
  --purple:   #7F77DD;
  --purple-l: #EEEDFE;
  --amber:    #EF9F27;
  --amber-l:  #FAEEDA;
  --coral:    #D85A30;
  --coral-l:  #FAECE7;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --nav-h: 56px;
  --sidebar-w: 280px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.7; }

/* Khmer text rendering */
:lang(km), .kh-text { font-family: 'Noto Sans Khmer', sans-serif; line-height: 2; }

/* Korean text rendering */
:lang(ko), .ko-text { font-family: 'Noto Sans KR', sans-serif; line-height: 1.8; }

/* ── Nav ── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(14,14,16,0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); font-weight: 700;
  font-size: 16px; letter-spacing: -0.02em; cursor: pointer;
  flex-shrink: 0;
}
.logo-icon { font-size: 20px; color: var(--teal); }
.nav-center { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); min-width: 0; }
.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.breadcrumb-sep { color: var(--text3); }
.breadcrumb-item { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-item.active { color: var(--text); }

/* Language toggle */
.lang-toggle {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.lang-btn {
  background: none; border: none; color: var(--text3);
  font-size: 11px; font-weight: 600; padding: 4px 8px;
  cursor: pointer; font-family: var(--font-body);
  transition: all 0.15s;
}
.lang-btn.active { background: var(--teal); color: #fff; }
.lang-btn:not(.active):hover { color: var(--text); }

#nav-progress { display: none; }
.progress-pill {
  position: relative; overflow: hidden;
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: 20px; padding: 4px 12px; min-width: 80px;
  text-align: center; font-size: 12px; font-weight: 500;
}
.progress-fill-pill {
  position: absolute; inset: 0;
  background: rgba(29,158,117,0.15);
  border-radius: 20px;
  width: 0%; transition: width 0.5s ease;
}
#nav-progress-text { position: relative; color: var(--teal); }

/* ── Pages ── */
.page { display: none; min-height: 100vh; padding-top: var(--nav-h); }
.page.active { display: block; }

/* ── Hero ── */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 4rem 1.5rem;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(29,158,117,0.08) 0%, transparent 70%);
}
.hero-inner { max-width: 720px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center;
  background: rgba(29,158,117,0.12); border: 0.5px solid rgba(29,158,117,0.3);
  color: var(--teal); font-size: 12px; font-weight: 500;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
}
.hero-title {
  font-size: clamp(26px, 4.5vw, 44px); font-weight: 700;
  line-height: 1.2; letter-spacing: -0.03em;
  margin-bottom: 0.5rem; color: var(--text);
}
.hero-title em { font-style: normal; color: var(--teal); }
.hero-title-kh {
  font-family: 'Noto Sans Khmer', sans-serif;
  font-size: clamp(16px, 2.5vw, 24px); font-weight: 600;
  color: var(--text2); margin-bottom: 1.25rem; line-height: 2;
}
.hero-sub { font-size: 16px; color: var(--text2); line-height: 1.8; margin-bottom: 0.5rem; }
.hero-sub-kh {
  font-family: 'Noto Sans Khmer', sans-serif;
  font-size: 14px; color: var(--text3); line-height: 2; margin-bottom: 2rem;
}
.hero-stats {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 2.5rem;
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.stat-item { padding: 1rem 1.5rem; text-align: center; }
.stat-n { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.stat-l { display: block; font-size: 11px; color: var(--text2); margin-top: 2px; }
.stat-sep { width: 0.5px; height: 40px; background: var(--border); }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal); color: #fff;
  padding: 12px 24px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: #16855f; transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text2);
  padding: 12px 24px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 15px;
  border: 0.5px solid var(--border2); cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { background: var(--bg2); color: var(--text); }
.btn-ghost.small { padding: 7px 14px; font-size: 13px; }

/* ── Section Wrap ── */
.section-wrap {
  max-width: 1100px; margin: 0 auto;
  padding: 4rem 1.5rem;
}
.section-wrap.alt { background: var(--bg2); max-width: 100%; }
.section-wrap.alt > * { max-width: 1100px; margin: 0 auto; }
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text3);
  margin-bottom: 2rem;
}
.section-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 12px;
}
.section-desc { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* ── Module Grid (Home) ── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.module-card-home {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 10px;
}
.module-card-home:hover { border-color: var(--border2); transform: translateY(-2px); background: var(--bg3); }
.mc-icon {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.mc-num { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); }
.mc-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.mc-sub { font-size: 12px; color: var(--text2); line-height: 1.5; }
.mc-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.mc-lessons { font-size: 11px; color: var(--text3); }
.mc-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); margin-left: auto; }
.mc-status-dot.complete { background: var(--teal); }

/* ── What Grid ── */
.what-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; max-width: 1100px; margin: 0 auto;
}
.what-card {
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.what-icon { font-size: 28px; margin-bottom: 0.75rem; }
.what-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.what-card h3 small { display: block; font-family: 'Noto Sans Khmer', sans-serif; font-size: 11px; color: var(--text3); font-weight: 400; margin-top: 2px; }
.what-card p { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* Home progress bar */
#home-progress-bar { display: none; }
.home-progress-wrap {
  background: var(--bg2); border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border); padding: 1rem 0;
}
.hp-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 16px;
}
.hp-label { font-size: 13px; color: var(--text2); flex-shrink: 0; }
.hp-bar { flex: 1; height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.hp-fill { height: 100%; background: var(--teal); border-radius: 2px; transition: width 0.5s; }
.hp-pct { font-size: 13px; font-weight: 500; color: var(--teal); min-width: 36px; text-align: right; }
.hp-resume { padding: 7px 16px; font-size: 13px; flex-shrink: 0; }

/* ── Course Layout ── */
.course-layout { display: flex; min-height: calc(100vh - var(--nav-h)); }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  background: var(--bg2);
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar-inner { padding: 1.25rem 1rem; }
.sidebar-overall { margin-bottom: 1.5rem; }
.sidebar-prog-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text2); margin-bottom: 6px; }
.sidebar-prog-bar { height: 3px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.sidebar-prog-fill { height: 100%; background: var(--teal); border-radius: 2px; transition: width 0.4s; }

.sb-module { margin-bottom: 4px; }
.sb-module-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s; font-size: 13px; font-weight: 500;
}
.sb-module-header:hover { background: var(--bg3); }
.sb-module-header.open { background: var(--bg3); }
.sb-m-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sb-m-title { flex: 1; color: var(--text); }
.sb-m-chevron { color: var(--text3); font-size: 11px; transition: transform 0.2s; }
.sb-module-header.open .sb-m-chevron { transform: rotate(90deg); }

.sb-lessons { display: none; padding-left: 16px; margin-bottom: 4px; }
.sb-module-header.open + .sb-lessons { display: block; }
.sb-lesson {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; color: var(--text2);
  transition: all 0.15s;
}
.sb-lesson:hover { background: var(--bg3); color: var(--text); }
.sb-lesson.active { background: rgba(29,158,117,0.1); color: var(--teal); }
.sb-lesson.done { color: var(--teal); }
.sb-l-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--text3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
}
.sb-l-dot.done { background: var(--teal); border-color: var(--teal); color: #fff; }
.sb-l-dot.active { border-color: var(--teal); }
.sb-l-title { flex: 1; line-height: 1.4; }

/* ── Lesson Main ── */
.lesson-main { flex: 1; min-width: 0; padding: 2.5rem 3rem 4rem; max-width: 780px; }

/* Module Overview */
.mo-header { display: flex; align-items: center; gap: 16px; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 0.5px solid var(--border); }
.mo-icon-big { width: 56px; height: 56px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.mo-num { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.mo-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.mo-sub { font-size: 14px; color: var(--text2); margin-top: 4px; }
.mo-lessons-list { display: flex; flex-direction: column; gap: 8px; }
.mo-lesson-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg2);
  border: 0.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s;
}
.mo-lesson-item:hover { border-color: var(--border2); background: var(--bg3); }
.mo-l-num { font-size: 11px; color: var(--text3); min-width: 20px; }
.mo-l-title { font-size: 14px; font-weight: 500; flex: 1; }
.mo-l-meta { display: flex; align-items: center; gap: 8px; }
.mo-l-type { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: var(--bg4); color: var(--text2); }
.mo-l-dur { font-size: 11px; color: var(--text3); }
.mo-l-done { font-size: 12px; color: var(--teal); }

/* Lesson Content */
.lesson-view {}
.lesson-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 0.5px solid var(--border); }
.lesson-type-badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 12px; margin-bottom: 10px; }
.lesson-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.lesson-header-kh { font-family: 'Noto Sans Khmer', sans-serif; font-size: 15px; color: var(--text2); margin-bottom: 8px; line-height: 2; }
.lesson-header-sub { font-family: 'Noto Sans KR', sans-serif; font-size: 15px; color: var(--text2); margin-bottom: 8px; }
.lesson-meta-row { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text2); }
.lesson-body { line-height: 1.8; }
.lesson-body h2 { font-size: 20px; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text); letter-spacing: -0.02em; }
.lesson-body h2:first-child { margin-top: 0; }
.lesson-body h3 { font-size: 16px; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); }
.lesson-body h4 { font-size: 14px; font-weight: 600; margin: 1rem 0 0.4rem; color: var(--text2); }
.lesson-body p { margin-bottom: 1rem; color: var(--text); }
.lesson-body a { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.lesson-body ul, .lesson-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.lesson-body li { margin-bottom: 0.3rem; color: var(--text); }
.lesson-body code { font-family: var(--font-mono); font-size: 13px; background: var(--bg3); padding: 1px 5px; border-radius: 4px; color: var(--teal); }
.lesson-body strong { font-weight: 600; color: var(--text); }

.code-block {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1rem 0 1.25rem; overflow-x: auto;
  color: #b8d0e8; white-space: pre;
}
.info-box {
  background: rgba(29,158,117,0.06); border: 0.5px solid rgba(29,158,117,0.25);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1rem 0 1.25rem; font-size: 14px; color: var(--text);
}
.info-box.blue { background: rgba(55,138,221,0.06); border-color: rgba(55,138,221,0.25); }
.info-box.amber { background: rgba(239,159,39,0.06); border-color: rgba(239,159,39,0.25); }
.info-box.red { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.25); }
.info-box strong { color: var(--teal); }
.info-box.blue strong { color: var(--blue); }
.info-box.amber strong { color: var(--amber); }
.info-box.red strong { color: #f87171; }

/* Khmer note box */
.kh-box {
  background: rgba(127,119,221,0.06); border: 0.5px solid rgba(127,119,221,0.25);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1.5rem 0; font-size: 13px;
}
.kh-box-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--purple); margin-bottom: 10px;
}
.vocab-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.vocab-item {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.vocab-en { font-size: 12px; font-weight: 600; color: var(--text); }
.vocab-kh { font-family: 'Noto Sans Khmer', sans-serif; font-size: 12px; color: var(--purple); line-height: 1.8; }
.vocab-ko { font-family: 'Noto Sans KR', sans-serif; font-size: 12px; color: var(--teal); line-height: 1.8; }

/* Korean vocab box */
.ko-box {
  background: rgba(29,158,117,0.06); border: 0.5px solid rgba(29,158,117,0.25);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1.5rem 0; font-size: 13px;
}
.ko-box-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--teal); margin-bottom: 10px;
}

/* Language visibility — controlled by body class */
body.lang-ko .kh-box { display: none; }
body.lang-en .ko-box,
body.lang-kh .ko-box { display: none; }

.step-list { display: flex; flex-direction: column; gap: 10px; margin: 1rem 0 1.25rem; }
.step { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--teal); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 1rem 0; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

.lesson-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 1rem 0 1.25rem; }
.lesson-table th { background: var(--bg3); color: var(--text2); font-weight: 600; padding: 8px 12px; text-align: left; border: 0.5px solid var(--border); }
.lesson-table td { padding: 8px 12px; border: 0.5px solid var(--border); color: var(--text); }
.lesson-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 1rem 0; }
.card-item { background: var(--bg3); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 12px; }
.card-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.card-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }
.card-tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--bg4); color: var(--text2); margin-top: 6px; }
.card-tag.teal { background: rgba(29,158,117,0.15); color: var(--teal); }
.card-tag.blue { background: rgba(55,138,221,0.12); color: var(--blue); }
.card-tag.amber { background: rgba(239,159,39,0.12); color: var(--amber); }

/* Can/Cannot comparison */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1rem 0 1.25rem; }
@media (max-width: 600px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-col { background: var(--bg3); border-radius: var(--radius); padding: 1rem; }
.compare-header { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; margin-bottom: 10px; }
.compare-col.can .compare-header { color: var(--teal); }
.compare-col.cannot .compare-header { color: #f87171; }
.compare-item { font-size: 13px; color: var(--text2); padding: 4px 0; border-bottom: 0.5px solid var(--border); display: flex; gap: 8px; align-items: flex-start; }
.compare-item:last-child { border-bottom: none; }
.compare-item::before { content: '✓'; color: var(--teal); font-weight: 700; flex-shrink: 0; }
.compare-col.cannot .compare-item::before { content: '✗'; color: #f87171; }

/* Lesson Nav */
.lesson-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 0.5px solid var(--border);
  gap: 12px;
}
.lesson-nav-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  border: 0.5px solid var(--border); background: var(--bg2);
  cursor: pointer; color: var(--text2); transition: all 0.15s;
}
.lesson-nav-btn:hover { border-color: var(--border2); color: var(--text); background: var(--bg3); }
.lesson-nav-btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.lesson-nav-btn.primary:hover { background: #16855f; }
.done-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  border: 0.5px solid var(--border); background: transparent;
  cursor: pointer; color: var(--text2); transition: all 0.2s;
}
.done-toggle.done { background: rgba(29,158,117,0.1); border-color: var(--teal); color: var(--teal); }

/* Nav link buttons */
.nav-link-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 13px;
  color: var(--text2); padding: 4px 10px; border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-link-btn:hover { color: var(--text); background: var(--bg3); }

/* Page inner */
.page-inner { max-width: 800px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 1.5rem; font-family: var(--font-body); }
.back-btn:hover { color: var(--text); }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2rem; }

/* Concept page */
.concept-section { margin-bottom: 2.5rem; }
.concept-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 1rem; }
.concept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.concept-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; }
.concept-card-icon { font-size: 20px; margin-bottom: 8px; }
.concept-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.concept-card p { font-size: 12px; color: var(--text2); line-height: 1.6; }
.flow-diagram { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.flow-diagram h3 { font-size: 14px; font-weight: 600; margin-bottom: 1rem; }
.flow-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-step { background: var(--bg3); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; font-weight: 500; }
.flow-step.hi { background: rgba(29,158,117,0.1); border-color: rgba(29,158,117,0.3); color: var(--teal); }
.flow-arrow { color: var(--text3); font-size: 14px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* Responsive (base — mobile layout handled in 900px block below) */
@media (max-width: 768px) {
  .lesson-main { padding: 1.5rem 1rem 3rem; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 14px; }
  .stat-item { padding: 0.75rem 1rem; }
  .compare-grid { grid-template-columns: 1fr; }
}

/* ── Quiz ── */
.quiz-container { max-width: 680px; }
.quiz-header { margin-bottom: 2rem; }
.quiz-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(239,159,39,0.12); border: 0.5px solid rgba(239,159,39,0.3);
  color: var(--amber); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px; margin-bottom: 10px;
}
.quiz-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.quiz-meta { font-size: 13px; color: var(--text2); }
.quiz-progress-bar {
  height: 3px; background: var(--bg4); border-radius: 2px;
  margin: 1.25rem 0; overflow: hidden;
}
.quiz-progress-fill { height: 100%; background: var(--amber); border-radius: 2px; transition: width 0.4s; }

.quiz-question-wrap { animation: fadeInUp 0.25s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.quiz-q-num { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.quiz-q-text { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 1.25rem; line-height: 1.5; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  cursor: pointer; transition: all 0.15s; font-size: 14px; color: var(--text);
  text-align: left; font-family: var(--font-body); width: 100%;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--amber); background: rgba(239,159,39,0.04); }
.quiz-opt-key {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg4); color: var(--text2);
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.quiz-opt.selected { border-color: var(--amber); background: rgba(239,159,39,0.08); }
.quiz-opt.selected .quiz-opt-key { background: var(--amber); color: #fff; }
.quiz-opt.correct { border-color: var(--teal); background: rgba(29,158,117,0.1); }
.quiz-opt.correct .quiz-opt-key { background: var(--teal); color: #fff; }
.quiz-opt.wrong { border-color: #f87171; background: rgba(239,68,68,0.08); }
.quiz-opt.wrong .quiz-opt-key { background: #f87171; color: #fff; }
.quiz-opt:disabled { cursor: default; }

.quiz-explanation {
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  margin-top: 12px; font-size: 13px; color: var(--text2); line-height: 1.7;
  animation: fadeInUp 0.2s ease;
}
.quiz-explanation strong { color: var(--text); }

.quiz-btn-row { display: flex; justify-content: flex-end; margin-top: 1.5rem; gap: 10px; }
.quiz-btn {
  padding: 10px 22px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; background: var(--amber); color: #fff;
  transition: all 0.2s;
}
.quiz-btn:hover { background: #d4860f; }
.quiz-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Quiz result */
.quiz-result { text-align: center; padding: 2rem 0; }
.quiz-score-circle {
  width: 100px; height: 100px; border-radius: 50%;
  margin: 0 auto 1.5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; border: 3px solid;
}
.quiz-score-circle.pass { border-color: var(--teal); background: rgba(29,158,117,0.1); color: var(--teal); }
.quiz-score-circle.fail { border-color: #f87171; background: rgba(239,68,68,0.08); color: #f87171; }
.quiz-score-num { font-size: 28px; line-height: 1; }
.quiz-score-label { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; margin-top: 2px; }
.quiz-result-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.quiz-result-sub { font-size: 14px; color: var(--text2); margin-bottom: 2rem; line-height: 1.6; }
.quiz-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Score badge in module overview */
.quiz-score-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 600;
}
.quiz-score-badge.passed { background: rgba(29,158,117,0.12); color: var(--teal); border: 0.5px solid rgba(29,158,117,0.3); }
.quiz-score-badge.failed { background: rgba(239,68,68,0.1); color: #f87171; border: 0.5px solid rgba(239,68,68,0.25); }

/* ── Footer ── */
.site-footer {
  margin-top: 6rem;
  background: var(--bg2);
  border-top: 1px solid var(--border2);
  position: relative;
}
.site-footer::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal) 30%, var(--blue) 70%, transparent);
  position: absolute;
  top: -1px; left: 0; right: 0;
}
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 3rem 2rem 2rem; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1.5rem; border-top: 0.5px solid var(--border);
  gap: 1rem;
}
.footer-bottom p { font-size: 12px; color: var(--text3); }
@media (max-width: 760px) {
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ── Flow diagram CSS (was inline) ── */
.flow-section-desc { margin-bottom: 1.5rem; }
.flow-diagram { max-width: 680px; }

/* ── Mobile Hamburger ── */
.nav-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px;
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  flex-shrink: 0; order: -1;
}
.nav-hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: all 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile Sidebar Overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 149;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Responsive Breakpoints ── */
@media (max-width: 900px) {
  /* Sidebar becomes a slide-in drawer on mobile */
  .nav-hamburger { display: flex; }
  #nav-hamburger { display: flex; }

  .sidebar {
    display: block;
    position: fixed;
    top: var(--nav-h); bottom: 0;
    left: calc(-1 * min(var(--sidebar-w), 85vw));
    z-index: 150;
    transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
    height: calc(100vh - var(--nav-h));
    width: min(var(--sidebar-w), 85vw);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { left: 0; }

  .lesson-main {
    padding: 1.5rem 1.25rem 3rem;
    max-width: 100%;
  }

  /* Hide breadcrumb on very small screens to save space */
  .nav-center { display: none; }
}

@media (max-width: 640px) {
  /* Hero */
  .hero { padding: 2rem 1rem; min-height: unset; }
  .hero-stats { flex-wrap: wrap; border-radius: var(--radius); }
  .stat-item { padding: 0.75rem 1rem; flex: 1 1 30%; }
  .stat-sep { display: none; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-ghost { justify-content: center; }

  /* Sections */
  .section-wrap { padding: 2.5rem 1rem; }
  .modules-grid { grid-template-columns: 1fr 1fr; }
  .what-grid { grid-template-columns: 1fr 1fr; }

  /* Module overview */
  .mo-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .mo-lesson-item { flex-wrap: wrap; gap: 6px; }
  .mo-l-meta { flex-wrap: wrap; }

  /* Progress bar */
  .hp-inner { flex-wrap: wrap; gap: 8px; }
  .hp-label { width: 100%; }
  .hp-resume { margin-left: auto; }

  /* Quiz */
  .quiz-btn-row { flex-direction: column; align-items: stretch; }
  .quiz-btn { justify-content: center; }
}

@media (max-width: 400px) {
  .modules-grid { grid-template-columns: 1fr; }
  .what-grid { grid-template-columns: 1fr; }
  .vocab-grid { grid-template-columns: 1fr 1fr; }
  .hero-stats { flex-direction: row; flex-wrap: wrap; }
  .lesson-main { padding: 1rem 0.875rem 3rem; }
}
