/* ==========================================================================
   CustomBix Design System & Style Definitions
   Content-First Academic Architecture (UX Quality Standard)
   ========================================================================== */

:root {
  color-scheme: light;
  /* Light Theme (Default) - Clean Academic Slate */
  --bg: #F8FAFC;
  --surface-1: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --surface-hover: #EDF2F7;
  --header-bg: rgba(248, 250, 252, 0.92);
  --overlay-bg: rgba(15, 23, 42, 0.55);
  
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-focus: rgba(79, 70, 229, 0.55);

  --text-1: #0F172A;
  --text-2: #475569;
  --text-3: #64748B;

  /* Primary Accent - Brand Indigo */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-bg: rgba(79, 70, 229, 0.08);
  --primary-border: rgba(79, 70, 229, 0.22);

  /* Signature Accents */
  --accent-amber: #D97706;
  --accent-amber-bg: rgba(217, 119, 6, 0.1);

  --accent-green: #059669;
  --accent-green-bg: rgba(5, 150, 105, 0.1);

  /* Status Colors */
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.09);
  --success-border: rgba(5, 150, 105, 0.25);

  --danger: #DC2626;
  --danger-bg: rgba(220, 38, 38, 0.09);
  --danger-border: rgba(220, 38, 38, 0.25);

  --warning: #D97706;
  --warning-bg: rgba(217, 119, 6, 0.09);
  --warning-border: rgba(217, 119, 6, 0.25);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii & Elevation */
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-pill: 9999px;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-focus: 0 0 0 3px rgba(79, 70, 229, 0.25);

  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  /* Dark Theme - Refined Slate Canvas */
  --bg: #090B11;
  --surface-1: #111420;
  --surface-2: #171C2D;
  --surface-3: #22283E;
  --surface-hover: #1C2237;
  --header-bg: rgba(9, 11, 17, 0.92);
  --overlay-bg: rgba(3, 5, 8, 0.75);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-1: #F8FAFC;
  --text-2: #94A3B8;
  --text-3: #64748B;

  --primary: #6366F1;
  --primary-hover: #818CF8;
  --primary-bg: rgba(99, 102, 241, 0.12);
  --primary-border: rgba(99, 102, 241, 0.3);

  --accent-amber: #F5B942;
  --accent-amber-bg: rgba(245, 185, 66, 0.12);

  --accent-green: #34D399;
  --accent-green-bg: rgba(52, 211, 153, 0.12);

  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --danger: #F43F5E;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --danger-border: rgba(244, 63, 94, 0.3);

  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 4px 12px -2px rgba(0, 0, 0, 0.45);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--primary);
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.theme-label {
  font-size: 0.8rem;
  font-weight: 600;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 2.25rem 4rem;
}

.screen {
  display: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.screen.active {
  display: block;
  opacity: 1;
}

#screen-test {
  overscroll-behavior-y: contain;
}

/* ── Typography ── */
h1, h2, h3, h4, .logo {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text-1);
}

p {
  color: var(--text-2);
}

/* ── Global Header Topbar ── */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  width: 100%;
  margin-bottom: 0.75rem;
}

.main-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-topbar, .sub-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo span {
  color: var(--primary);
}

.logo-sm {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
}

/* Central Navigation Links */
.home-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-1);
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.nav-link.active {
  background: var(--primary-bg);
  color: var(--primary-hover);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-cta {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1.05rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.25;
}

.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-danger, #btnFinish {
  background: var(--surface-2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #EF4444;
  font-weight: 600;
}

.btn-danger:hover:not(:disabled), #btnFinish:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: #EF4444;
  color: #DC2626;
  box-shadow: none;
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-back:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-1);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--primary-hover);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

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

/* ── Hero Section & "The Answer Sheet" Visual ── */
.home-hero {
  display: grid;
  grid-template-columns: 1fr 340px;
  align-items: center;
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.hero-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-eyebrow, .config-sec-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-hover);
  margin-bottom: 0.5rem;
  display: inline-block;
}

.home-hero h1 {
  font-family: var(--font-display);
  font-size: 2.35rem;
  line-height: 1.18;
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

.hero-brand-accent {
  color: var(--primary);
  font-weight: 800;
}

.home-hero p {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 580px;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.hero-btn {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.35rem;
}

.hero-btn-secondary {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hero-btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--primary-border);
}

/* Hero Top Alignment */
#screen-home .app {
  padding-top: 0.85rem;
}

/* Dedicated Trending Practice & Mocks Strip (Below Hero) */
.trending-strip {
  margin: 1.5rem 0 2rem;
  width: 100%;
}

.trending-strip-inner {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.trending-strip-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border);
}

.trending-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: trendPulse 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes trendPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.trending-pills-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.2rem 0;
  flex-grow: 1;
}

.trending-pills-wrap::-webkit-scrollbar {
  display: none;
}

