/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: #05050f;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== CSS VARIABLES ===== */
:root {
  --indigo: #6366f1;
  --purple: #a855f7;
  --pink: #ec4899;
  --amber: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --bg: #05050f;
  --bg2: #0d0d1f;
  --bg3: #12122a;
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --radius: 16px;
  --radius-sm: 10px;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: drift 20s infinite ease-in-out alternate;
}
.orb-1 { width: 700px; height: 700px; background: #6366f1; top: -200px; left: -200px; animation-duration: 18s; }
.orb-2 { width: 500px; height: 500px; background: #a855f7; bottom: -100px; right: -100px; animation-duration: 22s; animation-delay: -8s; }
.orb-3 { width: 400px; height: 400px; background: #ec4899; top: 40%; left: 50%; transform: translate(-50%,-50%); animation-duration: 26s; animation-delay: -4s; }
@keyframes drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.12); }
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background 0.4s, backdrop-filter 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(5,5,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom-color: var(--glass-border);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-size: 1.25rem; font-weight: 600;
  letter-spacing: -0.02em;
}
.logo strong { color: var(--indigo); }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.2));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 10px;
  display: grid; place-items: center;
  transition: transform 0.3s;
}
.logo:hover .logo-icon { transform: rotate(15deg) scale(1.05); }
.nav-links {
  list-style: none;
  display: flex; gap: 8px;
  margin-left: auto;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--glass); }
.nav-cta { display: flex; gap: 10px; align-items: center; }

/* ===== BUTTONS ===== */
.btn-ghost {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 9px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: rgba(99,102,241,0.5); color: var(--text); background: var(--glass); }
.btn-primary {
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  border: none;
  color: #fff;
  padding: 9px 22px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(99,102,241,0.5); }
.btn-primary:active { transform: translateY(0); }

/* ===== HERO ===== */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid rgba(99,102,241,0.35);
  background: rgba(99,102,241,0.08);
  font-size: 0.8rem;
  color: #a5b4fc;
  margin-bottom: 28px;
  animation: fadeUp 0.8s ease both;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--indigo);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.5; transform:scale(1.5); } }
.hero-title {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
  animation: fadeUp 0.8s 0.1s ease both;
  font-family: 'Space Grotesk', sans-serif;
}
.gradient-text {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 50%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
  margin-bottom: 36px;
  animation: fadeUp 0.8s 0.2s ease both;
}
.hero-actions {
  display: flex; gap: 14px; align-items: center;
  animation: fadeUp 0.8s 0.3s ease both;
  margin-bottom: 60px;
}
.btn-hero-primary {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 40px rgba(99,102,241,0.4);
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.btn-hero-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-hero-primary:hover::after { opacity: 1; }
.btn-hero-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 50px rgba(99,102,241,0.55); }
.btn-hero-ghost {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s;
  backdrop-filter: blur(10px);
}
.btn-hero-ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(99,102,241,0.4); transform: translateY(-2px); }
.hero-stats {
  display: flex; gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fadeUp 0.8s 0.4s ease both;
}
.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  padding: 20px 32px;
  text-align: center;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  cursor: default;
  animation: fadeUp 0.6s calc(0.5s + var(--delay)) ease both;
}
.stat-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 20px 60px rgba(99,102,241,0.15);
}
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-num span { font-size: 1.2rem; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ===== SECTIONS ===== */
section { position: relative; z-index: 1; }
.exams-section, .features-section, .leaderboard-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 24px;
}
.section-header { text-align: center; margin-bottom: 56px; }
.section-tag {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 100px;
  color: #a5b4fc;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: 'Space Grotesk', sans-serif;
  margin-bottom: 12px;
}
.section-sub { color: var(--text-muted); font-size: 1rem; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex; gap: 8px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 8px 20px;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: rgba(99,102,241,0.4); color: var(--text); }
.filter-btn.active {
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
}

