/* ═══════════════════════════════════════════════════════════
   DART ZERO TO EXPERT — Complete Stylesheet
   Author: Ramanpreet Singh Raina
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables / Theming ─────────────────────────────── */
:root {
  --primary:       #0175C2;
  --primary-d:     #01579B;
  --accent:        #54C5F8;
  --success:       #00C853;
  --warning:       #FFD600;
  --danger:        #FF5252;

  --bg:            #FFFFFF;
  --bg-alt:        #F8F9FA;
  --bg-card:       #FFFFFF;
  --bg-code:       #1E1E2E;
  --bg-sidebar:    #0D1117;

  --text:          #0D1117;
  --text-muted:    #6B7280;
  --text-faint:    #9CA3AF;
  --text-code:     #CDD6F4;

  --border:        #E5E7EB;
  --border-light:  #F3F4F6;

  --sidebar-w:     272px;
  --header-h:      60px;
  --strip-h:       0px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --transition:    0.2s ease;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="dark"] {
  --bg:            #0D1117;
  --bg-alt:        #161B22;
  --bg-card:       #161B22;
  --bg-code:       #1A1B26;
  --bg-sidebar:    #0A0D13;

  --text:          #E6EDF3;
  --text-muted:    #8B949E;
  --text-faint:    #484F58;

  --border:        #30363D;
  --border-light:  #21262D;

  --shadow:        0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.4);
}

/* ════════════════════════════════════════════════════════════
   AUTHOR STRIP — fixed top, every screen
   ════════════════════════════════════════════════════════════ */
#authorStrip {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--strip-h);
  z-index: 9999;
  background: linear-gradient(90deg, #010E1F 0%, #012D5C 50%, #010E1F 100%);
  border-bottom: 1px solid rgba(84,197,248,.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}
.strip-left {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex-shrink: 1;
}
.strip-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #0175C2, #54C5F8);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: white;
}
.strip-name {
  font-size: 12.5px; font-weight: 700;
  color: white; white-space: nowrap;
  text-decoration: none;
}
.strip-name:hover { color: #54C5F8; text-decoration: none; }
.strip-sep { color: rgba(255,255,255,.2); font-size: 12px; }
.strip-title { font-size: 11px; color: rgba(255,255,255,.45); white-space: nowrap; }

.strip-links {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.strip-link {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.6);
  text-decoration: none; border: 1px solid rgba(255,255,255,.1);
  transition: all var(--transition); white-space: nowrap;
}
.strip-link:hover { color: #54C5F8; border-color: rgba(84,197,248,.5); text-decoration: none; }
.strip-link svg { flex-shrink: 0; }

.strip-cta {
  display: none; /* hidden on desktop — shown only on mobile */
  align-items: center; gap: 8px;
  flex-shrink: 0;
}
.strip-cta-text {
  font-size: 11px; color: rgba(255,255,255,.45);
  white-space: nowrap;
}
.strip-follow-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 13px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  color: white; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
}
.strip-follow-btn:hover { transform: translateY(-1px); text-decoration: none; }
.strip-follow-gh { background: #24292e; border: 1px solid rgba(255,255,255,.2); }
.strip-follow-gh:hover { background: #333; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.strip-follow-li { background: #0A66C2; border: 1px solid rgba(255,255,255,.2); }
.strip-follow-li:hover { background: #0958a8; box-shadow: 0 4px 12px rgba(10,102,194,.5); }
.strip-follow-web {
  background: linear-gradient(135deg, #0175C2, #54C5F8);
  border: 1px solid rgba(255,255,255,.25);
}
.strip-follow-web:hover { box-shadow: 0 4px 14px rgba(84,197,248,.38); }

/* Push everything below the strip */
/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: clip;
  transition: background var(--transition), color var(--transition);
  padding-top: var(--strip-h);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { font-family: var(--font-sans); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  left: 0; top: var(--strip-h); bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition);
}

/* Logo */
.sidebar-top { padding: 14px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white; flex-shrink: 0;
  overflow: hidden;
}
.logo-icon img { width: 100%; height: 100%; display: block; }
.logo-text-wrap { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { font-size: 14px; font-weight: 700; color: #fff; }
.logo-sub   { font-size: 10px; color: rgba(255,255,255,.4); font-weight: 400; letter-spacing: .5px; }

/* Progress Ring */
.sidebar-progress {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.progress-ring-svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.progress-ring-bg  { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 4; }
.progress-ring-circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.progress-ring-text {
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,.85);
  margin-top: -4px;
}
.sidebar-progress-label { font-size: 10px; color: rgba(255,255,255,.35); letter-spacing: .3px; }

/* Nav */
.sidebar-nav { flex: 1; padding: 8px 0 12px; overflow-y: auto; }
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar-nav-link:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar-nav-link.active { color: var(--accent); border-left: 2px solid var(--accent); background: rgba(84,197,248,.07); }
.snl-icon { font-size: 14px; width: 18px; text-align: center; }

.sidebar-section-label {
  padding: 16px 16px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.22);
  text-transform: uppercase;
}

/* Chapter Accordion */
.sidebar-chapter { border-bottom: 1px solid rgba(255,255,255,.04); }
.chapter-accordion-toggle {
  width: 100%; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  color: rgba(255,255,255,.65);
  font-size: 12.5px; font-weight: 500;
  transition: all var(--transition);
  text-align: left; font-family: var(--font-sans);
}
.chapter-accordion-toggle:hover { color: #fff; background: rgba(255,255,255,.05); }
.ch-num-badge {
  width: 22px; height: 22px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; flex-shrink: 0;
  color: white; background: var(--primary);
}
.ch-acc-name { flex: 1; }
.ch-acc-prog {
  font-size: 9px; font-weight: 700;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.45);
  padding: 1px 5px; border-radius: 99px; white-space: nowrap;
}
.accordion-arrow {
  font-size: 14px; color: rgba(255,255,255,.3);
  transition: transform var(--transition);
}
.accordion-arrow.rotated { transform: rotate(90deg); }

.accordion-content { padding: 2px 0 6px; background: rgba(0,0,0,.15); }
.accordion-content.collapsed { display: none; }

.lesson-nav-link {
  display: block;
  padding: 7px 16px 7px 46px;
  font-size: 12px;
  color: rgba(255,255,255,.42);
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}
.lesson-nav-link::before {
  content: '';
  position: absolute;
  left: 34px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
}
.lesson-nav-link:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.04); text-decoration: none; }
.lesson-nav-link.active { color: var(--accent); }
.lesson-nav-link.active::before { background: var(--accent); }
.lesson-nav-link.lesson-done { color: rgba(0,200,83,.65); }
.lesson-nav-link.lesson-done::before { background: var(--success); }
.lesson-nav-link.nav-exercises { color: rgba(255,109,0,.65); }
.lesson-nav-link.nav-quiz      { color: rgba(84,197,248,.65); }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-author-link {
  font-size: 11px; font-weight: 500;
  color: rgba(255,255,255,.35);
  display: block;
  text-decoration: none;
  transition: color var(--transition);
}
.sidebar-author-link:hover { color: var(--accent); text-decoration: none; }

/* Sidebar collapse button */
.sidebar-collapse-btn {
  width: 26px; height: 26px; flex-shrink: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.4);
  transition: all var(--transition); margin-left: auto;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.8); }
.sidebar-collapse-btn svg { transition: transform var(--transition); }

/* Collapsed sidebar */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed ~ .main-wrapper { margin-left: 60px; }
.sidebar.collapsed .logo-text-wrap,
.sidebar.collapsed .sidebar-progress,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .ch-acc-name,
.sidebar.collapsed .ch-acc-prog,
.sidebar.collapsed .accordion-arrow,
.sidebar.collapsed .accordion-content,
.sidebar.collapsed .snl-text { display: none; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-top { justify-content: center; }
.sidebar.collapsed .logo { justify-content: center; }
.sidebar.collapsed .sidebar-nav-link { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .snl-icon { width: auto; text-align: center; }
.sidebar.collapsed .chapter-accordion-toggle { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .ch-num-badge { margin: 0; }

/* Mobile backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.visible { display: block; }

/* ════════════════════════════════════════════════════════════
   MAIN WRAPPER + HEADER
   ════════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: rgba(var(--bg), 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg);
}
[data-theme="dark"] .app-header { background: rgba(13,17,23,.94); }

.menu-btn { display: none; }
.btn-icon {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); background: var(--bg-alt); }
.btn-icon svg { width: 16px; height: 16px; pointer-events: none; }

.search-trigger {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font-sans);
  color: var(--text-faint);
  font-size: 13.5px;
}
.search-trigger:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(1,117,194,.1); }
.search-trigger svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-faint); }
.search-trigger-text { flex: 1; text-align: left; }
.search-trigger-text kbd {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
  font-size: 11px; font-family: var(--font-mono);
  color: var(--text-muted);
}

.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn-pdf-export {
  padding: 7px 14px;
  background: var(--primary);
  color: white; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-pdf-export:hover { background: var(--primary-d); transform: translateY(-1px); }

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0; cursor: default;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 28px 32px 80px;
  width: 100%;
  min-width: 0;
}

/* ════════════════════════════════════════════════════════════
   SEARCH OVERLAY
   ════════════════════════════════════════════════════════════ */
.search-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
.search-overlay.open { display: flex; }

.search-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-modal-icon { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; background: none;
  font-size: 15px; color: var(--text);
  font-family: var(--font-sans); outline: none;
}
.search-input::placeholder { color: var(--text-faint); }

.search-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.search-chip {
  padding: 3px 10px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 99px; font-size: 11.5px; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  font-family: var(--font-sans);
}
.search-chip:hover, .search-chip.active {
  background: var(--primary); border-color: var(--primary); color: white;
}

.search-results { max-height: 400px; overflow-y: auto; padding: 8px 0; }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  text-decoration: none; color: var(--text);
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-alt); text-decoration: none; }
.sr-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.sr-info { flex: 1; min-width: 0; }
.sr-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub   { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-chapter { font-size: 11px; color: var(--text-faint); white-space: nowrap; }

/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  color: white; background: #333;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: #00897B; }
.toast-error   { background: #C62828; }
.toast-info    { background: var(--primary); }

/* ════════════════════════════════════════════════════════════
   SHARED BUTTONS & COMPONENTS
   ════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: var(--primary-d); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(1,117,194,.35); text-decoration: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none;
}
.btn-secondary:hover { background: var(--border); text-decoration: none; }

/* Page header used by exercises, mega, interview, answers */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.page-header p { color: var(--text-muted); font-size: 14px; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 24px; }
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dashboard-header .page-title { margin-bottom: 0; }
.btn-reset-progress {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,82,82,.32);
  background: rgba(255,82,82,.08);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-reset-progress:hover {
  background: rgba(255,82,82,.16);
  border-color: rgba(255,82,82,.58);
}

/* Breadcrumb */
.breadcrumb, .lesson-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px;
}
.breadcrumb-link { color: var(--primary); text-decoration: none; }
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-faint); }

/* Code block */
.code-block {
  position: relative;
  background: var(--bg-code);
  border-radius: var(--radius);
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
}
.code-label {
  padding: 8px 16px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  color: rgba(255,255,255,.35); text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.2);
}
.code-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; z-index: 2;
}
.copy-btn, .dartpad-btn {
  width: 28px; height: 28px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.5);
  transition: all var(--transition);
}
.copy-btn:hover, .dartpad-btn:hover {
  background: rgba(255,255,255,.18); color: #fff;
}
.copy-btn svg, .dartpad-btn svg { width: 14px; height: 14px; }