.trend-pill {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.trend-pill:hover {
  background: rgba(109, 94, 245, 0.12);
  border-color: rgba(109, 94, 245, 0.45);
  color: var(--text-1);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(109, 94, 245, 0.15);
}

.trend-pill:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.trend-pill-highlight {
  background: linear-gradient(135deg, rgba(109, 94, 245, 0.15), rgba(168, 85, 247, 0.12));
  border-color: rgba(109, 94, 245, 0.4);
  color: var(--text-1);
  font-weight: 600;
}

.trend-pill-highlight:hover {
  background: linear-gradient(135deg, rgba(109, 94, 245, 0.24), rgba(168, 85, 247, 0.2));
  border-color: var(--primary);
}

.trend-emoji {
  font-size: 0.9rem;
  line-height: 1;
}

.trend-name {
  line-height: 1;
}

.trend-tag {
  background: rgba(109, 94, 245, 0.25);
  color: #A59BFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.35rem;
  border-radius: 9999px;
  line-height: 1;
}

@media (max-width: 768px) {
  .trending-strip-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
  }
  .trending-strip-badge {
    border-right: none;
    padding-right: 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
  }
  .trending-pills-wrap {
    width: 100%;
  }
}

/* OMR Answer Sheet Visual Motif */
.omr-hero-visual {
  display: flex;
  justify-content: center;
}

.omr-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-card);
}

.omr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed var(--border-strong);
}

.omr-sheet-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

.omr-sheet-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-amber);
}

.omr-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.omr-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.omr-qnum {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  width: 22px;
}

.omr-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

/* Motion Moment #1: Hero OMR Fill-in Animation (~800ms) */
.omr-bubble.filled {
  border-color: transparent;
  color: #ffffff;
  animation: omrFill 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.omr-bubble.filled.green {
  background: var(--accent-green);
  color: #08090D;
}

.omr-bubble.filled.violet {
  background: var(--primary);
}

.omr-bubble.filled.amber {
  background: var(--accent-amber);
  color: #08090D;
}

@keyframes omrFill {
  0% { transform: scale(0.6); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Question Library Grid & Cards ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
}

.section-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--primary-bg);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
}

.home-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

/* Motion Moment #2: Scroll-reveal Stagger Animation */
.home-topic-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  opacity: 1;
  transform: translateY(0);
  animation: cardReveal 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Motion Moment #3: Topic Card Hover Bubble Fill (100-150ms) */
.home-topic-card:hover {
  background: var(--surface-2);
  border-color: var(--primary-border);
  transform: translateY(-2px);
}

.home-topic-card:hover .htc-icon-wrap {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  transform: scale(1.08);
}

.htc-left-side {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.htc-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.htc-content {
  min-width: 0;
}

.htc-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htc-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
}

.htc-arrow {
  font-size: 0.85rem;
  color: var(--text-3);
  flex-shrink: 0;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.htc-content {
  min-width: 0;
}

.htc-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.htc-count {
  font-size: 0.75rem;
  color: var(--text-2);
}

.htc-arrow {
  font-size: 0.9rem;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ── Practice Browse Hero ── */
.practice-browse-hero {
  margin-bottom: 1.25rem;
}

.practice-browse-hero h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.practice-browse-hero p {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ── Segmented Mode Picker ── */
.segmented-mode-picker {
  display: inline-flex;
  gap: 0.35rem;
  background: var(--surface-1);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 1rem;
  margin-bottom: 1.75rem;
}

.mode-pick-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-2);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.mode-pick-btn:hover:not(.active) {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.03);
}

.mode-pick-btn.active {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-strong);
}

.mp-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.mp-sub {
  font-size: 0.75rem;
  display: block;
  opacity: 0.85;
  margin-top: 0.2rem;
  line-height: 1.2;
}

/* ── Tabs Navigation ── */
.topic-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
  scrollbar-width: thin;
}

.tab, .tab-btn {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab:hover, .tab-btn:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.tab.active, .tab-btn.active {
  background: var(--primary-bg);
  color: var(--primary-hover);
  border-color: var(--primary-border);
  font-weight: 600;
}

/* ── Subtopic Header & Select All Button ── */
.subtopic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.subtopic-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.85rem;
}

.btn-select-all, .btn-text {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--primary-hover);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  outline: none;
  user-select: none;
}

.btn-select-all:hover, .btn-text:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(109, 94, 245, 0.18);
}

.btn-select-all:active, .btn-text:active {
  transform: scale(0.97);
}

.bsa-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* ── Subtopic Grid ── */
.subtopic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.subtopic-card, .sub-card, .psc-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.05rem;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.subtopic-card:hover, .sub-card:hover, .psc-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.subtopic-card.selected, .sub-card.selected {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.sc-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.sc-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  border: 1px solid var(--border);
}

.sc-check-indicator, .sc-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.subtopic-card.selected .sc-check-indicator, .sub-card.selected .sc-check {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.sc-name, .sc-title, .psc-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.sc-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.subtopic-card:hover .sc-arrow {
  color: var(--primary-hover);
  transform: translateX(3px);
}

/* ── Selected Chips ── */
.selected-chips-wrap {
  margin: 1.25rem 0;
}

.scw-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.35rem;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.4rem;
  background: var(--surface-1);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font-size: 0.775rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
}

