@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: 5px;
  margin-left: 12px;
  cursor: pointer;
}

.logo-icon {
  width: 42px; height: 42px;
  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; }

/* Wordmark — "Prepare" reads as body text (black on light, cream on dark);
   "It" and "Up" take the two oranges from the P and U in the logo mark. */
.brand-prepare { color: #1A1A1A !important; font-weight: 600; }
.brand-it      { color: #F05A12 !important; font-weight: 700; }  /* P — orange */
.brand-up      { color: #F5A63A !important; font-weight: 700; }  /* U — yellow amber */
html[data-theme="dark"] .brand-prepare { color: #F5EFE6 !important; }
html[data-theme="dark"] .brand-it      { color: #F05A12 !important; }
html[data-theme="dark"] .brand-up      { color: #F5A63A !important; }

.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 img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.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: 460px;
  margin: 0 auto;
  padding: 38px 20px 54px;
}
#auth-screen.active { display: block; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(42,29,21,.09);
}

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

.auth-logo-img {
  width: 46px; height: 46px;
  object-fit: contain;
}

.auth-logo-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.18rem;
  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.58rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
}

.auth-sub {
  max-width: 345px;
  margin: 0 auto 21px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Social sign-in — one row of provider buttons above the email form. Each mark
   is the provider's own, unmodified, on a plain surface, which is what all
   three brand guidelines require. GitHub's is monochrome and inherits the text
   colour so it stays legible in dark mode; the other two are fixed colour. */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 4px;
}
.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition);
}
.auth-social-btn:hover:not(:disabled) {
  background: var(--accent-pale);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(198,83,29,.10);
}
.auth-social-btn:disabled { opacity: .55; cursor: default; }
.auth-social-icon { width: 17px; height: 17px; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 18px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.auth-tab {
  flex: 1;
  min-height: 39px;
  padding: 8px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  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;
  box-shadow: 0 4px 12px rgba(198,83,29,.2);
}
.auth-tab:hover:not(.active) {
  background: var(--accent-pale);
}

.auth-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 14px 0 0;
}
.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-step-login .auth-switch-text:first-of-type {
  margin-top: 9px;
  text-align: right;
}
#auth-step-login .auth-switch-text:first-of-type .auth-link-btn {
  font-size: .78rem;
}

.auth-label {
  display: block;
  font-size: 0.69rem;
  font-weight: 750;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.65px;
  margin-bottom: 7px;
}

.auth-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.93rem;
  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: 15px; }

.auth-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 11px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.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;
}

@media (max-width: 520px) {
  #auth-screen { padding: 18px 12px 40px; }
  .auth-card { padding: 26px 20px; border-radius: 18px; }
  .auth-title { font-size: 1.42rem; }
}

.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: 64px;
  height: 64px;
  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-screen { max-width: 980px; }
.home-hero {
  max-width: 720px;
  padding: 34px 0 24px;
}

.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: clamp(2rem, 4vw, 2.55rem);
  font-weight: 700;
  line-height: 1.16;
  color: var(--text);
  margin-bottom: 10px;
  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: 650px; }

.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 tracks: a deliberately simple and equal 2×2 layout. */
.home-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 142px;
  gap: 14px;
  margin: 22px 0 28px;
}
.home-grid .cat-icon-img,
.home-grid .cat-icon {
  width: 62px; height: 62px; flex: 0 0 62px;
}
.home-grid .cat-info { align-items: flex-start; gap: 6px; text-align: left; }
.home-grid .cat-name { font-size: 1.12rem; font-weight: 700; }
.home-grid .cat-count {
  color: var(--cat-color); font-size: .76rem; font-weight: 600; line-height: 1.45;
}
@media (max-width: 620px) {
  .home-grid { grid-template-columns: 1fr; grid-auto-rows: 132px; }
}

