/* أنواع الأسئلة التفاعلية (assets/qtypes.js) — سمّ الأجزاء، التصنيف، الربط، اختر كل ما ينطبق، صحّح الخطأ، الرسم البياني، الموقف.
   كل الألوان من متغيرات الموقع (--card --fg --line --accent --ok-* --bad-*) عشان الوضع الليلي يشتغل تلقائيًا. */
:is(#t3, body) .qt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-block: 8px;
}
:is(#t3, body) .qt button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
:is(#t3, body) .qt button:focus-visible,
:is(#t3, body) .qt [data-bin]:focus-visible {
  outline: 3px solid var(--c-gold);
  outline-offset: 2px;
}
:is(#t3, body) .qt-help {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* شرائح الأسماء */
:is(#t3, body) .qt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
:is(#t3, body) .qt .qt-chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  min-height: 42px;
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
:is(#t3, body) .qt .qt-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
:is(#t3, body) .qt .qt-chip.used {
  opacity: 0.35;
  pointer-events: none;
}
:is(#t3, body) .qt-lab {
  font-size: 0.85rem;
  color: var(--muted);
}
:is(#t3, body) .qt-done {
  font-size: 0.85rem;
  color: var(--good);
  font-weight: 600;
}
:is(#t3, body) .qt .qt-check {
  align-self: flex-start;
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-pill);
  padding: 10px 28px;
  min-height: 46px;
  font-weight: 700;
}
:is(#t3, body) .qt .qt-check:disabled {
  opacity: 0.4;
  cursor: default;
}
:is(#t3, body) .qt .qt-check.wait {
  opacity: 0.6;
}

/* ١ الرسمة: الخلفية فاتحة دائمًا (الرسمة ملوّنة) */
:is(#t3, body) .qt-dia {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
}
:is(#t3, body) .qt-dia svg {
  display: block;
  width: 100%;
  height: auto;
}
:is(#t3, body) .qt-lead {
  stroke: #55615e;
  stroke-width: 1.2;
}
:is(#t3, body) .qt-pt {
  fill: #111;
  stroke: #fff;
  stroke-width: 1;
}
:is(#t3, body) .qt .qt-pin {
  position: absolute;
  transform: translateY(-50%);
  max-width: 21%;
  min-width: 44px;
  min-height: 30px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  border: 2px dashed var(--c-green-2);
  background: #fff;
  color: var(--c-green);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
:is(#t3, body) .qt .qt-pin.set {
  border-style: solid;
  background: var(--c-green-2);
  color: #fff;
}
:is(#t3, body) .qt .qt-pin.ok {
  border: 2px solid var(--c-green-mid);
  background: var(--c-green-mid);
  color: #fff;
}
:is(#t3, body) .qt .qt-pin.no {
  border: 2px solid var(--c-danger);
  background: var(--c-danger);
  color: #fff;
}

/* ٢ التصنيف */
:is(#t3, body) .qt-bins {
  display: grid;
  grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr));
  gap: 10px;
}
:is(#t3, body) .qt-bin {
  border: 2px dashed var(--line);
  border-radius: var(--r-xl);
  padding: 10px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
}
:is(#t3, body) .qt-bin h4 {
  margin: 0;
  font-size: 0.92rem;
  text-align: center;
  color: var(--accent);
}
:is(#t3, body) .qt-bin.on {
  border-color: var(--accent);
  background: var(--accent-2);
}
:is(#t3, body) .qt .qt-chip.in {
  font-size: 0.85rem;
  min-height: 36px;
  padding: 4px 12px;
  justify-content: center;
  flex-wrap: wrap;
}
:is(#t3, body) .qt .qt-chip.in small {
  font-size: 0.72rem;
  font-weight: 500;
}

/* ٣ الربط */
:is(#t3, body) .qt-mcols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
:is(#t3, body) .qt-mcol {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
:is(#t3, body) .qt .qt-m {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: var(--r-lg);
  padding: 9px 10px;
  min-height: 48px;
  text-align: start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
:is(#t3, body) .qt .qt-m span {
  flex: 1;
  min-width: 0;
}
:is(#t3, body) .qt .qt-m i {
  font-style: normal;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex: none;
}
:is(#t3, body) .qt .qt-m.on {
  border-color: var(--c-gold-dark);
  box-shadow: 0 0 0 3px rgba(224, 161, 0, 0.25);
}
:is(#t3, body) .qt .qt-m.paired {
  border-color: var(--accent);
}
:is(#t3, body) .qt .qt-m small {
  flex-basis: 100%;
  font-size: 0.75rem;
}

/* ٤ اختر كل ما ينطبق */
:is(#t3, body) .qt-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
:is(#t3, body) .qt .qt-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--fg);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  min-height: 50px;
}
:is(#t3, body) .qt-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--muted);
  border-radius: 6px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}
:is(#t3, body) .qt .qt-opt[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-2);
}
:is(#t3, body) .qt .qt-opt[aria-pressed="true"] .qt-box {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:is(#t3, body) .qt .qt-opt.miss {
  border: 2px dashed var(--ok-bd);
}

/* ٥ صحّح الخطأ */
:is(#t3, body) .qt-sent {
  margin: 0;
  line-height: 2.6;
  font-size: 1.05rem;
}
:is(#t3, body) .qt .qt-w {
  border: 0;
  border-bottom: 2px dashed var(--line);
  background: none;
  color: var(--fg);
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 600;
}
:is(#t3, body) .qt .qt-w.on {
  background: var(--c-gold);
  color: var(--c-brown-ink);
  border-bottom-color: var(--c-gold-dark);
}
:is(#t3, body) .qt .qt-w.fixd {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border-bottom: 2px solid var(--ok-bd);
}

/* الحالات بعد التصحيح (مشتركة) */
:is(#t3, body) .qt .ok,
:is(#t3, body) .qt .qt-w.ok {
  border-color: var(--ok-bd);
  background: var(--ok-bg);
  color: var(--ok-fg);
}
:is(#t3, body) .qt .no,
:is(#t3, body) .qt .qt-w.no {
  border-color: var(--bad-bd);
  background: var(--bad-bg);
  color: var(--bad-fg);
}

/* الرسم البياني والموقف (فوق سؤال الاختيار العادي) */
:is(#t3, body) .qt-case {
  background: var(--accent-2);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  margin-block: 6px;
}
:is(#t3, body) .qt-case b {
  display: block;
  font-size: 0.8rem;
  color: var(--accent);
}
:is(#t3, body) .qt-case p {
  margin: 4px 0 0;
  line-height: 1.8;
}
:is(#t3, body) .qt-chartbox {
  max-width: 460px;
  margin: 6px auto;
  overflow-x: auto;
}
:is(#t3, body) .qt-chart {
  display: block;
  width: 100%;
  height: auto;
}
:is(#t3, body) .qt-chart text {
  font-size: 10px;
  fill: var(--muted);
}
:is(#t3, body) .qt-chart .qt-ax {
  font-size: 10.5px;
  font-weight: 700;
  fill: var(--fg);
}
:is(#t3, body) .qt-grid {
  stroke: var(--line);
}
:is(#t3, body) .qt-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
}
:is(#t3, body) .qt-dot {
  fill: var(--accent);
}
:is(#t3, body) .qt-bar {
  fill: var(--accent);
}

/* زر التدريب التفاعلي في قائمة الفصول */
:is(#t3, body) .lcard.qtdrill {
  border-style: dashed;
}
@media (max-width: 420px) {
  :is(#t3, body) .qt .qt-pin {
    font-size: 0.64rem;
    min-height: 26px;
  }
  :is(#t3, body) .qt-mcols {
    gap: 6px;
  }
  :is(#t3, body) .qt .qt-m {
    font-size: 0.82rem;
    padding: 8px;
  }
}
/* بعد التصحيح الأزرار تتعطّل بس تبقى واضحة (الافتراضي يبهّت الزر المعطّل) */
:is(#t3, body) .qt button:disabled {
  opacity: 1;
  cursor: default;
}
:is(#t3, body) .qt .qt-check:disabled {
  opacity: 0.4;
}
/* حالة التصحيح أقوى من «مختار» (وإلا الخيار الصح المختار يطلع بلون الاختيار بدل الأخضر) */
:is(#t3, body) .qt .qt-opt.ok,
:is(#t3, body) .qt .qt-m.ok,
:is(#t3, body) .qt .qt-chip.ok {
  border-color: var(--ok-bd);
  background: var(--ok-bg);
  color: var(--ok-fg);
}
:is(#t3, body) .qt .qt-opt.no,
:is(#t3, body) .qt .qt-m.no,
:is(#t3, body) .qt .qt-chip.no {
  border-color: var(--bad-bd);
  background: var(--bad-bg);
  color: var(--bad-fg);
}
:is(#t3, body) .qt .qt-opt.ok .qt-box {
  background: var(--ok-bd);
  border-color: var(--ok-bd);
  color: #fff;
}
