/* ============================================================
   مِسبار — التمارين · shot.css
   Real screenshots (ui.shot) + overlay marks + lightbox, and the
   image variants of the compare / spot / beforeafter / scenario types.
   The screenshot itself is never recoloured: it is shown exactly as captured,
   on a neutral frame that works in dark and light.
   ============================================================ */
#ex .ex-shot { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#ex .ex-shot-frame { position: relative; width: 100%; overflow: hidden; border-radius: 12px; background: #fff; border: 1px solid var(--ex-line2); box-shadow: var(--ex-sh); }
#ex .ex-shot-frame > img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
#ex .ex-shot-frame.has-max { max-height: var(--maxh); aspect-ratio: auto !important; }
#ex .ex-shot-frame.has-max > img { max-height: var(--maxh); width: auto; max-width: 100%; margin-inline: auto; }
#ex .ex-shot-frame.has-max .ex-shot-ov { display: none; }
#ex .ex-shot-frame.is-crop > img { position: absolute; width: var(--cw); height: auto; max-width: none; left: var(--cx); top: 0; transform: translateY(0); }
#ex .ex-shot-frame.is-crop > img { top: var(--cy); height: auto; }
#ex .ex-shot.is-missing .ex-shot-frame { display: grid; place-items: center; min-height: 120px; color: var(--ex-faint); background: var(--ex-s2); }

/* overlay: same coordinate space as the image (left/top/width/height in %) */
#ex .ex-shot-ov { position: absolute; inset: 0; pointer-events: none; }
#ex .ex-shot-ov > * { pointer-events: auto; }
#ex .ex-shot-mark { position: absolute; display: block; border-radius: 6px; box-sizing: border-box; }
#ex .ex-shot-mark.is-brand { outline: 2.5px solid #7C3AED; outline-offset: 2px; background: rgba(124,58,237,.10); }
#ex .ex-shot-mark.is-ok { outline: 2.5px solid #059669; outline-offset: 2px; background: rgba(5,150,105,.10); }
#ex .ex-shot-mark.is-close { outline: 2.5px dashed #D97706; outline-offset: 2px; background: rgba(217,119,6,.12); }
#ex .ex-shot-mark.is-danger { outline: 2.5px solid #DC2626; outline-offset: 2px; background: rgba(220,38,38,.10); }
#ex .ex-shot-mark.is-ghost { outline: none; background: transparent; }
#ex .ex-shot-n { position: absolute; top: -12px; left: -12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #7C3AED; color: #fff; font: 800 12px/1 inherit; font-style: normal; box-shadow: 0 0 0 2px #fff; }
#ex .ex-shot-mark.is-ok .ex-shot-n { background: #059669; }
#ex .ex-shot-mark.is-close .ex-shot-n { background: #B45309; }
#ex .ex-shot-mark.is-danger .ex-shot-n { background: #DC2626; }
#ex .ex-shot-lbl { position: absolute; top: calc(100% + 6px); left: 0; white-space: nowrap; font: 700 11px/1.4 inherit; font-style: normal; background: #111114; color: #fff; padding: 3px 7px; border-radius: 6px; }

/* zoom button (real <button>, top-left corner of the image) */
#ex .ex-shot-zoom { position: absolute; bottom: 8px; right: 8px; z-index: 6; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; border: 1px solid rgba(17,17,20,.14); background: rgba(255,255,255,.92); color: #111114; cursor: zoom-in; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
#ex .ex-shot-zoom:hover { background: #fff; }
#ex .ex-shot-zoom:focus-visible { outline: 2px solid #7C3AED; outline-offset: 2px; }

/* caption: product · page · date · source · licence */
#ex .ex-shot-cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 12.5px; line-height: 1.6; color: var(--ex-mut); }
#ex .ex-shot-cap b { color: var(--ex-ink); font-weight: 800; }
#ex .ex-shot-cap .ex-shot-sep { color: var(--ex-faint); }
#ex .ex-shot-meta { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; flex-basis: 100%; font-size: 11.5px; color: var(--ex-faint); }
#ex .ex-shot-meta a { color: var(--ex-vio); text-decoration: underline; text-underline-offset: 2px; }
#ex .ex-shot-cap.is-short { font-size: 12px; }