.rm {
  cursor: pointer;
  color: var(--text-3);
  font-weight: bold;
}

.rm:hover {
  color: var(--danger);
}

.chip-placeholder {
  font-size: 0.825rem;
  color: var(--text-3);
  padding: 0.2rem 0.4rem;
}

/* ── Empty State Component ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.25rem 1.5rem;
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
  grid-column: 1 / -1;
  width: 100%;
}

.empty-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--primary-hover);
  margin-bottom: 0.5rem;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.2rem;
}

.empty-desc {
  font-size: 0.825rem;
  color: var(--text-2);
  max-width: 320px;
}

/* ── Test Config Stepper ── */
.config-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-card);
}

.config-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.config-sec-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.4rem;
}

.config-sec-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.2rem;
}

.config-sec-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Middle 3-Column Grid Trio (Steps 3, 4, 5) ── */
.config-row-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.15rem;
  align-items: stretch;
}

.config-row-trio .config-section {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.config-row-trio .config-grid {
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.config-row-trio .marking-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 960px) {
  .config-row-trio {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.timing-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.tmode {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-2);
}

.tmode.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--text-1);
}

.tm-icon { font-size: 1.1rem; }
.tm-label { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; color: var(--text-1); }
.tm-sub { font-size: 0.775rem; color: var(--text-2); }

.config-grid, .config-grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.config-grid2 { margin-top: 1rem; }

.cfg { display: flex; flex-direction: column; gap: 0.35rem; }
.cfg label { font-size: 0.825rem; font-weight: 600; color: var(--text-2); }

.cfg select, .cfg input[type="number"] {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.cfg select:focus, .cfg input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.marking-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.mpill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  line-height: 1.25;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition: all var(--transition-fast);
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
}

.mpill:hover:not(.active) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-1);
}

.mpill:active {
  transform: scale(0.97);
}

.mpill.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-hover);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--primary);
}

.start-btn {
  width: 100%;
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1rem;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.start-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.start-btn:active {
  transform: translateY(0);
}

/* ── Active Test Engine Header & Modern HUD ── */
.test-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.test-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.test-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
}

.test-brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.test-brand-name .brand-accent {
  color: var(--primary);
}

.test-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-hover);
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.test-mode-chip .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: liveDotPulse 2s infinite ease-in-out;
}

@keyframes liveDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.test-header-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.test-theme-toggle {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.timer-card {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border-focus);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.timer-card .timer-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.timer-card .sc.timer {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.02em;
}

.timer-card .sc.timer.warn {
  color: #f59e0b;
}

.timer-card .sc.timer.danger {
  color: #ef4444;
  animation: timerDangerPulse 0.8s infinite alternate;
}

@keyframes timerDangerPulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.75; transform: scale(1.05); }
}

/* Segmented Test HUD Strip */
.test-hud-strip {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  gap: 0.5rem;
}

.hud-stat-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.hud-stat-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-3);
  text-transform: uppercase;
}

.hud-stat-val {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.hud-stat-cell.hud-q .hud-stat-val {
  color: var(--text-1);
}

.hud-stat-cell.hud-ans .hud-stat-val {
  color: #10b981;
}

.hud-stat-cell.hud-skip .hud-stat-val {
  color: #f59e0b;
}

.hud-stat-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--surface-1);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width var(--transition-normal);
}

.dot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.dot, .qdot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.825rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dot:hover:not(.strict-locked), .qdot:hover:not(.strict-locked) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.dot.current, .qdot.current {
  border: 2px solid var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  font-weight: 700;
}

.dot.answered, .qdot.answered {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  font-weight: 700;
}

.dot.skipped, .qdot.skipped {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
  font-weight: 600;
}

.qdot.strict-locked {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Issue 5, 6, 7 Fix: Question Card & Option Formatting ── */
.q-card, .prac-q-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.q-meta, .prac-q-num {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-hover);
}

.q-num-badge { color: var(--primary-hover); font-family: var(--font-mono); font-size: 0.85rem; }
.q-source, .prac-q-source { font-size: 0.775rem; color: var(--text-3); }

/* Direction & Context Passage */
.q-direction, .prac-direction {
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.55;
}

.q-text, .prac-q-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-1);
  margin-bottom: 1.5rem;
  word-break: break-word;
}

.q-text table, .prac-q-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.q-text th, .q-text td, .prac-q-text th, .prac-q-text td {
  border: 1px solid var(--border-strong);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.q-text th, .prac-q-text th {
  background: var(--surface-2);
  color: var(--text-1);
}

.q-text img, .prac-q-text img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.85rem 0;
}

/* Option Cards (Flex Layout - Fixes ASoft issue) */
.opts, .prac-opts {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.opt, .prac-opt, .opt-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.opt:hover, .prac-opt:hover, .opt-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.opt-lbl, .prac-opt-lbl, .opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1.5px solid var(--border-strong);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.825rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--transition-fast);
}

