/* ═══════════════════════════════════════════════════════
   AskAssam — Main Stylesheet  (light-first, dark via [data-theme="dark"])
   ═══════════════════════════════════════════════════════ */

/* ─── Light Theme (default) ──────────────────────────── */
:root {
  --bg:          #f8fafc;
  --bg2:         #ffffff;
  --bg3:         #f1f5f9;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --border:      #e2e8f0;
  --border2:     #cbd5e1;

  --text:        #0f172a;
  --text2:       #334155;
  --text3:       #64748b;
  --text-muted:  #94a3b8;

  --primary:     #4f46e5;
  --primary-h:   #4338ca;
  --primary-l:   rgba(79,70,229,0.1);

  --success:     #059669;
  --warning:     #d97706;
  --danger:      #dc2626;
  --info:        #2563eb;

  --radius:      10px;
  --radius-lg:   16px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.05);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.12);

  --font:        'DM Sans', system-ui, sans-serif;
  --font-display:'Outfit', system-ui, sans-serif;

  --nav-h:       64px;
  --bottom-nav-h:64px;

  /* Chart colours exposed as CSS vars */
  --chart-grid:  rgba(0,0,0,0.06);
  --chart-tick:  #94a3b8;
}

/* ─── Dark Theme ─────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0f172a;
  --bg2:         #1e293b;
  --bg3:         #334155;
  --surface:     #1e293b;
  --surface2:    #253047;
  --border:      #334155;
  --border2:     #475569;

  --text:        #f1f5f9;
  --text2:       #cbd5e1;
  --text3:       #94a3b8;
  --text-muted:  #64748b;

  --primary:     #6366f1;
  --primary-h:   #4f46e5;
  --primary-l:   rgba(99,102,241,0.15);

  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;

  --shadow:      0 4px 24px rgba(0,0,0,0.35);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.25);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.5);

  --chart-grid:  rgba(255,255,255,0.05);
  --chart-tick:  #94a3b8;
}

/* ─── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  padding-top: var(--nav-h);
  padding-bottom: var(--bottom-nav-h);
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select {
  font-family: var(--font);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  width: 100%;
  font-size: 0.95rem;
  transition: border-color .2s, box-shadow .2s, background .25s, color .25s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l);
}
select option { background: var(--bg2); color: var(--text); }

/* ─── Container ──────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem;
  transition: all .2s; cursor: pointer; border: none;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 4px 14px var(--primary-l); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-outline  { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-outline-light:hover { background: rgba(255,255,255,.1); }
.btn-link { background: none; color: var(--primary); font-size: .85rem; padding: .2rem 0; }
.btn-sm  { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.8rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.05rem; padding: .3rem; border-radius: var(--radius-sm); transition: background .15s; display: inline-flex; align-items: center; }
.btn-icon:hover { background: var(--bg3); }
.btn-icon.danger:hover { background: rgba(220,38,38,.12); }
.ml-auto { margin-left: auto; }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .18rem .65rem; border-radius: 99px;
  font-size: .73rem; font-weight: 600; letter-spacing: .02em;
}
.badge-board   { background: rgba(79,70,229,.12); color: var(--primary); }
.badge-class   { background: rgba(5,150,105,.12); color: var(--success); }
.badge-medium  { background: rgba(217,119,6,.12); color: var(--warning); }
.badge-subject { background: rgba(37,99,235,.12); color: var(--info); }
.badge-link    { cursor: pointer; transition: filter .15s; }
.badge-link:hover { filter: brightness(1.15); }
.badge-sm      { font-size: .68rem; padding: .12rem .5rem; }
.badge-red     { background: var(--danger); color: #fff; font-size: .7rem; padding: .1rem .4rem; border-radius: 99px; margin-left: .3rem; }
[data-theme="dark"] .badge-board   { background: rgba(99,102,241,.2); color: #a5b4fc; }
[data-theme="dark"] .badge-class   { background: rgba(16,185,129,.2); color: #6ee7b7; }
[data-theme="dark"] .badge-medium  { background: rgba(245,158,11,.2); color: #fcd34d; }
[data-theme="dark"] .badge-subject { background: rgba(59,130,246,.2); color: #93c5fd; }

/* ─── Alerts ─────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 1.1rem; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: .75rem;
}
.alert-success { background: rgba(5,150,105,.1); border: 1px solid rgba(5,150,105,.25); color: #065f46; }
.alert-error   { background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.25); color: #991b1b; }
.alert-warning { background: rgba(217,119,6,.1); border: 1px solid rgba(217,119,6,.25); color: #92400e; }
.alert-info    { background: rgba(37,99,235,.1); border: 1px solid rgba(37,99,235,.25); color: #1e40af; }
[data-theme="dark"] .alert-success { background: rgba(16,185,129,.15); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
[data-theme="dark"] .alert-error   { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3); color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,.15); border-color: rgba(245,158,11,.3); color: #fcd34d; }
[data-theme="dark"] .alert-info    { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.3); color: #93c5fd; }
.alert-icon    { font-weight: 700; }
.flash-container { position: fixed; top: calc(var(--nav-h) + .75rem); right: 1rem; z-index: 999; width: min(380px, calc(100vw - 2rem)); }
.flash-container .alert { box-shadow: var(--shadow); }

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--nav-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background .25s, border-color .25s;
}
[data-theme="dark"] .navbar {
  background: rgba(15,23,42,0.92);
  border-bottom-color: #334155;
}
.navbar-inner {
  display: flex; align-items: center; gap: 1rem; height: 100%;
}
.navbar-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 800;
  white-space: nowrap; color: var(--text);
}
.brand-icon { font-size: 1.4rem; }
.brand-text strong { color: var(--primary); }

.navbar-search { flex: 1; max-width: 480px; }
.search-wrapper { position: relative; }
.search-wrapper input {
  background: var(--bg3); border: 1px solid var(--border);
  padding: .5rem 2.5rem .5rem .95rem;
  border-radius: 99px; font-size: .9rem; width: 100%;
}
.search-wrapper input:focus { border-color: var(--primary); }
.search-btn { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; }
.search-dropdown {
  position: absolute; top: calc(100% + .4rem); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 999; max-height: 380px; overflow-y: auto; display: none;
}
.search-result-item { display: block; padding: .75rem 1rem; border-bottom: 1px solid var(--border); transition: background .15s; }
.search-result-item:hover { background: var(--bg3); }
.search-result-item:last-child { border-bottom: none; }
.sr-title { font-weight: 600; font-size: .9rem; }
.sr-meta  { font-size: .78rem; color: var(--text3); margin-top: .15rem; }

.navbar-links { display: flex; align-items: center; gap: 1rem; white-space: nowrap; }
.navbar-links > a:not(.btn) { font-size: .88rem; font-weight: 500; color: var(--text2); transition: color .15s; }
.navbar-links > a:not(.btn):hover { color: var(--primary); }

.notif-link { position: relative; font-size: 1.2rem; }
.notif-badge {
  position: absolute; top: -5px; right: -7px;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; padding: .08rem .35rem;
  border-radius: 99px; min-width: 16px; text-align: center;
}
.user-menu { position: relative; }
.user-avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: .88rem; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.user-dropdown {
  position: absolute; top: calc(100% + .5rem); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 180px; padding: .4rem; display: none; z-index: 999;
}
.user-dropdown.open { display: block; }
.user-dropdown a { display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; border-radius: var(--radius-sm); font-size: .88rem; transition: background .15s; }
.user-dropdown a:hover { background: var(--bg3); }
.user-dropdown hr { border-color: var(--border); margin: .3rem 0; }

.mobile-menu-btn { display: none; font-size: 1.4rem; color: var(--text); }
.mobile-menu {
  display: none; flex-direction: column; gap: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  position: absolute; top: var(--nav-h); left: 0; right: 0; z-index: 899;
  box-shadow: var(--shadow-lg);
}
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: .8rem 1.25rem; font-size: .92rem; font-weight: 500; border-bottom: 1px solid var(--border); transition: background .15s; }
.mobile-menu a:hover { background: var(--bg3); }

/* ─── Theme Toggle Button ────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--bg2); color: var(--text2);
  cursor: pointer; transition: all .2s; font-size: .95rem; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }

/* ─── Bottom Nav ─────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 800;
  height: var(--bottom-nav-h);
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
[data-theme="dark"] .bottom-nav { box-shadow: 0 -4px 20px rgba(0,0,0,0.3); }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; font-size: .65rem; font-weight: 600; color: var(--text3); padding: .5rem .25rem; transition: color .15s; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--primary); }
.bottom-nav-icon { font-size: 1.3rem; }

/* ─── Hero ───────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, #f0f4ff 0%, #fdf4ff 50%, #f0f9ff 100%);
  padding: 5rem 0 4rem;
}
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #0f172a 0%, #1a1035 50%, #0f172a 100%);
}
.hero-bg-shapes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.shape { position: absolute; border-radius: 50%; filter: blur(80px); }
.shape-1 { width: 500px; height: 500px; background: rgba(79,70,229,.15); top: -200px; right: -100px; }
.shape-2 { width: 300px; height: 300px; background: rgba(139,92,246,.12); bottom: -100px; left: 10%; }
.shape-3 { width: 200px; height: 200px; background: rgba(37,99,235,.1); top: 30%; left: 50%; }
[data-theme="dark"] .shape-1 { background: rgba(99,102,241,.2); }
[data-theme="dark"] .shape-2 { background: rgba(139,92,246,.15); }
[data-theme="dark"] .shape-3 { background: rgba(59,130,246,.12); }

.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(79,70,229,.1); border: 1px solid rgba(79,70,229,.2);
  color: var(--primary); font-size: .82rem; font-weight: 600;
  padding: .3rem .9rem; border-radius: 99px; margin-bottom: 1.2rem;
}
[data-theme="dark"] .hero-badge { background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.3); color: #a5b4fc; }
.hero-title { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.gradient-text {
  background: linear-gradient(135deg, var(--primary), #7c3aed, #0ea5e9);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { font-size: 1.05rem; color: var(--text2); max-width: 520px; margin-bottom: 2rem; }
.hero-search { margin-bottom: 1.5rem; max-width: 580px; }
.hero-search-box {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border2);
  border-radius: 99px; overflow: visible;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
[data-theme="dark"] .hero-search-box { box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.search-icon-lg { position: absolute; left: 1.1rem; font-size: 1.1rem; pointer-events: none; }
.hero-search-box input { background: none; border: none; padding: .9rem 1.2rem .9rem 3rem; font-size: 1rem; border-radius: 99px; box-shadow: none; }
.hero-search-box input:focus { box-shadow: none; }
.hero-dropdown { border-radius: var(--radius); }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-stats {
  display: flex; flex-direction: column; gap: .8rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow);
}
.stat-card { text-align: center; padding: .5rem 1.5rem; border-bottom: 1px solid var(--border); }
.stat-card:last-child { border-bottom: none; }
.stat-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: .78rem; color: var(--text3); }

/* ─── Sections ───────────────────────────────────────── */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--bg3); }
[data-theme="dark"] .section-alt { background: var(--surface); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.8rem; }
.section-title { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; }
.section-link { font-size: .88rem; color: var(--primary); font-weight: 600; }
.section-link:hover { text-decoration: underline; }

