/* ========================================================
   Paragliding Pro — Design System & Styles
   Aviation & Paragliding Theme (Sky, Thermals, Airspace)
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #090e1a;
  --bg2: #0f172a;
  --bg3: #16223d;
  --surface: #1e2d4f;
  --surface2: #273963;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.16);

  /* Aviation & Sky Colors */
  --primary: #0284c7;
  --primary-light: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --thermal-gold: #f59e0b;
  --thermal-glow: rgba(245, 158, 11, 0.25);
  --lift-green: #10b981;
  --lift-glow: rgba(16, 185, 129, 0.25);
  --sink-red: #ef4444;
  --sink-glow: rgba(239, 68, 68, 0.25);

  --text: #f8fafc;
  --text2: #94a3b8;
  --text3: #64748b;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --nav-h: 62px;
  --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, #172554 0%, #090e1a 75%);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
  border-radius: var(--radius-sm);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 10px; }

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text2); }
.text-accent { color: var(--primary-light); }
.text-gold { color: var(--thermal-gold); }
.flex-1 { flex: 1; }

/* App & Page Layout */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + 12px);
}

.page {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.25s ease-out;
}

.page.active {
  display: flex;
}

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

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

.page-header {
  padding: 16px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text2);
}

.page-content {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* Cards */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-align: center;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-thermal {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--thermal-glow);
}

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

.btn-ghost:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.btn-full { width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 16px; font-weight: 700; border-radius: var(--radius); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }

/* Inputs */
.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}

.input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input.correct {
  border-color: var(--lift-green) !important;
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
  font-weight: 700;
}

.input.wrong {
  border-color: var(--sink-red) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
  font-weight: 700;
}

.open-feedback {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

.open-feedback.correct {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--lift-green);
  color: #34d399;
}

.open-feedback.wrong {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--sink-red);
  color: #fca5a5;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Progress bars */
.progress-track {
  width: 100%;
  height: 9px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  transition: width 0.4s ease;
}

.progress-fill.green {
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}

.progress-fill.gold {
  background: linear-gradient(90deg, #fcd34d 0%, #f59e0b 100%);
}

/* Login Page */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo .logo-icon {
  font-size: 48px;
  display: inline-block;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px var(--primary-glow));
  transition: transform 0.2s ease;
}

.login-logo .logo-icon:hover {
  transform: scale(1.1) rotate(-6deg);
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f8fafc 30%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-logo p {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}

.user-select-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all var(--transition);
}

.user-select-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.2);
}

.user-select-card .avatar {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 50%;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.user-select-card .user-info {
  flex: 1;
}

.user-select-card .user-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-select-card .user-meta {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

.user-select-card .xp-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--thermal-gold);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--sink-red);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 10px;
}

/* Dashboard Elements */
.streak-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(234, 88, 12, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.streak-flame {
  font-size: 36px;
  animation: pulseFlame 1.8s infinite alternate;
}

@keyframes pulseFlame {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.3)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.6)); }
}

.streak-number {
  font-size: 22px;
  font-weight: 800;
  color: var(--thermal-gold);
  line-height: 1;
}

.streak-label {
  font-size: 12px;
  color: var(--text2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  transition: all var(--transition);
}

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

.stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text2); margin-top: 2px; }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.badge-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.4;
  filter: grayscale(1);
  transition: all var(--transition);
  position: relative;
}

.badge-item.unlocked {
  opacity: 1;
  filter: grayscale(0);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.05);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1);
}

.badge-icon { font-size: 28px; }
.badge-name { font-size: 10px; font-weight: 700; color: var(--text); line-height: 1.2; }
.badge-req { font-size: 9px; color: var(--text3); }

/* Activity Dots */
.activity-dots {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.activity-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.activity-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.activity-dot.active {
  background: var(--lift-green);
  border-color: var(--lift-green);
  color: #fff;
  box-shadow: 0 2px 8px var(--lift-glow);
}

/* Practice View */
.question-progress-bar {
  height: 6px;
  background: var(--surface);
  width: 100%;
}

.question-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  transition: width 0.3s ease;
}

.question-container {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  overflow-y: auto;
}

.question-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brevet-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
}

