/* ============================================================
   SCHOOL PORTAL — Global Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1e28;
  --surface:   #1f2433;
  --border:    #2a2f3f;
  --accent:    #f0c040;
  --accent2:   #e07830;
  --text:      #e8eaf0;
  --text-muted:#7a8099;
  --text-dim:  #4a5068;
  --success:   #3dd68c;
  --danger:    #f05060;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --nav-h:     64px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg:        #f4f5f8;
  --bg2:       #eceef3;
  --bg3:       #e4e7ef;
  --surface:   #ffffff;
  --border:    #d0d4e0;
  --text:      #1a1e28;
  --text-muted:#5a6080;
  --text-dim:  #9aa0b8;
  --shadow:    0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.12);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: var(--nav-h);
  transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }
button { cursor: pointer; font-family: var(--font-body); }
ul { list-style: none; }

/* ── Typography ── */
h1,h2,h3,h4 { font-family: var(--font-head); line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; }
p  { font-size: 1rem; font-weight: 300; color: var(--text-muted); }

/* ── Layout Utilities ── */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 4rem 0; }
.section-sm { padding: 2rem 0; }
.flex       { display: flex; }
.flex-center{ display: flex; align-items: center; justify-content: center; }
.grid       { display: grid; }
.gap-1      { gap: 0.5rem; }
.gap-2      { gap: 1rem; }
.gap-3      { gap: 1.5rem; }
.gap-4      { gap: 2rem; }
.mt-1       { margin-top: 0.5rem; }
.mt-2       { margin-top: 1rem; }
.mt-3       { margin-top: 1.5rem; }
.mt-4       { margin-top: 2rem; }
.text-center{ text-align: center; }
.text-accent{ color: var(--accent); }

/* ── Navigation ── */
#site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13,15,20,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background var(--transition);
}
[data-theme="light"] #site-nav {
  background: rgba(244,245,248,0.92);
}
.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav-logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* Dark mode toggle */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Nav Dropdowns */
.nav-dropdown { position: relative; }
.nav-dropbtn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-dropbtn:hover { color: var(--text); background: var(--surface); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  min-width: 140px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}
.nav-dropdown-menu.open { display: block; animation: fadeUp 0.15s ease; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all var(--transition);
}
.nav-dropdown-menu a:hover { color: var(--text); background: var(--surface); }
.mobile-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.4rem 1rem 0.2rem;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem 1.5rem;
  z-index: 999;
  flex-direction: column;
  gap: 0.25rem;
  animation: slideDown 0.2s ease;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  transition: all var(--transition);
}
.nav-mobile-menu a:hover { color: var(--text); background: var(--surface); }
.nav-mobile-menu .mobile-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero Banner ── */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  overflow: hidden;
  background: var(--bg2);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 60% 0%, rgba(240,192,64,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-block;
  background: rgba(240,192,64,0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 100px;
  border: 1px solid rgba(240,192,64,0.25);
  margin-bottom: 1.25rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero p { font-size: 1.1rem; max-width: 560px; margin-top: 1rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--accent);
  color: #0d0f14;
}
.btn-primary:hover { background: #ffd060; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(240,192,64,0.35); color: #0d0f14; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(240,192,64,0.06); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-success { background: var(--success); color: #0d0f14; }
.btn-success:hover { opacity: 0.88; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1.05rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Section Headers ── */
.section-header { margin-bottom: 2.5rem; }
.section-header h2 { margin-bottom: 0.5rem; }
.section-header p { max-width: 500px; }
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ── Subject Cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeUp 0.4s ease both;
  display: flex;
  flex-direction: column;
}
.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg3);
}
.card-img-placeholder {
  width: 100%;
  height: 160px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-grade-tag {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}
.card-body h3 { margin-bottom: 0.5rem; font-size: 1.15rem; }
.card-body p  { font-size: 0.88rem; flex: 1; }
.card-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Grade Band Tabs ── */
.grade-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  margin-bottom: 2rem;
}
.grade-tab {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  border-radius: calc(var(--radius) - 4px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
}
.grade-tab.active {
  background: var(--accent);
  color: #0d0f14;
}
.grade-panel { display: none; }
.grade-panel.active { display: block; }

/* ── Subject Page ── */
.subject-hero {
  padding: 3rem 0 2.5rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.subject-hero::after {
  content: attr(data-subject);
  position: absolute;
  right: -1rem;
  bottom: -1rem;
  font-family: var(--font-head);
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 800;
  color: rgba(255,255,255,0.02);
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}
.subject-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.08em;
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-accent { background: rgba(240,192,64,0.12); border-color: rgba(240,192,64,0.3); color: var(--accent); }

/* Topics list */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: all var(--transition);
  cursor: pointer;
}
.topic-card:hover { border-color: var(--accent); transform: translateX(4px); }
.topic-number {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-dim);
  line-height: 1;
  min-width: 2rem;
}
.topic-info h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.topic-info p  { font-size: 0.83rem; }

