/* ── CEH v13 Study Lab ── */
/* Custom cybersec theme: dark + cyan/emerald accents */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #1a1b26;
  --bg2:       #1f2033;
  --bg3:       #292a3e;
  --border:    #33354a;
  --text:      #cdd6f4;
  --text-muted:#6c7086;
  --accent:    #a6e3a1;
  --accent2:   #94e2d5;
  --green:     #a6e3a1;
  --green2:    #94e2d5;
  --red:       #f38ba8;
  --yellow:    #f9e2af;
  --purple:    #cba6f7;
  --code-bg:   #11111b;
  --sidebar-w: 240px;
  --topbar-h:  52px;
  --radius:    8px;
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
  --card-bg:   var(--bg2);
}

/* ── HEAP THEME ── */
:root[data-theme="heap"] {
  --bg:        #0d0a0a;
  --bg2:       #1a1111;
  --bg3:       #2d1b1b;
  --border:    #3d1f1f;
  --accent:    #ff4444;
  --accent2:   #ff6b6b;
  --green:     #ff8c00;
  --green2:    #ffa733;
  --purple:    #ff6b9d;
  --code-bg:   #120c0c;
  --card-bg:   var(--bg2);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: none; align-items: center; gap: 12px;
  padding: 0 16px;
}
.topbar-title { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-title .brand { color: var(--accent); font-weight: 700; }
.topbar-title .sep { color: var(--text-muted); margin: 0 4px; }

.menu-btn, .search-btn {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  transition: color .2s, background .2s;
}
.menu-btn:hover, .search-btn:hover { color: var(--text); background: var(--bg3); }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; transition: transform .2s, opacity .2s; }
.menu-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform .3s ease, width .3s ease;
}
/* Collapsed state (desktop) */
body.sidebar-collapsed .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
body.sidebar-collapsed .main { margin-left: 0; }
body.sidebar-collapsed .sidebar-toggle-btn { left: 0; }

/* Sidebar collapse toggle (desktop only) */
.sidebar-toggle-btn {
  display: none; /* hidden on mobile, shown on desktop */
  position: fixed; top: 12px; left: var(--sidebar-w); z-index: 91;
  width: 24px; height: 24px; border-radius: 0 4px 4px 0;
  background: var(--bg2); border: 1px solid var(--border); border-left: none;
  color: var(--text-muted); cursor: pointer; align-items: center; justify-content: center;
  transition: left .3s ease, color .15s;
  font-size: 12px; padding: 0;
}
.sidebar-toggle-btn:hover { color: var(--accent); }
body.sidebar-collapsed .sidebar-toggle-btn { left: 0; border-left: 1px solid var(--border); border-radius: 0 4px 4px 0; }
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.logo-bracket { color: var(--accent); font-family: var(--mono); font-size: 22px; font-weight: 700; }
.logo-text { color: var(--text); font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: 3px; }
.subtitle { font-size: 11px; color: var(--text-muted); letter-spacing: .5px; }

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.sidebar-search svg { color: var(--text-muted); flex-shrink: 0; }
.sidebar-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 13px;
}
.sidebar-search input::placeholder { color: var(--text-muted); }