/* 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);
}

.ap-physics-category-card {
  min-height:112px;
  padding:18px 22px;
  flex-direction:row;
  justify-content:flex-start;
  gap:18px;
  text-align:left;
}
.ap-physics-category-card .cat-icon-img {
  width:68px;
  height:68px;
  flex:0 0 68px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  object-fit:contain;
}
.ap-physics-category-card .cat-info {
  align-items:flex-start;
  text-align:left;
}

.cat-icon {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid color-mix(in srgb,var(--cat-color) 35%,var(--border));
  border-radius: 14px; background: color-mix(in srgb,var(--cat-color) 10%,var(--surface));
  color: var(--cat-color); font-size: .72rem; font-weight: 800; line-height: 1;
  letter-spacing: .04em;
}
.set-icon--flag {
  overflow: hidden;
  padding: 5px;
  background: var(--surface2);
}
.set-icon--flag img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.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;
}



/* Under-construction exam cards */

.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-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;
}
.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); }

/* ─── Global search ─────────────────────────────────────────────────── */
.pw-search-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 200px;
  padding: 7px 10px 7px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-family: inherit; font-size: 0.85rem; cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.pw-search-btn:hover { border-color: var(--accent); color: var(--accent); }
.pw-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font: 600 0.8rem/1 'DM Sans', sans-serif;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.pw-share-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pw-share-btn:hover {
  border-color: var(--accent);
  background: var(--accent-pale);
  color: var(--accent);
}
/* Push the shortcut hint to the far right so it reads like a search field */
.pw-search-kbd {
  margin-left: auto;
  font-size: 0.7rem; font-family: inherit; font-weight: 600;
  padding: 1px 5px; border-radius: 4px;
  background: var(--surface2); border: 1px solid var(--border-light);
  color: var(--text-muted);
}
@media (max-width: 900px) {
  .pw-search-btn { min-width: 150px; }
}
@media (max-width: 720px) {
  .pw-search-btn-text, .pw-search-kbd { display: none; }
  .pw-search-btn { min-width: 0; padding: 6px 9px; }
  .pw-share-btn span { display: none; }
  .pw-share-btn { padding: 7px 9px; }
}

.pw-search-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  backdrop-filter: blur(2px);
}
.pw-search-modal {
  width: 100%; max-width: 620px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  display: flex; flex-direction: column; max-height: 70vh;
}
.pw-search-inputbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-light);
}
.pw-search-inputicon { font-size: 1rem; opacity: 0.7; }
.pw-search-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: inherit; font-size: 1rem; color: var(--text);
}
.pw-search-input::placeholder { color: var(--text-muted); }
.pw-search-esc {
  font-size: 0.7rem; font-family: inherit; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface2); border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.pw-search-results { overflow-y: auto; padding: 6px; flex: 1; }
