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

/* ── Brand tokens (matches codesiya9a.ma exactly) ── */
:root {
  --blue:        #3a7bd5;
  --blue-d:      #2563b8;
  --blue-light:  #5a9be6;
  --blue-grad:   linear-gradient(135deg, #3a7bd5, #00d2ff);
  --blue-grad-h: linear-gradient(135deg, #2563b8, #00b8e0);
  --green:       #27ae60;
  --orange:      #e67e22;
  --red:         #e74c3c;
  --bg:          #e8ecf1;
  --surface:     #ffffff;
  --surface-2:   #f0f4f8;
  --border:      #d5dce6;
  --text:        #2c3e50;
  --text-2:      #5a6a7d;
  --text-3:      #8899aa;
  --shadow:      0 2px 12px rgba(44,62,80,.08);
  --shadow-md:   0 4px 20px rgba(44,62,80,.10);
  --shadow-lg:   0 12px 40px rgba(44,62,80,.15);
  --shadow-blue: 0 3px 12px rgba(58,123,213,.30);
  --radius:      14px;
  --radius-sm:   9px;
  --transition:  .2s ease;
  --font:        'Cairo', system-ui, -apple-system, sans-serif;
  --max-w:       1100px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ──────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; color: var(--text); }
h2 { font-size: 1.3rem;  font-weight: 800; color: var(--text); }
h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
p  { color: var(--text-2); }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }

/* ── Page transitions ────────────────────────────── */
.page-enter { animation: fadeUp .35s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ── Navbar ──────────────────────────────────────── */
.navbar {
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  transition: box-shadow var(--transition);
}
.navbar.scrolled { box-shadow: var(--shadow-md); }

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  cursor: pointer;
}
.navbar-brand:hover { text-decoration: none; }

.logo-icon {
  width: 40px; height: 40px;
  background: var(--blue-grad);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-blue);
  position: relative;
  overflow: hidden;
}
.logo-icon::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.2) 50%, transparent 60%);
  animation: logoShine 4s ease-in-out infinite;
}
@keyframes logoShine {
  0%,100% { transform: translateX(-100%) rotate(-45deg); }
  50%      { transform: translateX(100%) rotate(-45deg); }
}
.logo-icon svg { width: 20px; height: 20px; color: #fff; position: relative; z-index: 1; }
.logo-icon span { color: #fff; font-size: .85rem; font-weight: 800; position: relative; z-index: 1; }

.navbar-brand-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}

.navbar-actions { display: flex; align-items: center; gap: .5rem; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue-grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-blue);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue-grad);
  color: #fff;
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: var(--blue-grad-h);
  box-shadow: 0 6px 18px rgba(58,123,213,.35);
  transform: translateY(-1px);
  text-decoration: none; color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: #edf2ff; }
.btn-ghost { background: transparent; color: var(--text-2); padding: .4rem .85rem; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm   { padding: .35rem .9rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-google {
  background: #fff;
  border: 1.5px solid var(--border);
  color: #3c4043;
}
.btn-google:hover { background: var(--surface-2); box-shadow: var(--shadow); text-decoration: none; color: #3c4043; }
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ── Section cards (dashboard) ───────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.1rem;
  padding: 1.5rem 0;
}

.section-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
}
.section-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  text-decoration: none;
  color: var(--text);
}

.section-card-icon {
  height: 90px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  background: linear-gradient(160deg, #0a2e5c 0%, #1a56a8 40%, #2e86de 100%);
  position: relative;
  overflow: hidden;
}
.section-card-icon::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.08) 50%, transparent 60%);
  animation: logoShine 5s ease-in-out infinite;
}

.section-card-body { padding: 1.1rem 1.25rem; flex: 1; }
.section-card-title { font-size: 1rem; font-weight: 800; margin-bottom: .3rem; }
.section-card-desc  { font-size: .83rem; color: var(--text-2); }

.section-card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
}

