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

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

:root {
  --bg:           #FBF4EC;
  --surface:      #FFFCF7;
  --surface2:     #F3EAD9;
  --border:       #DDD2BF;
  --border-light: #EAE1D2;
  --text:         #2C2418;
  --text-muted:   #8A7D6D;
  --accent:       #D4621A;
  --accent-light: #E57A38;
  --accent-pale:  rgba(212,98,26,0.08);
  --success:      #2D6B3C;
  --success-pale: rgba(45,107,60,0.10);
  --error:        #B83030;
  --error-pale:   rgba(184,48,48,0.10);
  --warn:         #A86010;
  --warn-pale:    rgba(168,96,16,0.10);
  --info:         #1A4E9A;
  --radius:       6px;
  --radius-lg:    10px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --shadow:       0 2px 8px rgba(0,0,0,0.07);
  --transition:   0.15s ease;
}

/* ── Dark theme: override the variables, everything else follows ─────────── */
html[data-theme="dark"] {
  --bg:           #15110D;
  --surface:      #211B15;
  --surface2:     #2C2419;
  --border:       #3B3125;
  --border-light: #2E261B;
  --text:         #F1EADF;
  --text-muted:   #A99C8A;
  --accent:       #E88140;
  --accent-light: #F2A263;
  --accent-pale:  rgba(232,129,64,0.16);
  --success:      #5FB36F;
  --success-pale: rgba(95,179,111,0.16);
  --error:        #E5736B;
  --error-pale:   rgba(229,115,107,0.16);
  --warn:         #D69A3A;
  --warn-pale:    rgba(214,154,58,0.16);
  --info:         #6AA6F0;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.40);
  --shadow:       0 2px 12px rgba(0,0,0,0.55);
}

html { font-size: 16px; }
body { transition: background-color var(--transition), color var(--transition); }

/* ── Header dark-mode toggle — overrides moved after base .toggle-switch ── */

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Screens */
.screen { display: none; width: 100%; max-width: 920px; padding: 24px 20px 60px; }
.screen.active { display: block; }

/* Header */
header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo-icon {
  width: 36px; height: 36px;
  border-radius: 7px;
  object-fit: contain;
}

.logo-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}
.logo-text strong { color: var(--text); font-weight: 600; }

.brand-prepare { color: #f5a623 !important; font-weight: 600; }
.brand-it      { color: #e8781a !important; font-weight: 700; }
.brand-up      { color: #d44a00 !important; font-weight: 700; }

.header-toggles {
  /* Hidden by default — these controls are only for the Fun Quizzes section.
     updateHeaderToggles() reveals them (display:flex) on those screens. */
  display: none; align-items: center; gap: 16px;
}

.speech-toggle-wrap {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-switch {
  position: relative; display: inline-block;
  width: 36px; height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  inset: 0; background: var(--border);
  border-radius: 20px; transition: .2s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
input:checked + .slider { background: var(--accent); }
input:checked + .slider::before { transform: translateX(16px); }

/* ── Header dark-mode toggle (larger switch with sun/moon on the knob) ── */
.toggle-switch.theme-toggle-switch { width: 46px; height: 24px; }
.theme-toggle-switch .slider::before {
  height: 18px; width: 18px; left: 3px;
  top: 50%; bottom: auto;
  transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1;
  content: '☀️';
}
.theme-toggle-switch input:checked + .slider::before {
  transform: translate(22px, -50%);
  content: '🌙';
}

.header-right {
  display: flex; align-items: center; gap: 16px;
}

.user-info {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border-light);
  padding-left: 16px;
}

#user-name-display {
  font-weight: 500;
  color: var(--text);
}

.sign-out-btn {
  background: none; border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: underline;
  font-family: inherit;
}
.sign-out-btn:hover { color: var(--error); }

.settings-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 4px;
  opacity: 0.7;
  transition: opacity var(--transition);
}
.settings-btn:hover { opacity: 1; }

/* Header sign-in button */
.header-sign-in-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.header-sign-in-btn:hover {
  background: var(--accent-light);
}

/* Sign-in banner on home screen */
.sign-in-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--accent-pale);
  border: 1px solid rgba(212,98,26,0.2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.sign-in-banner-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}
.sign-in-banner-text strong {
  color: var(--accent);
}
.sign-in-banner-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.sign-in-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.sign-in-banner-dismiss:hover { color: var(--text); }

/* ─── Auth Screen ──────────────────────────────────────────────────────── */
#auth-screen {
  display: none;
  max-width: 440px;
  margin: 0 auto;
  padding: 60px 20px;
}
#auth-screen.active { display: block; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-logo-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: contain;
}

.auth-logo-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-muted);
}
.auth-logo-text strong { color: var(--text); font-weight: 700; }

.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.auth-tab.active {
  background: var(--accent);
  color: #fff;
}
.auth-tab:hover:not(.active) {
  background: var(--accent-pale);
}

.auth-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-switch-text .auth-link-btn {
  display: inline;
  margin: 0;
  width: auto;
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-step {
  text-align: left;
}

.auth-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}
.auth-label + .auth-input { margin-bottom: 14px; }

.auth-btn {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  font-size: 1rem;
}

.auth-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.auth-info strong { color: var(--text); }

.auth-link-btn {
  background: none; border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  margin-top: 12px;
  display: block;
  text-align: center;
  width: 100%;
}
.auth-link-btn:hover { text-decoration: underline; }

.auth-error {
  background: var(--error-pale);
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-top: 16px;
  text-align: left;
}

.auth-spinner {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Boot splash (loading screen on first open / refresh) ───────────────── */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.app-splash-logo-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-splash-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.app-splash-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  animation: splashPulse 1.6s ease-in-out infinite;
}
.app-splash-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}
.app-splash-name .brand-prepare,
.app-splash-name .brand-it,
.app-splash-name .brand-up { font-weight: 700; }
@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.92); opacity: 0.7; }
}
/* Hide the splash once the app is ready */
body:not(.app-loading) .app-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
/* Keep the header hidden until the app has booted so the pre-auth
   state never flashes underneath the splash. */
body.app-loading header { visibility: hidden; }

/* ─── Home Screen ─────────────────────────────────────────────────────── */
.home-hero { padding: 40px 0 32px; }

.hero-eyebrow {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 12px;
}

.home-hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.18;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.hero-greeting-sub {
  display: block;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 0.93rem;
  max-width: 460px;
  line-height: 1.6;
}

/* On the home hero, let the intro line run wider — up to about the middle of
   the second category card — instead of stopping at the first card's edge. */
.home-hero .hero-sub { max-width: 690px; }

.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Category Grid — 2x2 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 500px) { .category-grid { grid-template-columns: 1fr; } }

/* Home 2x2 group boxes — larger, more prominent than inner cards */
.home-grid { gap: 16px; margin-bottom: 28px; }
.home-grid .category-card { padding: 32px 18px 26px; gap: 12px; min-height: 192px; }
.home-grid .cat-icon { font-size: 2.6rem; }
.home-grid .cat-icon-img { width: 72px; height: 72px; }
.home-grid .cat-name { font-size: 1.2rem; }

/* Course card logo image */
.cat-icon-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cat-color, var(--accent));
  border-radius: var(--radius-lg);
  padding: 24px 16px 20px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.category-card:hover {
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cat-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.cat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: center;
}

.cat-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.cat-count {
  font-size: 0.78rem;
  color: var(--cat-color, var(--accent));
  font-weight: 600;
}

/* ─── Exam Grid (Competitive Exams) ───────────────────────────────────── */
#exam-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 860px) { #exam-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { #exam-grid { grid-template-columns: 1fr; } }

.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--exam-color, var(--accent));
  border-radius: var(--radius-lg);
  padding: 14px 12px 12px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.exam-card:hover {
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Under-construction exam cards */
.exam-card--soon {
  position: relative;
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.6);
  box-shadow: none;
}
.exam-card--soon:hover {
  background: var(--surface);
  transform: none;
  box-shadow: none;
}
.exam-soon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #fff;
  background: var(--text-muted);
  padding: 2px 6px;
  border-radius: 999px;
}

.subject-card.subject-card--soon,
.subject-card.subject-card--soon:hover,
.subject-card.subject-card--soon * {
  cursor: not-allowed;
}
.subject-card--soon {
  position: relative;
  opacity: 0.55;
  filter: grayscale(0.6);
  box-shadow: none;
}
.subject-card--soon:hover {
  transform: none;
  box-shadow: none;
}
.subject-soon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #fff;
  background: var(--text-muted);
  padding: 2px 6px;
  border-radius: 999px;
}

.exam-logo-img {
  width: 100%;
  max-width: 100px;
  height: 38px;
  object-fit: contain;
  border-radius: 4px;
}

.exam-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.exam-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.exam-subjects { font-size: 0.68rem; color: var(--text-muted); text-align: center; line-height: 1.4; }
.exam-count { font-size: 0.72rem; color: var(--exam-color, var(--accent)); font-weight: 600; }

/* Subject Screen (Competitive Exams) */
.subject-hero {
  padding: 20px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.exam-hero-icon { align-self: flex-start; margin-bottom: 4px; }
.exam-hero-logo { width: 120px; height: 48px; object-fit: contain; border-radius: 6px; }
.subject-hero h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.8rem; font-weight: 700; color: var(--text);
}

#subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  display: flex; flex-direction: column;
  gap: 4px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.subject-card:hover {
  border-left-color: var(--card-accent, var(--accent));
  background: var(--surface2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.subject-card.selected {
  border-left-color: var(--card-accent, var(--accent));
  background: var(--surface);
  box-shadow: var(--shadow);
}
.subject-card.selected .subject-name { color: var(--card-accent, var(--accent)); }

.subject-icon { font-size: 1.3rem; line-height: 1; }
.subject-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.subject-count { font-size: 0.72rem; color: var(--text-muted); }

/* ─── Sets Screen ─────────────────────────────────────────────────────── */
.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 8px;
  transition: color var(--transition);
}
.back-btn:hover { color: var(--accent); }

.sets-hero {
  padding: 20px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-hero-icon {
  font-size: 2.4rem;
  align-self: flex-start;
  margin-bottom: 4px;
  line-height: 1;
}
.cat-hero-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.sets-hero h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

#sets-grid, #continents-grid, #extra-grid, #inventors-grid, #history-period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 28px;
}

.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  display: flex; flex-direction: column;
  gap: 4px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.set-card:hover {
  border-left-color: var(--card-accent, var(--accent));
  background: var(--surface2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.set-card.selected {
  border-left-color: var(--card-accent, var(--accent));
  background: var(--surface);
  box-shadow: var(--shadow);
}
.set-card.selected .set-name { color: var(--card-accent, var(--accent)); }

.set-icon { font-size: 1.3rem; line-height: 1; }
.set-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.set-count { font-size: 0.72rem; color: var(--text-muted); }

.start-btn-wrap { text-align: left; }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 0.93rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(212,98,26,0.25);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.disabled, .btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}
.btn-primary.disabled:hover, .btn-primary:disabled:hover {
  background: var(--border);
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { color: var(--text); border-color: var(--accent); }

/* ─── Quiz Screen ─────────────────────────────────────────────────────── */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

#progress-text { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
#score-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.progress-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 99px;
  overflow: hidden;
  flex: 1;
}
#progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

/* Question Card */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.q-meta {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}

.q-category, .q-subject, .q-type {
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 3px;
}

.q-category {
  background: rgba(0,0,0,0.05);
  color: var(--badge-color, var(--accent));
  border: 1px solid rgba(0,0,0,0.08);
}

.q-subject {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.q-type {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

#q-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.55;
  font-weight: 600;
  color: var(--text);
}

.blank {
  display: inline-block;
  min-width: 70px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  margin: 0 3px;
  text-align: center;
}

/* ─── Answer Area ─────────────────────────────────────────────────────── */
.answer-area { margin-bottom: 12px; }
.answer-area.hidden { display: none !important; }

/* MCQ */
.answer-area.mcq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
@media (max-width: 480px) { .answer-area.mcq { grid-template-columns: 1fr; } }

.option-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.option-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.option-btn.correct {
  border-color: var(--success);
  background: var(--success-pale);
  color: var(--success);
}
.option-btn.wrong {
  border-color: var(--error);
  background: var(--error-pale);
  color: var(--error);
  opacity: 0.7;
}
.option-btn:disabled { cursor: default; }

.opt-label {
  min-width: 24px; height: 24px;
  background: var(--surface2);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
}
.option-btn.correct .opt-label {
  background: var(--success-pale);
  border-color: var(--success);
  color: var(--success);
}
.option-btn.wrong .opt-label {
  background: var(--error-pale);
  border-color: var(--error);
  color: var(--error);
}

.opt-text { flex: 1; line-height: 1.4; }

/* True/False */
.answer-area.tf {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.tf-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.tf-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-pale); }
.tf-btn.selected { border-color: var(--accent); background: var(--accent-pale); }
.tf-btn.correct  { border-color: var(--success); background: var(--success-pale); color: var(--success); }
.tf-btn.wrong    { border-color: var(--error);   background: var(--error-pale);   color: var(--error); opacity: 0.7; }
.tf-btn:disabled { cursor: default; }
.tf-icon { font-size: 1rem; }

/* Fill in the Blank */
.answer-area.fitb { padding: 2px 0; }

.fitb-wrap { display: flex; gap: 8px; align-items: stretch; }

.fitb-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.93rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  box-shadow: var(--shadow-sm);
}
.fitb-input:focus { border-color: var(--accent); }
.fitb-input::placeholder { color: var(--text-muted); }
.fitb-input.correct-reveal {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-pale);
  font-weight: 600;
}

.submit-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}
.submit-btn:hover:not(:disabled) { background: var(--accent-light); }
.submit-btn:disabled { opacity: 0.5; cursor: default; }

/* ─── Hint Box ────────────────────────────────────────────────────────── */
#hint-box {
  background: var(--warn-pale);
  border: 1px solid rgba(168,96,16,0.25);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: slideDown 0.2s ease;
}
#hint-box.show { display: flex; }

.hint-top { display: flex; align-items: center; gap: 7px; }

.hint-icon { font-size: 0.95rem; flex-shrink: 0; }
.hint-label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--warn);
}

#hint-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
  padding-left: 24px;
}

.answer-reveal {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--success-pale);
  border: 1px solid rgba(45,107,60,0.25);
  border-radius: var(--radius);
  margin-top: 4px;
  animation: slideDown 0.2s ease;
}
.answer-reveal.show { display: flex; }

.answer-reveal-label {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--success);
  white-space: nowrap;
}

.answer-reveal strong {
  font-size: 0.93rem;
  color: var(--success);
  font-weight: 700;
}

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

/* ─── Quiz Controls ───────────────────────────────────────────────────── */
.quiz-controls {
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
}

#mic-btn, #read-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 13px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
#mic-btn:hover { border-color: var(--accent); color: var(--accent); }
#read-btn:hover { border-color: var(--info); color: var(--info); }

#mic-btn.listening {
  border-color: var(--error);
  background: var(--error-pale);
  color: var(--error);
  animation: pulse 1s infinite;
}
.mic-icon { font-size: 0.9rem; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,48,48,0.25); }
  50%       { box-shadow: 0 0 0 4px rgba(184,48,48,0); }
}

.btn-show-answer {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 8px 13px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-show-answer:hover {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-pale);
  border-style: solid;
}

#skip-btn { margin-left: auto; }

#quit-btn {
  display: flex; align-items: center; gap: 4px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
#quit-btn:hover { border-color: var(--error); color: var(--error); }

/* ─── Results Screen ──────────────────────────────────────────────────── */
.results-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 440px;
  margin: 36px auto 0;
}

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

.score-ring { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border-light); stroke-width: 7; }
.score-ring-fill {
  fill: none;
  stroke: url(#ring-grad);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1);
  stroke-dasharray: 339.29;
  stroke-dashoffset: 339.29;
}

.score-ring-text {
  position: absolute;
  inset: 0; display: flex;
  flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}

#result-score {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
#result-pct {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}

.results-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
#result-msg {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 0.93rem;
}

.breakdown {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  text-align: left;
}

/* Pie Chart */
.pie-chart-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 10px 0;
}

#pie-chart {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.pie-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pie-label {
  color: var(--text-muted);
  min-width: 80px;
}

