/* تحدّي القدرات — تحدٍّ ومعرفة – مبادرة تعليمية مجانية */

:root {
  --green-900: #0f3a2b;
  --green-800: #154d39;
  --green-700: #1f6b4f;
  --green-600: #278059;
  --green-200: #cfe5d8;
  --green-100: #e6f2ea;
  --cream: #fbf6ea;
  --cream-2: #f4ecd8;
  --cream-3: #e9dcbc;
  --paper: #fffdf7;
  --ink: #1b2a23;
  --muted: #56675e;
  --line: #ded3b8;
  --team-0: #c4532f;
  --team-0-dark: #9c3c1d;
  --team-0-soft: #fbe3d8;
  --team-1: #2c6394;
  --team-1-dark: #1d4a73;
  --team-1-soft: #dce8f4;
  --team-2: #7a3f9e;
  /* لون الفريق الحالي (يُستبدل لكل عنصر فريق من الواجهة) */
  --tc: var(--team-0);
  --tc-dark: var(--team-0-dark);
  --tc-soft: var(--team-0-soft);
  --gold: #d99a14;
  --gold-soft: #fbefcf;
  --ok: #1f7a4a;
  --ok-soft: #dcf1e3;
  --bad: #b3261e;
  --bad-soft: #fbe4e1;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 0 rgba(15, 58, 43, .06), 0 8px 24px rgba(15, 58, 43, .08);
  --font: system-ui, -apple-system, 'SF Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'DejaVu Sans', sans-serif;
  --tap: 56px;
  /* الأرقام الكبيرة بخط النظام: صفر Tajawal العربي معيّن الشكل ويصعب تمييزه بالأحجام الكبيرة */
  --font-num: -apple-system, 'SF Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'DejaVu Sans', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
body.has-modal { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: not-allowed; }
img, svg { display: block; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }
.noscript { padding: 24px; text-align: center; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.3; margin: 0; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 20px;
  border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; font-size: 18px; line-height: 1.2;
  background: var(--paper); color: var(--green-800);
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; }
.btn-lg { min-height: var(--tap); padding: 10px 28px; font-size: 20px; }
.btn-sm { min-height: 40px; padding: 4px 14px; font-size: 16px; }
.btn-primary { background: var(--green-700); color: #fff; box-shadow: 0 3px 0 var(--green-900); }
.btn-primary:hover:not(:disabled) { background: var(--green-600); }
.btn-secondary { background: var(--green-100); color: var(--green-800); border-color: var(--green-200); }
.btn-ghost { background: transparent; color: var(--green-800); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--cream-2); }
.btn-accent { background: var(--gold); color: #2b1d00; box-shadow: 0 3px 0 #a77408; }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 3px 0 #7d1a14; }
.btn.danger, .tool-btn.danger { color: var(--bad); }

.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line); background: var(--paper); color: var(--green-800);
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn[aria-pressed="true"] { background: var(--cream-2); }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px; padding: 6px 14px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--paper); color: var(--green-800); font-weight: 700; font-size: 16px;
}
.tool-btn svg { width: 20px; height: 20px; }
.tool-btn:disabled { opacity: .4; }

/* ---------- عام ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.bar h1 { font-size: 24px; color: var(--green-800); text-align: center; }
.bar > :first-child { justify-self: start; }
.bar > :last-child { justify-self: end; }
.bar-tools { display: flex; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 10px; }
.brand b { display: block; font-size: 20px; color: var(--green-800); line-height: 1.1; }
.brand small { color: var(--muted); font-size: 14px; }
.brand.small b { font-size: 18px; }
.eyebrow { margin: 0; color: var(--green-700); font-weight: 800; letter-spacing: 0; font-size: 18px; }
.hint { color: var(--muted); font-size: 16px; margin: 6px 0; }
.note { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--cream-2); margin: 12px 0; font-size: 17px; }
.note.ok { background: var(--ok-soft); color: #14532f; }
.note.bad { background: var(--bad-soft); color: #7d1a14; }
.warn { color: var(--bad); }
.tag {
  display: inline-flex; align-items: center; padding: 2px 12px; border-radius: 999px;
  background: var(--green-100); color: var(--green-800); font-weight: 700; font-size: 15px; white-space: nowrap;
}
.tag.soft { background: var(--cream-2); color: var(--muted); }
.tag.domain-verbal { background: #efe4fb; color: #50307a; }
.tag.domain-quant { background: #ddeefa; color: #1d4a73; }
.tag.domain-logic { background: #ede1f6; color: #5b2c78; }
.tag.enrich { background: var(--gold-soft); color: #6b4a00; }
.tag.exit { background: var(--gold-soft); color: #6b4a00; }
.dot {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; color: #fff; font-weight: 800; font-size: 16px;
}
/* كل عنصر خاص بفريق يحمل الصنف tm والمتغيرات --tc و--tc-dark و--tc-soft بحسب لون الفريق */
.tm .dot, .dot.tm { background: var(--tc); }
.tm-text { color: var(--tc-dark); }

