@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@600;700;800;900&family=Lato:ital,wght@0,400;0,700;0,900;1,400&display=swap');

:root {
  /* Brand colors — exact AMBOSS palette */
  --navy-950: #164e52;
  --teal-700: #164e52;
  --teal-600: #1ab394;
  --teal-500: #18a689;
  --teal-400: #69c9d0;
  --teal-100: #e5f5f7;

  /* Theme-dependent tokens — light values (default). */
  --navy-900: #052c31;
  --pink-500: #d93874;
  --pink-100: #fde8f0;
  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7f9;
  --card: #ffffff;
  --muted-bg: #f1f5f9;
  --green-600: #1ab394;
  --green-100: #e6f7f4;
  --green-border: #18a689;
  --green-badge-bg: #1ab394;
  --red-600: #dc2626;
  --red-100: #fef2f2;
  --red-border: #f87171;
  --red-badge-bg: #dc2626;
  --amber-500: #d97706;
  --amber-100: #fffbeb;
  --highlight-bg: #fef08a;
  --highlight-fg: #0f172a;
  --btn-primary-bg: #164e52;
  --btn-primary-fg: #ffffff;
  --shadow: 0 4px 16px -2px rgba(4, 31, 35, 0.06), 0 2px 6px -1px rgba(4, 31, 35, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(4, 31, 35, 0.1), 0 4px 10px -2px rgba(4, 31, 35, 0.05);
  --radius: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, sans-serif;
}

/* System & explicit dark mode — exact AMBOSS dark theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy-900: #e2e8f0;
    --teal-600: #1ab394;
    --teal-100: #182829;
    --pink-500: #f43f5e;
    --pink-100: #38121f;
    --ink-900: #e2e8f0;
    --ink-700: #cbd5e1;
    --ink-500: #8899a6;
    --line: #282e32;
    --bg: #15181a;
    --card: #181b1d;
    --muted-bg: #202427;
    --green-600: #1ab394;
    --green-100: #133834;
    --green-border: #18a689;
    --green-badge-bg: #1ab394;
    --red-600: #e57373;
    --red-100: #201c1e;
    --red-border: #c94a4a;
    --red-badge-bg: #d34545;
    --amber-500: #f2b84b;
    --amber-100: #3a2505;
    --highlight-bg: #4d3a08;
    --highlight-fg: #fef08a;
    --btn-primary-bg: #18a689;
    --btn-primary-fg: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
}

:root[data-theme="dark"] {
  --navy-900: #e2e8f0;
  --teal-600: #1ab394;
  --teal-100: #182829;
  --pink-500: #f43f5e;
  --pink-100: #38121f;
  --ink-900: #e2e8f0;
  --ink-700: #cbd5e1;
  --ink-500: #8899a6;
  --line: #282e32;
  --bg: #15181a;
  --card: #181b1d;
  --muted-bg: #202427;
  --green-600: #1ab394;
  --green-100: #133834;
  --green-border: #18a689;
  --green-badge-bg: #1ab394;
  --red-600: #e57373;
  --red-100: #201c1e;
  --red-border: #c94a4a;
  --red-badge-bg: #d34545;
  --amber-500: #f2b84b;
  --highlight-bg: #4d3a08;
  --highlight-fg: #fef08a;
  --btn-primary-bg: #18a689;
  --btn-primary-fg: #ffffff;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-900);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--teal-600); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
  border-radius: 4px;
}

button,
.nav-btn,
.seg-btn,
.mini-btn,
.tool-btn,
.topbar-btn,
.admin-tab,
.auth-tab,
a.brand,
.option,
.browse-row {
  transition:
    background-color .16s cubic-bezier(.4, 0, .2, 1),
    border-color .16s cubic-bezier(.4, 0, .2, 1),
    color .16s cubic-bezier(.4, 0, .2, 1),
    box-shadow .16s cubic-bezier(.4, 0, .2, 1),
    transform .1s cubic-bezier(.4, 0, .2, 1);
}
button:active:not(:disabled),
.nav-btn:active,
.seg-btn:active,
.mini-btn:active,
.generate-btn:active {
  transform: scale(0.98);
}

::selection { background: #164e52; color: #fff; }

/* ---------- AMBOSS Topbar Header ---------- */
.topbar {
  background: #164e52;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
  white-space: nowrap;
  color: #ffffff;
}
.brand .tri {
  width: 14px; height: 14px;
  background: #69c9d0;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  display: inline-block;
}
.brand small {
  font-weight: 400;
  font-size: 11px;
  color: #a4d2d6;
}

/* Topbar search pill */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #113c40;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 12px;
  width: 320px;
  margin: 0 auto;
}
.topbar-search .search-icon { font-size: 12px; opacity: 0.6; }
.topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: #d1eaed;
  font-family: var(--font-sans);
  font-size: 13px;
  font-style: italic;
  width: 100%;
}
.topbar-search input::placeholder { color: #7cb2b6; }
.topbar-search .kbd-shortcut {
  font-size: 10.5px;
  font-weight: 700;
  color: #88b7bc;
  background: rgba(255, 255, 255, 0.12);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
}

.user-avatar-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #69c9d0;
  color: #0b3438;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.username-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  color: #e2f4f6;
  text-align: left;
}
.username-text small {
  font-size: 10px;
  color: #92c9cd;
  display: block;
}