.pw-search-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 9px;
  background: none; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text);
}
.pw-search-item.sel { background: var(--accent-pale); }
.pw-search-item-icon {
  width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface2);
  color: var(--accent); font-size: .58rem; font-weight: 800; text-align: center;
}
.pw-search-item-icon img {
  display: block; width: 26px; height: 26px; object-fit: contain;
}
.pw-search-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pw-search-item-title {
  font-size: 0.92rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-search-item-sub {
  font-size: 0.76rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-search-item-kind {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: var(--surface2);
  border-radius: 10px; padding: 2px 8px;
}
.pw-search-item.sel .pw-search-item-kind { background: rgba(212,98,26,0.14); color: var(--accent); }
.pw-search-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ── Drill-down: › on a row, ‹ + path above the list ─────────────────────── */
.pw-search-item-drill {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  font-size: 1.15rem; line-height: 1;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border-light);
  transition: background var(--transition), color var(--transition);
}
.pw-search-item-drill:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.pw-search-item.sel .pw-search-item-drill { color: var(--accent); border-color: var(--accent); }
.pw-search-item.sel .pw-search-item-drill:hover { color: #fff; }

/* Group heading: "In SQL" / "Outside this section" */
.pw-search-group {
  padding: 12px 12px 5px;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.pw-search-group:first-child { padding-top: 4px; }

.pw-search-scope {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
  min-width: 0;
}
.pw-search-back {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; cursor: pointer;
  font-size: 1.15rem; line-height: 1;
  font-family: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border);
}
.pw-search-back:hover { border-color: var(--accent); color: var(--accent); }
.pw-search-crumbs {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; overflow: hidden; white-space: nowrap;
  font-size: 0.78rem;
}
.pw-search-crumb {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted);
}
.pw-search-crumb:hover { color: var(--accent); }
.pw-search-crumbs .pw-search-crumb:last-child { color: var(--text); cursor: default; }
.pw-search-crumb-sep { color: var(--text-muted); opacity: 0.6; }
.pw-search-foot {
  display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 9px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
  font-size: 0.72rem; color: var(--text-muted);
}
/* Narrow screens are touch-driven — drop the keyboard-only hints rather than
   letting the row overflow the modal. ‹ and › stay tappable either way. */
@media (max-width: 560px) {
  .pw-search-foot .pw-search-hint-kb { display: none; }
}
.pw-search-foot kbd {
  font-family: inherit; font-weight: 600; padding: 1px 5px;
  border-radius: 4px; background: var(--surface);
  border: 1px solid var(--border-light); margin-right: 3px;
}

/* ─── Home "Continue where you left off" hero card ──────────────────── */
.pw-resume-card {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  width: 100%; margin: 0 0 22px;
  padding: 18px 22px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #E67E22);
  color: #fff; cursor: pointer; text-align: left;
  box-shadow: 0 6px 20px rgba(212,98,26,0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pw-resume-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(212,98,26,0.36); }
.pw-resume-card:focus-visible { outline: 3px solid var(--accent-pale); outline-offset: 2px; }
.pw-resume-icon {
  width: 46px; height: 46px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.45); border-radius: 13px;
  background: rgba(255,255,255,.16); color: #fff;
  font-size: .68rem; font-weight: 850; letter-spacing: .04em;
}
.pw-resume-icon img {
  display: block; width: 42px; height: 42px; object-fit: contain;
  border-radius: 11px; padding: 4px;
}
.pw-resume-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pw-resume-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; opacity: 0.88;
}
.pw-resume-title {
  font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-resume-sub { font-size: 0.82rem; opacity: 0.9; }
.pw-resume-badge {
  align-self: flex-start; margin-top: 6px;
  font-size: 0.72rem; font-weight: 700;
  background: rgba(255,255,255,0.22); border-radius: 20px; padding: 3px 10px;
}
.pw-resume-go { flex-shrink: 0; font-weight: 700; font-size: 0.95rem; opacity: 0.95; }
.pw-resume-dismiss {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.75); font-size: 1.3rem; line-height: 1;
  padding: 2px 6px; border-radius: 6px; font-family: inherit;
}
.pw-resume-dismiss:hover { background: rgba(255,255,255,0.18); color: #fff; }
@media (max-width: 560px) {
  .pw-resume-go { display: none; }
  .pw-resume-title { font-size: 1.05rem; }
}

/* ─── Settings: per-sound rows ──────────────────────────────────────── */
.settings-sound-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.settings-sound-row:last-child { border-bottom: none; }
.settings-sound-row .settings-switch { flex: 1; margin: 0; }
.settings-sound-row .settings-test-btn { flex-shrink: 0; margin: 0; padding: 6px 14px; font-size: 0.82rem; }
.settings-sound-desc {
  display: block; font-size: 0.76rem; color: var(--text-muted);
  font-weight: 400; margin-top: 2px;
}

/* ─── Sound toggle button (header) ──────────────────────────────────── */
.pw-sound-btn {
  background: none; border: 1px solid transparent; cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 6px 8px;
  border-radius: 8px; font-family: inherit;
  position: relative;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
}
.pw-sound-btn:hover { background: var(--surface2); border-color: var(--border-light); }
.pw-sound-btn.off { opacity: 0.55; }
.pw-sound-btn.off::after {
  content: '';
  position: absolute;
  width: 19px;
  height: 2px;
  left: 50%;
  top: 50%;
  border-radius: 2px;
  background: var(--error);
  transform: translate(-50%, -50%) rotate(-48deg);
  pointer-events: none;
}

/* ─── Daily streak chip ─────────────────────────────────────────────── */
.pw-streak-chip {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 20px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 1px solid #F59E0B;
  color: #B45309; font-weight: 700; font-size: 0.85rem;
  white-space: nowrap; cursor: default; user-select: none;
  font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .pw-streak-chip {
  background: rgba(245,158,11,0.15);
  color: #FCD34D;
}
.pw-streak-chip.bump { animation: pw-streak-bump 0.5s ease; }
@keyframes pw-streak-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ─── Confetti burst (great quiz results) ───────────────────────────── */
.pw-confetti {
  position: fixed; inset: 0; pointer-events: none;
  z-index: 2000; overflow: hidden;
}
.pw-confetti i {
  position: absolute; top: -14px; display: block;
  border-radius: 2px; opacity: 0.95;
  animation: pw-confetti-fall linear forwards;
}
@keyframes pw-confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.85; }
}

