/* ================================================================
   QuizPDF — Light Premium Design System
   Clean bright theme · Indigo accent · Lucide icons
   ================================================================ */

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

:root {
  /* ── Modern & Refined Palette ── */
  --bg-page: #f8faff;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --bg-card: #ffffff;
  --bg-card-h: #fdfdff;
  --bg-subtle: #f1f5f9;

  --border: rgba(226, 232, 240, 0.8);
  --border-h: #cbd5e1;
  --border-focus: #6366f1;

  --accent: #4f46e5;
  --accent-mid: #6366f1;
  --accent-light: #818cf8;
  --accent-pale: #eef2ff;
  --accent-glow: rgba(99, 102, 241, 0.15);

  --violet: #8b5cf6;
  --violet-pale: #f5f3ff;
  --green: #10b981;
  --green-pale: #f0fdf4;
  --rose: #f43f5e;
  --rose-pale: #fff1f2;
  --amber: #f59e0b;
  --amber-pale: #fffbeb;
  --teal: #14b8a6;
  --teal-pale: #f0fdfa;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-placeholder: #94a3b8;

  /* ── Typography ── */
  --font: 'Inter', system-ui, -apple-system, sans-serif;

  /* ── Sizing ── */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-2xl: 36px;
  --radius-full: 9999px;

  /* ── Soft & Layered Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.03), 0 1px 4px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 12px 24px -6px rgba(15, 23, 42, 0.06), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 48px -12px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 32px 64px -16px rgba(15, 23, 42, 0.16);
  --shadow-accent: 0 10px 25px -5px rgba(79, 70, 229, 0.3);
  --shadow-accent-lg: 0 20px 40px -8px rgba(79, 70, 229, 0.4);

  /* ── Transitions ── */
  --t-fast: 0.1s ease;
  --t-normal: 0.2s ease;
  --t-slow: 0.4s ease;
  --t-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Lucide icon sizing ───────────────────────────────────────── */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon svg {
  display: block;
}

/* ── Typography ─────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

p {
  line-height: 1.6;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 60%, #c026d3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.container-narrow {
  max-width: 680px;
}

/* ── Views ──────────────────────────────────────────────────── */
.view {
  display: none;
  min-height: calc(100vh - 60px);
}

.view.active {
  display: block;
  animation: fadeUp 0.3s ease forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 1px rgba(0,0,0,0.02), 0 2px 4px rgba(0,0,0,0.02);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.nav-logo-wrap {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-accent);
}

.nav-logo-wrap svg {
  color: #fff;
}

.nav-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--t-normal);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn svg {
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  color: #fff;
  padding: 12px 28px;
  font-size: 14px;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-accent-lg);
  filter: brightness(1.1);
}

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 12px 28px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-h);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 14px;
  border: 1.5px solid transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
  border-color: var(--border);
}

.btn-danger {
  background: var(--rose-pale);
  color: var(--rose);
  border: 1.5px solid #fecdd3;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-danger:hover {
  background: #ffe4e6;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-xl {
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #f0f4ff 0%, #ffffff 50%, #fdf4ff 100%);
  border-bottom: 1px solid var(--border);
  padding: 80px 24px 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-pale);
  border: 1.5px solid var(--border-h);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Upload Zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 52px 32px;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--t-normal);
  box-shadow: var(--shadow-xs);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent-mid);
  background: var(--accent-pale);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.10);
  transform: scale(1.005);
}

.upload-icon-wrap {
  width: 72px;
  height: 72px;
  background: var(--accent-pale);
  border: 1.5px solid var(--border-h);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--accent);
  transition: all var(--t-normal);
}

.upload-zone:hover .upload-icon-wrap {
  background: #e0e7ff;
  border-color: var(--accent-mid);
  transform: scale(1.06);
}

.upload-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.upload-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 22px;
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── URL Input ───────────────────────────────────────────────── */
.url-row {
  margin-bottom: 8px;
}

.url-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.url-input-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.url-prefix-icon {
  padding: 0 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  padding: 12px 4px;
}

.url-input::placeholder {
  color: var(--text-placeholder);
}

.url-input-wrap .btn {
  border-radius: 0;
  padding: 12px 20px;
}

.url-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-left: 4px;
}

/* ── Library ─────────────────────────────────────────────────── */
#librarySection {
  margin-top: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
}

.library-stats {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.pdf-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: all var(--t-spring);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdf-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px) scale(1.02);
}

.pdf-card-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-pale);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent);
}

.pdf-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
  word-break: break-word;
  color: var(--text-primary);
}

.pdf-card-count {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pdf-card-status {
  font-size: 12px;
  color: var(--amber);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pdf-card-remove {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}

.pdf-card-remove:hover {
  background: var(--rose-pale);
  border-color: #fecdd3;
  color: var(--rose);
}

.pdf-card-progress {
  margin-top: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.pdf-card-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.6s ease;
}

.library-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── Processing Overlay ─────────────────────────────────────── */
.proc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.proc-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 52px;
  text-align: center;
  min-width: 340px;
  box-shadow: var(--shadow-xl);
}

.proc-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin: 0 auto 20px;
}

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

.proc-status {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.proc-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.proc-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.4s ease;
}

