/*
 * VasmuStudy — Math chapters shared stylesheet (math.css)
 * All common CSS rules for math chapters + appendices.
 * Chapter-specific overrides remain inline in each HTML file.
 */

/* ============ CSS VARIABLES ============ */
:root {
  --bg: #f8f9fc;
  --bg-alt: #eef1f8;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --math-1: #4f46e5;
  --math-2: #7c3aed;
  --math-3: #a855f7;
  --cyan: #0891b2;
  --green: #059669;
  --gold: #d97706;
  --red: #dc2626;
  --border: rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.14), 0 6px 16px rgba(15, 23, 42, 0.08);
  --serif: "Playfair Display", Georgia, serif;
  --body: "Lora", Georgia, serif;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

/* ============ RESET & BASE ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 140px;
}

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ PROGRESS BAR ============ */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 999;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--math-1), var(--math-3), var(--cyan));
  transition: width 0.1s linear;
}

/* ============ NAVIGATION ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(248, 249, 252, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  color: #fff;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 800;
  border-radius: 11px;
  flex: none;
}

.brand-words {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--ui);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-name .accent {
  color: var(--math-1);
}

.brand-tag {
  font-family: var(--ui);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.nav-links a {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 999px;
  transition: all 0.22s ease;
}

.nav-links a:hover {
  color: var(--math-1);
  background: rgba(79, 70, 229, 0.07);
}

/* ============ BREADCRUMB ============ */
.breadcrumb {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 0;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--math-1);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb .sep {
  opacity: 0.5;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 60px 24px 68px;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(79, 70, 229, 0.16), transparent 62%),
    radial-gradient(800px 480px at 95% 10%, rgba(8, 145, 178, 0.14), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, var(--bg-alt) 100%);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--math-1);
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.18);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18);
  animation: pulse 2s ease-in-out infinite;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5.4vw, 3.4rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero h1 .accent {
  background: linear-gradient(120deg, var(--math-1), var(--cyan), var(--math-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .lede {
  font-size: 1.06rem;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 26px;
  line-height: 1.75;
}

.hero-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.meta-chip {
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta-chip .mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--math-1);
}

/* ============ STATS BAND ============ */
.stats-band {
  max-width: 1040px;
  margin: -30px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 3;
}

.stats-inner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 28px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 4px 10px;
  border-right: 1px solid var(--border);
}

.stat-item:last-child {
  border-right: 0;
}

.stat-num {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: block;
  margin-bottom: 6px;
}

.stat-label {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}

/* ============ CATEGORY NAV ============ */
.cat-nav {
  z-index: 800;
  background: rgba(248, 249, 252, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  margin-top: 30px;
}

.cat-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.cat-tab {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.22s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cat-tab:hover {
  border-color: var(--math-1);
  color: var(--math-1);
}

.cat-tab.active {
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

/* ============ SECTION LAYOUT ============ */
.section {
  padding: 68px 24px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
}

.wrap-narrow {
  max-width: 900px;
  margin: 0 auto;
}

.sec-head {
  margin-bottom: 38px;
}

.sec-head.center {
  text-align: center;
}

.sec-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.sec-head p {
  color: var(--muted);
  font-size: 1rem;
}

.kicker {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--math-1);
  margin-bottom: 10px;
  display: block;
}

/* ============ CONTENT CARDS ============ */
.content-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: all 0.25s ease;
}

.content-card:hover {
  box-shadow: var(--shadow-md);
}

.content-card h3 {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-card h3 .badge {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  padding: 4px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  letter-spacing: 0.05em;
}

.content-card h4 {
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--math-1);
}

.content-card p {
  color: #334155;
  margin-bottom: 12px;
}

.content-card ul,
.content-card ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.content-card li {
  margin-bottom: 8px;
  color: #334155;
  line-height: 1.7;
}

.content-card li strong {
  color: var(--ink);
}

.content-card code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--math-1);
  font-weight: 600;
}

