/* ============================================================
   TBVP SMART STUDY HUB — style.css
   Premium Dark-Mode Study Website
   ============================================================ */

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

:root {
  --bg: #0a0e1a;
  --bg2: #0f1525;
  --bg3: #141c30;
  --card: #141c30;
  --card2: #1a2440;
  --border: rgba(99, 130, 255, 0.15);
  --accent1: #6382ff;
  --accent2: #a855f7;
  --accent3: #22d3ee;
  --accent4: #f59e0b;
  --accent5: #10b981;
  --text: #e2e8f0;
  --text-muted: #8892aa;
  --text-dim: #4a5568;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --u1: #6382ff;
  --u2: #a855f7;
  --u3: #22d3ee;
  --u4: #f59e0b;
  --u5: #10b981;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --font: 'Inter', sans-serif;
  --font-alt: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}

body.light {
  --bg: #f1f5fb;
  --bg2: #e8edf7;
  --bg3: #dde4f0;
  --card: #ffffff;
  --card2: #f0f4ff;
  --border: rgba(99, 130, 255, 0.25);
  --text: #1a1f36;
  --text-muted: #5a6380;
  --text-dim: #9aa3ba;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.15);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  max-width: 100%;
  transition: background var(--transition), color var(--transition);
}

::-webkit-scrollbar {
  width: 6px;
}

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

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

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  height: 64px;
  background: var(--bg-nav, rgba(10, 14, 26, 0.85));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

body.light .navbar,
body.light-theme .navbar {
  background: var(--bg-nav, rgba(241, 245, 251, 0.9));
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-alt);
}

.nav-icon {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
}

.nav-sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(99, 130, 255, 0.12);
}

.nav-link[data-section="notes"],
.nav-link[data-section="pyqs"] {
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
  box-shadow: 0 0 10px rgba(99, 130, 255, 0.05);
  font-weight: 600;
}

.nav-link[data-section="notes"]:hover,
.nav-link[data-section="notes"].active,
.nav-link[data-section="pyqs"]:hover,
.nav-link[data-section="pyqs"].active {
  background: rgba(99, 130, 255, 0.12);
  border-color: var(--accent1);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
  color: var(--text);
}

.btn-dark-toggle:hover {
  background: var(--card2);
}

.btn-progress {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.4rem 1rem;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-progress:hover {
  opacity: 0.85;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 6rem 2rem 4rem;
}

.hero-bg-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99, 130, 255, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 20% 60%, rgba(34, 211, 238, 0.08) 0%, transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 780px;
}

.hero-badge {
  display: inline-block;
  background: rgba(99, 130, 255, 0.15);
  border: 1px solid rgba(99, 130, 255, 0.3);
  border-radius: 99px;
  padding: 0.4rem 1.2rem;
  font-size: 0.8rem;
  color: var(--accent1);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  animation: fadeSlideIn 0.6s ease both;
}

.hero-title {
  font-family: var(--font-alt);
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
  animation: fadeSlideIn 0.7s 0.1s ease both;
}

.hero-gradient-text {
  background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 50%, var(--accent3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  line-height: 1.6;
  animation: fadeSlideIn 0.7s 0.2s ease both;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
  animation: fadeSlideIn 0.7s 0.3s ease both;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 100px;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.hero-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeSlideIn 0.7s 0.4s ease both;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(99, 130, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 130, 255, 0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--card2);
  border-color: var(--accent1);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(6px)
  }
}

/* ============================================================
   ALERT BANNER
   ============================================================ */
.alert-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.1));
  border-top: 1px solid rgba(245, 158, 11, 0.3);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  padding: 1rem 2rem;
  text-align: center;
  color: var(--warning);
  font-size: 0.95rem;
}

.alert-icon {
  margin-right: 0.5rem;
  font-size: 1.1rem;
}

/* ============================================================
   GENERAL SECTIONS
   ============================================================ */
.section {
  padding: 5rem 2rem;
}

.section-alt {
  background: var(--bg2);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-badge {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.3rem 1rem;
  font-size: 0.78rem;
  color: var(--accent1);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-alt);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

.sub-title {
  font-family: var(--font-alt);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.sub-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ============================================================
   WEIGHTAGE GRID
   ============================================================ */
.weightage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.w-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.w-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.w-card.hot {
  border-color: rgba(34, 211, 238, 0.35);
}

.w-hot-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent3);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0.1rem 0.5rem;
}

.w-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.w-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  line-height: 1.3;
}

.w-bar-wrap {
  height: 6px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.w-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  transition: width 1.2s ease;
}