.results-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-accent {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
}
.btn-accent:hover { background: #B84F14; }

/* ─── Review List ─────────────────────────────────────────────────── */
.review-list {
  margin-top: 20px;
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.review-row:last-child { border-bottom: none; }

.review-correct  { background: #f0fdf4; }
.review-second   { background: #fffbeb; }
.review-wrong    { background: #fef2f2; }
.review-skipped  { background: #f8fafc; }

.review-q-num {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.review-q-body { flex: 1; min-width: 0; }

.review-q-text {
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.review-q-answer {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.review-q-answer strong { color: var(--text); }

.review-badge {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

@media (max-width: 500px) {
  .review-row { flex-wrap: wrap; gap: 6px; }
  .review-badge { width: 100%; text-align: right; }
}

/* ─── Quiz History Cards ──────────────────────────────────────────── */
.practice-again-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  font-family: inherit;
  margin-bottom: 12px;
}
.practice-again-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.pa-icon { font-size: 1.5rem; }

.pa-info { flex: 1; }

.pa-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.pa-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pa-arrow {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  transition: transform var(--transition);
}

/* ─── History Accordion Groups ────────────────────────────────────── */
.history-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-group + .history-group {
  margin-top: 10px;
}

.history-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background var(--transition);
}
.history-group-header:hover {
  background: var(--surface2);
}

.hg-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hg-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.hg-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 99px;
}

.hg-arrow {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.history-group-body {
  border-top: 1px solid var(--border-light);
}

.reattempt-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  background: #ede9fe;
  color: #6d28d9;
  padding: 1px 7px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: middle;
}

.history-group-body .history-card {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border-light);
}
.history-group-body .history-card:last-child {
  border-bottom: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow var(--transition);
}
.history-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.history-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-category {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.history-set {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 99px;
}

.history-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.4;
  transition: opacity var(--transition);
  padding: 2px 4px;
}
.history-delete:hover { opacity: 1; }

.history-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.history-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-score {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 2px 10px;
  border-radius: 99px;
}
.score-great { background: #dcfce7; color: #166534; }
.score-good  { background: #fef9c3; color: #854d0e; }
.score-low   { background: #fee2e2; color: #991b1b; }

.history-breakdown {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.hb-item {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.history-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.history-reattempt {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.history-reattempt:hover {
  background: #B84F14;
}

.history-weak {
  color: var(--accent);
  border-color: var(--accent);
}
.history-weak:hover {
  background: #fff5eb;
}

/* ─── Settings Screen ─────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.settings-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 16px;
}

.settings-field {
  margin-bottom: 14px;
}

.settings-field .auth-input {
  width: 100%;
}

.settings-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-section-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: -8px 0 16px;
}

/* Username field with leading @ */
.settings-username-row { position: relative; display: flex; align-items: center; }
.settings-username-at {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.settings-username-row .auth-input { padding-left: 26px; }

/* ── PrepOwl custom dropdown ──────────────────────────────────────────────── */
.pw-dd { position: relative; width: 100%; }

.pw-dd-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.pw-dd-trigger:hover { border-color: var(--accent-light); }
.pw-dd.open .pw-dd-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}
.pw-dd-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pw-dd-arrow {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.pw-dd.open .pw-dd-arrow { transform: rotate(180deg); color: var(--accent); }

.pw-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: none;
}
.pw-dd.open .pw-dd-menu { display: block; }

.pw-dd-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius);
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.pw-dd-option:hover { background: var(--surface2); }
.pw-dd-option.selected { color: var(--accent); font-weight: 600; }
.pw-dd-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pw-dd-check { flex-shrink: 0; opacity: 0; color: var(--accent); }
.pw-dd-option.selected .pw-dd-check { opacity: 1; }

/* Speed slider */
.settings-rate-val {
  font-weight: 600;
  color: var(--accent);
  margin-left: 6px;
}
.settings-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin-top: 6px;
}
.settings-test-btn { margin-top: 4px; }

/* "Coming soon" badge */
.settings-soon-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 2px 9px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(193, 102, 47, 0.12);
  border: 1px solid rgba(193, 102, 47, 0.3);
  border-radius: 999px;
}

/* Privacy / social toggles */
.settings-switch {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  border-top: 1px solid var(--border);
}
.settings-switch:first-of-type { border-top: none; }
.settings-switch input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.settings-switch-text { display: flex; flex-direction: column; gap: 2px; }
.settings-switch-text strong { font-size: 0.9rem; color: var(--text); font-weight: 600; }
.settings-switch-text small { font-size: 0.76rem; color: var(--text-muted); line-height: 1.45; }
.settings-switch + .settings-switch { margin-top: 0; }
#save-privacy-btn { margin-top: 14px; }

.settings-msg {
  text-align: center;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 12px;
}

.settings-msg-success {
  background: #dcfce7;
  color: #166534;
}

.settings-msg-error {
  background: #fee2e2;
  color: #991b1b;
}

/* ─── Course Viewer ──────────────────────────────────────────────────── */
.course-screen {
  padding: 0 !important;
  max-width: 100% !important;
}

.course-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* GRE content is shown in a centered 920px column (unlike the sidebar-based
   courses), so align its topbar back button to that same column. This makes
   the GRE back button land in the exact horizontal position as the back
   button on the screen it returns to, enabling "double-click two screens
   back". Vertical block spacing is neutralized so it sits on the same line.
   The left padding also reserves room so the corner-pinned Sections button
   never overlaps the back button on narrower screens. */
#gre-course-screen .course-topbar {
  position: relative;
  padding-top: 16px;
  padding-bottom: 16px;
  padding-left: max(130px, calc((100% - 920px) / 2 + 20px));
  padding-right: max(20px, calc((100% - 920px) / 2 + 20px));
}
#gre-course-screen .course-topbar .back-btn {
  margin-bottom: 0;
  padding-left: 0;
  padding-right: 0;
}
/* Pin the Sections menu button to the true top-left corner, independent of the
   content-column padding that keeps "Back to exams" aligned with the page. */
#gre-course-screen #gre-sidebar-toggle {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.course-sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
}

.course-layout {
  display: flex;
  min-height: calc(100vh - 120px);
}

.course-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  position: sticky;
  top: 60px;
}

.course-sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.course-sidebar-header:hover {
  background: var(--card-hover, rgba(0,0,0,0.04));
}

.course-sidebar-icon {
  font-size: 1.6rem;
}

.course-sidebar-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.course-sidebar-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.course-nav {
  padding: 8px 0;
}

/* Sidebar — Module/Chapter hierarchy */
.course-sidebar-module {
  border-bottom: 1px solid var(--border-light);
}

.course-sidebar-module-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
  line-height: 1.35;
}

.course-sidebar-module-header:hover {
  background: var(--surface2);
}

.course-sidebar-module-header.active-module {
  background: #FFF3E6;
  color: var(--accent);
}

.course-sidebar-chevron {
  font-size: 0.65rem;
  margin-top: 2px;
  flex-shrink: 0;
  width: 14px;
}

.course-sidebar-module-name {
  flex: 1;
}

.course-sidebar-chapters {
  padding-bottom: 4px;
}

.course-sidebar-chapter {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 16px 7px 32px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: left;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  line-height: 1.35;
}

.course-sidebar-chapter:hover {
  background: var(--surface2);
  color: var(--text);
}

.course-sidebar-chapter.active {
  background: #FFF3E6;
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.course-sidebar-ch-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 28px;
}

.course-sidebar-ch-title {
  flex: 1;
}

/* Module overview chapter grid */
.course-chapter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.course-chapter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  transition: all 0.15s;
}

.course-chapter-card:hover {
  border-color: var(--accent);
  background: #FFF3E6;
}
html[data-theme="dark"] .course-chapter-card:hover {
  background: var(--accent-pale);
}

.course-chapter-card-num {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  min-width: 32px;
}

.course-chapter-card-title {
  color: var(--text);
}

.course-module-progress {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Terminal-style code block (non-Python output) */
.course-terminal {
  border-left: 3px solid var(--accent);
  background: #f8f4ef;
}

/* Course Tables */
.course-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}
.course-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.5;
}
.course-table th {
  background: var(--bg-warm);
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}
.course-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.course-table tbody tr:last-child td {
  border-bottom: none;
}
.course-table tbody tr:nth-child(even) {
  background: rgba(0,0,0,.02);
}
.course-table code {
  background: rgba(0,0,0,.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* Course Content */
.course-content {
  flex: 1;
  padding: 32px 40px 60px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}

.course-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.course-level-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.course-level-beginner { background: #dcfce7; color: #166534; }
.course-level-intermediate { background: #fef3c7; color: #92400e; }
.course-level-advanced { background: #fce7f3; color: #9d174d; }

.course-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
}

.course-goals {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.course-erase-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.course-erase-btn {
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.course-erase-btn:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-pale);
}

.course-section {
  margin-bottom: 28px;
}

.course-section-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-top: 8px;
}

.course-inline-list {
  padding-left: 24px;
  margin: 8px 0 12px;
}
.course-inline-list li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 4px;
}

.course-section-body p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 10px;
}

.course-reinforcement {
  background: #FFF8F0;
  border-left: 3px solid var(--accent);
  padding: 18px 20px;
  border-radius: var(--radius);
}

/* Worked Examples */
.course-example {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.course-example-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  font-family: 'DM Sans', monospace;
}

.course-code {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.course-code code {
  font-family: inherit;
}

.course-example-explanation {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
}

/* Common Mistakes */
.course-mistakes {
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  padding: 18px 20px;
  border-radius: var(--radius);
}

.course-mistakes-list {
  list-style: none;
  padding: 0;
}

.course-mistakes-list li {
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 4px 0 4px 20px;
  position: relative;
  color: var(--text);
}

.course-mistakes-list li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: #ef4444;
  font-weight: 700;
}

/* Coding Practice */
.course-practice-list {
  list-style: none;
  padding: 0;
  counter-reset: practice;
}

.course-practice-text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 12px;
}

.course-code-input {
  width: 100%;
  background: #1e1e2e;
  color: #cdd6f4;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.course-code-input::placeholder {
  color: #6c7086;
}

.course-run-btn {
  margin-top: 8px;
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius);
  background: #3776AB;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.course-run-btn:hover { background: #2B5E8C; }

.course-code-output {
  margin-top: 8px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 12px;
  font-family: 'SF Mono', monospace;
  font-size: 0.8rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Review Prompts */
.course-review-list {
  padding-left: 20px;
}

.course-review-list li {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 6px;
}

/* MCQs */
.course-mcq {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  background: var(--surface);
}

.course-mcq-q {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}

.course-mcq-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-mcq-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: var(--text);
  transition: all 0.15s;
  line-height: 1.4;
}

.course-mcq-opt:hover:not(:disabled) {
  border-color: var(--accent);
  background: #FFF8F0;
}

.course-mcq-letter {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.course-mcq-opt.correct {
  border-color: #22c55e;
  background: #f0fdf4;
}

.course-mcq-opt.correct .course-mcq-letter {
  background: #22c55e;
  color: #fff;
}

.course-mcq-opt.wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.course-mcq-opt.wrong .course-mcq-letter {
  background: #ef4444;
  color: #fff;
}

.course-mcq-feedback {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius);
  border-left: 3px solid #22c55e;
}

.course-mcq-answer {
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 4px;
}

.course-mcq-why {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* MCQ Hint (2-attempt system) */
.course-mcq-hint {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--warn-pale);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--warn);
  line-height: 1.5;
}
.course-mcq-hint strong { color: var(--warn); }

/* MCQ Result badges */
.mcq-result {
  margin-top: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.4;
}
.mcq-result.mcq-first { color: var(--success); }
.mcq-result.mcq-second { color: #b08000; }
.mcq-result.mcq-incorrect { color: var(--error); }

/* MCQ disabled option */
.course-mcq-opt:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ── Dark mode fixes for course MCQs, chapters & solution boxes ────────── */
html[data-theme="dark"] .course-mcq-opt:hover:not(:disabled) {
  background: var(--accent-pale);
}
html[data-theme="dark"] .course-mcq-opt.correct {
  background: rgba(34,197,94,0.15);
  color: #6ee7b7;
  opacity: 1;
}
html[data-theme="dark"] .course-mcq-opt.wrong {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  opacity: 0.85;
}
html[data-theme="dark"] .course-mcq-feedback {
  background: var(--surface2);
}
html[data-theme="dark"] .course-sidebar-chapter.active {
  background: var(--accent-pale);
}
html[data-theme="dark"] .course-solution-box {
  background: rgba(34,197,94,0.10);
  border-color: rgba(34,197,94,0.25);
}
html[data-theme="dark"] .course-sidebar-module-header.active-module {
  background: var(--accent-pale);
}
html[data-theme="dark"] .course-reinforcement {
  background: var(--accent-pale);
}
html[data-theme="dark"] .course-mistakes {
  background: var(--error-pale);
}
html[data-theme="dark"] .course-expected-output {
  background: rgba(34,197,94,0.12);
}
html[data-theme="dark"] .course-practice-feedback.feedback-warn {
  background: var(--warn-pale);
  color: var(--warn);
}
html[data-theme="dark"] .course-code-output.output-success {
  background: rgba(34,197,94,0.10);
}
html[data-theme="dark"] .course-code-output.output-loading {
  background: var(--surface2);
}

/* Example header with Try-it button */
.course-example-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.course-try-btn {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  background: #3776AB;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.course-try-btn:hover { background: #2B5E8C; }

.course-example-output {
  margin-top: 6px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Practice items */
.course-practice-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 14px;
  transition: border-color var(--transition);
}
.course-practice-item.practice-correct {
  border-color: #22c55e;
  background: #f0fdf4;
}
.course-practice-num {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-pale);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.course-practice-body { flex: 1; min-width: 0; }

/* Code editor area */
.course-code-editor {
  margin-top: 10px;
}
.course-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.course-check-btn,
.course-solution-btn {
  padding: 7px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.course-check-btn {
  background: var(--success);
  color: #fff;
}
.course-check-btn:hover { background: #245a32; }
.course-solution-btn {
  background: var(--surface2);
  color: var(--text);
}
.course-solution-btn:hover { background: var(--border); }

/* Solution box */
.course-solution-box {
  margin-top: 12px;
  padding: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
}
.course-solution-label,
.course-expected-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 6px;
}
.course-expected-label { margin-top: 10px; }
.course-expected-output {
  background: #dcfce7;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

/* Practice feedback badges */
.course-practice-feedback {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}
.course-practice-feedback.feedback-correct {
  background: var(--success-pale);
  color: var(--success);
}
.course-practice-feedback.feedback-wrong {
  background: var(--error-pale);
  color: var(--error);
}
.course-practice-feedback.feedback-partial {
  background: var(--warn-pale);
  color: var(--warn);
}
.course-practice-feedback.feedback-warn {
  background: #fef3c7;
  color: #92400e;
}

/* Code output variants */
.course-code-output.output-success {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  color: var(--text);
}
.course-code-output.output-error {
  background: var(--error-pale);
  border-left: 3px solid var(--error);
  color: var(--error);
}
.course-code-output.output-loading {
  background: #f1f5f9;
  border-left: 3px solid #94a3b8;
  color: var(--text-muted);
  font-style: italic;
}

/* Navigation buttons */
.course-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 40px;
}

.course-prev-btn,
.course-next-btn {
  min-width: 160px;
}

/* Summary */
.course-summary {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  padding: 18px 20px;
  border-radius: var(--radius);
}
html[data-theme="dark"] .course-summary {
  background: rgba(34,197,94,0.10);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .course-sidebar-toggle { display: block; }

  .course-sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    height: 100vh;
    z-index: 50;
    transition: left 0.25s ease;
    box-shadow: none;
  }

  .course-screen.sidebar-open .course-sidebar {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }

  .course-content {
    padding: 20px 16px 60px;
    max-height: none;
  }

  .course-title { font-size: 1.4rem; }

  .course-nav-buttons { flex-direction: column; gap: 10px; }
  .course-prev-btn, .course-next-btn { width: 100%; min-width: auto; }
}

/* ─── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text);
  border-radius: 99px;
  padding: 8px 18px;
  font-size: 0.82rem;
  color: #fff;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}
#toast.show { opacity: 1; }
#toast.success { background: var(--success); }
#toast.error   { background: var(--error); }
#toast.warn    { background: var(--warn); }
#toast.info    { background: var(--info); }

/* ═══════════════════════════════════════════════════════════════════════
   AP PHYSICS COURSE VIEWER
   ═══════════════════════════════════════════════════════════════════════ */

/* Sidebar course group */
.ap-sidebar-course {
  margin-bottom: 4px;
}
.ap-sidebar-course-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}
.ap-sidebar-course-header:hover { color: var(--text); }
.ap-sidebar-course-header .arrow { transition: transform 0.2s; font-size: 0.7rem; }
.ap-sidebar-course-header.collapsed .arrow { transform: rotate(-90deg); }
.ap-sidebar-course.collapsed .ap-sidebar-units { display: none; }

.ap-sidebar-unit {
  display: block;
  width: 100%;
  padding: 8px 16px 8px 28px;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.ap-sidebar-unit:hover { background: var(--accent-pale); }
.ap-sidebar-unit.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-pale);
}
.ap-sidebar-unit .ap-unit-count {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Unit header */
.ap-unit-header {
  margin-bottom: 28px;
}
.ap-unit-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin: 0 0 4px;
}
.ap-unit-header .ap-unit-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Type sections */
.ap-type-section {
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.ap-type-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.ap-type-header:hover { background: var(--accent-pale); }
.ap-type-header .ap-type-icon { font-size: 1.1rem; }
.ap-type-header .ap-type-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}
.ap-type-header .ap-type-arrow {
  transition: transform 0.2s;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.ap-type-section.collapsed .ap-type-arrow { transform: rotate(-90deg); }
.ap-type-section.collapsed .ap-type-body { display: none; }

.ap-type-body {
  padding: 12px 16px;
}

/* Question cards */
.ap-question-card {
  padding: 16px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: box-shadow 0.15s;
}
.ap-question-card:last-child { margin-bottom: 0; }
.ap-question-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.ap-question-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ap-question-id,
.ap-question-num {
  font-size: 0.78rem;
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  padding: 2px 0;
}
.ap-difficulty-easy {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 500;
}
.ap-difficulty-medium {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
}
.ap-difficulty-hard {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 500;
}
.ap-topic-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: #ede9fe;
  color: #5b21b6;
}
.ap-question-text {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* MCQ choices */
.ap-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.ap-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.5;
  transition: all 0.15s;
}
.ap-choice:hover { border-color: var(--accent); background: var(--accent-pale); }
.ap-choice .ap-choice-letter {
  font-weight: 700;
  color: var(--accent);
  min-width: 18px;
}
.ap-choice.correct {
  background: #d1fae5;
  border-color: #059669;
  color: #14110D;
  pointer-events: none;
}
.ap-choice.incorrect {
  background: #fee2e2;
  border-color: #dc2626;
  color: #14110D;
  pointer-events: none;
}
.ap-choice.correct .ap-choice-text,
.ap-choice.incorrect .ap-choice-text,
.ap-choice.correct .ap-choice-letter,
.ap-choice.incorrect .ap-choice-letter { color: #14110D; }
.ap-choice.disabled { pointer-events: none; opacity: 0.6; }
html[data-theme="dark"] .ap-choice.correct {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
  color: #6ee7b7;
  opacity: 1;
}
html[data-theme="dark"] .ap-choice.incorrect {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #fca5a5;
  opacity: 0.85;
}
html[data-theme="dark"] .ap-choice.correct .ap-choice-text,
html[data-theme="dark"] .ap-choice.correct .ap-choice-letter { color: #6ee7b7; }
html[data-theme="dark"] .ap-choice.incorrect .ap-choice-text,
html[data-theme="dark"] .ap-choice.incorrect .ap-choice-letter { color: #fca5a5; }
html[data-theme="dark"] .ap-choice.disabled { opacity: 0.5; }

/* Free response textarea */
.ap-free-response {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
  background: var(--bg);
}
.ap-free-response:focus { border-color: var(--accent); outline: none; }
.ap-check-btn {
  padding: 6px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 10px;
}
.ap-check-btn:hover { opacity: 0.9; }

/* Hint & solution toggles */
.ap-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ap-hint-btn, .ap-answer-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.ap-hint-btn:hover, .ap-answer-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ap-hint-box {
  display: none;
  padding: 10px 14px;
  margin-top: 8px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: #92400e;
}
.ap-hint-box.visible { display: block; }
html[data-theme="dark"] .ap-hint-box {
  background: var(--warn-pale);
  color: var(--warn);
}

.ap-solution-box {
  display: none;
  padding: 12px 14px;
  margin-top: 8px;
  background: #ecfdf5;
  border-left: 3px solid #059669;
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.ap-solution-box.visible { display: block; }
/* In dark mode the light-green panel would wash out its light text — use a
   subtle dark-green tint so the inherited text stays readable. */
html[data-theme="dark"] .ap-solution-box { background: var(--success-pale); }
.ap-solution-box .ap-answer-label {
  font-weight: 600;
  color: #059669;
  margin-bottom: 4px;
}
.ap-solution-box .ap-solution-text {
  color: var(--text);
  margin-top: 6px;
  line-height: 1.6;
}

/* ─── ML Course ──────────────────────────────────────────────────────── */
.ml-overview-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.ml-overview-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--text);
}
.ml-overview-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.ml-project-connection {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.ml-lesson-topic {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}
.ml-lesson-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.ml-detail-box {
  margin-top: 6px;
  margin-bottom: 6px;
}
.ml-revision-section {
  margin-bottom: 18px;
}
.ml-revision-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
}
.ml-revision-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.ml-drill-item, .ml-hint-item {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.ml-drill-item:last-child, .ml-hint-item:last-child {
  border-bottom: none;
}

/* ─── NumPy Code Blocks ──────────────────────────────────────────────── */
.np-code-block {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px 18px;
  border-radius: var(--radius);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;   /* gap so consecutive code boxes don't touch */
}
.np-code-block:last-child { margin-bottom: 0; }

/* ── Lesson tables (Pandoc ::: center simple tables) ───────────────────── */
.np-table-wrap { overflow-x: auto; margin: 0 0 14px; }
.np-lesson-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 60%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.np-lesson-table th,
.np-lesson-table td {
  padding: 8px 14px;
  border: 1px solid var(--border);
  text-align: left;
  color: var(--text);
}
.np-lesson-table th {
  background: var(--surface2);
  font-weight: 700;
}
.np-lesson-table tbody tr:nth-child(even) { background: var(--bg); }

/* ── Lesson notes (numpy / pandas teaching content) ───────────────────── */
.np-lesson { margin-bottom: 22px; }
.np-lesson:last-child { margin-bottom: 0; }
.np-lesson-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.np-lesson-text {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 10px;
}
.np-lesson-subhead {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin: 14px 0 6px;
}
.np-lesson-list {
  margin: 0 0 10px;
  padding-left: 22px;
}
.np-lesson-list li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 4px;
}
.pw-inline-code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
  color: var(--accent);
}
.np-output-label,
.course-solution-label,
.course-expected-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 10px 0 4px;
}
.np-output-block {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 10px;
}

/* ── Pandas: View-datasets bar + button ───────────────────────────────── */
.pd-data-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}
.pd-data-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.pd-data-btn:hover { background: var(--accent-light); }
.pd-data-hint { font-size: 0.8rem; color: var(--text-muted); }
.pd-data-hint code, .pd-dataset-sub code, .pd-dataset-meta code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}

