/* ===== SYSTEM DESIGN COURSE - DARK GLOSS THEME ===== */

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

:root {
  color-scheme: dark;
  --bg-primary: #000000;
  --bg-secondary: #0d0d0d;
  --bg-card: rgba(19, 19, 19, 0.85);
  --bg-card-hover: rgba(26, 26, 26, 0.95);
  --bg-code: #0d0d0d;
  --bg-inline-code: rgba(45, 212, 191, 0.1);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-hover: rgba(45, 212, 191, 0.3);
  --text-primary: #f0ece8;
  --text-secondary: #a89eb0;
  --text-muted: #7a7080;
  --accent-1: #2dd4bf;
  --accent-2: #818cf8;
  --accent-3: #a5b4fc;
  --accent-gradient: linear-gradient(135deg, #2dd4bf, #818cf8);
  --accent-glow: rgba(45, 212, 191, 0.15);
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;
  --info: #2dd4bf;
  --node-client: #2dd4bf;
  --node-server: #818cf8;
  --node-db: #a5b4fc;
  --node-cache: #fbbf24;
  --node-queue: #4ade80;
  --node-lb: #f472b6;
  --node-cdn: #22d3ee;
  --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(45, 212, 191, 0.1);
  --transition-fast: 0.18s ease;
  --transition-normal: 0.18s ease;
  --transition-slow: 0.36s ease;
}

/* --- Light Mode --- */
[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #fafaf8;
  --bg-secondary: #f3f3f1;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-code: #f3f3f1;
  --bg-inline-code: rgba(45, 212, 191, 0.08);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-hover: rgba(45, 212, 191, 0.35);
  --text-primary: #0f0e0d;
  --text-secondary: #57535e;
  --text-muted: #a09898;
  --accent-1: #0f9688;
  --accent-2: #6366f1;
  --accent-3: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #0f9688, #6366f1);
  --accent-glow: rgba(15, 150, 136, 0.1);
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --info: #0f9688;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 30px rgba(15, 150, 136, 0.08);
}

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* --- Top Navigation --- */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.85), rgba(18, 18, 18, 0.95));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(to right, #60a5fa, #a78bfa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-links a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.nav-links a.lab-link {
  margin-left: 0.5rem;
  background: transparent;
  color: var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  font-weight: 600;
}

.nav-links a.lab-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-divider-slot {
  display: flex;
  align-items: center;
}

.nav-divider {
  width: 1px;
  height: 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 0.25rem;
}

.nav-theme-slot,
.auth-slot {
  display: flex;
  align-items: center;
}

.auth-buttons {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.auth-buttons.visible {
  display: flex;
}

.auth-btn {
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.nav-links a.auth-btn-login,
.nav-links a.auth-btn-signup {
  color: var(--text-secondary);
  border: none;
  background: transparent;
}

.nav-links a.auth-btn-login:hover,
.nav-links a.auth-btn-signup:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.auth-avatar {
  display: none;
  align-items: center;
}

.auth-avatar.visible {
  display: flex;
}

.auth-avatar-img {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--accent-gradient);
  border: 2px solid var(--glass-border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  overflow: hidden;
  text-decoration: none;
  transition: border-color var(--transition-fast);
}

.auth-avatar-img:hover {
  border-color: var(--glass-border-hover);
}

.auth-avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: width var(--transition-normal);
  border-radius: 0 1px 1px 0;
}

/* --- Layout --- */
.page-wrapper {
  position: relative;
  z-index: 1;
  padding-top: 64px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-1), transparent);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #e8e8f0 0%, #a78bfa 50%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

/* --- Glass Cards --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.card:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card-number {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.6;
  margin-left: 3.5rem;
}

.card-meta {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  margin-left: 3.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-beginner { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-intermediate { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-advanced { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-expert { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

/* --- Module Group --- */
.module-group {
  margin-bottom: 3rem;
}

.module-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding-left: 0.5rem;
}

/* --- Article Content --- */
.article-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--glass-border);
}

.article-header .breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.article-header .breadcrumb a {
  color: var(--accent-3);
  text-decoration: none;
}

.article-header .breadcrumb a:hover {
  text-decoration: underline;
}