/* ─── Boards Icon Grid ───────────────────────────────── */
.boards-nav { padding: 1.5rem 0; }
.boards-icon-grid { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.board-icon-card {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 18px; padding: 1rem .8rem; width: 100px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  flex-shrink: 0;
}
.board-icon-card:hover, .board-icon-card:active { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.13); border-color: var(--primary); }
.board-icon-img {
  width: 58px; height: 58px; border-radius: 14px;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 1px solid var(--border2); flex-shrink: 0;
}
.board-icon-img img { width: 58px; height: 58px; object-fit: contain; padding: 4px; display: block; }
.board-icon-emoji { font-size: 2.2rem; display: flex; align-items: center; justify-content: center; }
.board-icon-name { font-weight: 700; font-size: .82rem; text-align: center; color: var(--text1); line-height: 1.2; }
.board-icon-count { font-size: .7rem; color: var(--text3); }

/* ─── Chapter Cards ──────────────────────────────────── */
.cards-grid { display: grid; gap: 1rem; }
.cards-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cards-grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.chapter-card {
  display: flex; flex-direction: column; gap: .6rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: all .2s; position: relative; overflow: hidden;
}
.chapter-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--primary), #7c3aed); opacity: 0; transition: opacity .2s; }
.chapter-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79,70,229,.12); }
.chapter-card:hover::before { opacity: 1; }
.featured-card { border-color: rgba(79,70,229,.25); }
[data-theme="dark"] .chapter-card:hover { box-shadow: 0 8px 24px rgba(99,102,241,.15); }
[data-theme="dark"] .featured-card { border-color: rgba(99,102,241,.3); }
.chapter-card-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.chapter-card-title { font-weight: 700; font-size: .95rem; line-height: 1.35; flex: 1; }
.chapter-card-subject { font-size: .78rem; color: var(--text3); }
.chapter-card-medium  { display: flex; flex-wrap: wrap; gap: .3rem; font-size: .78rem; color: var(--text3); }
.chapter-card-medium .badge { display: inline-flex; align-items: center; }
.chapter-card-footer  { display: flex; gap: 1rem; font-size: .75rem; color: var(--text3); margin-top: auto; }