/* ─── Course progress (sidebar + overview) ──────────────────────────── */
.course-progress-box {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-light);
}
.course-progress-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  margin-bottom: 6px;
}
.course-progress-pct {
  color: var(--accent); font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.course-progress-bar {
  height: 6px; border-radius: 4px; overflow: hidden;
  background: var(--surface2);
}
.course-progress-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), #F59E0B);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Module progress strip on the overview page */
.course-module-progress-strip {
  margin: 14px 0 4px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 10px;
}
.course-module-progress-strip .course-progress-row { font-size: 0.85rem; color: var(--text); }

/* ─── Weighted progress: bucket breakdown + per-page strips ──────────────
   Shared by every Coding course (Python, SQL, NumPy, Pandas, ML) — these are
   class-based only, with no per-course id selectors, so all five look
   identical and a new course inherits the styling for free.               */
.course-progress-breakdown {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.course-progress-sub {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
  font-size: 0.72rem; color: var(--text-muted);
}
.course-progress-sub-label { display: inline-flex; align-items: baseline; gap: 5px; }
.course-progress-weight {
  font-style: normal; font-size: 0.64rem; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  background: var(--surface2); color: var(--text-muted);
}
.course-progress-sub-val {
  font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* The "MCQs — 8 of 12 answered · 67%" strip at the top of an MCQ/coding page */
.course-bucket-strip {
  margin: 14px 0 4px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}
.course-bucket-strip .course-progress-row {
  font-size: 0.88rem; color: var(--text); margin-bottom: 7px;
}
.course-bucket-strip.complete { border-left-color: var(--success); }
.course-bucket-strip.complete .course-progress-pct { color: var(--success); }
.course-bucket-strip.complete .course-progress-bar span {
  background: linear-gradient(90deg, var(--success), #4ADE80);
}
.course-bucket-note {
  margin-top: 7px;
  font-size: 0.7rem; color: var(--text-muted);
}
.course-bucket-note strong { color: var(--accent); font-weight: 800; }
.course-bucket-strip.complete .course-bucket-note strong { color: var(--success); }

/* ML's sidebar now uses the shared .course-sidebar-chapter row — no overrides. */

/* Sidebar module chip: "3/9" or ✓ */
.course-sidebar-mod-prog {
  flex-shrink: 0; margin-left: 6px; margin-top: 1px;
  font-size: 0.68rem; font-weight: 700;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 10px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.course-sidebar-mod-prog.complete {
  background: #DCFCE7; color: #15803D;
}
html[data-theme="dark"] .course-sidebar-mod-prog.complete {
  background: rgba(22,163,74,0.2); color: #4ADE80;
}

/* Sidebar chapter check */
.course-sidebar-ch-check {
  flex-shrink: 0; margin-left: auto;
  font-size: 0.72rem; font-weight: 800; color: #16A34A;
  opacity: 0; transition: opacity 0.2s;
}
.course-sidebar-chapter.done .course-sidebar-ch-check { opacity: 1; }
.course-sidebar-chapter.done .course-sidebar-ch-title { color: var(--text); }

/* Overview chapter-card check */
.course-chapter-card { position: relative; }
.course-chapter-card-check {
  margin-left: auto; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: #DCFCE7; color: #15803D;
  font-size: 0.7rem; font-weight: 800;
}
.course-chapter-card.done .course-chapter-card-check { display: inline-flex; }
.course-chapter-card.done {
  border-color: #86EFAC;
  background: linear-gradient(135deg, var(--surface), rgba(220,252,231,0.35));
}
html[data-theme="dark"] .course-chapter-card.done {
  border-color: rgba(74,222,128,0.4);
  background: linear-gradient(135deg, var(--surface), rgba(22,163,74,0.08));
}
html[data-theme="dark"] .course-chapter-card-check {
  background: rgba(22,163,74,0.2); color: #4ADE80;
}

/* ─── Position-within-module strip (page header) ───────────────────── */
.pw-mod-pos {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 4px; max-width: 360px;
}
.pw-mod-pos-bar {
  flex: 1; height: 5px; border-radius: 3px; overflow: hidden;
  background: var(--surface2);
}
.pw-mod-pos-bar span {
  display: block; height: 100%;
  background: var(--accent); border-radius: 3px;
  transition: width 0.4s ease;
}
.pw-mod-pos-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ─── Rich "Up next" page navigation cards ─────────────────────────── */
.pw-page-nav {
  display: grid; grid-template-columns: 1fr 1.4fr;
  gap: 12px; margin-top: 32px;
}
.pw-page-nav-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 14px 18px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer; font-family: inherit; text-align: left;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.pw-page-nav-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.pw-page-nav-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}
.pw-page-nav-title {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  line-height: 1.3;
}
.pw-page-nav-meta { font-size: 0.75rem; color: var(--text-muted); }
.pw-page-next {
  background: linear-gradient(135deg, var(--accent), #E67E22);
  border-color: transparent;
  align-items: flex-end; text-align: right;
}
.pw-page-next .pw-page-nav-label { color: rgba(255,255,255,0.85); }
.pw-page-next .pw-page-nav-title { color: #fff; }
.pw-page-next .pw-page-nav-meta { color: rgba(255,255,255,0.8); }
.pw-page-next:hover { border-color: transparent; box-shadow: 0 8px 22px rgba(212,98,26,0.35); }
@media (max-width: 560px) {
  .pw-page-nav { grid-template-columns: 1fr; }
  .pw-page-nav-card { align-items: flex-start; text-align: left; }
}

/* ─── Star button (quiz card + course cards) ───────────────────────── */
.q-star-btn {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  font-size: 1.6rem; line-height: 1; padding: 2px 6px;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
}
.q-star-btn:hover { color: #F59E0B; background: rgba(245,158,11,0.08); transform: scale(1.1); }
.q-star-btn.starred { color: #F59E0B; }

/* Star button used inline in course cards (SQL/PD/NP/PY/ML/AP) */
.pw-course-star-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; line-height: 1; padding: 2px 6px;
  color: var(--text-muted); border-radius: 6px;
  transition: color 0.15s, transform 0.1s;
  font-family: inherit;
  margin-left: auto;
}
.pw-course-star-btn:hover { color: #F59E0B; transform: scale(1.15); }
.pw-course-star-btn.starred { color: #F59E0B; }

/* Course-topbar "⭐ Starred" button */
.pw-course-starred-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
  color: var(--text); font-family: inherit; font-size: 0.85rem; font-weight: 500;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
}
.pw-course-starred-btn:hover { border-color: #F59E0B; color: #F59E0B; }


/* Quiz countdown timer */
.quiz-timer {
  font-weight: 700; font-size: 0.9rem; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border-light);
  border-radius: 20px; padding: 5px 14px; font-variant-numeric: tabular-nums;
}
.quiz-timer.urgent { color: var(--error); border-color: var(--error); background: var(--error-pale); }

/* 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; }

/* ─── 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;
}

/* Keep ordinary screen-level return controls in one predictable place and
   reachable while a long category page is being scrolled. Course workspaces
   use their own full-width navigation bar instead. */
.screen:not(.course-screen):not(.ap1-screen) > .back-btn {
  position: sticky;
  top: 76px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  margin: 0 0 16px;
  margin-top: -15px !important;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 4px 14px rgba(31, 24, 20, 0.06);
  backdrop-filter: blur(10px);
}

/* ─── Reserved routes and 404 pages ─────────────────────────────────── */
.route-status-screen {
  min-height: calc(100dvh - 64px);
  max-width: none !important;
  padding: clamp(34px, 8vh, 86px) 20px 72px !important;
  place-items: start center;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 42%),
    var(--bg);
}
.route-status-screen.active { display: grid; }
.route-status-card {
  width: min(100%, 620px);
  padding: clamp(30px, 6vw, 54px);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.route-status-code {
  color: var(--accent);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .16em;
}
.route-status-mark {
  margin: 20px auto 18px;
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
  font: 800 clamp(2.7rem, 9vw, 5.5rem)/1 'Playfair Display', Georgia, serif;
}
.route-status-card h1 {
  margin: 0;
  color: var(--text);
  font: 750 clamp(1.7rem, 4vw, 2.65rem)/1.13 'Playfair Display', Georgia, serif;
}
.route-status-card p {
  max-width: 450px;
  margin: 14px auto 18px;
  color: var(--text-muted);
  line-height: 1.65;
}
.route-status-card code {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 24px;
  padding: 7px 11px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route-status-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.route-status-actions button { min-height: 42px; }

.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 and SAT content is shown in a centered 920px column (unlike the
   sidebar-based courses), so align the topbar back button to that same column.
   This makes the 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. */
.exam-course-screen .course-topbar,
#quiz-screen .quiz-coursebar {
  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));
}
.exam-course-screen .course-topbar .back-btn,
#quiz-screen .quiz-coursebar .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. */
.exam-course-screen .course-sidebar-toggle,
#quiz-screen #quiz-sections-btn {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  display: inline-block;
}

.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;
}
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,
.course-hint-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); }

.course-hint-btn {
  background: var(--accent-pale);
  color: var(--accent);
}
.course-hint-btn:hover { background: rgba(212,98,26,0.15); }

.sql-hint-box {
  display: none;
  margin-top: 10px;
  padding: 12px 16px;
  background: #FFF8E1;
  border: 1px solid #FFB74D;
  border-left: 4px solid #F57C00;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #4E342E;
  line-height: 1.5;
}
.sql-hint-box.show { display: block; }
.sql-hint-box code {
  background: rgba(245,124,0,0.10);
  border: 1px solid #FFB74D;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
  color: #E65100;
}

/* 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); }

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

/* Type sections */
.course-assessment-type-section {
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.course-assessment-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;
}
.course-assessment-type-header:hover { background: var(--accent-pale); }
.course-assessment-type-header .course-assessment-type-icon { font-size: 1.1rem; }
.course-assessment-type-header .course-assessment-type-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}
.course-assessment-type-header .course-assessment-type-arrow {
  transition: transform 0.2s;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.course-assessment-type-section.collapsed .course-assessment-type-arrow { transform: rotate(-90deg); }
.course-assessment-type-section.collapsed .course-assessment-type-body { display: none; }

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

/* Question cards */
.course-assessment-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;
}
.course-assessment-question-card:last-child { margin-bottom: 0; }
.course-assessment-question-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

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