.article-header h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.article-header .lead {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.article-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 3rem 0 1.25rem;
  letter-spacing: -0.02em;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

.article-content h2:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--accent-3);
}

.article-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.article-content p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content ul, .article-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-secondary);
}

.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-content a {
  color: var(--accent-3);
  text-decoration: none;
  border-bottom: 1px solid rgba(167, 139, 250, 0.3);
  transition: all var(--transition-fast);
}

.article-content a:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

/* --- Code Blocks --- */
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-inline-code);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  color: var(--accent-3);
}

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  position: relative;
}

.code-block code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.6;
  display: block;
  white-space: pre;
}

.code-block .label {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Info / Callout Boxes --- */
.callout {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 3px solid;
  background: var(--bg-card);
}

.callout-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.callout-body {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.callout-info { border-color: var(--info); }
.callout-info .callout-title { color: var(--info); }

.callout-warning { border-color: var(--warning); }
.callout-warning .callout-title { color: var(--warning); }

.callout-tip { border-color: var(--success); }
.callout-tip .callout-title { color: var(--success); }

.callout-key { border-color: var(--accent-2); }
.callout-key .callout-title { color: var(--accent-2); }

/* --- Diagrams / Node Visuals --- */
.diagram-container {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  overflow-x: auto;
}

.diagram-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.diagram-container svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* SVG Node Styles */
.node-rect {
  rx: 10;
  ry: 10;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

.node-text {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
}

.node-subtext {
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 400;
  fill: rgba(255,255,255,0.7);
  text-anchor: middle;
  dominant-baseline: central;
}

.edge-line {
  stroke-width: 2;
  fill: none;
  marker-end: url(#arrowhead);
}

.edge-label {
  font-family: var(--font-main);
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.article-content th {
  background: rgba(99, 102, 241, 0.1);
  padding: 0.85rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.article-content td {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.article-content tr:last-child td { border-bottom: none; }
.article-content tr:hover td {
  background: rgba(99, 102, 241, 0.03);
}

/* --- Navigation Footer --- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
}

.page-nav a {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  transition: all var(--transition-normal);
  max-width: 48%;
  background: var(--bg-card);
}

.page-nav a:hover {
  border-color: var(--glass-border-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-glow);
}

.page-nav .nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.page-nav .nav-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-3);
}

.page-nav .prev { text-align: left; }
.page-nav .next { text-align: right; margin-left: auto; }

/* --- Quiz Styles --- */
.quiz-container {
  counter-reset: question;
}

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  counter-increment: question;
  position: relative;
}

.quiz-question::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.quiz-question h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.quiz-question h3::before {
  content: "Q" counter(question) ". ";
  color: var(--accent-3);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.925rem;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  width: 100%;
}

.quiz-option:hover {
  border-color: var(--glass-border-hover);
  background: rgba(99, 102, 241, 0.05);
  color: var(--text-primary);
}

.quiz-option .option-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  color: var(--text-muted);
}

.quiz-option:hover .option-marker {
  border-color: var(--accent-1);
  color: var(--accent-3);
}

.quiz-option.selected {
  border-color: var(--accent-1);
  background: rgba(99, 102, 241, 0.1);
}

.quiz-option.selected .option-marker {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: white;
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.quiz-option.correct .option-marker {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.08);
}

.quiz-option.incorrect .option-marker {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.quiz-option.disabled {
  pointer-events: none;
}

.quiz-explanation {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid var(--accent-1);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  display: none;
}

.quiz-explanation.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

.quiz-score {
  text-align: center;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  margin-top: 2rem;
}

.quiz-score .score-number {
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.quiz-score .score-label {
  font-size: 1rem;
  color: var(--text-secondary);
}

.quiz-score .score-message {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 500;
}

.quiz-actions {
  text-align: center;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--glass-border-hover);
  background: rgba(99, 102, 241, 0.1);
}

/* --- Comparison Blocks --- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.comparison-col {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.comparison-col h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--glass-border);
}

.comparison-col ul {
  margin-left: 1rem;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.stagger > * {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.4s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.5s; }

/* --- Progress Steps --- */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1.5rem 0;
  position: relative;
}

.step {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 0;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 48px;
  bottom: 0;
  width: 2px;
  background: var(--glass-border);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
  z-index: 1;
}

.step-content h4 {
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.step-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Key-Value List --- */
.kv-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
}

.kv-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  gap: 1rem;
  line-height: 1.5;
}

.kv-list li:last-child { border-bottom: none; }

.kv-list .kv-key {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 160px;
  flex-shrink: 0;
}

.kv-list .kv-val {
  color: var(--text-secondary);
}

/* --- Responsive --- */
/* --- Mobile Navigation Toggle --- */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--glass-border);
  background: rgba(7, 7, 14, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
}

.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col ul li a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-col ul li a:hover {
  color: var(--accent-3);
}

.footer-bottom {
  border-top: 1px solid var(--glass-border);
  padding-top: 1.5rem;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 1439px) {
  .top-nav {
    padding: 0 1rem;
    overflow: visible;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
  }

  .nav-toggle:hover {
    border-color: var(--glass-border-hover);
    background: rgba(99, 102, 241, 0.08);
  }

  .nav-toggle span {
    width: 20px;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    left: auto;
    bottom: 0;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    width: min(88vw, 360px);
    margin: 0;
    padding: 1rem 0.85rem 1rem;
    flex-direction: column;
    gap: 0.35rem;
    background: rgba(7, 7, 14, 0.96);
    border-left: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    z-index: 1210;
    pointer-events: none;
    visibility: hidden;
  }

  .nav-links.open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 0.65rem 0.9rem;
  }

  .nav-divider-slot {
    display: none;
  }

  .nav-theme-slot,
  .auth-slot {
    width: 100%;
  }

  .nav-theme-slot {
    padding: 0.5rem 0.75rem;
  }

  .auth-buttons.visible,
  .auth-avatar.visible {
    width: 100%;
    justify-content: flex-start;
    padding: 0.25rem 0.75rem;
  }

  body.nav-drawer-open {
    overflow: hidden;
  }

  body.nav-drawer-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: 1190;
  }
}

@media (max-width: 768px) {
  .container, .container-wide {
    padding: 2rem 1.25rem 4rem;
  }

  .hero {
    padding: 4rem 1.25rem 3rem;
  }

  .comparison {
    grid-template-columns: 1fr;
  }

  .page-nav {
    flex-direction: column;
  }

  .page-nav a {
    max-width: 100%;
  }

  .card {
    padding: 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .footer-brand {
    grid-column: span 2;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: span 1;
  }
}

/* ===== Custom Modal / Toast ===== */

.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  animation: modalFadeIn 0.2s ease forwards;
}

@keyframes modalFadeIn {
  to { opacity: 1; }
}

.custom-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99, 102, 241, 0.08);
  transform: translateY(8px) scale(0.97);
  animation: modalSlideIn 0.25s ease forwards;
}

