/* ============================================================
   مِسبار — التمارين · celebrate.css — full-screen ORBIT celebration (celebrate.js).
   The space scene is ALWAYS dark by design (also in html.light), so every colour here is fixed,
   not an #ex token: text is near-white / lavender on #05030F-ish space (AA ≥ 7:1).
   Opacity is driven by the frame loop (deterministic); CSS only handles the reduced-motion + skip fades.
   ============================================================ */
#ex .cel {
  position: fixed; inset: 0; z-index: 240; /* above the lesson (150) + its sheets (161), under the fx layer (260) */
  background: #06030F; color: #F5F3FF; overflow: hidden; opacity: 0;
  cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; user-select: none; -webkit-user-select: none;
  contain: strict;
}
#ex .cel.is-reduced { transition: opacity .42s ease; }
#ex .cel.is-skip { transition: opacity .2s ease; }
/* .is-out (the dissolve) keeps catching pointers on purpose: a tap there finishes the dissolve instead of
   landing on «كمّل» of an end screen that is still hidden under the overlay */
/* level-up bloom: a composited layer, only its opacity changes (driven by the frame loop) */
#ex .cel-flash {
  position: absolute; inset: 0; z-index: 1; opacity: 0; pointer-events: none; will-change: opacity;
  background: radial-gradient(circle at 50% var(--cel-fy, 37%), rgba(237,233,254,.7) 0, rgba(167,139,250,.34) 22%, rgba(124,58,237,.12) 48%, rgba(124,58,237,0) 75%);
}
#ex .cel-tx, #ex .cel-skip { z-index: 2; }
#ex .cel-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#ex .cel-tx {
  position: absolute; inset-inline: 0; top: var(--cel-ty, 62vh);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 18px 16px 0; pointer-events: none;
}
/* a soft dark pool under the copy so a ring or a glow passing behind it never lowers the contrast */
#ex .cel-tx::before {
  content: ""; position: absolute; z-index: -1; inset: -40px -10% -60px;
  background: radial-gradient(60% 70% at 50% 55%, rgba(5,3,14,.78), rgba(5,3,14,0) 72%);
}
#ex .cel-tx > * { margin: 0; opacity: 0; will-change: opacity, transform; }
#ex .cel.is-reduced .cel-tx > * { opacity: 1; }
#ex .cel-eyebrow {
  font-size: 13px; font-weight: 800; line-height: 1.6; color: #DDD6FE;
  padding: 3px 14px; border-radius: 99px; background: rgba(139,92,246,.22); border: 1px solid rgba(196,181,253,.32);
}
#ex .cel-h {
  font-size: clamp(32px, 4.6vw, 60px); line-height: 1.22; font-weight: 900; color: #FFFFFF; letter-spacing: -.005em;
  text-shadow: 0 0 22px rgba(167,139,250,.55), 0 2px 18px rgba(5,3,14,.9);
  margin-bottom: 4px;
}
#ex .cel-title { max-width: 36ch; font-size: clamp(15px, 1.4vw, 19px); line-height: 1.6; font-weight: 700; color: #DDD6FE; }
#ex .cel-xp { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-weight: 800; color: #DDD6FE; font-size: 15px; }
#ex .cel-xp b {
  font-size: clamp(28px, 3vw, 40px); line-height: 1.2; font-weight: 900; color: #F5F3FF; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(196,181,253,.6);
}
#ex .cel-chip {
  max-width: min(92vw, 560px); font-size: 14px; line-height: 1.6; font-weight: 700; color: #F5F3FF;
  padding: 6px 16px; border-radius: 99px; background: rgba(124,58,237,.32); border: 1px solid rgba(196,181,253,.4);
  box-shadow: 0 0 24px rgba(139,92,246,.35);
}
#ex .cel-skip {
  position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 14px;
  min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 99px; border: 1px solid rgba(237,233,254,.22); background: rgba(255,255,255,.07);
  color: #EDE9FE; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
#ex .cel-skip:hover { background: rgba(255,255,255,.13); }
#ex .cel-skip:focus-visible { outline: 2px solid #C4B5FD; outline-offset: 3px; }
#ex .cel-skip kbd {
  font: inherit; font-size: 11.5px; font-weight: 700; line-height: 1; padding: 4px 6px; border-radius: 6px;
  color: #DDD6FE; background: rgba(255,255,255,.08); border: 1px solid rgba(237,233,254,.2);
}
@media (pointer: coarse), (max-width: 720px) { #ex .cel-skip kbd { display: none; } }

/* the camera lands on the first end screen */
#ex .ls-done.is-from-cel { animation: cel-land .62s cubic-bezier(.2,.8,.2,1) both; }
@keyframes cel-land { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  #ex .ls-done.is-from-cel { animation: cel-fade .4s ease both; }
}
@keyframes cel-fade { from { opacity: 0; } to { opacity: 1; } }
