:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --navy: #0f2a56;
  --heading: #0f2a56;
  --navy-2: #1e3a8a;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --gold: #f59e0b;
  --gold-soft: #fffbeb;
  --emerald: #059669;
  --emerald-strong: #047857; /* chữ emerald đạt WCAG AA trên nền sáng */
  --emerald-soft: #ecfdf5;
  --rose: #e11d48;
  --rose-soft: #fff1f2;
  --radius: 16px;
  --shadow: 0 10px 30px -10px rgba(15, 42, 86, 0.12);
  --shadow-lg: 0 20px 45px -15px rgba(15, 42, 86, 0.18);
}

body.dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-elevated: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --heading: #f8fafc;
  --emerald-strong: #34d399;
  --border: #273449;
  --primary-soft: rgba(37, 99, 235, 0.16);
  --gold-soft: rgba(245, 158, 11, 0.14);
  --emerald-soft: rgba(5, 150, 105, 0.16);
  --rose-soft: rgba(225, 29, 72, 0.16);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 42, 86, 0.96);
  backdrop-filter: blur(12px);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f2a56;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}
.brand-title { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: #cbd5e1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.55);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-gold {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(245, 158, 11, 0.55);
}
.btn-gold:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-emerald {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(5, 150, 105, 0.45);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }
.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 15px; width: 100%; }

/* Container & Cards */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 64px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Hero Landing */
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: stretch;
}
.hero-banner {
  background: linear-gradient(135deg, #0f2a56 0%, #1e3a8a 55%, #1d4ed8 100%);
  color: #fff;
  border-radius: 22px;
  padding: 34px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hero-banner > * {
  position: relative;
  z-index: 1;
}
.hero-banner::after {
  content: "∑ ∫ π ∞";
  position: absolute;
  right: 24px;
  bottom: 8px;
  font-size: 64px;
  line-height: 1;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.045);
  pointer-events: none;
  z-index: 0;
}
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.pill-badge .ui-ico {
  width: 15px;
  height: 15px;
}
.hero-banner h1 {
  margin: 16px 0 14px;
  font-size: clamp(26px, 2.6vw, 33px);
  line-height: 1.36;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-accent {
  color: #fde68a;
}
.hero-banner p { margin: 0 0 18px; color: #dbeafe; font-size: 15px; line-height: 1.6; }
.quote-box {
  background: rgba(255, 255, 255, 0.1);
  border-left: 4px solid #fbbf24;
  border-radius: 12px;
  padding: 15px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #f8fafc;
  margin-top: 18px;
}
.quote-head {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-weight: 700;
  color: #fef3c7;
  margin-bottom: 6px;
}
.quote-head .ui-ico {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  vertical-align: 0;
  color: #fde68a;
}
.security-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.sec-pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* Access Code Gate Card */
.gate-card {
  border-top: 4px solid var(--gold);
  box-shadow: 0 14px 36px -14px rgba(15, 42, 86, 0.14);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.gate-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
}
.gate-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--gold-soft);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
}
.gate-icon-badge .ui-ico {
  width: 18px;
  height: 18px;
  vertical-align: 0;
}
body.dark .gate-icon-badge {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.32);
}
.gate-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.015em;
}
.gate-desc {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.label-row label {
  margin-bottom: 0;
}
.label-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}
.gate-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.gate-footer-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
body.dark .gate-footer-link {
  color: #60a5fa;
}
.gate-footer-link:hover {
  text-decoration: underline;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}
.input-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--heading);
  background: var(--gold-soft);
  border-color: #f59e0b;
}
body.dark .input-code { color: #fde68a; }
.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 14px;
}
.alert-error { background: var(--rose-soft); color: var(--rose); border: 1px solid rgba(225, 29, 72, 0.25); }
.alert-success { background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(5, 150, 105, 0.25); }

