/* ==========================================================================
   ULTIMATE VIBE CODING BIBLE — DESIGN SYSTEM & STYLESHEET
   Crafted for Maximum Clarity, Beginner Friendliness & High Performance
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #283548;
  --bg-code: #030712;
  --border-color: #374151;
  --border-focus: #6366f1;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --tip: #8b5cf6;
  --tip-bg: rgba(139, 92, 246, 0.1);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', Consolas, Monaco, monospace;
  --sidebar-width: 320px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.5);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-code: #1e293b;
  --border-color: #cbd5e1;
  --border-focus: #4f46e5;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-secondary: #0891b2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Top Navigation Bar */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1000;
  transition: var(--transition);
}

[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-badge {
  background: var(--accent-gradient);
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  transition: var(--transition);
}

.nav-search-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.search-shortcut {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.theme-toggle-btn, .mobile-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover, .mobile-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.mobile-toggle-btn {
  display: none;
}

/* Progress bar under top nav */
.reading-progress-container {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 999;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.1s ease-out;
}

/* Layout Wrapper */
.layout-container {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  position: fixed;
  top: var(--header-height);
  left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.25rem 1rem 3rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 900;
  transition: transform 0.3s ease;
}

.sidebar-search-box {
  position: relative;
}

.sidebar-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

.sidebar-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.sidebar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.progress-percentage {
  color: var(--accent-primary);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.3s ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nav-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.4rem;
  padding-left: 0.5rem;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-item a:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item a.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
  border-left: 3px solid var(--accent-primary);
}

.nav-item .part-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 22px;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem 3rem 6rem 3rem;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, rgba(17, 24, 39, 0) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  margin-bottom: 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.75rem;
  line-height: 1.2;
  font-weight: 900;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 850px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.hero-feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.hero-feature-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.hero-feature-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.hero-feature-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Quick Tools Bar */
.quick-tools-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.tool-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.tool-tab-btn:hover, .tool-tab-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Interactive Calculator & Decision Widget */
.interactive-widget-box {
  background: var(--bg-secondary);
  border: 2px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 3rem;
  display: none;
}

.interactive-widget-box.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Content Chapter Sections */
.chapter-section {
  margin-bottom: 4.5rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.chapter-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.chapter-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.chapter-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.chapter-lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Class 5 Analogy Card */
.analogy-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.75rem 0;
  position: relative;
}

.analogy-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: #c4b5fd;
  margin-bottom: 0.75rem;
}

.analogy-icon {
  font-size: 1.5rem;
}

.analogy-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.analogy-formula {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #a5b4fc;
}

/* Alerts / Callouts */
.alert-box {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
  line-height: 1.6;
}

.alert-note {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--text-primary);
}

.alert-tip {
  background: var(--tip-bg);
  border-color: var(--tip);
  color: var(--text-primary);
}

.alert-important {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--text-primary);
}

.alert-caution {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--text-primary);
}