/* ─── Class Grid ─────────────────────────────────────── */
.class-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; }
.class-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .2rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem .75rem; transition: all .2s; cursor: pointer;
}
.class-tile:hover { border-color: var(--primary); background: var(--primary-l); transform: translateY(-2px); box-shadow: var(--shadow); }
.class-tile-active { border-color: var(--primary); background: var(--primary-l); }
.class-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.class-label { font-size: .72rem; color: var(--text3); }

/* ─── Board Tabs (home class section) ───────────────────── */
.board-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.board-tab { padding: .3rem .85rem; border-radius: 99px; font-size: .8rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); transition: all .15s; color: var(--text2); }
.board-tab:hover, .board-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Stack title + tabs vertically in the class section */
.classes-header { flex-direction: column; align-items: flex-start; gap: .75rem; }

/* ─── Popular List ───────────────────────────────────── */
.popular-list { display: flex; flex-direction: column; gap: .5rem; }
.popular-item {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; transition: all .15s;
}
.popular-item:hover { border-color: var(--primary); transform: translateX(3px); }
.popular-rank { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: var(--text3); min-width: 24px; }
.popular-info { flex: 1; }
.popular-title { font-weight: 600; font-size: .92rem; }
.popular-meta  { font-size: .75rem; color: var(--text3); }
.popular-views { font-size: .82rem; color: var(--text3); }