@keyframes modalSlideIn {
  to { transform: translateY(0) scale(1); }
}

.custom-modal h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.custom-modal p {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.custom-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.custom-modal-actions .btn {
  min-width: 90px;
  justify-content: center;
  font-size: 0.875rem;
  padding: 0.55rem 1.25rem;
}

/* --- Toast notification --- */
.custom-toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border-hover);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.925rem;
  font-weight: 500;
  z-index: 10001;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  animation: toastSlideIn 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 380px;
}

.custom-toast.success { border-left: 3px solid var(--success); }
.custom-toast.error { border-left: 3px solid var(--error); }
.custom-toast.warning { border-left: 3px solid var(--warning); }
.custom-toast.info { border-left: 3px solid var(--info); }

.custom-toast .toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.custom-toast .toast-icon svg {
  width: 20px;
  height: 20px;
}

.custom-toast.hiding {
  animation: toastSlideOut 0.25s ease forwards;
}

@keyframes toastSlideIn {
  to { transform: translateX(0); }
}

@keyframes toastSlideOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.15rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  margin-left: 0.25rem;
}

.nav-links li:has(.theme-toggle) {
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .theme-toggle {
  background: transparent;
  color: var(--text-secondary);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

/* Dark mode (default): match app nav icon behavior */
.theme-toggle .icon-moon { display: block; }

/* Light mode: match app nav icon behavior */
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ===== LIGHT MODE OVERRIDES ===== */
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(79, 70, 229, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(124, 58, 237, 0.04) 0%, transparent 60%);
}

[data-theme="light"] .top-nav {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(247, 247, 247, 0.95));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

@media (max-width: 1439px) {
  [data-theme="light"] .nav-links {
    background: rgba(245, 245, 250, 0.97);
  }

  [data-theme="light"] body.nav-drawer-open::after {
    background: rgba(16, 18, 35, 0.28);
  }
}

[data-theme="light"] .site-footer {
  background: rgba(245, 245, 250, 0.7);
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.25);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 70, 229, 0.45);
}