.w1 .w-bar {
  background: linear-gradient(90deg, var(--u1), #8aa4ff);
}

.w2 .w-bar {
  background: linear-gradient(90deg, var(--u2), #c490f0);
}

.w3 .w-bar {
  background: linear-gradient(90deg, var(--u3), #7ae0f0);
}

.w4 .w-bar {
  background: linear-gradient(90deg, var(--u4), #fcd34d);
}

.w5 .w-bar {
  background: linear-gradient(90deg, var(--u5), #34d399);
}

.w-pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent1);
}

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

/* ============================================================
   PARETO LIST
   ============================================================ */
.pareto-section {
  margin: 2rem 0;
}

.pareto-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pareto-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  transition: all var(--transition);
  cursor: default;
}

.pareto-item:hover {
  border-color: var(--accent1);
  transform: translateX(4px);
}

.pareto-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.pareto-item:nth-child(1) .pareto-rank {
  color: #ffd700;
}

.pareto-item:nth-child(2) .pareto-rank {
  color: #c0c0c0;
}

.pareto-item:nth-child(3) .pareto-rank {
  color: #cd7f32;
}

.pareto-topic {
  font-weight: 600;
  font-size: 0.95rem;
}

.pareto-marks {
  font-size: 0.8rem;
  color: var(--accent5);
  font-weight: 600;
  white-space: nowrap;
}

.pareto-freq {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  background: rgba(99, 130, 255, 0.15);
  color: var(--accent1);
  white-space: nowrap;
}

.pareto-freq.full {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* ============================================================
   HEATMAP
   ============================================================ */
.heatmap-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.htab {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1.1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.htab.active {
  background: var(--accent1);
  color: white;
  border-color: var(--accent1);
}

.htab:hover:not(.active) {
  border-color: var(--accent1);
  color: var(--text);
}

.heatmap-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hm-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
}

.hm-topic {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.hm-bar-wrap {
  width: 200px;
  height: 8px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.hm-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s ease;
}

.hm-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent1);
  min-width: 4rem;
  text-align: right;
}

.must-badge {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================================
   UNIT STUDY GUIDE TABS
   ============================================================ */
.unit-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.utab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.utab-num {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.utab-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.utab.active {
  border-color: var(--accent1);
  background: rgba(99, 130, 255, 0.1);
}

.utab.active .utab-num {
  background: var(--accent1);
  color: white;
}

.utab.active .utab-name {
  color: var(--text);
}

.unit-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

/* Unit Content Blocks */
.unit-panel {
  display: block;
}

.unit-hero {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.unit-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--unit-color, var(--accent1));
}

.unit-hero-title {
  font-family: var(--font-alt);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.unit-freq-badge {
  font-size: 0.75rem;
  background: rgba(99, 130, 255, 0.15);
  color: var(--accent1);
  padding: 0.2rem 0.7rem;
  border-radius: 99px;
}

.unit-hero-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.accordion {
  margin-bottom: 0.75rem;
}

.acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
  font-size: 0.95rem;
}

.acc-header:hover {
  border-color: var(--accent1);
  background: var(--card2);
}

.acc-header.open {
  border-color: var(--accent1);
  background: rgba(99, 130, 255, 0.08);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.acc-arrow {
  transition: transform 0.25s;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.acc-header.open .acc-arrow {
  transform: rotate(180deg);
}

.acc-body {
  display: none;
  background: var(--card);
  border: 1px solid var(--accent1);
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  padding: 1.2rem 1.5rem;
  max-width: 100%;
  overflow-x: hidden;
}

.sol-block,
.q-block {
  max-width: 100%;
  overflow-x: auto;
}

.acc-body.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.acc-body p {
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.acc-body ul,
.acc-body ol {
  padding-left: 1.5rem;
  color: var(--text);
}

.acc-body li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.acc-body code {
  font-family: var(--font-mono);
  background: var(--bg3);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent3);
}

.acc-body .math-block {
  background: var(--bg3);
  border-left: 3px solid var(--accent1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  overflow-x: auto;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
}

.qna-block {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qna-q {
  background: rgba(99, 130, 255, 0.1);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--accent1);
  border-bottom: 1px solid var(--border);
}

.qna-a {
  background: var(--bg2);
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--text);
}

.qna-a p {
  margin-bottom: 0.75rem;
}

.qna-a p:last-child {
  margin-bottom: 0;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.2rem;
  line-height: 1.2;
}

.frac .num {
  border-bottom: 1px solid var(--text);
  padding: 0 0.1rem;
  width: 100%;
  text-align: center;
}

.frac .den {
  padding: 0 0.1rem;
}

.math-line {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.mistake-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.mistake-item:last-child {
  border-bottom: none;
}

.mistake-icon {
  font-size: 1rem;
  margin-top: 0.1rem;
}

.mistake-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.mistake-text strong {
  color: var(--danger);
}

/* ============================================================
   FORMULA GRID
   ============================================================ */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem;
}

.formula-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  transition: all var(--transition);
  cursor: pointer;
}

.formula-card:hover {
  border-color: var(--accent1);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.formula-card.highlighted {
  border-color: var(--accent4);
  background: rgba(245, 158, 11, 0.08);
}

.fc-unit {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.fc-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.fc-formula {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg3);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--accent3);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.fc-formula::-webkit-scrollbar {
  height: 4px;
}

.fc-formula::-webkit-scrollbar-track {
  background: transparent;
}

.fc-formula::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.fc-formula::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   EXAM STRATEGY
   ============================================================ */
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.strategy-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.strategy-head {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.strategy-part {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent1);
  margin-bottom: 0.25rem;
}

.strategy-marks {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.strategy-target {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.strategy-list {
  list-style: none;
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.strategy-list li {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.strategy-list li::before {
  content: '→';
  color: var(--accent1);
  font-weight: 700;
  flex-shrink: 0;
}

.freq-badge {
  font-size: 0.65rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  font-weight: 700;
  margin-left: auto;
}

.partb-table {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.partb-row {
  display: grid;
  grid-template-columns: 2rem 3rem 1fr;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.partb-row.header {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.partb-row.hot-row {
  color: var(--accent4);
}

.partb-row:last-child {
  border-bottom: none;
}

.partc-info {
  padding: 1.2rem 1.5rem;
}

.partc-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.partc-opt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.partc-q {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg3);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  min-width: 3rem;
  text-align: center;
}

.partc-choices {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.partc-choice {
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.partc-choice.winner {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--success);
  font-weight: 600;
}

.or {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.tip-box {
  background: rgba(99, 130, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ============================================================
   STUDY PLAN
   ============================================================ */
.study-plan {
  margin: 3rem 0;
}

.week-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.week-col {}

.week-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--accent1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.day-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  transition: all var(--transition);
}

.day-item:hover {
  border-color: var(--accent1);
}

.day-num {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bg3);
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  color: var(--text-muted);
  min-width: 2rem;
  text-align: center;
}

.day-text {
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   PREDICTIONS
   ============================================================ */
.predictions {
  margin-top: 2rem;
}

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

.pred-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: all var(--transition);
}

.pred-card:hover {
  border-color: var(--accent2);
}

.pred-unit {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
  margin-bottom: 0.4rem;
}

.pred-b {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.pred-c {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   PRACTICE — SOLVED QUESTIONS
   ============================================================ */
.solved-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.solved-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.solved-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.solved-head:hover {
  background: rgba(99, 130, 255, 0.08);
}

.solved-num {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}

.solved-meta {
  flex: 1;
}

.solved-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.1rem;
}

.solved-info {
  font-size: 0.75rem;
  color: var(--accent5);
  font-weight: 600;
}

.solved-toggle {
  color: var(--text-muted);
  font-size: 1.2rem;
}

.solved-body {
  padding: 1.5rem;
  display: none;
}

.solved-body.open {
  display: block;
  animation: fadeIn 0.25s ease;
}

.solved-problem {
  background: rgba(99, 130, 255, 0.08);
  border: 1px solid rgba(99, 130, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.solved-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.step {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.step:last-child {
  border-bottom: none;
}

.step-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent1);
  background: rgba(99, 130, 255, 0.15);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  margin-top: 0.15rem;
  white-space: nowrap;
}

.step-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.step-text code {
  font-family: var(--font-mono);
  color: var(--accent3);
}

.final-ans {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success);
}

/* ============================================================
   MCQ FLASHCARDS
   ============================================================ */
.mcq-score {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 600;
}

.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.flashcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  perspective: 600px;
}

.flashcard:hover {
  border-color: var(--accent1);
  box-shadow: var(--shadow);
}

.fc-question {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.fc-options {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.fc-opt {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
}

.fc-opt.correct {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--success);
  font-weight: 600;
}

.fc-opt.wrong {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.fc-reveal {
  font-size: 0.75rem;
  color: var(--accent1);
  text-align: center;
  margin-top: 0.5rem;
}

.fc-revealed .fc-reveal {
  display: none;
}

/* ============================================================
   CHECKLIST
   ============================================================ */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.checklist-item:hover {
  border-color: var(--accent1);
}

.checklist-item.checked {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}

.checklist-box {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 0.7rem;
}

.checklist-item.checked .checklist-box {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.checklist-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.checklist-item.checked .checklist-text {
  color: var(--success);
  text-decoration: line-through;
}

/* ============================================================
   PROGRESS MODAL — ProgressManager UI
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 440px;
  width: 92%;
  position: relative;
}

.pm-modal {
  /* Works with themes.css drawer (.modal-content) — override colours only */
  background: var(--bg2, var(--card2)) !important;
  border-left: 1px solid rgba(99, 130, 255, 0.25) !important;
  width: 380px !important;
  max-width: 92vw !important;
  overflow-y: auto;
  padding: 1.5rem 1.25rem !important;
}

.modal h3 {
  font-family: var(--font-alt);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.modal-close {
  /* themes.css forces position:static !important on this — we only set interaction styles */
  cursor: pointer;
  transition: color var(--transition), background var(--transition), transform 0.2s;
}

.modal-close:hover {
  color: var(--danger) !important;
  transform: rotate(90deg);
}

/* PM status sub-label */
.pm-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* PM Empty state — shown before any topic is marked done */
.pm-empty-state {
  text-align: center;
  padding: 1.25rem 0.75rem;
  margin: 0.5rem 0;
  background: rgba(99, 130, 255, 0.06);
  border: 1px dashed rgba(99, 130, 255, 0.25);
  border-radius: var(--radius);
}

.pm-empty-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.pm-empty-msg {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.pm-empty-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.pm-hint-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 99px;
  padding: 0.05rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

/* PM Overall bar */
.pm-overall-row {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.pm-overall-pct {
  font-family: var(--font-alt);
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.15rem;
  transition: color 0.4s ease;
}

.pm-overall-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.pm-overall-bar-bg {
  height: 10px;
}

/* PM bar shared */
.pm-bar-bg {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.pm-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.65s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease;
}

/* PM Unit rows */
.progress-units {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.pm-unit-row {}

.pm-unit-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 5px;
  font-size: 0.82rem;
}

.pm-unit-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.pm-unit-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pm-unit-pct {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 2.5rem;
  text-align: right;
  transition: color 0.4s;
}

.pm-bar-bg {
  height: 7px;
}

/* PM Action area */
.pm-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Export / Import row \u2014 side by side */
.pm-io-row {
  display: flex;
  gap: 0.6rem;
}

.pm-io-row .btn-secondary {
  flex: 1;
}

/* Secondary button \u2014 outlined, not filled */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), transform 0.1s;
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--accent1);
  color: var(--accent1);
  background: rgba(99, 130, 255, 0.08);
  transform: translateY(-1px);
}

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

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

/* Danger button \u2014 destructive action (Reset) */
.btn-danger {
  width: 100%;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform 0.1s;
}

.btn-danger:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  transform: translateY(-1px);
}

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

/* Legacy fallback bars (keep for any page that still uses them) */
.progress-overall {}

.progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.progress-bar-bg {
  height: 10px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  /* Smooth width animation — ease-in-out as specified */
  transition: width 0.5s ease-in-out, background 0.4s ease;
}

/* Dynamic color classes — applied by renderProgress() based on % */
.progress-bar-fill.prog-green,
.pm-bar-fill.prog-green {
  background: linear-gradient(90deg, #10b981, #34d399) !important;
}

.progress-bar-fill.prog-yellow,
.pm-bar-fill.prog-yellow {
  background: linear-gradient(90deg, #f59e0b, #fcd34d) !important;
}

.progress-bar-fill.prog-red,
.pm-bar-fill.prog-red {
  background: linear-gradient(90deg, #ef4444, #f97316) !important;
}

/* ── Mark Done Button ── */
.done-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.7rem;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg3);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.done-btn:hover {
  border-color: var(--success);
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.done-btn.done {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--success);
}

/* ── Completed Topic Accordion ── */
.accordion.topic-done .acc-header {
  border-color: rgba(16, 185, 129, 0.4);
}

.accordion.topic-done .acc-header .topic-header>span:first-child {
  color: var(--success);
}

.topic-done-badge {
  margin-right: 2px;
}


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-alt);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--accent1);
}

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

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

/* ============================================================
/* Laptop screen navbar optimization (1024px-1280px) */
@media (max-width: 1280px) and (min-width: 769px) {
  .navbar {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .nav-link {
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
  }

  #globalSearch {
    width: 130px;
  }

  #globalSearch:focus {
    width: 180px;
  }
}

/* Responsive Table Wrappers */
.table-scroll-wrap,
.unit-content table,
.acc-body table,
.section table {
  max-width: 100%;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.25rem;
    z-index: 999;
  }

  .nav-hamburger {
    display: block;
    margin-left: auto;
  }

  .hero-stats {
    gap: 0.75rem;
  }

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

  .pareto-item {
    grid-template-columns: 2rem 1fr auto;
  }

  .pareto-marks {
    display: none;
  }

  .hm-bar-wrap {
    width: 100px;
  }
}

/* Unit colors utility */
[data-ucolor="1"] {
  --unit-color: var(--u1);
}

[data-ucolor="2"] {
  --unit-color: var(--u2);
}

[data-ucolor="3"] {
  --unit-color: var(--u3);
}

[data-ucolor="4"] {
  --unit-color: var(--u4);
}

[data-ucolor="5"] {
  --unit-color: var(--u5);
}

/* ============================================================
   FORMULA SEARCH & FILTER
   ============================================================ */
.formula-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.formula-search {
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
}

.formula-search:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(99, 130, 255, 0.12);
}

.formula-search::placeholder {
  color: var(--text-dim);
}

.btn-clear-search {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn-clear-search:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.formula-unit-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.fuf-pill {
  padding: 0.3rem 0.9rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  transition: all var(--transition);
}

.fuf-pill.active {
  color: white;
  border-color: transparent;
}

.fuf-pill:hover:not(.active) {
  border-color: var(--accent1);
  color: var(--text);
}

.formula-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem;
  font-size: 1rem;
  grid-column: 1/-1;
}

/* formula card copy button & star button */
.formula-card {
  position: relative;
}

.fc-copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 2.5rem;
  background: var(--bg3, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-dim, var(--text-muted));
  cursor: pointer;
  opacity: 0.7;
  transition: all var(--transition, 0.2s ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.formula-card:hover .fc-copy-btn {
  opacity: 1;
}

.fc-copy-btn:hover {
  background: var(--primary, #3b82f6);
  color: var(--primary-contrast, #ffffff);
  border-color: var(--primary, #3b82f6);
}

.f-star-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.35;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 4px;
}

.f-star-btn:hover {
  opacity: 0.8;
  transform: scale(1.15);
}

.f-star-btn.starred {
  opacity: 1;
  color: var(--warning, #f59e0b);
}

/* ============================================================
   FLOATING BACK-TO-TOP BUTTON
   ============================================================ */
.fab-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 900;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  color: white;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 130, 255, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.fab-top.visible {
  display: flex;
}

.fab-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 130, 255, 0.55);
}

/* ============================================================
   COPY TOAST NOTIFICATION
   ============================================================ */
.copy-toast {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  z-index: 1100;
  background: var(--card2);
  border: 1px solid var(--accent5);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem;
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   EXTRA POLISH
   ============================================================ */
.stat-card {
  transition: all var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(99, 130, 255, 0.2);
  border-color: rgba(99, 130, 255, 0.3);
}

.solved-card.expanded .solved-head {
  background: rgba(99, 130, 255, 0.08);
}

/* Pulse ring on hot pareto items */
.pareto-item:nth-child(1) .pareto-freq,
.pareto-item:nth-child(2) .pareto-freq,
.pareto-item:nth-child(3) .pareto-freq {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
  }
}

/* Animated gradient border on hot cards */
.w-card.hot {
  background: linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, var(--accent3), var(--accent1)) border-box;
  border: 1px solid transparent;
}

/* Mobile improvements */
@media (max-width: 768px) {

  .fab-top,
  .fab-scratch,
  .fab-formula,
  .sp-toggle-tab,
  .sp-first-visit-tip {
    display: none !important;
  }

  .fab-swiss-army {
    display: flex;
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 10000;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    color: white;
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    border: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .fab-swiss-army.active {
    transform: rotate(45deg);
  }

  .swiss-menu {
    position: fixed;
    bottom: 9rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 1rem;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .swiss-menu.open {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
  }

  .swiss-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    cursor: pointer;
    background: transparent;
    border: none;
  }

  .swiss-menu-item-label {
    background: var(--card2);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
  }

  .swiss-menu-item-icon {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }

  .swiss-icon-ai {
    background: linear-gradient(135deg, #10b981, #059669);
  }

  .swiss-icon-formula {
    background: linear-gradient(135deg, #a855f7, #6382ff);
  }

  .swiss-icon-scratch {
    background: linear-gradient(135deg, #f59e0b, #d97706);
  }

  .swiss-icon-top {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
  }

  .copy-toast {
    right: 1rem !important;
    bottom: 13.75rem !important;
  }

  .formula-unit-filter {
    display: none;
  }
}

@media (min-width: 769px) {

  .fab-swiss-army,
  .swiss-menu {
    display: none !important;
  }
}

/* Mobile header (< 640px) */
@media (max-width: 640px) {
  .navbar {
    padding: 0 0.75rem !important;
    gap: 0.4rem !important;
  }

  .nav-brand {
    gap: 0.4rem !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }

  .nav-title {
    font-size: 0.88rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
  }

  .nav-sub {
    font-size: 0.58rem !important;
  }

  .nav-actions {
    gap: 0.35rem !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }

  #globalSearch {
    width: 85px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.76rem !important;
    border-radius: 6px !important;
  }

  #globalSearch:focus {
    width: 135px !important;
  }

  .search-results-dropdown {
    width: min(290px, 86vw) !important;
    right: 0 !important;
    max-width: 90vw !important;
  }

  #themeSelectorBtn,
  .btn-theme-selector {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.8rem !important;
  }

  #themeSelectorBtn .btn-text,
  .btn-theme-selector .btn-text {
    display: none !important;
  }

  #progressBtn {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.8rem !important;
  }

  #progressBtn .btn-text {
    display: none !important;
  }
}

/* Focus / Exam Mode in PYQ Viewer */
body.exam-focus-mode .pyq-navbar {
  opacity: 0.15;
  transition: opacity 0.25s ease;
}

body.exam-focus-mode .pyq-navbar:hover {
  opacity: 1;
}

body.exam-focus-mode footer {
  display: none !important;
}

body.exam-focus-mode #paperContentContainer {
  padding: 3rem 4rem;
  max-width: 1020px;
  margin: 0 auto;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  body.exam-focus-mode #paperContentContainer {
    padding: 1.5rem !important;
  }
}

/* Print styles */
@media print {

  .navbar,
  .fab-top,
  .copy-toast,
  .modal-overlay,
  .hero-btns,
  .nav-hamburger,
  .alert-banner {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .section {
    padding: 1.5rem 0;
  }
}

/* ============================================================
   MCQ ACTIVE RECALL — INTERACTIVE OPTIONS
   ============================================================ */
.flashcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: default;
  transition: all var(--transition);
}

.flashcard.fc-correct {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.flashcard.fc-wrong {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

.fc-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.fc-opt-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.fc-opt-btn:hover:not(:disabled) {
  background: rgba(99, 130, 255, 0.12);
  border-color: var(--accent1);
  transform: translateX(2px);
}

.fc-opt-btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.fc-opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.fc-opt-btn.opt-correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.fc-opt-btn.opt-correct .fc-opt-letter {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.fc-opt-btn.opt-wrong {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}

.fc-opt-btn.opt-wrong .fc-opt-letter {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* Shake animation for wrong answer */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-6px);
  }

  30% {
    transform: translateX(5px);
  }

  45% {
    transform: translateX(-4px);
  }

  60% {
    transform: translateX(3px);
  }

  75% {
    transform: translateX(-2px);
  }
}

.shake {
  animation: shake 0.55s ease;
}

/* MCQ Score Bar */
.mcq-scorebar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.mcq-score-item {
  font-size: 0.9rem;
  font-weight: 600;
}

.correct-score {
  color: var(--success);
}

.wrong-score {
  color: var(--danger);
}

.total-score {
  color: var(--text-muted);
}

.mcq-reset-btn {
  margin-left: auto;
  padding: 0.4rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.mcq-reset-btn:hover {
  border-color: var(--accent1);
  color: var(--accent1);
}

/* ============================================================
   PROGRESSIVE STEP REVEAL
   ============================================================ */
.step.step-reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step.step-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.step-answer {
  background: linear-gradient(135deg, var(--accent3), var(--accent5)) !important;
  color: white !important;
  border: none !important;
}

.solved-reveal-wrap {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
}

.btn-reveal-step,
.btn-reveal-all {
  padding: 0.65rem 1.4rem;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(99, 130, 255, 0.3);
}

.btn-reveal-all {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-reveal-step:hover,
.btn-reveal-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 130, 255, 0.45);
}

.btn-reveal-all:hover {
  background: var(--bg3);
  border-color: var(--accent1);
  box-shadow: 0 4px 12px rgba(99, 130, 255, 0.15);
}

.solved-steps-done {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ============================================================
   FORMULA PIN / STAR BUTTON
   ============================================================ */
.fc-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.formula-card:hover .fc-card-actions {
  opacity: 1;
}

.fc-pin-btn,
.fc-copy-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-dim);
  transition: all var(--transition);
  line-height: 1;
}

.fc-pin-btn:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fbbf24;
  color: #fbbf24;
}

.fc-pin-btn.pinned {
  color: #fbbf24;
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  opacity: 1 !important;
}

.fc-copy-btn:hover {
  background: var(--accent1);
  color: white;
  border-color: var(--accent1);
}

/* Always show pin btn on pinned cards */
.pinned-card .fc-card-actions {
  opacity: 1;
}

.pinned-card {
  border-color: rgba(251, 191, 36, 0.35) !important;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2) !important;
}

/* Pinned Row in main formula section */
.pinned-row {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(251, 191, 36, 0.04);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius);
}

.pinned-row-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fbbf24;
  margin-bottom: 0.75rem;
}

/* ============================================================
   FLOATING FORMULA PEEK PANEL
   ============================================================ */
.fab-formula {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: linear-gradient(135deg, #a855f7, #6382ff);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.4);
  transition: all var(--transition);
  font-family: var(--font);
}

.fab-formula:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 28px rgba(168, 85, 247, 0.55);
}

.fab-formula-icon {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.fab-formula-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* Overlay */
.formula-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.formula-peek-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Panel */
.formula-peek-panel {
  position: fixed;
  top: 0;
  right: -420px;
  z-index: 1160;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  background: var(--card2);
  border-left: 1px solid var(--border);
  display: block;
  transition: right 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
}

.formula-peek-panel.open {
  right: 0;
}

.fpp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--card2);
  background-image: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(99, 130, 255, 0.1));
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.fpp-title {
  font-weight: 700;
  font-size: 1rem;
}

.fpp-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.fpp-close:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.fpp-search-wrap {
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

.fpp-search {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition);
}

.fpp-search:focus {
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(99, 130, 255, 0.12);
}

.fpp-section-label {
  padding: 0.25rem 1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  flex-shrink: 0;
}

.fpp-pinned-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  flex-shrink: 0;
}

.fpp-pinned-grid {
  padding: 0 0.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.fpp-grid {
  padding: 0 0.75rem 2rem 0.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.fpp-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: all var(--transition);
  cursor: pointer;
}

.fpp-item:hover {
  border-color: var(--accent1);
  transform: translateY(-1px);
}

.fpp-grid .f-unit,
.fpp-pinned-grid .f-unit {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent3);
  margin-bottom: 0.25rem;
}

.fpp-grid .f-name,
.fpp-pinned-grid .f-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.fpp-grid .f-formula,
.fpp-pinned-grid .f-formula {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--bg3);
  padding: 0.5rem;
  border-radius: 4px;
}

.fpp-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .formula-peek-panel {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }
}

/* ============================================================
   NEW UX FEATURES (Pomodoro, Search, Scratchpad, Print, Conf)
   ============================================================ */

/* Pomodoro Timer */
.pomodoro-timer {
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition);
}