.opt-txt, .prac-opt-txt, .opt-text {
  font-size: 0.925rem;
  color: var(--text-1);
  line-height: 1.5;
  flex: 1;
}

.opt.sel, .opt-card.selected {
  background: var(--primary-bg);
  border-color: var(--primary);
}

.opt.sel .opt-lbl, .opt-card.selected .opt-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.opt.correct, .prac-opt.correct, .opt-card.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.opt.correct .opt-lbl, .prac-opt.correct .prac-opt-lbl, .opt-card.correct .opt-letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.opt.wrong, .prac-opt.wrong, .opt-card.incorrect {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.opt.wrong .opt-lbl, .prac-opt.wrong .prac-opt-lbl, .opt-card.incorrect .opt-letter {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Structured Solution Component */
.explanation-box, .prac-expl {
  display: none;
  margin-top: 1.25rem;
}

.prac-expl.show {
  display: block !important;
}

.prac-expl:empty, .explanation-box:empty {
  display: none !important;
}

.sol-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.sol-card.sol-correct {
  border-left: 4px solid var(--success);
}

.sol-card.sol-incorrect {
  border-left: 4px solid var(--danger);
}

.sol-card.sol-revealed {
  border-left: 4px solid var(--primary);
}

.sol-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.status-correct { color: var(--success); }
.status-incorrect { color: var(--danger); }
.status-revealed { color: var(--primary-hover); }

.sol-meta-label {
  display: block;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.2rem;
}

.sol-answer-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}

.sol-explanation-body {
  font-size: 0.925rem;
  line-height: 1.6;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sol-paragraph {
  white-space: pre-wrap;
  word-break: break-word;
}

.prac-show-ans {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.15rem;
  padding: 0.45rem 0.95rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.prac-show-ans::before {
  content: "💡";
  font-size: 0.85rem;
}

.prac-show-ans:hover {
  background: var(--primary-bg);
  color: var(--primary-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Navigation Bar */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-actions-right { display: flex; gap: 0.5rem; }

/* ── Issue 4 Fix: Application Pagination Component ── */
.prac-pagination, .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.75rem;
}

.pg-btn, .page-btn {
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 34px;
  height: 34px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pg-btn:hover:not(:disabled):not(.disabled), .page-btn:hover:not(:disabled):not(.disabled) {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border-strong);
}

.pg-btn.active, .page-btn.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.pg-btn:disabled, .page-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--border);
}

/* ── Results Screen ── */
.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

@media (max-width: 768px) {
  .result-stats {
    grid-template-columns: 1fr;
  }
}

.result-stats-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.result-stats-row .rstat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-score-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.score-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .score-donut-container {
    flex-direction: column;
    gap: 0.75rem;
  }
}

.rstat {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.rstat:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.rsh-val, .rs-val, .rv {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-1);
}

.rstat.green .rv { color: var(--success); }
.rstat.red .rv { color: var(--danger); }

.rsh-lbl, .rs-lbl, .rl {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.chart-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.chart-wrap h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-1);
}

/* Donut Chart & Custom Legend Layout */
.donut-canvas-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.825rem;
  font-family: var(--font-sans);
}

.donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-label {
  color: var(--text-2);
  font-weight: 500;
  flex-grow: 1;
}

.donut-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.825rem;
  color: var(--text-1);
}

.weak-bars { display: flex; flex-direction: column; gap: 0.75rem; }

.wbar-row, .wb-row {
  display: grid;
  grid-template-columns: 160px 1fr 45px;
  align-items: center;
  gap: 0.85rem;
}

.wbar-label, .wb-name {
  font-size: 0.825rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wbar-track, .wb-bar-bg {
  height: 7px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.wbar-fill, .wb-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
}

.wbar-fill.good { background: var(--success); }
.wbar-fill.mid { background: var(--warning); }
.wbar-fill.bad { background: var(--danger); }

.wbar-pct, .wb-pct {
  font-size: 0.825rem;
  font-weight: 700;
  text-align: right;
  font-family: var(--font-mono);
}

.review-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.75rem; }

.review-item, .rev-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
}

.review-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.ri-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.65rem; }
.ri-q { font-size: 0.95rem; font-weight: 600; line-height: 1.5; color: var(--text-1); }

