/* ============================================
   JAMB CBT PREP — STYLESHEET
   Font: Sora (display) + JetBrains Mono (code/numbers)
   Theme: Dark navy with electric blue accents
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1a2235;
  --bg4: #232d42;
  --card: #141b2d;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --blue: #1a6fff;
  --blue2: #3d8bff;
  --blue-dim: rgba(26,111,255,0.15);
  --green: #00c896;
  --green-dim: rgba(0,200,150,0.12);
  --red: #ff4d6a;
  --red-dim: rgba(255,77,106,0.12);
  --amber: #ffb342;
  --amber-dim: rgba(255,179,66,0.12);
  --purple: #a78bfa;
  --text: #e8edf5;
  --text2: #8c9ab5;
  --text3: #5c6a85;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SPLASH ── */
.splash {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; }
.logo-mark {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 24px rgba(26,111,255,0.4));
}
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.splash-inner h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.splash-inner h1 span { color: var(--blue); }
.splash-inner p { color: var(--text2); margin-top: 8px; font-size: 14px; }
.splash-bar {
  width: 200px; height: 3px; background: var(--bg3);
  border-radius: 2px; margin: 20px auto 0; overflow: hidden;
}
.splash-fill {
  height: 100%; width: 0; background: var(--blue);
  border-radius: 2px; animation: fillBar 1.5s ease forwards;
}
@keyframes fillBar { to { width: 100%; } }

/* ── LAYOUT ── */
#app { min-height: 100vh; }

.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ── NAVBAR ── */
.navbar {
  height: 60px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px;
  gap: 12px; position: sticky; top: 0; z-index: 100;
}
.navbar .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.navbar .logo-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.navbar .logo-text { font-weight: 700; font-size: 17px; color: var(--text); }
.navbar .logo-text span { color: var(--blue); }
.navbar .nav-links { display: flex; gap: 4px; margin-left: 16px; }
.nav-link {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text2); cursor: pointer; transition: all 0.2s; border: none;
  background: none; font-family: var(--font);
}
.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-link.active { color: var(--blue); background: var(--blue-dim); }
.navbar .spacer { flex: 1; }
.navbar .user-pill {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px;
  background: var(--bg3); border-radius: 999px; border: 1px solid var(--border);
  cursor: pointer;
}

.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
}
.user-name { font-size: 13px; color: var(--text2); }

/* ── MOBILE MENU ── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger-btn:hover { background: var(--bg3); }

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s;
}
.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 201;
  display: flex;
  flex-direction: column;
}

.mobile-menu-overlay.active .mobile-menu {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-title {
  font-weight: 600;
  font-size: 16px;
}

.mobile-menu-close {
  width: 32px;
  height: 32px;
  background: var(--bg3);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-close:hover { background: var(--border); }

.mobile-menu-links {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.mobile-menu-links button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}

.mobile-menu-links button:hover {
  background: var(--bg3);
  color: var(--text);
}

.mobile-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

body.is-admin .hamburger-btn {
  display: flex !important;
}

.mobile-menu-divider {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
}

/* ── AUTH PAGES ── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(26,111,255,0.07) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.05) 0%, transparent 50%);
  padding: 20px;
}
.auth-box {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-logo .logo-icon { width: 40px; height: 40px; }
.auth-logo h2 { font-size: 20px; font-weight: 700; }
.auth-logo h2 span { color: var(--blue); }
.auth-box h3 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.auth-box .sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 14px;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim);
}
.form-group select option { background: var(--bg3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.password-field { display: flex; align-items: center; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.password-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.password-input {
  flex: 1; background: transparent; border: none; padding: 10px 14px; color: var(--text);
  font-family: var(--font); font-size: 14px; outline: none;
}
.password-field .password-toggle {
  background: transparent; border: none; padding: 10px 14px; cursor: pointer;
  color: var(--text2); font-size: 16px; transition: color 0.2s;
}
.password-field .password-toggle:hover { color: var(--text); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm); font-family: var(--font);
  font-size: 14px; font-weight: 500; cursor: pointer; border: none;
  transition: all 0.2s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue2); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(26,111,255,0.35); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: var(--bg4); border-color: var(--border2); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,77,106,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── CARDS ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-lg { padding: 28px; }

/* ── DASHBOARD ── */
.dashboard { flex: 1; padding: 24px 20px; max-width: 1100px; margin: 0 auto; width: 100%; }
.dash-header { margin-bottom: 24px; }
.dash-header h2 { font-size: 22px; font-weight: 600; }
.dash-header p { color: var(--text2); font-size: 14px; margin-top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-card .stat-label { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-card .stat-val { font-size: 26px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.stat-card .stat-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.stat-card.blue { border-color: rgba(26,111,255,0.3); }
.stat-card.blue .stat-val { color: var(--blue2); }
.stat-card.green { border-color: rgba(0,200,150,0.3); }
.stat-card.green .stat-val { color: var(--green); }
.stat-card.amber { border-color: rgba(255,179,66,0.3); }
.stat-card.amber .stat-val { color: var(--amber); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.dash-grid.full { grid-template-columns: 1fr; }
@media (max-width: 700px) { .dash-grid { grid-template-columns: 1fr; } .form-row { grid-template-columns: 1fr; } }

.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text3); margin-bottom: 14px;
}

/* Subject pills */
.subject-list { display: flex; flex-wrap: wrap; gap: 8px; }
.subject-pill {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text2);
  cursor: pointer; transition: all 0.15s;
}
.subject-pill:hover { border-color: var(--blue); color: var(--blue); }
.subject-pill.selected { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.subject-pill.compulsory { border-color: rgba(0,200,150,0.4); color: var(--green); background: var(--green-dim); cursor: default; }

/* Quick actions */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-btn {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg3); cursor: pointer; transition: all 0.2s; text-align: left;
}
.action-btn:hover { border-color: var(--blue); background: var(--blue-dim); }
.action-btn .action-icon { font-size: 22px; margin-bottom: 8px; }
.action-btn .action-label { font-size: 13px; font-weight: 600; color: var(--text); }
.action-btn .action-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* History list */
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-score {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 600;
}
.history-score.good { background: var(--green-dim); color: var(--green); }
.history-score.mid { background: var(--amber-dim); color: var(--amber); }
.history-score.low { background: var(--red-dim); color: var(--red); }
.history-info { flex: 1; }
.history-info .h-subjects { font-size: 13px; font-weight: 500; }
.history-info .h-date { font-size: 12px; color: var(--text3); margin-top: 1px; }
.history-jamb { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text2); }