.brevet-pill.B1 { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.brevet-pill.B2 { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.brevet-pill.B3 { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

.diff-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.question-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.question-image-wrap {
  background: rgba(15, 23, 42, 0.7);
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.media-item-container {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  background: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  cursor: zoom-in;
  padding: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.media-item-container:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.media-item-container:hover .zoom-hint {
  opacity: 1;
}

.zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.media-item-container img,
.question-image-wrap img {
  max-height: 280px;
  max-width: 100%;
  object-fit: contain;
  display: block;
  background: #ffffff !important;
  border-radius: 6px;
}

.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox-modal img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
  cursor: default;
  background: #ffffff !important;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Exam Timer & Mode Badges */
.exam-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.exam-timer-pill.warning {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.exam-timer-pill.danger {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #f87171;
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.75; transform: scale(1.04); }
}

.exam-subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

/* Exam Report Card */
.exam-report-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.exam-result-banner {
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 20px;
}

.exam-result-banner.passed {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--lift-green);
  color: #34d399;
}

.exam-result-banner.failed {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--sink-red);
  color: #fca5a5;
}

.subject-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.pass-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.fail-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

/* Practice Filter Modal */
.filter-chip {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-chip.active {
  background: rgba(14, 165, 233, 0.18);
  border-color: var(--primary);
  color: #38bdf8;
}

.filter-chip input {
  cursor: pointer;
  accent-color: var(--primary);
}

.filter-cat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.filter-cat-chip:hover {
  border-color: var(--primary);
}
.filter-cat-chip input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 38px;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.question-body {
  padding: 20px;
}

.question-text {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 20px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: var(--surface);
  transform: translateX(4px);
}

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  transition: all var(--transition);
}

.option-btn.selected {
  border-color: var(--primary);
  background: rgba(2, 132, 199, 0.15);
}

.option-btn.correct {
  border-color: var(--lift-green) !important;
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399;
}

.option-btn.correct .option-letter {
  background: var(--lift-green);
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--sink-red) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5;
}

.option-btn.wrong .option-letter {
  background: var(--sink-red);
  color: #fff;
}

/* Theory Explanation Box (Separated & Collapsible) */
.explanation-box {
  margin-top: 18px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.explanation-toggle-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-light);
}

.explanation-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  border-top: 1px solid var(--border);
  background: var(--bg3);
}

/* Action Bar */
.action-bar {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* Theory Handbook Page (Kennisbank) */
.module-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.module-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--bg2);
}

.module-header:hover {
  background: var(--bg3);
}

.module-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-count {
  font-size: 11px;
  color: var(--text2);
  background: var(--surface);
  padding: 3px 8px;
  border-radius: 99px;
}

.module-content {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.handbook-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.handbook-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 8px;
}

.handbook-item-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}

.handbook-item img {
  margin-top: 12px;
  max-height: 240px;
  object-fit: contain;
}

/* Bottom Nav */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 600;
  transition: all var(--transition);
  padding: 6px 0;
}

.nav-item .nav-icon {
  font-size: 20px;
  transition: transform var(--transition);
}

.nav-item.active {
  color: var(--primary-light);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 8px var(--primary-glow));
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

/* Celebration Animation */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 14, 26, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.celebration-trophy {
  font-size: 72px;
  animation: bounceTrophy 1s infinite alternate;
}

@keyframes bounceTrophy {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-16px) scale(1.1); }
}

/* Chips & Filters */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.chip {
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--border2);
  color: var(--text);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface2);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* XP Toast */
#xp-toast {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 250;
  pointer-events: none;
}

.xp-popup {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 99px;
  box-shadow: 0 8px 24px var(--thermal-glow);
  animation: floatUp 1.8s ease forwards;
  display: flex;
  align-items: center;
  gap: 6px;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  20% { opacity: 1; transform: translateY(0) scale(1.05); }
  80% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* Practice ICAO Modal Sheet */
.practice-icao-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.practice-icao-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #0b1120;
}

.practice-icao-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0f172a;
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  gap: 10px;
  flex-shrink: 0;
}

.practice-icao-sheet-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0b1120;
}

.practice-icao-sheet-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