.ri-status {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.ri-status.correct {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.ri-status.wrong {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.ri-status.skipped {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.ri-ans { font-size: 0.875rem; color: var(--text-2); line-height: 1.55; }
.ri-source { font-size: 0.75rem; color: var(--text-3); margin-top: 0.45rem; font-family: var(--font-mono); }

.result-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Issue 10 Fix: Compact Actionable Error Page ── */
.error-state {
  background: var(--surface-1);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  max-width: 480px;
  margin: 2rem auto;
}

.error-icon { font-size: 1.75rem; margin-bottom: 0.35rem; }
.error-state h4 { font-family: var(--font-display); font-size: 1.05rem; color: #fca5a5; margin-bottom: 0.25rem; }
.error-state p { font-size: 0.85rem; color: var(--text-2); margin-bottom: 0.85rem; }

/* ── Overlay Loading Spinner ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-box {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.loading-box svg {
  display: block;
  margin: 0 auto 0.75rem;
}

/* Animated Test Sheet Loader */
.loader-pen { animation: loader-pen-move 4.8s linear infinite; }
.loader-ln:nth-of-type(1) { animation: loader-draw1 4.8s linear infinite; }
.loader-ln:nth-of-type(2) { animation: loader-draw2 4.8s linear infinite; }
.loader-ln:nth-of-type(3) { animation: loader-draw3 4.8s linear infinite; }
.loader-ln:nth-of-type(4) { animation: loader-draw4 4.8s linear infinite; }

@keyframes loader-pen-move {
  0% { transform: translate(26px,74px); }
  20% { transform: translate(154px,74px); }
  24% { transform: translate(26px,104px); }
  44% { transform: translate(154px,104px); }
  48% { transform: translate(26px,134px); }
  68% { transform: translate(154px,134px); }
  72% { transform: translate(26px,164px); }
  92% { transform: translate(120px,164px); }
  100% { transform: translate(26px,74px); }
}
@keyframes loader-draw1 { 0% { stroke-dashoffset: 128; } 20% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
@keyframes loader-draw2 { 0%, 20% { stroke-dashoffset: 128; } 44% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
@keyframes loader-draw3 { 0%, 44% { stroke-dashoffset: 128; } 68% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
@keyframes loader-draw4 { 0%, 68% { stroke-dashoffset: 94; } 92% { stroke-dashoffset: 0; } 96%, 100% { stroke-dashoffset: 94; } }

@media (prefers-reduced-motion: reduce) {
  .loader-pen, .loader-ln { animation: none; }
  .loader-ln { stroke-dashoffset: 0; }
}

.spinner, .spinner-sm {
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner { width: 32px; height: 32px; margin: 0 auto 0.85rem; }
.spinner-sm { width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 0.4rem; }

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

/* ── Attribution Footer ── */
.attribution-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.6;
}

.attribution-footer a {
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--primary-border);
  transition: color var(--transition-fast);
}

.attribution-footer a:hover {
  color: var(--primary-hover);
}

/* ── Responsive Adaptation ── */
@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .omr-hero-visual {
    order: -1;
  }
}

@media (max-width: 768px) {
  .app { padding: 1.25rem 1rem 3rem; }
  .home-topbar, .sub-topbar { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .home-nav { width: 100%; justify-content: space-around; }
  .topbar-right { width: 100%; }
  .topbar-right .btn { width: 100%; }
  .home-hero h1, .practice-browse-hero h1, .config-hero h1 { font-size: 1.65rem; }
  .home-topic-grid { grid-template-columns: 1fr; }
  .segmented-mode-picker, .source-toggle, .timing-mode { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .wbar-row, .wb-row { grid-template-columns: 110px 1fr 40px; }
  .nav-bar { 
    display: flex; 
    flex-direction: column; 
    gap: 0.75rem; 
  }
  .nav-actions-right { 
    order: 1; 
    width: 100%; 
    display: flex; 
    gap: 0.5rem; 
  }
  .nav-actions-right .btn { 
    flex: 1; 
    text-align: center; 
    justify-content: center; 
  }
  #btnFinish { 
    order: 2; 
    width: 100%; 
    text-align: center; 
    justify-content: center; 
    margin-top: 0.15rem; 
  }
}

/* ── Motion Budget & Reduced Motion Guard ── */
@media (prefers-reduced-motion: reduce) {
  .omr-bubble.filled {
    animation: none !important;
  }
  
  .home-topic-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .home-topic-card:hover {
    transform: none !important;
  }
}

/* ── API Connection Status & Modal ── */
.dot-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  background-color: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}
.dot-status.ok {
  background-color: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.nav-api-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.nav-api-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-1);
  background: var(--surface-2);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 13, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.modal-close:hover {
  color: var(--text-1);
}

.modal-body {
  padding: 1.25rem;
}

/* ==========================================================================
   App Bottom Footer Section
   ========================================================================== */
.app-footer {
  margin-top: 4.5rem;
  padding: 3rem 1.5rem 3.5rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, transparent, rgba(109, 94, 245, 0.03));
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
}

.footer-left {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: left;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.footer-beta-pill {
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  background: rgba(109, 94, 245, 0.12);
  color: var(--primary);
  border: 1px solid rgba(109, 94, 245, 0.25);
}

.footer-declaration {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.65;
  margin: 0;
}

.footer-declaration a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.footer-declaration a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.footer-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.footer-bug-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--surface-1);
  color: var(--text-1);
  box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.footer-bug-btn:hover {
  border-color: var(--primary);
  background: rgba(109, 94, 245, 0.08);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -4px rgba(109, 94, 245, 0.25);
}

.bug-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

@media (max-width: 860px) {
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.75rem;
  }
  .footer-right {
    width: 100%;
  }
  .footer-bug-btn {
    width: 100%;
    justify-content: center;
  }
}

.bug-form .form-group {
  margin-bottom: 1rem;
}

.bug-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.35rem;
}

.bug-form .form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.bug-form .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

.bug-form .file-control {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-2);
}

.bug-form .file-control::-webkit-file-upload-button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all var(--transition-fast);
}

.bug-form .file-control::-webkit-file-upload-button:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.bug-file-note {
  background: var(--primary-bg);
  color: var(--text-1);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.775rem;
  line-height: 1.45;
  margin-bottom: 1rem;
}

.bug-form .form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Floating Back to Top Control (Practice Screen)
   ========================================================================== */
.back-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--surface-1);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full, 9999px);
  padding: 0.5rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease, border-color 0.15s ease;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.back-to-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top-btn:hover {
  background: var(--surface-2);
  border-color: var(--primary-border);
  color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(109, 94, 245, 0.25);
}

