
:root {
  color-scheme: light dark;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #182033;
  --muted: #667085;
  --border: #d9deea;
  --accent: #2557d6;
  --accent-soft: #eaf0ff;
  --ok: #067647;
  --bad: #b42318;
  --warn: #9a6700;
  --notice-bg: #fff8e6;
  --notice-text: #473500;
  --notice-border: #f3d27a;
  --shadow: 0 18px 50px rgba(21, 31, 59, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --card: #1f2937;
    --text: #f9fafb;
    --muted: #cbd5e1;
    --border: #374151;
    --accent: #7aa2ff;
    --accent-soft: #172554;
    --notice-bg: #2b2108;
    --notice-text: #ffe8a3;
    --notice-border: #7c5c12;
    --shadow: none;
  }
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #182033;
  --muted: #667085;
  --border: #d9deea;
  --accent: #2557d6;
  --accent-soft: #eaf0ff;
  --notice-bg: #fff8e6;
  --notice-text: #473500;
  --notice-border: #f3d27a;
  --shadow: 0 18px 50px rgba(21, 31, 59, 0.08);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --card: #1f2937;
  --text: #f9fafb;
  --muted: #cbd5e1;
  --border: #374151;
  --accent: #7aa2ff;
  --accent-soft: #172554;
  --notice-bg: #2b2108;
  --notice-text: #ffe8a3;
  --notice-border: #7c5c12;
  --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background: radial-gradient(circle at top, var(--accent-soft), transparent 320px), var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-variant-numeric: lining-nums tabular-nums;
}
a { color: var(--accent); }
.skip-link {
  position: absolute;
  top: -60px;
  right: 16px;
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.skip-link:focus { top: 12px; z-index: 10; }
.container { width: min(1160px, calc(100% - 28px)); margin: 0 auto; }
.hero { padding: 38px 0 24px; }
.hero-top { direction: ltr; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: nowrap; margin-bottom: 14px; }
.hero-top > * { direction: rtl; }
.counter-pill { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.visitor-pill { min-height: 40px; padding: 7px 12px; gap: 7px; }
.counter-pill strong { direction: ltr; unicode-bidi: isolate; font-size: 18px; line-height: 1; }
.counter-pill small { color: var(--muted); font-size: 12px; }
.theme-toggle { width: 44px; min-width: 44px; min-height: 40px; border-radius: 999px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.badge { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 14px; }
h1 { margin: 18px 0 10px; font-size: clamp(28px, 5vw, 52px); line-height: 1.2; }
.lead { max-width: 820px; font-size: 18px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 22px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.stat strong { display: block; direction: ltr; unicode-bidi: isolate; font-size: 30px; line-height: 1; }
.stat span { color: var(--muted); font-size: 13px; }
.notice { background: var(--notice-bg); color: var(--notice-text); border: 1px solid var(--notice-border); border-radius: 18px; padding: 16px 18px; margin: 18px 0 26px; }
.grid { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 18px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; line-height: 1.35; }
.controls { display: grid; gap: 12px; }
label.field { display: grid; gap: 6px; font-weight: 700; }
select, input { width: 100%; min-height: 44px; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
#customSessionSize:disabled { opacity: 0.55; cursor: not-allowed; }
#sessionStatus { margin-top: 12px; }
button { min-height: 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.question-text { white-space: pre-line; font-size: 20px; font-weight: 700; margin: 16px 0; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 14px; padding: 12px; cursor: pointer; }
.choice input { width: auto; min-height: auto; margin-top: 8px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.nav-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.explanation { margin-top: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--accent-soft); padding: 14px; }
.answer-state { margin-top: 12px; font-weight: 800; }
.answer-state.ok { color: var(--ok); }
.answer-state.bad { color: var(--bad); }
.answer-state.warn { color: var(--warn); }
.quick-result { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--border); font-weight: 700; }
.catalog { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mini-index { min-width: 48px; padding: 0 10px; direction: ltr; unicode-bidi: isolate; }
.mini-index.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.plan { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.plan article { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.calculator { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; align-items: end; }
.footer { padding: 28px 0 42px; color: var(--muted); }
.dua-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 16px 18px; margin-bottom: 14px; color: var(--text); box-shadow: var(--shadow); }
.dua-card p { margin: 0; }
.dua-card p + p { margin-top: 6px; color: var(--muted); }
.footer-note { margin: 0; }
.sources { display: flex; gap: 10px; flex-wrap: wrap; padding: 0; list-style: none; }
.sources a { display: inline-flex; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); text-decoration: none; }
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid { grid-template-columns: 1fr; }
  .plan { grid-template-columns: 1fr; }
  .calculator { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .hero-top { justify-content: space-between; align-items: center; }
  .visitor-pill, .theme-toggle { width: auto; justify-content: center; }
  .visitor-pill { min-width: 76px; }
  .question-text { font-size: 18px; }
}
@media print {
  body { background: white; }
  .hero, .filters, .footer, .nav-row, .catalog-card { display: none; }
  .container { width: 100%; }
  .grid { display: block; }
  .card { box-shadow: none; border: 1px solid #000; }
}


.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.small-lead { font-size: 16px; margin: 0; }
.exam-hub { margin: 18px 0; }
.exam-options { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.exam-option { border: 1px solid var(--border); border-radius: 18px; padding: 16px; background: var(--accent-soft); }
.exam-option.featured { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.exam-option h3 { margin: 0 0 8px; }
.exam-option p { margin: 0 0 12px; color: var(--muted); }
.exam-option button { width: 100%; }
.exam-screen, .exam-result { margin: 18px 0; }
.exam-topbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; }
.exam-timer { min-width: 170px; text-align: center; border: 1px solid var(--border); border-radius: 18px; padding: 12px; background: var(--accent-soft); }
.exam-timer span { display: block; color: var(--muted); font-size: 13px; }
.exam-timer strong { display: block; direction: ltr; unicode-bidi: isolate; font-size: 30px; line-height: 1.15; }
.exam-section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.section-chip { border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; background: var(--card); color: var(--muted); font-weight: 700; }
.section-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.section-chip.done { color: var(--ok); border-color: rgba(6,118,71,.45); }
.section-chip.locked { opacity: .55; }
.result-stats { grid-template-columns: repeat(4, minmax(0,1fr)); margin: 12px 0 18px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-top: 16px; }
.analysis-list { display: grid; gap: 10px; }
.analysis-item { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--accent-soft); }
.analysis-item strong { display: flex; justify-content: space-between; gap: 8px; direction: rtl; }
.progress-bar { height: 9px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 8px; }
.progress-bar span { display: block; height: 100%; width: var(--w, 0%); background: var(--accent); }
.mistakes-box { margin-top: 18px; border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; }
.mistakes-box summary { cursor: pointer; font-weight: 800; }
.mistakes-list { display: grid; gap: 12px; margin-top: 12px; }
.mistake-item { border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.mistake-item h4 { margin: 0 0 8px; }
.mistake-item p { margin: 6px 0; }
.marked-note { color: var(--warn); font-weight: 800; }
.choice.exam-locked { cursor: default; }
@media (max-width: 820px) {
  .exam-options, .result-grid, .result-stats { grid-template-columns: 1fr; }
  .exam-topbar { align-items: stretch; flex-direction: column; }
  .exam-timer { width: 100%; }
}

input[type="number"], input[inputmode="numeric"] { direction: ltr; unicode-bidi: isolate; }

/* v14: clear practice/exam separation and immersive exam mode */
.main-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.tab-button {
  border-radius: 14px;
  font-size: 17px;
}
.tab-button.active,
.tab-button[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab-panel[hidden] { display: none !important; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

body.exam-active {
  background: var(--bg);
}
body.exam-active .hero,
body.exam-active .notice,
body.exam-active .main-tabs,
body.exam-active #trainingPanel,
body.exam-active #examHub,
body.exam-active .footer {
  display: none !important;
}
body.exam-active main.container {
  width: min(980px, calc(100% - 20px));
  padding: 10px 0 22px;
}
body.exam-active .exam-screen {
  min-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0 auto;
  border-radius: 18px;
  padding: 18px;
  box-shadow: none;
}
body.exam-active .exam-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  padding-top: 2px;
}
body.exam-active .exam-submeta {
  display: none;
}
body.exam-active #examQuestionTitle {
  margin-top: 8px;
  font-size: 22px;
}
body.exam-active #examQuestionText {
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.9;
  margin: 22px 0;
}
body.exam-active .choices {
  gap: 12px;
}
body.exam-active .choice {
  min-height: 58px;
  align-items: center;
  font-size: 18px;
  background: var(--card);
}
body.exam-active .choice input {
  margin-top: 0;
  transform: scale(1.15);
}
body.exam-active .nav-row {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  justify-content: space-between;
}
body.exam-active .nav-row button {
  min-width: 150px;
}
body.exam-active #examNextBtn {
  min-width: 180px;
}
body.exam-active #examFinishBtn {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 45%, var(--border));
}
.exam-options .exam-option h3,
.exam-options .exam-option p {
  text-wrap: pretty;
}

@media (max-width: 820px) {
  .main-tabs { grid-template-columns: 1fr; }
  body.exam-active main.container { width: min(100% - 12px, 980px); }
  body.exam-active .exam-screen { min-height: calc(100dvh - 12px); padding: 14px; }
  body.exam-active .exam-section-nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  body.exam-active .section-chip { white-space: nowrap; }
  body.exam-active .nav-row { display: grid; grid-template-columns: 1fr 1fr; }
  body.exam-active .nav-row button { width: 100%; min-width: 0; }
  body.exam-active #examNextBtn { min-width: 0; }
}


/* v15: realistic training sessions and cleaner exam navigation */
.practice-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.practice-guide article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow);
}
.practice-guide strong { font-size: 17px; }
.practice-guide span { color: var(--muted); font-size: 14px; line-height: 1.7; }
.practice-timer {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 800;
}
.practice-timer strong {
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 20px;
}
.exam-question-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--accent-soft);
}
.exam-qdot {
  min-width: 38px;
  min-height: 36px;
  border-radius: 10px;
  padding: 0 8px;
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 14px;
}
.exam-qdot.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.exam-qdot.answered:not(.current) {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
}
.exam-qdot.marked:not(.current) {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warn) 18%, transparent);
}
body.exam-active .exam-question-nav {
  max-height: 82px;
  overflow-y: auto;
}
@media (max-width: 820px) {
  .practice-guide { grid-template-columns: 1fr; }
  body.exam-active .exam-question-nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; }
  .exam-qdot { flex: 0 0 auto; }
}


/* v16: local save and print tools */
.save-print-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--accent-soft);
}
.save-print-box h3 { margin: 0 0 6px; }
.save-print-box p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.compact-actions { grid-template-columns: 1fr; gap: 8px; }
.result-actions { border-top: 1px solid var(--border); padding-top: 14px; }
@media print {
  .save-print-box, .result-actions { display: none !important; }
}


/* v17: compact mobile header and quiet footer prayer */
@media (max-width: 820px) {
  .hero { padding-top: 20px; }
  .hero-top { margin-bottom: 12px; }
  .badge { width: 100%; justify-content: center; text-align: center; border-radius: 18px; }
  .visitor-pill strong { font-size: 17px; }
  .dua-card { padding: 14px; font-size: 14px; }
}
