/* ===== CertiMaster - Global Styles ===== */

:root {
  --bg-deep: #0a0f1e;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #253044;
  --bg-input: #162032;
  --border: #2d3f55;
  --border-light: #3d5068;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.4);
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #38bdf8;
  --info-light: rgba(56, 189, 248, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-link: #818cf8;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --transition: 0.2s ease;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --navbar-bg: rgba(10, 15, 30, 0.92);
  --hero-gradient: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99, 102, 241, 0.25) 0%, transparent 60%);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg-deep: #f0f4f8;
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.10);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #16a34a;
  --success-light: rgba(22, 163, 74, 0.10);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.10);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.10);
  --info: #0284c7;
  --info-light: rgba(2, 132, 199, 0.10);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-link: #4f46e5;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --navbar-bg: rgba(248, 250, 252, 0.95);
  --hero-gradient: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99, 102, 241, 0.12) 0%, transparent 60%);
}
[data-theme="light"] body { background: var(--bg-dark); color: var(--text-primary); }
[data-theme="light"] .navbar { background: var(--navbar-bg); }
[data-theme="light"] .hero { background: var(--hero-gradient); }
[data-theme="light"] .hero h1 { background: linear-gradient(135deg, #0f172a 30%, #4f46e5 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="light"] .exam-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
[data-theme="light"] .exam-card:hover { box-shadow: var(--shadow-lg); }
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-input); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border-light); }
[data-theme="light"] .option-item { background: var(--bg-input); }
[data-theme="light"] code { color: #1e293b; }
[data-theme="light"] pre { color: #1e293b; }
[data-theme="light"] .quiz-start-card { box-shadow: var(--shadow); }
[data-theme="light"] .results-header { box-shadow: var(--shadow); }
[data-theme="light"] .compare-table tr:hover td { background: rgba(99,102,241,0.04); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 { line-height: 1.3; font-weight: 600; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
p { color: var(--text-secondary); margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--text-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
code, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: #e2e8f0;
}
pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  color: #e2e8f0;
  margin: 1rem 0;
}
pre code { background: none; border: none; padding: 0; }

/* ===== Layout ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}
.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 60px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}
.navbar-brand:hover { color: var(--text-primary); }
.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.navbar-links { display: flex; align-items: center; gap: 0.25rem; }
.navbar-links a {
  color: var(--text-secondary);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all var(--transition);
}
.navbar-links a:hover, .navbar-links a.active {
  color: var(--text-primary);
  background: var(--accent-light);
}
.navbar-links a.active { color: var(--accent-hover); }
.navbar-nav { display: flex; align-items: center; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.navbar-nav li { display: flex; }
.nav-link {
  color: var(--text-secondary);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all var(--transition);
  text-decoration: none;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--accent-light);
}
.nav-link.active { color: var(--accent-hover); }
.navbar-spacer { flex: 1; }
.navbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* ===== Global Promo Banner ===== */
.cm-promo-banner {
  position: relative;
  z-index: 95;
  background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
  border-bottom: 1px solid rgba(161, 98, 7, 0.22);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.10);
}
.cm-promo-banner__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cm-promo-banner__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: rgba(120, 53, 15, 0.12);
  color: #78350f;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.cm-promo-banner__content {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  color: #451a03;
}
.cm-promo-banner__product {
  font-weight: 800;
  color: #78350f;
  font-size: 0.9rem;
}
.cm-promo-banner__text {
  color: #5b3306;
  font-size: 0.88rem;
  line-height: 1.35;
}
.cm-promo-banner__link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: none;
  transition: transform var(--transition), background var(--transition), color var(--transition);
}
.cm-promo-banner__link:hover {
  background: #b91c1c;
  color: #ffffff;
  transform: translateY(-1px);
}

[data-theme="light"] .cm-promo-banner {
  box-shadow: 0 6px 16px rgba(202, 138, 4, 0.08);
}