/* ============ DEF / FORMULA BOXES ============ */
.def-box {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(168, 85, 247, 0.04));
  border-left: 4px solid var(--math-1);
  border-radius: 0 12px 12px 0;
  padding: 18px 22px;
  margin: 16px 0;
}

.def-box .def-label {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
  color: var(--math-1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

.def-box p {
  margin: 0;
  color: var(--ink);
}

.formula-box {
  background: linear-gradient(135deg, #f0f9ff, #faf5ff);
  border: 1.5px solid rgba(79, 70, 229, 0.15);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 14px 0;
  text-align: center;
  font-size: 1.05rem;
  overflow-x: auto;
}

/* ============ VIZ BOX ============ */
.viz-box {
  background: linear-gradient(135deg, #fafbfe, #f4f6fb);
  border: 1.5px solid rgba(79, 70, 229, 0.15);
  border-radius: 16px;
  padding: 22px 18px;
  margin: 20px 0;
  text-align: center;
  position: relative;
}

.viz-box .viz-label {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 800;
  color: var(--math-1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}

.viz-box svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.viz-caption {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
  line-height: 1.6;
  font-style: italic;
}

/* ============ TRICK BOX ============ */
.trick-box {
  background: linear-gradient(135deg, #fdf4ff, #fae8ff);
  border: 1.5px solid rgba(168, 85, 247, 0.25);
  border-radius: 16px;
  padding: 22px 26px;
  margin: 18px 0;
  position: relative;
}

.trick-box::before {
  content: "💡";
  position: absolute;
  top: -14px;
  left: 22px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--math-3), var(--math-1));
  border-radius: 10px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

.trick-box .trick-label {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 800;
  color: var(--math-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}

.trick-box p {
  margin-bottom: 8px;
}

.trick-box ul {
  padding-left: 22px;
  margin-top: 8px;
}

/* ============ TABLES ============ */
.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--card);
  margin: 18px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 15px;
}

thead {
  background: linear-gradient(135deg, var(--math-1), var(--math-2));
  color: #fff;
  font-family: var(--ui);
}

thead th {
  padding: 13px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

tbody tr:last-child {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--bg-alt);
}

tbody td {
  padding: 13px 16px;
  color: #334155;
  vertical-align: top;
  line-height: 1.6;
}

tbody td:first-child {
  font-weight: 700;
  color: var(--ink);
}

/* ============ SHOW ANSWER / STEP MARKING ============ */
.show-answer-wrap {
  margin: 16px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(79, 70, 229, 0.2);
  background: #fff;
}

.show-answer-btn {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 700;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(168, 85, 247, 0.06));
  color: var(--math-1);
  border: none;
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.22s ease;
  letter-spacing: 0.02em;
}

.show-answer-btn:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(168, 85, 247, 0.12));
}

.show-answer-btn .arrow {
  display: inline-block;
  transition: transform 0.28s ease;
  font-size: 12px;
  color: var(--math-1);
}

.show-answer-wrap.open .show-answer-btn .arrow {
  transform: rotate(90deg);
}

.show-answer-body {
  display: none;
  padding: 22px 24px;
  border-top: 1px dashed rgba(79, 70, 229, 0.25);
  background: #fefeff;
  animation: slideDown 0.3s ease;
}

.show-answer-wrap.open .show-answer-body {
  display: block;
}

.step-block {
  background: #f8fafc;
  border-left: 4px solid var(--math-1);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin: 12px 0;
}

.step-block .step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-family: var(--ui);
}

.step-block .step-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--math-1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.step-block .step-mark {
  font-size: 11.5px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green), #10b981);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.step-block p {
  margin: 6px 0;
  color: #334155;
  font-size: 15px;
  line-height: 1.7;
  overflow-x: auto;
}

.step-block p:last-child {
  margin-bottom: 0;
}

.final-answer {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(16, 185, 129, 0.08));
  border: 1.5px solid rgba(5, 150, 105, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 14px;
  font-weight: 600;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 10px;
}

.final-answer::before {
  content: "✓";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  flex: none;
  font-size: 13px;
}

