/* ==========================================================================
   learn Web Cockpit — Authentic Engineering Design System
   Entwickelt für Jeremy Benz (@benzjeremy) | GPL-3.0
   Strikt nach ISO/IEC 25010, WCAG AAA und Human-Centered UX
   ========================================================================== */

/* Light Mode (Standard) */
:root {
  --bg-page: #f6f8fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f6;
  --bg-subtle: #f6f8fa;
  --bg-input: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);

  --border-subtle: #d0d7de;
  --border-strong: #afb8c1;
  --border-focus: #0969da;

  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #6e7781;

  --accent-primary: #0969da;
  --accent-primary-hover: #0550ae;
  --accent-primary-bg: #ddf4ff;
  --accent-primary-border: #54aeff;

  --accent-cyan: #0969da;
  --accent-cyan-glow: rgba(9, 105, 218, 0.12);

  --accent-emerald: #1a7f37;
  --accent-emerald-bg: #dafbe1;
  --accent-emerald-border: #4ac26b;

  --accent-amber: #9a6700;
  --accent-amber-bg: #fff8c5;
  --accent-amber-border: #d4a72c;

  --accent-rose: #cf222e;
  --accent-rose-bg: #ffebe9;
  --accent-rose-border: #ff8182;

  --accent-violet: #8250df;
  --accent-violet-bg: #fbefff;
  --accent-violet-border: #d2a8ff;

  --code-bg: #24292f;
  --code-text: #f0f6fc;
  --code-border: #30363d;

  --card-shadow: 0 1px 3px rgba(31, 35, 40, 0.08), 0 1px 2px rgba(31, 35, 40, 0.04);
  --card-shadow-hover: 0 6px 18px rgba(31, 35, 40, 0.1);
  --modal-shadow: 0 12px 36px rgba(31, 35, 40, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-page: #0d1117;
  --bg-surface: #161b22;
  --bg-card: #161b22;
  --bg-card-hover: #21262d;
  --bg-subtle: #161b22;
  --bg-input: #0d1117;
  --header-bg: rgba(22, 27, 34, 0.92);

  --border-subtle: #30363d;
  --border-strong: #484f58;
  --border-focus: #58a6ff;

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --accent-primary: #58a6ff;
  --accent-primary-hover: #79b8ff;
  --accent-primary-bg: rgba(56, 139, 253, 0.15);
  --accent-primary-border: rgba(56, 139, 253, 0.4);

  --accent-cyan: #58a6ff;
  --accent-cyan-glow: rgba(88, 166, 255, 0.15);

  --accent-emerald: #3fb950;
  --accent-emerald-bg: rgba(46, 160, 67, 0.15);
  --accent-emerald-border: rgba(46, 160, 67, 0.4);

  --accent-amber: #d29922;
  --accent-amber-bg: rgba(187, 128, 9, 0.15);
  --accent-amber-border: rgba(187, 128, 9, 0.4);

  --accent-rose: #f85149;
  --accent-rose-bg: rgba(248, 81, 73, 0.15);
  --accent-rose-border: rgba(248, 81, 73, 0.4);

  --accent-violet: #a371f7;
  --accent-violet-bg: rgba(163, 113, 247, 0.15);
  --accent-violet-border: rgba(163, 113, 247, 0.4);

  --code-bg: #090d13;
  --code-text: #f0f6fc;
  --code-border: #30363d;

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.6);
  --modal-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
}

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

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   App Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.header-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.back-link:hover {
  color: var(--accent-primary);
  background: var(--accent-primary-bg);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 1rem;
}

.app-logo {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.app-title {
  letter-spacing: -0.01em;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--card-shadow);
}

.stat-icon {
  font-size: 0.875rem;
}

/* Header Controls */
.app-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.lang-switch {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   Main Layout: Sidebar & Content Stage
   ========================================================================== */
.app-layout {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  gap: 24px;
}

@media (max-width: 860px) {
  .app-layout {
    flex-direction: column;
  }
}

/* Course Sidebar */
.course-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 860px) {
  .course-sidebar {
    width: 100%;
  }
}

.sidebar-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 4px;
}

.course-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course-card-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
  color: inherit;
  width: 100%;
  box-shadow: var(--card-shadow);
  position: relative;
}

.course-card-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.course-card-btn.active {
  background: var(--bg-surface);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary), var(--card-shadow);
}

.course-card-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent-primary);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.c-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.course-card-btn.active .c-card-icon {
  background: var(--accent-primary-bg);
  border-color: var(--accent-primary-border);
}

.c-card-info {
  flex: 1;
  min-width: 0;
}

.c-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-card-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--accent-primary-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-bottom: 2px;
}

.c-card-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Content Stage
   ========================================================================== */
.content-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stage-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-primary-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stage-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stage-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ==========================================================================
   Chapter Grid & Cards
   ========================================================================== */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.chapter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 160px;
}

.chapter-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--card-shadow-hover);
}

.chapter-card.exam-card {
  border: 1px solid var(--accent-amber-border);
  background: var(--bg-surface);
}