/* ── Pandas: dataset viewer modal ─────────────────────────────────────── */
.pd-dataset-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: min(960px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}
.pd-dataset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.pd-dataset-head h3 { margin: 0; font-size: 1.1rem; color: var(--text); }
.pd-dataset-close {
  background: none; border: none; font-size: 1.6rem; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 4px;
}
.pd-dataset-close:hover { color: var(--text); }
.pd-dataset-sub {
  font-size: 0.84rem; color: var(--text-muted);
  padding: 12px 20px 0; margin: 0;
}
.pd-dataset-body { padding: 16px 20px 20px; overflow-y: auto; }
.pd-dataset-block { margin-bottom: 24px; }
.pd-dataset-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 6px;
}
.pd-dataset-title code { color: var(--accent); }
.pd-dataset-meta { font-weight: 400; font-size: 0.76rem; color: var(--text-muted); }
.pd-dataset-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.pd-dataset-table { border-collapse: collapse; font-size: 0.76rem; white-space: nowrap; }
.pd-dataset-table th, .pd-dataset-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
.pd-dataset-table th {
  background: var(--surface2); color: var(--text);
  font-weight: 700; position: sticky; top: 0;
}
.pd-dataset-table td { color: var(--text-muted); }
.pd-dataset-table tbody tr:last-child td { border-bottom: none; }
.pd-dataset-foot { font-size: 0.72rem; color: var(--text-muted); margin-top: 5px; }