.back-to-top-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.mobile-menu-toggle {
  display: none;
}

.mobile-nav-cta-wrap {
  display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM & BREAKPOINT ARCHITECTURE
   Desktop: >= 1200px | Tablet: 768px - 1199px | Mobile: < 768px
   ========================================================================== */

/* ── 1. Desktop & Large Screens (>= 1200px) ── */
@media (min-width: 1200px) {
  .app {
    max-width: 1280px;
    padding: 2rem 2.5rem 5rem;
  }

  .main-header-inner {
    max-width: 1280px;
  }
}

/* ── 2. Tablet & Intermediate Screens (768px - 1199px) ── */
@media (max-width: 1199px) and (min-width: 768px) {
  .app {
    max-width: 100%;
    padding: 1.5rem 1.75rem 4rem;
  }

  .main-header-inner {
    padding: 0.75rem 1.5rem;
  }

  .home-hero {
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
  }

  .home-hero h1 {
    font-size: 2.1rem;
  }

  .home-topic-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
  }

  .prac-q-card {
    padding: 1.25rem;
  }
}

/* ── 3. Mobile Screens (< 768px) ── */
@media (max-width: 767px) {
  /* Container System */
  .app {
    padding: 1rem 1rem 3.5rem 1rem;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Test Config Mobile Enhancements */
  .config-inline-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .marking-pills {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .mpill {
    min-height: 42px;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    flex: 1 1 auto;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto !important;
    position: relative;
    z-index: 2;
  }

  .tab, .subtopic-card, .mode-pick-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Active Test Header & HUD Mobile Styles */
  .test-header {
    padding: 0.7rem 0.85rem;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
  }

  .test-header-top {
    gap: 0.5rem;
  }

  .test-brand-name {
    font-size: 1.05rem;
  }

  .test-mode-chip {
    font-size: 0.62rem;
    padding: 0.15rem 0.45rem;
  }

  .test-theme-toggle .theme-label {
    display: none;
  }

  .test-theme-toggle {
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius-pill);
    min-width: 34px;
    height: 34px;
    justify-content: center;
  }

  .timer-card {
    padding: 0.3rem 0.65rem;
  }

  .timer-card .sc.timer {
    font-size: 0.875rem;
  }

  .test-hud-strip {
    padding: 0.4rem 0.5rem;
    gap: 0.25rem;
  }

  .hud-stat-cell {
    gap: 0.35rem;
  }

  .hud-stat-label {
    font-size: 0.6rem;
  }

  .hud-stat-val {
    font-size: 0.8rem;
  }

  .dot-grid {
    gap: 0.35rem;
    margin-bottom: 1rem;
  }

  .dot, .qdot {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  /* Header & Navigation */
  .main-header {
    margin-bottom: 1rem;
  }

  .main-header-inner {
    padding: 0.65rem 1rem;
    position: relative;
  }

  .topbar-right {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
  }

  .mobile-menu-toggle:hover,
  .mobile-menu-toggle.open {
    background: var(--surface-2);
    border-color: var(--border-strong);
  }

  .hamburger-bar {
    width: 18px;
    height: 2px;
    background-color: var(--text-1);
    border-radius: 2px;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
  }

  .mobile-menu-toggle.open .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .mobile-menu-toggle.open .hamburger-bar:nth-child(2) {
    opacity: 0;
  }
  .mobile-menu-toggle.open .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .home-nav {
    display: none;
  }

  .home-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-strong);
    padding: 1rem;
    gap: 0.5rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 1000;
  }

  .home-nav.open .nav-link {
    width: 100%;
    text-align: left;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
  }

  .mobile-nav-cta-wrap {
    display: block;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
  }

  .mobile-nav-cta-wrap .nav-cta {
    width: 100%;
    justify-content: center;
  }

  /* Hero Section Recomposition */
  .home-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
  }

  .home-hero h1 {
    font-size: 1.65rem;
    line-height: 1.25;
    margin-bottom: 0.6rem;
  }

  .home-hero p {
    font-size: 0.925rem;
    margin-bottom: 1.25rem;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .hero-actions .hero-btn,
  .hero-actions .hero-btn-secondary {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .omr-hero-visual {
    width: 100%;
    margin-top: 0.5rem;
  }

  .omr-card {
    max-width: 100%;
    padding: 1rem;
  }

  /* Segmented Mode Picker & Topic Tabs */
  .segmented-mode-picker {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.35rem;
  }

  .mode-pick-btn {
    width: 100%;
    padding: 0.65rem 0.85rem;
  }

  .topic-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    gap: 0.4rem;
  }

  .topic-tabs .tab {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.825rem;
  }

  /* Subtopic & Topic Card Grids */
  .home-topic-grid,
  .subtopic-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .home-topic-card,
  .subtopic-card {
    padding: 0.85rem 1rem;
    min-height: 52px;
  }

  /* Question Cards & Options */
  .sub-topbar.prac-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
  }

  .prac-header-meta {
    width: 100%;
    justify-content: space-between;
  }

  .prac-q-card {
    padding: 1rem 0.85rem;
    margin-bottom: 1rem;
  }

  .prac-q-num {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .prac-q-text {
    font-size: 0.925rem;
    line-height: 1.55;
    margin-bottom: 1rem;
    word-break: break-word;
  }

  .prac-opts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .prac-opt {
    width: 100%;
    padding: 0.65rem 0.85rem;
    min-height: 48px;
    align-items: flex-start;
  }

  .prac-opt-lbl {
    flex-shrink: 0;
  }

  .prac-opt-txt {
    font-size: 0.875rem;
    word-break: break-word;
  }

  /* Data Interpretation Tables & Media */
  .prac-direction {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
    padding: 0.75rem;
  }

  .prac-direction table {
    width: 100% !important;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .prac-direction img,
  .prac-direction svg {
    max-width: 100%;
    height: auto;
  }

  /* Pagination */
  .prac-pagination {
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
  }

  .pg-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    min-width: 36px;
    height: 36px;
  }

  /* Floating Back to Top */
  .back-to-top-btn {
    bottom: 16px;
    right: 16px;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

  /* Footer & Bug Report Card */
  .app-footer {
    margin-top: 2.25rem;
    padding: 1.75rem 0.5rem 2.5rem;
  }

  .bug-report-card {
    padding: 1.15rem;
  }

  .bug-form .form-actions {
    width: 100%;
  }

  .bug-form .form-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* ── 4. Extra Small Mobile (< 480px) ── */
@media (max-width: 479px) {
  .app {
    padding: 0.85rem 0.75rem 3rem;
  }

  .logo {
    font-size: 1.3rem;
  }

  .home-hero h1 {
    font-size: 1.45rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .prac-q-card {
    padding: 0.85rem 0.75rem;
  }
}

/* ====== HOME SEO FEATURES & FAQ ====== */
.home-seo-section {
  margin-top: 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.seo-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.seo-feature-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.seo-feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.25);
}

.seo-feature-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.seo-feature-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.seo-feature-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
}

.seo-feature-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

.seo-faq-section {
  width: 100%;
}

.seo-faq-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1rem;
}

