/* sq.css — أنماط صفحات اختبارات الطلاب (sq_list / sq_create / sq_quiz)
   نفس هوية المنصة: Cairo، تركواز/كحلي، RTL، ووضع داكن عبر data-theme="dark". */

:root {
  --ink: #0d1b2a;
  --bg: #f1f4f8;
  --surface: #ffffff;
  --border: rgba(13, 27, 42, .09);
  --txt: #0d1b2a;
  --txt2: #41566b;
  --txt3: #5b6b7b;
  --teal: #0d9488;
  --teal-d: #0f766e;
  --teal-lt: #2dd4bf;
  --blue: #1a73e8;
  --chip: #eaf1f8;
  --amber-bg: #fef3c7;
  --amber-tx: #92400e;
  --star: #d97706;
  --green: #15803d;
  --green-bg: #e8f7ee;
  --red: #c92a37;
  --red-bg: #fdecee;
  --shadow: 0 2px 12px rgba(13, 27, 42, .07);
  --shadow-lg: 0 10px 30px rgba(13, 27, 42, .12);
  --r: 20px;
}
[data-theme="dark"] {
  --bg: #0a1628;
  --surface: #132338;
  --border: rgba(45, 212, 191, .13);
  --txt: #e6f2f1;
  --txt2: #b4cfcc;
  --txt3: #8fb0ad;
  --teal-d: #2dd4bf;
  --blue: #6db3ff;
  --chip: #1b3149;
  --amber-bg: #3b2a07;
  --amber-tx: #fbbf24;
  --star: #fbbf24;
  --green: #4ade80;
  --green-bg: #0f3b2a;
  --red: #ff8a93;
  --red-bg: #3d1519;
  --shadow: none;
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Cairo', 'Tajawal', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--teal-lt); outline-offset: 2px; }

/* ── الهيدر ── */
.sq-hero {
  position: relative;
  padding: 18px 16px 70px;
  color: #fff;
  text-align: center;
  background: radial-gradient(120% 90% at 85% 0%, rgba(13, 148, 136, .6), rgba(13, 27, 42, 0) 60%), linear-gradient(160deg, #0d1b2a, #1e3448);
  border-bottom-left-radius: 44px;
  border-bottom-right-radius: 44px;
}
.sq-hero-bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.sq-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; font-size: .85rem; font-weight: 700; text-decoration: none;
}
.sq-theme {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .12); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.sq-hero h1 { font-size: 1.7rem; font-weight: 900; margin: 14px 0 4px; line-height: 1.35; }
.sq-hero p { font-size: .9rem; opacity: .88; }
.sq-main {
  position: relative; z-index: 2; max-width: 720px; margin: -44px auto 0; padding: 0 16px 120px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── كروت ── */
.card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 16px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--txt2); font-size: .85rem; }
.tiny { color: var(--txt3); font-size: .78rem; }
.h2 { font-size: 1.05rem; font-weight: 900; }

/* ── أزرار ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px;
  font-weight: 800; font-size: .95rem; text-decoration: none; transition: transform .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #2dd4bf, #0d9488); color: #04201d; box-shadow: 0 6px 18px rgba(13, 148, 136, .3); }
.btn-dark { background: var(--ink); color: #fff; }
[data-theme="dark"] .btn-dark { background: #2c4a66; }
.btn-ghost { background: var(--surface); color: var(--txt); border: 1.5px solid var(--border); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .85rem; border-radius: 12px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--txt2); display: inline-flex; align-items: center; justify-content: center;
}
.fab {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 20px; z-index: 50;
  height: 54px; padding: 0 22px; border: 0; border-radius: 18px; display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #2dd4bf, #0d9488); color: #04201d; font-weight: 900; font-size: .95rem;
  text-decoration: none; box-shadow: 0 10px 28px rgba(13, 148, 136, .4);
}

/* ── حقول ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-weight: 800; font-size: .88rem; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--bg); outline: none;
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--teal); }
.input.err, .textarea.err { border-color: var(--red); }
.hint { font-size: .78rem; color: var(--txt3); }

/* ── تبويبات وفلاتر ── */
.seg { display: flex; gap: 6px; background: var(--chip); padding: 4px; border-radius: 16px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent;
  color: var(--txt2); font-weight: 700; font-size: .85rem; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--txt); font-weight: 900; box-shadow: 0 2px 8px rgba(13, 27, 42, .1); }
