/* ==========================================================
   FreeNISMMockTest.com — style.css
   Complete stylesheet: light/dark theme, all components
   ========================================================== */

/* ----------------------------------------------------------
   SECTION 1 — CSS VARIABLES (Light Theme)
   ---------------------------------------------------------- */
:root {
  /* Brand colours */
  --primary:          #1a6ed8;
  --primary-dark:     #1355ab;
  --primary-light:    #e8f0fb;
  --accent:           #e05c00;
  --accent-light:     #fff0e6;

  /* Status colours */
  --success:          #16a34a;
  --success-light:    #dcfce7;
  --danger:           #dc2626;
  --danger-light:     #fee2e2;
  --warning:          #d97706;
  --warning-light:    #fef3c7;

  /* Backgrounds */
  --bg-page:          #f0f2f5;
  --bg-card:          #ffffff;
  --bg-header:        #ffffff;
  --bg-input:         #ffffff;
  --bg-hover:         #f5f7fa;
  --bg-code:          #f8f9fa;

  /* Text */
  --text-primary:     #111827;
  --text-secondary:   #4b5563;
  --text-muted:       #9ca3af;
  --text-inverse:     #ffffff;
  --text-link:        #1a6ed8;

  /* Borders */
  --border:           #e5e7eb;
  --border-strong:    #d1d5db;

  /* Shadows */
  --shadow-sm:        0 1px 3px rgba(0,0,0,.06);
  --shadow-md:        0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:        0 10px 30px rgba(0,0,0,.10);
  --shadow-focus:     0 0 0 3px var(--primary-light);
  --shadow-hover:     0 8px 24px rgba(26,110,216,.14);

  /* Border radius */
  --r-sm:   6px;
  --r:      10px;
  --r-lg:   14px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Layout */
  --header-h:   62px;
  --nav-h:      44px;
  --max-w:      1180px;
  --sidebar-w:  300px;

  /* Typography */
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Transitions */
  --t:     all 0.18s ease;
  --t-slow: all 0.30s ease;
}

/* ----------------------------------------------------------
   SECTION 2 — DARK THEME
   ---------------------------------------------------------- */
[data-theme="dark"] {
  --primary:          #4a9eff;
  --primary-dark:     #3a8ef0;
  --primary-light:    #1a2e4a;
  --accent:           #ff7c2a;
  --accent-light:     #2a1800;

  --success:          #22c55e;
  --success-light:    #052e16;
  --danger:           #f87171;
  --danger-light:     #2a0505;
  --warning:          #fbbf24;
  --warning-light:    #2a1f00;

  --bg-page:          #0d0f14;
  --bg-card:          #161a23;
  --bg-header:        #161a23;
  --bg-input:         #1e2330;
  --bg-hover:         #1e2330;
  --bg-code:          #1e2330;

  --text-primary:     #f1f3f7;
  --text-secondary:   #9ca3af;
  --text-muted:       #4b5563;
  --text-inverse:     #111827;
  --text-link:        #4a9eff;

  --border:           #242836;
  --border-strong:    #2e3344;

  --shadow-sm:        0 1px 3px rgba(0,0,0,.35);
  --shadow-md:        0 4px 12px rgba(0,0,0,.45);
  --shadow-lg:        0 10px 30px rgba(0,0,0,.55);
  --shadow-hover:     0 8px 24px rgba(74,158,255,.15);
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-slow), color var(--t-slow);
}

a { color: var(--text-link); text-decoration: none; transition: var(--t); }
a:hover { text-decoration: underline; color: var(--primary-dark); }

img  { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }
h1,h2,h3,h4,h5,h6 { line-height: 1.3; color: var(--text-primary); }

/* ----------------------------------------------------------
   SECTION 4 — LAYOUT
   ---------------------------------------------------------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

.page-body { flex: 1; padding: 28px 0 52px; }

/* Home layout: main + sidebar */
.home-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 24px;
  align-items: start;
}
.home-main { min-width: 0; }
.home-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--nav-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Helpers */
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center   { text-align: center; }
.text-muted    { color: var(--text-muted); }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }

/* ----------------------------------------------------------
   SECTION 5 — HEADER
   ---------------------------------------------------------- */
#site-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
  transition: background var(--t-slow), border-color var(--t-slow);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo:hover { text-decoration: none; }

.logo-mark {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  transition: var(--t);
}
.logo:hover .logo-mark { background: var(--primary-dark); }