.seo-faq-item {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.seo-faq-item:hover {
  border-color: rgba(109, 94, 245, 0.45);
  background: linear-gradient(to right, var(--surface-1), rgba(109, 94, 245, 0.03));
}

.seo-faq-item.is-expanded {
  border-color: var(--primary);
  background: var(--surface-1);
  box-shadow: 0 4px 20px -2px rgba(109, 94, 245, 0.16);
}

.seo-faq-trigger {
  width: 100%;
  padding: 0.9rem 1.35rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  text-align: left;
  user-select: none;
  outline: none;
  transition: color 0.2s ease;
}

.seo-faq-trigger:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.seo-faq-item.is-expanded .seo-faq-trigger {
  color: var(--primary);
}

.seo-faq-question {
  flex: 1;
  line-height: 1.45;
}

/* Animated Plus / Minus Icon */
.seo-faq-icon {
  position: relative;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: inline-block;
}

.seo-faq-icon::before,
.seo-faq-icon::after {
  content: "";
  position: absolute;
  background-color: var(--primary);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

/* Horizontal bar */
.seo-faq-icon::before {
  top: 5px;
  left: 0;
  width: 12px;
  height: 2px;
}

/* Vertical bar */
.seo-faq-icon::after {
  top: 0;
  left: 5px;
  width: 2px;
  height: 12px;
}

/* When expanded, vertical bar rotates 90deg and fades out to form a clean minus (-) */
.seo-faq-item.is-expanded .seo-faq-icon::after {
  transform: rotate(90deg);
  opacity: 0;
}

/* Smooth Accordion Animation via CSS Grid */
.seo-faq-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
}

.seo-faq-collapse-inner {
  min-height: 0;
  overflow: hidden;
}

.seo-faq-item.is-expanded .seo-faq-collapse {
  grid-template-rows: 1fr;
  opacity: 1;
}

.seo-faq-body {
  padding: 0.85rem 1.35rem 1.15rem;
  font-size: 0.885rem;
  color: var(--text-2);
  line-height: 1.65;
  border-top: 1px solid var(--border-light);
}

/* SEO Topic Coverage Dynamic Cards */
.seo-topic-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  align-items: start;
}