/* lightbox */
#ex .ex-lb { position: fixed; inset: 0; z-index: 400; background: rgba(6,6,9,.97); display: flex; flex-direction: column; padding: 12px; gap: 10px; }
html.light #ex .ex-lb { background: rgba(24,16,48,.96); }
#ex .ex-lb-bar { display: flex; align-items: center; gap: 10px; color: #fff; }
#ex .ex-lb-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
#ex .ex-lb-t b { font-weight: 800; }
#ex .ex-lb-t span { font-size: 13px; color: #D2D2DA; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ex .ex-lb-x, #ex .ex-lb-fit { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #fff; font: 700 13px/1 inherit; cursor: pointer; }
#ex .ex-lb-x:hover, #ex .ex-lb-fit:hover { background: rgba(255,255,255,.16); }
#ex .ex-lb-scroll { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; border-radius: 12px; }
#ex .ex-lb-scroll img { max-width: 100%; max-height: 100%; width: auto; height: auto; background: #fff; border-radius: 8px; }
#ex .ex-lb.is-full .ex-lb-scroll { place-items: start; }
#ex .ex-lb.is-full .ex-lb-scroll img { max-width: none; max-height: none; width: auto; }
#ex .ex-lb .ex-shot-cap { color: #D2D2DA; }
#ex .ex-lb .ex-shot-cap b { color: #fff; }
#ex .ex-lb .ex-shot-meta { color: #A3A3AF; }
#ex .ex-lb .ex-shot-meta a { color: #C4B5FD; }
html.ex-lb-open, html.ex-lb-open body { overflow: hidden; }