/* ===== Navbar Controls — Language switcher & Theme toggle ===== */
.lang-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  gap: 0;
}
.lang-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}
.lang-btn:last-child { border-right: none; }
.lang-btn:hover { color: var(--text-primary); background: var(--accent-light); }
.lang-btn.active { color: var(--accent-hover); background: var(--accent-light); }
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-light); }
.theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

/* ===== Hero Section ===== */
.hero {
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  background: var(--hero-gradient);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-hover);
  padding: 0.375rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}
.hero h1 {
  font-size: clamp(1.875rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #f1f5f9 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
  color: var(--text-primary);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: var(--danger-light); color: var(--danger); }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.0625rem; border-radius: var(--radius); }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-body { padding: 1.5rem; }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-clickable { cursor: pointer; }
.card-clickable:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ===== Exam Card (home page) ===== */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  padding: 0.75rem 0 2rem;
}
.exam-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.exam-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  color: var(--text-primary);
}
.exam-card-accent {
  height: 6px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
}
.exam-card-body { padding: 1.25rem; }
.exam-badge-row { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-accent, .badge-purple { background: var(--accent-light); color: var(--accent-hover); border: 1px solid rgba(99,102,241,0.3); }
.badge-info, .badge-blue { background: var(--info-light); color: var(--info); border: 1px solid rgba(56,189,248,0.3); }
.badge-success, .badge-green { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.exam-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.exam-card p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.875rem; }
.exam-card-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.exam-meta-item { display: flex; flex-direction: column; gap: 0.125rem; }
.exam-meta-item .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.exam-meta-item .value { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.exam-progress-bar {
  margin: 0.75rem 0 0;
  height: 4px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}
.exam-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.exam-progress-label { display: flex; justify-content: space-between; margin-top: 0.5rem; }
.exam-progress-label span { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Exam Card — missing structural classes ===== */
.exam-card-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem 0.75rem;
}
.exam-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.exam-code {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.exam-title {
  display: block;
  padding: 0 1.5rem 0.625rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.exam-description {
  display: block;
  padding: 0 1.5rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.exam-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.exam-progress-wrap {
  padding: 0.75rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
}
.exam-progress-pct { font-weight: 600; color: var(--accent-hover); }
.coming-soon-overlay {
  margin: 0.5rem 1.5rem 1.25rem;
  padding: 0.5rem 1rem;
  background: rgba(100,116,139,0.15);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ===== Exam Overview Page ===== */
.exam-header {
  background: linear-gradient(180deg, rgba(99,102,241,0.12) 0%, transparent 100%);
  padding: 2.5rem 1.5rem 1.75rem;
}
.exam-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.exam-header-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(99,102,241,0.4);
}
.exam-header-content { flex: 1; min-width: 0; }
.exam-header-content h1 { font-size: 1.75rem; font-weight: 700; margin: 0.25rem 0 0; line-height: 1.3; }
.exam-header-content .subtitle { color: var(--text-secondary); font-size: 1.0625rem; margin-bottom: 1rem; }
.exam-header-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.exam-header-code { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-hover); margin-bottom: 0.25rem; }
.exam-header-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.exam-stats-bar {
  display: flex;
  gap: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  justify-content: center;
}
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.stat-value { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value.accent { color: var(--accent-hover); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

/* ===== Tabs ===== */
.tabs {
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs .container {
  display: flex;
  gap: 0.25rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.tab-btn {
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Overview grid ===== */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ===== Domain summary (Skills Measured card) ===== */
.domain-summary-list { display: flex; flex-direction: column; gap: 0; }
.domain-summary-item { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.domain-summary-item:last-child { border-bottom: none; padding-bottom: 0; }
.domain-summary-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.3rem; }
.domain-summary-name { font-weight: 600; color: var(--text-primary); font-size: 0.925rem; }
.domain-summary-pct { font-size: 0.82rem; color: var(--accent-hover); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.overview-full-width { grid-column: 1 / -1; }

/* ===== Domain / Skill sections ===== */
.domain-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.domain-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  cursor: pointer;
  transition: background var(--transition);
}
.domain-header:hover { background: var(--bg-card-hover); }
.domain-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.domain-number.d1 { background: rgba(99,102,241,0.2); color: #818cf8; }
.domain-number.d2 { background: rgba(56,189,248,0.2); color: #38bdf8; }
.domain-number.d3 { background: rgba(34,197,94,0.2); color: #22c55e; }
.domain-info { flex: 1; min-width: 0; }
.domain-info h3 { font-size: 1.0625rem; margin-bottom: 0.125rem; }
.domain-info .domain-pct { font-size: 0.8125rem; color: var(--text-muted); }
.domain-progress { text-align: right; flex-shrink: 0; }
.domain-chevron {
  color: var(--text-muted);
  transition: transform var(--transition);
  font-size: 1.25rem;
}
.domain-section.open .domain-chevron { transform: rotate(180deg); }
.domain-body { display: none; }
.domain-section.open .domain-body { display: block; }

/* ===== Topic list ===== */
.topic-list { list-style: none; border-top: 1px solid var(--border); }
.topic-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.topic-item:last-child { border-bottom: none; }
.topic-item:hover { background: var(--bg-card-hover); }
.topic-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  font-size: 11px;
}
.topic-item.done .topic-check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.topic-title { flex: 1; font-size: 0.9375rem; }
.topic-item.done .topic-title { color: var(--text-muted); }
.topic-arrow { color: var(--text-muted); font-size: 1.125rem; }

/* ===== Study Content Page ===== */
.study-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 120px);
}
.study-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.study-sidebar::-webkit-scrollbar { width: 5px; }
.study-sidebar::-webkit-scrollbar-track { background: transparent; }
.study-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.study-main {
  flex: 1;
  min-width: 0;
  width: min(100%, 1240px);
  padding: 2rem 3rem;
  max-width: 1240px;
}
.sidebar-section { border-bottom: 1px solid var(--border); }
.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition);
}
.sidebar-section-header:hover { background: var(--bg-card-hover); }
.sidebar-section-num {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-section-num.s1 { background: rgba(99,102,241,0.25); color: #818cf8; }
.sidebar-section-num.s2 { background: rgba(56,189,248,0.25); color: #38bdf8; }
.sidebar-section-num.s3 { background: rgba(34,197,94,0.25); color: #22c55e; }
.sidebar-topics { list-style: none; }
.sidebar-topic {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem 0.625rem 2.75rem;
  cursor: pointer;
  font-size: 0.84375rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-topic:hover { color: var(--text-primary); background: rgba(99,102,241,0.06); }
.sidebar-topic.active { color: var(--accent-hover); background: var(--accent-light); }
.sidebar-topic.done { color: var(--success); }
.sidebar-topic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  flex-shrink: 0;
  transition: all var(--transition);
}
.sidebar-topic.done .sidebar-topic-dot {
  background: var(--success);
  border-color: var(--success);
}
.sidebar-topic.active .sidebar-topic-dot { border-color: var(--accent); }

/* ===== Study Content ===== */
.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.content-header h1 { font-size: 1.875rem; }
.content-breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.content-body { line-height: 1.75; }
.content-body h2 {
  font-size: 1.375rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.content-body h3 { font-size: 1.125rem; margin: 2rem 0 0.75rem; color: var(--accent-hover); }
.content-body h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; color: var(--text-primary); }
.content-body p { margin-bottom: 1rem; }
.content-body ul, .content-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}
.content-body li { margin-bottom: 0.375rem; }
.content-body li::marker { color: var(--accent); }

/* Info boxes */
.info-box {
  border-left: 3px solid;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}
.info-box-title { font-weight: 600; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.info-box.tip { border-color: var(--success); background: var(--success-light); }
.info-box.tip .info-box-title { color: var(--success); }
.info-box.warning { border-color: var(--warning); background: var(--warning-light); }
.info-box.warning .info-box-title { color: var(--warning); }
.info-box.info { border-color: var(--info); background: var(--info-light); }
.info-box.info .info-box-title { color: var(--info); }
.info-box.important { border-color: var(--accent); background: var(--accent-light); }
.info-box.important .info-box-title { color: var(--accent-hover); }

/* Comparison tables */
.compare-table-wrap { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius-sm); }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.compare-table th {
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.compare-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(99,102,241,0.04); }
.compare-table th:first-child, .compare-table td:first-child { font-weight: 500; color: var(--text-primary); }

/* Key points list */
.key-points {
  list-style: none;
  margin: 1rem 0;
}
.key-points li {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: flex-start;
  color: var(--text-secondary);
}
.key-points li::before {
  content: "→";
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.key-points li:last-child { border-bottom: none; }

/* Content nav */
.content-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}
.content-nav .btn { max-width: 48%; }
.complete-section {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--success-light);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.complete-section p { color: var(--success); margin: 0; font-weight: 500; }
.complete-section p small { display: block; font-size: 0.8125rem; font-weight: 400; opacity: 0.8; margin-top: 0.125rem; }

/* YouTube videos */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.video-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  transition: all var(--transition);
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  appearance: none;
  cursor: pointer;
}
.video-card:hover {
  border-color: #ff0000;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.15);
}
.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a0000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #ff0000;
  position: relative;
}
.video-thumb.has-image {
  background: #000;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.45) 100%);
}
.video-play-badge {
  position: absolute;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 30, 0.78);
  color: #fff;
  font-size: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform var(--transition), background var(--transition);
}
.video-card:hover .video-play-badge {
  transform: scale(1.06);
  background: rgba(220, 38, 38, 0.92);
}
.video-card-body { padding: 0.75rem; }
.video-card-body .channel { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }
.video-card-body .title { font-size: 0.8125rem; color: var(--text-primary); line-height: 1.4; }

/* ===== Quiz Page ===== */
.quiz-wrapper { min-height: calc(100vh - 60px); padding: 2rem 1.5rem; }
.quiz-start {
  max-width: 700px;
  margin: 3rem auto;
}
.quiz-start h1 { margin-bottom: 0.75rem; }
.quiz-start p { color: var(--text-secondary); margin-bottom: 2rem; }
.quiz-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}
.quiz-rule {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.quiz-rule-icon { font-size: 1.75rem; }
.quiz-rule-info .rule-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
.quiz-rule-info .rule-value { font-size: 1.0625rem; font-weight: 600; color: var(--text-primary); }

.quiz-exam {
  max-width: 900px;
  margin: 0 auto;
}
.quiz-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.quiz-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 120px;
}
.quiz-timer.warning { color: var(--warning); }
.quiz-timer.danger { color: var(--danger); animation: timerPulse 1s ease-in-out infinite; }
@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.quiz-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  min-width: 100px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.quiz-qnum {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.question-meta {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.question-number {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
  line-height: 1.5;
}
.options-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-dark);
}
.option-item:hover { border-color: var(--accent); background: var(--accent-light); }
.option-item.selected { border-color: var(--accent); background: var(--accent-light); }
.option-item.correct { border-color: var(--success); background: var(--success-light); }
.option-item.incorrect { border-color: var(--danger); background: var(--danger-light); }
.option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: all var(--transition);
}
.option-item:hover .option-label { color: var(--accent); }
.option-item.selected .option-label { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.option-item.correct .option-label { color: var(--success); border-color: var(--success); background: var(--success-light); }
.option-item.incorrect .option-label { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }
.option-text { flex: 1; line-height: 1.5; color: var(--text-secondary); font-size: 0.9375rem; }
.option-item.selected .option-text { color: var(--text-primary); }

.quiz-explanation {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: none;
}
.quiz-explanation strong { color: var(--info); }
.quiz-explanation.show { display: block; }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.quiz-question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.qgrid-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qgrid-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.qgrid-btn.current { border-color: var(--accent); background: var(--accent-light); color: var(--accent-hover); }
.qgrid-btn.answered { background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.4); color: var(--accent-hover); }
.qgrid-btn.correct-r { background: var(--success-light); border-color: rgba(34,197,94,0.5); color: var(--success); }
.qgrid-btn.incorrect-r { background: var(--danger-light); border-color: rgba(239,68,68,0.5); color: var(--danger); }

/* ===== Results ===== */
.results-container { max-width: 800px; margin: 0 auto; padding: 2rem 0; }
.results-header { text-align: center; margin-bottom: 3rem; }
.result-score-ring {
  width: 160px;
  height: 160px;
  margin: 0 auto 1.5rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-score-ring svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.result-score-inner { text-align: center; }
.result-score-num { font-size: 2.5rem; font-weight: 800; }
.result-score-label { font-size: 0.75rem; color: var(--text-muted); }
.result-pass { color: var(--success); }
.result-fail { color: var(--danger); }
.results-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.result-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.result-stat-card .big-num { font-size: 2rem; font-weight: 800; }
.result-stat-card .big-num.c { color: var(--success); }
.result-stat-card .big-num.w { color: var(--danger); }
.result-stat-card .big-num.s { color: var(--warning); }
.result-stat-card p { margin: 0; font-size: 0.8125rem; color: var(--text-muted); }
.domain-results { margin-bottom: 2rem; }
.domain-result-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.domain-result-name { flex: 1; font-size: 0.9375rem; }
.domain-result-bar { flex: 2; height: 10px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.domain-result-fill { height: 100%; border-radius: 999px; }
.domain-result-pct { min-width: 45px; text-align: right; font-size: 0.875rem; font-weight: 600; }

/* ===== Progress Overview ===== */
.progress-overview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.progress-overview h3 { margin-bottom: 1.25rem; font-size: 1.0625rem; }
.progress-domains { display: flex; flex-direction: column; gap: 0.875rem; }
.progress-domain-row { display: flex; align-items: center; gap: 1rem; }
.progress-domain-name { font-size: 0.875rem; min-width: 180px; color: var(--text-secondary); }
.progress-domain-bar { flex: 1; height: 6px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.progress-domain-fill { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.progress-domain-fill.d1 { background: linear-gradient(90deg, #6366f1, #a78bfa); }
.progress-domain-fill.d2 { background: linear-gradient(90deg, #38bdf8, #0ea5e9); }
.progress-domain-fill.d3 { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-domain-pct { font-size: 0.8125rem; color: var(--text-muted); min-width: 35px; text-align: right; }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text-secondary); }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent-hover); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .study-sidebar { width: 280px; }
}
@media (max-width: 768px) {
  .study-layout { flex-direction: column; }
  .study-sidebar { width: 100%; height: auto; position: static; }
  .study-main { padding: 1.25rem; }
  .quiz-rules { grid-template-columns: 1fr; }
  .results-stats { grid-template-columns: 1fr 1fr; }
  .exam-header-inner { flex-direction: column; }
  .overview-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  .hero h1 { font-size: 2rem; }

  .cm-promo-banner__inner {
    padding: 0.75rem 1rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .cm-promo-banner__content {
    width: 100%;
  }

  .cm-promo-banner__link {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .container, .container-narrow { padding: 0 1rem; }
  .exam-stats-bar { gap: 1.25rem; }
}

/* ===== Study Page — Sidebar (DOM-generated classes) ===== */
.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.sidebar-title { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.875rem; }
.sidebar-progress-label { display: flex; justify-content: space-between; font-size: 0.8125rem; margin-bottom: 0.4rem; color: var(--text-secondary); }
.sidebar-nav { flex: 1; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.sidebar-domain { border-bottom: 1px solid var(--border); }
.sidebar-domain-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.sidebar-domain-header:hover { background: var(--bg-card-hover); }
.sidebar-domain-chevron { font-size: 0.7rem; color: var(--text-muted); transition: transform var(--transition); flex-shrink: 0; }
.sidebar-domain.collapsed .sidebar-domain-chevron { transform: rotate(-90deg); }
.sidebar-domain-title { flex: 1; font-size: 0.84375rem; font-weight: 600; }
.sidebar-domain-count { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.sidebar-topic-list { list-style: none; }
.sidebar-domain.collapsed .sidebar-topic-list { display: none; }
.sidebar-topic-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5625rem 1.25rem 0.5625rem 2.25rem;
  cursor: pointer;
  font-size: 0.84375rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.sidebar-topic-item:hover { color: var(--text-primary); background: rgba(99,102,241,0.06); }
.sidebar-topic-item.active { color: var(--accent-hover); background: var(--accent-light); }
.sidebar-topic-item.done { color: var(--success); }
.sidebar-topic-check { width: 16px; font-size: 0.7rem; color: var(--success); flex-shrink: 0; }
.sidebar-topic-name { flex: 1; line-height: 1.4; }

/* ===== Study Page — Content Area ===== */
.study-content-area { padding: 2rem; }
.study-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  bottom: 0;
  flex-wrap: wrap;
}
.topic-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.topic-breadcrumb { font-size: 0.8rem; font-weight: 500; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }
.topic-title { font-size: 1.875rem; margin-bottom: 0.5rem; }
.topic-status { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; }
.topic-status.done { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.topic-status.pending { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.topic-content { line-height: 1.75; }
.topic-content h2 { font-size: 1.375rem; margin: 2.5rem 0 1rem; padding-bottom: 0.625rem; border-bottom: 1px solid var(--border); }
.topic-content h3 { font-size: 1.125rem; margin: 2rem 0 0.75rem; color: var(--accent-hover); }
.topic-content h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.topic-content p { margin-bottom: 1rem; }
.topic-content ul, .topic-content ol { padding-left: 1.5rem; margin-bottom: 1rem; color: var(--text-secondary); }
.topic-content li { margin-bottom: 0.375rem; }
.topic-content li::marker { color: var(--accent); }
.topic-videos { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.topic-videos h3 { margin-bottom: 1rem; }
.video-info { padding: 0.75rem; }
.video-title { font-size: 0.8125rem; color: var(--text-primary); line-height: 1.4; margin-bottom: 0.25rem; }
.video-channel { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
body.video-modal-open { overflow: hidden; }
.video-modal[hidden] { display: none; }
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
}
.video-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(90vw, 1600px);
  height: min(80vh, 960px);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
.video-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.75);
}
.video-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.video-modal-channel {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.video-modal-close {
  border: 1px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.video-modal-close:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}
.video-modal-frame-wrap {
  flex: 1;
  min-height: 0;
  background: #000;
}
.video-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 768px) {
  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-modal {
    padding: 1rem;
  }

  .video-modal-dialog {
    width: 90vw;
    height: 80vh;
  }

  .video-play-badge {
    width: 56px;
    height: 56px;
  }
}

/* ===== Quiz Page — Start Screen ===== */
.quiz-start-screen {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.quiz-start-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 760px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}
.quiz-start-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid rgba(99,102,241,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--accent-hover);
}
.quiz-start-title { font-size: 2rem; font-weight: 700; }
.quiz-start-subtitle { color: var(--text-secondary); max-width: 480px; }
.quiz-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  align-items: stretch;
}
.quiz-rule {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  line-height: 1.5;
  min-width: 0;
}
.quiz-rule > span:first-child {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.quiz-rule > span:last-child {
  color: var(--text-secondary);
  min-width: 0;
  flex: 1;
}

@media (max-width: 760px) {
  .quiz-start-card {
    padding: 2rem 1.25rem;
  }

  .quiz-rules {
    grid-template-columns: 1fr;
  }

  .quiz-start-title {
    font-size: 1.75rem;
  }
}

/* ===== Quiz Page — Exam Screen ===== */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 10;
  flex-wrap: wrap;
}
.quiz-header-left, .quiz-header-right { display: flex; align-items: center; gap: 0.625rem; }
.quiz-q-counter { font-size: 0.9rem; color: var(--text-secondary); }
.quiz-timer {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.quiz-timer.warning { color: var(--warning); }
.quiz-timer.danger { color: var(--danger); animation: timerPulse 1s ease-in-out infinite; }
.quiz-body {
  display: flex;
  gap: 0;
  width: min(1280px, calc(100% - 3rem));
  margin: 0 auto;
  min-height: calc(100vh - 120px);
}
.quiz-question-area {
  flex: 1;
  padding: 2rem;
  max-width: 820px;
  min-width: 0;
}
.quiz-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding: 1.25rem;
  background: var(--bg-card);
  position: sticky;
  top: 116px;
  height: calc(100vh - 116px);
  overflow-y: auto;
}
.question-domain-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.875rem;
}
.question-text {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.option-list { list-style: none; display: flex; flex-direction: column; gap: 0.625rem; margin-bottom: 1.5rem; }
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-dark);
}
.option-item:hover:not(.answered) { border-color: var(--accent); background: var(--accent-light); }
.option-item.answered { cursor: default; }
.option-item.correct { border-color: var(--success); background: var(--success-light); }
.option-item.incorrect { border-color: var(--danger); background: var(--danger-light); }
.option-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}
.option-item:hover:not(.answered) .option-letter { border-color: var(--accent); color: var(--accent); }
.option-item.correct .option-letter { border-color: var(--success); color: var(--success); background: var(--success-light); }
.option-item.incorrect .option-letter { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.option-item .option-text { flex: 1; font-size: 0.9375rem; line-height: 1.5; color: var(--text-secondary); }
.option-item.correct .option-text, .option-item.incorrect .option-text { color: var(--text-primary); }
.explanation-box {
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.explanation-box strong { color: var(--info); }
.quiz-nav-buttons { display: flex; gap: 0.75rem; justify-content: space-between; }
.quiz-grid-header { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.75rem; }
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.375rem;
  margin-bottom: 1rem;
}
.grid-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.grid-btn.current { border-color: var(--accent); background: var(--accent-light); color: var(--accent-hover); }
.grid-btn.answered { background: rgba(99,102,241,0.22); border-color: rgba(99,102,241,0.5); color: var(--accent-hover); }
.grid-btn.flagged { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }
.quiz-legend { display: flex; flex-direction: column; gap: 0.375rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--border); background: var(--bg-input); flex-shrink: 0; }
.legend-dot.answered { background: rgba(99,102,241,0.22); border-color: rgba(99,102,241,0.5); }
.legend-dot.flagged { border-color: var(--warning); background: var(--warning-light); }
.legend-dot.current { border-color: var(--accent); background: var(--accent-light); }
.legend-dot.unanswered { border-color: var(--border); background: var(--bg-input); }

/* ===== Quiz Page — Review Screen ===== */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.review-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.review-item:hover { border-color: var(--accent); color: var(--text-primary); }
.review-item.answered { background: rgba(99,102,241,0.18); border-color: rgba(99,102,241,0.5); color: var(--accent-hover); }
.review-item.flagged { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }

/* ===== Quiz Page — Results Screen ===== */
.results-header { display: flex; align-items: center; gap: 2.5rem; padding: 2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 1.5rem; flex-wrap: wrap; }
.results-score-ring { position: relative; width: 160px; height: 160px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.score-ring-svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); width: 160px; height: 160px; }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.score-ring-fill { fill: none; stroke-width: 8; stroke-linecap: round; }
.score-ring-label { position: relative; text-align: center; z-index: 1; }
.score-ring-value { font-size: 2.25rem; font-weight: 800; line-height: 1; }
.score-ring-sub { font-size: 0.75rem; color: var(--text-muted); }
.results-verdict { flex: 1; }
.verdict-badge { display: inline-block; padding: 0.375rem 1.25rem; border-radius: 999px; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.08em; margin-bottom: 0.75rem; }
.verdict-badge.pass { background: var(--success-light); color: var(--success); border: 2px solid rgba(34,197,94,0.4); }
.verdict-badge.fail { background: var(--danger-light); color: var(--danger); border: 2px solid rgba(239,68,68,0.4); }
.verdict-detail { color: var(--text-secondary); font-size: 1rem; line-height: 1.5; }
.results-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.result-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.125rem; text-align: center; }
.result-stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.375rem; }
.result-stat-value { display: block; font-size: 1.625rem; font-weight: 800; color: var(--text-primary); }

/* ===== Quiz Page — Full Review (results) ===== */
.review-question-item {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.review-question-item.correct-result { border-color: rgba(34,197,94,0.3); }
.review-question-item.incorrect-result { border-color: rgba(239,68,68,0.25); }
.review-question-item.unanswered { border-color: rgba(245,158,11,0.3); }
.review-q-header { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.625rem; flex-wrap: wrap; }
.review-q-num { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); min-width: 30px; }
.review-q-topic { flex: 1; font-size: 0.8rem; color: var(--text-muted); }
.review-q-status { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; }
.review-q-status.correct-result { background: var(--success-light); color: var(--success); }
.review-q-status.incorrect-result { background: var(--danger-light); color: var(--danger); }
.review-q-status.unanswered { background: var(--warning-light); color: var(--warning); }
.review-q-text { font-size: 0.9375rem; color: var(--text-primary); line-height: 1.55; margin-bottom: 0.875rem; font-weight: 500; }
.review-answer-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: -0.1rem 0 0.875rem; }
.review-answer-chip { font-size: 0.8rem; padding: 0.35rem 0.65rem; border-radius: 999px; border: 1px solid transparent; }
.review-answer-chip.user { background: var(--bg-input); color: var(--text-secondary); border-color: var(--border); }
.review-answer-chip.correct { background: var(--success-light); color: var(--success); border-color: rgba(34,197,94,0.28); }
.review-options { display: flex; flex-direction: column; gap: 0; margin-bottom: 0.875rem; }
.review-opt { font-size: 0.875rem; color: var(--text-secondary); padding: 0.4rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid transparent; }
.review-opt.correct { background: var(--success-light); color: var(--success); border-color: rgba(34,197,94,0.3); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.review-opt.wrong { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,0.3); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.review-opt-wrap { margin-bottom: 0.4rem; }
.review-opt-wrap .review-opt { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.review-opt-why { font-size: 0.8rem; color: var(--text-muted); padding: 0.35rem 0.75rem 0.45rem 1.25rem; background: var(--bg-input); border: 1px solid rgba(99,102,241,0.15); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); line-height: 1.45; }
.review-opt-why.is-correct { border-left: 3px solid rgba(34,197,94,0.5); }
.review-opt-why.is-wrong { border-left: 3px solid rgba(239,68,68,0.4); }
.review-explanation { font-size: 0.875rem; color: var(--text-muted); padding: 0.625rem 0.875rem; background: var(--bg-input); border-left: 3px solid var(--info); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; line-height: 1.5; }

/* Results tabs (Score / Answers) */
.results-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.results-tab-btn { flex: 1; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.results-tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.results-tab-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* Multi-select question badge + hint */
.multi-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--info-light);
  color: var(--info);
  border: 1px solid rgba(56,189,248,0.3);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.625rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}
.multi-hint {
  font-size: 0.8125rem;
  color: var(--info);
  padding: 0.5rem 0.75rem;
  background: var(--info-light);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
.question-text { white-space: pre-wrap; line-height: 1.65; }

/* card-title helper */
.card-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 1.25rem; }

@media (max-width: 768px) {
  .quiz-body { flex-direction: column; }
  .quiz-sidebar { width: 100%; position: static; height: auto; border-left: none; border-top: 1px solid var(--border); }
  .results-header { flex-direction: column; text-align: center; }
  .results-stats { grid-template-columns: repeat(2, 1fr); }
  .quiz-rules { grid-template-columns: 1fr; }
  .quiz-grid { grid-template-columns: repeat(8, 1fr); }
}
