.quiz-dock-btn {
  position: absolute;
  /* شارة كيوت على ركن زر الإرسال (تداخل واضح، لا فجوة فوقه) */
  top: 1.05rem;
  bottom: auto;
  inset-inline-end: 1.35rem;
  width: 1.55rem;
  height: 1.55rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  z-index: 30;
  isolation: isolate;
  overflow: visible;
  opacity: 0;
  transform: translateY(8px) scale(0.7);
  filter: blur(6px);
  pointer-events: none;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.4s ease;
}
.quiz-dock-btn.is-visible {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  filter: none !important;
  pointer-events: auto !important;
}
.quiz-dock-btn:hover {
  transform: translateY(-2px) scale(1.08) !important;
}
.quiz-dock-btn:active {
  transform: translateY(0) scale(0.94) !important;
}

.quiz-dock-aura {
  position: absolute;
  inset: -18px;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.quiz-dock-aura > * {
  position: absolute;
  pointer-events: none;
}

.qd-veil {
  inset: -4%;
  border-radius: 46% 54% 48% 52% / 58% 48% 52% 42%;
  background:
    radial-gradient(ellipse 90% 70% at 50% 60%,
      rgba(250, 255, 210, 0.65) 0%,
      rgba(190, 240, 120, 0.32) 28%,
      rgba(136, 197, 64, 0.14) 52%,
      transparent 78%);
  filter: blur(9px);
  animation: qdVeil 7s ease-in-out infinite, qdMorph 11s ease-in-out infinite;
}

.qd-blob {
  filter: blur(13px);
  will-change: transform, border-radius, opacity;
}
.qd-b1 {
  inset: 10%;
  background:
    radial-gradient(ellipse 120% 90% at 45% 55%,
      rgba(255, 255, 230, 0.95) 0%,
      rgba(210, 255, 140, 0.68) 30%,
      rgba(150, 220, 80, 0.36) 58%,
      transparent 80%);
  opacity: 0.95;
  animation: qdMorph 9s ease-in-out infinite, qdDriftA 8s ease-in-out infinite;
}
.qd-b2 {
  width: 82%;
  height: 82%;
  left: -16%;
  top: -4%;
  background:
    radial-gradient(circle at 60% 50%,
      rgba(160, 235, 150, 0.75) 0%,
      rgba(70, 150, 80, 0.3) 50%,
      transparent 76%);
  opacity: 0.72;
  animation: qdMorph 10.5s ease-in-out infinite reverse, qdDriftB 9.5s ease-in-out infinite;
}
.qd-b3 {
  width: 78%;
  height: 78%;
  right: -14%;
  bottom: -8%;
  left: auto;
  background:
    radial-gradient(circle at 35% 40%,
      rgba(230, 255, 160, 0.65) 0%,
      rgba(120, 195, 70, 0.28) 48%,
      transparent 74%);
  opacity: 0.68;
  animation: qdMorph 11s ease-in-out infinite, qdDriftC 8.8s ease-in-out infinite;
}

.qd-core {
  left: 18%;
  right: 18%;
  top: 18%;
  bottom: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%,
      #ffffff 0%,
      #f3ffd0 22%,
      #d4f56a 48%,
      #88c540 72%,
      rgba(35, 99, 36, 0.35) 100%);
  box-shadow:
    0 0 10px 3px rgba(180, 235, 100, 0.45),
    0 0 20px 7px rgba(136, 197, 64, 0.2);
  animation: qdCorePulse 5.5s ease-in-out infinite;
}

.qd-sheen {
  width: 44%;
  height: 28%;
  left: 24%;
  top: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.25) 55%, transparent 78%);
  filter: blur(1px);
  animation: qdSheen 6s ease-in-out infinite;
}

.qd-ring {
  left: 50%;
  top: 50%;
  width: 1.28rem;
  height: 1.28rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(220, 245, 170, 0.8);
  background:
    linear-gradient(150deg,
      rgba(255, 255, 255, 0.92) 0%,
      rgba(236, 252, 200, 0.58) 45%,
      rgba(210, 240, 160, 0.42) 100%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.7) inset,
    0 1px 0 rgba(255,255,255,0.85) inset,
    0 0 12px 4px rgba(170, 230, 90, 0.32),
    0 6px 14px rgba(35, 99, 36, 0.14);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  animation: qdRingGlow 4.5s ease-in-out infinite;
  transition: transform 0.35s cubic-bezier(0.22,1,0.36,1);
}
.quiz-dock-btn:hover .qd-ring {
  transform: translate(-50%, -50%) scale(1.08);
}