.pomodoro-timer:hover {
  background: var(--border);
}

.pomodoro-timer.break {
  color: var(--success);
}

/* Global Search */
.nav-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

#globalSearch {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  width: 180px;
  outline: none;
  transition: width var(--transition), border-color var(--transition);
}

body.light #globalSearch {
  background: rgba(0, 0, 0, 0.05);
}

#globalSearch:focus {
  width: 250px;
  border-color: var(--accent1);
}

.search-results-dropdown {
  position: absolute;
  top: 130%;
  right: 0;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition);
  display: block;
}

.search-result-item:hover {
  background: var(--card2);
}

.search-result-item:last-child {
  border-bottom: none;
}

.sr-type {
  font-size: 0.7rem;
  color: var(--accent1);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.sr-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Starred Button / Filter */
.utab[data-unit="starred"] {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
  margin-left: auto;
}

.utab[data-unit="starred"].active {
  background: var(--warning);
  color: #000;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.55;
  transition: all var(--transition);
  margin-left: 0.5rem;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: 8px;
  touch-action: manipulation;
}

.star-btn:hover {
  opacity: 0.85;
}

.star-btn:focus-visible {
  outline: 2px solid var(--primary, #f59e0b);
  outline-offset: 2px;
  opacity: 1;
}

.star-btn.starred {
  opacity: 1;
}

@media (max-width: 768px) {
  .star-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
}

.topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qna-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Scratchpad */
.fab-scratch {
  position: fixed;
  bottom: 24px;
  right: 88px;
  /* Next to formula peek */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 998;
  transition: all var(--transition);
}

.fab-scratch:hover {
  transform: translateY(-3px);
  background: var(--border);
}

.fab-scratch-icon {
  font-size: 1.2rem;
}

.scratchpad-panel {
  position: fixed;
  bottom: 6rem;
  right: -400px;
  width: 320px;
  max-width: 90vw;
  height: 400px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1160;
  overflow: hidden;
}

.scratchpad-panel.active {
  right: 2rem;
}

.scratch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card2);
  border-radius: var(--radius) var(--radius) 0 0;
}