/* ===== EXAM CARDS ===== */
.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  perspective: 1200px;
}
.exam-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.4s, border-color 0.3s;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.5s calc(var(--card-delay, 0s)) ease both;
  backdrop-filter: blur(10px);
}
.exam-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(99,102,241,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.exam-card:hover::before { opacity: 1; }
.exam-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.3);
  border-color: rgba(99,102,241,0.35);
}
.card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 20px 20px 0 0;
}
.card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.card-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-easy { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-hard { background: rgba(239,68,68,0.15); color: #f87171; }
.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  font-family: 'Space Grotesk', sans-serif;
}
.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.card-meta {
  display: flex; gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.card-meta span { display: flex; align-items: center; gap: 5px; }
.card-actions { display: flex; gap: 10px; position: relative; z-index: 2; }
.btn-book {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-book:hover { border-color: rgba(99,102,241,0.4); color: var(--text); }
.btn-start {
  flex: 2;
  padding: 10px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.btn-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-start:hover::after { opacity: 1; }
.btn-start:hover { transform: scale(1.03); }
.card-progress {
  margin-top: 16px;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}

/* ===== FEATURES GRID ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  transition: all 0.3s;
  animation: fadeUp 0.5s calc(var(--i) * 0.1s) ease both;
}
.feature-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.feature-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.2);
  display: grid; place-items: center;
  margin-bottom: 20px;
  color: var(--color);
  border-color: color-mix(in srgb, var(--color) 30%, transparent);
  background: color-mix(in srgb, var(--color) 10%, transparent);
}
.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  font-family: 'Space Grotesk', sans-serif;
}
.feature-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }

/* ===== LEADERBOARD ===== */
.leaderboard-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto;
  backdrop-filter: blur(10px);
}
.lb-header {
  display: grid;
  grid-template-columns: 60px 1fr 80px 80px;
  padding: 14px 24px;
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lb-row {
  display: grid;
  grid-template-columns: 60px 1fr 80px 80px;
  padding: 14px 24px;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
  animation: fadeUp 0.4s ease both;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(99,102,241,0.06); }
.lb-rank {
  font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
}
.rank-1 { color: #fbbf24; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #cd7c2f; }
.lb-student { display: flex; align-items: center; gap: 12px; }
.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.lb-name { font-weight: 600; font-size: 0.9rem; }
.lb-exams { color: var(--text-muted); font-size: 0.875rem; }
.lb-score { font-weight: 700; color: var(--green); font-size: 0.95rem; }

/* ===== FOOTER ===== */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--glass-border);
  padding: 40px 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-brand p { color: var(--text-muted); font-size: 0.85rem; margin-top: 8px; }
.footer-copy { color: var(--text-muted); font-size: 0.8rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: #0d0d1f;
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 24px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
}
.modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 { font-size: 1.2rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; padding: 4px; transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus, .form-group select:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group select option { background: #0d0d1f; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex; gap: 12px; justify-content: flex-end;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e1e3a;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
  pointer-events: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hero-actions { flex-direction: column; width: 100%; }
  .btn-hero-primary, .btn-hero-ghost { width: 100%; justify-content: center; }
  .hero-stats { gap: 10px; }
  .stat-card { padding: 16px 20px; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ===========================
   ======= EXAM PAGE ==========
   =========================== */
.exam-page-body {
  background: var(--bg);
  min-height: 100vh;
}

/* Exam Header */
.exam-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(5,5,15,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
}
.exam-header-inner {
  max-width: 1100px; margin: 0 auto;
  height: 64px;
  display: flex; align-items: center;
  gap: 20px;
}
.exam-title-bar {
  flex: 1;
  display: flex; flex-direction: column;
}
.exam-title-bar .exam-name {
  font-weight: 700;
  font-size: 1rem;
  font-family: 'Space Grotesk', sans-serif;
}
.exam-title-bar .exam-subtitle { font-size: 0.75rem; color: var(--text-muted); }

/* Timer */
.timer-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 16px;
}
.timer-icon { color: var(--indigo); }
.timer-display {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.3s;
}
.timer-display.warning { color: var(--amber); }
.timer-display.danger { color: var(--red); animation: timerPulse 1s infinite; }
@keyframes timerPulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.progress-chip {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(168,85,247,0.15));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a5b4fc;
  white-space: nowrap;
}

/* Exam Layout */
.exam-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
}
@media (max-width: 900px) {
  .exam-layout { grid-template-columns: 1fr; }
  .question-nav-panel { order: -1; }
}

/* Question Panel */
.question-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 36px;
  backdrop-filter: blur(10px);
}
.question-number {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 20px;
}
.q-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--indigo);
}
.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 32px;
  font-family: 'Space Grotesk', sans-serif;
}
.options-list { display: flex; flex-direction: column; gap: 12px; }
.option-item {
  position: relative;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
  display: flex; align-items: center; gap: 14px;
  overflow: hidden;
}
.option-item::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--indigo);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 3px 0 0 3px;
}
.option-item:hover {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.06);
  transform: translateX(4px);
}
.option-item:hover::before { opacity: 0.5; }
.option-item.selected {
  border-color: var(--indigo);
  background: rgba(99,102,241,0.1);
  transform: translateX(6px);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.2);
}
.option-item.selected::before { opacity: 1; }
.option-item.correct {
  border-color: var(--green);
  background: rgba(34,197,94,0.08);
}
.option-item.correct::before { background: var(--green); opacity: 1; }
.option-item.wrong {
  border-color: var(--red);
  background: rgba(239,68,68,0.08);
}
.option-item.wrong::before { background: var(--red); opacity: 1; }
.option-item.disabled { pointer-events: none; }
.option-key {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  display: grid; place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s;
}
.option-item.selected .option-key {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.option-item.correct .option-key { background: var(--green); border-color: var(--green); color: #fff; }
.option-item.wrong .option-key { background: var(--red); border-color: var(--red); color: #fff; }
.option-text { font-size: 0.95rem; line-height: 1.5; }

/* Explanation Box */
.explanation-box {
  margin-top: 24px;
  padding: 18px 20px;
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 14px;
  font-size: 0.88rem;
  color: #c7d2fe;
  line-height: 1.65;
  display: none;
  animation: fadeUp 0.3s ease both;
}
.explanation-box strong { color: #a5b4fc; }
.explanation-box.visible { display: block; }

/* Question Footer */
.question-footer {
  margin-top: 32px;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.btn-prev, .btn-next {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-prev {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.btn-prev:hover:not(:disabled) { background: rgba(255,255,255,0.07); color: var(--text); }
.btn-prev:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-next {
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  border: none;
  color: #fff;
  box-shadow: 0 4px 20px rgba(99,102,241,0.3);
  margin-left: auto;
}
.btn-next:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(99,102,241,0.5); transform: translateY(-1px); }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-flag {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.btn-flag:hover { border-color: rgba(245,158,11,0.4); color: var(--amber); }
.btn-flag.flagged { border-color: rgba(245,158,11,0.5); color: var(--amber); background: rgba(245,158,11,0.08); }

/* Sidebar Nav */
.question-nav-panel {
  display: flex; flex-direction: column; gap: 20px;
}
.nav-panel-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 22px;
  backdrop-filter: blur(10px);
}
.nav-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.nav-btn {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1.5px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover { border-color: rgba(99,102,241,0.4); color: var(--text); }
.nav-btn.current { border-color: var(--indigo); background: rgba(99,102,241,0.15); color: #a5b4fc; }
.nav-btn.answered { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: var(--green); }
.nav-btn.flagged-nav { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: var(--amber); }
.legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-muted); }
.legend-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.progress-bar-wrap { margin-top: 2px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--indigo), var(--purple));
  transition: width 0.6s ease;
}
.btn-submit-exam {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 6px 24px rgba(99,102,241,0.35);
}
.btn-submit-exam:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(99,102,241,0.5); }

/* ===== RESULTS PAGE ===== */
.results-screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  flex-direction: column;
  text-align: center;
}
.results-screen.active { display: flex; }
.result-trophy {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: trophyBounce 0.8s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
@keyframes trophyBounce {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.result-grade {
  font-size: 4rem;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeUp 0.5s 0.3s ease both;
}
.result-label {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  animation: fadeUp 0.5s 0.4s ease both;
  font-family: 'Space Grotesk', sans-serif;
}
.result-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 40px; animation: fadeUp 0.5s 0.5s ease both; }
.result-stats {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 40px;
  animation: fadeUp 0.5s 0.6s ease both;
}
.result-stat {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px 28px;
  min-width: 120px;
}
.result-stat-val {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
}
.result-stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.result-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; animation: fadeUp 0.5s 0.7s ease both; }
.btn-retry {
  padding: 13px 28px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-retry:hover { background: rgba(255,255,255,0.07); }
.certificate-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(168,85,247,0.12));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 20px;
  padding: 28px 40px;
  max-width: 500px;
  width: 100%;
  margin: 0 auto 40px;
  animation: fadeUp 0.5s 0.65s ease both;
}
.cert-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: #a5b4fc; margin-bottom: 8px; }
.cert-name { font-size: 1.8rem; font-weight: 800; font-family: 'Space Grotesk', sans-serif; margin-bottom: 4px; }
.cert-sub { font-size: 0.85rem; color: var(--text-muted); }
.cert-seal {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--purple));
  display: grid; place-items: center;
  margin: 16px auto 0;
  font-size: 1.8rem;
  box-shadow: 0 8px 30px rgba(99,102,241,0.5);
  animation: rotateSeal 20s linear infinite;
}
@keyframes rotateSeal { to { transform: rotate(360deg); } }