/* ── SQL query results ─────────────────────────────────────────────────── */
.sql-result {
  margin-top: 10px;
  font-size: 0.82rem;
}
.sql-result-error {
  background: rgba(178, 59, 46, 0.08);
  border: 1px solid rgba(178, 59, 46, 0.3);
  color: #8F2C21;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  white-space: pre-wrap;
}
.sql-result-msg { color: var(--text-muted); padding: 4px 0; }
.sql-result-warn { color: #8F2C21; font-weight: 600; }
.sql-result-ok .sql-result-msg:first-child { color: #1F7A3D; font-weight: 700; }
.sql-return-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 2px 0 10px;
}
.sql-return-hint code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85em;
  color: var(--accent);
}
.sql-result-meta { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 4px; }
.sql-result-scroll {
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sql-result-table { border-collapse: collapse; white-space: nowrap; min-width: 100%; }
.sql-result-table th, .sql-result-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
}
.sql-result-table th {
  background: var(--surface2);
  color: var(--text);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.sql-result-table td { color: var(--text-muted); }
.sql-result-table tbody tr:nth-child(even) { background: var(--bg); }
.sql-code-input { font-family: 'Fira Code', 'Consolas', 'Monaco', monospace; }

/* ════════════════════════════════════════════════════════════════════════
   GRE Course
   ════════════════════════════════════════════════════════════════════════ */

/* ── Topbar ──────────────────────────────────────────────────────────── */
.gre-topbar-left { display: flex; align-items: center; gap: 12px; }
#gre-sidebar-toggle { display: inline-block; }   /* always visible for GRE */

/* ── Push-right sidebar (closed by default; opening shifts content right) ─
   The sidebar is part of the flex flow but collapsed to zero width when
   closed. Opening it expands its column so the content pane is pushed to the
   right instead of being overlaid — nothing on screen is hidden. */
#gre-course-screen .course-layout {
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
#gre-course-screen .course-sidebar {
  flex: 0 0 0px;
  width: 0;
  min-width: 0;
  max-width: 300px;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow: hidden;
  opacity: 0;
  transition: flex-basis 0.25s ease, width 0.25s ease, opacity 0.2s ease;
}
#gre-course-screen.sidebar-open .course-sidebar {
  flex: 0 0 300px;
  width: 300px;
  min-width: 300px;
  opacity: 1;
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
}
#gre-course-screen .course-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 60px);
  transition: flex-basis 0.25s ease;
}
/* backdrop no longer used in push mode */
.gre-backdrop { display: none !important; }

