/* ============================================
   IIT JAM Mock Test — Minimalistic Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1080px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg-body: #0b0f19;
  --bg-surface: #141825;
  --bg-header: rgba(11, 15, 25, 0.85);
  --bg-card: #1a1f2e;
  --bg-card-hover: #222840;
  --border: #2a3044;
  --border-hover: #3d4663;
  --text-main: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #818cf8;
  --accent-dim: rgba(129, 140, 248, 0.12);
  --accent-glow: rgba(129, 140, 248, 0.25);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --purple: #a78bfa;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-main: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-dim: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.08);
  --red: #ef4444;
  --purple: #8b5cf6;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}


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

.hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}


/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 100vw;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-name .brand-short {
  display: none;
}

.brand-name .brand-full {
  display: inline;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-link-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}


/* --- Hero --- */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.hero .accent {
  color: var(--accent);
}

.hero-sub {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.hero-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.hero-pill {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.hero-pill strong {
  color: var(--text-main);
}

a.hero-pill {
  text-decoration: none;
  cursor: pointer;
}

a.hero-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}



/* --- Filter Tabs --- */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
}

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

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}


/* --- Topics Grid --- */
.main-content {
  padding-bottom: 64px;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
}

.topic-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow);
}

.topic-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topic-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
}

.best-score {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-dim);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.topic-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.topic-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.topic-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  font-weight: 600;
  color: var(--text-secondary);
}

.topic-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

.btn-test {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  padding: 9px 8px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: var(--transition);
  font-family: var(--font-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-test.primary {
  background: var(--accent);
  color: #fff;
}

.btn-test.primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-test.secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-test.secondary:hover {
  border-color: var(--accent);
  background: rgba(129, 140, 248, 0.2);
  transform: translateY(-1px);
}

.year-card .topic-actions .btn-mock-pdf {
  flex: 1 1 100%;
}

.btn-test.cheat {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.btn-test.cheat:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: var(--green);
  transform: translateY(-1px);
}

/* --- Hero Badges --- */
.hero-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hero-pill {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-pill strong {
  color: var(--accent);
}

/* --- Study Materials & Downloads Hub --- */
.section-header-block {
  text-align: center;
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  transition: var(--transition);
}

.resource-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.resource-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.resource-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.resource-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: -4px;
}

.resource-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.resource-badge {
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
}

/* --- Modal Styles --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.cheatsheet-category-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 16px 0 8px 0;
}

.cheatsheet-category-title:first-child {
  margin-top: 0;
}

.cheatsheet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cheatsheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.cheatsheet-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(3px);
}

.cheatsheet-item-icon {
  margin-right: 8px;
}

.cheatsheet-pages {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  background: var(--bg-body);
}

.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-footer strong {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 12px;
    height: 52px;
  }

  .nav-actions {
    gap: 6px;
  }

  .nav-link-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
    gap: 4px;
  }
}

@media (max-width: 640px) {
  .brand-name .brand-full {
    display: none;
  }

  .brand-name .brand-short {
    display: inline;
  }

  .nav-container {
    padding: 0 10px;
  }

  .nav-actions {
    gap: 5px;
  }

  .nav-link-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    gap: 3px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .hero-desc {
    font-size: 0.85rem;
  }

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

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

  .filter-tabs {
    gap: 6px;
  }

  .filter-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
  }

  .topic-actions {
    flex-wrap: wrap;
  }

  .btn-test.cheat {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .nav-btn-label {
    display: none;
  }
  .nav-link-btn {
    padding: 6px 10px;
    font-size: 0.95rem;
  }
}

@media (max-width: 420px) {
  .nav-container {
    padding: 0 8px;
    gap: 4px;
  }

  .brand-logo {
    gap: 6px;
  }

  .brand-icon {
    font-size: 1.15rem;
  }

  .brand-name {
    font-size: 0.85rem;
  }

  .nav-actions {
    gap: 4px;
  }

  .nav-link-btn {
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   PORTAL TAB NAVIGATION & 22-YEAR MOCK TEST CARDS
   ========================================================================== */

.main-tab-switcher {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 32px 0 24px 0;
  flex-wrap: wrap;
}

.main-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
}

.main-tab-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
  transform: translateY(-2px);
}

.main-tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.tab-content-panel.hidden {
  display: none !important;
}