.search {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 52px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-lg); border: 1.5px solid var(--border); color: var(--txt3);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 48px; color: var(--txt); }

/* ── شارات ── */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 800; background: var(--chip); color: var(--txt2); white-space: nowrap;
}
.chip-approved { background: var(--amber-bg); color: var(--amber-tx); }
.chip-new { background: var(--green-bg); color: var(--green); }
.chip-official { background: var(--ink); color: #fff; }
[data-theme="dark"] .chip-official { background: #2c4a66; }
.chip-done { background: var(--green-bg); color: var(--green); }
.chip-me { background: var(--chip); color: var(--txt2); }
.qc-name { font-weight: 800; color: var(--txt); }
.chip-warn { background: var(--red-bg); color: var(--red); }

/* ── كارت اختبار في القائمة ── */
.qcard {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 12px 14px; text-align: right; width: 100%;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.qcard::before { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 5px; background: var(--acc, var(--teal)); }
.qcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--acc, var(--teal)); }
.qcard:active { transform: scale(.99); }
.acc0 { --acc: #1a73e8; } .acc1 { --acc: #0d9488; } .acc2 { --acc: #e5484d; } .acc3 { --acc: #16a34a; } .acc4 { --acc: #6d5be0; }
.qc-head { display: flex; gap: 12px; align-items: flex-start; }
.qcard .ico { width: 48px; height: 48px; border-radius: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qc-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; min-height: 0; }
.qc-chips:empty { display: none; }
.qcard h3 { font-size: 1rem; font-weight: 900; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qc-by { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--txt2); flex-wrap: wrap; }
.qc-desc { font-size: .8rem; color: var(--txt3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.qc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.qc-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--chip); font-size: .74rem; font-weight: 700; color: var(--txt2); }
.qc-rate { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-size: .85rem; color: var(--star); }
.qc-rate b { color: var(--txt); }
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 900; flex-shrink: 0; line-height: 1; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.has-img { background: var(--chip); }
.qmeta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--txt2); }
.stars-mini { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; color: var(--txt); }
.tone0 { background: #e8f1fe; color: #1a73e8; }
.tone1 { background: #e6f6f4; color: #0f766e; }
.tone2 { background: #fdecee; color: #c92a37; }
.tone3 { background: #e8f7ee; color: #15803d; }
.tone4 { background: #efeafe; color: #5b4bd6; }
[data-theme="dark"] .tone0 { background: #16304f; color: #6db3ff; }
[data-theme="dark"] .tone1 { background: #0f3b36; color: #2dd4bf; }
[data-theme="dark"] .tone2 { background: #3d1519; color: #ff8a93; }
[data-theme="dark"] .tone3 { background: #0f3b2a; color: #4ade80; }
[data-theme="dark"] .tone4 { background: #28225a; color: #b3a8ff; }

/* ── حالات ── */
.empty { text-align: center; padding: 36px 16px; color: var(--txt2); }
.empty svg { margin-bottom: 10px; opacity: .6; }
.skel { border-radius: var(--r); height: 96px; background: linear-gradient(90deg, var(--chip) 25%, var(--surface) 50%, var(--chip) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } * { transition: none !important; } }

/* ── Toast / Sheet ── */
.toast {
  position: fixed; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 200; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: .9rem;
  max-width: 90vw; box-shadow: var(--shadow-lg);
}
.toast.err { background: var(--red); }
.sheet-bg { position: fixed; inset: 0; z-index: 150; background: rgba(5, 12, 22, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 26px 26px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px; max-height: 88dvh; overflow-y: auto;
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--border); align-self: center; }

/* ── نموذج الإنشاء ── */
.qb { border: 1.5px solid var(--border); border-radius: 18px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.qb.err { border-color: var(--red); }
.qb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qb-num { width: 32px; height: 32px; border-radius: 10px; background: var(--chip); color: var(--txt); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.opt { display: flex; align-items: center; gap: 8px; }
.opt .radio { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.opt .radio[aria-checked="true"] { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.tf-row { display: flex; gap: 8px; }
.tf-row button { flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); font-weight: 800; }
.tf-row button[aria-pressed="true"] { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.addbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.addbar button { min-height: 56px; border-radius: 14px; border: 2px dashed var(--border); background: var(--surface); font-weight: 800; font-size: .8rem; color: var(--txt2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.vis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vis button { min-height: 64px; border-radius: 14px; border: 2px solid var(--border); background: var(--bg); padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; }
.vis button[aria-pressed="true"] { border-color: var(--teal); background: var(--chip); }
.vis small { font-weight: 600; color: var(--txt3); font-size: .72rem; }

/* ── حل الاختبار ── */
.sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--surface); border-top: 1.5px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 12px; box-shadow: 0 -6px 20px rgba(13, 27, 42, .08);
}
.sticky-bar .grow { max-width: 720px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 12px; }
.timer { font-weight: 900; font-variant-numeric: tabular-nums; padding: 4px 12px; border-radius: 999px; background: var(--chip); }
.timer.low { background: var(--red-bg); color: var(--red); }
.progress { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #2dd4bf, #0d9488); transition: width .25s; }
.choice {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 14px; text-align: right;
  border-radius: 14px; border: 2px solid var(--border); background: var(--bg); font-weight: 600;
}
.choice[aria-pressed="true"] { border-color: var(--teal); background: var(--chip); font-weight: 800; }
.choice.ok { border-color: var(--green); background: var(--green-bg); }
.choice.bad { border-color: var(--red); background: var(--red-bg); }
.choice .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--txt3); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.choice[aria-pressed="true"] .dot { border-color: var(--teal); background: var(--teal); }
.q-text { font-weight: 800; font-size: 1.02rem; line-height: 1.7; white-space: pre-wrap; }
.expl { background: var(--chip); border-radius: 12px; padding: 10px 12px; font-size: .88rem; color: var(--txt2); }

/* ── صفحة تعريف الاختبار ── */
.info-hero { display: flex; flex-direction: column; gap: 12px; }
.creator-row { display: flex; align-items: center; gap: 10px; }
.creator-row .nm { font-weight: 800; }
.stat-tile { flex: 1; min-width: 0; text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--chip); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-tile .ic { color: var(--teal); display: inline-flex; }
.stat-tile b { font-weight: 900; font-size: 1.15rem; line-height: 1.3; }

/* ── النتيجة ── */
.res-hero { position: relative; overflow: hidden; text-align: center; padding: 22px 16px 18px; border-radius: 26px; color: #fff; box-shadow: var(--shadow-lg);
  background: linear-gradient(160deg, var(--rh1), var(--rh2)); }
.res-hero::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; top: -90px; inset-inline-end: -70px; background: rgba(255, 255, 255, .09); pointer-events: none; }
.res-hero.good { --rh1: #0b5e57; --rh2: #0d9488; }
.res-hero.mid { --rh1: #92400e; --rh2: #d97706; }
.res-hero.low { --rh1: #9b1c2c; --rh2: #d93a4a; }
.res-verdict { font-size: 1.35rem; font-weight: 900; margin-top: 8px; }
.res-sub { font-size: .88rem; opacity: .9; }
.res-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.res-stat { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .2); border-radius: 16px; padding: 10px 4px; display: flex; flex-direction: column; }
.res-stat b { font-size: 1.15rem; font-weight: 900; line-height: 1.3; }
.res-stat span { font-size: .72rem; opacity: .9; }
.score-ring { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring circle.fg { transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); }
.score-ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: 2.1rem; line-height: 1.1; }

/* تقييم الاختبار */
.rate-card { text-align: center; gap: 6px; }
.rate-sub { color: var(--txt2); font-size: .82rem; }
.stars { display: flex; justify-content: center; gap: 2px; margin: 4px 0 0; }
.stars button { width: 52px; height: 52px; border: 0; background: transparent; color: #cdd7e3; display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, color .15s; }
[data-theme="dark"] .stars button { color: #3a5775; }
.stars button:active { transform: scale(.88); }
.stars button[aria-pressed="true"] { color: var(--star); }
.stars button[aria-pressed="true"] svg { filter: drop-shadow(0 3px 6px rgba(217, 119, 6, .35)); }
.rate-label { min-height: 1.8em; font-weight: 900; font-size: 1rem; color: var(--star); }
.appr { margin-top: 6px; padding: 12px 14px; border-radius: 16px; background: var(--chip); text-align: right; display: flex; flex-direction: column; gap: 8px; }
.appr .t { font-size: .8rem; font-weight: 700; color: var(--txt2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.appr.done { background: var(--amber-bg); }
.appr.done .t { color: var(--amber-tx); }

/* ترتيب الطلاب */
.lb-card { gap: 6px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; }
.podium { direction: ltr; display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 26px 4px 0; }
.pod { flex: 1; max-width: 112px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; direction: rtl; position: relative; }
.pod .crown { color: #f5b301; position: absolute; top: -26px; filter: drop-shadow(0 2px 4px rgba(245, 179, 1, .5)); }
.pod .av { border: 3px solid var(--medal); }
.pod.p1 .av { width: 60px !important; height: 60px !important; font-size: 25px !important; }
.pod.me .av { box-shadow: 0 0 0 3px var(--teal-lt); }
.pod .pname { font-weight: 800; font-size: .8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pscore { font-weight: 900; font-size: .85rem; }
.pod .ptime { font-size: .68rem; color: var(--txt3); }
.pod .block { width: 100%; margin-top: 4px; border-radius: 14px 14px 0 0; background: linear-gradient(var(--medal), var(--medal-d)); height: var(--h);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; color: #fff; font-weight: 900; font-size: 1.35rem; transform-origin: bottom; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.pod.p1 { --medal: #f5b301; --medal-d: #d98e04; --h: 88px; }
.pod.p2 { --medal: #9aa8b8; --medal-d: #76869a; --h: 64px; }
.pod.p3 { --medal: #cd7f32; --medal-d: #a5612a; --h: 48px; }
.pod.p2 .block { animation-delay: .12s; } .pod.p3 .block { animation-delay: .22s; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.lb-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; }
.lb-row .lb-rank { width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .8rem; }
.lb-row .nm { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-weight: 900; }
.lb-row .tm { font-size: .72rem; color: var(--txt3); display: inline-flex; align-items: center; gap: 3px; min-width: 46px; justify-content: flex-end; }
.lb-row.me { background: linear-gradient(270deg, rgba(13, 148, 136, .16), transparent); box-shadow: inset 0 0 0 1.5px var(--teal); }
.lb-gap { text-align: center; color: var(--txt3); letter-spacing: .3em; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .pod .block, .score-ring circle.fg { animation: none; transition: none; } }
.banner { padding: 12px 14px; border-radius: 14px; font-weight: 700; font-size: .88rem; }
.banner.warn { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--chip); color: var(--txt2); }
.code-box { font-family: ui-monospace, monospace; letter-spacing: .25em; font-weight: 900; font-size: 1.3rem; text-align: center; padding: 10px; border-radius: 12px; background: var(--chip); direction: ltr; user-select: all; }

@media (min-width: 720px) { .sq-hero h1 { font-size: 2rem; } }


/* ═════ المراحل 2–4: مقالي / مطابقة / تصحيح / ترتيب ═════ */
.pair { display: flex; align-items: center; gap: 6px; }
.pair .input { flex: 1; min-width: 0; }
.pair-arrow { color: var(--txt3); flex: none; }
.review-row { display: flex; align-items: center; gap: 10px; }
.addbar + .tiny, .tiny + .addbar { margin-top: -2px; }

/* حل: مقالي + مطابقة */
.q-area { min-height: 120px; resize: vertical; }
.cnt { align-self: flex-end; font-size: .72rem; color: var(--txt3); }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
.match-row .lbox { padding: 12px 14px; border-radius: 14px; background: var(--chip); font-weight: 600; font-size: .92rem; }
.match-row select { width: 100%; }

/* حالة "قيد التصحيح" */
.pending-hero { text-align: center; padding: 26px 18px; border-radius: var(--r); background: linear-gradient(135deg, var(--teal-d), var(--teal)); color: #fff; box-shadow: var(--shadow-lg); }
.pending-hero .spin { display: inline-flex; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.18); align-items: center; justify-content: center; margin-bottom: 10px; }
.pending-hero .spin svg { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .pending-hero .spin svg { animation: none; } }
.pending-hero h2 { margin: 4px 0; font-size: 1.15rem; }
.pending-hero p { margin: 0; opacity: .92; font-size: .88rem; line-height: 1.7; }
.fb-note { font-size: .82rem; line-height: 1.7; padding: 10px 12px; border-radius: 12px; background: var(--chip); color: var(--txt2); }
.fb-open { display: flex; flex-direction: column; gap: 8px; }
.fb-box { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-size: .92rem; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.fb-box.mine { background: var(--chip); }
.fb-box.model { background: var(--green-bg); border-color: transparent; color: var(--green); }
.fb-box small { display: block; font-size: .72rem; opacity: .75; margin-bottom: 2px; font-weight: 700; }
.pair-fb { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: .88rem; }
.pair-fb .p { padding: 9px 12px; border-radius: 12px; background: var(--chip); }
.pair-fb .p.ok { background: var(--green-bg); color: var(--green); }
.pair-fb .p.bad { background: var(--red-bg); color: var(--red); }
.ai-note { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--txt3); line-height: 1.7; }

/* منشئ الاختبار: لوحة تصحيح */
.grade-alert { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--amber-bg); color: var(--amber-tx); font-weight: 700; text-decoration: none; }
.grade-alert .grow { line-height: 1.5; }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: inherit; }
.sub-row .grow { min-width: 0; }
.sub-row .nm { font-weight: 700; font-size: .95rem; }
.sub-row.need { border-color: var(--amber-tx); box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber-tx) 18%, transparent); }
.g-item { display: flex; flex-direction: column; gap: 10px; }
.g-pts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.g-pts .input { width: 84px; text-align: center; }
.g-pts .quick { display: flex; gap: 6px; flex-wrap: wrap; }
.g-pts .quick button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--chip); color: var(--txt); font-weight: 700; cursor: pointer; }
.g-pts .quick button[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: transparent; }

/* ترتيب */
.rk-tabs { display: flex; flex-direction: column; gap: 10px; }
.me-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: linear-gradient(135deg, var(--teal-d), var(--teal)); color: #fff; box-shadow: var(--shadow-lg); }
.me-card b { font-size: 1.5rem; }
.me-card .tiny { color: rgba(255,255,255,.85); }
.rk-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.rk-row.me { border-color: var(--teal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 20%, transparent); }
.rk-row .rank { width: 28px; text-align: center; font-weight: 800; color: var(--txt3); }
.rk-row .nm { font-weight: 700; font-size: .95rem; }
.rk-row .pts { font-weight: 800; color: var(--teal-d); white-space: nowrap; }

/* نتايجي */
.sum-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sum-grid .stat-tile { align-items: center; }

/* لوحة المشرف: بلاغات */
.mod-card { display: flex; flex-direction: column; gap: 10px; }
.rep-item { font-size: .85rem; padding: 8px 10px; border-radius: 10px; background: var(--chip); line-height: 1.7; }

/* ── إنشاء اختبار: الخطوات + اختيارات كبيرة ── */
.step-h { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.step-h .step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 900; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-h .h2 { flex: 1; }
.step-h .step-sub { font-size: .76rem; color: var(--txt3); font-weight: 600; }
.opt-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt-card { position: relative; min-height: 132px; padding: 14px 12px; border-radius: 18px; border: 2px solid var(--border); background: var(--bg); color: var(--txt);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; text-align: center; font-family: inherit; transition: border-color .15s, background .15s, transform .12s; }
.opt-card:active { transform: scale(.98); }
.opt-card[aria-pressed="true"] { border-color: var(--teal); background: var(--chip); box-shadow: 0 0 0 3px rgba(13, 148, 136, .14); }
.opt-card:disabled { opacity: .55; }
.opt-card .oc-ico { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--teal-lt), var(--teal)); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.opt-card .oc-t { font-weight: 900; font-size: .95rem; line-height: 1.3; }
.opt-card .oc-s { font-size: .74rem; font-weight: 600; color: var(--txt3); line-height: 1.5; }
.opt-card .oc-badge { position: absolute; top: 8px; left: 8px; background: var(--green-bg); color: var(--green); font-size: .62rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; }
.type-group-t { font-size: .78rem; font-weight: 800; color: var(--txt2); margin-top: 4px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-tile { min-height: 60px; padding: 10px; border-radius: 14px; border: 2px dashed var(--border); background: var(--surface); color: var(--txt); display: flex; align-items: center; gap: 10px; text-align: right; font-family: inherit; }
.type-tile:active { transform: scale(.98); }
.type-tile .tt-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--chip); color: var(--teal-d); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.type-tile b { display: block; font-size: .84rem; font-weight: 900; }
.type-tile small { display: block; font-size: .68rem; font-weight: 600; color: var(--txt3); line-height: 1.4; }
.q-count-chip { font-size: .78rem; font-weight: 800; background: var(--chip); color: var(--txt2); padding: 3px 10px; border-radius: 999px; }
@media (max-width: 380px) { .opt-cards, .type-grid { grid-template-columns: 1fr; } .opt-card { min-height: 0; } }