.qd-spark {
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: #f7ffd4;
  box-shadow: 0 0 5px 1px rgba(200, 245, 120, 0.85);
  opacity: 0;
  animation: qdSpark 4.6s ease-in-out infinite;
}
.qd-s1 { left: 8%; top: 16%; }
.qd-s2 { right: 10%; top: 22%; left: auto; width: 2px; height: 2px; animation-delay: -0.9s; }
.qd-s3 { left: 18%; bottom: 12%; top: auto; animation-delay: -1.8s; }
.qd-s4 { right: 14%; bottom: 18%; left: auto; top: auto; width: 2px; height: 2px; animation-delay: -2.7s; }
.qd-s5 { left: 46%; top: 2%; width: 2.25px; height: 2.25px; animation-delay: -1.4s; }

.quiz-dock-mark {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font: 800 0.78rem/1 "Tajawal", "Segoe UI", sans-serif;
  letter-spacing: 0;
  color: #143812;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.9),
    0 0 8px rgba(190, 240, 120, 0.45);
}

@keyframes qdMorph {
  0%, 100% { border-radius: 42% 58% 48% 52% / 52% 42% 58% 48%; }
  33% { border-radius: 58% 42% 62% 38% / 40% 60% 40% 60%; }
  66% { border-radius: 38% 62% 44% 56% / 60% 40% 55% 45%; }
}
@keyframes qdDriftA {
  0%, 100% { transform: translate(0, 2px) scale(1); }
  50% { transform: translate(3px, -5px) scale(1.08); }
}
@keyframes qdDriftB {
  0%, 100% { transform: translate(0, 2px) scale(1) rotate(0deg); }
  50% { transform: translate(5px, -5px) scale(1.12) rotate(-7deg); }
}
@keyframes qdDriftC {
  0%, 100% { transform: translate(0, 0) scale(0.95); }
  50% { transform: translate(-5px, -4px) scale(1.14); }
}
@keyframes qdCorePulse {
  0%, 100% { transform: scale(0.93); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes qdSheen {
  0%, 100% { transform: translate(0, 0) scale(0.9); opacity: 0.5; }
  50% { transform: translate(3px, -2px) scale(1.15); opacity: 0.95; }
}
@keyframes qdVeil {
  0%, 100% { opacity: 0.65; transform: scale(0.92) translateY(3px); }
  50% { opacity: 1; transform: scale(1.1) translateY(-4px); }
}
@keyframes qdRingGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.6) inset,
      0 0 18px 6px rgba(170,230,90,0.3),
      0 8px 18px rgba(35,99,36,0.12);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.8) inset,
      0 0 28px 10px rgba(180,240,100,0.45),
      0 12px 24px rgba(35,99,36,0.16);
  }
}
@keyframes qdSpark {
  0%, 100% { opacity: 0; transform: translate(0, 5px) scale(0.3); }
  20% { opacity: 1; transform: translate(2px, -2px) scale(1.15); }
  55% { opacity: 0.4; transform: translate(-2px, -11px) scale(0.85); }
  80% { opacity: 0; transform: translate(0, -18px) scale(0.25); }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-dock-btn,
  .quiz-dock-btn.is-visible { transition: opacity 0.2s ease, transform 0.2s ease; filter: none; }
  .quiz-dock-aura > * { animation: none !important; }
}


.quiz-explain {
  flex: 1 1 100%;
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--muted);
}
.quiz-wait.ok .quiz-explain { color: var(--leaf-deep); }
.quiz-wait.no .quiz-explain { color: #8a4b44; }

.quiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: end center;
  padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 20, 10, 0.72);
  backdrop-filter: blur(18px) saturate(0.7);
  -webkit-backdrop-filter: blur(18px) saturate(0.7);
  animation: quizOverlayIn 0.28s ease both;
}
@keyframes quizOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
body.quiz-open {
  overflow: hidden;
}
body.quiz-open .chat-panel,
body.quiz-open .messages,
body.quiz-open .ask-hero {
  filter: blur(10px) brightness(0.82);
  pointer-events: none;
  user-select: none;
}

