/* «اختبار أكتوبر التفاعلى» و«اختبار نوفمبر التفاعلى»
   2026-12-05: restyled to match the live site (navy/gold, 10px cards, form fields).
   Independent of the main style.css so the Android WebView at /exams/ stays self-contained.
   Exam logic, timer, scoring and certificates are unchanged. */
:root {
  --navy: #1a2b4a;
  --navy-dark: #12203a;
  --navy-soft: #e8ecf3;
  --blue: #1a2b4a; /* was a leftover bright blue; map to navy so .btn-blue matches the site */
  --gold: #a87b1f;
  --gold-strong: #c9a227;
  --gold-soft: #f6ecd2;
  --yellow: #c9a227;
  --yellow-soft: #f6ecd2;
  --green: #1e6b41;
  --green-soft: #e7f3ec;
  --green-text: #14532d;
  --red: #b91c1c;
  --red-soft: #fdecea;
  --text: #1d2733;
  --ink: #1d2733;
  --muted: #5b6673;
  --paper: #f7f4ec;
  --bg: #f7f4ec;
  --card: #fffdf8;
  --line: #e4ddcc;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: Cairo, "Noto Kufi Arabic", system-ui, sans-serif;
  line-height: 1.7;
}
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-weight: 600; }
.error {
  background: var(--card);
  border: 1px solid #ef9a9a;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  font-weight: 700;
}
.page-title { text-align: center; color: var(--navy); font-size: 1.3rem; font-weight: 800; margin: .2rem 0 .6rem; }
.back { display: inline-block; margin-bottom: .4rem; }