/* MCQ choices */
.course-assessment-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.course-assessment-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;
}
.course-assessment-choice:hover { border-color: var(--accent); background: var(--accent-pale); }
.course-assessment-choice .course-assessment-choice-letter {
  font-weight: 700;
  color: var(--accent);
  min-width: 18px;
}
.course-assessment-choice.correct {
  background: #d1fae5;
  border-color: #059669;
  color: #14110D;
  pointer-events: none;
}
.course-assessment-choice.incorrect {
  background: #fee2e2;
  border-color: #dc2626;
  color: #14110D;
  pointer-events: none;
}
.course-assessment-choice.correct .course-assessment-choice-text,
.course-assessment-choice.incorrect .course-assessment-choice-text,
.course-assessment-choice.correct .course-assessment-choice-letter,
.course-assessment-choice.incorrect .course-assessment-choice-letter { color: #14110D; }
.course-assessment-choice.disabled { pointer-events: none; opacity: 0.6; }
html[data-theme="dark"] .course-assessment-choice.correct {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
  color: #6ee7b7;
  opacity: 1;
}
html[data-theme="dark"] .course-assessment-choice.incorrect {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #fca5a5;
  opacity: 0.85;
}
html[data-theme="dark"] .course-assessment-choice.correct .course-assessment-choice-text,
html[data-theme="dark"] .course-assessment-choice.correct .course-assessment-choice-letter { color: #6ee7b7; }
html[data-theme="dark"] .course-assessment-choice.incorrect .course-assessment-choice-text,
html[data-theme="dark"] .course-assessment-choice.incorrect .course-assessment-choice-letter { color: #fca5a5; }
html[data-theme="dark"] .course-assessment-choice.disabled { opacity: 0.5; }

/* Free response textarea */
.course-assessment-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);
}
.course-assessment-free-response:focus { border-color: var(--accent); outline: none; }
.course-assessment-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;
}
.course-assessment-check-btn:hover { opacity: 0.9; }