/* ── EXAM SETUP ── */
.setup-page { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 32px 20px; }
.setup-box { width: 100%; max-width: 580px; }
.setup-box h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.setup-box .setup-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.mode-card {
  padding: 14px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg3); cursor: pointer; transition: all 0.2s; text-align: center;
}
.mode-card:hover { border-color: var(--blue2); }
.mode-card.selected { border-color: var(--blue); background: var(--blue-dim); }
.mode-card .mode-icon { font-size: 24px; margin-bottom: 6px; }
.mode-card .mode-name { font-size: 13px; font-weight: 600; }
.mode-card .mode-desc { font-size: 11px; color: var(--text2); margin-top: 2px; }
@media (max-width: 500px) { .mode-cards { grid-template-columns: 1fr; } }

/* ── EXAM ENGINE ── */
.exam-page { flex: 1; display: flex; flex-direction: column; }
.exam-topbar {
  height: 56px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.exam-topbar .subject-tab {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  cursor: pointer; transition: all 0.2s;
}
.exam-topbar .subject-tab.active { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.exam-topbar .spacer { flex: 1; }
.timer-display {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--amber-dim); color: var(--amber);
  border: 1px solid rgba(255,179,66,0.2);
}
.timer-display.low { background: var(--red-dim); color: var(--red); border-color: rgba(255,77,106,0.2); }

.exam-body { flex: 1; display: grid; grid-template-columns: 220px 1fr; }
@media (max-width: 768px) {
  .exam-body { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .exam-sidebar {
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    order: 2; width: 100%; padding: 8px 12px;
    border-right: none; border-top: 1px solid var(--border); overflow-x: auto;
  }
  .exam-sidebar .section-title { display: none; }
  .exam-sidebar .q-legend { display: none; }
  .exam-sidebar .divider { display: none; }
  .exam-sidebar .text-xs { display: none; }
  .exam-sidebar .q-navigator {
    display: flex; grid-template-columns: none; gap: 6px;
    margin-top: 0; overflow-x: auto;
  }
  .exam-sidebar .q-navigator::-webkit-scrollbar { display: none; }
  .exam-sidebar .q-nav-btn { width: 36px; height: 36px; flex-shrink: 0; }
  .exam-main { order: 1; }
}

.exam-sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 16px; overflow-y: auto;
}
.q-navigator { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 8px; }
.q-nav-btn {
  width: 100%; aspect-ratio: 1; border-radius: 7px; font-size: 12px; font-weight: 600;
  font-family: var(--mono); display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg3); color: var(--text3);
  transition: all 0.15s;
}
.q-nav-btn:hover { border-color: var(--border2); color: var(--text); }
.q-nav-btn.answered { background: var(--green-dim); border-color: rgba(0,200,150,0.4); color: var(--green); }
.q-nav-btn.flagged { background: var(--amber-dim); border-color: rgba(255,179,66,0.3); color: var(--amber); }
.q-nav-btn.current { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.q-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.q-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.q-legend-dot { width: 12px; height: 12px; border-radius: 3px; }

.exam-main { flex: 1; padding: 28px 24px; overflow-y: auto; max-width: 720px; }
.q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.q-meta { font-size: 13px; color: var(--text3); }
.q-meta span { color: var(--text2); font-weight: 500; }
.flag-btn {
  display: flex; align-items: center; gap: 5px; padding: 5px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border2);
  background: transparent; color: var(--text2); font-size: 13px; cursor: pointer;
  font-family: var(--font); transition: all 0.2s;
}
.flag-btn.flagged { background: var(--amber-dim); border-color: rgba(255,179,66,0.3); color: var(--amber); }
.flag-btn:hover { border-color: var(--amber); color: var(--amber); }

