/**
 * JavaScript for QA Study Platform Stylesheet
 * Responsive dark/light theme, modern card layout, 3D flashcard flip,
 * question bank pagination, mock exam simulator, and interactive QA tools.
 */

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

  /* Theme Colors - Dark (Default) */
  --bg-base: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #283548;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border-color: #334155;
  --border-focus: #f59e0b;

  /* Brand Accents */
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-rgb: 245, 158, 11;
  --secondary: #6366f1;
  --secondary-hover: #4f46e5;
  --accent: #38bdf8;

  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  /* Shadows & Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #d97706;

  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-rgb: 217, 119, 6;
  --secondary: #4f46e5;
  --secondary-hover: #4338ca;
  --accent: #0284c7;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.navbar-container {
  max-width: 1350px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface);
}

.nav-btn.active {
  color: #fbbf24;
  background-color: rgba(245, 158, 11, 0.12);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

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

/* Main Content Container */
.main-container {
  max-width: 1350px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* Views & Panels */
.view-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-panel.active {
  display: block;
}

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

/* Dashboard Banner */
.dash-hero {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(99, 102, 241, 0.08));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.dash-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0) 70%);
  pointer-events: none;
}

.dash-hero-text h1 {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

.dash-hero-text h1 span {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dash-hero-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 680px;
  margin-bottom: 1.25rem;
}

.dash-chips {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chip-tag {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-icon.blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Feature Cards Grid */
.dash-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.dash-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.dash-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dash-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.dash-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.dash-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.dash-card-footer {
  margin-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.dash-card-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-subtle);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #0f172a;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

/* Section Title Rows */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Chapter Study Guide View
   ========================================================================== */
.chapters-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .chapters-layout {
    grid-template-columns: 1fr;
  }
}

.chapter-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 5rem;
}

.chapter-sidebar-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

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

.chapter-nav-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}