.logo-text { line-height: 1.2; }
.logo-name { display: block; font-size: 13.5px; font-weight: 700; color: var(--primary); }
.logo-tag  { display: block; font-size: 10.5px; color: var(--text-muted); }

/* Search bar */
.header-search { flex: 1; max-width: 400px; position: relative; }

.search-wrap { position: relative; }

.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px; pointer-events: none; z-index: 1;
}

#header-search-input {
  width: 100%; height: 38px;
  padding: 0 36px 0 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: var(--t);
}
#header-search-input::placeholder { color: var(--text-muted); }
#header-search-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-muted); color: #fff;
  font-size: 11px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  transition: var(--t);
}
.search-clear.show { display: flex; }

.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 340px; overflow-y: auto;
  display: none; z-index: 300;
}
.search-dropdown.open { display: block; }

.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--t);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }
.search-item-icon { font-size: 20px; flex-shrink: 0; }
.search-item strong { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-item span   { font-size: 12px; color: var(--text-muted); }
.search-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; transition: var(--t);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.menu-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 6px; border-radius: var(--r-sm); transition: var(--t);
}
.menu-toggle span { display: block; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: var(--t); }
.menu-toggle:hover span { background: var(--primary); }

/* ----------------------------------------------------------
   SECTION 6 — NAVIGATION
   ---------------------------------------------------------- */
#site-nav {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  transition: background var(--t-slow);
}

.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 16px;
  height: 100%; display: flex; align-items: center;
  overflow-x: auto; scrollbar-width: none; gap: 2px;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 0 13px; height: 100%;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 2.5px solid transparent;
  text-decoration: none; flex-shrink: 0;
  transition: var(--t);
}
.nav-link:hover { color: var(--primary); text-decoration: none; }
.nav-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 15px; }

/* Mobile nav drawer */
#mobile-nav {
  display: none; flex-direction: column;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
#mobile-nav.open { display: flex; }
#mobile-nav .nav-link {
  height: auto; padding: 12px 20px;
  border-bottom: none; border-left: 3px solid transparent;
}
#mobile-nav .nav-link.active {
  border-left-color: var(--primary);
  background: var(--primary-light); border-bottom: none;
}

/* ----------------------------------------------------------
   SECTION 7 — HERO
   ---------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #1355ab 0%, #1a6ed8 60%, #2980e4 100%);
  color: #fff;
  padding: 36px 16px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--r-full);
  padding: 4px 14px; font-size: 12px; font-weight: 600;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(22px, 4.5vw, 34px);
  font-weight: 800; color: #fff;
  margin-bottom: 10px; letter-spacing: -.3px;
}
.hero p { font-size: 15px; opacity: .88; max-width: 560px; margin: 0 auto 24px; line-height: 1.65; }

.hero-stats { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; }
.hero-stat span   { font-size: 12px; opacity: .8; font-weight: 500; }

/* ----------------------------------------------------------
   SECTION 8 — SECTION HEADINGS
   ---------------------------------------------------------- */
.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.section-title {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; display: inline-block;
  width: 4px; height: 20px;
  background: var(--primary); border-radius: var(--r-full);
}
.section-sub  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.view-all-link { font-size: 13px; font-weight: 500; color: var(--primary); }

/* ----------------------------------------------------------
   SECTION 9 — FILTER TABS
   ---------------------------------------------------------- */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

.filter-tab {
  padding: 6px 16px; border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: var(--t);
}
.filter-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ----------------------------------------------------------
   SECTION 10 — EXAM CARDS
   ---------------------------------------------------------- */
.exams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.exam-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  transition: var(--t);
  cursor: pointer;
  text-decoration: none; color: inherit;
}
.exam-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
}
.exam-card.coming-soon { opacity: .7; cursor: default; }
.exam-card.coming-soon:hover { transform: none; border-color: var(--border); box-shadow: none; }

.exam-card-top { display: flex; align-items: flex-start; gap: 12px; }

.exam-icon {
  width: 46px; height: 46px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  background: var(--primary-light);
}

.exam-series  { font-size: 10.5px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .6px; }
.exam-name    { font-size: 14.5px; font-weight: 700; color: var(--text-primary); line-height: 1.3; margin-top: 2px; }
.exam-desc    { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; flex: 1; }

.exam-meta    { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--bg-code); color: var(--text-secondary);
  border: 1px solid var(--border); font-weight: 500;
}