/* ── Progress bar ────────────────────────────────── */
.progress-bar-wrap {
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: .6rem;
}
.progress-bar-fill {
  height: 100%;
  background: var(--blue-grad);
  border-radius: 999px;
  transition: width .4s ease;
}

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .4rem; color: var(--text); }
.input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  transition: all var(--transition);
  direction: rtl;
}
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,123,213,.12);
}
.input.error { border-color: var(--red); }
.form-error { font-size: .8rem; color: var(--red); margin-top: .35rem; font-weight: 600; }

/* ── Auth page ───────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #0a2e5c 0%, #1a56a8 30%, #2e86de 60%, #1a56a8 100%);
}
.auth-box {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo .logo-circle {
  width: 60px; height: 60px;
  background: var(--blue-grad);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.2rem; font-weight: 800;
  margin-bottom: .75rem;
  box-shadow: var(--shadow-blue);
}
.auth-logo h1 { font-size: 1.3rem; color: var(--text); margin: 0; }
.auth-logo p  { font-size: .85rem; color: var(--text-2); margin-top: .2rem; }

.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: .78rem; color: var(--text-3); white-space: nowrap; font-weight: 600; }

/* ── Quiz layout ─────────────────────────────────── */
.quiz-layout { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem; }

.quiz-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.quiz-counter { font-size: .85rem; color: var(--text-2); font-weight: 600; }
.quiz-timer {
  font-size: 1.05rem; font-weight: 800;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  background: #edf2ff;
  padding: .3rem .8rem;
  border-radius: 8px;
}
.quiz-timer.warn   { color: var(--orange); background: #fef3e2; }
.quiz-timer.danger { color: var(--red);    background: #fdecea; }

.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
}
.question-card-body { padding: 1.5rem; }
.question-media {
  width: 100%; border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  max-height: 280px; object-fit: contain;
  background: var(--surface-2);
}
.question-text { font-size: 1.05rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }

.answers-list { display: flex; flex-direction: column; gap: .6rem; }
.answer-btn {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .9rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: right;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text);
  transition: all var(--transition);
  width: 100%;
}
.answer-btn:hover:not(:disabled) {
  border-color: var(--blue);
  background: #edf2ff;
  transform: translateX(-2px);
}
.answer-btn.selected { border-color: var(--blue); background: #edf2ff; color: var(--blue-d); }
.answer-btn.correct  { border-color: var(--green); background: #eafaf1; color: #1e8449; }
.answer-btn.wrong    { border-color: var(--red);   background: #fdecea; color: #c0392b; }
.answer-btn:disabled { cursor: default; transform: none; }

.answer-letter {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
  color: var(--text-2);
}

/* ── Results ─────────────────────────────────────── */
.result-card { max-width: 500px; margin: 2rem auto; text-align: center; padding: 2rem; }
.result-score { font-size: 3.5rem; font-weight: 800; line-height: 1; margin: 1rem 0 .5rem; }
.result-score.pass { color: var(--green); }
.result-score.fail { color: var(--red); }
.result-badge {
  display: inline-block;
  padding: .35rem 1.1rem;
  border-radius: 999px;
  font-size: .85rem; font-weight: 800;
  margin-bottom: 1rem;
}
.result-badge.pass { background: #eafaf1; color: #1e8449; }
.result-badge.fail { background: #fdecea; color: #c0392b; }

/* ── Toast ───────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
  min-width: 260px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: .8rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideUp .2s ease;
  text-align: center;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes slideUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ── Spinner ─────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page loading overlay ────────────────────────── */
#app-loading {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #0a2e5c, #1a56a8 50%, #2e86de);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  transition: opacity .3s ease;
}
#app-loading.hidden { opacity: 0; pointer-events: none; }
#app-loading .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

/* ── Admin ───────────────────────────────────────── */
.admin-layout { display: flex; min-height: calc(100vh - 61px); }

.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 1.25rem .75rem;
  display: flex; flex-direction: column; gap: .2rem;
  box-shadow: 2px 0 8px rgba(44,62,80,.04);
}
.admin-sidebar .sidebar-label {
  font-size: .72rem; font-weight: 800; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  padding: .4rem .85rem .6rem;
}
.admin-sidebar a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .88rem; font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
}
.admin-sidebar a:hover { background: #edf2ff; color: var(--blue); text-decoration: none; }
.admin-sidebar a.active { background: #edf2ff; color: var(--blue); }

.admin-main { flex: 1; padding: 1.75rem; overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td {
  padding: .7rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--surface-2);
  font-weight: 800;
  color: var(--text-2);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table tbody tr:hover td { background: #f7f9fc; }

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .22rem .65rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 800;
}
.badge-admin    { background: #ede9fe; color: #6d28d9; }
.badge-user     { background: var(--surface-2); color: var(--text-2); }
.badge-pass     { background: #eafaf1; color: #1e8449; }
.badge-fail     { background: #fdecea; color: #c0392b; }
.badge-verified { background: #dbeafe; color: #1d4ed8; }
.badge-منشور   { background: #eafaf1; color: #1e8449; }

/* ── Stat tiles ──────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px,1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-tile {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--blue);
}
.stat-value {
  font-size: 2.2rem; font-weight: 800;
  background: var(--blue-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
.stat-label { font-size: .82rem; color: var(--text-2); margin-top: .35rem; font-weight: 600; }

/* ── Hero (dashboard welcome) ────────────────────── */
.dash-hero {
  background: linear-gradient(160deg, #0a2e5c 0%, #1a56a8 30%, #2e86de 60%, #1a56a8 100%);
  color: #fff;
  padding: 2.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.dash-hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(0,210,255,.12);
  border-radius: 50%;
  filter: blur(60px);
  top: -80px; right: 5%;
}
.dash-hero h1 { color: #fff; font-size: 1.6rem; }
.dash-hero p  { color: rgba(255,255,255,.8); margin-top: .3rem; }

/* ── Utilities ───────────────────────────────────── */
.hidden         { display: none !important; }
.mt-1           { margin-top: .5rem; }
.mt-2           { margin-top: 1rem; }
.mt-3           { margin-top: 1.5rem; }
.text-center    { text-align: center; }
.text-muted     { color: var(--text-2); }
.flex           { display: flex; }
.gap-1          { gap: .5rem; }
.gap-2          { gap: 1rem; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.w-full         { width: 100%; }
.page           { padding: 1.75rem 0; }
.page-title     { margin-bottom: 1.25rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-3); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .section-grid { grid-template-columns: 1fr 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: .5rem;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  .dash-hero { padding: 1.75rem 1rem; }
}
@media (max-width: 380px) {
  .section-grid { grid-template-columns: 1fr; }
}

/* ── Section Header ──────────────────────────────── */
.section-header {
  background: linear-gradient(160deg, #0a2e5c, #1a56a8, #2e86de);
  color: #fff;
  padding: 1.25rem 0;
  margin-bottom: 1.5rem;
}
.section-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-header-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

/* ── Exam Grid (series list) ─────────────────────── */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .7rem;
  text-align: right;
  transition: all .2s;
  box-shadow: var(--shadow);
  font-family: var(--font);
  color: var(--text);
}
.exam-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.exam-card--done { border-color: var(--green); }
.exam-card-num {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--blue-grad);
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exam-card--done .exam-card-num { background: linear-gradient(135deg, var(--green), #2ecc71); }
.exam-card-body { flex: 1; min-width: 0; }
.exam-card-title { font-size: .9rem; font-weight: 700; line-height: 1.3; }
.exam-card-meta  { font-size: .75rem; color: var(--text-3); margin-top: 2px; }
.exam-card-score { font-size: .75rem; color: var(--blue); font-weight: 700; margin-top: 2px; }
.exam-card-status { flex-shrink: 0; }
.exam-card-status svg { width: 18px; height: 18px; color: var(--text-3); }
.exam-card--done .exam-card-status svg { color: var(--green); }

/* ── Quiz Wrap ───────────────────────────────────── */
.quiz-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-2);
}

/* ── Quiz v2 (matches codesiya9a.ma exam layout) ─── */
.qv2 {
  --qv2-purple:   #7c5cf0;
  --qv2-purple-d: #5b3fd6;
  --qv2-navy:     #16213e;
  --qv2-navy-d:   #0d1526;
  --qv2-cream:    #f3ead9;
  --qv2-teal:     #17c3b2;
  direction: ltr;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #eef1f7;
  font-family: var(--font);
}

.qv2-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  background: #fff;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.qv2-stats { display: flex; align-items: center; gap: .5rem; }
.qv2-chip {
  display: flex; align-items: center; gap: 4px;
  font-weight: 800; font-size: .85rem;
  padding: .35rem .7rem; border-radius: 20px;
  background: var(--bg); color: var(--text);
}
.qv2-chip--wrong   { background: #fdecea; color: var(--red); }
.qv2-chip--correct { background: #eafaf1; color: var(--green); }
.qv2-chip-icon svg { width: 12px; height: 12px; display: block; }
.qv2-title {
  direction: rtl; flex: 1; text-align: center;
  font-weight: 800; font-size: 1rem; color: #e8a800;
}
.qv2-brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--text); }

.qv2-body {
  flex: 1;
  display: grid;
  grid-template-columns: 170px 1fr 60px;
  gap: 14px;
  padding: 14px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* Sidebar */
.qv2-sidebar {
  background: linear-gradient(160deg, #9c81f7, var(--qv2-purple-d));
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-md);
}
.qv2-correct-btn {
  background: var(--red); color: #fff; border: none; border-radius: 10px;
  padding: .7rem; font-weight: 800; font-size: .85rem;
  font-family: var(--font); cursor: pointer;
  opacity: .5; pointer-events: none; transition: opacity .15s;
}
.qv2-correct-btn.active { opacity: 1; pointer-events: auto; }
.qv2-numbers { display: flex; flex-direction: column; gap: 8px; }
.qv2-num {
  background: linear-gradient(160deg, #b09df8, var(--qv2-purple));
  border: none; border-radius: 10px; color: #fff;
  font-weight: 800; font-size: 1.1rem; font-family: var(--font);
  padding: .75rem; cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,.15);
  transition: transform .12s, box-shadow .12s, background .15s;
}
.qv2-num:hover { transform: translateY(-1px); }
.qv2-num--sel     { background: linear-gradient(160deg, var(--blue-light), var(--blue-d)); box-shadow: 0 0 0 3px rgba(58,123,213,.35); }
.qv2-num--correct { background: linear-gradient(160deg, #4bd080, var(--green)) !important; }
.qv2-num--wrong   { background: linear-gradient(160deg, #f0685a, var(--red)) !important; }
.qv2-validate-btn {
  background: #bcc4d6; color: #fff; border: none; border-radius: 10px;
  padding: .7rem; font-weight: 800; font-size: .85rem;
  font-family: var(--font); cursor: not-allowed;
}
.qv2-validate-btn.active { background: var(--blue-grad); cursor: pointer; }
.qv2-category {
  background: #2f5fb3; color: #fff; text-align: center;
  border-radius: 10px; padding: .5rem; font-size: .8rem; font-weight: 700;
}
.qv2-logo-badge {
  margin-top: auto;
  background: linear-gradient(160deg, var(--qv2-teal), #0f9c8f);
  color: #fff; text-align: center; border-radius: 10px;
  padding: .5rem; font-size: .68rem; font-weight: 800; line-height: 1.3;
}

/* Content */
.qv2-content {
  background: var(--qv2-navy);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.qv2-img-wrap {
  position: relative; flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--qv2-navy-d); min-height: 240px;
}
.qv2-progress-chip {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.55); color: #fff; font-weight: 800; font-size: .8rem;
  padding: .3rem .7rem; border-radius: 8px;
}
.qv2-img { max-width: 100%; max-height: 420px; object-fit: contain; }
.qv2-answer-panel { direction: rtl; background: var(--qv2-cream); padding: 1rem 1.25rem; }
.qv2-q-text { font-weight: 800; margin-bottom: .6rem; color: #4a3f2a; }
.qv2-a-line { padding: .3rem 0; color: #4a3f2a; font-weight: 600; }
.qv2-a-line b { margin-left: .4rem; }
.qv2-explanation {
  margin-top: .75rem; padding: .6rem .75rem; background: rgba(255,255,255,.5);
  border-radius: 8px; font-size: .85rem; color: #4a3f2a; line-height: 1.6;
}

/* Icon rail */
.qv2-icons { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qv2-icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  background: #1f2a4a; border: none; color: #cdd7f0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.qv2-icon-btn:hover { background: #2b3a63; }
.qv2-icon-btn svg { width: 20px; height: 20px; }
.qv2-icon-btn--ghost { width: 34px; height: 34px; background: transparent; color: var(--text-2); }
.qv2-icon-btn--ghost:hover { background: var(--bg); }
.qv2-timer {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(160deg, var(--qv2-teal), #0f9c8f);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums;
}

/* Dots overlay */
.qv2-dots-panel {
  position: fixed; inset: 0; background: rgba(15,20,35,.55);
  z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.qv2-dots-inner {
  background: #fff; border-radius: 16px; padding: 1.25rem;
  max-width: 360px; width: 100%; max-height: 80vh; overflow: auto; direction: rtl;
}
.qv2-dots-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: .75rem; }
.qv2-dot {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); font-weight: 700; font-size: .8rem;
  cursor: pointer; font-family: var(--font);
}
.qv2-dot--ans { background: #dbeafe; border-color: var(--blue); }
.qv2-dot--cur { background: var(--blue); color: #fff; border-color: var(--blue); }

@media (max-width: 860px) {
  .qv2-body { grid-template-columns: 1fr; }
  .qv2-content { order: 1; }
  .qv2-sidebar { order: 2; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .qv2-correct-btn { flex: 0 0 100%; order: 1; }
  .qv2-numbers { flex: 1; flex-direction: row; order: 2; }
  .qv2-num { flex: 1; }
  .qv2-validate-btn { flex: 0 0 100%; order: 3; }
  .qv2-category, .qv2-logo-badge { flex: 1; order: 4; margin-top: 0; }
  .qv2-icons { order: 3; flex-direction: row; justify-content: center; }
}

/* ── Result ──────────────────────────────────────── */
.result-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.result-icon svg { width: 36px; height: 36px; }
.result-icon--pass { background: #dcfce7; color: var(--green); }
.result-icon--fail { background: #fee2e2; color: var(--red); }
.result-verdict   { font-size: 1.6rem; margin-bottom: .5rem; }
.result-score-big { font-size: 2.5rem; font-weight: 900; color: var(--text); margin-bottom: .25rem; }
.result-pct       { font-size: 1.2rem; font-weight: 800; margin-bottom: .5rem; }
.result-note      { font-size: .9rem; color: var(--text-2); margin-bottom: 1.5rem; }
.result-actions   { display: flex; flex-direction: column; gap: .6rem; }

/* ── Review Mode ─────────────────────────────────── */
.quiz-wrap { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.quiz-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 40;
}
.quiz-title { flex: 1; font-size: .9rem; font-weight: 700; color: var(--text-2); text-align: center; }
.quiz-ans-label {
  min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800; flex-shrink: 0;
}
.review-list { padding: 1rem; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.review-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1rem;
  border-right: 4px solid var(--border);
}
.review-item--ok   { border-right-color: var(--green); }
.review-item--wrong { border-right-color: var(--red); }
.review-num   { font-size: .75rem; font-weight: 800; color: var(--text-3); margin-bottom: .5rem; }
.review-img   { max-width: 100%; border-radius: 8px; margin-bottom: .75rem; }
.review-text  { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; }
.review-answers   { display: flex; flex-direction: column; gap: 6px; margin-bottom: .75rem; }
.review-ans       { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border-radius: 8px; background: var(--bg); font-size: .875rem; }
.review-ans--correct { background: #dcfce7; color: #16a34a; font-weight: 700; }
.review-ans--wrong   { background: #fee2e2; color: var(--red); }
.review-explanation  { font-size: .85rem; color: var(--text-2); padding: .6rem; background: var(--surface-2); border-radius: 8px; line-height: 1.6; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 600px) {
  .exam-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .result-card { padding: 1.75rem 1.25rem; }
}
