/* Titanium Pharmacy — Exam UI
   Brand: green #8DC53F · charcoal #2E2E2E */

:root {
  --green: #8dc53f;
  --green-d: #6ea62b;
  --green-l: #f2f9e8;
  --ink: #22262a;
  --ink-2: #5c6670;
  --line: #e6e9ec;
  --paper: #f7f8f6;
  --card: #ffffff;
  --ok: #2f7a4f;
  --bad: #c0392b;
  --shadow: 0 10px 30px rgba(34, 38, 42, .07);
  --radius: 18px;
  --font: "Cairo", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-ar: "Cairo", "Segoe UI", system-ui, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* حجم الخط الأساسي — كل المقاسات بالـ rem بتكبر معه */
html { font-size: 17.5px; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 12% -8%, #eaf5da 0%, rgba(234,245,218,0) 62%),
    radial-gradient(760px 420px at 100% 0%, #eef1f4 0%, rgba(238,241,244,0) 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
}

.ar { font-family: var(--font-ar); direction: rtl; }

.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 72px; }

/* ---------- Brand head ---------- */
.brand { text-align: center; margin: 8px 0 26px; }
.brand img { width: 128px; height: auto; display: block; margin: 0 auto 14px; }
.brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
}
.brand .rule {
  width: 54px; height: 3px; border-radius: 3px;
  background: var(--green); margin: 12px auto 10px;
}
.brand p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* أثناء الامتحان: ترويسة مصغّرة لتوفير مساحة الشاشة */
.brand.compact { margin-bottom: 16px; }
.brand.compact img { width: 64px; margin-bottom: 8px; }
.brand.compact h1 { font-size: 1rem; }
.brand.compact .rule { margin: 8px auto 6px; width: 40px; height: 2px; }
.brand.compact p { font-size: .82rem; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px;
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 6px; font-size: 1.2rem; font-weight: 600; }
.card .sub { margin: 0 0 22px; color: var(--ink-2); font-size: .98rem; }

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: .92rem; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 8px;
}
.field .hint-ar { font-family: var(--font-ar); font-size: .94rem; font-weight: 600; color: #7d868e; text-transform: none; letter-spacing: 0; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=number], select {
  width: 100%; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: 1rem; color: var(--ink);
  background: #fcfdfc; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(141, 197, 63, .16);
  background: #fff;
}
.sections { display: flex; gap: 12px; }
.sec-btn {
  flex: 1; padding: 16px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fcfdfc; cursor: pointer; font-family: inherit; text-align: center;
  transition: border-color .15s, background .15s, transform .08s;
}
.sec-btn:hover { border-color: #c9d3bb; background: #fafcf7; }
.sec-btn b { display: block; font-size: 1rem; color: var(--ink); }
.sec-btn span { display: block; font-size: .92rem; color: var(--ink-2); margin-top: 2px; }
.sec-btn.on { border-color: var(--green); background: var(--green-l); }
.sec-btn.on b { color: var(--green-d); }

optgroup { font-weight: 700; color: var(--ink); }
optgroup option { font-weight: 400; }
.pick-note {
  margin: 8px 0 0; font-size: .92rem; color: var(--ink-2);
  min-height: 1.2em; opacity: 0; transition: opacity .15s;
}
.pick-note.on { opacity: 1; color: var(--green-d); font-weight: 600; }

.age-box {
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px;
  background: #f6f8f4; color: var(--ink-2); font-size: 1rem; font-weight: 600;
  transition: color .15s, background .15s, border-color .15s;
}
.age-box.on { color: var(--green-d); background: var(--green-l); border-color: #dcecc4; }

.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 15px 24px; margin-top: 8px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  letter-spacing: .02em; cursor: pointer;
  transition: background .18s, transform .08s, opacity .18s;
}
.btn:hover:not(:disabled) { background: #000; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-green { background: var(--green-d); }
.btn-green:hover:not(:disabled) { background: #5d9021; }
.btn-ghost {
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line); font-weight: 500;
}
.btn-ghost:hover:not(:disabled) { background: #f3f5f2; color: var(--ink); }

.note {
  margin-top: 18px; padding: 12px 14px;
  background: var(--green-l); border: 1px solid #dcecc4;
  border-radius: 12px; font-size: .92rem; color: #4d6b23;
}
.err {
  margin-top: 14px; padding: 12px 14px;
  background: #fdeceb; border: 1px solid #f6cfcb;
  border-radius: 12px; color: #a33327; font-size: .95rem; display: none;
}
.err.show { display: block; }

/* ---------- Exam bar ---------- */
.exam-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(34,38,42,.05);
}
.exam-bar .who { font-weight: 600; font-size: .94rem; }
.exam-bar .who span { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-2); }
.exam-bar .spacer { flex: 1; }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem;
  background: #f1f3f0; border-radius: 10px; padding: 6px 12px;
}
.timer.warn { background: #fdecea; color: var(--bad); }

.track { height: 6px; background: #e8ebe6; border-radius: 6px; overflow: hidden; margin-bottom: 20px; }
.track > div { height: 100%; width: 0; background: var(--green); transition: width .25s ease; }
.count { font-size: .9rem; color: var(--ink-2); margin: -14px 0 18px; text-align: right; }

/* ---------- Questions ---------- */
.q {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 22px 16px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(34,38,42,.04);
}
.q .n {
  display: inline-block; font-size: .8rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--green-d); margin-bottom: 8px;
}
.q .t { font-size: 1.12rem; font-weight: 600; margin: 0 0 16px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; margin-bottom: 9px;
  border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.opt:hover { border-color: #c9d3bb; background: #fafcf7; }
.opt input { margin-top: 4px; accent-color: var(--green-d); flex-shrink: 0; }
.opt.sel { border-color: var(--green); background: var(--green-l); }
.opt { font-size: 1.02rem; }
.opt .k { font-weight: 700; color: var(--ink-2); min-width: 20px; }
.q.unanswered { border-color: #f0c9c4; }

/* ---------- Result ---------- */
.result { text-align: center; }
.score-ring {
  width: 150px; height: 150px; margin: 6px auto 18px;
  border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--green) var(--pct), #eceee9 0);
}
.score-ring.fail { background: conic-gradient(var(--bad) var(--pct), #eceee9 0); }
.score-ring .inner {
  width: 122px; height: 122px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  font-size: 1.9rem; font-weight: 700;
}
.verdict { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px; }
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.meta-line { color: var(--ink-2); font-size: .92rem; }

footer { text-align: center; color: #9aa3ab; font-size: .8rem; margin-top: 28px; }

@media (max-width: 560px) {
  .wrap { padding: 22px 14px 56px; }
  .card { padding: 26px 20px; }
  .row { flex-direction: column; gap: 0; }
  .brand img { width: 104px; }
}