.proc-substatus {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ── Shared Card ─────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 48px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.card-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

/* ── Config View ─────────────────────────────────────────────── */
#view-config .container {
  padding-top: 36px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  margin-bottom: 22px;
  padding: 0;
  transition: color var(--t-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-btn:hover {
  color: var(--accent);
}

.cfg-section {
  margin-bottom: 30px;
}

.cfg-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.pdf-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.pdf-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.pdf-check-item:hover {
  background: var(--accent-pale);
  border-color: var(--border-h);
}

.pdf-check-item.selected {
  border-color: var(--accent);
  background: var(--accent-pale);
}

.pdf-check-item input[type=checkbox] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pdf-check-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.pdf-check-count {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.cfg-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ── Chips ───────────────────────────────────────────────────── */
.chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font);
}

.chip:hover {
  border-color: var(--accent-mid);
  color: var(--accent);
  background: var(--accent-pale);
}

.chip.active {
  background: var(--accent-pale);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.10);
}

.cfg-input {
  width: 100%;
  margin-top: 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 16px;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.cfg-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.cfg-input::placeholder {
  color: var(--text-placeholder);
}

/* ── Toggle ──────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background var(--t-normal);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.toggle-track.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-normal);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-track.on .toggle-thumb {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Quiz Bar ─────────────────────────────────────────────────── */
.quiz-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 90;
  box-shadow: var(--shadow-xs);
}

.quiz-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-prog-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.quiz-source-badge {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--accent-pale);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-full);
  color: var(--accent);
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-pale);
  border: 1px solid #99f6e4;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.quiz-timer.warning {
  color: var(--rose);
  background: var(--rose-pale);
  border-color: #fecdd3;
}

/* ── Quiz Progress Track ─────────────────────────────────────── */
.quiz-progress-track {
  height: 3px;
  background: var(--border);
  position: sticky;
  top: calc(60px + 44px);
  z-index: 89;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.4s ease;
}

/* ── Question Card ───────────────────────────────────────────── */
#view-quiz .container {
  padding-top: 32px;
}

.question-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.28s ease;
}

.q-number {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.q-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.q-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 32px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ── Options ─────────────────────────────────────────────────── */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-normal);
  text-align: left;
  font-family: var(--font);
  color: var(--text-primary);
  font-size: 15px;
  width: 100%;
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
}

.option-btn:hover:not(:disabled) {
  background: var(--accent-pale);
  border-color: var(--border-h);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: all var(--t-normal);
}

.option-text {
  flex: 1;
  font-weight: 500;
}

/* ── Option States ────────────────────────────────────────────── */
.option-btn.selected {
  background: var(--accent-pale);
  border-color: var(--accent);
}

.option-btn.selected .option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.1);
}

.option-btn.correct {
  background: var(--green-pale);
  border-color: var(--green);
  color: var(--text-primary);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

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

.option-btn.wrong {
  background: var(--rose-pale);
  border-color: var(--rose);
  opacity: 0.8;
}

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

@keyframes pulse-correct {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.018);
  }

  100% {
    transform: scale(1);
  }
}

/* ── Quiz Navigation ─────────────────────────────────────────── */
.quiz-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.skip-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  min-height: 18px;
  font-weight: 500;
}

/* ── Results ─────────────────────────────────────────────────── */
#view-results .container {
  padding-top: 44px;
}

.results-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 48px 48px;
  text-align: center;
  margin-bottom: 32px;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.score-ring-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 24px;
}

.score-ring {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.score-pct {
  font-size: 30px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

.score-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.score-stats {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.7;
}

.score-stats strong {
  color: var(--text-primary);
  font-weight: 700;
}

.score-feedback {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.results-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

/* ── Review List ─────────────────────────────────────────────── */
.review-section {
  margin-top: 8px;
}

.review-heading {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-item {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-fast);
}

.review-item:hover {
  box-shadow: var(--shadow-sm);
}

.review-item.review-correct {
  border-left: 4px solid var(--green);
}

.review-item.review-wrong {
  border-left: 4px solid var(--rose);
}

.review-item.review-skip {
  border-left: 4px solid var(--text-muted);
}

.review-q-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review-q-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-status-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.review-status-icon.correct {
  background: var(--green-pale);
  color: var(--green);
}

.review-status-icon.wrong {
  background: var(--rose-pale);
  color: var(--rose);
}

.review-status-icon.skip {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.review-q-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

.review-answers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-top: 10px;
  font-weight: 500;
}

.review-your-answer {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--rose-pale);
  color: var(--rose);
  border: 1px solid #fecdd3;
}

.review-correct-answer {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid #6ee7b7;
}

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-xl);
  z-index: 9000;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: #6ee7b7;
  color: var(--green);
}

.toast.error {
  border-color: #fecdd3;
  color: var(--rose);
}

.toast.info {
  border-color: var(--border-h);
  color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero {
    padding: 48px 16px 40px;
  }

  .upload-zone {
    padding: 36px 20px;
  }

  .question-card,
  .card {
    padding: 22px 20px;
  }

  .results-hero {
    padding: 32px 20px;
  }

  .pdf-grid {
    grid-template-columns: 1fr;
  }

  .quiz-bar {
    gap: 8px;
  }

  .q-text {
    font-size: 15px;
  }

  .option-btn {
    font-size: 14px;
    padding: 12px 14px;
  }

  .results-btn-row {
    flex-direction: column;
  }

  .library-cta {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-h);
}