.sidebar-nav-section { padding: 4px 0; overflow: hidden; }
.sidebar-nav-section:first-of-type { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.nav-section-label {
  padding: 10px 16px 6px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  flex-shrink: 0;
}
.module-nav {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.module-nav::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.nav-item { border-bottom: 1px solid transparent; }
.nav-module-btn {
  width: 100%; background: none; border: none;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer;
  color: var(--text-muted); font-family: var(--font); font-size: 12px; font-weight: 500;
  text-align: left; transition: color .15s, background .15s;
  border-left: 3px solid transparent;
}
.nav-module-btn:hover { color: var(--text); background: var(--bg3); }
.nav-item.active .nav-module-btn { color: var(--text); border-left-color: var(--accent); background: rgba(166,227,161,.08); }
.nav-num { font-family: var(--mono); font-size: 11px; color: var(--accent); min-width: 20px; flex-shrink: 0; }
.nav-title { flex: 1; font-size: 12px; line-height: 1.3; }
.nav-badge {
  font-size: 9px; font-family: var(--mono); color: var(--text-muted);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 5px; white-space: nowrap; flex-shrink: 0;
}
.nav-badge.done { color: var(--green); border-color: var(--green); background: rgba(166,227,161,.1); }
.nav-progress-bar { height: 2px; background: var(--bg3); margin: 0 12px 3px; border-radius: 1px; overflow: hidden; }
.nav-progress-fill { height: 100%; background: var(--green); border-radius: 1px; transition: width .4s ease; }

/* ── NAV ACTION BUTTONS ── */
.nav-action-btn {
  width: 100%; background: none; border: none;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer;
  color: var(--text-muted); font-family: var(--font); font-size: 13px; font-weight: 500;
  text-align: left; transition: color .15s, background .15s;
}
.nav-action-btn:hover { color: var(--accent2); background: var(--bg3); }
.nav-action-btn.active { color: var(--accent); background: rgba(166,227,161,.08); }
.nav-action-btn svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.progress-summary { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.reset-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11px; font-family: var(--font); padding: 4px 10px; border-radius: 4px;
  cursor: pointer; transition: all .2s;
}
.reset-btn:hover { border-color: var(--red); color: var(--red); }

/* ── MAIN ── */
.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .3s ease; }
.content-area { max-width: 820px; margin: 0 auto; padding: 48px 40px 120px; }

/* ── OVERLAY ── */
.overlay {
  display: none; position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.6); backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* ── READING PROGRESS ── */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 3px; background: linear-gradient(90deg, var(--accent), var(--green));
  width: 0; transition: width .1s;
}

/* ── LANDING ── */
.landing { padding-top: 20px; animation: fadeIn .3s ease; }
.landing-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  background: rgba(166,227,161,.1); border: 1px solid rgba(166,227,161,.3);
  color: var(--accent2); font-size: 12px; font-weight: 600;
  font-family: var(--mono); letter-spacing: .5px; margin-bottom: 20px;
}
.landing-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; line-height: 1.15; margin-bottom: 16px; }
.landing-sub { color: var(--text-muted); font-size: 16px; max-width: 560px; margin-bottom: 32px; line-height: 1.6; }

/* ── LANDING STATS ── */
.landing-stats { display: flex; gap: 14px; margin-bottom: 32px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  flex: 1; min-width: 100px; text-align: center;
}
.stat-num { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── LANDING ACTIONS ── */
.landing-actions { display: flex; gap: 12px; margin-bottom: 48px; flex-wrap: wrap; }
.action-btn {
  padding: 12px 28px; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s; border: none;
}
.action-btn.primary {
  background: var(--accent); color: #0a0e17;
}
.action-btn.primary:hover { background: var(--accent2); transform: translateY(-1px); }
.action-btn.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.action-btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

.grid-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); }

/* ── MODULE GRID ── */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.module-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: border-color .2s, transform .15s, background .2s;
  display: block;
}
.module-card:hover { border-color: var(--accent); background: var(--bg3); transform: translateY(-2px); }
.card-number { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-bottom: 8px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.card-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.card-bar { height: 2px; background: var(--bg3); border-radius: 1px; overflow: hidden; margin-bottom: 4px; }
.card-bar-fill { height: 100%; background: var(--green); border-radius: 1px; transition: width .4s ease; }
.card-pct { font-size: 10px; color: var(--text-muted); font-family: var(--mono); }

/* ── MODULE VIEW ── */
.module-view { animation: fadeIn .25s ease; }
.back-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; font-family: var(--font); padding: 5px 12px; border-radius: 6px;
  cursor: pointer; margin-bottom: 20px; transition: all .2s;
}
.back-btn:hover { border-color: var(--text-muted); color: var(--text); }
.module-meta-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.module-num-badge { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.module-title-h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 700; line-height: 1.2; }
.module-submeta { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }
.source-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.source-pill {
  font-size: 11px; font-family: var(--mono);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-muted); padding: 2px 8px; border-radius: 4px;
}