.code-block pre {
  margin: 0; padding: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.code-block code {
  font-family: var(--font-mono);
  font-size: 13.5px; line-height: 1.65;
  color: var(--text-code);
  white-space: pre;
  display: block;
  min-width: max-content;
}

/* Syntax highlight */
.kw  { color: #CBA6F7; } /* purple — keywords */
.str { color: #A6E3A1; } /* green  — strings */
.num { color: #FAB387; } /* orange — numbers */
.cmt { color: #6C7086; font-style: italic; } /* gray — comments */
.cls { color: #F38BA8; } /* red   — types */
.fn  { color: #89DCEB; } /* cyan  — functions */
.ann { color: #F9E2AF; } /* yellow — annotations */

/* Output block */
.output-block {
  background: rgba(0,200,83,.06);
  border: 1px solid rgba(0,200,83,.2);
  border-radius: var(--radius);
  margin: 0 0 16px;
  overflow: hidden;
}
.output-label {
  padding: 6px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .8px;
  color: rgba(0,200,83,.7); text-transform: uppercase;
  border-bottom: 1px solid rgba(0,200,83,.15);
}
.output-block .output {
  margin: 0; padding: 12px 16px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text); line-height: 1.6; overflow-x: auto;
}

/* Callouts */
.callout {
  padding: 12px 16px; border-radius: 8px; margin: 12px 0;
  font-size: 13.5px;
}
.callout-info { background: rgba(1,117,194,.1); border-left: 3px solid var(--primary); }
.callout-warn { background: rgba(255,214,0,.1); border-left: 3px solid var(--warning); color: var(--text); }

/* Inline code */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--primary);
}
[data-theme="dark"] :not(pre) > code { background: rgba(84,197,248,.1); border-color: rgba(84,197,248,.25); color: var(--accent); }

/* Empty state */
.empty-state {
  text-align: center; padding: 80px 20px; color: var(--text-muted);
}
.empty-state h2 { font-size: 22px; margin-bottom: 10px; color: var(--text); }

/* Page entrance animation */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home-page, .lesson-page, .quiz-page, .dashboard-page,
.exercises-page, .mega-page, .interview-page, .answers-page, .chapter-page {
  animation: pageEnter 0.18s ease forwards;
}

/* Search result highlight */
mark.search-hl {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════════
   HOME PAGE
   ════════════════════════════════════════════════════════════ */
.home-hero {
  background: linear-gradient(135deg, #0A1628 0%, #0D1F3C 60%, #0A1628 100%);
  border-radius: var(--radius-lg);
  padding: 52px 44px;
  margin-bottom: 32px;
  position: relative; overflow: hidden; color: white;
}
.home-hero::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(84,197,248,.18) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-tag {
  display: inline-flex; align-items: center;
  background: rgba(84,197,248,.15);
  border: 1px solid rgba(84,197,248,.3);
  color: var(--accent);
  padding: 4px 14px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .5px;
  margin-bottom: 18px;
}
.hero-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -1px; margin-bottom: 14px;
}
.hero-desc { font-size: 15px; color: rgba(255,255,255,.7); max-width: 520px; line-height: 1.65; margin-bottom: 24px; }
.hero-author {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.hero-author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 12px;
  font-weight: 800;
}
.hero-author-copy { display: flex; flex-direction: column; line-height: 1.25; }
.hero-author-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.42);
}
.hero-author-name {
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.hero-author-name:hover { color: var(--accent); text-decoration: none; }
.hero-author-meta {
  color: rgba(255,255,255,.56);
  font-size: 11px;
  max-width: 360px;
}
.hero-stats { display: flex; gap: 28px; margin-bottom: 24px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat .stat-num { font-size: 28px; font-weight: 800; color: var(--accent); display: block; line-height: 1; }
.hero-stat .stat-label { font-size: 11px; color: rgba(255,255,255,.45); font-weight: 500; }
.hero-progress { height: 4px; background: rgba(255,255,255,.12); border-radius: 99px; margin-bottom: 6px; overflow: hidden; }
.hero-progress-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }
.hero-progress-label { font-size: 12px; color: rgba(255,255,255,.45); margin-bottom: 20px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-cta-primary {
  padding: 11px 22px; background: var(--primary); color: white;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: all var(--transition);
}
.btn-cta-primary:hover { background: var(--primary-d); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(1,117,194,.4); text-decoration: none; }
.btn-cta-secondary {
  padding: 11px 22px;
  background: rgba(255,255,255,.1); color: white;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; font-size: 14px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center;
  backdrop-filter: blur(8px); transition: all var(--transition);
}
.btn-cta-secondary:hover { background: rgba(255,255,255,.2); text-decoration: none; }
.btn-cta-website {
  border-color: rgba(84,197,248,.42);
  color: var(--accent);
}

/* Author Card */
.author-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .author-card { background: #161b22; border-color: rgba(255,255,255,.08); }
.author-card-left { display: flex; align-items: center; gap: 16px; }
.author-avatar-lg {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white;
}
.author-card-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  text-decoration: none; display: block;
}
.author-card-name:hover { color: var(--primary); text-decoration: none; }
.author-card-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.author-card-title { font-size: 12.5px; color: var(--primary); font-weight: 600; display: block; margin: 2px 0; }
.author-card-location { font-size: 11.5px; color: var(--text-muted); display: block; margin-bottom: 8px; max-width: 540px; }
.author-card-socials { display: flex; gap: 8px; flex-wrap: wrap; }
.author-social-btn {
  font-size: 11.5px; padding: 3px 10px; border-radius: 99px;
  background: var(--bg-alt); border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
  transition: all var(--transition);
}
.author-social-btn:hover { background: var(--primary); border-color: var(--primary); color: white; text-decoration: none; }
.author-social-primary { color: var(--primary); border-color: rgba(1,117,194,.35); }
.author-free-banner {
  width: 100%;
  padding: 10px 16px;
  background: rgba(0,200,83,.08);
  border: 1px solid rgba(0,200,83,.2);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}
.author-free-banner strong { color: var(--success); }
.author-free-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 8px 0 12px;
  max-width: 540px;
}
.author-card-creds { display: flex; gap: 24px; flex-wrap: wrap; }
.author-cred { text-align: center; }
.author-cred-num { display: block; font-size: 22px; font-weight: 900; color: var(--primary); line-height: 1.1; }
.author-cred-label { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 500; margin-top: 2px; white-space: nowrap; }

/* Sidebar Author Block */
.sidebar-author-block {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-author-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white;
}
.sidebar-author-details { display: flex; flex-direction: column; min-width: 0; }
.sidebar-author-name {
  font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.85);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-author-name:hover { color: var(--accent); text-decoration: none; }
.sidebar-author-title { font-size: 10px; color: var(--accent); font-weight: 600; }
.sidebar-author-tagline { font-size: 9.5px; color: rgba(255,255,255,.3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-author-links {
  display: flex; gap: 12px; align-items: center;
  padding: 6px 14px 10px;
}
.sidebar-author-links a {
  color: rgba(255,255,255,.3); text-decoration: none;
  transition: color var(--transition); display: flex;
}
.sidebar-author-links a:hover { color: var(--accent); }

/* Chapter Cards */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--ch-color, var(--primary));
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.chapter-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chapter-icon { font-size: 22px; }
.chapter-num { font-size: 11px; font-weight: 700; color: var(--text-faint); letter-spacing: 1px; text-transform: uppercase; }
.chapter-card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.chapter-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.chapter-progress-bar { height: 4px; background: var(--bg-alt); border-radius: 99px; margin-bottom: 4px; overflow: hidden; }
.chapter-progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.chapter-progress-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 14px; }
.chapter-card-actions { display: flex; gap: 8px; }
.btn-chapter-start {
  flex: 1; padding: 7px 12px;
  background: var(--primary); color: white;
  border-radius: 6px; font-size: 12.5px; font-weight: 600;
  text-align: center; text-decoration: none; transition: all var(--transition);
}
.btn-chapter-start:hover { background: var(--primary-d); text-decoration: none; }
.btn-chapter-quiz {
  padding: 7px 12px;
  background: var(--bg-alt); color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px; font-size: 12.5px; font-weight: 500;
  text-decoration: none; transition: all var(--transition);
}
.btn-chapter-quiz:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ════════════════════════════════════════════════════════════
   CHAPTER PAGE
   ════════════════════════════════════════════════════════════ */
.chapter-page {}
.chapter-header {
  padding: 24px 28px; margin-bottom: 24px;
  border-radius: var(--radius-lg);
}
.chapter-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}
.chapter-page-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.chapter-page-icon { font-size: 28px; }
.chapter-page-desc { font-size: 14px; color: var(--text-muted); }

.lesson-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 28px; }
.lesson-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: all var(--transition);
}
.lesson-list-item:hover { border-color: var(--primary); background: var(--bg-alt); transform: translateX(3px); text-decoration: none; color: var(--text); }
.lesson-list-done { border-left: 3px solid var(--success); }
.lesson-list-num {
  width: 28px; height: 28px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.lesson-list-done .lesson-list-num { background: rgba(0,200,83,.1); border-color: var(--success); color: var(--success); }
.lesson-list-info { flex: 1; }
.lesson-list-title { font-size: 14.5px; font-weight: 600; }
.lesson-list-sub { font-size: 12px; color: var(--text-muted); }
.lesson-list-check { color: var(--success); font-size: 16px; }
.chapter-footer-actions { margin-top: 8px; }

/* ════════════════════════════════════════════════════════════
   LESSON PAGE
   ════════════════════════════════════════════════════════════ */
.lesson-page { max-width: 860px; margin: 0 auto; }

.lesson-header {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}
.lesson-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 0; }
.lesson-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.lesson-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-bookmark {
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}
.btn-bookmark svg { width: 16px; height: 16px; }
.btn-bookmark:hover { border-color: var(--warning); color: var(--warning); }
.btn-bookmark.bookmarked { border-color: var(--warning); color: var(--warning); background: rgba(255,214,0,.08); }
.btn-complete {
  padding: 7px 14px;
  background: var(--bg-alt); color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-complete:hover { border-color: var(--primary); color: var(--primary); }
.btn-complete.completed { background: rgba(0,200,83,.1); border-color: var(--success); color: var(--success); }
.lesson-subtitle { font-size: 15px; color: var(--text-muted); margin-bottom: 10px; }
.lesson-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 2px 10px;
  background: rgba(1,117,194,.1);
  color: var(--primary);
  border-radius: 99px; font-size: 11.5px; font-weight: 600;
  border: 1px solid rgba(1,117,194,.2);
}

/* Lesson Sections */
.lesson-section { margin-bottom: 36px; }
.section-title {
  font-size: 20px; font-weight: 700; letter-spacing: -.3px;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-content { font-size: 14.5px; line-height: 1.75; margin-bottom: 14px; }
.section-content p { margin-bottom: 10px; }
.section-content ul, .section-content ol { padding-left: 20px; margin-bottom: 10px; }
.section-content li { margin-bottom: 4px; }

.subsection { margin: 20px 0; padding: 0 0 0 18px; border-left: 3px solid var(--border-light); }
.subsection-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; color: var(--primary); }

/* Mistakes */
.mistakes-section .section-title { color: var(--danger); }
.mistake-list { display: flex; flex-direction: column; gap: 24px; }
.mistake-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.mistake-label { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; color: var(--text-muted); }
.mistake-explanation { font-size: 13.5px; color: var(--text-muted); margin-top: 10px; }
.mistake-text { border-left: 3px solid var(--danger); padding: 10px 14px !important; }
.mistake-text p { font-size: 13.5px; margin: 0; }

/* Best Practices */
.best-practices-list {
  list-style: none; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.best-practices-list li {
  padding: 10px 14px 10px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.6;
  position: relative;
}
.best-practices-list li::before { content: '✓'; position: absolute; left: 12px; color: var(--success); font-weight: 700; }

/* Mini Quiz */
.mini-quiz-section { background: var(--bg-alt); padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.mini-quiz { margin-top: 12px; }
.quiz-question { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  padding: 10px 16px; text-align: left;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; cursor: pointer;
  transition: all var(--transition); font-family: var(--font-sans); color: var(--text);
}
.quiz-opt:hover:not(:disabled) { border-color: var(--primary); background: rgba(1,117,194,.05); }
.quiz-opt.correct { background: rgba(0,200,83,.1); border-color: var(--success); color: var(--success); }
.quiz-opt.wrong   { background: rgba(255,82,82,.1); border-color: var(--danger); color: var(--danger); }
.quiz-opt:disabled { cursor: default; }
.quiz-explanation { margin-top: 14px; padding: 12px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; line-height: 1.65; }
.quiz-explanation.hidden { display: none; }

/* Lesson Nav */
.lesson-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 0; border-top: 1px solid var(--border); margin-top: 32px; flex-wrap: wrap;
}
.btn-nav {
  padding: 10px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text);
  text-decoration: none; transition: all var(--transition); max-width: 240px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-nav:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-quiz-link {
  padding: 10px 20px;
  background: var(--primary); color: white;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all var(--transition);
}
.btn-quiz-link:hover { background: var(--primary-d); text-decoration: none; }

/* ════════════════════════════════════════════════════════════
   QUIZ PAGE
   ════════════════════════════════════════════════════════════ */
.quiz-page {}
.quiz-header { margin-bottom: 28px; }
.quiz-breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.quiz-header h1 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.quiz-desc { font-size: 14px; color: var(--text-muted); }

.quiz-question-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow);
}
.quiz-progress-bar { height: 4px; background: var(--bg-alt); border-radius: 99px; margin-bottom: 16px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: var(--primary); transition: width .3s ease; }
.quiz-count { font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.diff-badge {
  padding: 2px 8px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
}
.diff-easy   { background: rgba(0,200,83,.1); color: var(--success); }
.diff-medium { background: rgba(255,214,0,.1); color: #E6B800; }
.diff-hard   { background: rgba(255,82,82,.1); color: var(--danger); }

.quiz-q-text { font-size: 16px; font-weight: 600; line-height: 1.6; margin-bottom: 20px; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.quiz-kb-hint { margin-left: auto; font-size: 11px; color: var(--text-faint); font-style: italic; }
.quiz-option {
  padding: 12px 18px; text-align: left;
  background: var(--bg-alt); border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; cursor: pointer;
  transition: all var(--transition); font-family: var(--font-sans); color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
.quiz-opt-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  background: var(--border); color: var(--text-muted);
  font-family: var(--font-mono);
}
.quiz-option.correct .quiz-opt-key { background: rgba(0,200,83,.2); color: var(--success); }
.quiz-option.wrong   .quiz-opt-key { background: rgba(255,82,82,.2); color: var(--danger); }
.quiz-option:hover:not([disabled]) { border-color: var(--primary); background: rgba(1,117,194,.05); }
.quiz-option.correct { background: rgba(0,200,83,.1); border-color: var(--success); color: var(--success); font-weight: 600; }
.quiz-option.wrong   { background: rgba(255,82,82,.1); border-color: var(--danger); color: var(--danger); }
.quiz-option.disabled { opacity: .6; cursor: default; }
.quiz-explanation {
  margin-top: 16px; padding: 14px 18px;
  background: rgba(1,117,194,.06); border: 1px solid rgba(1,117,194,.2);
  border-radius: 8px; font-size: 13.5px; line-height: 1.65;
}
.quiz-nav-btns { display: flex; justify-content: space-between; margin-top: 20px; gap: 10px; }

/* Quiz Results */
.quiz-results { padding: 8px 0; }
.results-score {
  text-align: center; padding: 36px;
  border-radius: var(--radius-lg); margin-bottom: 28px;
}
.grade-a { background: rgba(0,200,83,.1); border: 2px solid rgba(0,200,83,.3); }
.grade-b { background: rgba(1,117,194,.1); border: 2px solid rgba(1,117,194,.3); }
.grade-c { background: rgba(255,214,0,.1); border: 2px solid rgba(255,214,0,.3); }
.grade-d { background: rgba(255,82,82,.1); border: 2px solid rgba(255,82,82,.3); }
.score-circle { display: flex; align-items: baseline; justify-content: center; gap: 2px; margin-bottom: 4px; }
.score-num { font-size: 56px; font-weight: 900; line-height: 1; color: var(--text); }
.score-den { font-size: 24px; color: var(--text-muted); }
.score-pct { font-size: 28px; font-weight: 800; color: var(--primary); }
.score-grade { font-size: 18px; font-weight: 600; margin-top: 8px; }
.results-breakdown { margin-bottom: 28px; }
.results-breakdown h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.result-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 6px;
  border: 1px solid var(--border);
}
.result-correct { border-left: 3px solid var(--success); background: rgba(0,200,83,.04); }
.result-wrong   { border-left: 3px solid var(--danger); background: rgba(255,82,82,.04); }
.result-icon { margin-right: 8px; }
.result-q { font-size: 13.5px; }
.result-correct-ans { font-size: 12px; color: var(--success); margin-left: 24px; }
.results-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ════════════════════════════════════════════════════════════
   DASHBOARD
   ════════════════════════════════════════════════════════════ */
.dashboard-overview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.overview-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.overview-num { font-size: 32px; font-weight: 800; color: var(--primary); line-height: 1; }
.overview-label { font-size: 12px; color: var(--text-muted); margin: 4px 0 10px; }
.overview-bar { height: 4px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.overview-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }

.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.dash-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.dash-section h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.empty-msg { font-size: 13.5px; color: var(--text-muted); text-align: center; padding: 16px 0; }

.ch-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ch-progress-icon { font-size: 16px; flex-shrink: 0; }
.ch-progress-name { font-size: 13px; font-weight: 500; min-width: 90px; }
.ch-progress-bar { flex: 1; height: 5px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.ch-progress-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.ch-progress-num { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.quiz-score-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.quiz-score-ch { flex: 1; font-size: 13px; font-weight: 500; }
.quiz-score-val { font-size: 13px; font-weight: 700; }
.score-good { color: var(--success); }
.score-low  { color: var(--warning); }
.retake-link { font-size: 11.5px; color: var(--primary); text-decoration: none; }
.retake-link:hover { text-decoration: underline; }

.recent-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border-light);
  transition: color var(--transition);
}
.recent-item:hover { color: var(--primary); text-decoration: none; }
.recent-icon { font-size: 16px; }
.recent-title { font-size: 13px; font-weight: 500; }

.bookmark-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.bookmark-link { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); text-decoration: none; }
.bookmark-link:hover { color: var(--primary); text-decoration: none; }
.btn-remove-bookmark {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 16px; padding: 2px 6px;
  border-radius: 4px; transition: all var(--transition);
}
.btn-remove-bookmark:hover { color: var(--danger); background: rgba(255,82,82,.1); }

/* ── Dashboard planner block ── */
.dash-planner-block {
  background: var(--bg-card); border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg); padding: 20px;
  margin-bottom: 20px;
}
.dash-planner-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.dash-planner-title { font-size: 16px; font-weight: 700; flex: 1; margin: 0; }
.dash-planner-meta  { font-size: 12.5px; color: var(--text-muted); }
.dash-planner-all   { font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none; margin-left: auto; }
.dash-planner-all:hover { color: var(--accent); text-decoration: none; }
.dash-plan-rows { display: flex; flex-direction: column; gap: 3px; }
.dash-plan-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-alt);
}
.dpr-done  { opacity: .6; }
.dpr-today { border-color: var(--accent); background: rgba(84,197,248,.05); }
.dpr-left  { display: flex; align-items: center; gap: 8px; min-width: 120px; flex-shrink: 0; flex-wrap: wrap; }
.dpr-day   { font-size: 12.5px; font-weight: 700; }
.dpr-date  { font-size: 11.5px; color: var(--text-muted); }
.dpr-lessons { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.dpr-chip {
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500;
  background: rgba(1,117,194,.08); color: var(--primary);
  border: 1px solid rgba(1,117,194,.18);
}
.dpr-chip-rev {
  background: rgba(255,214,0,.07); color: #CC9900;
  border-color: rgba(255,214,0,.2);
}

/* ════════════════════════════════════════════════════════════
   EXERCISES
   ════════════════════════════════════════════════════════════ */
.exercise-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.exercise-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.exercise-num { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); }
.exercise-title { font-size: 17px; font-weight: 700; }
.exercise-problem { font-size: 14px; line-height: 1.7; margin-bottom: 16px; color: var(--text); }
.exercise-hint-toggle { margin-bottom: 14px; }
.btn-hint {
  padding: 6px 14px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--warning); font-family: var(--font-sans);
  transition: all var(--transition);
}
.btn-hint:hover { background: rgba(255,214,0,.1); border-color: var(--warning); }
.exercise-hint { margin-top: 10px; padding: 12px 16px; background: rgba(255,214,0,.07); border: 1px solid rgba(255,214,0,.25); border-radius: 8px; font-size: 13.5px; }
.exercise-solution { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.exercise-solution summary {
  padding: 12px 16px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--primary);
  background: rgba(1,117,194,.05); user-select: none;
}
.exercise-solution summary:hover { background: rgba(1,117,194,.1); }
.solution-inner { padding: 12px 0 0; }