.scratch-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.scratch-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.scratch-symbol-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.scratch-symbol-toolbar::-webkit-scrollbar {
  height: 4px;
}

.scratch-symbol-toolbar::-webkit-scrollbar-track {
  background: transparent;
}

.scratch-symbol-toolbar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.scratch-sym-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.35rem;
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-family: var(--font-mono, monospace);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.scratch-sym-btn:hover {
  background: var(--primary, #6366f1);
  color: #fff;
  border-color: var(--primary, #6366f1);
  transform: translateY(-1px);
}

.scratch-sym-btn:active {
  transform: translateY(0) scale(0.95);
}

#scratchText {
  flex: 1;
  background: transparent;
  border: none;
  padding: 1rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: none;
  outline: none;
  line-height: 1.5;
}

/* Confidence Ratings */
.confidence-ratings {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.conf-btn {
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.conf-btn:hover {
  filter: brightness(1.2);
}

.conf-btn.hard {
  border-color: var(--danger);
  color: var(--danger);
}

.conf-btn.med {
  border-color: var(--warning);
  color: var(--warning);
}

.conf-btn.easy {
  border-color: var(--success);
  color: var(--success);
}

.conf-btn.active {
  background: currentColor;
  color: #000;
}

/* Math Fonts */
.math-var {
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 1.1em;
}

/* Personal Notes */
.note-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.3;
  transition: all var(--transition);
  vertical-align: middle;
}

.note-btn:hover {
  opacity: 0.8;
}

.personal-note {
  margin-top: 1rem;
  padding: 0.8rem;
  background: rgba(168, 85, 247, 0.1);
  border: 1px dashed var(--accent2);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

/* --- Missing OS Site Specific Styles --- */

/* Flashcards */
.flashcard {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fc-meta {
  display: flex;
  align-items: center;
}

.fc-unit-badge {
  background: var(--bg2);
  color: var(--text-light);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-weight: 600;
}

.fc-q {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-light);
  line-height: 1.5;
}

.fc-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fc-option {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.fc-option:hover:not(:disabled) {
  background: var(--card2);
  border-color: var(--accent1);
}

.fc-option.correct {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.fc-option.wrong {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.opt-key {
  font-weight: 600;
  color: var(--text-muted);
}

.fc-option.correct .opt-key {
  color: var(--success);
}

.fc-option.wrong .opt-key {
  color: var(--danger);
}

.fc-explanation {
  background: rgba(99, 130, 255, 0.1);
  border-left: 4px solid var(--accent1);
  padding: 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--text-light);
  display: none;
  margin-top: 0.5rem;
}

.confidence-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.conf-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.conf-btn:hover {
  background: var(--card2);
}

.conf-btn.selected-hard {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.conf-btn.selected-medium {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--warning);
  color: var(--warning);
}

.conf-btn.selected-easy {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
  color: var(--success);
}

/* Heatmap Grid */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.hm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Prediction Grid */
.pred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

/* Checklist Items */
.checklist-item.checked {
  opacity: 0.6;
}

.checklist-item.checked .chk-icon {
  filter: grayscale(1);
}

.checklist-item.checked .chk-text {
  text-decoration: line-through;
}

/* Pareto Hot Icon */
.pareto-hot {
  color: #ef4444;
  margin-left: 0.5rem;
  font-size: 0.8rem;
}


/* ===================== SOLVED PYQS ===================== */
.pyq-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.pyq-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}

.pyq-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.pyq-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pyq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pyq-accordion {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s;
}

.pyq-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.03);
}

.pyq-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.pyq-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.pyq-icon {
  transition: transform 0.3s;
}

.pyq-accordion.open .pyq-icon {
  transform: rotate(180deg);
}

.pyq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}

.pyq-accordion.open .pyq-content {
  max-height: 100000px;
  /* accommodate massive PYQ blocks */
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pyq-content p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.pyq-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.pyq-content th,
.pyq-content td {
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  text-align: left;
}

.pyq-content th {
  background: rgba(255, 255, 255, 0.05);
}

/* === PYQ CUSTOM STYLES === */

:root {
  --bg-color: var(--bg2);
  --card-bg: var(--card);
  --text-main: var(--text);
  --text-muted: var(--text-dim);
  --primary: var(--accent1);
  --primary-hover: #4f6bec;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --border: rgba(99, 130, 255, 0.25);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}





.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 3rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.question-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.question-card:hover {
  transform: translateY(-2px);
}

.question-header {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.mcq-options {
  margin-bottom: 1.25rem;
}

.mcq-options ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* --- NEW MCQ INTERACTIVE STYLES --- */
.mcq-options li {
  background-color: var(--bg-color);
  margin-bottom: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mcq-options li:hover:not(.answered-state) {
  background-color: var(--card2);
  border-color: var(--accent1);
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(99, 130, 255, 0.15);
  color: var(--accent1);
}

/* Correct state */
.mcq-options li.correct {
  background-color: rgba(16, 185, 129, 0.08) !important;
  border-color: rgba(16, 185, 129, 0.6) !important;
  color: var(--success) !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
  animation: popCorrect 0.4s ease forwards;
}

.mcq-options li.correct::after {
  content: "✅ Correct";
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

/* Wrong state */
.mcq-options li.wrong {
  background-color: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: var(--danger) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
  animation: shakeWrong 0.4s ease forwards;
}

.mcq-options li.wrong::after {
  content: "❌ Incorrect";
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

/* Prevent interactions after answering */
.mcq-options li.answered-state {
  cursor: default;
}

.mcq-options li.answered-state:not(.correct):not(.wrong) {
  opacity: 0.6;
}

@keyframes popCorrect {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

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

@keyframes shakeWrong {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-4px);
  }

  40%,
  80% {
    transform: translateX(4px);
  }
}

/* ---------------------------------- */

.reveal-solution {
  margin-top: 1rem;
}

.reveal-solution summary {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-block;
  transition: background-color 0.2s ease;
}

.reveal-solution summary::-webkit-details-marker {
  display: none;
}

.reveal-solution summary:hover {
  background-color: var(--primary-hover);
}

.solution-content {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background-color: var(--bg-color);
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  animation: fadeIn 0.3s ease-in-out;
}

.final-answer {
  background-color: var(--success-bg);
  color: var(--success);
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  margin-bottom: 1rem;
  display: inline-block;
}

.step-by-step {
  font-size: 0.95rem;
}

.step-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

ol,
ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background-color: var(--card);
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
  color: var(--text);
}

th {
  background-color: var(--card2);
  font-weight: 600;
}

pre {
  background: var(--bg3);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  color: var(--text);
  margin: 1rem 0;
}

pre code,
.acc-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

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

/* --- PYQ LINK CARDS --- */
.pyq-card-link {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(145deg, var(--card2), rgba(99, 130, 255, 0.03));
  border: 1px solid rgba(99, 130, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1 1 320px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.pyq-card-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent1);
  border-radius: 4px 0 0 4px;
  transform: scaleY(0.3);
  opacity: 0;
  transition: all 0.3s ease;
}

.pyq-card-link:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 130, 255, 0.3);
  box-shadow: 0 10px 30px rgba(99, 130, 255, 0.15);
}

.pyq-card-link:hover::before {
  transform: scaleY(1);
  opacity: 1;
}

.pyq-card-icon {
  font-size: 1.75rem;
  width: 54px;
  height: 54px;
  background: rgba(99, 130, 255, 0.1);
  color: var(--accent1);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(99, 130, 255, 0.15);
}

.pyq-card-icon svg {
  width: 28px;
  height: 28px;
}

.pyq-card-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pyq-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-alt);
}

.pyq-card-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pyq-card-link:hover .pyq-card-subtitle {
  color: var(--accent1);
}

/* ══════════════════════════════════════════════════════════════
   PYQ TIERED ARCHITECTURE (OPTION 1: STACKED TIERS)
   ══════════════════════════════════════════════════════════════ */
.pyq-tier {
  margin-top: 1.5rem;
}

.pyq-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pyq-tier-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pyq-tier-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.pyq-tier-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  font-family: var(--font-alt, inherit);
  letter-spacing: -0.01em;
}