/* Worked examples */
.example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}
.example-header {
  padding: 1rem 1.25rem;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}
.example-header h4 { font-size: 0.95rem; margin: 0; }
.example-toggle { font-size: 1.2rem; transition: transform var(--transition); color: var(--text-muted); }
.example-card.open .example-toggle { transform: rotate(180deg); }
.example-body { padding: 1.25rem; display: none; }
.example-card.open .example-body { display: block; }
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(240,192,64,0.15);
  border: 1px solid rgba(240,192,64,0.3);
  color: var(--accent);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step p { font-size: 0.9rem; color: var(--text); margin-top: 0.1rem; }

/* ── Quiz Engine ── */
.quiz-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.quiz-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.quiz-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.quiz-timer {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0.3rem 0.8rem;
  background: rgba(240,192,64,0.1);
  border: 1px solid rgba(240,192,64,0.25);
  border-radius: 8px;
}
.quiz-timer.warning { color: var(--danger); background: rgba(240,80,96,0.1); border-color: rgba(240,80,96,0.25); }
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  animation: fadeUp 0.3s ease;
}
.quiz-q-num {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}
.quiz-question {
  font-family: var(--font-head);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}
.quiz-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  background: var(--bg3);
}
.quiz-options {
  display: grid;
  gap: 0.75rem;
}
.quiz-option {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: left;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 400;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(240,192,64,0.06); }
.quiz-option.selected  { border-color: var(--accent); background: rgba(240,192,64,0.1); }
.quiz-option.correct   { border-color: var(--success); background: rgba(61,214,140,0.1); color: var(--success); }
.quiz-option.incorrect { border-color: var(--danger);  background: rgba(240,80,96,0.1);  color: var(--danger); }
.quiz-option:disabled  { cursor: default; }
.option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.quiz-option.selected  .option-letter { background: var(--accent); color: #0d0f14; }
.quiz-option.correct   .option-letter { background: var(--success); color: #0d0f14; }
.quiz-option.incorrect .option-letter { background: var(--danger); color: #fff; }
.quiz-feedback {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb  { background: rgba(61,214,140,0.1);  border: 1px solid rgba(61,214,140,0.3);  color: var(--success); }
.quiz-feedback.incorrect-fb{ background: rgba(240,80,96,0.1);   border: 1px solid rgba(240,80,96,0.3);   color: var(--danger); }
.quiz-nav { display: flex; justify-content: flex-end; margin-top: 1.5rem; }

/* Difficulty filter */
.difficulty-filter { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.diff-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.diff-btn:hover { border-color: var(--accent); color: var(--accent); }
.diff-btn.active { background: var(--accent); color: #0d0f14; border-color: var(--accent); }

/* Results */
.quiz-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  animation: fadeUp 0.4s ease;
}
.result-score {
  font-family: var(--font-head);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 1rem 0;
}
.result-label { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 2rem; }
.result-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.result-stat { text-align: center; }
.result-stat-val {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.5rem;
}
.result-stat-val.green  { color: var(--success); }
.result-stat-val.red    { color: var(--danger); }
.result-stat-val.yellow { color: var(--accent); }
.result-stat-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; }
.result-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Review */
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.review-item.was-correct   { border-left: 4px solid var(--success); }
.review-item.was-incorrect { border-left: 4px solid var(--danger); }
.review-q { font-weight: 500; margin-bottom: 0.5rem; font-size: 0.95rem; }
.review-answer { font-size: 0.85rem; color: var(--text-muted); }
.review-answer strong { color: var(--success); }
.review-explanation {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Score History */
.score-history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.score-history h4 { font-size: 0.9rem; margin-bottom: 0.75rem; }
.score-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.score-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-head);
}
.score-pill.good   { background: rgba(61,214,140,0.15);  color: var(--success); }
.score-pill.okay   { background: rgba(240,192,64,0.15);  color: var(--accent); }
.score-pill.poor   { background: rgba(240,80,96,0.15);   color: var(--danger); }

/* ── Past Papers ── */
.papers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.papers-table th {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.papers-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.papers-table tr:last-child td { border-bottom: none; }
.papers-table tr:hover td { background: var(--bg3); }
.papers-table a { color: var(--accent); font-weight: 500; }

/* ── Formula Sheet ── */
.formula-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: var(--text);
}
.formula-label {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

/* ── Toast / Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #0d0f14;
  border: none;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 800;
  box-shadow: 0 4px 16px rgba(240,192,64,0.4);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px); }

/* ── Footer ── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-inner p { font-size: 0.85rem; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.5s ease both; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Print styles ── */
@media print {
  #site-nav, .back-to-top, .site-footer, .btn { display: none !important; }
  body { padding-top: 0; background: #fff; color: #000; }
  .formula-box { border: 1px solid #ccc; background: #f9f9f9; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .topics-grid { grid-template-columns: 1fr; }
  .result-stats { gap: 1rem; }
  .section { padding: 2rem 0; }
  .hero { padding: 2.5rem 0 2rem; }
  .hero p { font-size: 0.95rem; }
}

@media (max-width: 480px) {
  html { font-size: 58%; }
  :root { --nav-h: 50px; --radius: 10px; --radius-lg: 14px; }

  .container { padding: 0 0.85rem; }
  .section { padding: 1.5rem 0; }
  .section-header { margin-bottom: 1.25rem; }
  .hero { padding: 1.75rem 0 1.5rem; }
  .hero p { font-size: 0.9rem; }
  .hero-actions { gap: 0.5rem; margin-top: 1.25rem; }
  .hero-tag { font-size: 0.7rem; padding: 0.25rem 0.7rem; }

  .nav-logo { font-size: 0.95rem; }
  .theme-toggle, .nav-hamburger { width: 30px; height: 30px; font-size: 0.85rem; }
  .nav-mobile-menu a { font-size: 0.88rem; padding: 0.55rem 0.85rem; }
  .mobile-section-label { font-size: 0.62rem; }

  .cards-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .card-img, .card-img-placeholder { height: 80px; }
  .card-img-placeholder { font-size: 1.8rem !important; }
  .card-body { padding: 0.75rem; }
  .card-body h3 { font-size: 0.9rem; margin-bottom: 0.3rem; }
  .card-body p { font-size: 0.78rem; }
  .card-footer { margin-top: 0.75rem; padding-top: 0.65rem; }
  .card-grade-tag { font-size: 0.62rem; }

  .btn { font-size: 0.82rem; padding: 0.55rem 1rem; }
  .btn-sm { font-size: 0.75rem; padding: 0.4rem 0.75rem; }
  .btn-lg { font-size: 0.88rem; padding: 0.65rem 1.25rem; }

  .grade-tabs { flex-wrap: wrap; gap: 0.3rem; margin-bottom: 1.25rem; }
  .grade-tab { font-size: 0.78rem; padding: 0.4rem 0.85rem; }

  .subject-hero { padding: 1.5rem 0 1.25rem; }
  .subject-hero::after { font-size: 4rem; }
  .badge { font-size: 0.65rem; padding: 0.2rem 0.6rem; }

  .topic-card { padding: 0.85rem; gap: 0.65rem; }
  .topic-number { font-size: 1rem; min-width: 1.5rem; }
  .topic-info h4 { font-size: 0.85rem; }
  .topic-info p { font-size: 0.75rem; }

  .option-letter, .step-num { width: 22px; height: 22px; font-size: 0.68rem; }

  .quiz-wrap { padding: 0.65rem 0.65rem 3rem; }
  .quiz-card { padding: 1rem; }
  .result-score { font-size: clamp(1.6rem, 9vw, 2.2rem); }
  .result-stats { gap: 0.75rem; }
  .result-stat-val { font-size: 1.2rem; }

  .papers-table th:nth-child(3),
  .papers-table td:nth-child(3) { display: none; }

  .footer-inner { flex-direction: column; text-align: center; gap: 0.35rem; }
  .footer-inner p { font-size: 0.78rem; }
}

@media (max-width: 360px) {
  html { font-size: 52%; }
  .cards-grid { grid-template-columns: 1fr; }
  .card-img-placeholder { font-size: 1.5rem !important; }
}