/* ── SECTION BLOCK ── */
.section-block { margin-bottom: 48px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.section-block:last-of-type { border-bottom: none; }
.section-block.read .section-title { color: var(--text-muted); }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-title { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.mark-read-btn {
  flex-shrink: 0; background: none; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; font-family: var(--font);
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.mark-read-btn:hover { border-color: var(--green); color: var(--green); }
.mark-read-btn.read { border-color: var(--green); color: var(--green); background: rgba(166,227,161,.1); }

/* ── CONTENT TYPOGRAPHY ── */
.section-body h3 { font-size: 1rem; font-weight: 600; color: var(--accent2); margin: 24px 0 10px; }
.section-body h4 { font-size: .9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin: 20px 0 8px; }
.section-body p { margin-bottom: 14px; color: #c9d1d9; }
.section-body strong { color: var(--text); }
.section-body em { color: var(--text-muted); font-style: italic; }
.section-body ul, .section-body ol { padding-left: 20px; margin-bottom: 14px; }
.section-body li { margin-bottom: 5px; color: #c9d1d9; }
.section-body li strong { color: var(--text); }
.section-body a { color: var(--accent); text-decoration: none; }
.section-body a:hover { text-decoration: underline; }
.section-body hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ── TABLES ── */
.section-body table {
  width: 100%; border-collapse: collapse; margin: 18px 0 22px;
  font-size: 13.5px; overflow: hidden; border-radius: 6px;
  border: 1px solid var(--border);
}
.section-body th {
  background: var(--bg3); color: var(--text); font-weight: 600;
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
}
.section-body td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.section-body tr:last-child td { border-bottom: none; }
.section-body tr:hover td { background: rgba(166,227,161,.04); }

/* ── CODE ── */
.section-body pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 14px 0 20px;
  overflow-x: auto; position: relative;
}
.section-body pre code {
  font-family: var(--mono); font-size: 13px; color: #c9d1d9; line-height: 1.6;
  background: none; padding: 0; border: none; border-radius: 0;
}
.section-body code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--bg3); color: var(--accent2);
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11px; font-family: var(--font); padding: 3px 8px; border-radius: 4px;
  cursor: pointer; transition: all .2s; opacity: 0;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

/* ── CALLOUT BLOCKS ── */
.callout {
  border-left: 3px solid var(--accent); background: rgba(166,227,161,.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px; margin: 16px 0; font-size: 14px;
}
.callout.info { border-color: var(--purple); background: rgba(167,139,250,.06); }
.callout.success { border-color: var(--green); background: rgba(166,227,161,.06); }
.callout.warn { border-color: var(--yellow); background: rgba(245,158,11,.06); }
.callout.danger { border-color: var(--red); background: rgba(239,68,68,.06); }

/* ── MODULE NAV FOOTER ── */
.module-nav-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 60px; padding-top: 28px; border-top: 1px solid var(--border); gap: 12px;
}
.nav-arrow {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 10px 16px; border-radius: var(--radius); cursor: pointer;
  transition: all .2s; flex: 1; max-width: 260px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-arrow:hover { border-color: var(--accent); background: var(--bg3); }
.nav-arrow.next { margin-left: auto; justify-content: flex-end; text-align: right; }

/* ── QUIZ / EXAM VIEW ── */
.quiz-view { animation: fadeIn .25s ease; }

.quiz-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 12px;
}
.quiz-title { font-size: 1.4rem; font-weight: 700; }
.quiz-meta { display: flex; gap: 16px; align-items: center; }
.quiz-timer {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  color: var(--accent); padding: 6px 14px;
  background: rgba(166,227,161,.1); border: 1px solid rgba(166,227,161,.3);
  border-radius: var(--radius);
}
.quiz-timer.warning { color: var(--yellow); border-color: var(--yellow); background: rgba(245,158,11,.1); }
.quiz-timer.danger { color: var(--red); border-color: var(--red); background: rgba(239,68,68,.1); }
.quiz-counter { font-size: 13px; color: var(--text-muted); font-family: var(--mono); }

.quiz-progress-bar { height: 4px; background: var(--bg3); border-radius: 2px; margin-bottom: 32px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 2px; transition: width .3s ease; }

/* ── QUESTION CARD ── */
.question-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-bottom: 24px;
}
.question-num { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.question-text { font-size: 15px; line-height: 1.7; margin-bottom: 20px; color: var(--text); }
.question-module-tag {
  display: inline-block; font-size: 10px; font-family: var(--mono);
  background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted);
  padding: 2px 8px; border-radius: 4px; margin-bottom: 12px;
}

.option-list { list-style: none; padding: 0; }
.option-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; margin-bottom: 8px;
  background: var(--bg3); border: 2px solid transparent;
  border-radius: var(--radius); cursor: pointer;
  transition: all .15s; font-size: 14px;
}
.option-item:hover { border-color: var(--border); background: rgba(30,58,95,.5); }
.option-item.selected { border-color: var(--accent); background: rgba(166,227,161,.08); }
.option-item.correct { border-color: var(--green); background: rgba(166,227,161,.08); }
.option-item.wrong { border-color: var(--red); background: rgba(239,68,68,.08); }
.option-letter {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border);
  flex-shrink: 0; transition: all .15s;
}
.option-item.selected .option-letter { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.option-item.correct .option-letter { background: var(--green); color: var(--bg); border-color: var(--green); }
.option-item.wrong .option-letter { background: var(--red); color: white; border-color: var(--red); }
.option-text { flex: 1; padding-top: 3px; }

.explanation {
  margin-top: 16px; padding: 14px 16px;
  background: rgba(166,227,161,.06); border-left: 3px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px; color: #c9d1d9; display: none;
}
.explanation.show { display: block; }

/* ── QUIZ NAVIGATION ── */
.quiz-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; gap: 12px;
}
.quiz-btn {
  padding: 10px 24px; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s; border: none;
}
.quiz-btn.primary { background: var(--accent); color: var(--bg); }
.quiz-btn.primary:hover { background: var(--accent2); }
.quiz-btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.quiz-btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.quiz-btn:disabled { opacity: .4; cursor: not-allowed; }
.quiz-btn.danger { background: var(--red); color: white; }
.quiz-btn.danger:hover { opacity: .9; }

