/* The question card. Class prefix qz-. Right to left; uses only variables from tokens.css (and --font-text / --font-ui). */
.qz-root, .qz-root * { box-sizing: border-box; }
.qz-root [hidden] { display: none !important; }
.qz-root {
  --qz-text: var(--font-text, "Amiri", "Geeza Pro", serif);
  --qz-ui: var(--font-ui, "IBM Plex Sans Arabic", system-ui, sans-serif);
  position: absolute; inset: 0; z-index: 40;
  display: grid; place-items: center;
  padding: clamp(6px, 1.6vh, 22px) clamp(8px, 2vw, 30px);
  overflow: hidden; direction: rtl; text-align: right;
  font-family: var(--qz-ui); font-size: var(--size-body); color: var(--ink);
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.qz-card {
  width: min(1100px, 100%); height: min(100%, 740px);
  display: flex; flex-direction: column; gap: clamp(6px, 1.3vh, 14px);
  padding: clamp(8px, 1.6vh, 20px) clamp(12px, 2vw, 28px);
  background: var(--cream); border: var(--outline); border-radius: var(--radius-l);
  box-shadow: var(--shadow-sticker), var(--shadow-soft);
  animation: qz-rise 0.4s var(--pop) both; overflow: hidden;
}

/* header */
.qz-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-height: 40px; padding-left: 56px; }  /* room for the shell's pause button */
.qz-label {
  padding: 3px 16px; background: var(--turquoise); border: 3px solid var(--ink); border-radius: 999px;
  font-weight: 800; font-size: clamp(16px, 2.4vh, 20px); line-height: 1.3;
}
.qz-type { padding: 3px 14px; background: var(--lilac); border: 3px solid var(--ink); border-radius: 999px; font-weight: 700; font-size: clamp(14px, 2.1vh, 18px); }
.qz-spacer { flex: 1 1 auto; }
.qz-rule-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 16px;
  font: inherit; font-weight: 800; font-size: clamp(15px, 2.3vh, 19px); color: var(--ink);
  background: var(--butter); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); cursor: pointer;
}
.qz-rule-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.qz-rule {
  flex: 0 1 auto; max-height: 34%; overflow-y: auto; padding: 8px 16px;
  background: var(--butter); border: 3px solid var(--ink); border-radius: var(--radius-m);
  font-family: var(--qz-text); font-size: clamp(18px, 2.8vh, 24px); line-height: 1.5;
  animation: qz-pop 0.25s var(--pop) both;
}
.qz-rule-h { display: block; font-family: var(--qz-ui); font-size: 0.8em; color: var(--orchid-deep); }
.qz-rule-list { margin: 2px 0 0; padding: 0 1.2em 0 0; }
.qz-warn { color: var(--rose-deep); font-weight: 700; list-style: "⚠️ "; }

/* body */
.qz-main { flex: 1 1 auto; min-height: 0; display: flex; gap: clamp(6px, 1.2vw, 16px); align-items: stretch; }
.qz-guide { flex: 0 0 auto; display: flex; align-items: flex-end; pointer-events: none; }
.qz-guide-img { display: block; height: min(100%, 340px); max-height: 100%; width: auto; max-width: 18vw; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 0 rgba(59, 30, 84, 0.2)); }
.qz-body {
  flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 1.8vh, 20px);
  padding: clamp(8px, 1.6vh, 20px) clamp(10px, 2vw, 24px);
  background: var(--paper); border: 3px solid var(--lilac); border-radius: var(--radius-m); outline: none;
}
.qz-body > * { flex: 0 0 auto; }
.qz-q { margin: 0; width: 100%; text-align: center; font-weight: 800; font-size: clamp(20px, 3.2vh, 30px); line-height: 1.45; color: var(--orchid-deep); }

/* the sentence */
.qz-sentence {
  margin: 0; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.15em 0.4em;
  font-family: var(--qz-text); font-size: clamp(30px, 6.2vh, 56px); line-height: 1.7; direction: rtl;
}
.qz-w { font: inherit; color: var(--ink); padding: 0 0.1em; background: none; border: 0; }
.qz-target { color: var(--rose-deep); text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 0.18em; font-weight: 700; }
.qz-blank {
  display: inline-block; min-width: 2.4em; height: 1.1em; vertical-align: middle; margin: 0 0.1em;
  border: 3px dashed var(--ink-soft); border-radius: var(--radius-s); background: var(--lilac); text-align: center; line-height: 1.1;
}
.qz-blank.qz-filled { min-width: 0; padding: 0 0.4em; border-style: solid; border-color: var(--turquoise-deep); background: var(--mint); }
.qz-taps .qz-w {
  min-height: var(--tap); padding: 0 0.45em; cursor: pointer; line-height: 1.4;
  background: var(--cream); border: var(--outline); border-radius: var(--radius-m); box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s;
}
.qz-taps .qz-w:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.qz-taps .qz-w:disabled { cursor: default; }