/* ════════════════════════════════════════════════════════════
   MEGA PRACTICE
   ════════════════════════════════════════════════════════════ */
.mega-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-btn {
  padding: 6px 16px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 99px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-muted); font-family: var(--font-sans);
  transition: all var(--transition);
}
.filter-btn:hover, .filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

.mega-list { display: flex; flex-direction: column; gap: 10px; }
.mega-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.mega-item[open] { box-shadow: var(--shadow); }
.mega-item.level-beginner     { border-left: 3px solid var(--success); }
.mega-item.level-intermediate { border-left: 3px solid var(--warning); }
.mega-item.level-advanced     { border-left: 3px solid var(--danger); }
.mega-item.level-interview    { border-left: 3px solid var(--primary); }

.mega-summary {
  padding: 14px 16px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  list-style: none; user-select: none;
  font-size: 14px; font-weight: 500;
}
.mega-summary:hover { background: var(--bg-alt); }
.mega-id { font-size: 11px; font-weight: 800; color: var(--text-faint); white-space: nowrap; }
.mega-level {
  padding: 2px 8px; border-radius: 99px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; white-space: nowrap;
}
.mega-level.level-beginner     { background: rgba(0,200,83,.1); color: var(--success); }
.mega-level.level-intermediate { background: rgba(255,214,0,.1); color: #CC9900; }
.mega-level.level-advanced     { background: rgba(255,82,82,.1); color: var(--danger); }
.mega-level.level-interview    { background: rgba(1,117,194,.1); color: var(--primary); }
.topic-badge {
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted);
}
.mega-q { flex: 1; }
.mega-answer { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.75; background: var(--bg-alt); }