/* ── Sidebar tree ────────────────────────────────────────────────────── */
#gre-nav { padding: 8px 0 40px; }
.gre-sb-item,
.gre-sb-grouphead {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  /* indent grows with depth (top level = depth 1) */
  padding: 9px 14px 9px calc(14px + (var(--depth, 1) - 1) * 15px);
}
.gre-sb-label { flex: 1; }
.gre-sb-grouphead {
  font-weight: 700;
  font-size: 0.84rem;
}
.gre-sb-group[style*="--depth:0"] > .gre-sb-grouphead,
.gre-sb-group:not([style*="--depth"]) > .gre-sb-grouphead {
  text-transform: none;
}
.gre-sb-grouphead:hover { background: var(--accent-pale); }
.gre-sb-caret {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.gre-sb-group.open > .gre-sb-grouphead .gre-sb-caret { transform: rotate(90deg); }
.gre-sb-groupbody { display: none; }
.gre-sb-group.open > .gre-sb-groupbody { display: block; }

.gre-sb-item {
  font-size: 0.82rem;
  font-weight: 500;
}
.gre-sb-item:hover { background: var(--accent-pale); }
.gre-sb-item.active {
  background: var(--accent-pale);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.gre-sb-count {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 99px;
  padding: 1px 8px;
}
.gre-sb-item.active .gre-sb-count { color: var(--accent); }

/* ── Breadcrumbs ─────────────────────────────────────────────────────── */
.gre-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}
.gre-crumb {
  background: none;
  border: none;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.gre-crumb:hover { color: var(--accent); background: var(--accent-pale); }
.gre-crumb:last-child { color: var(--text); cursor: default; }
.gre-crumb-sep { color: var(--text-muted); font-size: 0.75rem; }

/* ── Card grid (landing + branch pages) ──────────────────────────────── */
.gre-cards-wrap { max-width: 920px; margin-left: auto; margin-right: auto; }
.gre-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.gre-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 18px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

/* "Continue where you left off" banner on the GRE landing page */
.gre-resume {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; padding: 16px 18px; margin-bottom: 22px;
  background: var(--accent-pale); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); cursor: pointer; font-family: inherit;
  transition: box-shadow var(--transition), transform var(--transition);
}
.gre-resume:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.gre-resume-icon {
  flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center;
  justify-content: center; border-radius: 10px; background: var(--surface);
  font-size: 1.3rem;
}
.gre-resume-body { flex: 1; min-width: 0; }
.gre-resume-label { font-weight: 700; color: var(--accent); font-size: 0.95rem; }
.gre-resume-trail {
  font-weight: 600; color: var(--text); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gre-resume-time { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.gre-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.gre-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-pale);
  color: var(--accent);
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
}
.gre-card-body { flex: 1; min-width: 0; }
.gre-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.gre-card-meta { font-size: 0.78rem; color: var(--text-muted); }
.gre-card-score {
  margin-top: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Saved mock-test results ─────────────────────────────────────────────── */
.gre-saved-h { margin-top: 32px; }
.gre-saved-list { display: flex; flex-direction: column; gap: 10px; }
.gre-saved-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.gre-saved-body { flex: 1 1 60%; min-width: 180px; }
.gre-saved-title { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.gre-saved-meta { font-size: 0.78rem; color: var(--text-muted); }
.gre-saved-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gre-saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}
.gre-saved-head .gre-saved-h { margin-top: 0; }
.gre-saved-del {
  flex-shrink: 0;
}

/* ── List toolbars (Practice Again / Continue) + soft danger button ─────── */
.gre-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.gre-btn-danger-soft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: #B23B2E;
  background: rgba(178, 59, 46, 0.07);
  border: 1px solid rgba(178, 59, 46, 0.28);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.gre-btn-danger-soft:hover {
  background: rgba(178, 59, 46, 0.13);
  border-color: rgba(178, 59, 46, 0.5);
  color: #8F2C21;
}
.gre-card-arrow {
  flex-shrink: 0;
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
}
.gre-card:hover .gre-card-arrow { color: var(--accent); transform: translateX(3px); }

/* ── "Continue" / "Practice Again" boxes (below the 6-topic grid) ─────── */
.gre-pboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}
.gre-pbox {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; padding: 18px 20px; font-family: inherit; cursor: pointer;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.gre-pbox:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.gre-pbox-icon {
  flex-shrink: 0; width: 46px; height: 46px; display: flex; align-items: center;
  justify-content: center; border-radius: 12px; background: var(--surface);
  font-size: 1.4rem; box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
}
.gre-pbox-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gre-pbox-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.gre-pbox-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

/* ── PrepOwl confirm modal (replaces native confirm/alert) ───────────── */
.pw-modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(20, 12, 6, 0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity 0.15s ease;
}
.pw-modal-overlay.show { opacity: 1; }
.pw-modal {
  width: 100%; max-width: 400px; background: var(--surface, #fff);
  border-radius: 18px; padding: 28px 26px 22px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  transform: translateY(12px) scale(0.97); transition: transform 0.18s ease;
}
.pw-modal-overlay.show .pw-modal { transform: translateY(0) scale(1); }
.pw-modal-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
  background: var(--accent-pale, #fdeee2);
}
.pw-modal-icon.danger { background: #fdecea; }
.pw-modal-title {
  margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; color: var(--text, #2a2118);
  font-family: 'Playfair Display', serif;
}
.pw-modal-msg { margin: 0 0 22px; font-size: 0.92rem; color: var(--text-muted, #7a6f63); line-height: 1.5; }
.pw-modal-actions { display: flex; gap: 10px; }
.pw-modal-btn {
  flex: 1; padding: 12px 16px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 0.92rem; border: 1px solid var(--border, #e6ddd2);
  transition: filter 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.pw-modal-btn:active { transform: translateY(1px); }
.pw-modal-cancel { background: var(--surface, #fff); color: var(--text, #2a2118); }
.pw-modal-cancel:hover { background: var(--bg, #faf6f1); }
.pw-modal-primary { background: var(--accent, #D4621A); border-color: var(--accent, #D4621A); color: #fff; }
.pw-modal-primary:hover { filter: brightness(1.05); }
.pw-modal-danger { background: #c0392b; border-color: #c0392b; color: #fff; }
.pw-modal-danger:hover { filter: brightness(1.05); }

/* Quit button shown in the topbar during an in-progress mock exam */
.gre-exam-quit-btn { color: #c0392b; }
.gre-exam-quit-btn:hover { color: #a93226; border-color: #c0392b; }

/* Quiz screen top-corner reset button */
.quiz-topbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.quiz-reset-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); border-radius: 999px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 0.82rem;
  padding: 6px 14px; transition: all var(--transition);
}
.quiz-reset-btn:hover { border-color: #c0392b; color: #c0392b; background: #fdecea; }

/* Per-subject Continue / Practice Again box host + list modal */
.pbox-host { margin: 4px 0 22px; }
.pbox-host:empty { display: none; }
.pw-list-modal { max-width: 560px; }
.pw-list-modal .gre-modal-body { max-height: 70vh; overflow-y: auto; }
/* Stack the action buttons onto their own full-width row so the title text
   never gets squeezed into an unreadable sliver beside them. */
.pw-list-modal .gre-litem { flex-wrap: wrap; }
.pw-list-modal .gre-litem-body { flex: 1 1 60%; min-width: 160px; }
.pw-list-modal .gre-litem-title { white-space: normal; word-break: break-word; }
.pw-list-modal .gre-litem-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
.pw-litem-del {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; cursor: pointer; font-size: 0.95rem;
  padding: 7px 9px; line-height: 1; transition: all var(--transition);
}
.pw-litem-del:hover { border-color: #c0392b; background: #fdecea; }

/* ── Continue / Practice Again list views ────────────────────────────── */
.gre-list-h {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  margin: 26px 0 12px;
}
.gre-litems { display: flex; flex-direction: column; gap: 12px; }
.gre-litem {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.gre-litem-icon {
  flex-shrink: 0; width: 42px; height: 42px; display: flex; align-items: center;
  justify-content: center; border-radius: 10px; background: var(--accent-pale);
  font-size: 1.3rem;
}
.gre-litem-body { flex: 1; min-width: 0; }
.gre-litem-title { font-weight: 700; color: var(--text); font-size: 0.98rem; }
.gre-litem-trail {
  font-size: 0.82rem; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gre-litem-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.gre-litem-bar {
  height: 6px; border-radius: 999px; background: var(--border);
  margin-top: 8px; overflow: hidden;
}
.gre-litem-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.gre-litem-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.gre-litem-actions button:disabled { opacity: 0.45; cursor: not-allowed; }
.gre-awscore {
  font-weight: 800; font-size: 1.25rem; color: var(--accent);
  display: inline-flex; align-items: baseline; gap: 1px;
}
.gre-awscore small { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
.gre-alltogether {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 4px 0 4px; padding: 12px 20px; font-family: inherit; font-weight: 700;
  cursor: pointer; border-radius: var(--radius-lg);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  transition: filter var(--transition), transform var(--transition);
}
.gre-alltogether:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* ── Practice modal ──────────────────────────────────────────────────── */
.gre-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.gre-modal {
  width: 100%; max-width: 420px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, 0 20px 50px rgba(0,0,0,0.25));
  overflow: hidden;
}
.gre-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.gre-modal-head h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.gre-modal-x {
  border: none; background: none; font-size: 1.1rem; cursor: pointer;
  color: var(--text-muted); padding: 4px;
}
.gre-modal-body { padding: 18px 20px 22px; }
.gre-modal-sub { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 16px; }
.gre-modal-group { margin-bottom: 18px; }
.gre-modal-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 8px;
}
.gre-modal-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gre-chip {
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-weight: 600; font-size: 0.88rem; color: var(--text);
  border: 1px solid var(--border); background: var(--surface);
  transition: all var(--transition);
}
.gre-chip--on { border-color: var(--accent); background: var(--accent-pale); color: var(--accent); }
.gre-modal-start { width: 100%; margin-top: 4px; }

@media (max-width: 640px) {
  .gre-pboxes { grid-template-columns: 1fr; }
  .gre-litem { flex-wrap: wrap; }
  .gre-litem-actions { width: 100%; }
}

/* ── Document / Syllabus ─────────────────────────────────────────────── */
.gre-doc { max-width: 760px; margin-left: auto; margin-right: auto; }
.gre-doc-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.25;
}
.gre-doc-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.6;
}
.gre-doc-h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.gre-doc-h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--accent);
  margin: 20px 0 8px;
}
.gre-doc-p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 12px;
}

/* ── Analytical Writing (essay) ──────────────────────────────────────── */
.gre-essay { max-width: 880px; }
.gre-essay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.gre-essay-controls { display: flex; align-items: center; gap: 12px; }
.gre-essay-topicno {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.gre-btn-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.gre-btn-soft:hover:not(:disabled) {
  background: var(--accent-pale);
  border-color: var(--accent);
  color: var(--accent);
}
.gre-btn-soft:disabled { opacity: 0.45; cursor: not-allowed; }

.gre-essay-prompt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.gre-essay-statement {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  font-weight: 500;
}
.gre-essay-directions {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: italic;
}
.gre-essay-box {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  padding: 18px 20px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gre-essay-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}
.gre-essay-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
}
.gre-word-count { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.gre-essay-saved { font-size: 0.78rem; color: var(--success); font-weight: 600; }
.gre-essay-foot-right { display: flex; align-items: center; gap: 12px; }

/* ── Analytical Writing: rubric grader ─────────────────────────────────── */
.gre-essay-result { margin-top: 18px; }
.gre-rubric {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.gre-rubric-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.gre-rubric-score {
  flex: 0 0 auto;
  width: 72px; height: 72px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 800; line-height: 1;
  color: #fff;
  background: var(--accent);
}
.gre-rubric-score span { font-size: 0.9rem; font-weight: 600; opacity: 0.85; margin-left: 1px; align-self: flex-end; margin-bottom: 6px; }
.gre-rubric[data-band="6"] .gre-rubric-score,
.gre-rubric[data-band="5"] .gre-rubric-score { background: #059669; }
.gre-rubric[data-band="4"] .gre-rubric-score { background: #2563EB; }
.gre-rubric[data-band="3"] .gre-rubric-score { background: #D97706; }
.gre-rubric[data-band="2"] .gre-rubric-score,
.gre-rubric[data-band="1"] .gre-rubric-score,
.gre-rubric[data-band="0"] .gre-rubric-score { background: #DC2626; }
.gre-rubric-label { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.gre-rubric-summary { font-size: 0.88rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.gre-rubric-breakdown { display: flex; flex-direction: column; gap: 10px; }
.gre-rubric-row {
  display: grid;
  grid-template-columns: 160px 1fr 38px;
  grid-template-areas: "name bar num" "note note note";
  align-items: center;
  gap: 4px 12px;
}
.gre-rubric-name { grid-area: name; font-size: 0.85rem; font-weight: 600; color: var(--text); }
.gre-rubric-bar { grid-area: bar; height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.gre-rubric-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.gre-rubric-num { grid-area: num; font-size: 0.82rem; font-weight: 700; color: var(--text); text-align: right; }
.gre-rubric-note { grid-area: note; font-size: 0.74rem; color: var(--text-muted); }
.gre-rubric-fbtitle { font-size: 0.95rem; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.gre-rubric-fb { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.gre-rubric-fb li { font-size: 0.86rem; line-height: 1.5; color: var(--text); }
.gre-rubric-disclaimer { font-size: 0.72rem; color: var(--text-muted); margin: 16px 0 0; line-height: 1.45; font-style: italic; }
@media (max-width: 560px) {
  .gre-rubric-row { grid-template-columns: 120px 1fr 36px; }
}

/* ── Question deck: header + nav ─────────────────────────────────────── */
.gre-cat-head { margin-bottom: 20px; }
.gre-deck-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.gre-counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Two-pane (RC / DI) vs single ────────────────────────────────────── */
.gre-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.gre-left {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding-right: 4px;
}
.gre-single { max-width: 720px; }

.gre-passage-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}
.gre-passage {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.gre-passage p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 12px;
}
.gre-passage p:last-child { margin-bottom: 0; }
.gre-di-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 12px;
}
.gre-graph {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.gre-graph img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

/* ── Tables ──────────────────────────────────────────────────────────── */
.gre-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 4px 0;
}
.gre-table th, .gre-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}
.gre-table th { background: var(--surface2); font-weight: 700; }
.gre-table tr:nth-child(even) td { background: var(--surface); }
.gre-doc-table { margin: 14px 0 20px; overflow-x: auto; }
.gre-doc-table .gre-table { font-size: 0.9rem; }

/* ── Question card ───────────────────────────────────────────────────── */
.gre-q {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.gre-stem {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
}
.gre-multi-note {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.gre-blank {
  display: inline-block;
  min-width: 64px;
  border-bottom: 2px solid var(--accent);
  text-align: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.2;
  margin: 0 2px;
  vertical-align: baseline;
}

/* ── Choices ─────────────────────────────────────────────────────────── */
.gre-choices { display: flex; flex-direction: column; gap: 10px; }
.gre-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.gre-choice:hover:not(.disabled) {
  background: var(--accent-pale);
  border-color: var(--accent);
}
.gre-choice-mark {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
}
.gre-choice-mark.sq { border-radius: 5px; }
.gre-choice-text { flex: 1; padding-top: 2px; }

.gre-choice.selected {
  background: var(--accent-pale);
  border-color: var(--accent);
}
.gre-choice.selected .gre-choice-mark {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.gre-choice.correct {
  background: var(--success-pale);
  border-color: var(--success);
}
.gre-choice.correct .gre-choice-mark {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.gre-choice.incorrect {
  background: var(--error-pale);
  border-color: var(--error);
}
.gre-choice.incorrect .gre-choice-mark {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}
.gre-choice.disabled { cursor: default; }
.gre-choice.disabled:hover { background: var(--bg); border-color: var(--border); }
.gre-choice.disabled.selected:hover { background: var(--accent-pale); border-color: var(--accent); }
.gre-choice.disabled.correct:hover { background: var(--success-pale); border-color: var(--success); }
.gre-choice.disabled.incorrect:hover { background: var(--error-pale); border-color: var(--error); }

/* ── Multi-blank columns (Text Completion) ───────────────────────────── */
.gre-blank-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}
.gre-blank-col { display: flex; flex-direction: column; gap: 8px; }
.gre-blank-col-h {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 2px;
}

/* ── Quantitative Comparison ─────────────────────────────────────────── */
.gre-qc-quants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.gre-qc-cell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.gre-qc-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.gre-qc-val { font-size: 1.05rem; font-weight: 600; color: var(--text); }

/* ── Numeric entry ───────────────────────────────────────────────────── */
.gre-numeric { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gre-num-input {
  flex: 1;
  min-width: 200px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gre-num-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-pale);
}

/* ── Check button ────────────────────────────────────────────────────── */
.gre-check {
  margin-top: 16px;
  padding: 10px 22px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background var(--transition);
}
.gre-check:hover:not(:disabled) { background: var(--accent-light); }
.gre-check:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Feedback ────────────────────────────────────────────────────────── */
.gre-feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 3px solid;
}
.gre-feedback.ok { background: var(--success-pale); border-left-color: var(--success); }
.gre-feedback.bad { background: var(--error-pale); border-left-color: var(--error); }
.gre-feedback-tag {
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.gre-feedback.ok .gre-feedback-tag { color: var(--success); }
.gre-feedback.bad .gre-feedback-tag { color: var(--error); }
.gre-reasoning {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
  margin-top: 6px;
}
/* put the label (Explanation: / Answer:) on its own line, claim/text below it */
.gre-reasoning strong { display: block; margin-bottom: 3px; }
.gre-reasoning + .gre-reasoning { margin-top: 10px; }

/* Critical Reasoning: question prompt drops to its own line under the passage */
.gre-cr-passage { display: block; margin-bottom: 14px; }
.gre-cr-question { display: block; font-weight: 600; }

/* ── Read-aloud (TTS) button ─────────────────────────────────────────── */
.gre-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.gre-readaloud {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.gre-readaloud:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Mark-for-review button ──────────────────────────────────────────── */
.gre-btn-mark {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.gre-btn-mark:hover { border-color: var(--accent); }
.gre-btn-mark.marked {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

/* ── Review modal + grid ─────────────────────────────────────────────── */
.gre-rev-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 80;
  padding: 20px;
}
.gre-rev-modal.open { display: flex; }
.gre-rev-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: min(640px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 22px 24px;
}
.gre-rev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.gre-rev-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.gre-rev-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.gre-rev-close:hover { background: var(--bg); color: var(--text); }
.gre-rev-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.gre-rev-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gre-rev-key {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.gre-rev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
}
.gre-rev-box {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}
.gre-rev-box:hover { transform: scale(1.08); }
.gre-rev-box.current { outline: 2px solid var(--accent); outline-offset: 1px; }

/* status colors (used by both legend keys and grid boxes) */
.gre-rev-box.unseen,   .gre-rev-key.unseen   { background: #D1D5DB; }
.gre-rev-box.answered, .gre-rev-key.answered { background: #22C55E; color: #fff; }
.gre-rev-box.seen-un,  .gre-rev-key.seen-un  { background: #EF4444; color: #fff; }
/* marked + answered = half yellow / half green */
.gre-rev-box.mark-ans, .gre-rev-key.mark-ans {
  background: linear-gradient(135deg, #FBBF24 0 50%, #22C55E 50% 100%);
  color: #fff;
}
/* marked + unanswered = half yellow / half red */
.gre-rev-box.mark-un,  .gre-rev-key.mark-un {
  background: linear-gradient(135deg, #FBBF24 0 50%, #EF4444 50% 100%);
  color: #fff;
}

/* ── Quant calculator ────────────────────────────────────────────────── */
.gre-calc {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 248px;
  background: #1f2937;
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.4);
  z-index: 70;
  display: none;
  padding: 10px;
  user-select: none;
}
.gre-calc.open { display: block; }
.gre-calc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #e5e7eb;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 4px 8px;
}
.gre-calc-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
}
.gre-calc-display {
  background: #f8fafc;
  color: #111827;
  border-radius: 6px;
  text-align: right;
  font-size: 1.35rem;
  font-weight: 600;
  padding: 10px 12px;
  margin-bottom: 8px;
  min-height: 24px;
  overflow-x: auto;
  white-space: nowrap;
}
.gre-calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.gre-calc-key {
  padding: 11px 0;
  border: none;
  border-radius: 6px;
  background: #374151;
  color: #f9fafb;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.gre-calc-key:hover { background: #4b5563; }
.gre-calc-key.op { background: #475569; color: #fde68a; }
.gre-calc-key.mem { background: #4b5563; color: #cbd5e1; font-size: 0.82rem; }
.gre-calc-key.eq { background: var(--accent); color: #fff; }
.gre-calc-key.eq:hover { background: var(--accent-light); }
.gre-calc-transfer {
  width: 100%;
  margin-top: 8px;
  padding: 9px 0;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.gre-calc-transfer:hover { background: #1d4ed8; }

/* ── GRE responsive ──────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .gre-split { grid-template-columns: 1fr; gap: 18px; }
  .gre-left { position: static; max-height: none; }
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .home-hero h1 { font-size: 1.8rem; }
  .subject-hero h2 { font-size: 1.4rem; }
  #subject-grid { grid-template-columns: 1fr 1fr; }
  .results-card { padding: 28px 20px; }
  .gre-qc-quants { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GRE EXTRAS — Vocabulary flashcards & Mock exam (gre_extra.js)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Vocabulary flashcards ───────────────────────────────────────────────── */
.gre-voc-wrap { max-width: 760px; margin: 0 auto; }
.gre-voc-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px;
}
.gre-voc-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.gre-voc-chip:hover { border-color: var(--accent); color: var(--text); }
.gre-voc-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.gre-voc-card {
  position: relative; min-height: 240px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
  cursor: pointer; padding: 36px 28px; display: flex; align-items: center;
  justify-content: center; text-align: center; transition: var(--transition);
}
.gre-voc-card:hover { box-shadow: var(--shadow); border-color: var(--accent-light); }
.gre-voc-front, .gre-voc-back { width: 100%; }
.gre-voc-read { position: absolute; top: 12px; right: 12px; z-index: 2; }
.gre-voc-read .gre-readaloud { margin: 0; }
.gre-voc-card .gre-voc-back { display: none; }
.gre-voc-card.flipped .gre-voc-front { display: none; }
.gre-voc-card.flipped .gre-voc-back { display: block; text-align: left; }
.gre-voc-word { font-size: 2.2rem; font-weight: 700; color: var(--text); letter-spacing: 0.5px; }
.gre-voc-pos {
  display: inline-block; margin-top: 8px; font-size: 0.8rem; font-style: italic;
  font-weight: 600; color: var(--text-muted);
}
.gre-voc-backword {
  font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-light);
}
.gre-voc-backword .gre-voc-pos { margin: 0 0 0 6px; font-size: 0.85rem; }
.gre-voc-hint { margin-top: 14px; font-size: 0.82rem; color: var(--text-muted); }
.gre-voc-mean { font-size: 1.05rem; line-height: 1.6; color: var(--text); margin-bottom: 12px; }
.gre-voc-syn { font-size: 0.98rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 12px; }
.gre-voc-ex {
  font-size: 0.98rem; line-height: 1.6; color: var(--text);
  padding: 10px 14px; background: var(--accent-pale); border-radius: var(--radius);
  border-left: 3px solid var(--accent-light);
}
.gre-voc-ex em { font-style: italic; }
.gre-voc-ex strong { color: var(--accent); font-style: normal; }
.gre-voc-mean strong, .gre-voc-syn strong, .gre-voc-ex strong { color: var(--accent); }
.gre-voc-badge {
  display: inline-block; margin-top: 16px; padding: 3px 12px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.gre-voc-badge.know   { background: var(--success-pale); color: var(--success); }
.gre-voc-badge.review { background: var(--warn-pale);    color: var(--warn); }
.gre-voc-badge.dont   { background: var(--error-pale);   color: var(--error); }
.gre-voc-actions { display: flex; gap: 10px; margin: 18px 0 6px; flex-wrap: wrap; }
.gre-voc-act {
  flex: 1; min-width: 130px; padding: 12px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: var(--transition);
}
.gre-voc-act.know:hover   { background: var(--success-pale); border-color: var(--success); color: var(--success); }
.gre-voc-act.review:hover { background: var(--warn-pale);    border-color: var(--warn);    color: var(--warn); }
.gre-voc-act.dont:hover   { background: var(--error-pale);   border-color: var(--error);   color: var(--error); }
.gre-voc-empty {
  text-align: center; color: var(--text-muted); padding: 60px 20px;
  border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface);
}

/* ─── Mock exam: shared ───────────────────────────────────────────────────── */
.gre-exam, .gre-exam-results { max-width: 820px; margin: 0 auto; }
.gre-btn-primary {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 10px 22px; border-radius: var(--radius); font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.gre-btn-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.gre-exam-controls { display: flex; gap: 12px; align-items: center; margin: 24px 0; flex-wrap: wrap; }
.gre-exam-structure { margin: 20px 0; width: 100%; }

/* ─── Section intro ───────────────────────────────────────────────────────── */
.gre-exam-step {
  display: inline-block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--accent); margin-bottom: 6px;
}
.gre-exam-intro-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  padding: 24px; box-shadow: var(--shadow-sm); margin-top: 8px;
}
.gre-exam-intro-meta {
  display: flex; gap: 22px; flex-wrap: wrap; font-weight: 700; color: var(--text);
  margin-bottom: 14px;
}
.gre-exam-directions { line-height: 1.65; color: var(--text); margin: 0 0 14px; }
.gre-exam-note {
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; margin: 0;
  padding-top: 12px; border-top: 1px solid var(--border-light);
}

/* ─── Running section ─────────────────────────────────────────────────────── */
.gre-exam-run { max-width: 900px; margin: 0 auto; }
.gre-exam-bar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.gre-exam-bar-left, .gre-exam-bar-right { display: flex; align-items: center; gap: 12px; }
.gre-exam-secname { font-weight: 700; color: var(--text); }
.gre-exam-timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; color: var(--text);
  padding: 4px 12px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border);
}
.gre-exam-timer.low { color: var(--error); border-color: var(--error); background: var(--error-pale); }

.gre-exam-legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px;
  font-size: 0.8rem; color: var(--text-muted);
}
.gre-exam-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gre-exam-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.gre-exam-pbox {
  width: 34px; height: 34px; border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1f2937; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: transform var(--transition); position: relative;
}
.gre-exam-pbox:hover { transform: scale(1.08); }
/* identical combination to the practice-question review grid */
.gre-exam-pbox.unseen   { background: #D1D5DB; }
.gre-exam-pbox.answered { background: #22C55E; color: #fff; }
.gre-exam-pbox.seen-un  { background: #EF4444; color: #fff; }
.gre-exam-pbox.mark-ans { background: linear-gradient(135deg, #FBBF24 0 50%, #22C55E 50% 100%); color: #fff; }
.gre-exam-pbox.mark-un  { background: linear-gradient(135deg, #FBBF24 0 50%, #EF4444 50% 100%); color: #fff; }
.gre-exam-pbox.current  { outline: 2px solid var(--accent); outline-offset: 1px; }
.gre-exam-qhost { margin-bottom: 18px; }

/* ─── AW textarea inside exam ─────────────────────────────────────────────── */
.gre-exam-aw { margin-top: 4px; }
.gre-exam-aw .gre-essay-box { min-height: 340px; }

/* ─── Results ─────────────────────────────────────────────────────────────── */
.gre-score-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 24px 0;
}
.gre-score-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  padding: 22px 16px; text-align: center; box-shadow: var(--shadow-sm);
}
.gre-score-card.total { background: var(--accent-pale); border-color: var(--accent); }
.gre-score-num { font-size: 2.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.gre-score-card.total .gre-score-num { color: var(--accent); }
.gre-score-lbl { margin-top: 8px; font-size: 0.84rem; font-weight: 600; color: var(--text-muted); }
.gre-score-sub { margin-top: 4px; font-size: 0.8rem; color: var(--text-muted); }
.gre-score-aw {
  background: var(--info, #1A4E9A); background: rgba(26,78,154,0.08); color: var(--text);
  border: 1px solid rgba(26,78,154,0.25); border-radius: var(--radius); padding: 12px 16px;
  font-size: 0.92rem; margin-bottom: 14px;
}
.gre-score-note { font-size: 0.85rem; color: var(--text-muted); }

/* ─── Answer review ───────────────────────────────────────────────────────── */
.gre-review-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 28px; }
.gre-review-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius);
  background: var(--surface);
}
.gre-review-row.ok  { border-left-color: var(--success); }
.gre-review-row.bad { border-left-color: var(--error); }
.gre-review-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--bg);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
}
.gre-review-body { flex: 1; min-width: 0; }
.gre-review-stem { color: var(--text); line-height: 1.5; margin-bottom: 6px; }
.gre-review-ans { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.88rem; }
.gre-review-yours { color: var(--text-muted); }
.gre-review-correct { color: var(--success); }
.gre-review-row.ok .gre-review-yours strong { color: var(--success); }
.gre-review-row.bad .gre-review-yours strong { color: var(--error); }
.gre-review-mark { flex: none; font-size: 1.2rem; font-weight: 800; }
.gre-review-row.ok  .gre-review-mark { color: var(--success); }
.gre-review-row.bad .gre-review-mark { color: var(--error); }

.gre-right { flex: 1; min-width: 0; }

@media (max-width: 640px) {
  .gre-score-cards { grid-template-columns: 1fr; }
  .gre-exam-bar { position: static; }
  .gre-voc-act { min-width: 100%; }
}
