/* Learn4Free - Free and Open Source Programming Education
   Original Design System Inspired by Warm Editorial Aesthetics
   Copyright (C) 2026 Learn4Free contributors
   SPDX-License-Identifier: GPL-2.0-only */

:root {
  /* Warm Editorial Palette */
  --bg: #fff0e5;                 /* Warm cream canvas */
  --panel: #ffffff;              /* Crisp white cards */
  --navy: #10162f;               /* Midnight navy text & borders */
  --navy-dark: #070a16;
  --navy-light: #1b2347;
  --border: #10162f;             /* 1.5px dark crisp borders */
  --border-light: #e5dfd9;
  --text: #10162f;
  --muted: #575d71;
  --blue-cta: #3a10e5;           /* Electric purple/blue for primary actions */
  --blue-hover: #290bb0;
  --yellow: #ffd600;             /* Energetic gold/yellow for progress bars */
  --yellow-light: #fff8d6;
  --pastel-blue: #d1f4ff;
  --pastel-green: #e3fde8;
  --pastel-purple: #eee5ff;
  --pastel-pink: #ffe6eb;
  --ok: #008a00;
  --ok-bg: #e3fde8;
  --err: #d62020;
  --err-bg: #ffe6eb;
  --radius: 4px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.55 var(--font-sans);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, textarea, kbd { font-family: var(--font-mono); }

/* Lucide Vector Icons */
.lucide {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-pass { color: var(--ok); }
.icon-fail { color: var(--err); }

/* ---------- Topbar ---------- */
#topbar {
  height: 56px;
  background: #ffffff;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex: none;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 32px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy) !important;
}
.brand-box {
  background: var(--navy);
  color: var(--yellow);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  border-radius: 3px;
}
.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--navy);
}
.brand-num { color: var(--blue-cta); }

.top-nav { display: flex; align-items: center; gap: 20px; }
.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-bottom-color 0.15s;
}
.nav-link:hover { color: var(--blue-cta); text-decoration: none; }
.nav-link.active { font-weight: 800; color: var(--blue-cta); border-bottom-color: var(--blue-cta); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.nologin {
  font-size: 12px;
  font-weight: 700;
  background: #fbf7f4;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  padding: 4px 12px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot-online {
  width: 7px;
  height: 7px;
  background: #16a34a;
  border-radius: 50%;
  display: inline-block;
}

#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.page { overflow-y: auto; flex: 1; }

/* ---------- Common Container ---------- */
.clean-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

/* ---------- Buttons & Badges ---------- */
.btn-primary-action {
  background: var(--blue-cta);
  color: #fff !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 0 var(--border);
  transition: background 0.15s, transform 0.1s;
}
.btn-primary-action:hover { background: var(--blue-hover); transform: translateY(-1px); }
.btn-primary-action:active { transform: translateY(1px); box-shadow: none; }

.btn-secondary-action {
  background: #ffffff;
  color: var(--navy) !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 0 var(--border);
  transition: background 0.15s, transform 0.1s;
}
.btn-secondary-action:hover { background: #fbf7f4; transform: translateY(-1px); }
.btn-secondary-action:active { transform: translateY(1px); box-shadow: none; }

.badge-pill {
  background: var(--pastel-blue);
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 3px 12px;
  font-weight: 800;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 12px;
}
.card {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 0 var(--border);
}

/* ---------- Homepage Layout ---------- */
.hero-block {
  text-align: center;
  padding: 20px 0 32px;
}
.hero-headline {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  line-height: 1.2;
}
.hero-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Resume Learning Card */
.resume-banner-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 0 var(--border);
  overflow: hidden;
  margin-bottom: 36px;
}
.resume-progress-top {
  height: 28px;
  background: #e5dfd9;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: stretch;
  position: relative;
}
.resume-percent-badge {
  background: var(--yellow);
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 900;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1.5px solid var(--border);
  white-space: nowrap;
  flex: none;
  letter-spacing: 0.02em;
}
.resume-track {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: repeating-linear-gradient(
    -45deg,
    #d9d3cd,
    #d9d3cd 4px,
    #e5dfd9 4px,
    #e5dfd9 8px
  );
}
.resume-track-fill {
  background: var(--yellow);
  height: 100%;
  border-right: 1.5px solid var(--border);
  transition: width 0.3s;
}

.resume-card-body {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.resume-info { flex: 1; }
.resume-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.resume-title { font-size: 24px; font-weight: 900; margin: 4px 0 6px; }
.resume-lesson-meta { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.resume-stats-row { font-size: 13px; color: var(--muted); }
.resume-actions { display: flex; align-items: center; gap: 12px; }

/* Sections */
.section-block { margin-bottom: 40px; }
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
}
.section-title { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; margin: 0 0 4px; }
.section-desc { font-size: 14px; color: var(--muted); margin: 0; }
.catalog-badge {
  font-size: 12px;
  font-weight: 800;
  background: #ffffff;
  border: 1.5px solid var(--border);
  padding: 4px 12px;
  border-radius: 9999px;
  box-shadow: 0 1px 0 var(--border);
}

/* Course Catalog Grid */
.courses-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-gap: 24px;
}
.course-card-clean {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 0 var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.course-card-clean:hover { transform: translateY(-2px); box-shadow: 0 4px 0 var(--border); }
.course-card-top-strip {
  padding: 8px 16px;
  background: var(--pastel-blue);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.course-lang-tag { font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy); }
.course-level-tag { font-size: 11px; font-weight: 700; color: #475569; }

.course-card-content { padding: 22px 20px; flex: 1; display: flex; flex-direction: column; }
.course-title-text { font-size: 20px; font-weight: 900; margin: 0 0 8px; }
.course-desc-text { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin: 0 0 16px; flex: 1; }

.course-metrics-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 12px;
}
.metric-divider { color: #cbd5e1; }

.course-bar-track {
  height: 10px;
  background: #f1ece6;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.course-bar-fill { background: var(--yellow); height: 100%; border-radius: 9999px; }
.course-progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 18px; }

.course-buttons-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* Export / Import Card */
.export-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: #fdfaf7;
}
.export-card-text h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.export-card-text p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.export-card-btns { display: flex; gap: 10px; flex-shrink: 0; }
.import-label { margin: 0; cursor: pointer; }

/* Principles Grid */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  grid-gap: 20px;
}
.principle-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 0 var(--border);
}
.principle-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--yellow-light);
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  margin-bottom: 12px;
}
.principle-icon { font-size: 26px; margin-bottom: 8px; }
.principle-card h3 { font-size: 15px; font-weight: 800; margin: 0 0 6px; }
.principle-card p { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }

/* Footer */
.clean-footer {
  background: #ffffff;
  border-top: 1.5px solid var(--border);
  padding: 44px 24px;
}
.clean-footer-wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 32px;
}
.footer-brand { font-size: 18px; margin-bottom: 6px; }
.footer-left-info p { margin: 0 0 8px; color: var(--muted); font-size: 13px; max-width: 360px; line-height: 1.45; }
.footer-subtext { font-size: 12px; color: var(--muted); }
.footer-links-group { display: flex; flex-direction: column; gap: 8px; }
.footer-links-group h4 { margin: 0 0 6px; font-size: 13px; font-weight: 800; }
.footer-links-group a { font-size: 13px; color: var(--muted); }
.footer-links-group a:hover { color: var(--navy); }

/* ---------- Curriculum Page (#/:courseId) ---------- */
.curriculum-overview-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 2px 0 var(--border);
  margin-bottom: 24px;
}
.curriculum-top-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.curriculum-title { font-size: 28px; font-weight: 900; margin: 0 0 8px; }
.curriculum-desc { font-size: 15px; color: var(--muted); line-height: 1.5; margin: 0 0 20px; }
.curriculum-bar-track {
  height: 10px;
  background: #f1ece6;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.curriculum-bar-fill { background: var(--yellow); height: 100%; border-radius: 9999px; }
.curriculum-meta-bar { display: flex; justify-content: space-between; align-items: center; }
.curriculum-progress-text { font-size: 13.5px; }
.curriculum-actions { display: flex; gap: 10px; }

.units-list-container { display: flex; flex-direction: column; gap: 18px; }
.unit-group-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 0 var(--border);
}
.unit-group-head {
  padding: 14px 20px;
  background: #fdfaf7;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.unit-group-title { font-size: 16px; font-weight: 800; margin: 0; }
.unit-group-count { font-size: 12px; font-weight: 700; color: var(--muted); }

.lessons-table { display: flex; flex-direction: column; }
.lesson-row-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #f1ece6;
  color: var(--navy);
  font-weight: 600;
  transition: background 0.15s;
}
.lesson-row-item:last-child { border-bottom: 0; }
.lesson-row-item:hover { background: #fbf7f4; text-decoration: none; }
.lesson-status-circle {
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: #fff;
  flex: none;
}
.lesson-status-circle.completed { background: var(--yellow); color: var(--navy); font-weight: 900; }
.lesson-row-title { flex: 1; font-size: 14px; }
.lesson-row-tests { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------- Documentation Page (#/docs) ---------- */
.docs-hero-header { text-align: center; margin-bottom: 24px; }
.docs-hero-header h1 { font-size: 32px; font-weight: 900; margin: 0 0 8px; }
.docs-hero-header p { font-size: 15px; color: var(--muted); max-width: 600px; margin: 0 auto 12px; }
.docs-meta-stats { display: flex; gap: 10px; justify-content: center; font-size: 13px; color: var(--muted); font-weight: 600; }

.docs-search-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 0 var(--border);
}
.docs-search-input-wrap { position: relative; display: flex; align-items: center; margin-bottom: 14px; }
.docs-search-glass { position: absolute; left: 14px; font-size: 16px; pointer-events: none; opacity: 0.6; }
.docs-search-box {
  width: 100%;
  padding: 10px 40px 10px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  background: #fdfaf7;
}
.docs-search-box:focus { border-color: var(--blue-cta); background: #fff; }
.btn-clear-search {
  position: absolute;
  right: 12px;
  background: none;
  border: 0;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
}

.docs-options-row { display: flex; gap: 20px; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.radio-option { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.docs-category-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab-btn {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--navy);
  transition: all 0.15s;
}
.cat-tab-btn:hover { background: #fbf7f4; }
.cat-tab-btn.active { background: var(--navy); color: #fff; }

.docs-results-counter { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.empty-docs-notice { background: var(--yellow-light); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px; font-size: 13.5px; }

.docs-entries-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); grid-gap: 20px; }
.doc-entry-card {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 0 var(--border);
  display: flex;
  flex-direction: column;
}
.doc-entry-card.card-learned { border-top: 5px solid var(--blue-cta); }
.doc-card-top-bar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 10px; }
.doc-badge-pill {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--pastel-blue);
  color: var(--navy);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 6px;
}
.doc-category-name { font-size: 12px; color: var(--muted); font-weight: 600; }
.doc-entry-title { font-size: 18px; font-weight: 900; margin: 4px 0 0; }
.doc-status-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.doc-status-tag.learned { background: var(--ok-bg); color: var(--ok); }
.doc-status-tag.upcoming { background: #f1ece6; color: var(--muted); }

.doc-entry-summary { font-size: 13.5px; font-weight: 700; color: var(--text); margin: 6px 0; }
.doc-entry-explanation { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.doc-field-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }

.code-wrap-relative { position: relative; margin-bottom: 8px; }
.code-wrap-relative pre {
  margin: 0;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-x: auto;
}
.btn-copy-code {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.code-wrap-relative:hover .btn-copy-code { opacity: 1; }
.btn-copy-code:hover { background: rgba(255,255,255,0.3); }
.btn-copy-code.copied { background: var(--ok); opacity: 1; }

.doc-output-box {
  background: #fdfaf7;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12.5px;
  margin: 0 0 8px;
  color: var(--navy);
}
.doc-terms-flex { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.term-token {
  background: #f1ece6;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
}

/* Glossary Section */
.glossary-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); grid-gap: 16px; }
.glossary-term-box { padding: 16px; }
.glossary-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.glossary-term-code code { font-size: 13.5px; font-weight: 800; color: var(--blue-cta); background: var(--pastel-blue); padding: 2px 6px; border-radius: 3px; }
.glossary-jump-link { font-size: 11.5px; font-weight: 700; background: #f1ece6; border: 1px solid var(--border-light); padding: 2px 8px; border-radius: 4px; color: var(--navy); }
.glossary-term-def { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- 3-Pane Workspace ---------- */
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
}
.pane {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  position: relative;
}
.left-pane { width: 31%; min-width: 250px; border-right: 1.5px solid var(--border); }
.editor-pane { flex: 1; min-width: 300px; background: var(--navy); }
.right-pane { width: 30%; min-width: 270px; border-left: 1.5px solid var(--border); }

/* Draggable Splitters */
.gutter-h {
  width: 6px;
  cursor: col-resize;
  background: #e2dbd5;
  flex: none;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.gutter-h:hover, .gutter-h.dragging { background: var(--blue-cta); }

/* Left Tabs */
.left-tabs {
  display: flex;
  background: #fbf7f4;
  border-bottom: 1.5px solid var(--border);
  flex: none;
}
.left-tabs button {
  flex: 1;
  background: none;
  border: 0;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.left-tabs button.on {
  color: var(--navy);
  background: #fff;
  border-bottom-color: var(--navy);
}
.left-tab-content { flex: 1; min-height: 0; display: none; flex-direction: column; overflow: hidden; }
.left-tab-content.on { display: flex; }

.status-bar {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}
.status-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-indicator { width: 8px; height: 8px; border-radius: 50%; }
.status-todo { background: #fdfaf7; color: var(--muted); }
.status-todo .status-indicator { background: #94a3b8; }
.status-completed { background: var(--ok-bg); color: var(--ok); }
.status-completed .status-indicator { background: var(--ok); }

.lesson-body { padding: 18px 22px 36px; overflow-y: auto; flex: 1; }
.unit-tag { font-size: 11px; font-weight: 800; color: var(--blue-cta); text-transform: uppercase; letter-spacing: 0.05em; }
.lesson-header-title h1 { font-size: 21px; font-weight: 900; margin: 4px 0 14px; }
.lesson-markup p { margin: 10px 0; font-size: 14px; line-height: 1.6; color: #222; }
.lesson-markup h2 { font-size: 16px; font-weight: 800; margin: 20px 0 8px; color: var(--navy); }
.lesson-markup ul { padding-left: 20px; }
.lesson-markup code { background: #f1ece6; padding: 2px 6px; border-radius: 3px; font-size: 12.5px; }

/* Lesson Diagrams & Figures */
.lesson-tag-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.badge-unit-test {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--yellow-light);
  border: 1.5px solid #d97706;
  color: #92400e;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}
.badge-unit-test-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--yellow-light);
  border: 1px solid #d97706;
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 9999px;
  margin-left: 8px;
  vertical-align: middle;
}
.unit-test-row { background: #fffdf8; }
.unit-test-row:hover { background: #fef9ed !important; }

.lesson-figure {
  margin: 18px 0 22px;
  padding: 12px;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 0 var(--border);
  text-align: center;
}
.lesson-figure-img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--border-light);
}
.lesson-figure-cap {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

/* Vocabulary Card */
.vocab-card {
  background: #fdfaf7;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--navy);
  border-radius: var(--radius);
  padding: 14px;
  margin: 16px 0 20px;
}
.vocab-head { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--navy); font-weight: 800; }
.vocab-intro { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.vocab-list { display: flex; flex-direction: column; gap: 8px; }
.vocab-item {
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.vocab-term code { background: var(--pastel-blue); color: var(--navy); font-weight: 800; font-size: 12px; padding: 2px 6px; border-radius: 3px; }
.vocab-def { font-size: 12.5px; color: #374151; margin-top: 3px; line-height: 1.45; }

/* Progressive Hint */
.hint-details {
  background: var(--yellow-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin: 18px 0;
  overflow: hidden;
}
.hint-details summary {
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
  color: var(--navy);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hint-body { padding: 8px 14px 14px; font-size: 13px; border-top: 1px solid #f0e2a3; line-height: 1.5; }

/* Editor Header */
.ed-head {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex: none;
}
.ed-file-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1b2347;
  color: #fff;
  padding: 6px 14px;
  border-radius: 4px 4px 0 0;
  font-weight: 700;
  font-size: 13px;
}
.ed-actions { display: flex; align-items: center; gap: 8px; }
.btn-ghost {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  border-radius: var(--radius);
  padding: 6px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.18); }
.btn-primary {
  background: var(--blue-cta);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 6px 16px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--blue-hover); }
.ed-actions kbd {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  color: #e2e8f0;
}

.editor { position: relative; flex: 1; min-height: 0; display: flex; background: var(--navy); }
.gutter, .hl, #code { font-size: 13.5px; line-height: 1.55; padding-top: 10px; padding-bottom: 10px; tab-size: 4; }
.gutter {
  width: 44px;
  background: #0d1226;
  color: #64748b;
  text-align: right;
  padding-right: 8px;
  overflow: hidden;
  user-select: none;
  white-space: pre;
  flex: none;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.code-area { position: relative; flex: 1; min-width: 0; }
.hl, #code {
  position: absolute;
  inset: 0;
  margin: 0;
  padding-left: 14px;
  padding-right: 14px;
  white-space: pre;
  overflow: auto;
  border: 0;
}
.hl { pointer-events: none; color: #f8fafc; overflow: hidden; }
#code {
  background: transparent;
  color: transparent;
  caret-color: #60a5fa;
  resize: none;
  outline: none;
}
#code::selection { background: rgba(96, 165, 250, 0.3); color: transparent; }

/* Syntax Highlight Colors */
.tk-kw { color: #f472b6; font-weight: 700; }
.tk-str { color: #a3e635; }
.tk-num { color: #fbbf24; }
.tk-com { color: #94a3b8; font-style: italic; }
.tk-mac { color: #38bdf8; font-weight: 700; }
.tk-ty { color: #34d399; }
.tk-lt { color: #fb923c; }

/* Right Pane: Tabs & CodeHS Test Cases */
.right-tabs {
  display: flex;
  background: #fbf7f4;
  border-bottom: 1.5px solid var(--border);
  flex: none;
}
.right-tabs button {
  flex: 1;
  background: none;
  border: 0;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.right-tabs button.on {
  color: var(--navy);
  background: #fff;
  border-bottom-color: var(--navy);
}

.tab { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: none; }
.tab.on { display: block; }

.stdin-box {
  width: 100%;
  height: 64px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 13px;
  resize: vertical;
  outline: none;
  margin-bottom: 10px;
}
.console-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kbd-shortcut-label { font-size: 11px; font-family: var(--font-mono); color: var(--muted); }

.out {
  background: var(--navy);
  color: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}
.out .e { color: #f87171; }

.diag-card {
  margin-top: 14px;
  background: #eff6ff;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--blue-cta);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.diag-head { font-weight: 800; color: var(--navy); font-size: 13.5px; margin-bottom: 4px; }
.diag-tip { font-size: 13px; color: #1e3a8a; line-height: 1.45; }

/* Test Cases UI (CodeHS Style) */
.test-summary-initial, .test-summary-grading, .test-summary-pass, .test-summary-fail {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  margin-bottom: 14px;
}
.test-summary-initial { background: #ffffff; color: var(--muted); }
.test-summary-grading { background: var(--pastel-blue); color: #0369a1; }
.test-summary-pass { background: var(--ok-bg); border-left: 5px solid var(--ok); color: #14532d; }
.test-summary-fail { background: var(--err-bg); border-left: 5px solid var(--err); color: #7f1d1d; }
.summary-title { font-weight: 900; font-size: 15px; margin-bottom: 2px; }
.summary-desc { font-size: 13px; line-height: 1.4; }
.summary-actions { margin-top: 10px; }
.celebration-btn { width: 100%; justify-content: center; padding: 10px 16px; font-size: 14px; }

.results-list { display: flex; flex-direction: column; gap: 12px; }
.test-case-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}
.test-case-card.pass { border-left: 5px solid var(--ok); }
.test-case-card.fail { border-left: 5px solid var(--err); }
.test-case-card.pending { border-left: 5px solid #cbd5e1; }

.test-case-header {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fbf7f4;
  border-bottom: 1px solid var(--border-light);
}
.test-case-card.pass .test-case-header { background: #f0fdf4; }
.test-case-card.fail .test-case-header { background: #fef2f2; }

.badge-status {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.status-pending { background: #e2e8f0; color: #475569; }
.status-pass { background: var(--ok-bg); color: var(--ok); }
.status-fail { background: var(--err-bg); color: var(--err); }

.test-case-body { padding: 12px; }
.test-pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  border: 1px solid var(--border-light);
}
.test-in { background: #f8fafc; color: #334155; }
.test-exp { background: var(--navy); color: #fff; }
.test-got { background: var(--navy); color: #fff; }
.test-got.match { border-color: var(--ok); background: #064e3b; color: #ecfdf5; }
.test-got.mismatch { border-color: var(--err); background: #450a0a; color: #fef2f2; }
.pending-text { color: #94a3b8; font-style: italic; background: #f8fafc; }
.test-diff-hint { margin-top: 6px; padding: 6px 10px; background: var(--yellow-light); border: 1px solid #fde68a; font-size: 12px; color: #92400e; }

/* Bottom Lesson Bar */
.lessonbar {
  flex: none;
  height: 50px;
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  overflow-x: auto;
}
.lessonbar .unit-sel {
  background: #1b2347;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 10px;
  border-radius: var(--radius);
  max-width: 280px;
  font-size: 13px;
  outline: none;
}
.pills { display: flex; gap: 6px; align-items: center; }
.pill {
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #1b2347;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.pill.done { background: var(--yellow); color: var(--navy); font-weight: 900; }
.pill.cur { background: var(--blue-cta); color: #fff; outline: 2px solid #fff; }
.lessonbar a.nav { color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 700; }
.lessonbar a.nav:hover { color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .resume-card-body { flex-direction: column; align-items: flex-start; }
  .export-card { flex-direction: column; align-items: flex-start; }
  .clean-footer-wrap { flex-direction: column; }
  .workspace { display: block; height: auto; }
  .gutter-h { display: none; }
  .pane { width: 100% !important; border: 0; border-bottom: 1.5px solid var(--border); }
  .editor { height: 440px; flex: none; }
  .docs-entries-grid { grid-template-columns: 1fr; }
}