/* ---------- compare with images ---------- */
#ex .cmp-mock.is-shot { padding: 0; background: none; display: block; }
#ex .cmp-mock.is-shot .ex-shot-frame { max-height: none; }
#ex .cmp-duo.has-c { grid-template-columns: 1fr; }
@media (min-width: 980px) { #ex .cmp-duo.has-c { grid-template-columns: repeat(3, minmax(0, 1fr)); } #ex .cmp-duo.has-c .cmp-vs { display: none; } }

/* ---------- spot on a screenshot ---------- */
#ex .sp-mock.is-shot { padding: 0; background: none; border: 0; }
#ex .sp-shot-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
#ex .sp-shot-scroll > .ex-shot { min-width: var(--sp-minw, 0px); }
#ex .sp-mock.is-shot [data-spot] { position: absolute; border-radius: 6px; }
#ex .sp-mock.is-shot [data-spot] > .sp-hit { border-radius: 8px; border-width: 2.5px; }
#ex .sp-mock.is-shot [data-spot].is-clean > .sp-hit { border: 1.5px dashed rgba(17,17,20,.38); }
#ex .sp-layout.is-shot { grid-template-columns: minmax(0, 1fr); }
/* screenshots need the full width; the find/review panel sits under the image */
#ex .sp-layout.is-shot .sp-mockcol { position: static; }
#ex .sp-layout.is-shot .sp-panel { max-width: 760px; }
#ex .sp-layout.is-shot .sp-mockcol { justify-items: stretch; min-width: 0; top: 96px; }
#ex .sp-layout.is-shot .sp-mock { width: 100%; }
#ex .sp-zoom.is-shot { padding: 0; background: #fff; overflow: hidden; border-radius: 10px; }
#ex .sp-zoom.is-shot .ex-shot-cap { display: none; }
#ex .sp-measure { margin-top: 8px; font-size: 13px; color: var(--ex-mut); }
#ex .sp-measure b { color: var(--ex-ink); font-weight: 800; }
#ex .sp-rev small.sp-why { display: block; margin-top: 2px; }

/* ---------- beforeafter with screenshots ---------- */
#ex .ba-frame.is-shot { aspect-ratio: var(--ar); width: 100%; max-width: none; height: auto; border-radius: 12px; background: #fff; }
#ex .ba-frame.is-shot .ba-layer { position: absolute; inset: 0; }
#ex .ba-frame.is-shot .ba-layer > img { display: block; width: 100%; height: 100%; object-fit: contain; }
#ex .ba-frame.is-shot [data-chg] { position: absolute; border-radius: 6px; pointer-events: none; }
#ex .ba-frame.is-shot [data-chg].is-hl { outline: 3px solid #7C3AED; outline-offset: 2px; background: rgba(124,58,237,.12); }
#ex .ba-layout.is-shot { grid-template-columns: 1fr; }
@media (min-width: 1100px) { #ex .ba-layout.is-shot { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); } }
#ex .ba-src { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ex-s2); border: 1px solid var(--ex-line); font-size: 13px; line-height: 1.7; }
#ex .ba-src q { display: block; font-style: normal; color: var(--ex-body); direction: ltr; text-align: left; }
#ex .ba-src a { color: var(--ex-vio); text-decoration: underline; font-size: 12px; overflow-wrap: anywhere; }
#ex .ba-caps { display: grid; gap: 8px; margin-top: 10px; }
@media (min-width: 700px) { #ex .ba-caps { grid-template-columns: 1fr 1fr; } }

/* ---------- scenario evidence gallery ---------- */
#ex .ext-scenario .scn-ev-wrap.has-screen:has(.scn-ev-shot) { grid-template-columns: minmax(0, 1fr); }
#ex .ext-scenario .scn-ev-shot { width: 100%; justify-self: stretch; min-width: 0; }
#ex .ext-scenario .scn-ev--screen:has(.scn-ev-shot) { padding: 12px 12px 14px; }

/* ---------- principle sources (engine stage 5) ---------- */
#ex .ex-sources { margin-top: 18px; display: grid; gap: 8px; }
#ex .ex-sources li { list-style: none; padding: 10px 12px; border-radius: 10px; background: var(--ex-s2); border: 1px solid var(--ex-line); font-size: 13px; }
#ex .ex-sources q { display: block; font-style: normal; color: var(--ex-body); direction: ltr; text-align: left; }
#ex .ex-sources a { color: var(--ex-vio); text-decoration: underline; font-size: 12px; overflow-wrap: anywhere; }
#ex .ex-measured { margin-top: 14px; width: 100%; border-collapse: collapse; font-size: 13px; }
#ex .ex-measured th, #ex .ex-measured td { padding: 8px 10px; border-bottom: 1px solid var(--ex-line); text-align: start; vertical-align: top; }
#ex .ex-measured th { color: var(--ex-mut); font-weight: 700; }
#ex .ex-measured .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-inline-end: 6px; border: 1px solid rgba(0,0,0,.2); }
#ex .ex-measured .is-fail { color: var(--ex-danger); font-weight: 800; }
#ex .ex-measured .is-pass { color: var(--ex-ok); font-weight: 800; }
#ex .ex-table-wrap { overflow-x: auto; }
#ex .ex-real-shot { margin-top: 10px; max-width: 520px; }
#ex .ex-intro-art.is-shot { padding: 0; background: none; overflow: hidden; }
#ex .ex-intro-art.is-shot .ex-shot-frame { border-radius: inherit; }
#ex .ex-intro-art.is-shot, #ex .ex-nextcard-art.is-shot { aspect-ratio: auto; padding: 0; border: 0; background: none; overflow: visible; }
#ex .ex-intro-art.is-shot .ex-shot-cap { margin-top: 2px; }
#ex .ex-nextcard-art.is-shot .ex-shot-frame { border-radius: 10px; }
#ex .ex-shot-zoom { z-index: 6; }
/* spot on a screenshot: keep the image inside its column; wide/thin shots scroll sideways */
#ex .sp-layout.is-shot .sp-mockcol { grid-template-columns: minmax(0, 1fr); }
#ex .sp-mock.is-shot, #ex .sp-shot-scroll { min-width: 0; max-width: 100%; }
#ex .sp-layout.is-stack { grid-template-columns: minmax(0, 1fr) !important; }
#ex .sp-layout.is-stack .sp-mockcol { position: static; }
#ex .sp-shot-scroll:focus-visible { outline: 2px solid var(--ex-vio); outline-offset: 3px; }
/* wide shots scroll from the image's own left edge (screenshots are LTR pages) */
#ex .sp-shot-scroll { direction: ltr; }
#ex .sp-shot-scroll .ex-shot-cap { direction: rtl; }
/* thin strips: sideways scroller on narrow screens + zoom button outside the image */
#ex .ex-shot-scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
#ex .ex-shot-scroller:focus-visible { outline: 2px solid var(--ex-vio); outline-offset: 3px; }
#ex .ex-shot-wide { min-width: 880px; }
#ex .ex-shot-zoom.is-out { position: static; width: auto; height: 34px; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; align-self: flex-start; font: 700 12.5px/1 inherit; border-color: var(--ex-line2); background: var(--ex-s2); color: var(--ex-ink); box-shadow: none; }

/* ================= player v3 (2026-11-24): the screenshot is the hero =================
   Owner feedback: screenshots were tiny while half the screen was empty. Rules below give
   every task screenshot the width of the (now 1400px) task stage, capped by viewport height
   where two must be seen together, and keep overlays aligned (the frame keeps the ratio). */
#ex .ex-task .ex-shot-frame:not(.is-crop) { max-width: calc(var(--shot-h, 72vh) * var(--arn, 1.6)); margin-inline: auto; }
#ex .ex-task .ex-shot.is-mobile .ex-shot-frame { --shot-h: 78vh; }
/* spot / thin strips / before-after: the full width, no height cap (hotspots scale with it) */
#ex .ex-task .sp-shot-scroll .ex-shot-frame, #ex .ex-task .ex-shot-wide .ex-shot-frame, #ex .ex-task .sp-mock .ex-shot-frame { --shot-h: 1000vh; }
#ex .ex-task .ex-shot-cap { justify-content: center; }
#ex .ex-task .ex-shot-cap .ex-shot-meta { flex-basis: auto; }
/* zoom button: bigger + labelled, always reachable */
#ex .ex-task .ex-shot-zoom:not(.is-out) { width: auto; height: 38px; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; font: 800 12.5px/1 inherit; }
#ex .ex-task .ex-shot-zoom:not(.is-out)::after { content: "تكبير"; }

/* ---------- compare: two big screenshots ---------- */
#ex .ext-compare { gap: 16px; }
#ex .ext-compare .cmp-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px 20px; }
#ex .ext-compare .cmp-head .ex-eyebrow { grid-column: 1 / -1; }
#ex .ext-compare .cmp-q-t { max-width: 70ch; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.5; }
#ex .ext-compare .cmp-steps { margin: 0; flex-wrap: nowrap; }
#ex .ext-compare .cmp-steps li { height: 30px; font-size: 12.5px; white-space: nowrap; }
@media (max-width: 899px) { #ex .ext-compare .cmp-head { grid-template-columns: 1fr; } #ex .ext-compare .cmp-steps { flex-wrap: wrap; } }

#ex .ext-compare .cmp-duo.has-shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
#ex .ext-compare .cmp-duo.has-shots.has-c { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#ex .ext-compare .cmp-duo.has-shots .cmp-vs { display: none; }
#ex .ext-compare .cmp-duo.is-rows { grid-template-columns: minmax(0, 1fr); }
#ex .ext-compare .cmp-duo.has-shots .cmp-opt { grid-template-rows: auto auto auto auto; gap: 10px; padding: 10px 10px 12px; border-radius: 18px; }
#ex .ext-compare .cmp-duo.has-shots .cmp-opt-top { min-height: 0; gap: 8px; }
#ex .ext-compare .cmp-duo.has-shots .cmp-letter { width: 26px; height: 26px; border-radius: 8px; font-size: 13.5px; }
#ex .ext-compare .cmp-duo.has-shots .cmp-opt-t { font-size: 14px; }
#ex .ext-compare .cmp-duo.has-shots .cmp-mock.is-shot { display: block; padding: 0; border-radius: 12px; background: none; }
#ex .ext-compare .cmp-duo.has-shots .cmp-pickbtn { min-height: 46px; }
#ex .ext-compare .cmp-duo.is-rows .cmp-opt { grid-template-columns: minmax(0, 1fr) 220px; grid-template-rows: auto auto auto; column-gap: 16px; }
#ex .ext-compare .cmp-duo.is-rows .cmp-opt > * { grid-column: 1; }
#ex .ext-compare .cmp-duo.is-rows .cmp-opt > .cmp-pickbtn { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
#ex .ext-compare .cmp-duo.is-rows .cmp-opt > .cmp-notes:not([hidden]) { grid-column: 2; grid-row: 1 / span 3; align-self: center; }

/* A/B switcher + swipe track (tablet / phone) */
#ex .ext-compare .cmp-switch { display: none; gap: 6px; padding: 4px; border-radius: 14px; background: var(--ex-s2); border: 1px solid var(--ex-line); position: sticky; top: 8px; z-index: 8; }
#ex .ext-compare .cmp-sw { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 0; background: transparent; color: var(--ex-mut); font: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; }
#ex .ext-compare .cmp-sw b { width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--ex-s3); color: var(--ex-ink); }
#ex .ext-compare .cmp-sw span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#ex .ext-compare .cmp-sw[aria-pressed="true"] { background: var(--ex-s); color: var(--ex-ink); box-shadow: var(--ex-sh); }
#ex .ext-compare .cmp-sw[aria-pressed="true"] b { background: var(--ex-vio); color: var(--ex-on); }
@media (max-width: 1099px) {
  #ex .ext-compare:has(.cmp-duo.has-shots) .cmp-switch { display: flex; }
  #ex .ext-compare .cmp-duo.has-shots { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; gap: 12px; padding-bottom: 2px; }
  #ex .ext-compare .cmp-duo.has-shots::-webkit-scrollbar { display: none; }
  #ex .ext-compare .cmp-duo.has-shots > .cmp-opt { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
  #ex .ext-compare .cmp-duo.is-rows .cmp-opt { grid-template-columns: minmax(0, 1fr); }
  #ex .ext-compare .cmp-duo.is-rows .cmp-opt > .cmp-pickbtn, #ex .ext-compare .cmp-duo.is-rows .cmp-opt > .cmp-notes:not([hidden]) { grid-column: 1; grid-row: auto; }
}

/* questions: one compact panel under the screenshots, two columns on wide screens */
#ex .ext-compare .cmp-flow { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 14px; align-items: start; }
#ex .ext-compare .cmp-flow .cmp-q { padding: 16px 18px; gap: 10px; }
#ex .ext-compare .cmp-flow .cmp-choice { min-height: 46px; padding: 9px 14px; font-size: 14.5px; }
#ex .ext-compare .cmp-flow .cmp-submit { grid-column: 1 / -1; }

/* ---------- spot: huge screenshot; ≥1500px the panel moves to the side ---------- */
@media (min-width: 1500px) {
  #ex .sp-layout.is-shot:not(.is-stack) { grid-template-columns: 340px minmax(0, 1fr) !important; gap: 20px; }
  #ex .sp-layout.is-shot:not(.is-stack) .sp-panel { order: -1; }
  #ex .sp-layout.is-shot:not(.is-stack) .sp-panel { position: sticky; top: 16px; max-height: calc(100vh - 130px); overflow: auto; }
}
#ex .sp-layout.is-shot .sp-panel { max-width: none; }

/* ---------- before/after: big frame, narrower side panel ---------- */
@media (min-width: 1100px) { #ex .ba-layout.is-shot { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 22px; } }

/* lightbox v3: zoom levels + pan */
#ex .ex-lb-zoom { display: inline-flex; align-items: center; gap: 4px; }
#ex .ex-lb-zoom .ex-lb-fit { font-size: 20px; min-width: 44px; padding: 0; }
#ex .ex-lb-zoom .ex-lb-fit:disabled { opacity: .35; cursor: default; }
#ex .ex-lb-lvl { min-width: 84px; text-align: center; color: #fff; font: 800 13px/1 inherit; }
#ex .ex-lb-scroll img { cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
#ex .ex-lb.is-full .ex-lb-scroll { place-items: start; cursor: grab; }
#ex .ex-lb.is-full .ex-lb-scroll img { max-width: none; max-height: none; height: auto; cursor: zoom-out; margin: auto; }
#ex .ex-lb.is-drag .ex-lb-scroll, #ex .ex-lb.is-drag .ex-lb-scroll img { cursor: grabbing; }
/* never let a long label or the swipe track widen the task column (phones) */
#ex .ex-player, #ex .ex-task, #ex .ext-compare { grid-template-columns: minmax(0, 1fr); }
#ex .ext-compare .cmp-switch { min-width: 0; overflow: hidden; }
#ex .ext-compare .cmp-sw span { flex: 1 1 0; width: 0; text-align: start; }
/* wide strips on tablet/phone: no swipe track; each strip keeps a readable width and scrolls sideways */
@media (max-width: 1099px) {
  #ex .ext-compare:has(.cmp-duo.is-rows) .cmp-switch { display: none; }
  #ex .ext-compare .cmp-duo.has-shots.is-rows { display: grid; overflow: visible; grid-template-columns: minmax(0, 1fr); }
  #ex .ext-compare .cmp-duo.is-rows .cmp-mock.is-shot { overflow-x: auto; -webkit-overflow-scrolling: touch; direction: ltr; display: flex; justify-content: flex-start; place-items: normal; }
  #ex .ext-compare .cmp-duo.is-rows .cmp-mock.is-shot > .ex-shot { flex: none; }
  #ex .ext-compare .cmp-duo.is-rows .cmp-mock.is-shot .ex-shot { min-width: 760px; }
  #ex .ext-compare .cmp-duo.is-rows .cmp-mock.is-shot .ex-shot-cap { direction: rtl; justify-content: flex-start; }
}