/* choices */
.qz-choices { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 1.6vh, 16px); }
.qz-choice {
  position: relative; flex: 1 1 14em; max-width: 100%; min-height: clamp(56px, 9.5vh, 84px); padding: 6px 18px 6px 40px;
  font-family: var(--qz-text); font-weight: 700; font-size: clamp(24px, 4.4vh, 38px); line-height: 1.4; color: var(--ink); text-align: center;
  background: var(--cream); border: var(--outline); border-radius: var(--radius-m); box-shadow: 0 5px 0 var(--ink);
  cursor: pointer; touch-action: manipulation; transition: transform 0.08s;
}
.qz-n2 .qz-choice { flex-basis: 12em; }
.qz-n4 .qz-choice { flex-basis: 45%; }
.qz-choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.qz-choice:disabled { cursor: default; }
.qz-key { position: absolute; left: 10px; top: 8px; font-family: var(--qz-ui); font-size: 15px; font-weight: 700; color: var(--ink-soft); opacity: 0.75; }
.qz-choice-t { display: block; }
.qz-picked { background: var(--lilac); }                       /* placement: no right or wrong colour */
.qz-right { background: var(--mint) !important; opacity: 1; animation: qz-yes 0.45s var(--pop); }
.qz-shown { background: var(--mint) !important; opacity: 1; outline: 4px dashed var(--turquoise-deep); outline-offset: 2px; }
.qz-wrong { background: var(--butter); opacity: 0.7; text-decoration: line-through; text-decoration-thickness: 3px; }   /* never red */
.qz-shake { animation: qz-nope 0.35s; }

/* irab */
.qz-chain { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; min-height: 0; }
.qz-chip {
  padding: 2px 14px; background: var(--mint); border: 3px solid var(--ink); border-radius: 999px;
  font-family: var(--qz-text); font-weight: 700; font-size: clamp(18px, 3.2vh, 28px); line-height: 1.5; animation: qz-pop 0.3s var(--pop) both;
}
.qz-chip-shown { background: var(--butter); border-style: dashed; }
.qz-arrow { font-family: var(--qz-ui); font-weight: 900; color: var(--orchid-deep); font-size: clamp(18px, 3vh, 26px); }
.qz-step { width: 100%; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1.4vh, 14px); }
.qz-step-n { font-weight: 700; font-size: clamp(14px, 2vh, 18px); color: var(--ink-soft); }
.qz-step-q { margin: 0; font-weight: 800; font-size: clamp(20px, 3.2vh, 30px); text-align: center; line-height: 1.45; }
.qz-full {
  width: 100%; padding: 10px 18px; text-align: center; background: var(--lilac); border: var(--outline); border-radius: var(--radius-m);
  animation: qz-pop 0.35s var(--pop) both;
}
.qz-full-h { display: block; font-size: clamp(15px, 2.2vh, 19px); color: var(--orchid-deep); }
.qz-full-t { margin: 2px 0 0; font-family: var(--qz-text); font-weight: 700; font-size: clamp(22px, 3.8vh, 34px); line-height: 1.6; }

/* feedback and the continue button */
.qz-foot { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; min-height: 0; }
.qz-fb {
  flex: 1 1 auto; min-width: 0; max-height: 24vh; overflow-y: auto; margin: 0; padding: 0;
  font-weight: 700; font-size: clamp(16px, 2.6vh, 24px); line-height: 1.5;
}
.qz-fb:empty { display: none; }
.qz-fb-right, .qz-fb-wrong, .qz-fb-shown { padding: 6px 16px; border: 3px solid var(--ink); border-radius: var(--radius-s); }
.qz-fb-right { background: var(--mint); }
.qz-fb-wrong, .qz-fb-shown { background: var(--butter); }
.qz-pop { animation: qz-pop 0.3s var(--pop); }
.qz-go {
  flex: 0 0 auto; margin-inline-start: auto; min-width: 170px; min-height: clamp(56px, 9vh, 76px); padding: 6px 28px;
  font: inherit; font-weight: 900; font-size: clamp(22px, 3.6vh, 32px); color: var(--ink);
  background: var(--gold); border: var(--outline); border-radius: var(--radius-m); box-shadow: var(--shadow-sticker);
  cursor: pointer; animation: qz-pulse 1.4s ease-in-out infinite;
}
.qz-go:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.qz-go:focus-visible, .qz-choice:focus-visible, .qz-rule-btn:focus-visible, .qz-w:focus-visible { outline: 4px solid var(--turquoise); outline-offset: 2px; }

@keyframes qz-rise { from { opacity: 0; transform: translateY(22px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes qz-pop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes qz-nope { 0%, 100% { transform: none; } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes qz-yes { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes qz-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) {
  .qz-root *, .qz-root *::before, .qz-root *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .qz-go { outline: 4px solid var(--gold-deep); }
}

/* short windows: laptop 1000x560, phone landscape 932x430 */
@media (max-height: 620px) {
  .qz-guide-img { max-width: 12vw; height: min(100%, 200px); }
  .qz-key { display: none; }
  .qz-choice { padding-left: 18px; }
}
@media (max-height: 500px) {
  .qz-guide { display: none; }
  .qz-head { min-height: 36px; }
  .qz-label, .qz-type { padding-top: 0; padding-bottom: 0; }
  .qz-rule-btn { min-height: 38px; }
  .qz-card { gap: 6px; padding-top: 6px; padding-bottom: 8px; }
  .qz-n4 .qz-choice { flex-basis: 30%; }
}