.q-text { font-size: 16px; line-height: 1.7; color: var(--text); margin-bottom: 24px; }
.q-text em { color: var(--blue2); font-style: italic; }

.options-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.option-btn {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg3); cursor: pointer; transition: all 0.2s; text-align: left;
  width: 100%; font-family: var(--font);
}
.option-btn:hover { border-color: var(--border2); background: var(--bg4); }
.option-btn.selected { border-color: var(--blue); background: var(--blue-dim); }
.option-btn.correct { border-color: var(--green); background: var(--green-dim); }
.option-btn.wrong { border-color: var(--red); background: var(--red-dim); }
.option-letter {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; background: var(--bg4); color: var(--text2);
  border: 1px solid var(--border2);
}
.option-btn.selected .option-letter { background: var(--blue); color: #fff; border-color: var(--blue); }
.option-btn.correct .option-letter { background: var(--green); color: #fff; border-color: var(--green); }
.option-btn.wrong .option-letter { background: var(--red); color: #fff; border-color: var(--red); }
.option-text { font-size: 14px; color: var(--text); line-height: 1.5; }

/* Study mode explanation */
.explanation-box {
  background: var(--bg3); border: 1px solid rgba(0,200,150,0.2);
  border-left: 3px solid var(--green); border-radius: var(--radius-sm);
  padding: 16px; margin-top: 4px;
}
.explanation-box .exp-label { font-size: 11px; font-weight: 600; color: var(--green); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.explanation-box .exp-text { font-size: 13px; color: var(--text2); line-height: 1.7; white-space: pre-line; }

.exam-nav { display: flex; gap: 10px; align-items: center; }
.q-progress-text { flex: 1; font-size: 13px; color: var(--text3); text-align: center; }
.progress-bar { height: 3px; background: var(--bg3); border-radius: 2px; margin: 0 0 20px; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.3s; }

/* Submit modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  opacity: 0; visibility: hidden; transition: all 0.2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 420px;
  transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--text2); margin-bottom: 20px; line-height: 1.6; }
.modal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.modal-stat { background: var(--bg3); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.modal-stat .ms-val { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.modal-stat .ms-label { font-size: 12px; color: var(--text2); margin-top: 2px; }
.modal-actions { display: flex; gap: 10px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text2); cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ── RESULTS PAGE ── */
.result-page { flex: 1; padding: 24px 20px; }
.result-inner { max-width: 800px; margin: 0 auto; }
.score-hero {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 28px;
  text-align: center; margin-bottom: 20px;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(26,111,255,0.1) 0%, transparent 60%);
}
.score-circle {
  width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 3px solid var(--blue);
  background: var(--blue-dim);
}
.score-circle .sc-num { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--blue2); }
.score-circle .sc-label { font-size: 10px; color: var(--text2); }
.score-hero h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.score-hero p { font-size: 14px; color: var(--text2); }
.jamb-score-display {
  display: inline-flex; align-items: baseline; gap: 4px;
  background: var(--blue-dim); border: 1px solid rgba(26,111,255,0.3);
  border-radius: var(--radius-sm); padding: 8px 18px; margin-top: 12px;
}
.jamb-score-display .js-num { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--blue); }
.jamb-score-display .js-label { font-size: 13px; color: var(--text2); margin-left: 4px; }

.subject-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.sub-result-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.sub-result-card .sr-name { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text2); text-transform: capitalize; }
.sub-result-card .sr-score { font-family: var(--mono); font-size: 24px; font-weight: 700; }
.sub-result-card .sr-score.good { color: var(--green); }
.sub-result-card .sr-score.mid { color: var(--amber); }
.sub-result-card .sr-score.low { color: var(--red); }
.sub-result-card .sr-bar { height: 4px; background: var(--bg3); border-radius: 2px; margin-top: 8px; }
.sub-result-card .sr-fill { height: 100%; border-radius: 2px; background: var(--blue); }

.wrong-section { margin-top: 8px; }
.wrong-q-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 12px;
}
.wrong-q-item .wq-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.wrong-q-item .wq-text { font-size: 14px; color: var(--text); line-height: 1.6; flex: 1; }
.wrong-q-item .wq-topic { font-size: 11px; color: var(--text3); padding: 3px 8px; background: var(--bg3); border-radius: 999px; white-space: nowrap; }
.answer-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.answer-tag {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 500;
}
.answer-tag.yours { background: var(--red-dim); color: var(--red); }
.answer-tag.correct { background: var(--green-dim); color: var(--green); }
.load-explanation-btn {
  font-size: 13px; color: var(--blue2); background: none; border: none;
  cursor: pointer; font-family: var(--font); padding: 0;
  display: flex; align-items: center; gap: 5px;
}
.load-explanation-btn:hover { text-decoration: underline; }