/* ---------- الرئيسية ---------- */
.home { background: radial-gradient(1200px 500px at 80% -10%, var(--green-100), transparent 70%), var(--cream); }
.home-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; }
.home-tools { display: flex; gap: 8px; }
.hero {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center;
  padding: 16px clamp(16px, 5vw, 64px) 32px; max-width: 1280px; margin: 0 auto; width: 100%;
}
.hero-text h1 { font-size: clamp(40px, 6vw, 72px); color: var(--green-900); font-weight: 800; margin: 4px 0 12px; }
.lead { font-size: clamp(19px, 2vw, 23px); color: var(--muted); margin: 0 0 24px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-art { position: relative; aspect-ratio: 4 / 3; border-radius: 28px; overflow: hidden; background: linear-gradient(#f9f3e3, #f1e6c9); box-shadow: var(--shadow); order: 2; }
.hero-art .mountain-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-flag { position: absolute; top: 6%; left: 34%; width: 4px; height: 13%; background: var(--green-900); }
.hero-flag::after { content: ''; position: absolute; top: 0; left: 4px; width: 34px; height: 22px; background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.hero-dot { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.hero-dot.team-0 { background: var(--team-0); right: 22%; bottom: 18%; animation: bob 3s ease-in-out infinite; }
.hero-dot.team-1 { background: var(--team-1); right: 40%; bottom: 30%; animation: bob 3s ease-in-out .8s infinite; }
.hero-dot.team-2 { background: var(--team-2); right: 30%; bottom: 46%; animation: bob 3s ease-in-out 1.6s infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.resume-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--paper); border: 2px solid var(--green-200);
}
.resume-card p { margin: 4px 0 0; color: var(--muted); font-size: 17px; }
.home-foot { text-align: center; padding: 16px 24px 24px; color: var(--muted); font-size: 16px; }
.home-foot p { margin: 4px 0; }
.home-foot .stats-note { font-size: 14px; }

/* ---------- الإعداد ---------- */
.setup-main { width: 100%; max-width: 980px; margin: 0 auto; padding: 24px 16px 40px; }
.stepper { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 20px; }
.stepper li {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--paper); border: 2px solid var(--line); color: var(--muted); font-weight: 700;
}
.stepper li span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--cream-2); flex: none; }
.stepper li.current { border-color: var(--green-700); color: var(--green-800); }
.stepper li.current span { background: var(--green-700); color: #fff; }
.stepper li.done span { background: var(--green-200); color: var(--green-800); }
.setup-card { background: var(--paper); border-radius: 24px; padding: clamp(18px, 3vw, 32px); box-shadow: var(--shadow); }
.setup-card h2 { font-size: 28px; color: var(--green-900); margin-bottom: 18px; }
.names-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.name-field { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--radius); font-weight: 700; }
.name-field.tm { background: var(--tc-soft); color: var(--tc-dark); }
.names-grid.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.names-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.name-field label { font-weight: 700; }
.seg.team-count { margin-bottom: 22px; }
.seg.team-count button { min-height: 56px; padding: 8px 28px; font-size: 20px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.12); padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.swatch.on::after { content: '✓'; color: #fff; font-weight: 800; font-size: 20px; }
/* يسمح لحقول الأسماء بالانكماش في الشاشات الضيقة (٣٢٠px): لحقل الإدخال عرض أدنى افتراضي يدفع الصفحة خارج الشاشة */
.names-grid > .name-field { min-width: 0; }
.name-field input { width: 100%; min-width: 0; min-height: 60px; font-size: 24px; padding: 8px 16px; border-radius: var(--radius-sm); border: 2px solid transparent; background: #fff; color: var(--ink); }
.name-field input:focus { border-color: currentColor; outline: none; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
/* أربع بطاقات تدريب (لفظي، كمي، تفكير منطقي، مختلط) */
.option-grid:not(.counts) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .option-grid:not(.counts) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .option-grid:not(.counts) { grid-template-columns: 1fr; } }
.option-card { position: relative; }
.option-card.enrich { border-style: dashed; }
.enrich-badge { position: absolute; top: 10px; inset-inline-end: 10px; font-style: normal; font-size: 13px; font-weight: 700; background: var(--gold-soft); color: #6b4a00; border-radius: 999px; padding: 1px 10px; }
.mix-logic { margin-top: 14px; padding: 8px 14px; border-radius: var(--radius-sm); background: #f6effb; }
.option-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start;
  min-height: 150px; padding: 20px; border-radius: var(--radius);
  border: 3px solid var(--line); background: var(--cream); transition: border-color .15s, background-color .15s;
}
.option-card b { font-size: 30px; color: var(--green-900); }
.option-card span { color: var(--muted); font-size: 17px; }
.option-card small { margin-top: auto; color: var(--green-700); font-weight: 700; font-size: 16px; }
.option-card.selected { border-color: var(--green-700); background: var(--green-100); box-shadow: inset 0 0 0 2px var(--green-700); }
.option-card:disabled { opacity: .5; }
.option-card.count { align-items: center; justify-content: center; text-align: center; min-height: 130px; }
.option-card.count b { font-size: 56px; line-height: 1; }
.timer-defaults { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.stepper-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--cream); font-weight: 700; flex-wrap: wrap; }
.stepper-ctl { display: flex; align-items: center; gap: 8px; }
.stepper-ctl .btn { width: 48px; padding: 0; font-size: 26px; }
.stepper-ctl output { min-width: 70px; text-align: center; font-size: 20px; }
.summary-box { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--green-100); color: var(--green-900); font-size: 19px; }
.setup-nav { display: flex; justify-content: space-between; margin-top: 20px; }

/* ---------- اللعب ---------- */
.game { background: var(--cream); }
.game-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.round-pill { padding: 6px 20px; border-radius: 999px; background: var(--green-800); color: #fff; font-size: 20px; }
.round-pill b { font-size: 26px; margin: 0 4px; }
.game-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-grid {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) clamp(270px, 25vw, 380px); gap: 16px;
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  align-items: start;
}
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.qcard { background: var(--paper); border-radius: 24px; padding: clamp(16px, 2.2vw, 28px); box-shadow: var(--shadow); }
.qmeta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.passage { background: var(--cream); border-inline-start: 6px solid var(--green-600); border-radius: var(--radius-sm); padding: 12px 18px; margin-bottom: 12px; }
.passage-label { display: block; color: var(--green-700); font-weight: 700; font-size: 16px; }
.passage p { margin: 4px 0 0; font-size: clamp(19px, 1.7vw, 26px); line-height: 1.8; }
.qprompt { margin: 0 0 4px; color: var(--muted); font-size: clamp(17px, 1.4vw, 21px); }
.stem { font-size: clamp(24px, 2.4vw, 38px); font-weight: 800; color: var(--green-900); margin: 4px 0 14px; line-height: 1.5; }
.stem.analogy { font-size: clamp(32px, 3.4vw, 54px); text-align: center; padding: 8px; background: var(--green-100); border-radius: var(--radius); word-spacing: .2em; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.compare div { background: var(--cream); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.compare span { display: block; color: var(--muted); font-weight: 700; font-size: 16px; }
.compare b { font-size: clamp(24px, 2.4vw, 38px); color: var(--green-900); }
.choices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 72px;
  padding: 10px 16px; border-radius: var(--radius); background: var(--cream); border: 3px solid var(--line);
  font-size: clamp(20px, 2vw, 32px); font-weight: 700; transition: background-color .3s, border-color .3s;
}
.choice .letter {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%;
  background: var(--green-800); color: #fff; font-size: 26px; font-weight: 800;
}
.choice .ctext { flex: 1; min-width: 0; }
.choice .marks { display: flex; gap: 4px; }
.choice .mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 18px; font-weight: 800; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.choice .mark.tm { background: var(--tc); }
.choice.correct { background: var(--ok-soft); border-color: var(--ok); animation: pop .5s ease; }
.choice.correct .letter { background: var(--ok); }
.choice.wrong { background: var(--bad-soft); border-color: #e3a49e; }
.choice .check { font-size: 34px; color: var(--ok); font-weight: 800; }
@keyframes pop { 40% { transform: scale(1.03); } }

/* الخطأ السياقي: الكلمات المحددة مسطّرة */
.stem u.ce, .b-stem u.ce { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; text-decoration-color: var(--green-600); }
/* جدول بيانات السؤال */
.qtable-wrap { overflow-x: auto; margin: 6px 0 12px; }
.qtable { border-collapse: collapse; min-width: 60%; margin: 0 auto; font-size: clamp(18px, 1.7vw, 26px); }
.qtable caption { font-weight: 700; color: var(--green-800); padding-bottom: 6px; font-size: .85em; }
.qtable th, .qtable td { border: 2px solid var(--line); padding: 6px 18px; text-align: center; }
.qtable thead th { background: var(--green-100); color: var(--green-900); }
.qtable tbody tr:nth-child(even) td { background: var(--cream); }
.b-stem + .qtable-wrap, .bank-item .qtable { font-size: 16px; }
/* أسباب البدائل */
.rationales { margin-top: 10px; background: var(--cream); border-radius: var(--radius-sm); padding: 8px 14px; }
.rationales summary { cursor: pointer; font-weight: 700; color: var(--green-800); min-height: 40px; display: flex; align-items: center; }
.rationales ul { margin: 4px 0; padding-inline-start: 18px; font-size: 17px; }
.rationales li { margin: 3px 0; }
.rationales li.right { color: var(--ok); font-weight: 700; }

/* لوحة التحكم أسفل السؤال */
.dock { background: var(--paper); border-radius: 24px; padding: 16px clamp(14px, 2vw, 24px); box-shadow: var(--shadow); border: 2px solid transparent; }
.dock-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.dock-actions .btn:last-child { margin-inline-start: auto; }
.seg { display: inline-flex; background: var(--cream-2); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 10px; }
.seg button { min-height: 48px; padding: 6px 20px; border-radius: 999px; border: 0; background: transparent; font-weight: 700; font-size: 18px; color: var(--muted); }
.seg button.on { background: var(--green-700); color: #fff; }
.timer-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.timer-face { display: flex; flex-direction: column; align-items: center; padding: 6px 24px; border-radius: var(--radius); background: var(--green-900); color: #fff; min-width: 230px; }
.timer-face span, .score-card .sc, .result-card .big, .score-row .pts, .scored b, .float-points, .round-pill b, .stat b, .option-card.count b { font-family: var(--font-num); }
.timer-face span { font-size: clamp(56px, 6vw, 88px); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.timer-face small { font-size: 15px; opacity: .85; text-align: center; max-width: 260px; }
.timer-face.low { background: #8a5a00; }
.timer-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1; }
.duration-adj { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; }
.duration-adj .btn { width: 48px; padding: 0; font-size: 24px; }
.dock-timer.expired { border-color: var(--bad); }
.dock-timer.expired .timer-face { background: var(--bad); animation: flash 1s ease-in-out 4; }
.time-up { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 12px 18px; border-radius: var(--radius-sm); background: var(--bad-soft); color: #7d1a14; font-size: 22px; }
@keyframes flash { 50% { opacity: .55; } }

.reminder { padding: 12px 18px; border-radius: var(--radius-sm); background: var(--gold-soft); color: #5a3d00; font-size: 19px; border-inline-start: 6px solid var(--gold); }
.reminder.soft { margin-top: 10px; font-size: 17px; }
.answer-grid { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.team-answer { padding: 12px; border-radius: var(--radius); }
.team-answer.tm { background: var(--tc-soft); }
.team-answer h3 { display: flex; align-items: center; gap: 8px; font-size: 22px; margin-bottom: 10px; }
.team-answer.tm h3 { color: var(--tc-dark); }
.ans-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ans { min-height: 64px; border-radius: var(--radius-sm); border: 3px solid rgba(0,0,0,.08); background: #fff; font-size: 30px; font-weight: 800; color: var(--ink); }
.ans.none { grid-column: 1 / -1; min-height: 48px; font-size: 17px; font-weight: 700; color: var(--muted); }
.tm .ans.selected { background: var(--tc); border-color: var(--tc-dark); color: #fff; }

.explain-order { font-size: clamp(22px, 2vw, 30px); font-weight: 700; color: var(--green-900); }
.explain-order .mic { margin-inline-end: 6px; }
.explain-toggles { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.toggle {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 16px; text-align: start;
  border-radius: var(--radius-sm); border: 3px solid var(--line); background: #fff; font-size: 18px; font-weight: 700;
}
.toggle small { color: var(--muted); font-weight: 400; }
.toggle .box { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; border: 3px solid var(--line); background: #fff; font-size: 20px; color: #fff; }
.toggle.tm { background: var(--tc-soft); }
.toggle.on { border-color: var(--ok); }
.toggle.on .box { background: var(--ok); border-color: var(--ok); }
.toggle:disabled { opacity: .45; }

.solution h3 { font-size: clamp(22px, 2vw, 30px); color: var(--ok); }
.solution p { margin: 6px 0 0; font-size: clamp(18px, 1.6vw, 24px); }
.solution.compact h3 { font-size: 20px; }
.solution.compact p { font-size: 17px; color: var(--muted); }
.criterion { margin-top: 12px; padding: 12px 18px; border-radius: var(--radius-sm); background: var(--green-100); border-inline-start: 6px solid var(--green-700); }
.criterion h4 { font-size: 18px; color: var(--green-800); }
.criterion p { margin: 4px 0 0; font-size: clamp(18px, 1.5vw, 22px); }
.score-rows { display: grid; gap: 10px; margin-top: 12px; }
.score-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px 14px; padding: 10px 14px; border-radius: var(--radius-sm); }
.score-row.tm { background: var(--tc-soft); }
.score-row .who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 20px; }
.score-row .why { grid-column: 1 / -1; color: var(--muted); font-size: 15px; }
.score-row .pts { font-size: 32px; min-width: 64px; text-align: center; }
.score-row .toggle { min-height: 52px; font-size: 17px; }
.verdict { font-size: 16px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.no { background: var(--bad-soft); color: var(--bad); }
.scored-summary { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.scored { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 700; font-size: 20px; }
.scored.tm { background: var(--tc-soft); color: var(--tc-dark); }
.scored b { font-size: 36px; }

/* لوحة القمة */
.summit-panel {
  position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px;
  height: calc(100vh - 100px); height: calc(100dvh - 100px); min-height: 480px;
}
.score-cards { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 10px; }
.score-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 6px; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); min-width: 0; }
.score-card.tm { background: var(--tc); }
.score-card .dot { background: rgba(255,255,255,.25) !important; }
.score-card .nm { font-weight: 700; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.score-card .sc { font-size: clamp(40px, 4vw, 60px); line-height: 1.05; font-weight: 800; }
.score-card small { opacity: .9; font-size: 14px; }
.float-points { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-size: 36px; font-weight: 800; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.25); animation: floatUp 1.6s ease-out forwards; pointer-events: none; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.mountain { position: relative; flex: 1; min-height: 300px; border-radius: 24px; overflow: hidden; background: linear-gradient(#f9f3e3 0%, #f1e6c9 100%); box-shadow: var(--shadow); }
.mountain .mountain-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.summit-flag { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; z-index: 2; }
.summit-flag .pole { width: 4px; height: 34px; background: var(--green-900); position: relative; }
.summit-flag .cloth { position: absolute; top: 0; left: calc(50% + 2px); width: 30px; height: 20px; background: var(--gold); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.summit-flag b { font-size: 16px; color: var(--green-900); background: rgba(255,253,247,.85); padding: 0 10px; border-radius: 999px; }
.lanes { position: absolute; top: 76px; bottom: 66px; inset-inline: 0; display: flex; justify-content: space-around; }
.lane { position: relative; width: 60px; }
.track { position: absolute; top: 0; bottom: 0; left: 50%; width: 10px; margin-left: -5px; border-radius: 999px; background: repeating-linear-gradient(to top, rgba(15,58,43,.25) 0 10px, transparent 10px 20px); }
.lane.tm .track { background: repeating-linear-gradient(to top, var(--tc) 0 10px, transparent 10px 20px); opacity: .5; }
.token {
  position: absolute; left: 50%; width: 54px; height: 54px; margin-left: -27px; margin-bottom: -27px;
  display: grid; place-items: center; border-radius: 50%; border: 4px solid #fff; color: #fff; font-size: 24px; font-weight: 800;
  box-shadow: 0 4px 10px rgba(0,0,0,.25); transition: bottom 1.1s cubic-bezier(.34, 1.3, .64, 1); z-index: 3;
}
.token.tm { background: var(--tc); }
.token.moving { animation: hop 1.1s ease; }
@keyframes hop { 30% { transform: scale(1.2); } 60% { transform: scale(.95); } }
.basecamp { position: absolute; bottom: 8px; inset-inline: 0; text-align: center; font-weight: 700; color: var(--green-900); font-size: 15px; }
.summit-note { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }

/* ---------- النتيجة ---------- */
.results-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.winner-banner { text-align: center; padding: 24px; border-radius: 28px; background: linear-gradient(135deg, var(--green-800), var(--green-600)); color: #fff; box-shadow: var(--shadow); }
.winner-banner .eyebrow { color: var(--gold-soft); }
.winner-banner h2 { font-size: clamp(36px, 5vw, 60px); font-weight: 800; margin: 4px 0; }
.winner-banner p { margin: 0; opacity: .92; font-size: 19px; }
.result-cards { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 16px; }
.result-card { position: relative; padding: 20px; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); border: 3px solid transparent; text-align: center; }
.result-card.tm { border-color: var(--tc-soft); }
.result-card.tm.winner { border-color: var(--tc); }
.result-card h3 { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 26px; }
.result-card .big { display: block; font-size: 72px; line-height: 1.1; font-weight: 800; }
.result-card.tm .big { color: var(--tc); }
.result-card .unit { color: var(--muted); }
.result-card ul { list-style: none; padding: 0; margin: 12px 0 0; font-size: 18px; }
.crown { position: absolute; top: -18px; inset-inline-start: 18px; font-size: 40px; }
.panel { background: var(--paper); border-radius: 24px; padding: 18px 22px; box-shadow: var(--shadow); }
.panel > h3 { font-size: 24px; color: var(--green-900); margin-bottom: 8px; }
.weak-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.weak-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--cream); font-size: 19px; }
.qcard.exit { box-shadow: none; border: 2px dashed var(--line); margin-top: 8px; }
.exit-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.disclaimer { text-align: center; color: var(--muted); font-size: 16px; margin: 0; }
.results-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ---------- البنك ---------- */
.bank-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.banner { padding: 14px 18px; border-radius: var(--radius); background: var(--gold-soft); border: 2px solid #efd28a; color: #4d3400; }
.warn-inline { display: block; margin-top: 4px; color: var(--bad); font-weight: 700; }
.bank-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 12px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; color: var(--green-800); }
.stat span { color: var(--muted); font-size: 15px; }
.bank-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 4px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 700; font-size: 16px; color: var(--muted); }
.chip.on { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.search { flex: 1; min-width: 220px; min-height: 48px; padding: 6px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; }
.bank-item { background: var(--paper); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow); border: 2px solid transparent; }
.bank-item.invalid { border-color: var(--bad); }
.bank-item header { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qid { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--muted); }
.status { margin-inline-start: auto; padding: 2px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.status.draft { background: var(--cream-2); color: #6b5a2e; }
.status.reviewed { background: var(--ok-soft); color: var(--ok); }
.b-passage { background: var(--cream); padding: 8px 12px; border-radius: 10px; margin: 8px 0 0; font-size: 16px; }
.b-stem { font-weight: 700; font-size: 19px; margin: 8px 0 4px; }
.b-compare { margin: 4px 0; }
.b-choices { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 17px; }
.b-choices span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cream-2); font-weight: 700; font-size: 14px; }
.b-choices li.right { color: var(--ok); font-weight: 700; }
.b-choices li.right span { background: var(--ok); color: #fff; }
.bank-item details { margin-top: 6px; font-size: 16px; }
.bank-item summary { cursor: pointer; color: var(--green-700); font-weight: 700; min-height: 36px; display: flex; align-items: center; }
.bank-item details p { margin: 4px 0; }
.bank-item footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- النوافذ ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 30, 24, .5); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--paper); border-radius: 24px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .2s ease; -webkit-overflow-scrolling: touch; }
.modal.wide { max-width: 860px; }
.modal h2 { font-size: 26px; color: var(--green-900); margin-bottom: 10px; }
.modal-body p { margin: 6px 0; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.help ol { padding-inline-start: 24px; margin: 0; }
.help li { margin-bottom: 6px; }
.editor { display: grid; gap: 12px; }
.editor label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 16px; color: var(--green-800); }
.editor input:not([type="radio"]):not([type="checkbox"]), .editor select, .editor textarea, textarea.code, .modal input[type="file"] {
  width: 100%; min-height: 48px; padding: 8px 12px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: #fff; font-weight: 400; font-size: 18px; color: var(--ink);
}
.editor textarea, textarea.code { resize: vertical; line-height: 1.6; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 14px; direction: ltr; text-align: left; margin-top: 8px; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-line { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; }
.check-line input { width: 24px; height: 24px; accent-color: var(--green-700); flex: none; }
.check-line.big { font-size: 20px; }
fieldset { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0 0; }
legend { font-weight: 700; color: var(--green-800); padding: 0 6px; }
.choices-edit { display: grid; gap: 8px; }
.choice-edit { display: flex; gap: 10px; align-items: center; }
.radio { flex-direction: row !important; align-items: center; }
.radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--line); background: #fff; font-weight: 800; font-size: 22px; cursor: pointer; }
.radio input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.radio input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.editor-errors ul { margin: 0; padding: 10px 30px; background: var(--bad-soft); color: #7d1a14; border-radius: var(--radius-sm); }
.editor-errors:empty { display: none; }

/* ---------- التنبيه السريع والمؤثرات ---------- */
#toast {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 30px);
  padding: 12px 24px; border-radius: 999px; background: var(--green-900); color: #fff; font-weight: 700; font-size: 18px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(-40px); } }

/* ---------- تقليل الحركة ---------- */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* ---------- الشاشات المتوسطة (آيباد عمودي) ---------- */
/* ثلاثة فرق: لوحة القمة أعرض قليلًا، وبطاقات النقاط مضغوطة */
@media (min-width: 981px) { .teams-3 .game-grid { grid-template-columns: minmax(0, 1fr) clamp(320px, 30vw, 460px); } }
.teams-3 .score-cards { gap: 8px; }
.teams-3 .score-card { padding: 8px 4px; }
.teams-3 .score-card .sc { font-size: clamp(32px, 3vw, 48px); }
.teams-3 .score-card .nm { font-size: 15px; line-height: 1.25; }
.teams-3 .score-card small { font-size: 12px; line-height: 1.3; }
.teams-3 .score-card .dot { width: 26px; height: 26px; font-size: 14px; }
.teams-3 .lane { width: 54px; }
.teams-3 .token { width: 48px; height: 48px; margin-left: -24px; margin-bottom: -24px; font-size: 21px; }
.teams-3 .ans { min-height: 58px; font-size: 26px; }
.teams-3 .explain-toggles .toggle { font-size: 16px; }
/* أربعة فرق: أربع ألوان ومسارات مستقلة، بطاقتا نقاط في كل صف للحفاظ على قراءة الأسماء. */
@media (min-width: 981px) {
  .teams-4 .game-grid { grid-template-columns: minmax(0, 1fr) clamp(350px, 34vw, 490px); }
}
.teams-4 .score-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.teams-4 .score-card { padding: 7px 5px; }
.teams-4 .score-card .nm { font-size: 15px; }
.teams-4 .score-card .sc { font-size: clamp(27px, 3vw, 43px); }
.teams-4 .score-card small { font-size: 12px; }
.teams-4 .score-card .dot { width: 26px; height: 26px; font-size: 14px; }
.teams-4 .lane { width: 51px; }
.teams-4 .token { width: 46px; height: 46px; margin-left: -23px; margin-bottom: -23px; font-size: 20px; }
.teams-4 .ans { min-height: 54px; font-size: 24px; }
.teams-4 .explain-toggles .toggle { font-size: 15px; }
.teams-4 .result-card { padding: 14px; }
.teams-4 .result-card h3 { font-size: 20px; }
.teams-4 .result-card .big { font-size: 56px; }
/* على شاشة الحاسب: فريقان في كل صف لقراءة الإجابات والتفسيرات بوضوح. */
@media (max-width: 1400px) and (min-width: 641px) {
  .teams-4 .answer-grid, .teams-4 .explain-toggles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teams-4 .ans-buttons { grid-template-columns: repeat(5, 1fr); }
  .teams-4 .ans.none { grid-column: auto; min-height: 54px; font-size: 15px; }
}
@media (max-width: 1090px) and (min-width: 641px) {
  .teams-4 .result-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* على الشاشات المتوسطة تنتقل لوحة إدخال الإجابات لثلاثة فرق إلى عمود واحد */
@media (max-width: 1240px) { .teams-3 .answer-grid, .teams-3 .explain-toggles { grid-template-columns: 1fr; } .teams-3 .ans-buttons { grid-template-columns: repeat(5, 1fr); } .teams-3 .ans.none { grid-column: auto; min-height: 58px; font-size: 16px; } }

@media (max-width: 980px) {
  .game-grid { grid-template-columns: 1fr; }
  .summit-panel { position: static; height: auto; min-height: 0; order: -1; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .summit-panel .score-cards { grid-column: 1 / -1; }
  .summit-panel .mountain { grid-column: 1 / -1; min-height: 0; height: 170px; flex: none; }
  .summit-panel .summit-note { grid-column: 1 / -1; }
  .lanes { top: 18px; bottom: 18px; inset-inline: 46px 80px; flex-direction: column; justify-content: space-around; }
  .lane { width: auto; height: 56px; }
  .track { top: 50%; bottom: auto; left: 0; right: 0; width: auto; height: 10px; margin: -5px 0 0; background: repeating-linear-gradient(to left, rgba(15,58,43,.25) 0 10px, transparent 10px 20px); }
  .lane.tm .track { background: repeating-linear-gradient(to left, var(--tc) 0 10px, transparent 10px 20px); }
  .teams-3 .summit-panel .mountain { height: 220px; }
  .teams-4 .summit-panel .mountain { height: 275px; }
  .lane { height: 52px; }
  .summit-flag { top: 50%; left: 14px; transform: translateY(-50%); }
  .basecamp { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: 0; max-height: 300px; aspect-ratio: auto; height: 240px; }
  .row4 { grid-template-columns: 1fr 1fr; }
  .names-grid.n3 { grid-template-columns: 1fr; }
  .teams-4 .answer-grid, .teams-4 .explain-toggles { grid-template-columns: 1fr; }
}

/* في الوضع العمودي يتحرك المؤشر أفقيًا نحو القمة (يسارًا) */
@media (max-width: 980px) {
  .teams-3 .token { margin: -24px -24px 0 0; }
  .teams-3 .lane { width: auto; }
  .teams-4 .token { margin: -23px -23px 0 0; }
  .teams-4 .lane { width: auto; }
  .token { top: 50%; bottom: auto !important; left: auto; right: var(--pos, 0%); margin: -27px -27px 0 0; transition: right 1.1s cubic-bezier(.34, 1.3, .64, 1); }
}

/* ---------- الهاتف ---------- */
@media (max-width: 640px) {
  body { font-size: 17px; }
  .names-grid, .names-grid.n3, .names-grid.n4, .option-grid, .timer-defaults, .answer-grid, .explain-toggles, .result-cards, .compare, .scored-summary { grid-template-columns: 1fr; }
  .choices { grid-template-columns: 1fr; }
  .bank-stats { grid-template-columns: 1fr 1fr; }
  .b-choices { grid-template-columns: 1fr; }
  .stepper li { font-size: 14px; padding: 8px; gap: 6px; }
  .tool-btn span { display: none; }
  .score-row { grid-template-columns: 1fr auto; }
  .score-row .toggle { grid-column: 1 / -1; }
  .score-row .pts { grid-row: 1; grid-column: 2; }
  .bar h1 { font-size: 20px; }
  .timer-face { min-width: 0; width: 100%; }
  .row4, .row2 { grid-template-columns: 1fr; }
  .brand.small div { display: none; }
  .teams-4 .score-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teams-4 .result-cards { grid-template-columns: 1fr; }
}

/* ---------- تقرير التفعيل (A4) ---------- */
.report-main { width: 100%; max-width: 1000px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.report-form { background: var(--paper); border-radius: 24px; padding: 18px 22px; box-shadow: var(--shadow); }
.report-form h2 { font-size: 22px; color: var(--green-900); }
.rf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 10px; align-items: start; }
.rf { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 16px; color: var(--green-800); }
.rf.full { margin-top: 10px; }
.rf input, .rf select, .rf textarea { width: 100%; min-height: 48px; padding: 8px 12px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: #fff; font-weight: 400; font-size: 18px; color: var(--ink); }
.rf textarea { line-height: 1.6; resize: vertical; }
.rf-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.rf-quick .btn { min-height: 44px; }
.report-preview-wrap { overflow-x: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.report-doc { color: #1b2a23; font-size: 13.5px; line-height: 1.55; }
.sheet { width: 210mm; min-height: 297mm; margin: 0 auto 18px; padding: 13mm 14mm; background: #fff; box-shadow: 0 2px 14px rgba(15, 58, 43, .14); border-radius: 4px; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 3px solid var(--green-700); padding-bottom: 8px; margin-bottom: 6px; }
.r-head h1 { font-size: 21px; color: var(--green-900); font-weight: 800; }
.r-kicker { margin: 0; color: var(--green-700); font-weight: 700; font-size: 13px; }
.r-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.r-brand img { border-radius: 10px; }
.r-brand span { font-weight: 800; font-size: 13px; color: var(--green-800); }
.r-initiative { margin: 4px 0 0; font-size: 12px; color: #3d4f46; }
.free-note { color: var(--green-800); font-weight: 700; }
.report-doc h2 { font-size: 15.5px; color: var(--green-800); margin: 14px 0 6px; padding-inline-start: 8px; border-inline-start: 4px solid var(--green-600); }
.r-table { width: 100%; border-collapse: collapse; margin: 4px 0; }
.r-table th, .r-table td { border: 1px solid #cfc6ad; padding: 5px 8px; text-align: start; vertical-align: top; }
.r-table thead th, .r-meta th { background: #f4ecd8; font-weight: 700; color: #1f4a39; }
.r-meta th { width: 22%; }
.r-results td:not(:first-child), .r-results th:not(:first-child) { text-align: center; }
.r-results tr.win td { background: #fff8e3; }
.r-results small { color: #56675e; }
.r-team { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.r-team i { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-style: normal; font-size: 11px; flex: none; }
.rv.blank { display: inline-block; min-width: 150px; height: 1.2em; border-bottom: 1px dotted #8a8a7a; }
.r-note { margin: 2px 0 0; font-size: 11.5px; color: #56675e; }
.r-plain { margin: 4px 0; }
.r-chart { width: 100%; height: auto; display: block; }
.r-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; font-size: 11.5px; color: #56675e; }
.r-legend i { display: inline-block; width: 16px; height: 11px; vertical-align: middle; border: 1px solid #1f4a39; margin-inline-end: 4px; }
.r-legend i.solid { background: #1f4a39; }
.r-legend i.hatch { background: repeating-linear-gradient(45deg, #1f4a39 0 2px, #fff 2px 4px); }
.r-matrix th, .r-matrix td { text-align: center; padding: 4px 3px; }
.r-matrix td:first-child, .r-matrix th:first-child { text-align: start; padding-inline: 8px; }
.r-matrix .m-correct, .r-matrix .m-correct-plus { color: #1f7a4a; font-weight: 800; }
.r-matrix .m-correct-plus { background: #e5f4ea; }
.r-matrix .m-wrong { color: #b3261e; font-weight: 800; }
.r-matrix .m-none { color: #8a8a7a; }
/* المسار الإثرائي (التفكير المنطقي) في التقرير */
.r-matrix .m-logic, .r-tracks .m-logic { background-image: linear-gradient(rgba(122, 63, 158, .09), rgba(122, 63, 158, .09)); }
.r-tracks td:not(:first-child), .r-tracks th:not(:first-child) { text-align: center; }
.r-enrich { color: #5b2c78; font-weight: 700; }
.r-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.r-two .r-weak { margin: 0; font-size: 12px; }
.r-two .r-weak th, .r-two .r-weak td { padding: 3px 6px; }
.r-weak td:not(:first-child), .r-weak th:not(:first-child) { text-align: center; width: 1%; white-space: nowrap; }
.r-notes { border: 1px solid #cfc6ad; border-radius: 6px; padding: 8px 10px; min-height: 110px; }
.r-notes.empty { background: repeating-linear-gradient(to bottom, transparent 0 27px, #d9d2bf 27px 28px); }
.r-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.r-sign div { display: flex; align-items: flex-end; gap: 8px; font-weight: 700; }
.r-sign i { flex: 1; border-bottom: 1px solid #555; height: 1.4em; }
.r-foot { margin-top: 16px; padding-top: 6px; border-top: 1px solid #cfc6ad; font-size: 11px; color: #56675e; }
.archive-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--paper); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.archive-item p { margin: 4px 0 0; }
@media (max-width: 640px) { .rf-grid { grid-template-columns: 1fr; } }

@page { size: A4; margin: 0; }

/* ---------- الشاشات الضيقة جدًا (٣٢٠–٤٠٠px) ---------- */
@media (max-width: 400px) {
  .stepper { gap: 6px; }
  .stepper li { flex-direction: column; justify-content: center; text-align: center; gap: 2px; padding: 6px 4px; min-width: 0; font-size: 13px; line-height: 1.3; }
  .stepper li span { width: 26px; height: 26px; font-size: 13px; }
  /* شريط العنوان: عمود أوسط مرن بدل عمودين جانبيين متساويين */
  .bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding-inline: 10px; }
  .bar h1 { font-size: 17px; }
  .bar .btn-ghost { padding-inline: 12px; }
  .bar-tools { gap: 4px; }
  .bar h1 { min-width: 0; overflow-wrap: anywhere; }
  /* شاشة التقرير: زر الطباعة يحتاج المساحة، والعنوان الكبير موجود أسفل الشريط */
  .screen.report .bar h1 { visibility: hidden; }
  /* شاشة النتيجة: العنوان الطويل ينكسر داخل الكلمة؛ بطاقة الفائز تحته تكفي */
  .screen.results .bar h1 { visibility: hidden; }
  /* اختيار عدد الفرق: ثلاثة أزرار تملأ العرض دون تمرير أفقي */
  .seg.team-count { display: flex; width: 100%; }
  .seg.team-count button { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 16px; }
  /* الوسوم تلتف بدل أن تخرج عن الشاشة */
  .tag { white-space: normal; }
  /* أزرار الإجابة: أربعة حروف في صف و«بلا إجابة» في صف كامل حتى لا تقل عن ٤٤px */
  .teams-3 .ans-buttons, .ans-buttons { grid-template-columns: repeat(4, 1fr); }
  .teams-3 .ans.none { grid-column: 1 / -1; min-height: 48px; }
}

/* ---------- الطباعة ---------- */
@media print {
  html, body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body:not(.on-report) .screen { padding: 12mm; }
  body.on-report .no-print, body.on-report .bar { display: none !important; }
  body.on-report .report-main { padding: 0; max-width: none; display: block; }
  body.on-report .report-preview-wrap { overflow: visible; padding: 0; }
  .sheet { width: 210mm; min-height: 0; margin: 0; padding: 12mm 14mm; box-shadow: none; border-radius: 0; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .r-table, .r-visual, .r-notes, .r-sign, .r-chart, tr { break-inside: avoid; page-break-inside: avoid; }
  .report-doc h2 { break-after: avoid; page-break-after: avoid; }
  body { background: #fff; font-size: 14px; }
  .bar button, .bar-tools, .no-print, .exit-actions, #toast, #fx { display: none !important; }
  .bar { position: static; border: 0; }
  .panel, .result-card, .winner-banner { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .winner-banner { background: #fff; color: var(--ink); }
  .winner-banner .eyebrow { color: var(--green-700); }
}


/* =========================== تحدٍّ ومعرفة – unified design =========================== */
body.tahaddi-qudrat{background:#faf8f2;color:#213c32}
body.tahaddi-qudrat .site,body.tahaddi-qudrat .app{background:transparent}
body.tahaddi-qudrat .tm-unity-bar{direction:rtl;display:flex;align-items:center;justify-content:space-between;gap:14px;background:#fffdf8;color:#17483b;padding:10px clamp(14px,3vw,38px);border-bottom:1px solid #e4e9de;position:relative;z-index:70;font-family:'Tajawal',Tahoma,sans-serif}
body.tahaddi-qudrat .tm-unity-brand{display:inline-flex;align-items:center;gap:10px;color:#17483b;font-weight:800;text-decoration:none;font-size:17px}
body.tahaddi-qudrat .tm-unity-symbol{font-size:21px;display:grid;place-items:center;width:35px;height:35px;border-radius:10px;background:#e5f1e9}
body.tahaddi-qudrat .tm-unity-links{display:flex;flex-wrap:wrap;gap:8px}
body.tahaddi-qudrat .tm-unity-links a{min-height:37px;padding:7px 12px;border-radius:10px;color:#275744;border:1px solid #d9e6db;text-decoration:none;background:#f8fbf8;font-weight:700;font-size:14px}
body.tahaddi-qudrat .tm-unity-links a.current{background:#184c3d;color:white;border-color:#184c3d}
body.tahaddi-qudrat .tm-unity-links a:hover{background:#e8f4ec}
body.tahaddi-qudrat .tm-unity-links a.current:hover{background:#1b6049;color:white}
body.tahaddi-qudrat .tm-unity-bar a:focus-visible{outline:3px solid #d5a355;outline-offset:3px}
body.tahaddi-qudrat .hero-art{border-radius:23px;box-shadow:0 10px 30px rgba(20,65,47,.07)}
body.tahaddi-qudrat .hero-text h1,body.tahaddi-qudrat .brand b{color:#174738}
body.tahaddi-qudrat .btn{border-radius:13px}
body.tahaddi-qudrat .btn-primary{background:#1e674f;box-shadow:0 3px 0 #104333}
body.tahaddi-qudrat .btn-primary:hover:not(:disabled){background:#18563f}
body.tahaddi-qudrat .btn-accent{background:#c49445;color:#203329;box-shadow:0 3px 0 #93682f}
body.tahaddi-qudrat .hero-text h1{font-size:clamp(35px,5.7vw,67px)}
body.tahaddi-qudrat .card,body.tahaddi-qudrat .panel{border-radius:18px}
body.tahaddi-qudrat .r-brand span{color:#1d664f}
@media(max-width:600px){
  body.tahaddi-qudrat .tm-unity-bar{padding:10px 12px;align-items:flex-start}
  body.tahaddi-qudrat .tm-unity-brand{font-size:14px;white-space:nowrap}
  body.tahaddi-qudrat .tm-unity-links{justify-content:flex-end}
  body.tahaddi-qudrat .tm-unity-links a{font-size:12px;padding:6px 9px}
}
@media print{body.tahaddi-qudrat .tm-unity-bar{display:none!important}}