/* ── QUESTION MAP ── */
.question-map {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0;
}
.qmap-dot {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s; color: var(--text-muted);
}
.qmap-dot:hover { border-color: var(--accent); }
.qmap-dot.answered { background: rgba(166,227,161,.15); border-color: var(--accent); color: var(--accent); }
.qmap-dot.current { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.qmap-dot.correct { background: rgba(166,227,161,.2); border-color: var(--green); color: var(--green); }
.qmap-dot.wrong { background: rgba(239,68,68,.2); border-color: var(--red); color: var(--red); }

/* ── RESULTS VIEW ── */
.results-view { animation: fadeIn .3s ease; }
.results-header { text-align: center; margin-bottom: 40px; }
.results-score {
  font-family: var(--mono); font-size: 72px; font-weight: 700;
  margin: 16px 0 8px;
}
.results-score.pass { color: var(--green); }
.results-score.fail { color: var(--red); }
.results-verdict { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.results-detail { color: var(--text-muted); font-size: 14px; }

.results-breakdown {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin: 32px 0;
}
.breakdown-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.breakdown-num { font-family: var(--mono); font-size: 28px; font-weight: 700; }
.breakdown-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; }

/* ── PRACTICE MODE SELECTOR ── */
.practice-selector {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-top: 20px;
}
.practice-module-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all .2s;
}
.practice-module-card:hover { border-color: var(--accent); background: var(--bg3); }
.practice-module-card .pm-num { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.practice-module-card .pm-title { font-size: 13px; font-weight: 600; margin: 6px 0 4px; }
.practice-module-card .pm-count { font-size: 11px; color: var(--text-muted); }

/* ── SEARCH OVERLAY ── */
.search-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,14,23,.9); backdrop-filter: blur(8px);
  flex-direction: column; align-items: center; padding-top: 80px;
}
.search-overlay.show { display: flex; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; width: min(600px, 90vw);
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 16px;
}
.search-box input::placeholder { color: var(--text-muted); }
#searchClose { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; }
.search-results {
  width: min(600px, 90vw); margin-top: 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.search-result-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg3); }