/* Header — same identity as the site */
.ex-header { background: var(--navy); color: #fff; }
.ex-header .wrap { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; }
.ex-brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.ex-brand img { width: 46px; height: 46px; border-radius: 50%; }
.ex-brand strong { display: block; font-size: 1.05rem; line-height: 1.3; }
.ex-brand small { display: block; font-size: .8rem; color: #d9d2c0; }
.ex-brand span { white-space: nowrap; }
.ex-header nav { margin-inline-start: auto; display: flex; gap: 1rem; }
.ex-header nav a { color: #fff; text-decoration: none; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.ex-header nav a:hover { color: var(--gold-strong); }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
.ex-body { -webkit-tap-highlight-color: transparent; }
.ex-body .wrap { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }

/* Buttons — same radius, weight and colors as the site */
.btn {
  display: inline-block;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
  padding: 10px 22px;
  margin-top: .8rem;
  text-align: center;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { background: var(--navy-dark); border-color: var(--navy-dark); text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
.btn-blue { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-blue:hover { background: var(--navy-dark); }
.btn-outline { background: var(--card); color: var(--navy); border: 1px solid var(--navy); }
.btn-outline:hover { background: var(--navy-soft); }
.btn-yellow { background: var(--gold-strong); border-color: var(--gold-strong); color: var(--navy-dark); }
.btn-yellow:hover { background: #b89120; border-color: #b89120; }
.btn:disabled { opacity: .5; cursor: default; }

/* Hero + October/November switcher */
.ex-hero {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin: 1rem 0;
  text-align: center;
  border-top: 3px solid var(--gold-strong);
}
.ex-hero h2 { margin: 0; font-size: 1.35rem; font-weight: 800; }
.ex-hero p { margin: .3rem 0 0; color: var(--gold-strong); font-weight: 700; font-size: .95rem; }
.ex-sets { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0 0 1rem; }
.ex-set {
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-weight: 800; font-size: .95rem;
  min-height: 48px; padding: .55rem .7rem;
  border-radius: 8px; text-decoration: none;
  border: 1px solid var(--gold-strong); color: var(--navy-dark); background: var(--card);
}
.ex-set.on { background: var(--gold-strong); color: var(--navy-dark); }
.ex-set:hover { text-decoration: none; border-color: var(--navy); }
.ex-set:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Cards */
.ex-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.ex-card h3 { margin: 0 0 .3rem; font-size: 1.2rem; font-weight: 800; color: var(--navy); }

/* Start / registration form */
#ex-pf { display: flex; flex-direction: column; align-items: stretch; }
#ex-pf > .hint { margin: 0 0 .25rem; line-height: 1.7; }
#ex-pf > label,
#ex-pf label {
  display: block;
  width: 100%;
  font-weight: 800;
  font-size: .95rem;
  color: var(--navy);
  margin: 1rem 0 .45rem;
  line-height: 1.5;
}
#ex-name,
#ex-pf input[type="text"],
#ex-pf input:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]):not([type="submit"]) {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: start;
  appearance: none;
  -webkit-appearance: none;
}
#ex-name::placeholder { color: var(--muted); font-weight: 600; opacity: 1; }
#ex-name:focus,
#ex-pf input:focus {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
  border-color: var(--navy);
}
#ex-pf .ex-chips { margin-top: 0; }
#ex-pf .btn { margin-top: 1.25rem; }
#ex-pf .btn-outline { margin-top: .55rem; }

/* Choice chips (stage / grade / school) */
.ex-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .2rem; }
.ex-chip {
  flex: 1 1 auto;
  min-width: 5.5rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--navy);
  background: var(--card);
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  padding: .4rem .75rem;
}
.ex-chip:hover { background: var(--navy-soft); }
.ex-chip[aria-pressed="true"] {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}
.ex-chip:focus-visible { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
.ex-err { color: var(--red); font-size: .85rem; font-weight: 700; margin: .4rem 0 0; }

/* Profile strip on the subject list */
.ex-profile {
  display: flex;
  align-items: center;
  gap: .6rem;
  justify-content: space-between;
  background: var(--gold-soft);
  border: 1px solid var(--gold-strong);
  border-radius: var(--radius);
  padding: .75rem .95rem;
  margin-bottom: 1rem;
}
.ex-profile b { color: var(--navy); }
.ex-profile small { display: block; color: var(--muted); font-size: .82rem; }
.ex-link {
  background: none; border: 0; color: var(--navy);
  font: inherit; font-weight: 800; cursor: pointer;
  padding: .3rem; text-decoration: underline;
}
.ex-month {
  display: inline-block;
  background: var(--gold-strong);
  color: var(--navy-dark);
  border-radius: 999px;
  padding: .15rem .8rem;
  font-weight: 800;
  font-size: .85rem;
  margin-bottom: .6rem;
}

/* Subject / model list (was leftover bright green) */
.ex-list { display: grid; gap: .65rem; }
.ex-subj {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  width: 100%;
  min-height: 4.15rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--gold-strong);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  padding: .7rem 1rem;
  cursor: pointer;
  text-align: start;
}
.ex-subj:hover { border-color: var(--navy); border-inline-start-color: var(--navy); background: var(--navy-soft); }
.ex-subj small { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; }
.ex-subj.soon { background: var(--bg); border-color: var(--line); border-inline-start-color: var(--line); color: var(--muted); cursor: default; }
.ex-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .78rem;
  font-weight: 800;
  background: var(--navy);
  color: #fff;
}
.ex-subj.soon .ex-badge { background: #c9d0db; color: #fff; }
.ex-badge.ok { background: var(--gold-strong); color: var(--navy-dark); }

/* Question screen */
.ex-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem .75rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
  font-weight: 800;
  color: var(--navy);
  font-size: .95rem;
}
.ex-progress { height: .5rem; border-radius: 999px; background: var(--navy-soft); overflow: hidden; margin-bottom: .7rem; }
.ex-progress i { display: block; height: 100%; background: var(--gold-strong); border-radius: 999px; transition: width .3s; }
.ex-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 0 auto .7rem;
  width: max-content;
  max-width: 100%;
  padding: .35rem 1rem;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-weight: 800;
  font-size: .95rem;
  border: 1px solid #c9d3e3;
}
.ex-timer b { font-size: 1.1rem; min-width: 3.2em; text-align: center; font-variant-numeric: tabular-nums; }
.ex-timer.warn { background: var(--gold-soft); border-color: var(--gold-strong); color: #8a5a00; }
.ex-timer.crit { background: var(--red-soft); border-color: #e89a9a; color: var(--red); animation: exPulse 1s ease-in-out infinite; }
@keyframes exPulse { 50% { transform: scale(1.04); } }
.ex-sec {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  padding: .2rem .8rem;
  font-size: .85rem;
  font-weight: 800;
  margin-bottom: .6rem;
}
.ex-q { font-size: 1.12rem; font-weight: 800; line-height: 1.8; margin: 0 0 .9rem; color: var(--text); }
.ex-opts { display: grid; gap: .55rem; }
.ex-opt {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  min-height: 3.2rem;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  padding: .65rem .85rem;
  text-align: start;
  line-height: 1.6;
}
.ex-opt .ex-l {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--navy-soft);
  font-weight: 800;
  color: var(--navy);
}
.ex-opt:hover { border-color: var(--navy); }
.ex-opt[aria-pressed="true"] { border-color: var(--navy); background: var(--navy-soft); }
.ex-opt[aria-pressed="true"] .ex-l { background: var(--navy); color: #fff; }
.ex-opt.right { border-color: var(--green); background: var(--green-soft); color: var(--green-text); }
.ex-opt.right .ex-l { background: var(--green); color: #fff; }
.ex-opt.wrong { border-color: var(--red); background: var(--red-soft); color: #8a1f11; }
.ex-opt.wrong .ex-l { background: var(--red); color: #fff; }
.ex-opt:disabled { cursor: default; opacity: 1; }
.ex-opt:focus-visible { outline: 3px solid var(--gold-strong); outline-offset: 2px; }
.ex-fb { border-radius: var(--radius); padding: .75rem .9rem; margin-top: .8rem; font-weight: 700; }
.ex-fb.good { background: var(--green-soft); color: var(--green-text); }
.ex-fb.bad { background: var(--red-soft); color: #8a1f11; }
.ex-fb p { margin: .2rem 0 0; font-weight: 600; color: var(--text); }
.ex-src { display: block; margin-top: .3rem; color: var(--muted); font-size: .78rem; font-weight: 600; }

/* Result + review */
.ex-score { text-align: center; }
.ex-ring { --p: 0; width: 9.5rem; height: 9.5rem; margin: .4rem auto .6rem; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold-strong) calc(var(--p)*1%), var(--navy-soft) 0); }
.ex-ring div { width: 7.6rem; height: 7.6rem; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.ex-ring small { display: block; font-size: .85rem; color: var(--muted); }
.ex-score h3 { font-size: 1.35rem; margin: .2rem 0; color: var(--navy); }
.ex-score p { margin: .2rem 0; color: var(--muted); font-weight: 700; }
.ex-timeout { margin: .5rem 0 0; color: var(--red); font-weight: 800; }
.ex-saved { margin: .4rem 0 0; color: var(--muted); font-weight: 700; font-size: .9rem; }
.ex-review { display: grid; gap: .6rem; }
.ex-rv { border-radius: var(--radius); padding: .75rem .9rem; border: 1px solid var(--line); background: var(--card); text-align: start; }
.ex-rv.ok { border-color: #9ccc9f; background: #f6fbf6; }
.ex-rv.no { border-color: #ef9a9a; background: #fff8f7; }
.ex-rv b { display: block; line-height: 1.7; }
.ex-rv .ans { margin: .25rem 0 0; font-size: .92rem; }
.ex-rv .ans span { font-weight: 800; }
.ex-rv .ans .g { color: var(--green-text); }
.ex-rv .ans .r { color: var(--red); }

/* Certificate */
.ex-cert-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
  margin-bottom: 1rem;
  text-align: center;
}
.ex-cert-wrap h3 { margin: .2rem 0 .1rem; color: var(--green-text); font-size: 1.2rem; }
.ex-cert-wrap > p { margin: 0 0 .6rem; color: var(--muted); font-weight: 700; font-size: .9rem; }
.ex-cert-img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fffdf5; -webkit-touch-callout: default; }
.ex-cert-wait { padding: 2.2rem 1rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-weight: 700; }
.ex-cert-img:not([data-ready]) { display: none; }
.ex-cert-more { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.ex-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .8rem; }
.ex-actions .btn { margin-top: 0; }
.ex-small {
  display: block;
  margin: .7rem auto 0;
  color: var(--navy);
  font-weight: 800;
  font-size: .9rem;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  min-height: 44px;
}
.ex-note { font-size: .82rem; color: var(--muted); margin: .5rem 0 0; font-weight: 600; }
.ex-toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border-radius: 8px; padding: .7rem 1rem;
  font-weight: 700; font-size: .92rem;
  max-width: min(92vw, 28rem); text-align: center; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.ex-modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 40; padding: 1rem; }
.ex-modal > div { background: var(--card); border-radius: var(--radius); padding: 1.2rem; max-width: 24rem; width: 100%; text-align: center; border: 1px solid var(--line); }
.ex-modal h3 { margin: 0 0 .4rem; color: var(--navy); }

@media (min-width: 48rem) {
  .ex-body .wrap { max-width: 44rem; }
  .ex-q { font-size: 1.2rem; }
}
.ex-code { direction: ltr; text-align: left; background: #0f2742; color: #e8f1ff; font: 600 .92rem/1.6 ui-monospace, Menlo, Consolas, monospace; padding: .7rem .9rem; border-radius: 8px; margin: 0 0 .9rem; overflow-x: auto; white-space: pre; }
.ex-rv .ex-code { font-size: .8rem; margin: .4rem 0; }
.ex-en .ex-q, .ex-en .ex-opt, .ex-rv[dir=ltr] { font-family: Poppins, Cairo, system-ui, sans-serif; text-align: left; }
.ex-fig { display: block; max-width: 100%; max-height: 260px; margin: 0 auto .9rem; border-radius: 8px; background: #fff; }
.ex-rv .ex-fig { max-height: 180px; margin: .4rem 0; }
@media (prefers-reduced-motion: reduce) { .ex-timer.crit { animation: none; } }

/* Footer + legal links */
.ex-footer { text-align: center; color: var(--muted); font-size: .85rem; font-weight: 600; padding: 1.2rem 1rem .4rem; line-height: 1.8; }
.ex-footer a { color: var(--navy); font-weight: 800; text-decoration: none; }
.ex-legal {
  text-align: center;
  font-size: .85rem;
  margin: 0 0 1.6rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem .9rem;
}
.ex-legal a { color: var(--navy); font-weight: 700; text-decoration: none; }

@media (max-width: 34rem) {
  .ex-header .wrap { flex-wrap: wrap; gap: .45rem .8rem; padding: .6rem .9rem; }
  .ex-brand img { width: 40px; height: 40px; }
  .ex-brand small { display: none; }
  .ex-header nav {
    margin-inline-start: 0; width: 100%; justify-content: space-between; gap: .5rem;
    border-top: 1px solid rgba(255,255,255,.18); padding-top: .45rem;
  }
  .ex-header nav a { font-size: .9rem; }
  .ex-sets { grid-template-columns: 1fr; }
  .ex-chip { min-width: calc(33.33% - .4rem); }
  .ex-actions { grid-template-columns: 1fr; }
}

/* ---------- dark mode (2026-12-05: site default is dark; light via the site settings) ---------- */
html[data-theme="dark"] {
  --navy-soft: #1c2c42;
  --gold-soft: #3a2f14;
  --yellow-soft: #3a2f14;
  --green-soft: #12301f;
  --green-text: #9be3b5;
  --red-soft: #3a1717;
  --text: #ece7d9;
  --ink: #ece7d9;
  --muted: #9aa7b5;
  --paper: #0e1622;
  --bg: #0e1622;
  --card: #16222f;
  --line: #2b3a4a;
  color-scheme: dark;
}
html[data-theme="dark"] .ex-header { background: #0b1320; border-bottom: 1px solid var(--line); }
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .ex-card h3,
html[data-theme="dark"] .ex-profile b,
html[data-theme="dark"] .btn-outline { color: #d8c27a; }
html[data-theme="dark"] .btn-outline { border-color: #d8c27a; }
html[data-theme="dark"] .btn-blue, html[data-theme="dark"] .btn-primary { background: #2c4a73; border-color: #2c4a73; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .ex-opt { background: var(--card) !important; color: var(--ink) !important; }
html[data-theme="dark"] .ex-ring div { background: var(--card); }
html[data-theme="dark"] .ex-rv.ok { background: #12301f; border-color: #2f6b45; }
html[data-theme="dark"] .ex-rv.no { background: #3a1717; border-color: #7a2e2e; }
html[data-theme="dark"] .ex-opt.wrong, html[data-theme="dark"] .ex-fb.bad { color: #ffb4a8 !important; }
html[data-theme="dark"] .ex-subj.soon .ex-badge { background: #3a4656; }
html[data-theme="dark"] a { color: #d8c27a; }
html[data-theme="dark"] .ex-header nav a, html[data-theme="dark"] .ex-brand { color: #fff; }
html[data-theme="dark"] .btn:not(.btn-yellow):not(.btn-outline) { background: #2c4a73; border-color: #2c4a73; color: #fff; }
html[data-theme="dark"] .ex-link { color: #d8c27a; }
html[data-theme="dark"] #ex-pf label { color: #d8c27a; }
html[data-theme="dark"] .ex-timer.warn { color: #f3d27a; }
html[data-theme="dark"] .ex-chip { border-color: #3a4a5c; }
html[data-theme="dark"] .ex-chip[aria-pressed="true"] { background: var(--gold-strong); border-color: var(--gold-strong); color: #12203a; }
html[data-theme="dark"] .ex-err { color: #f87171; }
html[data-theme="dark"] #ex-name:focus, html[data-theme="dark"] #ex-pf input:focus { outline-color: #d8c27a; border-color: #d8c27a; }
html[data-theme="dark"] .ex-top, html[data-theme="dark"] .ex-ring div,
html[data-theme="dark"] .ex-score h3, html[data-theme="dark"] .ex-modal h3, html[data-theme="dark"] .ex-set:not(.on),
html[data-theme="dark"] .ex-timer:not(.warn):not(.crit) { color: #d8c27a; }
html[data-theme="dark"] .ex-timer:not(.warn):not(.crit) { border-color: #3a4a5c; background: var(--card); }
html[data-theme="dark"] .ex-opt:not([aria-pressed="true"]):not(.right):not(.wrong) .ex-l { color: #d8c27a; background: #22324a; }
html[data-theme="dark"] .ex-opt[aria-pressed="true"]:not(.right):not(.wrong) { border-color: var(--gold-strong) !important; background: #2a2a1a !important; }
html[data-theme="dark"] .ex-opt[aria-pressed="true"]:not(.right):not(.wrong) .ex-l { background: var(--gold-strong); color: #12203a; }
html[data-theme="dark"] .ex-opt.right { background: #12301f !important; }
html[data-theme="dark"] .ex-opt.wrong { background: #3a1717 !important; }
html[data-theme="dark"] .ex-badge:not(.ok) { color: #d8c27a; }
html[data-theme="dark"] .ex-month { color: #12203a; }
html[data-theme="dark"] .ex-small { color: #c9b77a; }