/* Leaderboards & Preview */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.lb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 8px;
  font-size: 13.5px;
}
.lb-rank {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  margin-right: 8px;
  font-size: 13px;
}
.lb-rank.rank-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #0f2a56; box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35); }
.lb-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #0f172a; }
.lb-rank.rank-3 { background: linear-gradient(135deg, #b45309, #d97706); color: #fff; }
.lb-empty-card {
  padding: 20px 16px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.lb-card-flex { display: flex; flex-direction: column; justify-content: space-between; }

/* ==================== EXAM FOCUS ARENA ==================== */
.exam-bar {
  position: sticky;
  top: 67px;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 42, 86, 0.06);
}
.exam-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.timer-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.timer-pill.warn { background: #d97706; animation: pulse 1.2s infinite; }
.timer-pill.danger { background: #dc2626; animation: pulse 0.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.82; } }

.progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  width: 200px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  transition: width 0.3s ease;
}

.arena-layout {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 24px;
  align-items: start;
  position: relative;
}
/* Chống tràn ngang trên mobile: cho phép cột lưới co lại dưới kích thước nội dung */
.arena-layout > *, #questionsContainer, .q-card, .opt-btn, .tf-row, .q-header { min-width: 0; }
.q-card, .opt-btn { overflow-wrap: anywhere; }
.q-header { flex-wrap: wrap; }

/* Forensic Watermark Layer */
.watermark-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
  opacity: 0.055;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 80px;
  padding: 60px;
  user-select: none;
}
.watermark-item {
  transform: rotate(-28deg);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--heading);
}
body.dark .watermark-item { color: #e2e8f0; }

.section-divider {
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  margin: 24px 0 16px;
}
.section-divider h3 { margin: 0 0 2px; font-size: 16px; }
.section-divider p { margin: 0; font-size: 12.5px; color: #cbd5e1; }

.q-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
  position: relative;
}
.q-card.answered { border-left: 5px solid var(--emerald); }
.q-card.flagged { border-color: var(--gold); }
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.q-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  color: var(--primary);
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.tag-gold { background: var(--gold-soft); color: #b45309; }
.tag-emerald { background: var(--emerald-soft); color: var(--emerald); }
.tag-rose { background: var(--rose-soft); color: var(--rose); }

.math-content { font-size: 15.5px; line-height: 1.8; overflow-x: auto; max-width: 100%; }
/* Nội dung công thức dài/hình/bảng phải co lại trong ô lưới & ô flex thay vì đẩy tràn trang ngang (mobile) */
/* KaTeX đặt phần MathML ẩn bằng position:absolute; nếu khung cuộn không phải "positioned" thì phần ẩn này
   thoát khỏi overflow và làm trang rộng hơn màn hình (mobile). Đặt position:relative để khung cắt đúng. */
.math-content, .math-display-wrap, .math-table-wrap, .solution-box, .lesson-quote, .lab-readout, .tf-text { position: relative; }
.opt-btn .math-content, .tf-text, .tf-row > * { min-width: 0; }
.opt-btn .math-content { flex: 1 1 auto; }
.math-content img, .math-fig-wrap img, .lesson-quote img { max-width: 100%; height: auto; }
.math-display-wrap { margin: 10px 0; overflow-x: auto; padding: 4px 0; }
.math-fig-wrap {
  margin: 10px auto;
  text-align: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px 7px;
  display: inline-block;
  max-width: 100%;
  cursor: zoom-in;
  box-shadow: 0 3px 10px rgba(15, 42, 86, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.math-fig-wrap:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(15, 42, 86, 0.1);
}
.math-fig-wrap img {
  max-width: min(480px, 100%);
  max-height: 235px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}
.fig-hint {
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  opacity: 0.85;
}
.math-fig-wrap:hover .fig-hint { color: var(--primary); opacity: 1; }
.fig-center { text-align: center; margin: 4px 0; }

.math-table-wrap {
  margin: 16px auto;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}
.math-table {
  border-collapse: separate;
  border-spacing: 0;
  width: auto;
  min-width: 300px;
  max-width: 100%;
  background: var(--surface);
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  font-size: 14.5px;
  box-shadow: 0 4px 14px rgba(15, 42, 86, 0.06);
}
.math-table td, .math-table th {
  border-right: 1px solid #dbe4f0;
  border-bottom: 1px solid #dbe4f0;
  padding: 9px 14px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.math-table tr:last-child td, .math-table tr:last-child th { border-bottom: none; }
.math-table td:last-child, .math-table th:last-child { border-right: none; }
.math-table th {
  background: var(--primary-soft);
  color: var(--heading);
  font-weight: 800;
}
body.dark .math-table th { color: #e2e8f0; }
.math-table.mode-col th {
  text-align: left;
  padding-right: 18px;
}
.math-table.mode-none tr:nth-child(even) td {
  background: var(--surface-2);
}

/* MC Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-size: 15px;
}
.opt-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.opt-key {
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--heading);
}
.opt-btn.selected .opt-key { background: var(--primary); color: #fff; border-color: var(--primary); }

/* TF Rows */
.tf-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.tf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
}
.tf-text { flex: 1; font-size: 15px; }
.tf-toggle { display: flex; gap: 8px; flex-shrink: 0; }
.tf-pill {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.tf-pill.active-true { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.tf-pill.active-false { background: var(--rose); color: #fff; border-color: var(--rose); }

/* SA Input */
.sa-box {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sa-input {
  max-width: 240px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

/* Navigator Sidebar */
.nav-sidebar {
  position: sticky;
  top: 142px;
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
}
.pal-btn {
  height: 36px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.pal-btn.done { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.pal-btn.flag { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }

/* ==================== DIAGNOSTIC REPORT ==================== */
.report-hero {
  background: linear-gradient(135deg, #0f2a56 0%, #1e40af 60%, #059669 100%);
  color: #fff;
  border-radius: 22px;
  padding: 32px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: center;
  box-shadow: var(--shadow-lg);
}
.score-circle {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 6px solid #fbbf24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.35);
}
.score-big { font-size: 46px; font-weight: 800; line-height: 1; }
.score-sub { font-size: 13px; color: #fde68a; font-weight: 700; margin-top: 4px; }
.badges-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.badge-chip {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.praise-card {
  background: linear-gradient(135deg, var(--emerald-soft), var(--gold-soft));
  border: 1.5px solid rgba(5, 150, 105, 0.3);
}
.cta-card {
  background: linear-gradient(135deg, #0f2a56, #1e3a8a);
  color: #fff;
  border: 2px solid #f59e0b;
}
.cta-card p { color: #dbeafe; }

.bloom-row { margin-bottom: 12px; }
.bloom-meta { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.bloom-bar { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bloom-bar > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #10b981); }

.solution-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
}

/* Modal & Lightbox */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 26px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box.wide {
  max-width: 880px;
}

/* Essay (Tự luận) Upload & Rubric Styles */
.tl-upload-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
}
.tl-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 14px;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tl-dropzone:hover, .tl-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tl-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tl-thumb-card {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  padding: 6px;
}
.tl-thumb-img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
}
.tl-thumb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.tl-del-btn {
  border: none;
  background: var(--rose-soft);
  color: var(--rose);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.tl-rubric-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
}
.tl-step-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.tl-step-row:last-child { border-bottom: none; }
.lightbox-img {
  max-width: 90vw;
  max-height: 84vh;
  min-width: min(460px, 86vw);
  object-fit: contain;
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

/* Table for Admin */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { font-weight: 800; color: var(--text-muted); background: var(--surface-2); }

/* Tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  padding: 9px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.25s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== INLINE SVG ICONS & INTERACTIVE ACADEMIC LUXURY ==================== */
.ui-ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  vertical-align: -3px;
}
.pace-insight-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--heading);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid rgba(5, 150, 105, 0.18);
}
body.dark .pace-insight-box {
  background: rgba(15, 23, 42, 0.68);
  color: var(--text);
  border-color: rgba(16, 185, 129, 0.25);
}

/* ==================== LỘ TRÌNH HỌC TẬP TỐI GIẢN & SANG TRỌNG ==================== */
.roadmap-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 22px 0 14px;
}
.roadmap-title-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}
.roadmap-title-group h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}
.roadmap-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.roadmap-xp {
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  padding: 3px 10px;
  border-radius: 999px;
}
body.dark .roadmap-xp {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.track-tabs-wrap {
  position: relative;
  margin-bottom: 18px;
}
.track-tabs-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 10px;
  width: 34px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--bg));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.track-tabs-wrap.has-overflow::after { opacity: 1; }

.track-tabs-clean {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 24px 10px 0;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.track-tabs-clean::-webkit-scrollbar { display: none; }

.track-tab-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
}
.track-tab-item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.track-tab-item.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}
body.dark .track-tab-item.active {
  background: var(--primary);
}
.track-tab-num {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}
.track-tab-item.active .track-tab-num {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.mode-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  gap: 4px;
  flex-wrap: wrap;
}
.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.mode-btn.active {
  background: var(--surface-elevated);
  color: var(--heading);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

/* Search & Multi-filter bar inside #/kho-de */
.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.catalog-search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.catalog-search-box .ui-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.catalog-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.catalog-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.struct-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.period-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.period-pill:hover {
  border-color: var(--primary);
  color: var(--text);
}
.period-pill.is-empty { opacity: 0.52; }
.period-pill.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.35);
  font-weight: 700;
  opacity: 1;
}

.exam-card-clean {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.exam-card-clean:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.exam-card-clean:hover {
  transform: translateY(-3px);
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-lg);
}
.exam-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.exam-period-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.exam-duration-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.exam-card-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--heading);
  letter-spacing: -0.01em;
}
.exam-card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.exam-card-chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.exam-chapter-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exam-ratio-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  margin: 8px 0 6px;
  gap: 2px;
}
.ratio-seg-mc { background: #2563eb; }
.ratio-seg-tf { background: #059669; }
.ratio-seg-sa { background: #f59e0b; }
.ratio-seg-tl { background: #7c3aed; }
.exam-card-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.exam-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* Chương & Bài học 3 chặng + thanh tiến độ */
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.chapter-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.chapter-head:hover { background: var(--surface-2); }
.chapter-head strong { color: var(--heading); }
.chapter-index {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  margin-right: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chapter-prog-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.chap-prog-bar {
  width: 68px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.chap-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #059669);
  transition: width 0.3s ease;
}
.chapter-status {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.chapter-status.has-items { color: var(--emerald); font-weight: 700; }
.chapter-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.lesson-card {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.lesson-quote {
  margin: 10px 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  font-size: 13.5px;
  line-height: 1.55;
}
.lesson-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.step-tile {
  padding: 14px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.step-tile.done {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
}
.step-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--heading);
}
.step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.step-tile.done .step-num { color: var(--emerald); }

/* ==================== PHÒNG THÍ NGHIỆM TOÁN TRỰC QUAN (MINI-LAB 60FPS) ==================== */
.math-lab-card {
  padding: 22px;
  border-radius: 20px;
  margin-bottom: 18px;
}
.math-lab-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.math-lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.math-lab-stage {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: stretch;
}
.math-lab-canvas-wrap {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
  touch-action: none;
  min-height: 330px;
  align-self: start;
}
.math-lab-canvas {
  width: 100%;
  height: 360px;
  display: block;
  cursor: crosshair;
}
.math-lab-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.lab-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.lab-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
}
.lab-slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}
.lab-readout {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.55;
}

.gate-card.gate-pulse { animation: gatePulse 1.2s ease; }
@keyframes gatePulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55); }
  50% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
  100% { box-shadow: none; }
}

/* ==================== TOPBAR NAVIGATION & TRANG ĐẦU TRUYỀN CẢM HỨNG ==================== */
.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.top-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 13.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.top-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.top-nav-link.active {
  background: #fff;
  color: #0f2a56;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.hero-cta-row .btn {
  min-height: 42px;
}
@media (min-width: 1100px) {
  .hero-cta-row { flex-wrap: nowrap; }
  .hero-cta-row .btn { white-space: nowrap; }
}

.inspire-section { margin-top: 44px; }
.inspire-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.inspire-kicker {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 4px;
}
.inspire-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}
.inspire-head p {
  margin: 0;
  max-width: 480px;
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.inspire-card {
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.inspire-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.inspire-img-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f2a56;
}
.inspire-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.inspire-card:hover .inspire-img-wrap img { transform: scale(1.04); }
.inspire-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.inspire-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 6px;
}
.inspire-body h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--heading);
}
.inspire-body p {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  flex: 1;
}
.inspire-link {
  align-self: flex-start;
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}
.inspire-link:hover { text-decoration: underline; }

.home-stats-strip {
  margin-top: 26px;
  padding: 20px 26px;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  background: linear-gradient(135deg, rgba(15, 42, 86, 0.03), rgba(37, 99, 235, 0.06));
}
body.dark .home-stats-strip {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.25), rgba(15, 23, 42, 0.55));
}
.home-stats-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
}
.home-stats-metrics > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.home-stats-metrics strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--heading);
}
.home-stats-metrics span {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.subpage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

/* ==================== GLOBAL FOOTER ==================== */
.site-footer {
  margin-top: 56px;
  padding: 36px 20px 30px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
}
.site-footer h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--heading);
}
.site-footer p, .site-footer a:not(.btn), .site-footer button:not(.btn) {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}
.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.footer-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-muted);
}
.footer-link-btn:hover { color: var(--primary); }
.site-footer-bottom {
  max-width: 1200px;
  margin: 24px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==================== RESPONSIVE & MOBILE APP BAR (<= 768px) ==================== */
@media (max-width: 920px) {
  .hero-grid, .arena-layout, .report-hero, .grid-3, .grid-2, .lesson-steps, .math-lab-stage, .site-footer-inner { grid-template-columns: minmax(0, 1fr); }
  .options-grid { grid-template-columns: minmax(0, 1fr); }
  .nav-sidebar { position: static; }
  .hero-banner h1 { font-size: 25px; }
}

@media (max-width: 768px) {
  body.has-bottom-nav { padding-bottom: 84px; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar-inner { padding: 9px 14px; flex-wrap: nowrap; }
  .brand-sub, .admin-top-btn, .theme-btn-label { display: none; }
  .brand-title { font-size: 14.5px; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .topbar-actions .btn-sm { padding: 7px 10px; font-size: 12.5px; }

  #topPageNav.top-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
  }
  .top-nav-link {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    font-size: 11.5px;
    color: var(--text-muted);
    border-radius: 10px;
  }
  .top-nav-link:hover { color: var(--heading); background: var(--surface-2); }
  .top-nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .container { padding: 18px 14px 38px; }
  .hero-banner { padding: 22px; }
  .hero-banner h1 { font-size: 23px; }
  .card { padding: 18px; }
  .exam-card-actions { grid-template-columns: 1fr; }
}