/* ════════════════════════════════════════════════════════════
   INTERVIEW PREP
   ════════════════════════════════════════════════════════════ */
.interview-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.itab {
  padding: 7px 16px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: 99px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-muted); font-family: var(--font-sans);
  transition: all var(--transition);
}
.itab:hover, .itab.active { background: var(--primary); border-color: var(--primary); color: white; }

.interview-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.interview-item[open] { box-shadow: var(--shadow); }
.interview-q {
  padding: 16px 18px; cursor: pointer;
  font-size: 14.5px; font-weight: 600;
  list-style: none; user-select: none;
  border-left: 3px solid var(--primary);
  transition: background var(--transition);
}
.interview-q:hover { background: var(--bg-alt); }
.interview-a { padding: 16px 20px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.8; }

/* Cheat Sheets */
.cheat-sheet { margin-bottom: 36px; }
.cheat-sheet h2 { font-size: 20px; font-weight: 800; margin-bottom: 18px; letter-spacing: -.3px; }
.cheat-section { margin-bottom: 20px; }
.cheat-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--primary); }
.cheat-section ul { padding-left: 20px; }
.cheat-section li { font-size: 13.5px; line-height: 1.7; margin-bottom: 4px; }

/* ════════════════════════════════════════════════════════════
   ANSWER CENTER
   ════════════════════════════════════════════════════════════ */
