/* ============================================================
   VasmuStudy — Common Chemistry Chapter CSS
   Works for chapter1.html through chapter15.html
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #faf7ff;
  --alt: #f3ebff;
  --card: #fff;
  --ink: #1a0f2e;
  --muted: #6b5b7e;
  --border: rgba(124, 58, 237, 0.14);
  --sh: 0 1px 2px rgba(26, 15, 46, 0.06), 0 2px 8px rgba(124, 58, 237, 0.06);
  --serif: "Playfair Display", Georgia, serif;
  --body: "Lora", Georgia, serif;
  --ui: "Inter", system-ui, sans-serif;
  --violet: #7c3aed;
  --violet-d: #5b21b6;
  --magenta: #c026d3;
  --pink: #ec4899;
  --indigo: #4f46e5;
  --teal: #0d9488;
  --amber: #d97706;
}

html.dark {
  --bg: #0f0820;
  --alt: #1a0f2e;
  --card: #231438;
  --ink: #ede9fe;
  --muted: #a78bfa;
  --border: rgba(167, 139, 250, 0.18);
  --sh: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   BASE
   ============================================================ */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  font-size: 17px;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.pt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 999;
}
#progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7c3aed, #c026d3, #ec4899);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
  transition: width 0.1s linear;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(250, 247, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
html.dark .nav {
  background: rgba(15, 8, 32, 0.94);
}
.ni {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.nl {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
}
.nl::-webkit-scrollbar {
  display: none;
}
.nl a {
  font: 500 13px var(--ui);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  transition: 0.2s;
  position: relative;
}
.nl a:hover {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
}
.nl a.read::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 9px;
  color: #059669;
  font-weight: 900;
}

/* ============================================================
   HEADER BRAND (fixed)
   ============================================================ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  flex: none;
  display: block;
  background: #fff;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.brand-words {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--ui);
  font-weight: 800;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-name .accent {
  color: #7c3aed;
}
.brand-tag {
  font-family: var(--ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.2;
}
html.dark .brand-logo {
  background: #fff;
}
html.dark .brand-name {
  color: var(--ink);
}
html.dark .brand-name .accent {
  color: #c084fc;
}
html.dark .brand-tag {
  color: var(--muted);
}

/* ============================================================
   THEME + PRINT BUTTONS
   ============================================================ */
.theme-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  transition: 0.2s;
  margin-left: 8px;
  flex: none;
}
.theme-btn:hover {
  border-color: #7c3aed;
}
.print-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: 0.2s;
  margin-left: 4px;
  font-family: var(--ui);
  flex: none;
}
.print-btn:hover {
  border-color: #7c3aed;
  color: #7c3aed;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.bc {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 0;
  font: 13px var(--ui);
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.bc a {
  color: #7c3aed;
  text-decoration: none;
  font-weight: 600;
}
.chapter-nav-top {
  margin-left: auto;
  display: flex;
  gap: 6px;
  font-size: 12px;
}
.chapter-nav-top a {
  background: rgba(124, 58, 237, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  color: #7c3aed !important;
  font-weight: 700;
}
.chapter-nav-top a:hover {
  background: rgba(124, 58, 237, 0.2);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 70px 24px 78px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(124, 58, 237, 0.18), transparent 62%),
    radial-gradient(800px 480px at 95% 10%, rgba(192, 38, 211, 0.16), transparent 60%),
    linear-gradient(180deg, var(--card), var(--alt));
  border-bottom: 1px solid var(--border);
}
.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.hero > div {
  position: relative;
  z-index: 1;
}
.eyebrow {
  display: inline-block;
  font: 700 12px var(--ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.22);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.difficulty-badge {
  display: inline-block;
  font: 700 11px var(--ui);
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  padding: 4px 12px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.legacy-badge {
  display: inline-block;
  font: 700 11px var(--ui);
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
  padding: 4px 12px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
html.dark .difficulty-badge {
  background: rgba(217, 119, 6, 0.2);
  color: #fcd34d;
  border-color: rgba(217, 119, 6, 0.4);
}
html.dark .legacy-badge {
  background: rgba(217, 119, 6, 0.3);
  color: #fcd34d;
  border-color: rgba(217, 119, 6, 0.5);
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 5vw, 3.1rem);
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 span {
  background: linear-gradient(120deg, #7c3aed, #c026d3, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede {
  color: var(--muted);
  max-width: 700px;
  margin: 0 auto 20px;
}
.meta-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font: 600 13px var(--ui);
  color: var(--muted);
  margin-top: 8px;
}
.meta-info span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ============================================================
   STATS
   ============================================================ */
.stats {
  max-width: 1000px;
  margin: -32px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 3;
}
.si {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 28px;
  box-shadow: 0 18px 48px rgba(124, 58, 237, 0.14);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  text-align: center;
}
.sn {
  font: 800 2rem var(--serif);
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
}
.sl {
  font: 600 12px var(--ui);
  color: var(--muted);
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  padding: 60px 24px;
}
.w {
  max-width: 920px;
  margin: 0 auto;
}
.alt {
  background: var(--alt);
  border-block: 1px solid var(--border);
}
.sh {
  margin-bottom: 34px;
}
.sh.c {
  text-align: center;
}
.sh h2 {
  font: 700 clamp(1.6rem, 3.6vw, 2.2rem) / 1.2 var(--serif);
  margin-bottom: 8px;
}
.kicker {
  font: 700 12px var(--ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7c3aed;
  display: block;
  margin-bottom: 8px;
}
.sec-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.read-btn {
  font: 600 12px var(--ui);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.read-btn:hover {
  border-color: #7c3aed;
  color: #7c3aed;
}
.read-btn.done {
  background: rgba(5, 150, 105, 0.1);
  border-color: #059669;
  color: #059669;
}
.read-btn.done:before {
  content: "✓ ";
  font-weight: 900;
}
html.dark .read-btn {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.3);
  color: #c4b5fd;
}
html.dark .read-btn.done {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* ============================================================
   CONTENT CARDS
   ============================================================ */
.cc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 30px 32px;
  box-shadow: var(--sh);
  margin-bottom: 20px;
  transition: background 0.3s;
}
.cc h3 {
  font: 700 1.32rem var(--serif);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cc h4 {
  font: 700 1.08rem var(--serif);
  margin: 20px 0 12px;
  color: var(--ink);
}
.badge {
  font: 800 11px var(--ui);
  color: #fff;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.cc p,
.cc li {
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.8;
  opacity: 0.9;
}
.cc ul,
.cc ol {
  padding-left: 24px;
}
.cc strong {
  color: var(--ink);
  font-weight: 700;
}

/* ============================================================
   CALLOUT BOXES
   ============================================================ */
.def,
.note,
.exam,
.real,
.mistake,
.why,
.analogy,
.trap,
.try,
.takeaway,
.did-you-know,
.mnemonic-box {
  border-radius: 0 14px 14px 0;
  padding: 16px 22px;
  margin: 16px 0;
}
.def {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06), rgba(192, 38, 211, 0.04));
  border-left: 4px solid #7c3aed;
}
.def i {
  font: 800 11px var(--ui);
  color: #7c3aed;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
  font-style: normal;
}
.def p {
  margin: 0 0 6px;
  color: var(--ink);
}
.def p:last-child {
  margin-bottom: 0;
}

.real {
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border-left: 4px solid #d97706;
}
.real i {
  font: 800 11px var(--ui);
  color: #b45309;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.real i:before { content: "🌍"; font-size: 14px; }
.real p { margin: 0 0 8px; color: #78350f; font-size: 15.5px; }
.real ul { margin: 6px 0 0; padding-left: 22px; color: #78350f; font-size: 15.5px; }
.real ul li { margin-bottom: 6px; }
html.dark .real {
  background: linear-gradient(135deg, #2a2308, #3a2e0a);
  border-left-color: #d97706;
}
html.dark .real p, html.dark .real ul, html.dark .real li { color: #fcd34d; }
html.dark .real i { color: #fbbf24; }

.mistake {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-left: 4px solid #dc2626;
}
.mistake i {
  font: 800 11px var(--ui);
  color: #991b1b;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.mistake i:before { content: "⚠️"; font-size: 14px; }
.mistake p { color: #7f1d1d; font-size: 15.5px; margin: 0 0 6px; }
html.dark .mistake {
  background: linear-gradient(135deg, #3a0d0d, #4a1414);
  border-left-color: #dc2626;
}
html.dark .mistake p { color: #fca5a5; }
html.dark .mistake i { color: #f87171; }

.why {
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  border-left: 4px solid #7c3aed;
}
.why i {
  font: 800 11px var(--ui);
  color: #6d28d9;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.why i:before { content: "💡"; font-size: 14px; }
.why p { color: #4c1d95; font-size: 15.5px; margin: 0; }
html.dark .why {
  background: linear-gradient(135deg, #1a0f2e, #231438);
  border-left-color: #a855f7;
}
html.dark .why p { color: #c4b5fd; }

.analogy {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  border-left: 4px solid #ec4899;
}
.analogy i {
  font: 800 11px var(--ui);
  color: #9d174d;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.analogy i:before { content: "🎯"; font-size: 14px; }
.analogy p { color: #831843; font-size: 15.5px; margin: 0; }
html.dark .analogy {
  background: linear-gradient(135deg, #1e0f3d, #26144f);
  border-left-color: #7c3aed;
}
html.dark .analogy p { color: #c4b5fd; }

.trap {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-left: 4px solid #ea580c;
}
.trap i {
  font: 800 11px var(--ui);
  color: #9a3412;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.trap i:before { content: "🎯"; font-size: 14px; }
.trap p { color: #7c2d12; font-size: 15.5px; margin: 0; }
html.dark .trap {
  background: linear-gradient(135deg, #3a1d08, #4a2610);
  border-left-color: #ea580c;
}
html.dark .trap p { color: #fdba74; }

.try {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-left: 4px solid #059669;
}
.try i {
  font: 800 11px var(--ui);
  color: #065f46;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.try i:before { content: "🧪"; font-size: 14px; }
.try p, .try ul { color: #064e3b; font-size: 15.5px; margin: 0 0 6px; }
.try ul { padding-left: 22px; }
html.dark .try {
  background: linear-gradient(135deg, #082a1d, #0a3527);
  border-left-color: #059669;
}
html.dark .try p, html.dark .try li { color: #6ee7b7; }

.note {
  background: rgba(192, 38, 211, 0.07);
  border: 1px solid rgba(192, 38, 211, 0.22);
  border-radius: 14px;
}
.note i {
  font: 800 11px var(--ui);
  color: #c026d3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
  font-style: normal;
}
.note p { margin: 0; }
html.dark .note { background: rgba(192, 38, 211, 0.12); }

.exam {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-left: 4px solid #a855f7;
  color: #4c1d95;
}
.exam p { color: #4c1d95; }
html.dark .exam {
  background: linear-gradient(135deg, #1a0f2e, #231438);
  color: #c4b5fd;
}

.takeaway {
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  border-left: 4px solid #a855f7;
  margin-top: 24px;
  padding: 14px 20px;
}
.takeaway i {
  font: 800 11px var(--ui);
  color: #6d28d9;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-style: normal;
}
.takeaway i:before { content: "🔑"; font-size: 14px; }
.takeaway p {
  margin: 0;
  color: #4c1d95;
  font-size: 15.5px;
  font-weight: 500;
}
html.dark .takeaway {
  background: linear-gradient(135deg, #1a0f2e, #231438);
  border-left-color: #a855f7;
}
html.dark .takeaway p { color: #c4b5fd; }

.did-you-know {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border: 2px dashed #0891b2;
  border-radius: 14px;
  padding: 16px 22px;
  margin: 20px 0;
}
.did-you-know i {
  font: 800 11px var(--ui);
  color: #0891b2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-style: normal;
}
.did-you-know i:before { content: "💎"; font-size: 14px; }
.did-you-know p {
  margin: 0;
  color: #0c4a6e;
  font-size: 15px;
  line-height: 1.65;
}
html.dark .did-you-know {
  background: linear-gradient(135deg, #1a0f2e, #2a1a40);
  border-color: rgba(168, 85, 247, 0.3);
}
html.dark .did-you-know p { color: #c4b5fd; }

.mnemonic-box {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  border-left: 4px solid #d97706;
  border-radius: 0 14px 14px 0;
  padding: 16px 22px;
  margin: 16px 0;
}
.mnemonic-box i {
  font: 800 11px var(--ui);
  color: #92400e;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-style: normal;
}
.mnemonic-box i:before { content: "🧠"; font-size: 14px; }
.mnemonic-box p, .mnemonic-box ul {
  margin: 0 0 8px;
  color: #78350f;
  font-size: 15.5px;
  line-height: 1.7;
}
.mnemonic-box ul { padding-left: 22px; }
.mnemonic-box strong { color: #7c2d12; }
html.dark .mnemonic-box {
  background: linear-gradient(135deg, #1a0f2e, #231438);
  border-color: rgba(192, 38, 211, 0.3);
}

/* ============================================================
   TABLES
   ============================================================ */
.tw {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin: 18px 0;
  background: var(--card);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 15px;
}
thead {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  font-family: var(--ui);
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td {
  padding: 12px 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.7;
  opacity: 0.9;
}
td:first-child { font-weight: 700; color: var(--ink); }
html.dark table { color: #cbd5e1; }
html.dark td { color: #cbd5e1; }
html.dark td:first-child { color: #e9d5ff; }

/* ============================================================
   VIZ / SVG DIAGRAMS
   ============================================================ */
.viz {
  background: #f8f5ff;
  border: 1.5px solid rgba(124, 58, 237, 0.18);
  border-radius: 16px;
  padding: 20px 14px;
  margin: 20px 0;
  text-align: center;
  overflow-x: auto;
  position: relative;
}
.viz > b {
  font: 800 11px var(--ui);
  color: #7c3aed;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}
.viz svg {
  width: 100%;
  min-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.cap {
  font: italic 13px var(--ui);
  color: #6b5b7e;
  margin-top: 12px;
}
html.dark .viz { background: #f8f5ff; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes dashFlow { to { stroke-dashoffset: -40; } }
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
@keyframes particleFloat {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}
@keyframes electronFlow { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -40; } }

.flow-line { stroke-dasharray: 6 10; animation: dashFlow 2s linear infinite; }
.electron-flow { stroke-dasharray: 8 6; animation: electronFlow 1.5s linear infinite; }

.hero-particles span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #a855f7, #7c3aed);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.9);
  animation: particleFloat 6s ease-in-out infinite;
}
.hero-particles span:nth-child(1) { top: 20%; left: 12%; --dx: 60px; --dy: -40px; }
.hero-particles span:nth-child(2) { top: 60%; left: 8%; --dx: 40px; --dy: -80px; animation-delay: 1.2s; }
.hero-particles span:nth-child(3) { top: 30%; right: 15%; --dx: -50px; --dy: 50px; animation-delay: 0.6s; }
.hero-particles span:nth-child(4) { top: 75%; right: 10%; --dx: -60px; --dy: -30px; animation-delay: 2s; }
.hero-particles span:nth-child(5) { top: 15%; left: 50%; --dx: 30px; --dy: 60px; animation-delay: 1.6s; }
.hero-particles span:nth-child(6) { top: 80%; left: 40%; --dx: -30px; --dy: -50px; animation-delay: 0.4s; }

/* ============================================================
   INTERACTIVE / CALCULATORS
   ============================================================ */
.interactive {
  background: var(--card);
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--sh);
}
.interactive h4 {
  font: 800 15px var(--ui);
  color: #7c3aed;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.interactive h4:before { content: "🎮"; font-size: 18px; }
html.dark .interactive {
  background: #1a0f2e;
  border-color: rgba(168, 85, 247, 0.3);
}
html.dark .interactive h4 { color: #c4b5fd; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.calc-field { display: flex; flex-direction: column; gap: 4px; }
.calc-field label {
  font: 600 12px var(--ui);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.calc-input {
  width: 100%;
  padding: 10px 14px;
  font: 600 14px var(--ui);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s;
}
.calc-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
html.dark .calc-input {
  background: #2a1a40;
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.3);
}
select {
  width: 100%;
  padding: 10px 14px;
  font: 600 14px var(--ui);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
html.dark select {
  background: #2a1a40;
  color: #cbd5e1;
  border-color: rgba(168, 85, 247, 0.3);
}
.calc-btn {
  font: 700 14px var(--ui);
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
  width: 100%;
}
.calc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}
.calc-results {
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  padding: 16px;
  border-radius: 12px;
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
html.dark .calc-results { background: linear-gradient(135deg, #1a0f2e, #231438); }
.calc-results .res-item {
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}
html.dark .calc-results .res-item {
  background: #2a1a40;
  border-color: rgba(168, 85, 247, 0.3);
}
.calc-results .lbl {
  font: 700 11px var(--ui);
  color: #6b5b7e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.calc-results .val {
  font-size: 16px;
  font-weight: 800;
  color: #7c3aed;
  display: block;
  margin-top: 2px;
  font-family: var(--body);
}
.calc-results .val.small { font-size: 13px; font-weight: 700; }
html.dark .calc-results .lbl { color: #a78bfa; }
html.dark .calc-results .val { color: #c084fc; }

/* ============================================================
   NCERT ACCORDION
   ============================================================ */
.ncert-q {
  background: var(--card);
  border: 1.5px solid rgba(124, 58, 237, 0.25);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 14px 0;
  box-shadow: var(--sh);
}
.ncert-q .qnum {
  display: inline-block;
  font: 800 11px var(--ui);
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.06em;
}
.ncert-q .qtext {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.7;
}
.ncert-q details {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  background: rgba(124, 58, 237, 0.03);
}
html.dark .ncert-q details { background: rgba(168, 85, 247, 0.08); }
.ncert-q summary {
  cursor: pointer;
  font: 700 13px var(--ui);
  color: #7c3aed;
  user-select: none;
  list-style: none;
}
.ncert-q summary::before {
  content: "▶ ";
  font-size: 10px;
  margin-right: 4px;
  display: inline-block;
  transition: transform 0.2s;
}
.ncert-q details[open] summary::before { transform: rotate(90deg); }
.ncert-q details .sol {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  opacity: 0.9;
}
html.dark .ncert-q {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.25);
}

/* ============================================================
   SUMMARY / EXAM BOXES
   ============================================================ */
.summary-box {
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-radius: 18px;
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--sh);
}
.summary-box h3 {
  font: 800 20px var(--serif);
  color: #5b21b6;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.summary-box h3:before { content: "📌"; font-size: 24px; }
.summary-box ol {
  padding-left: 28px;
  counter-reset: item;
}
.summary-box li {
  font-size: 15.5px;
  line-height: 1.85;
  margin-bottom: 10px;
  color: #1a0f2e;
  padding-left: 8px;
}
.summary-box li strong { color: #5b21b6; font-weight: 800; }
html.dark .summary-box {
  background: #1a0f2e;
  border-color: rgba(168, 85, 247, 0.3);
}
html.dark .summary-box li { color: #cbd5e1; }

.exam-q-box {
  background: var(--card);
  border: 1.5px solid rgba(124, 58, 237, 0.25);
  border-radius: 18px;
  padding: 26px;
  margin: 20px 0;
  box-shadow: var(--sh);
}
.exam-q-box h4 {
  font: 800 16px var(--ui);
  color: #7c3aed;
  margin: 18px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(124, 58, 237, 0.2);
}
.exam-q-box h4:first-child { margin-top: 0; }
.exam-q-box ol { padding-left: 26px; }
.exam-q-box li {
  font-size: 15.5px;
  line-height: 1.8;
  margin-bottom: 10px;
  color: var(--ink);
}
html.dark .exam-q-box {
  background: #1a0f2e;
  border-color: rgba(168, 85, 247, 0.3);
}

/* ============================================================
   CONSTANTS TABLE
   ============================================================ */
.constants-table {
  background: var(--card);
  border: 1.5px solid rgba(124, 58, 237, 0.25);
  border-radius: 14px;
  padding: 20px;
  margin: 20px 0;
  overflow-x: auto;
}
.constants-table h4 {
  font: 800 14px var(--ui);
  color: #7c3aed;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.constants-table h4:before { content: "📊"; font-size: 16px; }
.constants-table table { min-width: 400px; font-size: 14px; }
.constants-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.constants-table td:first-child { font-weight: 700; color: var(--ink); width: 50%; }
.constants-table td:nth-child(2) {
  font-family: "Cambria Math", Georgia, serif;
  color: #7c3aed;
  font-weight: 700;
}
.constants-table td:nth-child(3) { color: var(--muted); font-size: 13px; }
html.dark .constants-table {
  background: #1a0f2e;
}
html.dark .constants-table td { color: #cbd5e1; }

/* ============================================================
   FLASHCARDS
   ============================================================ */
.flashcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.flashcard {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--sh);
}
.flashcard-face {
  text-align: center;
  font: 700 14px var(--ui);
  color: var(--ink);
  line-height: 1.4;
}
.flashcard-back {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.09);
  color: var(--violet-d);
  font-family: "Cambria Math", Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}
html.dark .flashcard-face { color: #e9d5ff; }
html.dark .flashcard-back { background: rgba(168, 85, 247, 0.15); color: #ddd6fe; }

/* Static flashcards (chapter 3+) */
.flashcard-static {
  background: var(--card);
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-radius: 14px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: var(--sh);
  transition: 0.2s;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.flashcard-static:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.18);
  border-color: #7c3aed;
}
.flashcard-static .fc-title {
  font: 700 13.5px var(--ui);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.4;
}
.flashcard-static .fc-formula {
  font: 700 15px "Cambria Math", Georgia, serif;
  color: #7c3aed;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(192, 38, 211, 0.05));
  border-radius: 8px;
  line-height: 1.5;
}
html.dark .flashcard-static {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.3);
}
html.dark .flashcard-static .fc-title { color: #a78bfa; }
html.dark .flashcard-static .fc-formula {
  color: #c084fc;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(192, 38, 211, 0.08));
}

/* ============================================================
   RELATED LINKS
   ============================================================ */
.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.related-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--ink);
  transition: 0.2s;
  font: 600 14px var(--ui);
}
.related-links a:hover {
  transform: translateY(-2px);
  border-color: #7c3aed;
  box-shadow: var(--sh);
}
.related-links .ico { font-size: 22px; }
html.dark .related-links a {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.3);
  color: #c4b5fd;
}

/* ============================================================
   CHAPTER PREV/NEXT
   ============================================================ */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 40px 0 20px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}
.chapter-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: 0.2s;
}
.chapter-nav a:hover {
  transform: translateY(-2px);
  border-color: #7c3aed;
  box-shadow: var(--sh);
}
.chapter-nav .nav-dir {
  font: 700 11px var(--ui);
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.chapter-nav .nav-title { font: 700 15px var(--ui); }
.chapter-nav .next { text-align: right; }
html.dark .chapter-nav a {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.3);
  color: #c4b5fd;
}

/* ============================================================
   FORMULA SHEET
   ============================================================ */
.formula-sheet {
  background: var(--card);
  border: 1.5px solid rgba(124, 58, 237, 0.25);
  border-radius: 18px;
  padding: 28px;
  margin: 24px 0;
  box-shadow: var(--sh);
}
.formula-sheet h3 {
  font: 800 18px var(--serif);
  color: #7c3aed;
  margin-bottom: 20px;
  text-align: center;
}
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.formula-item {
  background: var(--alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: 0.2s;
}
.formula-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.15);
}
.formula-item .ftitle {
  font: 800 11px var(--ui);
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.formula-item .fmath {
  font: 600 15px "Cambria Math", Georgia, serif;
  color: var(--ink);
  line-height: 1.5;
}
html.dark .formula-sheet { background: #231438; }
html.dark .formula-item {
  background: #1a0f2e;
  border-color: rgba(168, 85, 247, 0.2);
}
html.dark .formula-item .ftitle { color: #c4b5fd; }

/* ============================================================
   NOTATION TABLE
   ============================================================ */
.notation {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin: 20px 0;
}
.notation h4 {
  font: 800 13px var(--ui);
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.notation table { min-width: 100%; font-size: 14px; }
.notation td {
  padding: 8px 12px;
  border-bottom: 1px dashed var(--border);
}
.notation td:first-child {
  font-family: var(--ui);
  font-weight: 800;
  color: #7c3aed;
  width: 80px;
}
html.dark .notation { background: #1a0f2e; }
html.dark .notation td { color: #cbd5e1; }

/* ============================================================
   FLOW DIAGRAM
   ============================================================ */
.flow-wrap {
  overflow-x: auto;
  margin: 20px 0;
  padding: 10px 0;
}
.flow-svg {
  min-width: 700px;
  width: 100%;
  height: auto;
}
.flow-node {
  fill: #fff;
  stroke: #7c3aed;
  stroke-width: 2;
}
.flow-node-text {
  fill: #6d28d9;
  font-weight: 700;
  font-family: Inter, Arial;
  font-size: 11px;
  text-anchor: middle;
}
.flow-arrow {
  stroke: #7c3aed;
  stroke-width: 2;
  fill: none;
}
html.dark .flow-node { fill: #231438; stroke: #a855f7; }
html.dark .flow-node-text { fill: #c4b5fd; }
html.dark .flow-arrow { stroke: #a855f7; }

/* ============================================================
   SHOW ANSWER ACCORDIONS (SA)
   ============================================================ */
.sa {
  margin: 16px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(124, 58, 237, 0.22);
  background: var(--card);
}
.sa button {
  font: 700 14px var(--ui);
  width: 100%;
  text-align: left;
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border: 0;
  padding: 14px 20px;
  cursor: pointer;
  transition: 0.2s;
}
.sa button:hover { background: rgba(124, 58, 237, 0.14); }
.sa .b {
  display: none;
  padding: 18px 22px;
  border-top: 1px dashed rgba(124, 58, 237, 0.25);
}
.sa.open .b { display: block; }
.sa.open button span { display: inline-block; transform: rotate(90deg); }
html.dark .sa {
  background: #231438;
  border-color: rgba(168, 85, 247, 0.3);
}
html.dark .sa button {
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
}
html.dark .sa .b { border-top-color: rgba(168, 85, 247, 0.3); }

/* Steps inside answers */
.step {
  background: var(--alt);
  border-left: 4px solid #7c3aed;
  border-radius: 0 12px 12px 0;
  padding: 12px 18px;
  margin: 10px 0;
}
.step h6 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font: 800 13px var(--ui);
  color: #7c3aed;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.step h6 em {
  font-style: normal;
  font-size: 11.5px;
  background: #7c3aed;
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.step p {
  margin: 4px 0;
  font-size: 15px;
  color: var(--ink);
  opacity: 0.9;
}
html.dark .step { background: #1a0f2e; }
html.dark .step p { color: #cbd5e1; }

.fa {
  background: rgba(5, 150, 105, 0.1);
  border: 1.5px solid rgba(5, 150, 105, 0.3);
  border-radius: 12px;
  padding: 12px 18px;
  margin-top: 12px;
  font-weight: 600;
  color: #065f46;
}
.fa:before { content: "✓ "; }
html.dark .fa {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.mt {
  display: inline-block;
  font: 700 12px var(--ui);
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* ============================================================
   MCQ / ASSERTION-REASON
   ============================================================ */
.qf {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--sh);
}
.q {
  padding: 20px 0;
  border-bottom: 1px dashed var(--border);
}
.q:first-child { padding-top: 0; }
.qt {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}
.qt span {
  color: #7c3aed;
  font-family: var(--ui);
  font-weight: 800;
  margin-right: 8px;
}
.ar {
  background: rgba(124, 58, 237, 0.06);
  border-left: 3px solid #7c3aed;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 6px 0;
  font-size: 15.5px;
  color: var(--ink);
}
.ar.r {
  background: rgba(192, 38, 211, 0.06);
  border-color: #c026d3;
}
.ar b {
  font: 800 11px var(--ui);
  text-transform: uppercase;
  display: block;
}
html.dark .ar { background: rgba(168, 85, 247, 0.12); }
html.dark .ar.r { background: rgba(192, 38, 211, 0.12); }

.o {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.o label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
  transition: 0.2s;
  color: var(--ink);
}
.o label:hover {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.05);
}
.o input {
  accent-color: #7c3aed;
  margin-top: 4px;
}
.o .correct {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.08);
}
.o .wrong {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.07);
}
html.dark .o label {
  background: #1a0f2e;
  color: #cbd5e1;
}
html.dark .o label:hover { background: #2a1a40; }

.ex {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(124, 58, 237, 0.07);
  border-left: 3px solid #7c3aed;
  border-radius: 0 10px 10px 0;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.7;
}
.ex.show { display: block; }
.ex strong { color: #7c3aed; }
html.dark .ex { background: rgba(168, 85, 247, 0.12); color: #cbd5e1; }

.act {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.btn {
  font: 600 14px var(--ui);
  padding: 12px 26px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  background: var(--card);
  color: var(--ink);
  transition: 0.2s;
}
.btn:hover {
  border-color: #7c3aed;
  color: #7c3aed;
}
.btn.p {
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}
.btn.p:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.45);
  color: #fff;
}
.score {
  margin-left: auto;
  font: 700 14.5px var(--ui);
  background: var(--alt);
  padding: 10px 20px;
  border-radius: 10px;
  color: var(--ink);
}
.score b { color: #7c3aed; }
.rb {
  display: none;
  margin-top: 16px;
  padding: 18px;
  border-radius: 12px;
  font: 15px var(--ui);
  text-align: center;
  background: rgba(124, 58, 237, 0.1);
  color: #4c1d95;
}
.rb.show { display: block; }
html.dark .rb {
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
}

/* ============================================================
   FOOTER (fixed)
   ============================================================ */
footer {
  background: #150a26;
  color: #d4c8e8;
  padding: 48px 24px 28px;
  margin-top: 50px;
  font: 14px var(--ui);
}
.footer-inner {
  max-width: none;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.f-col h5 {
  color: #faf7ff;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  margin-bottom: 12px;
  font-weight: 700;
  font-family: var(--ui);
}
.f-col p {
  color: #b8a8d0;
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 10px;
  font-family: var(--ui);
}
.f-col a {
  display: block;
  color: #d4c8e8;
  text-decoration: none;
  padding: 4px 0;
  font-size: 13.5px;
  transition: color 0.2s;
  font-family: var(--ui);
}
.f-col a:hover {
  color: #c084fc;
}
.f-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.f-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  flex: none;
}
.f-brand {
  font-family: var(--ui);
  font-size: 20px;
  font-weight: 800;
  color: #faf7ff;
  line-height: 1.1;
}
.f-brand .accent {
  color: #c084fc;
}
.f-tag {
  font-family: var(--ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #a78bfa;
  margin-top: 3px;
  line-height: 1.2;
}
.f-quote {
  font-style: italic;
  color: #c084fc !important;
  font-size: 13px !important;
  margin-top: 10px !important;
  border-left: 2px solid #7c3aed;
  padding-left: 10px;
  line-height: 1.6;
}
.f-bottom {
  text-align: center;
  margin-top: 20px;
  color: #a78bfa;
  font-size: 12.5px;
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  font-family: var(--ui);
  line-height: 1.6;
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
#backTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #c026d3);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
  z-index: 800;
  font-weight: 900;
}
#backTop.show { opacity: 1; visibility: visible; }
#backTop:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 26px rgba(124, 58, 237, 0.6);
}

/* ============================================================
   RESPONSIVE (max-width 720px)
   ============================================================ */
@media (max-width: 720px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }
  .f-col:first-child {
    grid-column: 1 / -1;
  }
  .brand-tag {
    display: none;
  }
  .cc { padding: 22px 18px; }
  .score {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
  .section { padding: 48px 16px; }
  #backTop {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
  .calc-results { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav .next { text-align: left; }
  .summary-box { padding: 20px 18px; }
  .chapter-nav-top { display: none; }
  .ni { padding: 10px 14px; gap: 10px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-name { font-size: 17px; }
  .theme-btn, .print-btn { padding: 6px 10px; font-size: 12px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .nav,
  .bc,
  .hero-particles,
  .pt,
  #backTop,
  .theme-btn,
  .print-btn,
  .act,
  .sa button,
  .viz svg,
  .read-btn,
  .sec-actions,
  .chapter-nav,
  .related-links {
    display: none !important;
  }
  .viz {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px;
  }
  body {
    font-size: 11pt;
    line-height: 1.5;
    background: #fff;
    color: #000;
  }
  .section {
    padding: 12px 0;
    page-break-inside: avoid;
  }
  .cc {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  .hero {
    padding: 20px 0;
    background: #fff;
    border-bottom: 2px solid #333;
  }
  .formula-sheet {
    border: 2px solid #7c3aed;
    page-break-inside: avoid;
  }
  .formula-grid { grid-template-columns: repeat(2, 1fr); }
  .real,
  .mistake,
  .why,
  .analogy,
  .try,
  .trap,
  .takeaway,
  .def,
  .note,
  .exam,
  .did-you-know,
  .mnemonic-box,
  .flashcard-static {
    background: #f8f8f8 !important;
    page-break-inside: avoid;
  }
  footer {
    background: #fff !important;
    color: #333 !important;
    border-top: 1px solid #ccc;
  }
  .f-brand,
  .f-brand .accent,
  .f-col h5,
  .f-col p,
  .f-col a,
  .f-quote,
  .f-bottom {
    color: #333 !important;
  }
  .f-logo {
    background: transparent;
    box-shadow: none;
  }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .q,
  .ex,
  .ncert-q,
  .flashcard {
    page-break-inside: avoid;
  }
  .sa .b {
    display: block !important;
    border-top: none;
    padding: 0;
  }
  .sa button { display: none; }
}