/* ===========================
   ====== PROCTORING UI =======
   =========================== */

/* Gate overlay — shown before exam starts */
.proctor-gate {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5,5,15,0.97);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(20px);
  overflow-y: auto;
}
.proctor-gate-card {
  background: #0d0d1f;
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 28px;
  padding: 48px 44px;
  max-width: 540px; width: 100%;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 60px rgba(99,102,241,0.08);
  animation: fadeUp 0.5s cubic-bezier(0.175,0.885,0.32,1.275) both;
  margin: auto;
}
.proctor-gate-icon { font-size: 4rem; margin-bottom: 20px; }
.proctor-gate-title {
  font-size: 1.8rem; font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.03em; margin-bottom: 10px;
}
.proctor-gate-sub { color: #64748b; font-size: 0.9rem; line-height: 1.6; margin-bottom: 28px; }

.proctor-rules {
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; margin-bottom: 32px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; padding: 20px;
}
.proctor-rule {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.875rem; color: #94a3b8;
}
.rule-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
}
.rule-no  { background: rgba(239,68,68,0.15);  color: #f87171; }
.rule-ok  { background: rgba(34,197,94,0.15);  color: #4ade80; }

.proctor-gate-footer {
  display: flex; gap: 12px; justify-content: center;
}

/* Warning overlay */
.proctor-warning, .proctor-terminated {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(5,5,15,0.92);
  backdrop-filter: blur(20px);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.proctor-warning.active, .proctor-terminated.active {
  display: flex;
}
.proctor-warning-card {
  background: #0d0d1f;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 24px;
  padding: 44px 40px;
  max-width: 420px; width: 100%;
  text-align: center;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 40px rgba(245,158,11,0.08);
  animation: warningPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
@keyframes warningPop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.warning-pulse {
  font-size: 3.5rem; margin-bottom: 16px;
  animation: warningShake 0.5s ease both;
}
@keyframes warningShake {
  0%,100% { transform: rotate(0); }
  20%     { transform: rotate(-10deg); }
  40%     { transform: rotate(10deg); }
  60%     { transform: rotate(-6deg); }
  80%     { transform: rotate(6deg); }
}
.proctor-warning-card h3 {
  font-size: 1.4rem; font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
  color: #fbbf24; margin-bottom: 10px;
}
.proctor-warning-card p {
  color: #94a3b8; font-size: 0.9rem;
  line-height: 1.6; margin-bottom: 20px;
}
.violation-counter {
  font-size: 0.8rem; font-weight: 600;
  color: #64748b; margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.violation-dots {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 28px;
}
.v-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  transition: all 0.3s;
}
.v-dot.hit { background: #ef4444; border-color: #ef4444; box-shadow: 0 0 10px rgba(239,68,68,0.6); }
.v-dot.warn { background: #f59e0b; border-color: #f59e0b; }

/* Countdown inside warning card */
.warning-countdown {
  font-size: 2rem; font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: #fbbf24; margin-bottom: 20px;
  animation: countPulse 1s infinite;
}
@keyframes countPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }

/* Violation badge — permanent during exam */
.violation-badge {
  position: fixed; top: 72px; right: 20px;
  z-index: 200;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.78rem; font-weight: 600;
  color: #fbbf24;
  display: flex; align-items: center; gap: 6px;
  animation: fadeUp 0.3s ease both;
  backdrop-filter: blur(10px);
}
.violation-badge.danger {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.35);
  color: #f87171;
  animation: badgePulse 1s infinite;
}
@keyframes badgePulse { 0%,100%{box-shadow:none} 50%{box-shadow:0 0 20px rgba(239,68,68,0.4)} }

/* Screen flash on violation */
.screen-flash {
  position: fixed; inset: 0; z-index: 580;
  background: rgba(239,68,68,0.15);
  pointer-events: none;
  animation: flashOut 0.6s ease forwards;
}
@keyframes flashOut { from{opacity:1} to{opacity:0} }


/* ===========================
   EXAM PAGE — MOBILE RESPONSIVE
   =========================== */
@media (max-width: 700px) {

  /* ---- Header ---- */
  .exam-header { padding: 0 14px; }
  .exam-header-inner { height: 56px; gap: 10px; }
  .exam-name { font-size: 0.85rem; }
  .exam-subtitle { display: none; }
  .timer-display { font-size: 1rem; }
  .logo span { display: none; }
  .logo .logo-icon { width: 30px; height: 30px; }
  .progress-chip { display: none; }

  /* ---- Exam area layout ---- */
  #examArea { padding: 0; }
  .exam-layout {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 14px;
  }

  /* ---- Question panel ---- */
  .question-panel { padding: 18px 16px; border-radius: 16px; }
  .question-text { font-size: 1rem; line-height: 1.6; margin-bottom: 18px; }
  .option-item { padding: 12px 14px; gap: 10px; }
  .option-key { width: 30px; height: 30px; font-size: 0.75rem; border-radius: 8px; }
  .option-text { font-size: 0.875rem; }

  /* ---- Nav buttons ---- */
  .question-footer { gap: 8px; }
  .btn-prev, .btn-next { padding: 10px 16px; font-size: 0.85rem; }
  .btn-flag { padding: 10px 12px; font-size: 0.8rem; }

  /* ---- Sidebar — collapse to horizontal strip ---- */
  .question-nav-panel { gap: 12px; order: -1; }
  .nav-panel-card { padding: 14px; }
  .nav-panel-title { font-size: 0.75rem; margin-bottom: 10px; }
  .nav-grid { gap: 5px; }
  .nav-btn { width: 30px; height: 30px; font-size: 0.72rem; border-radius: 7px; }
  .legend { flex-wrap: wrap; gap: 6px 12px; }
  .legend-item { font-size: 0.68rem; }
  .btn-submit-exam { padding: 13px 20px; font-size: 0.9rem; }

  /* ---- Results screen ---- */
  .results-screen { padding: 40px 16px 60px; }
  .result-trophy { font-size: 4rem; }
  .result-grade { font-size: 2.8rem; }
  .result-label { font-size: 1.3rem; }
  .result-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .result-stat { padding: 16px 10px; }
  .result-stat-val { font-size: 1.6rem; }
  .result-actions { flex-direction: column; gap: 10px; }
  .result-actions button { width: 100%; }
  .certificate-card { padding: 20px; }
  .cert-name { font-size: 1.1rem; }

  /* ---- Proctor gate ---- */
  .proctor-gate-card { padding: 24px 18px; margin: 12px; }
  .proctor-gate-title { font-size: 1.3rem; }
  .proctor-gate-sub { font-size: 0.82rem; }
  .proctor-rules { gap: 8px; }
  .proctor-rule { font-size: 0.8rem; padding: 8px 10px; }

  /* ---- Proctor warning overlays ---- */
  .proctor-warning-card { padding: 24px 18px; margin: 16px; }
  .proctor-warning-card h3 { font-size: 1.2rem; }

  /* ---- Camera PIP — smaller on mobile ---- */
  #gazePipWrap {
    bottom: 12px !important;
    right: 12px !important;
    width: 110px !important;
  }
  #gazePipCanvas { width: 110px !important; height: 82px !important; }

  /* ---- Violation badge ---- */
  .violation-badge { top: 60px; right: 10px; font-size: 0.7rem; padding: 5px 10px; }
}

@media (max-width: 400px) {
  .exam-layout { padding: 8px; }
  .question-panel { padding: 14px 12px; }
  .question-text { font-size: 0.93rem; }
  .option-text { font-size: 0.82rem; }
  .nav-btn { width: 26px; height: 26px; font-size: 0.65rem; }
}