.seo-topic-col {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  user-select: none;
  outline: none;
  display: flex;
  flex-direction: column;
}

.seo-topic-col:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(109, 94, 245, 0.4);
}

.seo-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
}

.seo-topic-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.seo-topic-icon {
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.seo-topic-col h3,
.seo-topic-title {
  font-family: var(--font-display);
  font-size: 0.885rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.seo-topic-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.seo-topic-badge {
  font-size: 0.675rem;
  font-weight: 600;
  padding: 0.18rem 0.45rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  border: 1px solid var(--border-light);
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
}

.seo-topic-chevron {
  font-size: 0.75rem;
  color: var(--text-3);
  transition: transform 0.25s ease, color 0.2s ease;
  display: inline-block;
  line-height: 1;
}

/* Accordion expand animation via CSS Grid */
.seo-topic-content {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin-top 0.25s ease,
              padding-top 0.25s ease;
  margin-top: 0;
  border-top: 1px solid transparent;
}

.seo-topic-content-inner {
  min-height: 0;
  overflow: hidden;
}

.seo-topic-col p {
  font-size: 0.835rem;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
}

/* Hover effects for pointer devices */
@media (hover: hover) {
  .seo-topic-col:hover {
    border-color: rgba(109, 94, 245, 0.45);
    background: linear-gradient(to bottom, var(--surface-2), rgba(109, 94, 245, 0.06));
    box-shadow: 0 10px 26px -6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(109, 94, 245, 0.25);
    transform: translateY(-2px);
  }
}

/* Click/expanded state */
.seo-topic-col.is-expanded {
  border-color: rgba(109, 94, 245, 0.45);
  background: linear-gradient(to bottom, var(--surface-2), rgba(109, 94, 245, 0.06));
  box-shadow: 0 10px 26px -6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(109, 94, 245, 0.25);
  transform: translateY(-2px);
}
.seo-topic-col.is-expanded .seo-topic-badge {
  background: rgba(109, 94, 245, 0.12);
  color: var(--primary);
  border-color: rgba(109, 94, 245, 0.3);
}
.seo-topic-col.is-expanded .seo-topic-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.seo-topic-col.is-expanded .seo-topic-content {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top-color: var(--border-light);
}

/* SEO Targeted Exam Hub Dynamic Accordion Cards */
.seo-exam-hub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .seo-exam-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .seo-exam-hub-grid {
    grid-template-columns: 1fr;
  }
}

.seo-exam-card {
  outline: none;
  padding: 1.35rem 1.25rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.seo-exam-header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.seo-exam-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.seo-exam-icon {
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(109, 94, 245, 0.12);
  border: 1px solid rgba(109, 94, 245, 0.2);
  flex-shrink: 0;
}

.seo-exam-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.seo-exam-badge {
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  border: 1px solid var(--border-light);
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
}

.seo-exam-heading-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.seo-exam-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
  min-height: 2.85rem;
}

.seo-exam-subtitle {
  font-size: 0.785rem;
  color: var(--text-3);
  line-height: 1.45;
  margin: 0;
}

/* Hover effects */
@media (hover: hover) {
  .seo-exam-card:hover {
    border-color: rgba(109, 94, 245, 0.45);
    background: linear-gradient(to bottom, var(--surface-1), rgba(109, 94, 245, 0.06));
    box-shadow: 0 10px 26px -6px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(109, 94, 245, 0.25);
    transform: translateY(-2px);
  }
}

/* ── Floating Toast Notification System ── */
.toast-container {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  width: calc(100% - 2rem);
  max-width: 440px;
  box-sizing: border-box;
}

.toast-msg {
  pointer-events: auto;
  position: relative;
  background: var(--surface-1);
  color: var(--text-1);
  border: 1px solid var(--border-focus);
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-sizing: border-box;
  animation: toastSlideDown 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast-msg.toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, var(--surface-1), rgba(245, 158, 11, 0.06));
}

.toast-icon-wrap {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.toast-desc {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.45;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.toast-msg.fade-out {
  opacity: 0;
  transform: translateY(-16px) scale(0.96);
}

@keyframes toastSlideDown {
  from { opacity: 0; transform: translateY(-20px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
  .toast-container {
    top: 0.85rem;
    width: calc(100% - 1.5rem);
  }

  .toast-msg {
    padding: 0.75rem 0.85rem;
    gap: 0.65rem;
    border-radius: 10px;
  }

  .toast-icon-wrap {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.9rem;
  }

  .toast-title {
    font-size: 0.8rem;
  }

  .toast-desc {
    font-size: 0.75rem;
  }
}