[data-theme="light"] .hero h1,
[data-theme="light"] .landing-hero h1 .gradient-text {
  background: linear-gradient(135deg, #1a1a2e 0%, #4f46e5 50%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .card::before,
[data-theme="light"] .feature-card::before,
[data-theme="light"] .quiz-question::before {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
}

[data-theme="light"] .article-content tr:hover td {
  background: rgba(79, 70, 229, 0.04);
}

[data-theme="light"] .article-content th {
  background: rgba(79, 70, 229, 0.06);
}

[data-theme="light"] .quiz-option:hover {
  background: rgba(79, 70, 229, 0.05);
}

[data-theme="light"] .quiz-option.selected {
  background: rgba(79, 70, 229, 0.08);
}

[data-theme="light"] .quiz-explanation {
  background: rgba(79, 70, 229, 0.05);
}

[data-theme="light"] .badge-beginner { background: rgba(5, 150, 105, 0.1); color: #059669; }
[data-theme="light"] .badge-intermediate { background: rgba(217, 119, 6, 0.1); color: #d97706; }
[data-theme="light"] .badge-advanced { background: rgba(220, 38, 38, 0.1); color: #dc2626; }
[data-theme="light"] .badge-expert { background: rgba(109, 40, 217, 0.1); color: #6d28d9; }

[data-theme="light"] .node-text,
[data-theme="light"] .node-subtext {
  fill: white;
}

[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .nav-links a.active {
  color: var(--text-primary);
}

[data-theme="light"] .nav-links a:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-links a.active {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .nav-divider {
  background: rgba(0, 0, 0, 0.14);
}

[data-theme="light"] .nav-links a.lab-link {
  color: var(--accent-2);
}

[data-theme="light"] .nav-links a.lab-link:hover,
[data-theme="light"] .nav-links a.auth-btn-login:hover,
[data-theme="light"] .nav-links a.auth-btn-signup:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* ===== GUIDED LAB CTA ===== */
.guided-lab-cta {
  margin: 3rem 0;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  border-radius: var(--radius-lg);
  animation: cta-glow 3s ease-in-out infinite alternate;
}

@keyframes cta-glow {
  0% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
  100% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.3); }
}

.lab-cta-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-radius: calc(var(--radius-lg) - 2px);
}

.lab-cta-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.lab-cta-text {
  flex: 1;
}

.lab-cta-text h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.lab-cta-text p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lab-cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.lab-cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

@media (max-width: 768px) {
  .lab-cta-content {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }
  
  .lab-cta-button {
    width: 100%;
    justify-content: center;
  }
}

[data-theme="light"] .lab-cta-content {
  background: white;
}

[data-theme="light"] .lab-cta-text h3 {
  color: #1a1a2e;
}

[data-theme="light"] .lab-cta-text p {
  color: #64748b;
}

/* ── Chapter Top CTA Bar ──────────────────────────────── */
.chapter-cta-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 2rem 0;
}

.chapter-cta-bar .cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.chapter-cta-bar .cta-btn:hover {
  opacity: 0.85;
}

.chapter-cta-bar .cta-lab {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #a78bfa;
}

.chapter-cta-bar .cta-quiz {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

[data-theme="light"] .chapter-cta-bar .cta-lab {
  background: rgba(139, 92, 246, 0.08);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="light"] .chapter-cta-bar .cta-quiz {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}