.pyq-tier-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(99, 130, 255, 0.12);
  color: var(--accent1, #818cf8);
  border: 1px solid rgba(99, 130, 255, 0.25);
  letter-spacing: 0.02em;
}

.pyq-tier-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border, rgba(255, 255, 255, 0.1)), transparent);
  margin: 3rem 0 2rem;
}

/* Vault Grid */
.pyq-vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.pyq-vault-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  background: linear-gradient(145deg, var(--card2, #181926), rgba(99, 130, 255, 0.02));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius, 12px);
  color: var(--text);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.pyq-vault-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 130, 255, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.pyq-vault-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pyq-vault-icon-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pyq-vault-icon {
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 130, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(99, 130, 255, 0.15);
}

.pyq-vault-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pyq-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.tag-endsem {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.tag-ct {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-model {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-other {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.tag-fmt {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pyq-vault-card-body {
  margin-bottom: 1.1rem;
}

.pyq-vault-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #f1f5f9);
  margin: 0 0 0.35rem 0;
  line-height: 1.4;
  word-break: break-word;
}

.pyq-vault-meta {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pyq-vault-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
}

.pyq-vault-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.pyq-vault-btn-preview {
  background: rgba(99, 130, 255, 0.12);
  color: var(--accent1, #818cf8);
  border-color: rgba(99, 130, 255, 0.25);
}

.pyq-vault-btn-preview:hover {
  background: rgba(99, 130, 255, 0.22);
  border-color: rgba(99, 130, 255, 0.4);
  color: #fff;
}

.pyq-vault-btn-download {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted, #94a3b8);
  border-color: rgba(255, 255, 255, 0.1);
}

.pyq-vault-btn-download:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  border-color: rgba(255, 255, 255, 0.2);
}

.pyq-empty-state,
.pyq-loading-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-radius: var(--radius, 12px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-muted, #94a3b8);
  font-size: 0.92rem;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.pyq-pending-banner {
  padding: 1.1rem 1.4rem;
  border-radius: 12px;
  background: rgba(99, 130, 255, 0.06);
  border: 1px solid rgba(99, 130, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- BACK BUTTON --- */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  font-size: 0.95rem;
  margin-right: 1.5rem;
}

.btn-back:hover {
  background: rgba(99, 130, 255, 0.15);
  border-color: rgba(99, 130, 255, 0.3);
  color: var(--accent1);
  transform: translateX(-2px);
}

.btn-back svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn-back:hover svg {
  transform: translateX(-3px);
}


/* PYQ Viewer Fixes */
#paperContent h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

#paperContent p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

#paperContent h2 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}


/* ── Smart Image Parser Styles ── */
.parsed-image-wrapper {
  width: 100%;
  max-width: 600px;
  margin: 1.5rem auto;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.parsed-image-wrapper:hover {
  transform: scale(1.02);
  border-color: rgba(255, 255, 255, 0.2);
}

.parsed-image {
  width: 100%;
  height: auto;
  display: block;
  mix-blend-mode: normal;
}

body.light-mode .parsed-image-wrapper {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}


/* ── Diagram CSS (from user workflow) ── */
.diagram-wrapper {
  margin: 16px 0;
  text-align: center;
}

.study-diagram {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
}

.caption {
  font-size: 0.85rem;
  color: #a0aec0;
  margin-top: 6px;
}

/* Fix for MathJax overflow in formula cards */
.f-formula,
.fc-formula {
  overflow-x: auto !important;
  max-width: 100%;
}

mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.f-formula::-webkit-scrollbar,
.fc-formula::-webkit-scrollbar,
mjx-container::-webkit-scrollbar {
  height: 4px;
}

.f-formula::-webkit-scrollbar-track,
.fc-formula::-webkit-scrollbar-track,
mjx-container::-webkit-scrollbar-track {
  background: transparent;
}

.f-formula::-webkit-scrollbar-thumb,
.fc-formula::-webkit-scrollbar-thumb,
mjx-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.f-formula::-webkit-scrollbar-thumb:hover,
.fc-formula::-webkit-scrollbar-thumb:hover,
mjx-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Ensure PYQ text is fully bright and readable in default dark mode without an active custom theme */
body.dark-theme:not([class*="theme-"]) #paperContent,
body.dark-theme:not([class*="theme-"]) #paperContent .question-text,
body.dark-theme:not([class*="theme-"]) #paperContent p,
body.dark-theme:not([class*="theme-"]) #paperContent li,
body.dark-theme:not([class*="theme-"]) #paperContent span.step-title,
body.dark-theme:not([class*="theme-"]) #paperContent div.step {
  color: #f8fafc !important;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.1);
}

/* ============================================================
   SMART STUDY HUB — SMART PANEL CONTENT SHRINK RULES
   ============================================================ */
@media (min-width: 1025px) {
  body.panel-open {
    padding-right: var(--sp-width, 440px);
    transition: padding-right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.panel-open .navbar {
    right: var(--sp-width, 440px) !important;
    padding: 0 1rem !important;
    gap: 0.5rem !important;
    transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.panel-open .nav-links {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.15rem;
  }

  body.panel-open .nav-links::-webkit-scrollbar {
    display: none;
  }

  body.panel-open .nav-link {
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  body.panel-open .nav-actions {
    flex-shrink: 0;
    margin-left: auto;
  }

  body.panel-open .fab-top {
    right: calc(var(--sp-width, 440px) + 1.5rem) !important;
  }

  body.panel-open .fab-formula {
    right: calc(var(--sp-width, 440px) + 1.5rem) !important;
  }
}

/* ── Model Switcher Styles ── */
.sp-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card2, #181926);
  border: 1px solid var(--border, #334155);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text, #f1f5f9);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.sp-model-pill:hover {
  background: rgba(99, 130, 255, 0.15);
  border-color: rgba(99, 130, 255, 0.4);
}

.sp-model-pill-icon {
  font-size: 0.85rem;
}

.sp-model-pill-name {
  white-space: nowrap;
}

.sp-model-pill-caret {
  opacity: 0.6;
  font-size: 0.7rem;
  margin-left: 2px;
}

.sp-model-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: 280px;
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 10010;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sp-model-popover-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.1);
}

.sp-model-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--text, #f1f5f9);
  transition: background 0.15s ease;
}

.sp-model-popover-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sp-model-popover-item.active {
  background: rgba(99, 130, 255, 0.15);
  color: var(--accent1, #818cf8);
}

.sp-model-popover-item.locked {
  opacity: 0.5;
}

.sp-model-item-check {
  font-size: 0.8rem;
  min-width: 12px;
  opacity: 0.5;
}

.sp-model-popover-item.active .sp-model-item-check {
  opacity: 1;
}

.sp-model-item-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sp-model-item-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.sp-model-item-desc {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
  margin-top: 2px;
}

.sp-model-no-key {
  font-size: 0.7rem;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.sp-model-popover-sep {
  height: 1px;
  background: var(--border, #334155);
}