.alert-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Code Blocks & Terminal Windows */
.code-block-wrapper {
  margin: 1.5rem 0;
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.code-header {
  background: #111827;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.code-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.window-dots {
  display: flex;
  gap: 5px;
}

.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

pre {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: #e2e8f0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

p code, li code, td code {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Visual Screenshot Checkpoint UI Mockups (Rule 2 Compliance) */
.screenshot-checkpoint-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin: 1.75rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.checkpoint-header {
  background: #111827;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.checkpoint-badge {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.checkpoint-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.mockup-viewport {
  background: #030712;
  padding: 1.5rem;
  position: relative;
}

.mock-browser-bar {
  background: #1f2937;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.mock-url {
  color: #60a5fa;
}

.mock-ui-body {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 1.25rem;
}

.mock-ui-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #1f2937;
}

.mock-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.mock-btn-primary {
  background: #10b981;
  color: #fff;
  border: none;
}

.mock-btn-brand {
  background: #6366f1;
  color: #fff;
  border: none;
}

.mock-badge-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.checkpoint-footer {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  line-height: 1.5;
}

.checkpoint-footer strong {
  color: var(--accent-secondary);
}

/* Comparison Tables */
.table-container {
  overflow-x: auto;
  margin: 1.75rem 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

thead th {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge-winner {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #10b981;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
}

.badge-runnerup {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid #6366f1;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Decision Tree Cards */
.decision-tree-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.75rem 0;
}

.decision-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-top: 4px solid var(--accent-primary);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.decision-card.alt {
  border-top-color: var(--accent-secondary);
}

.decision-card.warning {
  border-top-color: var(--warning);
}

.decision-condition {
  font-size: 0.85rem;
  font-weight: 700;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.decision-recommendation {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.decision-reason {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Step By Step Numbered List */
.step-list {
  list-style: none;
  counter-reset: step-counter;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-item {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3.5rem;
}

.step-item::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.step-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Interactive Checklists */
.checklist-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.checklist-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-checkbox {
  margin-top: 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.checklist-label {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
  transition: var(--transition);
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Prompt Card System */
.prompt-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
  overflow: hidden;
}

.prompt-card-header {
  background: #1e293b;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.prompt-role {
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.prompt-body {
  padding: 1rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Troubleshooting Card */
.trouble-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.trouble-card:hover {
  border-color: var(--danger);
  transform: translateY(-2px);
}

.trouble-symptom {
  color: var(--danger);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.trouble-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}

.trouble-col h5 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.trouble-col p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Search Modal */
.search-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-modal-backdrop.open {
  display: flex;
}

.search-modal-box {
  width: 90%;
  max-width: 640px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.search-modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-modal-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  outline: none;
}

.search-results-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: var(--transition);
  text-decoration: none;
}

.search-result-item:hover {
  background: var(--bg-card);
}

.search-result-title {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
}

.search-result-snippet {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 1.5rem 1.25rem 4rem 1.25rem;
  }
  .mobile-toggle-btn {
    display: flex;
  }
  .hero-title {
    font-size: 2.1rem;
  }
  .trouble-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .chapter-title {
    font-size: 1.5rem;
  }
  .step-item {
    padding-left: 2.75rem;
  }
  .step-item::before {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   MULTI-PAGE & 200+ IDEAS ENHANCEMENTS
   ========================================================================== */

.nav-center-pages {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-page-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-page-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-page-link.active {
  color: #fff;
  background: var(--accent-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

@media (max-width: 1024px) {
  .nav-center-pages {
    display: none;
  }
}

/* Category Filter Bar */
.category-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 0 1.25rem 0;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.filter-pill:hover, .filter-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Idea Card Grid */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 3rem 0;
}

.idea-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.idea-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.idea-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.idea-icon-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.idea-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.idea-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.idea-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.idea-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.badge-cat {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-easy {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-med {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.idea-detail-row {
  margin: 0.4rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.idea-label {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  display: block;
}

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

.idea-prompt-box {
  background: #030712;
  border: 1px solid #1f2937;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-top: 1rem;
}

.prompt-copy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 700;
}

.idea-prompt-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #cbd5e1;
  max-height: 90px;
  overflow-y: auto;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ==========================================================================
   100% SCREEN-FRIENDLY & MOBILE RESPONSIVE ENGINE (ALL VIEWPORTS)
   ========================================================================== */

/* 1. Fluid Typography with clamp() */
.hero-title {
  font-size: clamp(1.65rem, 5vw, 2.75rem);
  line-height: 1.25;
  word-break: break-word;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  line-height: 1.6;
}

.chapter-title {
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.3;
  word-break: break-word;
}

/* 2. Universal Mobile Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  padding: 1.25rem 1.5rem 1.75rem 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 995;
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  max-height: calc(100vh - var(--header-height) - 1rem);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
}

.mobile-drawer-link:hover, .mobile-drawer-link.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

/* 3. Universal Safe-Grid layouts for Small Displays (<360px) */
.ideas-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
}

.hero-features-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.decision-tree-container {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* 4. Touch Targets & Inputs (16px to prevent iOS auto-zoom) */
input, select, textarea {
  font-size: 16px !important;
}

button, a, input, select {
  touch-action: manipulation;
}

/* 5. Smooth Touch Table Scrolling with indicators */
.table-container {
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.table-container::after {
  content: '👉 Scroll table horizontally to view full data';
  display: none;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.4);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
}

@media (max-width: 768px) {
  .table-container::after {
    display: block;
  }
}

/* 6. Back-to-Top Floating Button */
.back-to-top-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  z-index: 800;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: var(--transition);
}

.back-to-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
}

/* 7. Comprehensive Breakpoint Fine-Tuning */
@media (max-width: 768px) {
  .top-nav {
    padding: 0 1rem;
  }
  
  .brand span:first-child {
    font-size: 1.05rem;
  }
  
  .brand-badge {
    display: none; /* Keep header clean on small screens */
  }

  .nav-search-btn span:first-child {
    display: none;
  }
  .nav-search-btn::before {
    content: '🔍';
  }
  .search-shortcut {
    display: none;
  }

  .hero-section {
    padding: 1.75rem 1.25rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
  }

  .main-content {
    padding: 1.25rem 1rem 4rem 1rem;
  }

  .step-item {
    padding-left: 2.75rem;
  }
  .step-item::before {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
  }

  .checkpoint-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .search-modal-box {
    width: 95%;
    max-height: 80vh;
  }
}

@media (max-width: 480px) {
  .hero-section {
    padding: 1.5rem 1rem;
  }
  .code-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .copy-btn {
    align-self: flex-end;
  }
  .quick-tools-bar {
    flex-direction: column;
  }
  .tool-tab-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Print Optimization */
@media print {
  .top-nav, .sidebar, .reading-progress-container, .quick-tools-bar, .back-to-top-btn, #searchModal {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .chapter-section {
    page-break-inside: avoid;
  }
}