.marks-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  background: rgba(79, 70, 229, 0.1);
  color: var(--math-1);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* ============ MCQ ============ */
.mcq-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.q {
  padding: 22px 0;
  border-bottom: 1px dashed var(--border);
}

.q:first-child {
  padding-top: 0;
}

.q:last-of-type {
  border-bottom: 0;
  padding-bottom: 12px;
}

.q-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  color: var(--ink);
}

.q-text span {
  color: var(--math-1);
  font-family: var(--ui);
  font-weight: 800;
  flex: none;
}

.opts {
  display: grid;
  gap: 8px;
  padding-left: 22px;
}

.opts label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fefefe;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
  transition: all 0.18s ease;
}

.opts label:hover {
  border-color: var(--math-1);
  background: rgba(79, 70, 229, 0.04);
}

.opts input {
  accent-color: var(--math-1);
  cursor: pointer;
  flex: none;
}

.opts span {
  font-family: var(--ui);
  font-weight: 700;
  color: var(--muted);
  font-size: 13.5px;
  flex: none;
}

.opts label.correct {
  border-color: var(--green);
  background: rgba(5, 150, 105, 0.08);
}

.opts label.correct span {
  color: var(--green);
}

.opts label.wrong {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.07);
}

.opts label.wrong span {
  color: var(--red);
}

.explain {
  display: none;
  margin: 14px 0 0 22px;
  padding: 12px 18px;
  background: rgba(79, 70, 229, 0.07);
  border-left: 3px solid var(--math-1);
  border-radius: 0 10px 10px 0;
  font-size: 14.5px;
  color: #334155;
  line-height: 1.7;
}

.explain.show {
  display: block;
}

.mcq-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.38);
}

.btn-outline {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--math-1);
  color: var(--math-1);
}

.score {
  margin-left: auto;
  font-family: var(--ui);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg-alt);
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.score b {
  color: var(--math-1);
  font-size: 18px;
}

.result-banner {
  display: none;
  margin-top: 20px;
  padding: 20px 24px;
  border-radius: 12px;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.result-banner.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.result-banner .rt {
  font-size: 1.15rem;
  font-weight: 800;
  display: block;
  margin-bottom: 4px;
}

.result-banner.good {
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.3);
  color: #065f46;
}

.result-banner.mid {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.3);
  color: #78350f;
}

.result-banner.low {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #991b1b;
}

/* ============ ASSERTION REASON ============ */
.ar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.ar-card:hover {
  box-shadow: var(--shadow-md);
}

.ar-qnum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 800;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  color: #fff;
  border-radius: 10px;
  margin-bottom: 12px;
}

.ar-assertion,
.ar-reason {
  padding: 12px 16px;
  border-radius: 10px;
  margin: 8px 0;
  font-size: 15.5px;
  line-height: 1.7;
}

.ar-assertion {
  background: rgba(79, 70, 229, 0.06);
  border-left: 3px solid var(--math-1);
}

.ar-reason {
  background: rgba(217, 119, 6, 0.06);
  border-left: 3px solid var(--gold);
}

.ar-assertion strong,
.ar-reason strong {
  font-family: var(--ui);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.ar-assertion strong {
  color: var(--math-1);
}

.ar-reason strong {
  color: var(--gold);
}

.ar-options {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-left: 0;
}

.ar-options label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fefefe;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.55;
  transition: all 0.18s ease;
}

.ar-options label:hover {
  border-color: var(--math-1);
  background: rgba(79, 70, 229, 0.03);
}

.ar-options input {
  accent-color: var(--math-1);
  cursor: pointer;
  margin-top: 3px;
  flex: none;
}

.ar-options label.correct {
  border-color: var(--green);
  background: rgba(5, 150, 105, 0.08);
}

.ar-options label.wrong {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.07);
}

.ar-explain {
  display: none;
  margin-top: 14px;
  padding: 14px 18px;
  background: rgba(79, 70, 229, 0.06);
  border-left: 3px solid var(--math-1);
  border-radius: 0 10px 10px 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: #334155;
}

.ar-explain.show {
  display: block;
}