.topbar-spacer { flex: 1; }

.topbar .icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.3); transform: translateY(-1px); }
.topbar .icon-btn.active { background: var(--pink-500); border-color: var(--pink-500); box-shadow: 0 0 12px rgba(244, 63, 94, 0.4); }

.topbar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.topbar-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.3); }

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.25);
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2f4f6;
}
.timer.low-time {
  background: var(--pink-500);
  border-color: var(--pink-500);
  animation: pulse-time 1s infinite;
}

.end-block-btn {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.3);
}
.end-block-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

.user-menu { position: relative; }
.user-menu-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.18); }
.user-menu-btn .role-chip {
  background: var(--pink-500);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.user-menu-btn .caret { font-size: 10px; opacity: 0.7; }

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
  flex-direction: column;
}
.user-menu-dropdown.show { display: flex; }
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover { background: var(--teal-100); color: var(--teal-600); text-decoration: none; }

/* ================= LANDING PAGE ================= */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-400));
  opacity: 0.8;
}
.stat-card.accent::before {
  background: linear-gradient(90deg, #00b4c5, #10b981);
  opacity: 1;
}
.stat-card .num {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw + 10px, 32px);
  font-weight: 800;
  color: var(--navy-900);
  line-height: 1.1;
}
.stat-card .label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 6px;
}
.stat-card.accent .num { color: var(--teal-600); }

.section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--navy-900);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title .rule { flex: 1; height: 1px; background: var(--line); }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 11px 16px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-sans);
  background-color: var(--card);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" stroke="%2364748b" stroke-width="2"><circle cx="6.5" cy="6.5" r="5"/><line x1="10.5" y1="10.5" x2="15" y2="15"/></svg>');
  background-repeat: no-repeat;
  background-position: 12px center;
  color: var(--ink-900);
}
.search-box input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(11, 143, 158, 0.15); }

.search-results {
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-result-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13.5px;
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row .tag { color: var(--teal-600); font-weight: 700; white-space: nowrap; }
.search-result-row .txt { color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-row:hover { background: var(--teal-100); cursor: pointer; }

.resume-card {
  background: var(--card);
  border: 1.5px solid var(--teal-500);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  cursor: pointer;
  margin-bottom: 10px;
}
.resume-card .bnum { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--navy-900); }
.resume-card .bmeta { font-size: 12px; color: var(--ink-500); }
.resume-card .bbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.resume-card .bbar .correct { height: 100%; background: linear-gradient(90deg, var(--teal-500), var(--teal-400)); display: block; }
.resume-card .go-btn { font-size: 12.5px; font-weight: 700; color: var(--teal-600); }

/* Dashboard symmetrical 2-column layout */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 900px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }
  .create-card, .resume-card {
    max-width: 100%;
  }
}

/* ---- Create-session card ---- */
.create-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  max-width: 640px;
}
.create-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.create-row:last-of-type { margin-bottom: 0; }
.create-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-500);
}
.create-hint { font-size: 12px; color: var(--ink-500); margin: -4px 0 18px; line-height: 1.5; }
#generateWarn { color: var(--red-600); margin-top: 10px; margin-bottom: 0; }

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-900);
  font-size: 14px;
}
.text-input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }

/* Shared theme-aware stat/button primitives — used on profile.html directly,
   and overridden with a fixed dark-glass look inside admin.html (see admin.css). */
.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.health-label { font-size: 10.5px; text-transform: uppercase; color: var(--ink-500); font-weight: 800; letter-spacing: 0.3px; }
.health-val { font-size: 19px; font-weight: 900; color: var(--navy-900); margin-top: 3px; }

.mini-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-700);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.mini-btn:hover { border-color: var(--teal-500); }
.mini-btn:disabled { opacity: 0.5; }
.mini-btn-danger { color: var(--red-600); border-color: var(--red-border); }
.mini-btn-danger:hover { background: var(--red-100); }
.mini-btn.flagged { background: var(--pink-100); border-color: var(--pink-500); color: var(--pink-500); }

.module-actionbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--teal-100);
  border: 1px solid var(--teal-500);
  border-radius: 8px;
  padding: 10px 14px;
  margin: -4px 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
}
.browse-check { flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--teal-600); }
.browse-row.selected { border-color: var(--teal-500); background: var(--teal-100); }

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.hidden {
  display: none !important;
}
.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  width: 100%;
  max-width: 440px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.practice-module-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.practice-module-card .pmc-name { font-weight: 800; color: var(--navy-900); font-size: 14px; }
.practice-module-card .pmc-meta { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.practice-module-card .pmc-spacer { flex: 1 1 auto; }
.practice-module-card .owner-chip {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 6px;
}

.qcount-control {
  display: flex;
  align-items: center;
  gap: 14px;
}
.qcount-control input[type="range"] {
  flex: 1;
  accent-color: var(--teal-600);
}
.qcount-control input[type="number"] {
  width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font-size: 14px;
  font-weight: 800;
  color: var(--navy-900);
  text-align: center;
}
.time-readout {
  min-width: 64px;
  font-weight: 800;
  font-size: 14px;
  color: var(--navy-900);
  text-align: right;
}

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.seg-btn {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.seg-btn span {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-500);
}
.seg-btn.active { border-color: var(--teal-500); background: var(--teal-100); color: var(--teal-600); box-shadow: 0 0 0 1px var(--teal-500); }
.seg-btn.active span { color: var(--teal-600); }

.generate-btn {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, #052c31 0%, #084c55 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(5, 44, 49, 0.25);
}
.generate-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }

/* ================= QUIZ PAGE ================= */
.quiz-layout {
  display: flex;
  align-items: flex-start;
}

.qnav-sidebar {
  position: relative;
  width: 290px;
  min-width: 290px;
  flex: 0 0 auto;
  background: #181b1d;
  border-right: 1px solid #282e32;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: width .22s cubic-bezier(.4, 0, .2, 1);
}
.qnav-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: visible;
}
.qnav-sidebar.collapsed .qnav-sidebar-head,
.qnav-sidebar.collapsed .qnav-list {
  display: none !important;
}

.qnav-sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid #282e32;
  flex: 0 0 auto;
}
.qnav-title {
  font-size: 13px;
  font-weight: 700;
  color: #c5d0d8;
  line-height: 1.3;
}
.qnav-progress {
  font-size: 12px;
  font-weight: 600;
  color: #8899a6;
  margin-top: 4px;
}

.qnav-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0;
}
.qnav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid #212528;
  cursor: pointer;
  position: relative;
}
.qnav-row:hover { background: #202427; }
.qnav-row.current { background: #242a2d; border-left-color: #69c9d0; }
.qnav-row .qnav-status {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.qnav-row.correct .qnav-status { background: #1ab394; }
.qnav-row.incorrect .qnav-status { background: #d34545; }
.qnav-row.omitted .qnav-status { background: #55626d; }
.qnav-row .qnav-num {
  flex: 0 0 auto;
  width: 16px;
  font-size: 12px;
  font-weight: 700;
  color: #8899a6;
}
.qnav-row.current .qnav-num { color: #ffffff; }
.qnav-row .qnav-preview {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: #a4b2bc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qnav-row.current .qnav-preview { color: #ffffff; font-weight: 600; }
.qnav-row .qnav-diff {
  flex: 0 0 auto;
  display: flex;
  gap: 1px;
}
.qnav-row .qnav-diff .hammer-icon {
  font-size: 10px;
  opacity: 0.25;
  filter: grayscale(1);
}
.qnav-row .qnav-diff .hammer-icon.on {
  opacity: 1;
  filter: none;
}
.qnav-row .qnav-flag {
  position: absolute; top: 6px; right: 8px;
  width: 7px; height: 7px;
  background: #f43f5e;
  border-radius: 50%;
}

.qnav-collapse-btn {
  position: absolute;
  top: 12px;
  right: -24px;
  width: 24px; height: 34px;
  border-radius: 0 6px 6px 0;
  border: 1px solid #282e32;
  border-left: none;
  background: #181b1d;
  color: #69c9d0;
  font-size: 13px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  cursor: pointer;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.4);
}
.qnav-collapse-btn:hover { background: #202629; color: #ffffff; }

.quiz-main {
  flex: 1 1 auto;
  min-width: 0;
}

.quiz-wrap {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 32px 140px;
}

.font-size-btn {
  position: absolute;
  top: 24px;
  right: 32px;
  font-size: 13px;
  font-weight: 700;
  color: #8899a6;
  background: none;
  border: none;
  cursor: pointer;
}
.font-size-btn:hover { color: #ffffff; }

.q-substem-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 16px;
  padding: 10px 0;
  border-top: 1px solid #282e32;
  border-bottom: 1px solid #282e32;
}
.q-substem-bar .tool-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.q-substem-bar .tool-btn:hover { color: #ffffff; }
.q-substem-bar .tool-btn.active { color: #69c9d0; border-bottom: 2px solid #69c9d0; }
.q-substem-bar .tool-btn.icon-only { font-size: 16px; letter-spacing: 2px; color: #718096; position: relative; }

/* Topbar Mobile Navigation Toggle Pill */
.topbar-qnav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
}
.topbar-qnav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #69c9d0;
}
@media (min-width: 901px) {
  .topbar-qnav-btn { display: none; }
}

/* 3-Dots Overflow Popover — AMBOSS Dark Teal Palette */
.overflow-popover {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  width: 280px;
  background: #182226;
  border: 1px solid #28373b;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
  z-index: 100;
  text-align: left;
  font-style: normal;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-section-title {
  font-size: 10px;
  font-weight: 800;
  color: #69c9d0;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.popover-tags-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.pop-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #d0e4e6;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #28373b;
}
.pop-tag-item.pyq { background: rgba(244, 63, 94, 0.12); color: #fb7185; border-color: rgba(244, 63, 94, 0.3); }
.pop-tag-item.exam { background: rgba(105, 201, 208, 0.12); color: #69c9d0; border-color: rgba(105, 201, 208, 0.3); }

.popover-divider {
  height: 1px;
  background: #28373b;
  margin: 12px 0;
}

.popover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-action-btn {
  background: #141c1f;
  border: 1px solid #253337;
  border-radius: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}

.popover-action-btn:hover {
  border-color: #69c9d0;
  color: #ffffff;
  background: #1b272b;
}

.popover-action-btn.active {
  border-color: #f43f5e;
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.12);
}

.popover-copied {
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #69c9d0;
  text-align: center;
}

/* AMBOSS Exact Key Takeaway Box */
.key-takeaway-container {
  margin: 18px 0;
  padding: 22px 26px;
  background: #091a1c;
  border-left: 3.5px solid #00b4c5;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.key-takeaway-header {
  font-size: 11px;
  font-weight: 800;
  color: #29b6c5;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.key-takeaway-body {
  font-size: 15px;
  line-height: 1.7;
  color: #cde4e6;
  font-family: var(--font-sans);
}

.key-cyan-highlight {
  color: #29b6c5;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.key-takeaway-body a,
.key-learning-text a {
  color: #55cad4;
  text-decoration: none;
  border-bottom: 1px dotted #55cad4;
}

.key-learning-header {
  font-size: 11px;
  font-weight: 800;
  color: #29b6c5;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 22px;
  margin-bottom: 6px;
}

.key-learning-text {
  font-size: 15px;
  line-height: 1.7;
  color: #cde4e6;
}

.q-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.q-stem {
  font-size: 16px;
  line-height: 1.65;
  color: #e2e8f0;
  font-family: var(--font-sans);
}
.q-stem p { margin: 0 0 14px; }
.q-stem .Highlight,
.q-stem .concept-term,
.concept-term {
  text-decoration: none;
  color: inherit;
  background: none;
  border-bottom: none;
  padding: 0;
}

.q-stem.show-highlights .Highlight {
  background: #4d3a08;
  color: #fef08a;
  padding: 2px 4px;
  border-radius: 3px;
}

.q-stem.show-highlights .concept-term,
.why .concept-term {
  border-bottom: 2px solid #e5a93c;
  text-decoration: none;
  color: #fef08a;
  font-weight: 500;
}

.q-media { margin: 16px 0; }
.q-media img { max-width: 100%; border-radius: 8px; border: 1px solid #282e32; display: block; }

/* Attending Tip with Doctor Avatar */
.hint-box {
  margin: 18px 0 16px;
  background: #1d2629;
  border: 1px solid #28363a;
  border-radius: 8px;
  padding: 16px 18px;
  display: none;
  gap: 16px;
  align-items: flex-start;
}
.hint-box.shown { display: flex; }
.hint-box .doctor-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid #69c9d0;
  background: #1b4d52;
}
.hint-box .doctor-avatar svg { width: 100%; height: 100%; }
.hint-box .hint-content { flex: 1; font-size: 14px; font-style: italic; color: #d0e4e6; line-height: 1.6; }
.hint-box .feedback-link, .opt-feedback-btn {
  font-size: 11px;
  font-weight: 800;
  color: #88b7bc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-style: normal;
  display: inline-block;
  margin-top: 10px;
}
.hint-box .feedback-link:hover, .opt-feedback-btn:hover { color: #ffffff; text-decoration: none; }

/* Options Styling — Sleek Pill-Line Rows */
.options {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Hide Stats Functionality */
.options.hide-stats .opt-pct,
.options.hide-stats .rate-bar {
  display: none !important;
}

.option {
  display: block;
  border: 1px solid #2b3238;
  border-radius: 20px;
  padding: 10px 18px;
  background: #1a1d20;
  position: relative;
}
.option:not(.answered) { cursor: pointer; }
.option:not(.answered):hover {
  border-color: #4a5568;
  background: #22262a;
}

.option .opt-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.option .letter {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid #4a5568;
  background: transparent;
  color: #a0aec0;
  font-weight: 700;
  font-size: 11.5px;
  display: flex; align-items: center; justify-content: center;
}
.option .body { flex: 1; min-width: 0; }
.option .otext { font-size: 15px; line-height: 1.5; color: #e2e8f0; }

.option .opt-right {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  gap: 10px;
}
.option.answered .opt-right {
  display: flex;
}
.option .opt-pct { font-size: 13px; font-weight: 700; color: #8899a6; min-width: 34px; text-align: right; }
.option .opt-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #525e68;
  background: rgba(255, 255, 255, 0.05);
}

.option .rate-bar {
  margin: 10px 0 0;
  height: 4px;
  border-radius: 2px;
  background: #282e32;
  overflow: hidden;
  display: none;
}
.option.answered .rate-bar { display: block; }
.option .rate-bar > span { display: block; height: 100%; background: #1ab394; }

.option .why {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #282e32;
  font-size: 14px;
  line-height: 1.6;
  color: #c5d0d8;
}
.option.answered .why { display: none; }
.option.answered.expanded .why,
.option.answered.correct-answer .why,
.option.answered.wrong-answer .why { display: block; }
.options.show-all-expl .option.answered .why { display: block !important; }

/* Correct Option (Green Card) — Softened Tone & Premium Contrast */
.option.correct-answer {
  border: 1px solid #1a6054;
  background: #0f2d29;
  border-radius: 8px;
}
.option.correct-answer .letter {
  background: #14806a;
  border-color: #14806a;
  color: #ffffff;
}
.option.correct-answer .otext {
  color: #ffffff;
  font-weight: 700;
}
.option.correct-answer .opt-pct { color: #26a69a; font-weight: 800; }
.option.correct-answer .opt-check {
  background: #14806a;
  color: #ffffff;
}
.option.correct-answer .rate-bar > span { background: #14806a; }
.option.correct-answer .why {
  color: #e0f2f1;
  font-size: 14.5px;
  line-height: 1.65;
}
.option.correct-answer .why b,
.option.correct-answer .why .wichtig {
  color: #ffffff;
}
.option.correct-answer .why a,
.option.correct-answer .why .autolink {
  color: #80cbc4;
  font-weight: 600;
}

/* Incorrect Option (Red Card) */
.option.wrong-answer {
  border: 1.5px solid #c94a4a;
  background: #201c1e;
  border-radius: 8px;
}
.option.wrong-answer .letter {
  background: #d34545;
  border-color: #d34545;
  color: #ffffff;
}
.option.wrong-answer .otext {
  color: #ffffff;
  font-weight: 700;
}
.option.wrong-answer .opt-pct { color: #e57373; font-weight: 800; }
.option.wrong-answer .opt-check {
  background: #d34545;
  color: #ffffff;
}
.option.wrong-answer .rate-bar > span { background: #d34545; }
.option.answered:not(.correct-answer):not(.wrong-answer) {
  background: #181b1d;
  border: 1px solid #282e32;
  border-radius: 6px;
  opacity: 0.85;
}

.why .wichtig, .hint-box .wichtig, .wichtig {
  color: #ffffff;
  font-weight: 700;
}
.why .autolink, .hint-box .autolink, a.autolink, .why a {
  color: #69c9d0;
  text-decoration: underline;
}
.why a:hover { color: #9be2e7; }

.history-note {
  margin: 14px 0 8px;
  background: #201c1e;
  border-left: 4px solid #c94a4a;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #e57373;
}

/* Key Learning Point Box */
.key-learning-point {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(20, 128, 106, 0.15);
  border-left: 4px solid #14806a;
  border-radius: 6px;
  font-size: 14px;
  color: #ffffff;
  line-height: 1.6;
}
.key-learning-point b {
  color: #26a69a;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-right: 6px;
}

.opt-feedback-row { text-align: right; margin-top: 8px; }
.opt-article-row { margin-top: 12px; }
.article-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #282e32;
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.article-btn:hover { border-color: #1ab394; color: #1ab394; }

/* Result Banner */
.result-banner {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}
.result-banner.show { display: flex; align-items: center; gap: 8px; }
.result-banner.correct { background: #133834; color: #1ab394; border: 1px solid #18a689; }
.result-banner.incorrect { background: #201c1e; color: #e57373; border: 1px solid #c94a4a; }

/* ---------- Bottom Footer Navigation ---------- */
.q-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #15181a;
  border-top: 1px solid #282e32;
  padding: 0;
  height: 64px;
  display: flex;
  align-items: center;
  z-index: 35;
}

.footer-sidebar-part {
  width: 290px;
  flex: 0 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid #282e32;
  padding: 0 16px;
}

.timer-widget {
  display: flex;
  align-items: center;
  gap: 12px;
}
.timer-widget .timer-icon { font-size: 14px; color: #8899a6; }
.timer-widget .timer-column { display: flex; flex-direction: column; }
.timer-widget .session-time, .timer-widget .question-time {
  font-weight: 800;
  font-size: 12px;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.timer-widget .time-sub {
  font-size: 8.5px;
  font-weight: 800;
  color: #8899a6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.timer-widget .pause-btn {
  background: none;
  border: none;
  color: #8899a6;
  font-size: 12px;
  padding: 2px;
}
.timer-widget .pause-btn:hover { color: #ffffff; }

.end-block-btn {
  background: none;
  border: none;
  color: #8899a6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 8px;
}
.end-block-btn:hover { color: #ffffff; }

.footer-main-part {
  flex: 1 1 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0;
}

.footer-top-links {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}
.footer-top-links .q-card-tool-link {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #718096;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
}
.footer-top-links .q-card-tool-link:hover { color: #e2e8f0; }

.footer-nav-buttons {
  height: 100%;
  display: flex;
  align-items: center;
}
.footer-nav-buttons .nav-btn {
  height: 100%;
  background: none;
  border: none;
  border-left: 1px solid #282e32;
  color: #cbd5e1;
  padding: 0 24px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 0;
  box-shadow: none;
}
.footer-nav-buttons .nav-btn:hover { background: rgba(255,255,255,0.05); color: #ffffff; }

.footer-nav-buttons .nav-btn.primary {
  height: 100%;
  background: #0d4a52;
  border-left: 1px solid #165e68;
  color: #ffffff;
  padding: 0 40px;
  border-radius: 0;
  box-shadow: none;
}
.footer-nav-buttons .nav-btn.primary:hover { background: #115760; }
.nav-btn:hover { border-color: #69c9d0; color: #ffffff; }
.nav-btn.primary {
  background: #18a689;
  border: none;
  color: #ffffff;
  padding: 8px 24px;
  box-shadow: 0 2px 8px rgba(24, 166, 137, 0.4);
}
.nav-btn.primary:hover { background: #1ab394; }

.nav-btn:hover { text-decoration: none; border-color: var(--teal-500); color: var(--teal-600); transform: translateY(-1px); }
.nav-btn.primary {
  background: linear-gradient(135deg, #052c31 0%, #084c55 100%);
  color: #ffffff;
  border-color: #052c31;
  box-shadow: 0 4px 12px rgba(5, 44, 49, 0.2);
}
.nav-btn.primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.q-footer .pos-label { font-size: 13px; color: var(--ink-500); font-weight: 700; min-width: 100px; text-align: center; }

/* Summary screen */
.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
}
.summary-card .score {
  font-size: clamp(36px, 8vw + 14px, 48px);
  font-weight: 900;
  color: var(--navy-900);
}
.summary-card .score.good { color: var(--green-600); }
.summary-card .score.bad { color: var(--red-600); }
.summary-breakdown {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 18px 0 26px;
}
.summary-breakdown div { text-align: center; }
.summary-breakdown .n { font-size: 22px; font-weight: 900; }
.summary-breakdown .l { font-size: 11px; text-transform: uppercase; color: var(--ink-500); font-weight: 700; }

/* ================= BROWSE PAGE ================= */
.browse-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.browse-toolbar .search-box { flex: 1 1 240px; min-width: 200px; }

.browse-meta {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 700;
  margin: 10px 0;
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.browse-empty {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  color: var(--ink-500);
  font-size: 14px;
}

.browse-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
  /* transition handled by the shared interactive-controls rule above */
}
.browse-row:hover { border-color: var(--teal-500); background: var(--teal-100); }

.browse-idx {
  flex: 0 0 auto;
  width: 34px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-500);
  text-align: right;
}
.browse-diff {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--muted-bg);
  color: var(--ink-500);
  min-width: 54px;
  text-align: center;
}
.browse-diff.diff-easy { background: var(--green-100); color: var(--green-600); }
.browse-diff.diff-medium { background: var(--amber-100); color: var(--amber-500); }
.browse-diff.diff-hard { background: var(--red-100); color: var(--red-600); }

.browse-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browse-flag { flex: 0 0 auto; font-size: 13px; }

.browse-status {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.browse-status.status-unused { background: var(--muted-bg); color: var(--ink-500); }
.browse-status.status-correct { background: var(--green-100); color: var(--green-600); }
.browse-status.status-incorrect { background: var(--red-100); color: var(--red-600); }
.browse-status.status-omitted { background: var(--muted-bg); color: var(--ink-500); }

.browse-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 10px;
}
.page-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-700);
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
}
.page-btn:hover:not(:disabled) { border-color: var(--teal-500); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-jump {
  width: 56px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-900);
  border-radius: 6px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
}
.page-of { font-size: 12px; color: var(--ink-500); font-weight: 700; }

/* Mobile & Tablet Sidebar Overlay & Backdrop */
.qnav-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .qnav-backdrop {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .qnav-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }
}

.qnav-toggle-btn {
  position: fixed;
  top: 60px;
  left: 14px;
  z-index: 90;
  background: #181b1d;
  border: 1px solid #69c9d0;
  color: #69c9d0;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.25s ease;
}
.qnav-toggle-btn:hover {
  background: #69c9d0;
  color: #181b1d;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .page { padding: 20px 14px 70px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .create-card { padding: 18px 16px; }
  .quiz-wrap { padding: 20px 18px 120px; }
  .font-size-btn { top: 16px; right: 18px; }
  .brand small { display: none; }
  .segmented { gap: 6px; }
  .seg-btn { padding: 8px 12px; flex: 1 1 auto; }
  
  .qnav-toggle-btn { display: flex; }
  .qnav-sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 64px;
    height: auto;
    width: 280px;
    z-index: 100;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.6);
    transform: translateX(0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .qnav-sidebar.collapsed {
    transform: translateX(-100%);
    width: 280px !important;
  }
  .footer-sidebar-part { width: 220px; padding: 0 10px; }
  .timer-widget { gap: 6px; }
  .timer-widget .session-time, .timer-widget .question-time { font-size: 11px; }
  .footer-top-links { padding: 0 12px; gap: 10px; }
  .footer-top-links .q-card-tool-link { font-size: 10px; }
  .footer-nav-buttons .nav-btn { padding: 0 14px; font-size: 11px; }
  .footer-nav-buttons .nav-btn.primary { padding: 0 24px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; height: 48px; }
  .brand { font-size: 15px; }
  .topbar .icon-btn { width: 30px; height: 30px; font-size: 13px; }
  .quiz-wrap { padding: 16px 12px 110px; }
  .font-size-btn { top: 12px; right: 12px; font-size: 12px; }
  .q-stem { font-size: 15px; line-height: 1.6; }
  .q-substem-bar { gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0 12px; padding: 8px 0; }
  .q-substem-bar .tool-btn { font-size: 10px; padding: 4px 6px; flex-shrink: 0; }
  .option { padding: 10px 12px; border-radius: 16px; margin-bottom: 6px; }
  .option .letter { width: 22px; height: 22px; font-size: 10.5px; }
  .option .otext { font-size: 14px; line-height: 1.45; }
  .option .opt-pct { font-size: 11.5px; min-width: 28px; }
  
  .q-footer { height: 56px; }
  .footer-sidebar-part { width: auto; border-right: none; padding: 0 8px; }
  .timer-widget .time-sub { display: none; }
  .end-block-btn { display: none; }
  .footer-top-links { display: none; }
  .footer-main-part { justify-content: flex-end; width: 100%; }
  .footer-nav-buttons { width: 100%; justify-content: space-between; }
  .footer-nav-buttons .nav-btn { flex: 1; text-align: center; justify-content: center; padding: 0 12px; font-size: 11px; }
  .footer-nav-buttons .nav-btn.primary { flex: 1; text-align: center; justify-content: center; padding: 0 16px; font-size: 11px; }

  .share-popover { position: fixed; top: 108px; left: 12px; right: 12px; width: auto; }
  .overflow-popover { position: fixed; top: 108px; right: 12px; left: auto; max-width: calc(100vw - 24px); width: 280px; }
  .browse-toolbar .search-box { flex: 1 1 100%; }
  .browse-toolbar .segmented { flex: 1 1 100%; }
  .browse-row { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
  .browse-idx { display: none; }
  .browse-text { flex: 1 1 100%; order: 1; white-space: normal; }
  .browse-diff, .browse-status, .browse-flag { order: 2; }
  .browse-pagination { gap: 8px; }
  .page-btn { padding: 8px 12px; font-size: 12px; }
}

@media (max-width: 420px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .create-row { margin-bottom: 14px; }
  .segmented { flex-direction: column; }
  .seg-btn { width: 100%; text-align: center; }
  .diff-meter .bars span { width: 4px; height: 10px; }
  .brand { font-size: 14px; }
  .topbar { gap: 6px; padding: 0 8px; }
  .end-block-btn span, .end-block-btn { white-space: nowrap; }
  .username-text { display: none; }
  .user-menu-btn { padding: 5px 7px; }
  .summary-breakdown { justify-content: space-between; }
  .summary-breakdown div { flex: 1 1 40%; }
}

@media (hover: none) {
  .option:not(.answered):hover { background: var(--card); border-color: var(--line); }
  .option:not(.answered):active { border-color: var(--teal-500); background: var(--teal-100); }
}

/* ---------- Modern UI & Performance Micro-Animations ---------- */
@keyframes flow-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes answer-pop {
  0% { transform: scale(0.985); }
  60% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.page, .quiz-wrap, .summary-card {
  animation: flow-up 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.stat-card, .create-card, .resume-card, .q-card, .summary-card {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
}

.stat-card:hover, .resume-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5, 79, 87, 0.12), var(--shadow);
}

.option {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.option:hover:not(.answered) {
  transform: translateX(3px);
  border-color: var(--teal-500);
  box-shadow: 0 2px 10px rgba(13, 148, 163, 0.12);
}

.option.correct, .option.incorrect, .option.selected {
  animation: answer-pop 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.user-menu-dropdown {
  transform-origin: top right;
}

.user-menu-dropdown[style*="display: block"],
.user-menu-dropdown[style*="display: flex"] {
  animation: flow-up 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Real AMBOSS Custom Session Secondary Subnav & 2-Card Layout */
.amboss-subnav {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #141c1f;
  border-bottom: 1px solid #232d31;
  padding: 0 24px;
  height: 44px;
  margin: -24px -24px 20px -24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.subnav-dropdown-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #69c9d0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.subnav-link {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  padding: 10px 0;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}
.subnav-link:hover { color: #ffffff; }
.subnav-link.active {
  color: #ffffff;
  border-bottom-color: #00b4c5;
  font-weight: 700;
}

.custom-session-container {
  margin-top: 16px;
}
.custom-session-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 860px) {
  .custom-session-grid,
  .home-secondary-grid { grid-template-columns: 1fr !important; }
}

.custom-card {
  background: #14191b;
  border: 1px solid #232d31;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.custom-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 20px;
  letter-spacing: -0.1px;
}

.criteria-row {
  margin-bottom: 18px;
}
.criteria-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8899a6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.filter-search-wrap {
  margin-bottom: 16px;
}
.filter-search-input,
.text-input,
#moduleNameInput {
  background: #192023;
  border: 1px solid #2b383d;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #ffffff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}
.filter-search-input input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 13.5px;
  width: 100%;
}
.filter-search-input:focus-within,
.text-input:focus,
#moduleNameInput:focus {
  border-color: #00b4c5;
  outline: none;
}

/* Accordion group inside custom session cards */
.accordion-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.accordion-item {
  background: #192023;
  border: 1px solid #2b383d;
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.accordion-item[open] {
  border-color: #00b4c5;
}
.accordion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.accordion-header::-webkit-details-marker { display: none; }
.accordion-icon {
  font-size: 14px;
  font-weight: 800;
  color: #718096;
}
.accordion-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  flex: 1;
}
.accordion-badge {
  font-size: 11px;
  font-weight: 700;
  color: #8899a6;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
}
.accordion-badge.active-pill {
  background: rgba(0, 180, 197, 0.15);
  color: #69c9d0;
  border: 1px solid rgba(0, 180, 197, 0.3);
}
.accordion-body {
  padding: 12px 14px 16px;
  border-top: 1px solid #232d31;
}
.accordion-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #718096;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Adaptive session card */
.adaptive-card {
  background: #192023;
  border: 1px solid #2b383d;
  border-radius: 6px;
  padding: 16px;
  margin: 18px 0;
}
.adaptive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.adaptive-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #00b4c5;
}
.adaptive-sub {
  font-size: 12px;
  color: #8899a6;
  margin-top: 6px;
}
.adaptive-sub a {
  color: #69c9d0;
  text-decoration: underline;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 20px;
}
.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.toggle-switch input:checked + .slider { background-color: #00b4c5; }
.toggle-switch input:checked + .slider:before { transform: translateX(16px); }

/* Premium AMBOSS Custom Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #212c30;
  border: 1px solid #2d3b40;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  margin: 10px 0 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00b4c5;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 180, 197, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #00cadc;
  box-shadow: 0 4px 12px rgba(0, 180, 197, 0.7);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #00b4c5;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 180, 197, 0.5);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: #212c30;
  border-radius: 4px;
}

/* Question Count Section */
.qcount-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #232d31;
}
.qcount-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8899a6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.qcount-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.qcount-input-wrap input[type="number"] {
  width: 75px;
  background: #192023;
  border: 1px solid #2b383d;
  border-radius: 6px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  padding: 8px;
}
.qcount-max {
  font-size: 14px;
  font-weight: 700;
  color: #8899a6;
}

/* Custom Session Bottom Sticky Bar */
.custom-session-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #182226;
  border: 1px solid #28373b;
  border-radius: 10px;
  padding: 14px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  margin-bottom: 30px;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.session-type-label {
  font-size: 10.5px;
  font-weight: 800;
  color: #718096;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.start-session-btn {
  background: #00b4c5;
  color: #14191b;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 180, 197, 0.3);
}
.start-session-btn:hover {
  background: #00cadc;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 180, 197, 0.45);
}

/* Custom Session Share Result Card & Buttons */
.module-share-card {
  background: #192023;
  border: 1px solid #2b383d;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.module-share-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #69c9d0;
  margin-bottom: 10px;
}
.module-share-input-wrap {
  margin-bottom: 12px;
}
.module-share-input {
  background: #14191b !important;
  border: 1px solid #2b383d !important;
  color: #69c9d0 !important;
  font-family: monospace;
  font-size: 12px !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  width: 100%;
  box-sizing: border-box;
}
.module-share-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}
.share-copy-btn {
  background: transparent;
  border: 1px solid #2b383d;
  color: #c5d0d8;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.share-copy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: #69c9d0;
}
.share-start-btn {
  background: #00b4c5;
  border: none;
  color: #14191b;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.share-start-btn:hover {
  background: #00cadc;
}

/* Footer Share Button */
.footer-share-btn {
  background: rgba(0, 180, 197, 0.12);
  border: 1px solid rgba(0, 180, 197, 0.35);
  color: #69c9d0;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 8px;
}
.footer-share-btn:hover {
  background: rgba(0, 180, 197, 0.22);
  border-color: #00b4c5;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Mobile responsive rules for QBank custom session footer */
@media (max-width: 768px) {
  .custom-card {
    padding: 16px;
  }
  .custom-session-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 16px;
    position: sticky;
    bottom: 12px;
    z-index: 90;
    margin-bottom: 20px;
  }
  .footer-left {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }
  #timerRow {
    margin-left: 0 !important;
    width: 100%;
    justify-content: space-between;
    margin-top: 4px;
  }
  .footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .footer-share-btn {
    flex: 1;
    margin-right: 0 !important;
    text-align: center;
    padding: 10px 12px;
  }
  .start-session-btn {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
  }
}

/* ---- Leaderboard UI Styles ---- */
.topbar-leaderboard-btn {
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.topbar-leaderboard-btn:hover {
  border-color: #00b4c5;
  color: #00b4c5;
  background: rgba(0, 180, 197, 0.1);
}

.leaderboard-modal-card {
  max-width: 520px;
  width: 92vw;
  background: var(--card, #14191b);
  border: 1px solid var(--line, #242d31);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.lb-my-rank-banner {
  background: linear-gradient(135deg, rgba(0, 180, 197, 0.12), rgba(0, 180, 197, 0.04));
  border: 1px solid rgba(0, 180, 197, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.lb-my-rank-banner .highlight-num {
  color: #00b4c5;
  font-size: 15px;
  font-weight: 800;
}

.leaderboard-list-wrap {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line, #242d31);
  border-radius: 8px;
  background: var(--bg, #0e1213);
}

.lb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #1c2428);
  font-size: 13.5px;
  transition: background 0.15s ease;
}
.lb-row:last-child {
  border-bottom: none;
}
.lb-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.lb-row.me-row {
  background: rgba(0, 180, 197, 0.1);
  border-left: 3px solid #00b4c5;
  font-weight: 700;
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lb-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.lb-rank.rank-1 { background: #ffd700; color: #000; font-size: 14px; }
.lb-rank.rank-2 { background: #c0c0c0; color: #000; font-size: 14px; }
.lb-rank.rank-3 { background: #cd7f32; color: #fff; font-size: 14px; }

.lb-username {
  font-weight: 600;
  color: var(--fg);
}
.lb-row.me-row .lb-username {
  color: #00b4c5;
}

.lb-score {
  font-weight: 800;
  color: var(--fg);
}
.lb-score-unit {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 3px;
}