.sr-module { font-size: 11px; color: var(--accent); margin-bottom: 3px; }
.sr-section { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.sr-snip { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.sr-snip mark { background: rgba(166,227,161,.25); color: var(--accent2); border-radius: 2px; }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── BACK TO TOP ── */
.back-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text-muted);
  width: 40px; height: 40px; border-radius: 50%; font-size: 16px;
  cursor: pointer; display: none; align-items: center; justify-content: center;
  transition: all .2s; box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.back-top.show { display: flex; }
.back-top:hover { color: var(--text); border-color: var(--accent); }

/* ── RESPONSIVE ── */
/* Show sidebar collapse button on desktop */
@media (min-width: 769px) {
  .sidebar-toggle-btn { display: flex; }
}

@media (max-width: 768px) {
  .topbar { display: flex; }
  .sidebar { top: var(--topbar-h); transform: translateX(-100%); z-index: 95; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle-btn { display: none !important; }
  .main { margin-left: 0; padding-top: var(--topbar-h); }
  .content-area { padding: 28px 20px 80px; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .module-nav-footer { flex-direction: column; }
  .nav-arrow { max-width: 100%; }
  .landing-stats { gap: 8px; }
  .stat-card { padding: 12px; min-width: 70px; }
  .stat-num { font-size: 20px; }
  .question-card { padding: 20px; }
}

@media (max-width: 480px) {
  .module-grid, .practice-selector { grid-template-columns: 1fr; }
  .section-body pre { font-size: 12px; }
  .copy-btn { opacity: 1; }
  .landing-stats { flex-direction: row; flex-wrap: wrap; }
  .stat-card { flex: 1 1 40%; }
}

/* ── MERMAID DIAGRAMS ── */
.mermaid {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  text-align: center;
  overflow-x: auto;
  cursor: zoom-in;
  position: relative;
}
.mermaid::after {
  content: '🔍 Tap to zoom';
  position: absolute; top: 6px; right: 10px;
  font-size: 10px; color: var(--text-muted); opacity: 0.5;
  pointer-events: none;
}
.mermaid:hover::after { opacity: 1; }

/* Fullscreen diagram overlay */
.diagram-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.diagram-overlay.show { opacity: 1; pointer-events: all; }
.diagram-overlay .diagram-inner {
  max-width: 95vw; max-height: 90vh;
  overflow: auto; touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
  transform-origin: center center;
  padding: 20px;
}
.diagram-overlay .diagram-inner svg {
  max-width: none !important; width: auto !important;
  min-width: 600px; height: auto !important;
}
.diagram-close {
  position: fixed; top: 16px; right: 20px; z-index: 9999;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 50%;
  font-size: 18px; cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.diagram-overlay.show + .diagram-close,
.diagram-overlay.show ~ .diagram-close { display: flex; }
.diagram-zoom-controls {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: none; gap: 8px;
}
.diagram-overlay.show ~ .diagram-zoom-controls { display: flex; }
.diagram-zoom-btn {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); width: 40px; height: 40px; border-radius: 8px;
  font-size: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.diagram-zoom-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── THEME TOGGLE ── */
.theme-toggle-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; margin-bottom: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 0.8em; cursor: pointer; transition: all 0.2s;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle-btn svg { flex-shrink: 0; }

/* ── MIKE BADGE ── */
.mike-badge {
  display: inline-block;
  font-size: 0.65em;
  font-weight: 600;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── EXAM CONFIG ── */
.exam-config-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 560px;
  animation: fadeIn 0.3s ease;
}
.exam-config-card h3 {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 4px;
}
.config-section { margin-bottom: 8px; }
.source-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.source-toggle:hover { border-color: var(--accent); background: rgba(166,227,161,0.04); }
.source-toggle input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent);
  flex-shrink: 0; cursor: pointer;
}
.source-toggle input[type="checkbox"]:disabled { opacity: 0.6; cursor: default; }
.toggle-label { display: flex; flex-direction: column; gap: 2px; }
.toggle-label strong { font-size: 0.95em; }
.toggle-count {
  font-size: 0.8em; font-weight: 600; color: var(--accent);
  background: rgba(166,227,161,0.1); padding: 2px 8px; border-radius: 10px;
  display: inline-block; width: fit-content; margin-top: 2px;
}
.toggle-desc { font-size: 0.8em; color: var(--text-muted); margin-top: 2px; }
.config-summary {
  font-size: 0.9em; color: var(--text-muted); text-align: center;
  padding: 10px; background: rgba(166,227,161,0.05); border-radius: 8px;
}
.config-summary strong { color: var(--text); }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