/* ─── CTA Section ────────────────────────────────────── */
.cta-section { padding: 3.5rem 0; }
.cta-card {
  background: linear-gradient(135deg, var(--primary-l) 0%, var(--surface) 100%);
  border: 1px solid rgba(79,70,229,.2); border-radius: var(--radius-lg);
  padding: 2.5rem 2rem; display: flex; gap: 2rem; align-items: center; flex-wrap: wrap;
}
[data-theme="dark"] .cta-card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(99,102,241,.1) 100%);
  border-color: rgba(99,102,241,.3);
}
.cta-text { flex: 1; }
.cta-text h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-bottom: .6rem; }
.cta-text p { color: var(--text2); margin-bottom: 1rem; }
.cta-perks { display: flex; gap: 1rem; flex-wrap: wrap; }
.cta-perks span { font-size: .82rem; color: var(--primary); font-weight: 600; background: var(--primary-l); padding: .25rem .75rem; border-radius: 99px; }
.cta-actions { display: flex; flex-direction: column; gap: .75rem; }

/* ─── Chapter Page ───────────────────────────────────── */
.chapter-layout { padding: 1.5rem 0 3rem; }
.chapter-grid { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; margin-top: 1.5rem; }
.breadcrumb { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .82rem; color: var(--text3); padding: .5rem 0; }
.breadcrumb-link { color: var(--primary); transition: opacity .15s; }
.breadcrumb-link:hover { opacity: .8; }
.breadcrumb-current { color: var(--text2); }
.breadcrumb-sep { color: var(--border2); }

.chapter-header { margin-bottom: 2rem; }
.chapter-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.chapter-title { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; line-height: 1.25; margin-bottom: .8rem; }
.chapter-meta-row { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .82rem; color: var(--text3); margin-bottom: 1.2rem; }
.meta-item { display: flex; align-items: center; gap: .3rem; }

.chapter-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.vote-group { display: flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: .3rem .7rem; }
.vote-btn { background: none; border: none; cursor: pointer; font-size: .95rem; padding: .2rem .3rem; border-radius: 99px; transition: background .15s; color: var(--text2); }
.vote-btn:hover, .vote-btn.active { background: var(--primary-l); color: var(--primary); }
.vote-total { font-weight: 700; font-size: .9rem; min-width: 24px; text-align: center; }
.bookmark-btn, .share-btn, .report-btn { background: var(--surface); border: 1px solid var(--border); padding: .4rem .9rem; border-radius: 99px; font-size: .82rem; font-weight: 600; transition: all .15s; }
.bookmark-btn:hover, .bookmark-btn.active { border-color: var(--warning); color: var(--warning); background: rgba(217,119,6,.08); }
.share-btn:hover { border-color: var(--info); color: var(--info); }
.report-btn { color: var(--text3); }
.report-btn:hover { border-color: var(--danger); color: var(--danger); }
.medium-switcher { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .82rem; color: var(--text3); }
.medium-label { font-weight: 600; }

/* ─── Prose ──────────────────────────────────────────── */
.prose { color: var(--text2); line-height: 1.8; font-size: 1rem; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font-display); font-weight: 700; color: var(--text); margin: 1.8rem 0 .8rem; line-height: 1.3; }
.prose h1 { font-size: 1.7rem; }
.prose h2 { font-size: 1.35rem; border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
.prose h3 { font-size: 1.1rem; color: var(--primary); }
.prose p  { margin-bottom: 1.1rem; }
.prose ul, .prose ol { margin: 1rem 0 1rem 1.5rem; }
.prose li { margin-bottom: .4rem; }
.prose strong { font-weight: 700; color: var(--text); }
.prose em     { color: var(--text3); font-style: italic; }
.prose blockquote { border-left: 3px solid var(--primary); margin: 1.2rem 0; padding: .75rem 1.2rem; background: var(--primary-l); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--border2); padding: .6rem .9rem; text-align: left; }
.prose th { background: var(--bg3); font-weight: 700; color: var(--text); }
.prose tr:nth-child(even) td { background: var(--surface2); }
.prose img { border-radius: var(--radius); margin: 1.2rem auto; box-shadow: var(--shadow); }
.prose code { background: var(--bg3); padding: .15rem .4rem; border-radius: 4px; font-size: .88em; }
.prose pre  { background: var(--bg3); padding: 1rem 1.2rem; border-radius: var(--radius-sm); overflow-x: auto; margin: 1.2rem 0; }