/* ── ANALYTICS PAGE ── */
.analytics-page { flex: 1; padding: 24px 20px; }
.analytics-inner { max-width: 900px; margin: 0 auto; }
.chart-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.trend-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 12px; }
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--blue); min-height: 4px; transition: height 0.4s; }
.trend-label { font-size: 10px; color: var(--text3); font-family: var(--mono); }

.weak-topic-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.weak-topic-item:last-child { border-bottom: none; }
.weak-topic-name { flex: 1; font-size: 13px; }
.weak-topic-count { font-size: 12px; font-family: var(--mono); color: var(--red); background: var(--red-dim); padding: 2px 8px; border-radius: 999px; }

/* ── SYLLABUS PAGE ── */
.syllabus-page { flex: 1; padding: 24px 20px; }
.syllabus-inner { max-width: 800px; margin: 0 auto; }
.syllabus-subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.syllabus-subject-btn {
  padding: 14px 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s; text-align: left;
}
.syllabus-subject-btn:hover, .syllabus-subject-btn.active { border-color: var(--blue); background: var(--blue-dim); }
.syllabus-subject-btn .ss-name { font-size: 14px; font-weight: 500; }
.syllabus-subject-btn .ss-count { font-size: 12px; color: var(--text3); margin-top: 3px; }
.topic-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.topic-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg3); border-radius: var(--radius-sm); font-size: 13px;
}
.topic-item::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }

/* ── ADMIN PANEL ── */
.admin-page { flex: 1; display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
@media (max-width: 768px) { .admin-page { grid-template-columns: 1fr; } .admin-sidebar { display: none; } }

.admin-sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 20px 12px;
}
.admin-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text2); transition: all 0.2s; margin-bottom: 2px;
}
.admin-nav-item:hover { background: var(--bg3); color: var(--text); }
.admin-nav-item.active { background: var(--blue-dim); color: var(--blue); }
.admin-content { padding: 24px; overflow-y: auto; }
.admin-section { display: none; }
.admin-section.active { display: block; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; padding: 10px 14px; background: var(--bg3); color: var(--text2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
table tr:hover td { background: var(--bg3); }
table .badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
table .badge.pending { background: var(--amber-dim); color: var(--amber); }
table .badge.live { background: var(--green-dim); color: var(--green); }

.upload-zone {
  border: 2px dashed var(--border2); border-radius: var(--radius-lg);
  padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s;
  background: var(--bg3);
}
.upload-zone:hover { border-color: var(--blue); background: var(--blue-dim); }
.upload-zone .uz-icon { font-size: 36px; margin-bottom: 10px; }
.upload-zone p { color: var(--text2); font-size: 14px; }
.upload-zone small { color: var(--text3); font-size: 12px; }

.progress-track { background: var(--bg3); border-radius: 999px; height: 8px; overflow: hidden; margin-top: 10px; }
.progress-track-fill { height: 100%; background: var(--blue); border-radius: 999px; transition: width 0.4s; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius); max-width: 340px;
  font-size: 14px; animation: slideIn 0.3s ease; box-shadow: var(--shadow);
  border: 1px solid var(--border2);
}
.toast.success { background: var(--card); border-left: 3px solid var(--green); }
.toast.error { background: var(--card); border-left: 3px solid var(--red); }
.toast.info { background: var(--card); border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── LOADING ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px 20px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 60px 20px; }
.empty .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty p { font-size: 14px; color: var(--text2); max-width: 320px; margin: 0 auto 20px; }

/* ── UTILITY ── */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag-blue { background: var(--blue-dim); color: var(--blue2); }
.tag-green { background: var(--green-dim); color: var(--green); }
.tag-amber { background: var(--amber-dim); color: var(--amber); }
.tag-red { background: var(--red-dim); color: var(--red); }
.flex { display: flex; flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Result page actions */
.result-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.result-actions .btn {
  flex: 1;
  min-width: 130px;
  justify-content: center;
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}
.back-btn:hover {
  background: var(--bg4);
  color: var(--text);
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.link { color: var(--blue2); cursor: pointer; font-size: 14px; }
.link:hover { text-decoration: underline; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── MATH RENDERING (KaTeX) ── */
.katex { font-size: 1.1em; color: var(--text); }
.katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; }
.katex-display > .katex { font-size: 1.2em; }
.q-text .katex { font-size: 1.15em; }
.option-text .katex, .exp-text .katex, .wq-text .katex { font-size: 1em; }
.katex .mord, .katex .mbin, .katex .mrel, .katex .mopen, .katex .mclose, .katex .mpunct { color: var(--text); }

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */

/* Base mobile adjustments */
@media (max-width: 768px) {
  body { font-size: 14px; overflow-x: hidden; }
  
  /* Padding adjustments */
  .dashboard, .result-page, .analytics-page, .syllabus-page { padding: 16px 12px; }
  .admin-content { padding: 16px 12px; }
  .exam-main { padding: 16px 12px; }
  .exam-topbar { padding: 0 12px; gap: 8px; }
  
  /* Navbar mobile - hide user name and desktop nav, show hamburger */
  .navbar .user-name { display: none; }
  .navbar .logo-text { font-size: 15px; }
  .navbar .nav-links { display: none; }
  .navbar .hamburger-btn { display: flex; }
  .navbar .user-pill { margin-left: auto; }
  
  /* Result actions on mobile - stack buttons */
  .result-actions {
    flex-direction: column;
  }
  .result-actions .btn {
    width: 100%;
    min-width: unset;
  }
  
  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .stat-card .stat-val { font-size: 22px; }
  
  /* Dashboard grid */
  .dash-grid { grid-template-columns: 1fr !important; }
  .dash-grid.full { grid-template-columns: 1fr !important; }
  
  /* Question header */
  .q-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .flag-btn { align-self: flex-start; }
  
  /* Question text */
  .q-text { font-size: 15px; }
  
  /* Options */
  .option-btn { padding: 12px; gap: 10px; }
  .option-letter { width: 26px; height: 26px; font-size: 12px; }
  .option-text { font-size: 13px; }
  
  /* Navigation */
  .exam-nav { flex-wrap: wrap; justify-content: center; }
  .q-progress-text { order: -1; width: 100%; margin-bottom: 8px; }
  
  /* Results */
  .score-hero { padding: 24px 16px; }
  .score-circle { width: 80px; height: 80px; }
  .score-circle .sc-num { font-size: 20px; }
  .jamb-score-display { padding: 6px 14px; }
  .jamb-score-display .js-num { font-size: 22px; }
  
  /* Subject breakdown */
  .subject-breakdown { grid-template-columns: repeat(2, 1fr) !important; }
  
  /* Wrong questions */
  .wrong-q-item { padding: 14px; }
  .wrong-q-item .wq-header { flex-direction: column; gap: 8px; }
  .wrong-q-item .wq-text { font-size: 13px; }
  .answer-row { flex-direction: column; gap: 6px; }
  .answer-tag { align-self: flex-start; }
  
  /* Analytics */
  .chart-box { padding: 14px; }
  .trend-chart { height: 100px; }
  
  /* Tables */
  .table-wrap { font-size: 12px; }
  table th, table td { padding: 8px 10px; }
  
  /* Auth */
  .auth-box { padding: 24px 20px; }
  
  /* Setup */
  .setup-box { max-width: 100%; }
  
  /* Modal */
  .modal { padding: 20px; }
  .modal-actions { flex-direction: column; }
  
  /* Toast - bottom center on mobile */
  .toast-container { 
    left: 12px; right: 12px; bottom: 12px; 
    align-items: center;
  }
  .toast { max-width: 100%; width: 100%; }
  
  /* AI Tools */
  .ai-card { padding: 16px; }
  .ai-card h3 { font-size: 16px; }
  
  /* AI Tools grids - stack on mobile */
  .dash-grid .card { margin-bottom: 12px; }
  
  /* Progress bars */
  .progress-track { height: 6px; }
  
  /* Full-width cards on mobile */
  .card { width: 100%; margin-bottom: 12px; }
  
  /* Modal fixes */
  .modal-overlay { padding: 12px; }
  .modal { max-height: 85vh; }
  
  /* Better touch targets for subject pills */
  .subject-pill {
    padding: 8px 12px;
  }
  
  /* Question number navigator - smaller on mobile */
  .q-navigator { gap: 4px; }
  .q-nav-btn { font-size: 11px; }
  
  /* Novel tabs - horizontal scroll on mobile */
  .novel-tabs { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .novel-tabs::-webkit-scrollbar { display: none; }
  .novel-tab { flex-shrink: 0; }
  
  /* Exam top bar - horizontal scroll on small screens */
  .exam-topbar { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .exam-topbar::-webkit-scrollbar { display: none; }
  
  /* Mobile admin header hint */
  .admin-content::before {
    content: '☰ Use menu button in navbar for admin navigation';
    display: none;
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 12px;
    text-align: center;
  }
  
  /* Mobile admin view */
  @media (max-width: 768px) {
    .admin-content::before { display: block; }
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  /* Stats - single column */
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  
  /* Subject breakdown - single column */
  .subject-breakdown { grid-template-columns: 1fr !important; }
  
  /* Syllabus - single column */
  .syllabus-subject-grid { grid-template-columns: 1fr !important; }
  
  /* Progress bar text hidden on very small screens */
  .q-meta { font-size: 12px; }
  
  /* Exam topbar */
  .exam-topbar .subject-tab { padding: 4px 10px; font-size: 12px; }
  .timer-display { padding: 4px 10px; font-size: 13px; }
  
  /* Logo */
  .logo-mark { width: 36px; height: 36px; }
  
  /* Dashboard header */
  .dash-header h2 { font-size: 18px; }
  
  /* Score hero */
  .score-hero h2 { font-size: 18px; }
  .score-circle { width: 70px; height: 70px; }
  
  /* Buttons */
  .btn { padding: 10px 16px; font-size: 13px; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
  
  /* Form inputs */
  .form-group input, .form-group select {
    padding: 10px 12px; font-size: 14px; }
  
  /* Cards */
  .card { padding: 14px; }
  .card-lg { padding: 20px; }
  
  /* Auth pages */
  .auth-box { padding: 20px 16px; }
  .auth-logo h2 { font-size: 18px; }
  .auth-box h3 { font-size: 18px; }
  
  /* Question navigator - 4 columns on small screens */
  .q-navigator { grid-template-columns: repeat(4, 1fr) !important; }
  
  /* Smaller text for stats */
  .stat-card .stat-val { font-size: 20px; }
  
  /* Study mode cards - tighter on very small screens */
  .mode-card { padding: 14px 10px; }
  .mode-card .mode-icon { font-size: 20px; }
  .mode-card .mode-name { font-size: 12px; }
  .mode-card .mode-desc { font-size: 10px; }
  
  /* Subject tabs - horizontal scroll */
  .exam-topbar { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .exam-topbar::-webkit-scrollbar { display: none; }
}

/* Touch-friendly targets */
@media (max-width: 768px) {
  button, .btn, .nav-link, .action-btn, .mode-card, .subject-pill, 
  .admin-nav-item, .syllabus-subject-btn, .q-nav-btn, .option-btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* Touch-friendly form inputs */
  .form-group input, .form-group select {
    min-height: 44px;
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
  
  /* Ensure table cells are touch-friendly */
  table td { min-height: 44px; }
  
  /* Hide horizontal overflow */
  html { overflow-x: hidden; }
  
  /* Full-width buttons on mobile */
  .btn-full-mobile { width: 100%; display: block; }
  
  /* Better option buttons for touch */
  .option-btn {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Prevent text selection on buttons */
  .btn, .option-btn, .action-btn, .mode-card, .subject-pill {
    -webkit-user-select: none;
    user-select: none;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .splash-inner { transform: scale(0.8); }
  .logo-mark { width: 48px; height: 48px; }
}

/* High contrast improvements for accessibility */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(255,255,255,0.2);
    --text: #fff;
    --text2: #ccc;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  body { background: #fff; color: #000; }
  .navbar, .exam-nav, .flag-btn, .toast-container { display: none !important; }
  .exam-main { padding: 0; max-width: 100%; }
  .card, .wrong-q-item { border: 1px solid #ccc; margin-bottom: 10px; page-break-inside: avoid; }
}

/* ── SUPPORT PAGES ── */
.support-page { padding: 20px 20px 40px; max-width: 600px; margin: 0 auto; }
.support-inner { width: 100%; }

.info-box {
  background: var(--blue-dim); border: 1px solid var(--blue);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13px; color: var(--text);
}
.info-box code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.info-box a { color: var(--blue); text-decoration: none; }
.info-box a:hover { text-decoration: underline; }

.ticket-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: border-color 0.2s;
}
.ticket-card:hover { border-color: var(--blue); }
.ticket-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ticket-category { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.ticket-status {
  font-size: 11px; padding: 3px 8px; border-radius: 4px; font-weight: 500; text-transform: uppercase;
}
.ticket-status.open { background: var(--amber-dim); color: var(--amber); }
.ticket-status.pending { background: var(--blue-dim); color: var(--blue); }
.ticket-status.resolved { background: var(--green-dim); color: var(--green); }
.ticket-subject { font-weight: 500; margin-bottom: 4px; }
.ticket-date { font-size: 12px; color: var(--text2); }

.ticket-detail { padding: 8px 0; }
.ticket-meta { display: flex; gap: 8px; margin-bottom: 12px; }
.ticket-user-info { margin-bottom: 12px; }
.ticket-user-info strong { display: block; }
.ticket-user-info .ticket-email, .ticket-user-info span { font-size: 13px; color: var(--text2); }
.ticket-message { margin: 12px 0; line-height: 1.6; }

.admin-response {
  background: var(--bg3); border-left: 3px solid var(--blue); padding: 12px; margin-top: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.response-label { font-size: 11px; color: var(--blue); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.response-text { line-height: 1.6; }
.response-date { font-size: 12px; color: var(--text2); margin-top: 8px; }

.admin-ticket-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-btn {
  padding: 6px 12px; border-radius: 6px; font-size: 13px; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--text2); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.admin-ticket-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: border-color 0.2s;
}
.admin-ticket-card:hover { border-color: var(--blue); }
.ticket-row-main { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ticket-row-cat { font-size: 12px; color: var(--blue); margin-bottom: 4px; }
.ticket-row-subject { font-weight: 500; margin-bottom: 4px; }
.ticket-row-date { font-size: 12px; color: var(--text2); }

.adm-ticket-card { display: none; }
@media (max-width: 600px) {
  .support-page, .admin-ticket-card { padding: 16px; }
}

/* ── NOVEL PAGE ── */
.novel-page { padding: 20px 20px 40px; max-width: 800px; margin: 0 auto; }
.novel-header { text-align: center; margin-bottom: 24px; }
.novel-header h2 { font-size: 24px; margin-bottom: 4px; }
.novel-author { color: var(--text2); font-size: 14px; }
.novel-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.novel-tab { padding: 8px 16px; border-radius: 6px; font-size: 14px; background: transparent; border: none; color: var(--text2); cursor: pointer; transition: all 0.2s; }
.novel-tab:hover { color: var(--text); background: var(--bg3); }
.novel-tab.active { background: var(--blue); color: #fff; }
.novel-summary { line-height: 1.8; }
.novel-summary h3 { margin-bottom: 12px; }
.novel-chapters { display: flex; flex-direction: column; gap: 16px; }
.chapter-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chapter-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.chapter-number { font-size: 12px; background: var(--blue); color: #fff; padding: 4px 8px; border-radius: 4px; }
.chapter-title { font-weight: 600; }
.key-points-list { padding-left: 20px; margin: 0; }
.key-points-list li { margin-bottom: 6px; line-height: 1.5; }
.chapter-summary { font-size: 14px; line-height: 1.7; color: var(--text2); margin-bottom: 12px; padding: 12px; background: var(--bg3); border-radius: 6px; }
.chapter-subheading { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text2); margin-bottom: 8px; margin-top: 16px; }
.theme-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-tag { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber); }
.chapter-characters .character-list { padding-left: 20px; margin: 0; }
.chapter-characters .character-list li { font-size: 14px; margin-bottom: 4px; line-height: 1.5; }
.chapter-excerpts { margin-top: 12px; }
.excerpt-item { background: var(--bg3); padding: 12px; border-radius: 6px; margin-bottom: 8px; border-left: 3px solid var(--blue); }
.excerpt-quote { font-style: italic; font-size: 14px; line-height: 1.6; margin-bottom: 6px; color: var(--text); }
.excerpt-significance { font-size: 13px; color: var(--text2); line-height: 1.5; }
.chapter-exam-notes { background: var(--green-dim); border: 1px solid var(--green); border-radius: 6px; padding: 12px; margin-top: 16px; }
.exam-notes-label { font-size: 13px; font-weight: 700; color: var(--green); margin-bottom: 6px; }
.exam-notes-text { font-size: 14px; line-height: 1.6; color: var(--text); }
.novel-practice { display: flex; flex-direction: column; gap: 24px; }
.practice-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.practice-section h3 { margin-bottom: 4px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ── READ MODE ── */
.read-page { padding: 20px 20px 40px; max-width: 800px; margin: 0 auto; }
.read-header { margin-bottom: 24px; }
.read-header h2 { margin-bottom: 4px; }
.read-subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.read-subject-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; }
.read-subject-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.read-subject-icon { font-size: 32px; margin-bottom: 8px; }
.read-subject-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.read-subject-topics { font-size: 12px; color: var(--text2); }
.topic-cards { display: flex; flex-direction: column; gap: 12px; }
.topic-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all 0.2s; }
.topic-card:hover { border-color: var(--blue); }
.topic-card h4 { margin-bottom: 4px; }
.topic-card p { font-size: 13px; color: var(--text2); margin: 0; }
.topic-content h4 { margin: 20px 0 12px; }
.topic-content h4:first-child { margin-top: 0; }
.content-text { line-height: 1.5; white-space: normal; }
.content-text p { margin: 0 0 6px; }
.content-text h4 { margin: 16px 0 6px; }
.content-text ul, .content-text ol { margin: 4px 0; padding-left: 20px; }
.content-text li { margin-bottom: 2px; }
.hacks-section { background: var(--amber-dim); border: 1px solid var(--amber); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.hacks-list { padding-left: 20px; margin: 0; }
.hacks-list li { margin-bottom: 8px; line-height: 1.5; }
.examples-section { background: var(--blue-dim); border: 1px solid var(--blue); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.example-item { background: var(--bg3); padding: 12px; border-radius: 6px; margin-bottom: 12px; }
.example-item:last-child { margin-bottom: 0; }
.example-q { margin-bottom: 8px; }
.example-a { color: var(--green); padding-left: 12px; border-left: 2px solid var(--green); }
.diagrams-section { margin: 16px 0; }
.diagrams-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.topic-diagram { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

/* ── NOVEL EXAM ── */
.novel-exam-page { padding: 0; min-height: 100vh; display: flex; flex-direction: column; }
.novel-exam-topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.novel-exam-header { display: flex; align-items: center; gap: 12px; }
.novel-exam-title { font-weight: 600; font-size: 14px; }
.novel-exam-body { display: flex; flex: 1; overflow: hidden; }
.novel-exam-sidebar { width: 220px; background: var(--card); border-right: 1px solid var(--border); padding: 16px; overflow-y: auto; flex-shrink: 0; }
.novel-exam-main { flex: 1; padding: 20px; overflow-y: auto; }
.passage-panel { background: var(--card); border: 1px solid var(--blue); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.passage-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--blue-dim); cursor: pointer; }
.passage-title { font-weight: 600; font-size: 14px; }
.passage-content { padding: 16px; line-height: 1.8; font-size: 15px; border-top: 1px solid var(--border); }
.novel-q-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.passage-nav-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 12px; border: none; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13px; color: var(--text2); transition: all 0.2s; margin-bottom: 4px; }
.passage-nav-btn:hover { background: var(--bg3); color: var(--text); }
.passage-nav-btn.active { background: var(--blue); color: #fff; }
.passage-count { font-size: 11px; background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 4px; }

/* ── NOVEL RESULTS ── */
.novel-results-container { max-width: 800px; margin: 0 auto; padding: 20px; width: 100%; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.results-header h2 { margin: 0; font-size: 20px; }
.results-score-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; display: flex; align-items: center; gap: 40px; margin-bottom: 24px; }
.score-circle { width: 120px; height: 120px; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 6px solid; flex-shrink: 0; }
.score-good { border-color: var(--green); background: var(--green-dim); }
.score-ok { border-color: var(--amber); background: var(--amber-dim); }
.score-bad { border-color: var(--red); background: var(--red-dim); }
.score-value { font-size: 32px; font-weight: 700; }
.score-label { font-size: 12px; color: var(--text2); }
.results-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; flex: 1; }
.stat-item { background: var(--bg3); border-radius: 8px; padding: 16px; text-align: center; }
.stat-num { display: block; font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text2); }
.stat-correct .stat-num { color: var(--green); }
.stat-wrong .stat-num { color: var(--red); }
.stat-skipped .stat-num { color: var(--text2); }
.stat-total .stat-num { color: var(--blue); }
.results-review { margin-bottom: 24px; }
.results-review h3 { margin-bottom: 16px; }
.review-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.review-correct { border-left: 4px solid var(--green); }
.review-wrong { border-left: 4px solid var(--red); }
.review-skipped { border-left: 4px solid var(--text2); }
.review-q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-q-num { font-weight: 700; font-size: 14px; background: var(--bg3); padding: 4px 8px; border-radius: 4px; }
.review-status { font-size: 13px; font-weight: 600; }
.review-q-text { margin-bottom: 12px; line-height: 1.6; }
.review-answer { display: flex; gap: 24px; font-size: 14px; margin-bottom: 8px; }
.review-answer strong { font-weight: 600; }
.review-explanation { background: var(--blue-dim); padding: 12px; border-radius: 6px; font-size: 14px; line-height: 1.6; border-left: 3px solid var(--blue); }
.results-actions { display: flex; gap: 12px; justify-content: center; }

@media (max-width: 768px) {
  .novel-exam-body { flex-direction: column; }
  .novel-exam-sidebar {
    width: 100%; padding: 8px 12px; border-right: none;
    border-top: 1px solid var(--border); overflow-x: auto;
    display: flex; flex-direction: row; align-items: center;
    gap: 8px; flex-shrink: 0; order: 2;
  }
  .novel-exam-sidebar .section-title { display: none; }
  .novel-exam-sidebar .passage-nav { display: none; }
  .novel-exam-sidebar .q-legend { display: none; }
  .novel-exam-sidebar .divider { display: none; }
  .novel-exam-sidebar .text-xs { display: none; }
  .novel-exam-sidebar .q-navigator {
    display: flex; grid-template-columns: none; gap: 6px;
    margin-top: 0; overflow-x: auto;
  }
  .novel-exam-sidebar .q-navigator::-webkit-scrollbar { display: none; }
  .q-nav-btn { width: 36px; height: 36px; padding: 0; font-size: 12px; flex-shrink: 0; }
  .novel-exam-main { order: 1; }
  .results-score-card { flex-direction: column; gap: 24px; padding: 24px; }
  .results-stats { grid-template-columns: repeat(2, 1fr); }
  .novel-exam-title { font-size: 12px; }
}

/* ── NOVEL ADMIN ── */
.novels-admin-list { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.novel-admin-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.novel-admin-card.active { border-color: var(--green); }
.novel-admin-info { flex: 1; }
.novel-admin-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.novel-admin-author { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.novel-admin-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text2); }
.novel-admin-actions { display: flex; gap: 8px; }
.btn-accent { background: var(--amber); color: #000; border: 1px solid var(--amber); }
.btn-accent:hover { background: var(--amber-dark, #d49000); }

/* ── GENERATE CONTENT BUTTON ── */
#gen-content-btn { margin-top: 12px; }