/* Year Test Card Accents */
.year-badge {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.era-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-cbt {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.tag-classic {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.year-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.year-filter-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.year-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.year-filter-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Subtopic Filter Wrapper & Groups */
.topic-filters-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 65px;
}

.filter-group .filter-tabs {
  margin-bottom: 0;
}

.tag-recent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.tag-archive {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.card-zero-qs {
  opacity: 0.75;
}

.card-zero-qs:hover {
  opacity: 1;
}

.btn-test.disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================================
   Custom Mock Test & Offline PDF Generator Styles
   ======================================================== */

.custom-generator-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.custom-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.custom-generator-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.custom-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.custom-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.custom-step-pill {
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.custom-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  flex: 1;
}

/* Preset Buttons */
.custom-topic-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.preset-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Subject Groups & Topic Items */
.custom-subject-group {
  margin-bottom: 20px;
}

.custom-subject-group:last-child {
  margin-bottom: 0;
}

.custom-subject-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.subject-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.custom-topics-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.custom-topic-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.custom-topic-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.custom-topic-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.custom-topic-item[data-cat="oos"]:has(input:checked) {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.1);
}

.custom-topic-item[data-cat="oos"] input[type="checkbox"] {
  accent-color: #f59e0b;
}

.custom-topic-item[data-cat="oos"] .custom-topic-count {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.custom-topic-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.custom-topic-icon {
  font-size: 1.25rem;
  min-width: 26px;
  text-align: center;
}

.custom-topic-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.custom-topic-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-topic-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-topic-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--border);
  color: var(--text-secondary);
}

/* Config Grid */
.config-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.count-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

#custom-q-input {
  width: 70px;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

#custom-q-input:focus {
  border-color: var(--accent);
}

.count-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Custom Range Slider */
.slider-row {
  margin: 8px 0;
}

.custom-range-slider {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent);
}

.count-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chip-btn {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.chip-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.chip-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.custom-text-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
}

.custom-text-input:focus {
  border-color: var(--accent);
}

.config-row-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.radio-pill-group, .checkbox-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill, .checkbox-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.radio-pill:hover, .checkbox-pill:hover {
  background: var(--bg-card-hover);
}

.radio-pill:has(input:checked), .checkbox-pill:has(input:checked) {
  border-color: var(--accent);
  color: var(--text-main);
  font-weight: 600;
  background: var(--accent-dim);
}

.radio-pill input, .checkbox-pill input {
  accent-color: var(--accent);
}

.radio-pill.mini, .checkbox-pill.mini {
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
  gap: 5px;
}

.diff-source-selector-bar {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.preview-status-pill.solved {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.preview-status-pill.unsolved {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Live Summary Metrics */
.custom-summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-metric-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-metric-box .metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.summary-metric-box .metric-val {
  font-size: 1.15rem;
  font-weight: 800;
}

/* Action Buttons */
.custom-actions-row {
  display: grid;
  grid-template-columns: 1.5fr 1.3fr 1fr;
  gap: 14px;
}

@media (max-width: 860px) {
  .custom-actions-row {
    grid-template-columns: 1fr;
  }
}

.btn-custom-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition);
  text-align: left;
}

.btn-custom-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.btn-custom-action .action-icon {
  font-size: 1.6rem;
}

.btn-custom-action .action-text {
  display: flex;
  flex-direction: column;
}

.btn-custom-action .action-text strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.btn-custom-action .action-text small {
  font-size: 0.72rem;
  opacity: 0.85;
}

.btn-generate-pdf {
  background: linear-gradient(135deg, #1d4ed8, #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
}

.btn-generate-pdf:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.45);
}

.btn-start-cbt {
  background: linear-gradient(135deg, #059669, #0f766e);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-start-cbt:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4);
}

.btn-preview-qs {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-preview-qs:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

/* PDF Generation Progress Modal */
.pdf-progress-card {
  max-width: 480px;
}

.progress-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.2s ease;
  border-radius: var(--radius-full);
}

.progress-percent {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.progress-status-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.progress-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.preview-modal-card {
  max-width: 760px;
  width: 95%;
}

/* Offline Warning Banner */
.offline-warning-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  color: var(--text-main);
  animation: pulseWarning 2s infinite ease-in-out;
}

.offline-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.offline-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.offline-text strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ef4444;
}

.offline-text span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

@keyframes pulseWarning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}




/* --- Quick Topic & Difficulty Launcher Bar --- */
.quick-drill-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.quick-drill-left {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
}

.quick-drill-icon {
  font-size: 2rem;
  line-height: 1;
}

.quick-drill-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.quick-drill-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

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

.quick-drill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-drill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.quick-drill-btn.drill-easy {
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}
.quick-drill-btn.drill-easy:hover {
  background: rgba(16, 185, 129, 0.15);
}

.quick-drill-btn.drill-medium {
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}
.quick-drill-btn.drill-medium:hover {
  background: rgba(245, 158, 11, 0.15);
}

.quick-drill-btn.drill-hard {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}
.quick-drill-btn.drill-hard:hover {
  background: rgba(239, 68, 68, 0.15);
}

.quick-drill-btn.drill-custom {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.quick-drill-btn.drill-custom:hover {
  filter: brightness(1.1);
}

/* Custom Generator Difficulty Controls */
.custom-diff-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--accent);
}

.diff-pill-select-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diff-pill-item input[type="checkbox"]:checked + span {
  font-weight: 700;
}