.chapter-nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.chapter-nav-item.active {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.chapter-nav-num {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 700;
}

.chapter-nav-item.active .chapter-nav-num {
  color: #f59e0b;
}

.chapter-content-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

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

.chapter-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.badge-tag {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-klevel {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.chapter-title-text {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.chapter-subtitle-text {
  color: var(--text-muted);
  font-size: 1rem;
}

.learning-objectives-box {
  background: rgba(99, 102, 241, 0.08);
  border-left: 4px solid #6366f1;
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 2rem;
}

.learning-objectives-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #818cf8;
  margin-bottom: 0.5rem;
}

.learning-objectives-box ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.learning-objectives-box li {
  margin-bottom: 0.35rem;
}

.section-block {
  margin-bottom: 2.25rem;
}

.section-block h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.section-block p {
  margin-bottom: 0.85rem;
  line-height: 1.65;
  color: var(--text-main);
}

.section-block ul, .section-block ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.section-block li {
  margin-bottom: 0.45rem;
  line-height: 1.5;
}

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

.cheatsheet-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.cheatsheet-key {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fbbf24;
  margin-bottom: 0.35rem;
}

.cheatsheet-val {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.pitfalls-box {
  background: rgba(239, 68, 68, 0.08);
  border-left: 4px solid var(--danger);
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: 2rem;
}

.pitfalls-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.5rem;
}

.pitfalls-box ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.pitfalls-box li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Flashcards View (3D Flip Animation)
   ========================================================================== */
.flashcards-container {
  max-width: 760px;
  margin: 0 auto;
}

.deck-progress-bar {
  background: var(--bg-surface);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.deck-progress-fill {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.flashcard-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.flashcard-progress-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-perspective-stage {
  perspective: 1000px;
  height: 380px;
  margin-bottom: 1.5rem;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
}

.card-front {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-surface));
}

.card-back {
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
  transform: rotateY(180deg);
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-chapter-tag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  padding: 3px 10px;
  border-radius: 9999px;
}

.card-flip-prompt {
  font-size: 0.8rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 0;
}

.card-front .card-main-content h3 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-main);
}

.card-back .card-main-content p {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
  text-align: left;
}

.card-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.card-category-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.flashcard-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Practice Question Bank View
   ========================================================================== */
.practice-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.filters-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.filter-select:focus {
  border-color: var(--primary);
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  width: 280px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  width: 320px;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-jump-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.page-num-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-num-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.page-num-btn.active {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
}

.page-num-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.question-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.question-num {
  font-size: 0.9rem;
  font-weight: 800;
  color: #fbbf24;
}

.question-body {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.question-body code, .question-card code {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #38bdf8;
}

.question-body pre, .question-card pre {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #f1f5f9;
}

.question-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  user-select: none;
}

.option-item:hover:not(.locked) {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.option-item.selected {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.1);
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
}

.option-item.correct {
  border-color: var(--success) !important;
  background: rgba(16, 185, 129, 0.12) !important;
}

.option-item.correct .option-letter {
  background: var(--success) !important;
  color: #ffffff !important;
  border-color: var(--success) !important;
}

.option-item.incorrect {
  border-color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

.option-item.incorrect .option-letter {
  background: var(--danger) !important;
  color: #ffffff !important;
  border-color: var(--danger) !important;
}

.explanation-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

.explanation-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.explanation-rationale {
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.distractors-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.distractors-list {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.distractors-list li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Mock Exam Simulator
   ========================================================================== */
.exam-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.exam-mode-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.exam-mode-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.exam-mode-card.selected {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.12);
}

.exam-mode-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-mode-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exam-summary-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.summary-item h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.summary-item p {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.2rem;
}

.exam-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.exam-timer {
  font-size: 1.4rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exam-timer.warning {
  color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.exam-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .exam-layout {
    grid-template-columns: 1fr;
  }
}

.exam-nav-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.exam-nav-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.exam-grid-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.exam-grid-cell:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.exam-grid-cell.current {
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4);
}

.exam-grid-cell.answered {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
}

.exam-grid-cell.flagged::after {
  content: "🚩";
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.65rem;
}

.exam-legend {
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Exam Results Screen */
.exam-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow-card);
}

.result-badge {
  display: inline-flex;
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}

.result-badge.passed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 2px solid #10b981;
}

.result-badge.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 2px solid #ef4444;
}

.result-score-number {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-score-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.chapter-performance-breakdown {
  text-align: left;
  margin: 2rem 0;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.chapter-performance-breakdown h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.perf-bar-row {
  margin-bottom: 0.85rem;
}

.perf-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.perf-bar-track {
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.6s ease;
}

.perf-bar-fill.high { background: var(--success); }
.perf-bar-fill.medium { background: var(--warning); }
.perf-bar-fill.low { background: var(--danger); }

/* ==========================================================================
   Specialized QA Engineering Tools
   ========================================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

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

.tool-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.calc-input-group {
  margin-bottom: 1rem;
}

.calc-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.calc-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
}

.calc-input:focus {
  border-color: var(--primary);
}

.calc-results-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.calc-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.calc-metric-row:last-child {
  margin-bottom: 0;
}

.calc-metric-val {
  font-size: 1.15rem;
  font-weight: 800;
}

/* Event Loop Stage Display */
.event-loop-visualizer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.queue-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  min-height: 140px;
}

.queue-column h5 {
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Glossary View
   ========================================================================== */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.glossary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease;
}

.glossary-card:hover {
  border-color: var(--primary);
}

.glossary-term-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.glossary-term {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.glossary-acronym {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.glossary-def {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.glossary-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 600;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease-out;
}

.modal-box h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.modal-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

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

/* Site Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1.75rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

/* ==========================================================================
   Sleek Dark Code Snippet Box Component
   ========================================================================== */
.dark-code-box {
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  font-family: var(--font-mono);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dark-code-box:hover {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55), 0 0 15px rgba(56, 189, 248, 0.15);
}

.dark-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d1527;
  padding: 0.55rem 0.95rem;
  border-bottom: 1px solid #1e293b;
  user-select: none;
}

.dark-code-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dark-code-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.dark-code-dot.red { background: #ff5f56; }
.dark-code-dot.yellow { background: #ffbd2e; }
.dark-code-dot.green { background: #27c93f; }

.dark-code-lang {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-left: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dark-code-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-sans);
}

.dark-code-copy-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.dark-code-content-wrapper {
  display: flex;
  background: #090d16;
  overflow-x: auto;
  position: relative;
}

.dark-code-gutter {
  user-select: none;
  text-align: right;
  padding: 1rem 0.65rem 1rem 0.85rem;
  color: #475569;
  font-size: 0.84rem;
  font-family: var(--font-mono);
  line-height: 1.65;
  border-right: 1px solid #1e293b;
  background: #060910;
  min-width: 38px;
}

.dark-code-body {
  flex: 1;
  padding: 1rem 1.15rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: #f1f5f9;
  background: #090d16;
  overflow-x: auto;
  white-space: pre;
}

/* Enhanced Syntax Tokens */
.tok-kw { color: #f43f5e; font-weight: 700; }        /* const, let, async, await, function, return, try, etc. */
.tok-str { color: #34d399; }                         /* 'string', "string", `string` */
.tok-num { color: #fbbf24; font-weight: 600; }       /* 123, true, false, null, undefined */
.tok-fn { color: #818cf8; font-weight: 600; }        /* test(), expect(), page.click(), etc. */
.tok-com { color: #64748b; font-style: italic; }     /* // comment */
.tok-prop { color: #38bdf8; }                        /* .locator, .status, .body */
.tok-op { color: #f43f5e; }                          /* ===, =>, &&, || */
.tok-punc { color: #94a3b8; }                        /* ;, {, }, (, ) */

/* Inline Code Badges */
.inline-code, code.inline-code {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   Code Runner & SDET Interactive Console
   ========================================================================== */
.runner-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (max-width: 980px) {
  .runner-layout {
    grid-template-columns: 1fr;
  }
}

.runner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.runner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.runner-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.runner-code-area {
  width: 100%;
  min-height: 420px;
  background: #090d16;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 1.25rem;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 2;
  box-sizing: border-box;
  white-space: pre;
}

.runner-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Console Stream Output */
.runner-console-stream {
  flex: 1;
  min-height: 420px;
  max-height: 600px;
  overflow-y: auto;
  background: #04070d;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: #7ee787;
  display: flex;
  flex-direction: column;
}

.console-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
  white-space: pre-wrap;
}

.console-msg.log { color: #f1f5f9; }
.console-msg.info { color: #38bdf8; }
.console-msg.warn { color: #fbbf24; }
.console-msg.error { color: #ef4444; }
.console-msg.success { color: #34d399; }
.console-msg.system {
  color: #64748b;
  font-size: 0.78rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

.console-prompt-badge {
  color: #3b82f6;
  font-weight: 700;
  user-select: none;
}

.runner-status-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.runner-status-chip.running {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.runner-status-chip.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ==========================================================================
   Flashcards Multi-View & Browse Grid
   ========================================================================== */
.flashcard-view-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.flashcard-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.flashcard-mode-btn.active {
  background: var(--primary);
  color: #0f172a;
}

.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.flashcard-grid-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: 220px;
}

.flashcard-grid-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.flashcard-grid-item.mastered {
  border-left: 4px solid var(--success);
}

.flashcard-grid-item.review {
  border-left: 4px solid var(--danger);
}

.flashcard-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.flashcard-grid-body {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-main);
  flex: 1;
}

.flashcard-grid-body strong {
  color: #fbbf24;
}

.flashcard-grid-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   FIRST-CLASS ENHANCEMENTS: COMMAND PALETTE, SHORTCUTS, RUNNER & EXAM
   ========================================================================== */

/* Buttons & Badges Extra Sizes */
.btn-xs {
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}

/* Quick Search / Command Palette Navbar Trigger */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.84rem;
  transition: all 0.2s ease;
}

.nav-search-btn:hover {
  border-color: var(--primary);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.nav-search-kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.72rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* Command Palette Modal (Ctrl+K) */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: fadeIn 0.15s ease-out;
}

.palette-overlay.hidden {
  display: none;
}

.palette-box {
  width: 90%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(245, 158, 11, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideDown 0.18s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.palette-icon {
  font-size: 1.25rem;
}

.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.05rem;
  color: var(--text-main);
  font-family: var(--font-sans);
}

.palette-esc-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.palette-category-label {
  padding: 0.5rem 0.85rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--text-main);
}

.palette-item:hover, .palette-item.selected {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.palette-item-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.palette-item-icon {
  font-size: 1.15rem;
}

.palette-item-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.palette-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.palette-item-shortcut {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.palette-footer {
  display: flex;
  gap: 1.25rem;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Keyboard Shortcuts Modal */
.shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
}

/* Code Runner Gutter & Line Numbers */
.runner-toolbar-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.runner-editor-wrapper {
  display: flex;
  min-height: 420px;
  background: #090d16;
  position: relative;
}

.runner-editor-gutter {
  width: 44px;
  background: #060911;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #475569;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 1.25rem 8px 1.25rem 0;
  text-align: right;
  user-select: none;
  white-space: pre;
  overflow: hidden;
  box-sizing: border-box;
}

.console-counts {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Flashcard Split Mastery Progress Bar */
.flashcard-split-progress {
  display: flex;
  height: 8px;
  width: 100%;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.split-segment {
  height: 100%;
  transition: width 0.35s ease;
}

.split-segment.mastered {
  background: var(--success);
}

.split-segment.review {
  background: var(--danger);
}

.split-segment.unreviewed {
  background: var(--border-color);
}

/* Chapter Guides Enhancements */
.chapter-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chapter-sidebar-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 9999px;
}

.chapter-nav-item.completed .chapter-nav-num {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: #34d399;
}

.chapter-toc-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.chapter-toc-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.chapter-toc-pill:hover {
  color: #fbbf24;
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.1);
}

.chapter-nav-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Practice View Score Pill & Bookmark */
.practice-live-score {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.question-bookmark-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.question-bookmark-btn:hover, .question-bookmark-btn.bookmarked {
  color: #fbbf24;
  border-color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
}

/* Mock Exam Circular Gauge & Confidence */
.result-score-gauge-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 1.25rem;
}

.result-score-gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-circle-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 12;
}

.score-circle-progress {
  fill: none;
  stroke: var(--success);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 440;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

.score-gauge-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-gauge-overlay .result-score-number {
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
  line-height: 1;
}

.score-gauge-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.confidence-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

.conf-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.conf-btn.selected {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

/* Floating Back-to-Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #0f172a;
  border: none;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.25s ease;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

/* Toast Notifications Container */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-message {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}


