/* «إحساس دروسي» (١٠ نوفمبر ٢٠٢٦) — الحركة اللي ترافق assets/feel.js. html.fxCalm (إعداد «الحركة» مطفي أو «تقليل الحركة» في الجهاز) يطفيها كلها. */
:root { --fx-spring: cubic-bezier(.34, 1.56, .64, 1); --fx-out: cubic-bezier(.22, 1, .36, 1); --fx-ok: #1f8a57; --fx-no: #c2412d; }

/* ١) أزرار الإجابة: تنضغط تحت الإصبع، الصح ينبض وتنرسم علامته، والغلط يهتز، والباقي يخفت */
html:not(.fxCalm) .lesson-quiz-option, html:not(.fxCalm) .challenge-options button, html:not(.fxCalm) .truefalse-buttons button, html:not(.fxCalm) .match-grid button { transition: transform .12s ease, opacity .35s, box-shadow .2s; }
.lesson-quiz-option:active:not(:disabled), .challenge-options button:active:not(:disabled), .truefalse-buttons button:active:not(:disabled), .match-grid button:active:not(:disabled) { transform: scale(.975); }
html:not(.fxCalm) .lesson-quiz-option.ok, html:not(.fxCalm) .challenge-options button.ok, html:not(.fxCalm) .truefalse-buttons button.ok, html:not(.fxCalm) .match-grid button.ok { animation: fxOk .55s var(--fx-spring); }
html:not(.fxCalm) .lesson-quiz-option.no, html:not(.fxCalm) .challenge-options button.no, html:not(.fxCalm) .truefalse-buttons button.no, html:not(.fxCalm) .match-grid button.no { animation: fxNo .45s cubic-bezier(.36, .07, .19, .97); }
.lesson-quiz-option:disabled:not(.ok):not(.no) { opacity: .5; }
.lesson-quiz-option.ok { position: relative; }
.lesson-quiz-option.ok::after {
  content: ""; position: absolute; inset-inline-end: 12px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  background: var(--fx-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center/16px no-repeat;
}
html:not(.fxCalm) .lesson-quiz-option.ok::after { animation: fxTick .45s .08s var(--fx-spring) both; }
@keyframes fxOk { 35% { transform: scale(1.04); } }
@keyframes fxNo { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes fxTick { from { transform: scale(0); } }
/* الشرح بعد الإجابة ينزلق */
html:not(.fxCalm) #lqFb > * { animation: fxUp .4s var(--fx-out); }
@keyframes fxUp { from { opacity: 0; transform: translateY(14px); } }

/* ٢) كائنك فوق الأسئلة */
.lesson-quiz-head { position: relative; }
.fxPal { position: relative; display: inline-grid; width: 44px; height: 44px; flex: none; margin-inline-start: 8px; vertical-align: middle; }
.fxPal canvas { width: 44px; height: 44px; border-radius: 50%; background: #081a16; box-shadow: 0 0 0 2px rgba(233, 196, 106, .5); }
html:not(.fxCalm) .fxPal canvas { transition: filter .4s, box-shadow .4s; }
html:not(.fxCalm) .fxPal.fxJump canvas { animation: fxJump .7s var(--fx-spring); }
.fxPal.fxSad canvas { filter: saturate(.25) brightness(.8); }
html:not(.fxCalm) .fxPal.fxSad canvas { animation: fxSad 1s ease; }
.fxPal.fxFire canvas { box-shadow: 0 0 0 3px #ff9b54, 0 0 16px 5px rgba(255, 120, 40, .5); }
@keyframes fxJump { 30% { transform: translateY(-12px) scale(1.12, .92); } 55% { transform: scale(.94, 1.08); } 75% { transform: translateY(-4px); } }
@keyframes fxSad { 30% { transform: translateY(4px) scale(.94); } }
.fxBub { position: absolute; top: 2px; inset-inline-end: 52px; white-space: nowrap; z-index: 3; pointer-events: none;
  background: var(--ad-card, #fff); color: var(--ad-ink, #12302a); font: 700 12px/1.4 inherit; padding: 5px 10px; border-radius: var(--r-lg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .14); opacity: 0; transform: scale(.6); }
html:not(.fxCalm) .fxBub { transition: opacity .25s, transform .4s var(--fx-spring); }
.fxBub.on { opacity: 1; transform: none; }

/* ٣) الانتقال بين الصفحات + الشريط السفلي */
html:not(.fxCalm) #xv.fxIn { animation: fxPage .42s var(--fx-out); }
@keyframes fxPage { from { opacity: 0; transform: translateX(calc(var(--fxd, 0) * -28px)); } }
html:not(.fxCalm) #bNav a.fxPop svg, html:not(.fxCalm) #bNav a.fxPop i, html:not(.fxCalm) #bNav a.fxPop img { animation: fxNav .45s var(--fx-spring); }
@keyframes fxNav { 40% { transform: translateY(-3px) scale(1.18); } }

/* ٤) الإشعار ينسحب */
.toast { touch-action: pan-y; }

/* ٥) تنبيه الوقت (#g2Time في التحدي والتوصيل والمبارزة) */
#g2Time.fxWarn, .fxWarn #g2Time { color: #c77a12; }
#g2Time.fxHot, .fxHot #g2Time { color: var(--fx-no); display: inline-block; }
html:not(.fxCalm) #g2Time.fxHot, html:not(.fxCalm) .fxHot #g2Time { animation: fxBeat 1s ease-in-out infinite; }
@keyframes fxBeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.18); } }

/* ٦) أرقامك الشخصية (آخر الدرس) */
.fxRecs { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.fxRecs h3 { margin: 0 0 2px; font-size: 1rem; }
.fxRc {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r-xl); background: var(--ad-card, #fff);
  box-shadow: inset 0 0 0 1px var(--ad-line, #e1eae5); opacity: 0; transform: translateX(-16px);
}
html:not(.fxCalm) .fxRc.on { animation: fxRc .55s var(--fx-spring) forwards; }
@keyframes fxRc { to { opacity: 1; transform: none; } }
.fxRc.new { box-shadow: inset 0 0 0 2px #e9c46a; }
.fxRcI { width: 36px; height: 36px; flex: none; border-radius: var(--r-md); display: grid; place-items: center; background: rgba(233, 196, 106, .22); color: #a87b0c; }
.fxRcI svg { width: 20px; height: 20px; }
.fxRc b { display: block; font-size: .92rem; }
.fxRc small { color: var(--ad-muted, #5b7570); font-size: .8rem; }
.fxRc em { margin-inline-start: auto; font: 800 .68rem inherit; font-style: normal; background: #e9c46a; color: #4a3300; border-radius: var(--r-pill); padding: 2px 8px; }

/* ٧) «حسّها» */
.fxFeelB {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  font: 700 .85rem inherit; background: rgba(194, 65, 45, .1); color: var(--fx-no);
}
.fxFeelB svg { width: 18px; height: 18px; }
.fxFeel { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; background: rgba(8, 20, 17, .6); }
.fxFeelP { position: relative; width: min(100%, 360px); background: var(--ad-card, #fff); color: var(--ad-ink, #12302a); border-radius: var(--r-4xl); padding: 22px 18px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fxFeelX { position: absolute; top: 10px; inset-inline-start: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(128, 128, 128, .16); font-size: 1.3rem; cursor: pointer; color: inherit; }
.fxFeelA { width: 190px; height: 190px; }
.fxFeelA svg { width: 100%; height: 100%; overflow: visible; }
.fxFeelP small { color: var(--ad-muted, #5b7570); max-width: 28ch; }
.fxFeelH { margin: 0; font-size: .78rem; color: var(--ad-muted, #5b7570); }
.fxFeelR { display: flex; gap: 6px; }
.fxFeelR button { border: 0; border-radius: var(--r-md); padding: 7px 12px; font: 700 .8rem inherit; cursor: pointer; background: rgba(128, 128, 128, .16); color: inherit; }
.fxFeelR button[aria-pressed="true"] { background: var(--fx-no); color: #fff; }
.fxHeart { transform-origin: 110px 120px; }
html:not(.fxCalm) .fxHeart { transition: transform .09s ease-out; }
.fxHeart.b1 { transform: scale(1.13); } .fxHeart.b2 { transform: scale(1.06); }
.fxFish { transform-origin: 110px 110px; transform: rotate(calc(var(--fs, 0) * -3deg)); }
html:not(.fxCalm) .fxFish { transition: transform .45s ease-in-out; }
.fxTail { transform-origin: 160px 110px; transform: rotate(calc(var(--fs, 0) * 22deg)); }
html:not(.fxCalm) .fxTail { transition: transform .45s ease-in-out; }
.fxWing { transform-origin: 112px 116px; }

/* ٨) «أسبوعي» */
.fxStory { position: fixed; inset: 0; z-index: 1300; color: #fff; overflow: hidden; background: var(--c-green, #0d4f3c); }
.fxSegs { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; gap: 4px; z-index: 5; }
.fxSegs i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.fxSegs i b { display: block; height: 100%; width: 0; background: #fff; }
.fxSegs i.done b { width: 100%; }
html:not(.fxCalm) .fxSegs i.run b { animation: fxSeg 4.2s linear forwards; }
@keyframes fxSeg { to { width: 100%; } }
.fxStoryX { position: absolute; top: calc(24px + env(safe-area-inset-top, 0px)); inset-inline-start: 12px; z-index: 6; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.4rem; cursor: pointer; }
.fxSl { position: absolute; inset: 0; padding: 70px 24px 30px; display: flex; flex-direction: column; justify-content: center; gap: 12px; opacity: 0; text-align: start; }
html:not(.fxCalm) .fxSl { transition: opacity .35s; }
.fxSl.on { opacity: 1; }
.fxSl p { margin: 0; color: rgba(255, 255, 255, .82); }
.fxSl h4 { margin: 0; font-size: 1.5rem; line-height: 1.35; }
.fxBig { font-size: 4.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.fxChips { display: flex; flex-wrap: wrap; gap: 6px; } .fxChips span { background: rgba(255, 255, 255, .15); border-radius: var(--r-pill); padding: 4px 10px; font-size: .8rem; }
.fxS1 { background: linear-gradient(160deg, var(--c-green, #0d4f3c), #1b7a5c); } .fxS2 { background: linear-gradient(160deg, #5b2a86, #a33f8a); } .fxS3 { background: linear-gradient(160deg, #b8460e, #e8862c); }
.fxS4 { background: linear-gradient(160deg, #0b3a5c, #1f7aa8); } .fxS5 { background: linear-gradient(160deg, var(--c-ink, #10302a), var(--c-green, #0d4f3c)); align-items: center; }
.fxStoryOrb { width: 150px; height: 150px; border-radius: 50%; overflow: hidden; background: #081a16; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.fxStoryOrb canvas { width: 100%; height: 100%; }
.fxShare canvas { width: min(78vw, 300px); height: auto; border-radius: var(--r-3xl); box-shadow: 0 20px 40px rgba(0, 0, 0, .35); }
.fxShareB { border: 0; border-radius: var(--r-xl); padding: 13px 26px; font: 800 1rem inherit; background: #fff; color: var(--c-green, #0d4f3c); cursor: pointer; }
.fxTap { position: absolute; top: 60px; bottom: 0; width: 38%; border: 0; background: transparent; cursor: pointer; z-index: 4; }
.fxTap.r { right: 0; } .fxTap.l { left: 0; }
.fxS5 .fxTap, .fxSl.on ~ .fxTap { z-index: 4; }
html:not(.fxCalm) .fxSl.on .fxPop { animation: fxSt .7s var(--fx-spring) both; } html:not(.fxCalm) .fxSl.on .fxPop2 { animation: fxSt .7s .15s var(--fx-spring) both; } html:not(.fxCalm) .fxSl.on .fxPop3 { animation: fxSt .7s .3s var(--fx-spring) both; }
@keyframes fxSt { from { opacity: 0; transform: translateY(18px) scale(.92); } }

.fxSl { pointer-events: none; } .fxSl.on { pointer-events: auto; }
.fxShareB { position: relative; z-index: 7; }

/* الحركة مطفية: اللي يطلع بحركة يطلع جاهز */
html.fxCalm .fxRc { opacity: 1; transform: none; }
html.fxCalm .fxBub.on { opacity: 1; transform: none; }

/* ---------- الوسام يلف لما ينفتح (اللقب الجديد والوسام الجديد) ---------- */
html:not(.fxCalm) .badge-icon,
html:not(.fxCalm) .lvUpO .b {
  animation: bdPop 0.6s var(--sp), fxSpin 1.1s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes fxSpin {
  from { transform: perspective(400px) rotateY(0); }
  to { transform: perspective(400px) rotateY(720deg); }
}

/* ---------- زر الحفظ/الإرسال: دائرة تحميل ثم ✓ ---------- */
button.fxLoad.fxLoad,
button.fxDone.fxDone { position: relative; color: transparent; }
button.fxLoad.fxLoad::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  border: 2.5px solid var(--fxc, currentColor);
  border-top-color: transparent;
}
html:not(.fxCalm) button.fxLoad.fxLoad::after { animation: fxRot 0.7s linear infinite; }
@keyframes fxRot { to { transform: rotate(360deg); } }
button.fxDone.fxDone::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--fxc, currentColor);
  font-size: 1.25rem;
  font-weight: 800;
}
html:not(.fxCalm) button.fxDone.fxDone::after { animation: fxOk 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes fxOk { from { transform: scale(0.3); opacity: 0; } }

/* ---------- «فعّل البصمة» بعد الدرس (assets/passkey2.js) ---------- */
.pk2O {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  align-items: end;
  background: rgba(6, 20, 16, 0.45);
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
.pk2S {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  background: var(--ad-card, #fff);
  color: var(--ad-ink, #12302a);
  border-radius: var(--r-4xl);
  padding: 22px 18px 18px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.pk2S h3 { margin: 0; font-size: 1.15rem; }
.pk2S p { margin: 0; color: var(--ad-muted, #5b7570); }
.pk2S .pkMessage:empty { display: none; }
.pk2S .pkMessage.bad { color: var(--c-danger, #b42318); }
.pk2S button { width: 100%; }
.pk2I { font-size: 2.4rem; line-height: 1; }
html:not(.fxCalm) .pk2S { animation: pk2Up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes pk2Up { from { transform: translateY(40px); opacity: 0; } }