/* Difficulty */
.diff { font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); }
.diff-beginner     { background: #dcfce7; color: #166534; }
.diff-intermediate { background: #fef3c7; color: #92400e; }
.diff-advanced     { background: #fee2e2; color: #991b1b; }
.diff-expert       { background: #ede9fe; color: #4c1d95; }
[data-theme="dark"] .diff-beginner     { background: #052e16; color: #4ade80; }
[data-theme="dark"] .diff-intermediate { background: #2a1f00; color: #fcd34d; }
[data-theme="dark"] .diff-advanced     { background: #2a0505; color: #fca5a5; }
[data-theme="dark"] .diff-expert       { background: #1e0d33; color: #c4b5fd; }

/* Card start button */
.exam-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 9px 16px;
  background: var(--primary); color: #fff;
  border-radius: var(--r); font-size: 13.5px; font-weight: 600;
  transition: var(--t); text-decoration: none; border: none; cursor: pointer;
}
.exam-btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.exam-btn.disabled { background: var(--bg-code); color: var(--text-muted); cursor: not-allowed; }
.exam-btn.disabled:hover { background: var(--bg-code); }

/* Card badge (Popular / New / Soon) */
.card-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--r-full);
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-popular { background: var(--accent);   color: #fff; }
.badge-new     { background: var(--success);  color: #fff; }
.badge-soon    { background: var(--text-muted); color: #fff; }

/* ----------------------------------------------------------
   SECTION 11 — SIDEBAR WIDGETS
   ---------------------------------------------------------- */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
}
.widget-title {
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
}
.widget-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 16px;
  background: var(--primary); border-radius: var(--r-full);
}

.quick-links { display: flex; flex-direction: column; gap: 6px; }
.quick-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  text-decoration: none; transition: var(--t);
}
.quick-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.quick-link-icon { font-size: 18px; flex-shrink: 0; }

.stats-list { display: flex; flex-direction: column; gap: 10px; }
.stats-row  { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.stats-label { color: var(--text-secondary); }
.stats-val   { font-weight: 700; color: var(--text-primary); }

/* ----------------------------------------------------------
   SECTION 12 — AD SLOTS (AdSense)
   ---------------------------------------------------------- */
.ad-slot {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px;
  letter-spacing: .3px; overflow: hidden;
  text-align: center;
}
.ad-top     { width: 100%; min-height: 90px;  margin: 16px 0; }
.ad-mid     { width: 100%; min-height: 250px; margin: 24px 0; }
.ad-sidebar { width: 100%; min-height: 250px; }
.ad-between { width: 100%; min-height: 90px;  margin: 16px 0; }

/* ----------------------------------------------------------
   SECTION 13 — BUTTONS
   ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--r);
  font-size: 14px; font-weight: 600;
  transition: var(--t); cursor: pointer; border: none;
  white-space: nowrap; text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; }

.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #15803d; color: #fff; }

.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c;   color: #fff; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong); color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-ghost  { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm  { padding: 6px 14px;  font-size: 12.5px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------
   SECTION 14 — QUIZ PAGE
   ---------------------------------------------------------- */
.quiz-layout {
  max-width: 820px; margin: 0 auto;
  padding: 24px 16px 52px;
}

/* Top info bar */
.quiz-info-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.quiz-exam-name { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; min-width: 160px; }

.quiz-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.quiz-meta-item { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Timer */
.quiz-timer {
  display: flex; align-items: center; gap: 7px;
  font-size: 16px; font-weight: 700;
  padding: 6px 14px; border-radius: var(--r);
  background: var(--primary-light); color: var(--primary);
  min-width: 90px; justify-content: center;
  font-variant-numeric: tabular-nums;
  transition: var(--t);
}
.quiz-timer.warn   { background: var(--warning-light); color: var(--warning); }
.quiz-timer.danger { background: var(--danger-light);  color: var(--danger);  animation: pulse 1s ease infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.55} }

/* Progress bar */
.progress-wrap { margin-bottom: 16px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.progress-bg { background: var(--border); border-radius: var(--r-full); height: 7px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--primary), #4a9eff);
  transition: width .35s ease;
}

/* Question navigator */
.q-nav-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px; margin-bottom: 16px;
}
.q-nav-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.q-nav-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.q-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg-input);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: var(--t);
  display: flex; align-items: center; justify-content: center;
}
.q-btn:hover   { border-color: var(--primary); color: var(--primary); }
.q-btn.current { background: var(--primary);       color: #fff; border-color: var(--primary); }
.q-btn.done    { background: var(--success-light);  color: var(--success); border-color: var(--success); }
.q-btn.marked  { background: var(--warning-light);  color: var(--warning); border-color: var(--warning); }
.q-btn.skipped { background: var(--danger-light);   color: var(--danger);  border-color: var(--danger); }

.q-nav-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend-item  { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-dot   { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.ld-c { background: var(--primary); }
.ld-d { background: var(--success); }
.ld-m { background: var(--warning); }
.ld-s { background: var(--danger); }
.ld-n { background: var(--border); border: 1px solid var(--border-strong); }

/* Question card */
.q-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.q-card-top {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  flex-wrap: wrap; margin-bottom: 12px;
}

.q-topic {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--primary);
  background: var(--primary-light); padding: 3px 10px;
  border-radius: var(--r-full); text-transform: uppercase; letter-spacing: .4px;
}
.q-num { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.mark-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  padding: 4px 10px; border-radius: var(--r-full);
  border: 1.5px solid var(--border); background: transparent;
  transition: var(--t); cursor: pointer;
}
.mark-btn:hover, .mark-btn.active {
  color: var(--warning); border-color: var(--warning); background: var(--warning-light);
}

.q-text { font-size: 16px; font-weight: 500; color: var(--text-primary); line-height: 1.65; margin-bottom: 22px; }

/* Options */
.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border: 1.5px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  background: var(--bg-card); font-size: 14.5px;
  color: var(--text-primary); line-height: 1.5;
  user-select: none; transition: var(--t);
}
.option:hover:not(.locked) { border-color: var(--primary); background: var(--primary-light); }

.option-key {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; flex-shrink: 0;
  color: var(--text-secondary); transition: var(--t);
}

.option.selected        { border-color: var(--primary); background: var(--primary-light); }
.option.selected .option-key { background: var(--primary); border-color: var(--primary); color: #fff; }

.option.correct         { border-color: var(--success); background: var(--success-light); }
.option.correct .option-key { background: var(--success); border-color: var(--success); color: #fff; }

.option.wrong           { border-color: var(--danger);  background: var(--danger-light); }
.option.wrong .option-key   { background: var(--danger);  border-color: var(--danger);  color: #fff; }

.option.locked { cursor: default; }

/* Explanation */
.explanation {
  margin-top: 16px; padding: 14px 16px;
  border-radius: var(--r); font-size: 13.5px; line-height: 1.65;
  border-left: 4px solid; display: none;
}
.explanation.show { display: block; }
.explanation.correct { background: var(--success-light); border-color: var(--success); color: #166534; }
.explanation.wrong   { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
[data-theme="dark"] .explanation.correct { color: #4ade80; }
[data-theme="dark"] .explanation.wrong   { color: #fca5a5; }
.explanation strong { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; opacity: .75; }

/* Quiz controls bar */
.quiz-controls {
  display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap;
}
.quiz-ctrl-left, .quiz-ctrl-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------
   SECTION 15 — RESULT PAGE
   ---------------------------------------------------------- */
.result-layout {
  max-width: 820px; margin: 0 auto;
  padding: 28px 16px 56px;
}

/* Score card */
.score-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 32px 24px;
  text-align: center; margin-bottom: 20px;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.score-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.score-ring {
  width: 128px; height: 128px; border-radius: 50%;
  border: 6px solid var(--primary); background: var(--primary-light);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px; position: relative;
}
.score-ring.pass { border-color: var(--success); background: var(--success-light); }
.score-ring.fail { border-color: var(--danger);  background: var(--danger-light); }

.score-pct { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1; }
.score-ring.pass .score-pct { color: var(--success); }
.score-ring.fail .score-pct { color: var(--danger); }

.result-status { font-size: 22px; font-weight: 800; margin-bottom: 5px; }
.result-status.pass { color: var(--success); }
.result-status.fail { color: var(--danger); }
.result-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.r-stat {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 10px; text-align: center;
}
.r-stat-val  { font-size: 22px; font-weight: 800; display: block; color: var(--text-primary); }
.r-stat-lbl  { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.r-stat.c .r-stat-val { color: var(--success); }
.r-stat.w .r-stat-val { color: var(--danger); }
.r-stat.s .r-stat-val { color: var(--warning); }

/* Topic breakdown */
.topic-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px;
}
.topic-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.topic-row     { margin-bottom: 14px; }
.topic-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.topic-name    { font-size: 13.5px; font-weight: 500; }
.topic-score   { font-size: 12.5px; color: var(--text-muted); }
.topic-bar-bg  { height: 8px; background: var(--border); border-radius: var(--r-full); overflow: hidden; }
.topic-bar-fill { height: 100%; border-radius: var(--r-full); transition: width .6s ease; }
.tbf-high   { background: var(--success); }
.tbf-medium { background: var(--warning); }
.tbf-low    { background: var(--danger); }

/* Share section */
.share-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
  margin-bottom: 20px; text-align: center;
}
.share-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.share-card p  { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.share-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: var(--t); text-decoration: none;
}
.share-btn:hover { opacity: .85; transform: translateY(-1px); text-decoration: none; }
.s-whatsapp  { background: #25D366; color: #fff; }
.s-twitter   { background: #1DA1F2; color: #fff; }
.s-copy      { background: var(--bg-code); color: var(--text-primary); border: 1.5px solid var(--border); }
.s-challenge { background: var(--accent); color: #fff; }

/* Suggest next quiz */
.suggest-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; margin-bottom: 20px;
}
.suggest-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.suggest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
  gap: 12px;
}
.suggest-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; transition: var(--t);
  text-decoration: none; color: inherit;
}
.suggest-item:hover { border-color: var(--primary); background: var(--primary-light); text-decoration: none; }
.suggest-icon { font-size: 24px; flex-shrink: 0; }
.suggest-name { font-size: 13px; font-weight: 600; }
.suggest-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ----------------------------------------------------------
   SECTION 16 — STATIC PAGES (About, Disclaimer, etc.)
   ---------------------------------------------------------- */
.page-hero { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 28px 0; margin-bottom: 28px; }
.page-hero h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.page-hero p  { font-size: 14px; color: var(--text-muted); }

.info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 28px 32px; margin-bottom: 20px;
}
.info-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.info-card h3 { font-size: 15px; font-weight: 700; margin: 20px 0 8px; }
.info-card p  { font-size: 14px; color: var(--text-secondary); line-height: 1.75; margin-bottom: 12px; }
.info-card ul { list-style: disc; padding-left: 20px; font-size: 14px; color: var(--text-secondary); line-height: 1.75; }
.info-card ul li { margin-bottom: 6px; }

.notice {
  display: flex; gap: 12px; padding: 14px 16px;
  border-radius: var(--r); font-size: 13.5px; line-height: 1.6;
  margin: 16px 0; border: 1px solid;
}
.notice-warn   { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.notice-info   { background: var(--primary-light); border-color: var(--primary);  color: var(--primary-dark); }
.notice-danger { background: var(--danger-light);  border-color: var(--danger);   color: #991b1b; }
[data-theme="dark"] .notice-warn   { color: #fcd34d; }
[data-theme="dark"] .notice-info   { color: var(--primary); }
[data-theme="dark"] .notice-danger { color: #fca5a5; }
.notice-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.bc-sep { font-size: 11px; }
.bc-cur { color: var(--text-primary); font-weight: 500; }

/* FAQ */
.faq-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; margin-top: 28px; }
.faq-block h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.faq-item  { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--text-primary);
  gap: 12px; user-select: none; transition: var(--t);
}
.faq-q:hover { color: var(--primary); }
.faq-chevron { font-size: 18px; flex-shrink: 0; color: var(--text-muted); transition: transform .2s ease; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-a { font-size: 14px; color: var(--text-secondary); line-height: 1.75; padding-bottom: 14px; display: none; }
.faq-item.open .faq-a { display: block; }

/* ----------------------------------------------------------
   SECTION 17 — MODAL
   ---------------------------------------------------------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 28px 24px;
  max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-icon  { font-size: 40px; text-align: center; margin-bottom: 12px; }
.modal-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.modal-body  { font-size: 14px; color: var(--text-secondary); text-align: center; line-height: 1.65; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ----------------------------------------------------------
   SECTION 18 — TOAST
   ---------------------------------------------------------- */
#toast-area {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 600; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 18px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  pointer-events: auto; max-width: 320px;
  animation: toastIn .3s ease;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--primary); }
@keyframes toastIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ----------------------------------------------------------
   SECTION 19 — LOADER
   ---------------------------------------------------------- */
#page-loader {
  position: fixed; inset: 0; background: var(--bg-page);
  z-index: 1000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { font-size: 14px; color: var(--text-muted); }

/* ----------------------------------------------------------
   SECTION 20 — FOOTER
   ---------------------------------------------------------- */
#site-footer {
  background: #111827; color: #9ca3af;
  padding: 40px 0 20px; margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px; margin-bottom: 32px;
}

.footer-desc { font-size: 13px; line-height: 1.7; color: #9ca3af; margin-top: 14px; max-width: 300px; }

.footer-col-title {
  font-size: 13px; font-weight: 700; color: #e5e7eb;
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px;
}
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 13px; color: #9ca3af; transition: var(--t); }
.footer-links a:hover { color: #e5e7eb; text-decoration: none; }

.footer-disclaimer {
  background: #1a2235; border: 1px solid #243044;
  border-radius: var(--r); padding: 14px 16px;
  font-size: 12px; color: #6b7280; line-height: 1.65; margin-bottom: 24px;
}
.footer-disclaimer strong { color: #9ca3af; }

.footer-bottom {
  border-top: 1px solid #1f2937; padding-top: 18px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; font-size: 12px;
}
.footer-copy { color: #6b7280; }
.footer-copy a { color: #9ca3af; }
.footer-legal { display: flex; gap: 16px; }
.footer-legal a { color: #6b7280; font-size: 12px; }
.footer-legal a:hover { color: #9ca3af; text-decoration: none; }

/* ----------------------------------------------------------
   SECTION 21 — SCROLLBAR
   ---------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ----------------------------------------------------------
   SECTION 22 — FOCUS / ACCESSIBILITY
   ---------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ----------------------------------------------------------
   SECTION 23 — ANIMATIONS
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .fade-in  { animation: fadeIn  .3s ease; }
  .slide-up { animation: slideUp .3s ease; }
  @keyframes fadeIn  { from{opacity:0}          to{opacity:1} }
  @keyframes slideUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* ----------------------------------------------------------
   SECTION 24 — PRINT
   ---------------------------------------------------------- */
@media print {
  #site-header, #site-nav, #site-footer,
  .quiz-controls, .share-btns, .suggest-card,
  .ad-slot { display: none !important; }
  body { background: #fff; color: #000; }
  .q-card, .score-card { box-shadow: none; border: 1px solid #ccc; }
}

/* ----------------------------------------------------------
   SECTION 25 — RESPONSIVE: TABLET (≤1024px)
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .home-layout { grid-template-columns: 1fr; }
  .home-sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .footer-grid  { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* ----------------------------------------------------------
   SECTION 26 — RESPONSIVE: MOBILE (≤768px)
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  :root { --header-h: 56px; --nav-h: 40px; }

  /* Header */
  .header-search { display: none; }
  .menu-toggle   { display: flex; }
  .logo-tag      { display: none; }
  #site-nav      { display: none; }

  /* Show search as drawer when mobile open */
  .header-search.mobile-open {
    display: block; position: absolute;
    top: var(--header-h); left: 0; right: 0;
    padding: 10px 16px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border); z-index: 100;
  }

  /* Hero */
  .hero { padding: 28px 16px 32px; }
  .hero h1 { font-size: 22px; }
  .hero p  { font-size: 14px; }
  .hero-stats { gap: 20px; }
  .hero-stat strong { font-size: 22px; }

  /* Grid */
  .exams-grid { grid-template-columns: 1fr; }
  .home-sidebar { grid-template-columns: 1fr; }

  /* Quiz */
  .quiz-layout    { padding: 16px 12px 32px; }
  .quiz-info-bar  { padding: 12px 14px; }
  .q-card         { padding: 18px 16px; }
  .q-text         { font-size: 15px; }
  .option         { font-size: 13.5px; padding: 11px 14px; }
  .q-btn          { width: 30px; height: 30px; font-size: 11.5px; }
  .quiz-controls  { gap: 8px; }
  .btn            { padding: 9px 14px; font-size: 13px; }

  /* Result */
  .result-layout  { padding: 16px 12px 32px; }
  .score-card     { padding: 24px 16px; }
  .result-stats   { grid-template-columns: repeat(2,1fr); }
  .share-btn      { padding: 8px 13px; font-size: 13px; }

  /* Static pages */
  .info-card { padding: 20px 16px; }

  /* Footer */
  .footer-grid   { grid-template-columns: 1fr; gap: 20px; }
  .footer-desc   { max-width: 100%; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  /* Toast */
  #toast-area { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
}

/* ----------------------------------------------------------
   SECTION 27 — RESPONSIVE: SMALL MOBILE (≤480px)
   ---------------------------------------------------------- */
@media (max-width: 480px) {
  .hero-stats { gap: 14px; }
  .filter-tab { padding: 5px 12px; font-size: 12.5px; }
  .exams-grid { gap: 12px; }
  .exam-card  { padding: 16px; }
  .result-stats { grid-template-columns: repeat(2,1fr); }
  .score-ring { width: 110px; height: 110px; }
  .score-pct  { font-size: 26px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}