/* ============ PYQ ============ */
.pyq-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.pyq-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--red));
}

.pyq-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.pyq-year {
  display: inline-block;
  font-family: var(--ui);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--red));
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.pyq-q {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink);
  line-height: 1.6;
}

/* ============ EQUATION DISPLAY (ch 9–12) ============ */
.eq-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 24px;
  margin: 0 auto 8px;
  background: #fff;
  border: 1.5px solid rgba(79, 70, 229, 0.18);
  border-radius: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(15px, 2.2vw, 20px);
  line-height: 1.5;
  max-width: 640px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.06);
}

.eq-term {
  color: #334155;
  font-weight: 700;
  white-space: nowrap;
}

.eq-term sup {
  font-size: 0.75em;
  color: inherit;
  vertical-align: super;
}

.eq-term sub {
  font-size: 0.75em;
  color: inherit;
  vertical-align: sub;
}

.eq-op {
  color: #64748b;
  font-weight: 500;
  font-size: 1.05em;
}

/* ============ FOOTER ============ */
footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 56px 24px 32px;
  margin-top: 60px;
}

.footer-inner {
  max-width: none;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 36px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.f-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.f-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--math-1), var(--math-3));
  color: #fff;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 800;
  border-radius: 12px;
  flex: none;
}

.f-brand {
  font-family: var(--ui);
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.f-brand .accent {
  color: var(--math-3);
}

.f-tag {
  font-family: var(--ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #94a3b8;
}

.f-col p {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 8px;
}

.f-col h5 {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f8fafc;
  margin-bottom: 14px;
}

.f-col a {
  display: block;
  font-family: var(--ui);
  font-size: 14px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 5px 0;
  transition: color 0.2s ease;
}

.f-col a:hover {
  color: var(--math-3);
}

.f-bottom {
  max-width: 1140px;
  margin: 22px auto 0;
  text-align: center;
  font-family: var(--ui);
  font-size: 12.5px;
  color: #94a3b8;
}

/* ============ ANIMATIONS ============ */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .footer-inner {
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 28px;
  }
}

@media (max-width: 720px) {
  .nav-inner { padding: 10px 14px; }
  .brand-tag { display: none; }
  .brand-logo { width: 38px; height: 38px; font-size: 18px; }
  .brand-name { font-size: 17px; }
  .nav-links a { padding: 6px 10px; font-size: 12px; }
  .hero { padding: 44px 18px 54px; }
  .section { padding: 52px 18px; }
  .stats-inner { padding: 18px 16px; gap: 12px; }
  .stat-item { border-right: 0; }
  .cat-nav { padding: 10px 14px; }
  .cat-tab { padding: 7px 14px; font-size: 12px; }
  .content-card { padding: 22px 20px; }
  .mcq-form { padding: 20px 16px; }
  .opts { padding-left: 0; }
  .explain { margin-left: 0; }
  .score { margin-left: 0; width: 100%; text-align: center; }
  .mcq-actions .btn { flex: 1; justify-content: center; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .show-answer-body { padding: 18px 16px; }
  .ar-card { padding: 18px 16px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .nav-links a { padding: 5px 9px; font-size: 11.5px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .content-card h3 { font-size: 1.1rem; flex-wrap: wrap; }
  .eq-display { font-size: 14px; padding: 14px 16px; gap: 5px; }
}

/* ============ EQUATION TERM HIGHLIGHTS (ch 10-12) ============ */
.eq-term.highlight-a {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(220, 38, 38, 0.35);
}

.eq-term.highlight-b {
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(5, 150, 105, 0.35);
}

.eq-term.highlight-c {
  color: #d97706;
  background: rgba(217, 119, 6, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(217, 119, 6, 0.35);
}

/* Highlighted row in tables (e.g., optimal values) */
tbody tr.highlight {
  background: linear-gradient(90deg, rgba(5, 150, 105, 0.1), rgba(5, 150, 105, 0.03));
}

tbody tr.highlight td {
  color: #065f46;
  font-weight: 700;
}