.chapter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chapter-number {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-primary);
}

.chapter-card.exam-card .chapter-number {
  color: var(--accent-amber);
}

.chapter-level-pill {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.chapter-level-pill.pill-exam {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  border-color: var(--accent-amber-border);
}

.chapter-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.chapter-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.completed-check {
  color: var(--accent-emerald);
  font-weight: 600;
}

.chapter-exam-score-pill {
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

.btn-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  width: 100%;
}

.btn-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-card.highlight {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.btn-card.highlight:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.chapter-card.exam-card .btn-card.highlight {
  background: var(--accent-amber);
  border-color: var(--accent-amber);
  color: #ffffff;
}

/* ==========================================================================
   Active Lesson / Quiz Runner Player
   ========================================================================== */
.lesson-player {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--card-shadow);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
}

.player-close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9375rem;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.player-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.progress-container {
  flex: 1;
  height: 6px;
  background: var(--bg-page);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Concept Box */
.concept-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 75ch;
}

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

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

.concept-body p {
  margin-bottom: 12px;
}

.concept-body ul, .concept-body ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.concept-body li {
  margin-bottom: 6px;
}

.concept-body strong {
  color: var(--text-primary);
}

.concept-body code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-primary);
}

/* Code Block Container */
.code-block-container {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--code-text);
  box-shadow: var(--card-shadow);
}

/* Quiz Box */
.quiz-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-prompt {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.option-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.9375rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.15s ease;
  box-shadow: var(--card-shadow);
}

.option-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.option-btn.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-bg);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.option-btn.correct {
  border-color: var(--accent-emerald-border);
  background: var(--accent-emerald-bg);
  box-shadow: 0 0 0 1px var(--accent-emerald);
}

.option-btn.wrong {
  border-color: var(--accent-rose-border);
  background: var(--accent-rose-bg);
  box-shadow: 0 0 0 1px var(--accent-rose);
}

.option-indicator {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.option-btn.selected .option-indicator {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: #ffffff;
}

.option-btn.correct .option-indicator {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald);
  color: #ffffff;
}

.option-btn.wrong .option-indicator {
  border-color: var(--accent-rose);
  background: var(--accent-rose);
  color: #ffffff;
}

/* Feedback Banner */
.feedback-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.feedback-banner.success {
  background: var(--accent-emerald-bg);
  border: 1px solid var(--accent-emerald-border);
  color: var(--accent-emerald);
}

.feedback-banner.error {
  background: var(--accent-rose-bg);
  border: 1px solid var(--accent-rose-border);
  color: var(--accent-rose);
}

.feedback-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feedback-desc {
  color: var(--text-primary);
}

/* Player Actions */
.player-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent-primary);
  color: #ffffff;
  border: 1px solid var(--accent-primary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-action.secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-action.secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Interactive Compiler Lab & Sandbox
   ========================================================================== */
.compiler-lab-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compiler-instruction {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.compiler-editor-wrap {
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--card-shadow);
}

.compiler-editor-header {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--code-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.compiler-textarea {
  width: 100%;
  min-height: 140px;
  background: transparent;
  border: none;
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 14px;
  resize: vertical;
  outline: none;
}

.compiler-console-wrap {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  min-height: 80px;
  color: var(--code-text);
}

.console-header {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.console-output {
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.console-output.success {
  color: var(--accent-emerald);
}

.console-output.error {
  color: var(--accent-rose);
}

/* ==========================================================================
   Exam Mode Sticky Bar & Navigator
   ========================================================================== */
.exam-timer-bar {
  background: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--accent-amber);
  font-size: 0.875rem;
}

.exam-nav-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.exam-nav-pill {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.exam-nav-pill:hover {
  background: var(--bg-card-hover);
}

.exam-nav-pill.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: #ffffff;
}

.exam-nav-pill.answered {
  border-color: var(--accent-emerald-border);
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
}

/* ==========================================================================
   AI Code Tutor Dock & Chat Drawer
   ========================================================================== */
.ai-assistant-dock {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--modal-shadow);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ai-assistant-dock:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.dock-icon {
  font-size: 1rem;
}

.dock-status {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--accent-primary-bg);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Drawer Backdrop & Window */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-drawer {
  width: 100%;
  max-width: 400px;
  height: 520px;
  max-height: 80vh;
  margin: 0 20px 20px 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--modal-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.open .ai-chat-drawer {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .ai-chat-drawer {
    margin: 0;
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.drawer-header {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  font-weight: 700;
  font-size: 0.9375rem;
}

.status-badge-dev {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent-amber);
  background: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.drawer-close:hover {
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bot-greeting-card {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 12px;
}

.bot-avatar-large {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.bot-msg-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.bot-msg-content p {
  margin-bottom: 8px;
}

.drawer-footer {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.drawer-input-disabled {
  width: 100%;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==========================================================================
   Modals (Settings & Feedback)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--modal-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.setting-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.setting-input {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8125rem;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.8125rem;
  background: var(--bg-surface);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--accent-primary);
}