.answers-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.answers-chapter {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.answers-chapter h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.answers-lesson-links { display: flex; flex-direction: column; gap: 2px; }
.answer-lesson-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 7px;
  font-size: 13px; color: var(--text); text-decoration: none;
  transition: all var(--transition);
}
.answer-lesson-link:hover { background: var(--bg-alt); color: var(--primary); text-decoration: none; }
.answer-arrow { color: var(--text-faint); font-size: 12px; }
.answer-quiz-link {
  display: block; margin-top: 10px; padding: 8px 12px;
  background: rgba(1,117,194,.08); border: 1px solid rgba(1,117,194,.2);
  border-radius: 7px; font-size: 12.5px; font-weight: 600;
  color: var(--primary); text-decoration: none; transition: all var(--transition);
}
.answer-quiz-link:hover { background: var(--primary); color: white; text-decoration: none; }

/* ════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV — shown only on mobile
   ════════════════════════════════════════════════════════════ */
.mobile-bottom-nav { display: none; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET & MOBILE (≤ 768px)
   ════════════════════════════════════════════════════════════ */
/* Desktop always hides hamburger and shows collapse btn */
@media (min-width: 769px) {
  .menu-btn { display: none !important; }
  .mobile-bottom-nav { display: none !important; }
  .sidebar-collapse-btn { display: flex; }
}

@media (max-width: 768px) {
  /* Sidebar: off-screen, slides in as overlay */
  .sidebar {
    transform: translateX(-110%);
    position: fixed;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  /* Hide desktop-only collapse button on mobile */
  .sidebar-collapse-btn { display: none; }

  /* Main wrapper: full width, no sidebar offset */
  .main-wrapper { margin-left: 0; }

  /* Header: show hamburger, keep search + theme */
  .menu-btn { display: flex; }

  /* Content area: tighter padding + space for bottom nav */
  .content-area { padding: 20px 16px 90px; }

  /* Grids: single column on tablet */
  .chapters-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .answers-grid   { grid-template-columns: 1fr; }

  /* Typography */
  .hero-title   { font-size: 26px; }
  .home-hero    { padding: 28px 20px; }
  .lesson-title { font-size: 22px; }
  .lesson-title-row { flex-direction: column; gap: 10px; }
  .quiz-nav-btns { flex-direction: column; }

  /* Search overlay */
  .search-overlay { padding-top: 60px; padding-left: 12px; padding-right: 12px; }
  .search-trigger-text kbd { display: none; }

  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 62px;
    background: var(--bg-sidebar);
    border-top: 1px solid rgba(255,255,255,.08);
    z-index: 190;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mbn-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: rgba(255,255,255,.38);
    background: none; border: none;
    cursor: pointer;
    padding: 6px 4px;
    font-family: var(--font-sans);
    transition: color var(--transition);
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-item:hover, .mbn-item.mbn-active { color: var(--accent); text-decoration: none; }
  .mbn-label { font-size: 9.5px; font-weight: 600; white-space: nowrap; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — PHONE (≤ 600px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* Content area */
  .content-area { padding: 16px 14px 90px; }

  /* Hero */
  .home-hero { padding: 22px 16px 24px; }
  .hero-title { font-size: 24px; letter-spacing: -.3px; }
  .hero-desc  { font-size: 14px; }
  /* Stats: clean 2×2 grid */
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px; text-align: center;
    margin-bottom: 18px;
  }
  .hero-stat { padding: 10px 8px; background: rgba(255,255,255,.04); border-radius: 10px; }
  .hero-stat .stat-num { font-size: 26px; }
  .hero-ctas { flex-direction: column; gap: 10px; }
  .btn-cta-primary, .btn-cta-secondary { width: 100%; text-align: center; justify-content: center; }

  /* Chapters grid: single col */
  .chapters-grid { grid-template-columns: 1fr; }

  /* Dashboard overview: 2 cols */
  .dashboard-overview { grid-template-columns: repeat(2, 1fr); }

  /* Author card: stack */
  .author-card { flex-direction: column; align-items: flex-start; gap: 14px; }

  /* Typography */
  .page-header h1, .page-title { font-size: 21px; }
  .lesson-title         { font-size: 20px; }
  .chapter-page-title   { font-size: 21px; }
  .section-title        { font-size: 16px; }
  .subsection-title     { font-size: 14.5px; }

  /* Lesson nav: full-width stacked */
  .lesson-nav    { flex-direction: column; align-items: stretch; gap: 8px; }
  .btn-nav       { max-width: 100%; text-align: center; }
  .btn-quiz-link { text-align: center; }

  /* Lesson header: tighter */
  .lesson-header  { padding: 16px 14px; }
  .lesson-actions { gap: 6px; }
  .btn-complete   { padding: 6px 12px; font-size: 12px; }

  /* Code blocks: scrollable, smaller font */
  .code-block          { margin: 12px 0; }
  .code-block pre      { padding: 14px 12px; }
  .code-block code     { font-size: 12px; line-height: 1.6; }
  .output-block .output { font-size: 12px; }

  /* Callouts */
  .callout { padding: 12px 14px; font-size: 13px; }

  /* Quiz */
  .quiz-question-card { padding: 16px 14px; }
  .quiz-q-text   { font-size: 14px; }
  .quiz-option   { font-size: 13px; padding: 11px 12px; min-height: 44px; }
  .results-actions { flex-direction: column; }

  /* Exercise cards */
  .exercise-card { padding: 16px 14px; }

  /* Mega/Interview filter pills */
  .itab, .filter-btn { padding: 6px 12px; font-size: 12px; }

  /* Breadcrumb */
  .breadcrumb, .lesson-breadcrumb { flex-wrap: wrap; font-size: 12px; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (≤ 480px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .content-area { padding: 12px 12px 88px; }

  /* Hero: tightest */
  .home-hero  { padding: 18px 14px 20px; }
  .hero-title { font-size: 22px; }
  .hero-tag   { font-size: 10px; padding: 3px 10px; }
  .hero-stat .stat-num { font-size: 24px; }

  /* Chapter cards */
  .chapter-card { padding: 14px 12px; }

  /* Quiz */
  .score-num { font-size: 44px; }

  /* Lesson header */
  .lesson-header { padding: 14px 12px; }

  /* Search overlay: less top space */
  .search-overlay { padding-top: 50px; padding-left: 8px; padding-right: 8px; }
  .search-modal   { border-radius: var(--radius); }
}

/* ════════════════════════════════════════════════════════════
   SHARE BUTTON
   ════════════════════════════════════════════════════════════ */
.btn-share {
  color: var(--text-muted);
  transition: color var(--transition);
}
.btn-share:hover { color: var(--primary); }

/* ════════════════════════════════════════════════════════════
   FOLLOW CTA — bottom of every lesson
   ════════════════════════════════════════════════════════════ */
.follow-cta {
  margin: 40px 0 8px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #010E1F 0%, #012D5C 60%, #010E1F 100%);
  border: 1px solid rgba(84,197,248,.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.follow-cta-text {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.75);
  flex: 1;
  min-width: 160px;
}
.follow-cta-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.follow-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.follow-btn:hover { transform: translateY(-1px); text-decoration: none; }
.follow-btn-gh { background: #24292e; border: 1px solid rgba(255,255,255,.2); }
.follow-btn-gh:hover { background: #333; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.follow-btn-li { background: #0A66C2; border: 1px solid rgba(255,255,255,.15); }
.follow-btn-li:hover { background: #0958a8; box-shadow: 0 4px 12px rgba(10,102,194,.5); }

@media (max-width: 600px) {
  .follow-cta { flex-direction: column; align-items: flex-start; }
  .follow-cta-btns { width: 100%; }
  .follow-btn { flex: 1; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════
   STUDY PLANNER CARD
   ════════════════════════════════════════════════════════════ */
.planner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

/* ── Planner number inputs ── */
.planner-input-wrap {
  display: flex; align-items: center; gap: 10px;
}
.planner-input {
  width: 72px; padding: 7px 10px;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg-alt); color: var(--text);
  font-size: 18px; font-weight: 700; font-family: var(--font-sans);
  text-align: center; outline: none;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
}
.planner-input::-webkit-outer-spin-button,
.planner-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.planner-input:focus { border-color: var(--primary); }
.planner-input-unit { font-size: 12.5px; color: var(--text-muted); }

/* ── Plan page link ── */
.planner-view-plan {
  font-size: 12.5px; font-weight: 600; color: var(--primary);
  text-decoration: none; transition: color var(--transition);
}
.planner-view-plan:hover { color: var(--accent); text-decoration: none; }

/* Setup card */
.planner-setup {
  border-top: 3px solid var(--primary);
}
.planner-setup-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.planner-setup-icon {
  font-size: 28px; flex-shrink: 0;
}
.planner-title {
  font-size: 16px; font-weight: 700; margin-bottom: 3px;
}
.planner-setup-sub {
  font-size: 13px; color: var(--text-muted);
}
.planner-setup-body {
  display: flex; flex-direction: column; gap: 14px;
}
.planner-option-group {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.planner-option-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  min-width: 120px;
}
.planner-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.planner-pill {
  padding: 5px 16px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 99px; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; font-family: var(--font-sans);
  transition: all var(--transition);
}
.planner-pill:hover { border-color: var(--primary); color: var(--primary); }
.planner-pill-sel {
  background: var(--primary); border-color: var(--primary); color: white;
}
.planner-start-btn {
  align-self: flex-start;
  padding: 10px 22px;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 700; font-family: var(--font-sans);
  cursor: pointer; transition: all var(--transition);
}
.planner-start-btn:hover { background: var(--primary-d); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(1,117,194,.35); }

/* Active study day card */
.planner-active {
  border-top: 3px solid var(--accent);
}
.planner-day-done {
  border-top-color: var(--success);
  opacity: .92;
}
.planner-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.planner-day-badge {
  font-size: 17px; font-weight: 800; color: var(--text); white-space: nowrap;
}
.planner-header-meta {
  flex: 1; min-width: 120px;
}
.planner-day-of {
  font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 5px;
}
.planner-prog-bar {
  height: 4px; background: var(--bg-alt); border-radius: 99px; overflow: hidden;
}
.planner-prog-fill {
  height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease;
}
.planner-streak-badge {
  font-size: 14px; font-weight: 800; color: #FF8C00;
  background: rgba(255,140,0,.12); border: 1px solid rgba(255,140,0,.25);
  border-radius: 99px; padding: 3px 12px; white-space: nowrap;
}
.planner-section {
  margin-bottom: 14px;
}
.planner-section-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 7px;
}
.planner-lessons {
  display: flex; flex-direction: column; gap: 5px;
}
.planner-lesson-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; font-weight: 500;
  color: var(--text); text-decoration: none;
  transition: all var(--transition);
}
.planner-lesson-link:hover { border-color: var(--primary); color: var(--primary); background: rgba(1,117,194,.05); text-decoration: none; }
.planner-lesson-review { color: var(--text-muted); }
.planner-lesson-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.planner-dot-new    { background: var(--accent); }
.planner-dot-review { background: var(--warning); }
.planner-footer {
  display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap;
}
.planner-complete-btn {
  padding: 9px 20px;
  background: var(--primary); color: white;
  border: none; border-radius: 8px;
  font-size: 13.5px; font-weight: 700; font-family: var(--font-sans);
  cursor: pointer; transition: all var(--transition);
}
.planner-complete-btn:hover:not(:disabled) { background: var(--primary-d); transform: translateY(-1px); }
.planner-complete-btn.is-done {
  background: rgba(0,200,83,.15); color: var(--success);
  border: 1px solid rgba(0,200,83,.3); cursor: default;
}
.planner-reset-btn {
  padding: 8px 14px; background: none;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; font-family: var(--font-sans); transition: all var(--transition);
}
.planner-reset-btn:hover { border-color: var(--danger); color: var(--danger); }

/* Rest day */
.planner-rest {
  border-top: 3px solid var(--border);
}
.planner-rest-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.planner-rest-icon { font-size: 28px; flex-shrink: 0; }
.planner-rest-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.planner-rest-sub { font-size: 13px; color: var(--text-muted); }
.planner-next-info { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
.planner-next-info strong { color: var(--text); }

/* Complete state */
.planner-complete {
  text-align: center; padding: 28px 24px;
  border-top: 3px solid var(--success);
}
.planner-complete-icon  { font-size: 40px; margin-bottom: 8px; }
.planner-complete-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.planner-complete-sub   { font-size: 13.5px; color: var(--text-muted); margin-bottom: 10px; }
.planner-complete-streak { font-size: 14px; font-weight: 700; color: #FF8C00; margin-bottom: 16px; }

/* Mobile tweaks */
@media (max-width: 600px) {
  .planner-card { padding: 16px; }
  .planner-option-group { flex-direction: column; align-items: flex-start; gap: 6px; }
  .planner-option-label { min-width: unset; }
  .planner-start-btn { width: 100%; text-align: center; }
  .planner-complete-btn { flex: 1; text-align: center; }
}

/* ════════════════════════════════════════════════════════════
   STUDY PLAN PAGE
   ════════════════════════════════════════════════════════════ */
.plan-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.plan-page-sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 8px; }
.plan-overall-bar {
  height: 6px; background: var(--border); border-radius: 99px;
  overflow: hidden; margin: 6px 0 4px; max-width: 320px;
}
.plan-overall-fill {
  height: 100%; background: var(--primary);
  border-radius: 99px; transition: width 0.4s ease;
}
.plan-overall-label { font-size: 11.5px; color: var(--text-faint); margin-bottom: 16px; }
.plan-completed-date { font-size: 11px; color: var(--success); font-weight: 500; }
.plan-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 12px; color: var(--text-muted);
}
.plan-legend-item { display: flex; align-items: center; gap: 5px; }
.plan-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.plan-dot-done   { background: rgba(0,200,83,.15);  color: var(--success); }
.plan-dot-today  { background: rgba(84,197,248,.2); color: var(--accent); }
.plan-dot-missed { background: rgba(255,82,82,.12); color: var(--danger); }
.plan-dot-up     { background: var(--bg-alt); border: 1px solid var(--border); color: transparent; }

.plan-timeline { display: flex; flex-direction: column; gap: 3px; }

.plan-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.plan-row:hover { background: var(--bg-alt); }
.plan-done   { border-left-color: var(--success); opacity: .7; }
.plan-today  { border-left-color: var(--accent); background: rgba(84,197,248,.04); }
.plan-missed { border-left-color: var(--danger); opacity: .65; }
.plan-upcoming { border-left-color: transparent; }

.plan-row-icon {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; margin-top: 1px;
}
.plan-done   .plan-row-icon { background: rgba(0,200,83,.15);  color: var(--success); }
.plan-today  .plan-row-icon { background: rgba(84,197,248,.2); color: var(--accent); }
.plan-missed .plan-row-icon { background: rgba(255,82,82,.12); color: var(--danger); }
.plan-upcoming .plan-row-icon { color: var(--text-faint); }

.plan-row-body { flex: 1; min-width: 0; }
.plan-row-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.plan-row-day  { font-size: 13px; font-weight: 700; color: var(--text); }
.plan-row-date { font-size: 12.5px; color: var(--text-muted); }
.plan-today-chip {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  background: var(--accent); color: #000;
  padding: 2px 8px; border-radius: 99px;
}
.plan-review-only-chip {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  background: rgba(255,214,0,.15); color: #CC9900;
  padding: 2px 8px; border-radius: 99px;
}
.plan-row-lessons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.plan-row-reviews { margin-top: 4px; }

.plan-chip {
  padding: 3px 10px;
  background: rgba(1,117,194,.08); border: 1px solid rgba(1,117,194,.2);
  color: var(--primary); border-radius: 99px;
  font-size: 12px; font-weight: 500; text-decoration: none;
  transition: all var(--transition);
}
.plan-chip:hover { background: var(--primary); color: white; text-decoration: none; }
.plan-chip-review {
  background: rgba(255,214,0,.07); border-color: rgba(255,214,0,.25); color: #CC9900;
}
.plan-chip-review:hover { background: var(--warning); color: #000; }

@media (max-width: 600px) {
  .plan-row { padding: 10px 12px; gap: 8px; }
  .plan-legend { gap: 10px; font-size: 11px; }
}

/* ════════════════════════════════════════════════════════════
   PRINT / PDF EXPORT
   ════════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .app-header, .search-overlay, .toast,
  .btn-bookmark, .btn-complete, .btn-nav, .btn-quiz-link,
  .lesson-actions, .code-actions, .sidebar-backdrop,
  .follow-cta, .btn-share, .planner-card { display: none !important; }

  body { display: block; }
  .main-wrapper { margin-left: 0; }
  .content-area { max-width: 100%; padding: 0; }

  .lesson-page, .chapter-page { page-break-before: always; }
  .lesson-section { page-break-inside: avoid; }

  .code-block { break-inside: avoid; }
  .code-block pre { white-space: pre-wrap; word-break: break-all; }
  .code-block { background: #1E1E2E !important; color: #CDD6F4 !important; }

  @page { size: A4; margin: 20mm; }
  a[href]::after { content: ''; } /* hide link URLs in print */
}