/* ─── Sidebar ────────────────────────────────────────── */
.chapter-sidebar { display: flex; flex-direction: column; gap: 1.2rem; }
.sidebar-widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; position: sticky; top: calc(var(--nav-h) + 1rem); }
.widget-title { font-weight: 700; font-size: .9rem; margin-bottom: .9rem; color: var(--text); }
.toc-item { display: block; font-size: .82rem; color: var(--text3); padding: .3rem 0; border-bottom: 1px solid var(--border); transition: color .15s; }
.toc-item:hover { color: var(--primary); }
.toc-h3 { padding-left: 1rem; font-size: .78rem; }
.related-list { display: flex; flex-direction: column; gap: .5rem; }
.related-item { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem; border-radius: var(--radius-sm); transition: background .15s; }
.related-item:hover { background: var(--bg3); }
.related-icon { font-size: 1rem; margin-top: .1rem; }
.related-title { font-size: .84rem; font-weight: 600; }
.related-meta  { font-size: .72rem; color: var(--text3); }
.info-row { display: flex; justify-content: space-between; font-size: .84rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.info-row span { color: var(--text3); }

/* ─── Chapter Footer / Share ─────────────────────────── */
.chapter-footer { margin: 2rem 0; padding: 1.5rem; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.share-section { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; font-size: .88rem; font-weight: 600; }
.share-btn-social { padding: .4rem .9rem; border-radius: 99px; font-size: .82rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); transition: all .15s; }
.share-btn-social:hover { transform: translateY(-1px); }
.whatsapp:hover  { background: rgba(37,211,102,.1); border-color: #25d366; color: #25d366; }
.facebook:hover  { background: rgba(24,119,242,.1); border-color: #1877f2; color: #1877f2; }
.copy:hover      { background: var(--primary-l); border-color: var(--primary); color: var(--primary); }

.contribute-cta-box { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px dashed rgba(79,70,229,.3); border-radius: var(--radius); padding: 1.5rem; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.contribute-cta-text h3 { font-size: 1rem; font-weight: 700; margin-bottom: .3rem; }
.contribute-cta-text p  { font-size: .85rem; color: var(--text3); }

/* ─── Page Headers ───────────────────────────────────── */
/* ─── Page min-height (prevents footer floating mid-screen on short pages) ── */
.search-page,
.boards-page,
.profile-page,
.bookmarks-page,
.page-content {
  min-height: calc(100vh - var(--nav-h) - var(--bottom-nav-h) - 100px);
}

.page-header { margin: 1rem 0 1.5rem; }
.page-header h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }
.page-subtitle { color: var(--text3); margin-top: .4rem; }

/* ─── Chapter List ───────────────────────────────────── */
.chapter-list { display: flex; flex-direction: column; gap: .5rem; }
.chapter-list-item { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.2rem; transition: all .15s; }
.chapter-list-item:hover { border-color: var(--primary); transform: translateX(3px); }
.chapter-num { font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--primary); min-width: 40px; }
.chapter-list-info { flex: 1; }
.chapter-list-title { font-weight: 600; font-size: .93rem; }
.chapter-list-meta  { display: flex; gap: .4rem; margin-top: .25rem; }
.chapter-list-stats { display: flex; align-items: center; gap: .75rem; font-size: .8rem; color: var(--text3); }
.arrow { color: var(--text3); font-size: 1rem; }

/* ─── Medium Tabs ────────────────────────────────────── */
.medium-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.medium-tab { padding: .45rem 1.1rem; border-radius: 99px; font-size: .85rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border); transition: all .15s; cursor: pointer; }
.medium-tab.active, .medium-tab:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-count { font-size: .72rem; opacity: .7; margin-left: .3rem; }

/* ─── Auth Pages ─────────────────────────────────────── */
.auth-page { min-height: calc(100vh - var(--nav-h) - var(--bottom-nav-h)); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 1.8rem; }
.auth-logo { font-size: 2.5rem; margin-bottom: .6rem; }
.auth-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.auth-header p  { color: var(--text3); font-size: .9rem; margin-top: .3rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer-links { text-align: center; font-size: .85rem; color: var(--text3); }
.auth-footer-links a { color: var(--primary); }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--text3); font-size: .82rem; margin: 1rem 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.auth-perks { display: flex; justify-content: center; gap: 1rem; margin-top: 1.2rem; flex-wrap: wrap; }
.perk { font-size: .78rem; color: var(--success); }
.input-password-wrap { position: relative; }
.password-toggle { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: .9rem; }

/* ─── Empty State ────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 4rem 2rem; text-align: center; color: var(--text3); }
.empty-icon { font-size: 3.5rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text2); }
.empty-state-sm { padding: 1.5rem; text-align: center; color: var(--text3); font-size: .88rem; }
.empty-td { text-align: center; color: var(--text3); padding: 2.5rem 1rem !important; font-size: .88rem; }

/* ─── Leaderboard ────────────────────────────────────── */
.leaderboard-list { display: flex; flex-direction: column; gap: .6rem; max-width: 700px; margin: 0 auto; }
.leaderboard-item { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; transition: all .15s; }
.leaderboard-item:hover { border-color: var(--primary); }
.top-1 { border-color: #f59e0b !important; background: rgba(245,158,11,.04) !important; }
.top-2 { border-color: #94a3b8 !important; }
.top-3 { border-color: #b45309 !important; }
.lb-rank { font-size: 1.4rem; min-width: 36px; text-align: center; }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.lb-info { flex: 1; }
.lb-name { font-weight: 700; }
.lb-meta { font-size: .78rem; color: var(--text3); display: flex; gap: .6rem; margin-top: .15rem; }
.lb-rep { font-family: var(--font-display); font-weight: 800; color: var(--warning); font-size: 1rem; }

/* ─── Profile ────────────────────────────────────────── */
.profile-page { padding: 2rem 0 3rem; }
.profile-header { display: flex; align-items: flex-start; gap: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.profile-avatar-img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); }
.profile-info { flex: 1; min-width: 0; }
.profile-info h1 { font-size: 1.4rem; font-weight: 800; margin: 0 0 .3rem; }
.profile-bio { color: var(--text2); font-size: .88rem; margin: .3rem 0 .5rem; line-height: 1.5; }
.profile-email { color: var(--text3); font-size: .85rem; margin: .2rem 0; }
.profile-badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; align-items: center; }
.profile-joined { font-size: .78rem; color: var(--text3); }
.profile-actions { display: flex; flex-direction: column; gap: .5rem; flex-shrink: 0; }
.rep-badge { background: rgba(217,119,6,.1); color: var(--warning); border: 1px solid rgba(217,119,6,.25); padding: .2rem .7rem; border-radius: 99px; font-size: .82rem; font-weight: 700; }
[data-theme="dark"] .rep-badge { background: rgba(245,158,11,.15); border-color: rgba(245,158,11,.3); }

/* Stats row */
.profile-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.profile-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.profile-stat-num { font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.profile-stat-label { font-size: .75rem; color: var(--text3); margin-top: .3rem; }

/* Badges */
.badge-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 99px; border: 1.5px solid; font-size: .82rem; font-weight: 600; background: transparent; }

/* Grid */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.profile-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.profile-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.bookmark-item { display: block; padding: .6rem .8rem; background: var(--bg3); border-radius: var(--radius-sm); transition: background .15s; margin-bottom: .4rem; text-decoration: none; }
.bookmark-item:hover { background: var(--border); }
.bookmark-title { font-weight: 600; font-size: .88rem; color: var(--text); }
.bookmark-meta  { font-size: .75rem; color: var(--text3); margin-top: .15rem; }

/* ─── Notifications ──────────────────────────────────── */
.notif-item { display: flex; align-items: flex-start; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; margin-bottom: .5rem; }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: .4rem; flex-shrink: 0; }
.notif-item:not(.unread) .notif-dot { background: var(--border2); }
.notif-content { flex: 1; font-size: .88rem; }
.notif-link { color: var(--primary); font-size: .82rem; display: block; margin-top: .25rem; }
.notif-time { font-size: .75rem; color: var(--text3); white-space: nowrap; }

/* ─── Status / Role Badges ───────────────────────────── */
.status-badge { display: inline-block; padding: .18rem .65rem; border-radius: 99px; font-size: .72rem; font-weight: 700; text-transform: capitalize; }
.status-published { background: rgba(5,150,105,.12); color: var(--success); }
.status-draft     { background: rgba(100,116,139,.12); color: var(--text2); }
.status-archived  { background: rgba(217,119,6,.12); color: var(--warning); }
.status-pending   { background: rgba(37,99,235,.12); color: var(--info); }
.status-approved  { background: rgba(5,150,105,.12); color: var(--success); }
.status-rejected  { background: rgba(220,38,38,.12); color: var(--danger); }
.status-open      { background: rgba(220,38,38,.12); color: var(--danger); }
.status-resolved  { background: rgba(5,150,105,.12); color: var(--success); }
[data-theme="dark"] .status-published { background: rgba(16,185,129,.2); color: #6ee7b7; }
[data-theme="dark"] .status-draft     { background: rgba(100,116,139,.2); color: #94a3b8; }
[data-theme="dark"] .status-archived  { background: rgba(245,158,11,.2); color: #fcd34d; }
[data-theme="dark"] .status-pending   { background: rgba(59,130,246,.2); color: #93c5fd; }
[data-theme="dark"] .status-approved  { background: rgba(16,185,129,.2); color: #6ee7b7; }
[data-theme="dark"] .status-rejected  { background: rgba(239,68,68,.2); color: #fca5a5; }
[data-theme="dark"] .status-open      { background: rgba(239,68,68,.2); color: #fca5a5; }
[data-theme="dark"] .status-resolved  { background: rgba(16,185,129,.2); color: #6ee7b7; }
.role-badge { display: inline-block; padding: .18rem .65rem; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.role-admin  { background: rgba(79,70,229,.12); color: var(--primary); }
.role-editor { background: rgba(217,119,6,.12); color: var(--warning); }
.role-user   { background: rgba(100,116,139,.12); color: var(--text2); }
[data-theme="dark"] .role-admin  { background: rgba(99,102,241,.2); color: #a5b4fc; }
[data-theme="dark"] .role-editor { background: rgba(245,158,11,.2); color: #fcd34d; }
[data-theme="dark"] .role-user   { background: rgba(100,116,139,.2); color: #94a3b8; }

/* ─── Forms ──────────────────────────────────────────── */
.form-page    { max-width: 640px; margin: 2rem auto; padding: 0 1.5rem; }
.form-page-lg { max-width: 760px; margin: 2rem auto; padding: 0 1.5rem; }
.page-narrow  { max-width: 700px; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; }
.form-card h1 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: .5rem; }
.form-card p  { color: var(--text3); margin-bottom: 1.5rem; }
.form-group   { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-group label { font-size: .88rem; font-weight: 600; color: var(--text2); }
.form-group small { font-size: .75rem; color: var(--text3); font-weight: 400; }
.checkbox-label { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; }
.checkbox-label input { width: auto; }

/* ─── Board / Boards pages ───────────────────────────── */
.boards-page    { padding: 2rem 0; }
.bookmarks-page { padding: 2rem 0; }
.page-content   { padding: 2rem 0; }
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; transition: all .2s; }
.board-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.board-card-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.board-card-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.board-card-info { font-size: .8rem; color: var(--text3); margin-top: .25rem; }

/* ─── Search Results ─────────────────────────────────── */
.search-page { padding: 2rem 0; }
.search-form-bar { display: flex; gap: .75rem; margin-bottom: 2rem; flex-wrap: wrap; }
.search-form-bar input { flex: 1; min-width: 200px; }
.search-results-count { color: var(--text3); font-size: .9rem; margin-bottom: 1.2rem; }
.search-results-count strong { color: var(--primary); }

/* ─── Banners ────────────────────────────────────────── */
.cookie-banner { position: fixed; bottom: calc(var(--bottom-nav-h) + .75rem); left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.2rem; box-shadow: var(--shadow-lg); z-index: 850; width: min(500px, calc(100vw - 2rem)); }
.cookie-inner { display: flex; align-items: center; gap: 1rem; font-size: .85rem; }
.cookie-inner p { flex: 1; color: var(--text2); }
.cookie-inner a { color: var(--primary); }
.pwa-banner { position: fixed; bottom: calc(var(--bottom-nav-h) + .75rem); left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1.2rem; box-shadow: var(--shadow-lg); z-index: 840; width: min(440px, calc(100vw - 2rem)); }
.pwa-inner { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.pwa-inner span { flex: 1; }

/* ─── Footer ─────────────────────────────────────────── */
.footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 3rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand p { color: var(--text3); font-size: .85rem; margin: .75rem 0 1rem; line-height: 1.6; }
.footer-links h4 { font-weight: 700; font-size: .88rem; margin-bottom: .75rem; color: var(--text); }
.footer-links a  { display: block; font-size: .83rem; color: var(--text3); margin-bottom: .4rem; transition: color .15s; }
.footer-links a:hover { color: var(--primary); }
.newsletter-mini { display: flex; gap: .4rem; }
.newsletter-mini input { flex: 1; border-radius: 99px; padding: .45rem .9rem; font-size: .82rem; }
.newsletter-mini button { background: var(--primary); color: #fff; border: none; padding: .45rem 1rem; border-radius: 99px; font-size: .82rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .8rem; color: var(--text3); }
.footer-bottom a { color: var(--text3); }
.footer-bottom a:hover { color: var(--primary); }

/* ─── Pagination ─────────────────────────────────────── */
.pagination { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; margin-top: 1.5rem; }
.page-btn { display: inline-block; padding: .4rem .8rem; border-radius: var(--radius-sm); font-size: .85rem; background: var(--surface); border: 1px solid var(--border); color: var(--text2); transition: all .15s; text-decoration: none; }
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Misc ───────────────────────────────────────────── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text3) !important; }
.tab-bar      { display: flex; gap: .5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.tab          { padding: .6rem 1.2rem; font-size: .88rem; font-weight: 600; color: var(--text3); border-bottom: 2px solid transparent; transition: all .15s; }
.tab.active, .tab:hover { color: var(--primary); border-bottom-color: var(--primary); }
.modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.8rem; max-width: 460px; width: 100%; box-shadow: var(--shadow-lg); }
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.error-page    { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 3rem 1rem; }
.error-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.error-code { font-family: var(--font-display); font-size: 6rem; font-weight: 900; color: var(--primary); opacity: .2; line-height: 1; }
.error-title { font-size: 1.5rem; font-weight: 700; margin: .5rem 0; }
.error-subtitle { color: var(--text3); margin-bottom: 1.5rem; }
.contribution-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; }
.contribution-guide { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.guide-title        { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.guide-body         { font-size: .85rem; color: var(--text3); line-height: 1.8; }
.cont-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; flex-wrap: wrap; gap: .5rem; }
.cont-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .85rem; color: var(--text3); }
.cont-meta strong { color: var(--text); }
.cont-actions { display: flex; gap: .5rem; }
.cont-title { font-weight: 700; font-size: 1rem; margin-bottom: .6rem; }
.cont-preview { font-size: .88rem; color: var(--text3); }
.cont-full { margin-top: .75rem; border-top: 1px solid var(--border); padding-top: .75rem; }

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ─── Animations ─────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .35s ease forwards; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .chapter-grid { grid-template-columns: 1fr; }
  .chapter-sidebar .sidebar-widget { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --nav-h: 56px; }
  .navbar-search { display: none; }
  .navbar-links  { display: none; }
  .mobile-menu-btn { display: block; }
  .bottom-nav    { display: grid; }
  .class-grid    { grid-template-columns: repeat(4, 1fr); }
  .hero-inner    { grid-template-columns: 1fr; }
  .hero-stats    { display: none; }
  .footer-grid   { grid-template-columns: 1fr; }
  .footer        { padding: 1.5rem 0 1rem; }
  .footer-grid   { gap: 1rem; margin-bottom: 1rem; }
  .cta-card      { flex-direction: column; }
  .profile-grid  { grid-template-columns: 1fr; gap: 1rem; }
  .profile-stats-row { grid-template-columns: repeat(2, 1fr); }
  .profile-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .profile-actions { flex-direction: row; }
  .hero          { padding: 3rem 0 2.5rem; }
  .cards-grid-3, .cards-grid-4 { grid-template-columns: 1fr 1fr; }
  .page-header   { margin: .75rem 0 1.25rem; }
  .breadcrumb    { flex-wrap: wrap; gap: .2rem; }
  .main-content  { padding-bottom: calc(var(--bottom-nav-h, 64px) + 1rem); }
  .board-tabs    { gap: .3rem; }
  .board-tab     { padding: .25rem .65rem; font-size: .75rem; }
}
@media (max-width: 480px) {
  .container { padding: 0 .85rem; }
  .class-grid { grid-template-columns: repeat(3, 1fr); }
  .cards-grid-3, .cards-grid-4 { grid-template-columns: 1fr; }
  .auth-card  { padding: 1.5rem; }
  .section    { padding: 2rem 0; }
  /* Stats bar single column on tiny screens */
  .stats-grid-home { grid-template-columns: 1fr 1fr; }
  /* Table horizontal scroll for chapter/subject tables */
  .table-wrapper { -webkit-overflow-scrolling: touch; }
}
.as-fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 8px;
  font-size: 1em;
  line-height: 1.4;
}

.as-fraction .numerator {
  border-bottom: 1.5px solid currentColor;
  padding: 2px 12px;
  text-align: center;
  white-space: nowrap;
}

.as-fraction .denominator {
  padding: 2px 12px;
  text-align: center;
  white-space: nowrap;
}.criss-cross {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 8px;
  padding: .75rem 1.25rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.criss-cross .cc-label {
  font-size: .9em;
  font-weight: 600;
  color: var(--teal);
  margin-bottom: 4px;
  align-self: flex-start;
}

.criss-cross .cc-row {
  display: flex;
  align-items: center;
  gap: 56px;
}

.criss-cross .cc-element {
  font-size: 1.25em;
  font-weight: 700;
  text-align: center;
  min-width: 40px;
  color: var(--heading-color);
}

.criss-cross .cc-val {
  font-size: 1em;
  text-align: center;
  min-width: 40px;
  color: var(--body-color);
}