.quiz-sheet {
  width: min(100%, 28rem);
  height: auto;
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fbfef8 100%);
  color: var(--ink);
  border-radius: 1.15rem 1.15rem 0.9rem 0.9rem;
  border: 1px solid var(--line);
  box-shadow: 0 -10px 36px rgba(20, 48, 22, 0.16);
  padding: 0.85rem 0.95rem 0.9rem;
  animation: quizSheetIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes quizSheetIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.quiz-sheet.is-scrollable .quiz-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.quiz-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 0.55rem;
  flex: 0 0 auto;
  margin-bottom: 0.65rem;
}
.quiz-kicker {
  margin: 0;
  grid-column: 1;
  justify-self: stretch;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--leaf-deep);
  letter-spacing: 0.01em;
  line-height: 1.35;
}
.quiz-steps {
  grid-column: 2;
  justify-self: end; /* في RTL = يسار بصريًا بجانب زر الإغلاق */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1.55rem;
  gap: 0.22rem;
  padding: 0.18rem;
  border-radius: 999px;
  background: #e8f0df;
  box-shadow: inset 0 0 0 1px rgba(35, 99, 36, 0.06);
}
.quiz-step {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.quiz-step.is-current {
  background: var(--leaf);
  color: #fff;
  box-shadow: 0 1px 4px rgba(35, 99, 36, 0.22);
}
.quiz-step.is-done {
  background: var(--leaf-dark);
  color: #fff;
}
.quiz-step.is-todo {
  color: #7a8f72;
}
.quiz-x {
  grid-column: 3;
  justify-self: end;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 10px;
  background: var(--paper-deep);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.quiz-x:hover {
  background: #e8f0df;
  color: var(--leaf-deep);
}

.quiz-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-inline-end: 2px;
}

.quiz-prompt-frame {
  margin: 0 0 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(136, 197, 64, 0.35);
  background:
    linear-gradient(135deg, #eaf6dc 0%, #f3f8ec 42%, #fbfff6 78%, #ffffff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 6px 16px rgba(35, 99, 36, 0.05);
}
.quiz-prompt {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.6;
  color: var(--leaf-deep);
}

.quiz-choices {
  display: grid;
  gap: 0.55rem;
}
.quiz-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: start;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0;
  border-inline-start: 3px solid var(--leaf);
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.quiz-choice-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  margin-top: 0.08em;
  padding: 0 0.2rem;
  border-radius: 0;
  clip-path: polygon(
    18% 0, 82% 0, 100% 18%, 100% 82%,
    82% 100%, 18% 100%, 0 82%, 0 18%
  );
  background: var(--leaf);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.quiz-choice-text {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
}
.quiz-choice:hover:not(:disabled) {
  background: var(--leaf-soft);
  border-color: rgba(136, 197, 64, 0.4);
}
.quiz-choice:disabled {
  cursor: default;
}
.quiz-choice.is-right {
  border-color: rgba(136, 197, 64, 0.55);
  background: var(--leaf-soft);
}
.quiz-choice.is-right .quiz-choice-num {
  background: var(--leaf-dark);
}
.quiz-choice.is-wrong {
  border-color: rgba(192, 57, 43, 0.35);
  background: #fff7f6;
  border-inline-start-color: var(--danger, #c0392b);
}
.quiz-choice.is-wrong .quiz-choice-num {
  background: var(--danger, #c0392b);
}

.quiz-feedback { display: none; }
.quiz-wait {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  min-height: 2.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}
.quiz-result-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 800 1rem/1 var(--font);
}
.quiz-wait.ok .quiz-result-ico {
  background: color-mix(in srgb, var(--leaf) 22%, #fff);
  color: var(--leaf-deep);
}
.quiz-wait.no .quiz-result-ico {
  background: #fff5f4;
  color: var(--danger, #c0392b);
}
.quiz-wait-label {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink);
}
.quiz-count {
  min-width: 1.5rem;
  margin-inline-start: auto;
  text-align: center;
  font: 800 1.15rem/1 var(--font);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.quiz-skip {
  border: 1px solid rgba(136, 197, 64, 0.4);
  background: var(--leaf-soft);
  color: var(--leaf-deep);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: 800 0.84rem/1 var(--font);
  cursor: pointer;
}
.quiz-skip:hover {
  background: #e0f2c8;
}

.quiz-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  flex: 0 0 auto;
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.quiz-later {
  border: 0;
  background: var(--leaf-soft);
  font: 700 0.84rem/1.35 var(--font);
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  color: var(--leaf-deep);
}
.quiz-later:hover {
  background: #e0f2c8;
}
.quiz-pref {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.4rem 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  user-select: none;
}
.quiz-pref-label {
  font: 600 0.78rem/1.2 var(--font);
  color: var(--muted);
}
.quiz-switch {
  position: relative;
  width: 2.4rem;
  height: 1.32rem;
  border: 0;
  border-radius: 999px;
  background: #c9d6c0;
  padding: 0;
  cursor: pointer;
  transition: background 0.18s ease;
  flex: 0 0 auto;
}
.quiz-switch.is-on {
  background: var(--leaf);
}
.quiz-switch-knob {
  position: absolute;
  top: 0.16rem;
  inset-inline-start: 0.16rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 48, 22, 0.22);
  transition: inset-inline-start 0.18s ease;
}
.quiz-switch.is-on .quiz-switch-knob {
  inset-inline-start: calc(100% - 1.16rem);
}
.quiz-pref-chip {
  display: block;
  width: 100%;
  margin: 0 0 0.45rem;
  border: 1px dashed rgba(136, 197, 64, 0.45);
  background: rgba(248, 252, 242, 0.92);
  color: var(--leaf-deep);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font: 700 0.82rem/1.35 var(--font);
  cursor: pointer;
  text-align: center;
}
.quiz-pref-chip:hover {
  background: #eaf6dc;
}

@media (prefers-reduced-motion: reduce) {
  .quiz-overlay,
  .quiz-sheet,
  .quiz-choice,
  .quiz-step,
  .quiz-wait,
  .quiz-steps::before,
  .quiz-duel,
  .quiz-orb,
  .quiz-score,
  .quiz-score-hero strong,
  .quiz-race,
  .quiz-challenge {
    animation: none !important;
    transition: none !important;
  }
}

.quiz-duel { display:grid; grid-template-columns:1fr auto 1fr; gap:10px; align-items:center; margin:0 0 14px; }
.quiz-orb { display:grid; justify-items:center; gap:2px; min-width:0; padding:10px 8px; border:1px solid #d7e7c8; border-radius:16px; background:linear-gradient(180deg,#f7fbf3,#fff); color:#365f2b; animation:quiz-orb-in .35s ease both; }
.quiz-orb strong { font-size:1.35rem; font-weight:800; font-variant-numeric:tabular-nums; line-height:1; }
.quiz-orb span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.72rem; font-weight:600; color:#687461; }
.quiz-orb.is-you { background:linear-gradient(180deg,#eaf6dc,#fff); border-color:#88c540; }
.quiz-vs { width:36px; height:36px; color:#537e36; }
.quiz-vs svg { width:36px; height:36px; }
.quiz-invite { margin:0 0 12px; text-align:center; color:#537e36; font-size:.92rem; font-weight:700; }
.quiz-score, .quiz-score-hero { display:flex; align-items:center; gap:8px; margin:8px 0 0; padding:8px 10px; border-radius:14px; background:#f3f8ec; color:#236324; }
.quiz-score strong, .quiz-score-hero strong { font-size:1.25rem; font-variant-numeric:tabular-nums; }
.quiz-score.is-counted strong, .quiz-orb strong.is-counted, .quiz-score-hero strong { animation:quiz-score-pop .45s cubic-bezier(.22,1,.36,1) both; }
.quiz-score .quiz-result-ico, .quiz-score-mark { width:28px; height:28px; display:grid; place-items:center; color:#236324; }
.quiz-score svg, .quiz-score-mark svg { width:26px; height:26px; }
.quiz-score-hero { margin:0 0 14px; padding:14px 16px; border:1px solid #d7e7c8; background:radial-gradient(ellipse at 100% 0,#eff7e9 0,transparent 180px),#f7fbf3; }
.quiz-score-hero span:last-child { color:#687461; font-size:.82rem; font-weight:600; }
.quiz-result-bar { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-inline-start:auto; }
.quiz-result-bar .quiz-score { margin:0; padding:4px 8px; }
.quiz-result-bar .quiz-race { flex:0 0 auto; width:36px; height:36px; display:grid; place-items:center; color:#537e36; }
.quiz-result-bar .quiz-race svg { width:28px; height:28px; }
.quiz-result-bar .quiz-topic-link { flex:0 0 auto; width:40px; height:40px; display:grid; place-items:center; border-radius:50%; background:#eaf6dc; color:#236324; }
.quiz-result-bar .quiz-topic-link svg { width:20px; height:20px; }
.quiz-result-bar .quiz-topic-link.is-join { width:auto; height:auto; border-radius:0; background:transparent; }
.quiz-result-bar .quiz-evidence { width:auto; }
.quiz-result-bar .quiz-evidence[open] { flex:1 0 100%; }
.quiz-explain { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.quiz-challenge { display:inline-flex; align-items:center; justify-content:center; gap:0; width:40px; min-width:40px; height:40px; padding:0; border:0; border-radius:50%; background:#236324; color:#fff; cursor:pointer; }
.quiz-challenge.is-live { animation:quiz-challenge-pulse 1.6s ease-in-out infinite; }
.quiz-challenge.is-posted { background:#88c540; animation:quiz-score-pop .45s cubic-bezier(.22,1,.36,1) both; }
.quiz-challenge.is-cancel { background:#fff; color:#405137; border:1px solid #dce6d4; }
@keyframes quiz-challenge-pulse { 0%,100% { box-shadow:0 0 0 0 rgba(35,99,36,.35); } 70% { box-shadow:0 0 0 8px rgba(35,99,36,0); } }
.quiz-challenge .quiz-result-ico { width:22px; height:22px; background:transparent; color:#fff; }
.quiz-challenge svg { width:20px; height:20px; }
.quiz-challenge:hover { background:#3e672b; transform:translateY(-1px); }
.quiz-share-note { flex:1 1 100%; margin:0; color:#687461; font-size:.84rem; }
.quiz-race { flex:1 1 100%; margin:0; font-weight:800; color:#236324; animation:quiz-orb-in .35s ease both; }
.quiz-topic-link { flex:1 1 100%; color:#286237; font-weight:700; font-size:.84rem; }
.quiz-choice.is-right { animation:quiz-choice-bloom .28s ease both; }
.land-dashboard .dashboard-stat.is-score { background:linear-gradient(180deg,#eaf6dc,#fff); border:1px solid #88c540; border-radius:16px; }
@keyframes quiz-score-pop { 0% { transform:scale(.6); opacity:.2; } 60% { transform:scale(1.12); } 100% { transform:scale(1); opacity:1; } }
@keyframes quiz-orb-in { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes quiz-choice-bloom { 50% { box-shadow:0 0 0 6px #88c54022; } 100% { box-shadow:0 0 0 0 #88c54000; } }


/* Optional knowledge check: encountered naturally at the end of its answer. */
.answer-quiz { display: flex; justify-content: center; padding: 26px 0 22px; width: 100%; }
.answer-quiz[hidden] { display: none; }
.answer-quiz .quiz-dock-btn { position: relative; inset: auto; width: 48px; height: 48px; z-index: 1; }
.answer-quiz .quiz-dock-mark { font-size: 1.5rem; }
.answer-quiz .quiz-dock-btn:focus-visible { outline: 3px solid var(--leaf-deep, #285c30); outline-offset: 8px; }
.answer-quiz .is-complete .qd-ring { opacity: 0.5; }

body.quiz-open .topic-detail { filter: blur(6px) brightness(.85); pointer-events: none; }
.quiz-x { min-width: 44px; min-height: 44px; }

.answer-quiz { flex-direction: column; align-items: center; gap: 14px; }
.quiz-load-status { font-size: .85rem; color: var(--muted, #5f6b5f); text-align: center; }
.quiz-load-status:empty { display: none; }
.quiz-dock-btn:disabled { cursor: wait; }
.quiz-evidence { width: 100%; font-size: .9rem; }
.quiz-evidence summary { width: 44px; min-height: 44px; display: grid; place-items: center; border: 1px solid var(--line, #dce6d4); border-radius: 50%; cursor: pointer; list-style: none; }
.quiz-evidence summary::-webkit-details-marker { display: none; }
.quiz-evidence blockquote { margin: 8px 0 0; padding: 12px; border-inline-start: 3px solid var(--leaf, #88c540); }

/* Homepage header bar, answer highlight, and a moving progress track. */
.quiz-overlay {
  background: rgba(8, 20, 10, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.quiz-sheet {
  width: min(100%, 32rem);
  background: linear-gradient(180deg, #fcfef9, #f3f8ec);
  color: #1e2a1e;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(12, 36, 14, 0.28);
  font-family: Tajawal, "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
  padding: 0 0 16px;
  overflow: hidden;
}
.quiz-head {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: rgba(12, 36, 14, 0.92);
}
.quiz-kicker {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: #f3fbe8;
  overflow-wrap: anywhere;
}
.quiz-steps {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}
.quiz-steps::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--quiz-progress, 0) * 100%);
  background: linear-gradient(90deg, #9ad24a, #5d9a2c);
  border-radius: inherit;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 0;
}
[dir=rtl] .quiz-steps::before { inset: 0 0 0 auto; }
.quiz-step { position: relative; z-index: 1; color: #d7e8c8; }
.quiz-step.is-current {
  background: #f3fbe8;
  color: #0c240e;
  box-shadow: none;
  animation: quiz-step-live 1.5s ease-in-out infinite;
}
.quiz-step.is-done { background: transparent; color: #fff; }
.quiz-x {
  border-radius: 50%;
  background: transparent;
  color: #f3fbe8;
  font-weight: 400;
}
.quiz-x:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.quiz-body { padding: 0 14px; }
.quiz-prompt-frame {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(100deg, #eaf6dc 0%, #f7fbf2 72%, #fff 100%);
  box-shadow: none;
  padding: 14px 16px;
}
.quiz-prompt-icon {
  display: inline-flex;
  flex: none;
  color: #537e36;
  margin-top: 1px;
}
.quiz-prompt-icon svg { width: 22px; height: 22px; }
.quiz-prompt {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.55;
  color: #236324;
}
.quiz-choice { animation: quiz-arrive 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
.quiz-choice:nth-child(2) { animation-delay: 0.05s; }
.quiz-choice:nth-child(3) { animation-delay: 0.1s; }
.quiz-choice:nth-child(4) { animation-delay: 0.15s; }
@keyframes quiz-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes quiz-step-live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(154, 210, 74, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(154, 210, 74, 0); }
}
.quiz-wait { animation: quiz-arrive 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
.quiz-choice {
  align-items: center;
  min-height: 54px;
  border: 1px solid #e0e8e2;
  border-radius: 13px;
  border-inline-start-width: 1px;
  background: #fff;
  padding: 11px 12px;
  color: #405137;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}
.quiz-choice:hover:not(:disabled) {
  background: #f7faf4;
  border-color: #abc696;
}
.quiz-choice-num {
  width: 28px;
  min-width: 28px;
  height: 28px;
  margin-top: 0;
  border-radius: 50%;
  clip-path: none;
  background: #eaf6dc;
  color: #236324;
  font-size: 12px;
  font-weight: 500;
}
.quiz-choice-text { font-size: 13px; font-weight: 400; line-height: 1.45; color: #405137; }
.quiz-choice.is-right { border-color: #88b75b; background: #f0f7eb; }
.quiz-choice.is-right .quiz-choice-num { background: #236324; color: #fff; }
.quiz-choice.is-wrong { border-color: #e7c8c4; background: #fff8f7; border-inline-start-color: #e7c8c4; }
.quiz-choice.is-wrong .quiz-choice-num { background: #a33932; color: #fff; }
.quiz-wait {
  border: 0;
  border-radius: 13px;
  background: #f3f7ee;
}
.quiz-result-ico {
  width: 36px;
  height: 36px;
  background: #fffefa;
  border: 1px solid #dce6d4;
}
.quiz-result-ico svg { width: 20px; height: 20px; }
.quiz-wait.ok .quiz-result-ico { background: #236324; border-color: #236324; color: #fff; }
.quiz-wait.no .quiz-result-ico { background: #fff; border-color: #e7c8c4; color: #a33932; }
.quiz-wait-label { font-weight: 500; font-size: 14px; color: #365f2b; }
.quiz-explain { font-weight: 400; font-size: 13px; line-height: 1.55; color: #687461; }
.quiz-wait.ok .quiz-explain, .quiz-wait.no .quiz-explain { color: #687461; }
.quiz-skip {
  border: 0;
  background: linear-gradient(145deg, #4cae3a 0%, #2f8a2c 42%, #1f6b24 100%);
  color: #fff;
  border-radius: 999px;
  min-height: 40px;
  padding: 10px 18px;
  box-shadow: 0 8px 18px rgba(31, 107, 36, 0.28);
  font: 800 0.95rem/1.2 Tajawal, "Segoe UI", Tahoma, sans-serif;
}
.quiz-skip:hover { filter: brightness(1.06); }
.quiz-later {
  background: none;
  color: #687461;
  font: 400 12px/1.4 system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
.quiz-later:hover { background: #f7faf4; }
.quiz-wait > .quiz-explain { flex: 1 0 100%; }
.quiz-challenge .quiz-result-ico,
.quiz-challenge.is-cancel .quiz-result-ico { width: 22px; height: 22px; background: transparent; border: 0; color: inherit; }
.quiz-pref { background: #fff; border: 1px solid #e0e8e2; border-radius: 999px; }
.quiz-pref-label { font-weight: 400; color: #687461; }
.quiz-switch.is-on { background: #537e36; }