/* Hint & solution toggles */
.course-assessment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.course-assessment-hint-btn, .course-assessment-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;
}
.course-assessment-hint-btn:hover, .course-assessment-answer-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.course-assessment-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;
}
.course-assessment-hint-box.visible { display: block; }
html[data-theme="dark"] .course-assessment-hint-box {
  background: var(--warn-pale);
  color: var(--warn);
}

.course-assessment-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;
}
.course-assessment-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"] .course-assessment-solution-box { background: var(--success-pale); }
.course-assessment-solution-box .course-assessment-answer-label {
  font-weight: 600;
  color: #059669;
  margin-bottom: 4px;
}
.course-assessment-solution-box .course-assessment-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-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;
}

/* ─── 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); }

.pw-sticky-data-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: background var(--transition), transform 0.2s, opacity 0.25s;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}
.pw-sticky-data-fab.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.pw-sticky-data-fab:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.22);
}
.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; }

.pw-category-icon-svg {
  width: 27px;
  height: 27px;
  display: block;
  overflow: visible;
}
.set-icon .pw-category-icon-svg {
  width: 31px;
  height: 31px;
  margin: auto;
}

/* ── 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; color: #9f2f25; }
html[data-theme="dark"] .pw-modal-icon.danger {
  background: #4b201d;
  color: #ffaaa2;
  border: 1px solid #71312c;
}
.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); }

/* ── GRE-style top area ──────────────────────────────────────────────────
   Off by default: .quiz-coursebar is hidden and .quiz-body is a plain flow
   wrapper, so standalone quizzes keep their existing header. */
.quiz-coursebar { display: none; }
/* Deck actions live in the nav row (GRE) rather than beside the crumbs. */
.quiz-navbtn { display: none; }
.quiz-navbtn.marked { color: var(--accent); border-color: var(--accent); }

/* Deck title above the panel, mirroring GRE's .gre-doc-title. */
.quiz-title { display: none; }

/* Per-subject Continue / Practice Again box host + list modal */
.pbox-host { margin: 4px 0 22px; }
.pbox-host:empty { display: none; }
.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; }

/* ─── 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; }
}
