/* MARK FUEL signature study card ("Paper Mark").
   Scoped to the review screen only (#flashcardContainer, #ratingBtnsContainer, study header).
   The two faces, flip state, reveal and rating logic stay owned by index.html. */

/* ---------- card stage ---------- */
html body #flashcardContainer{position:relative;display:block!important;width:100%;max-width:760px!important;margin-inline:auto;padding:12px 12px 4px!important;perspective:1600px;filter:drop-shadow(0 10px 16px rgb(11 46 89 / .12))}
html body #flashcardContainer>*+*{margin-top:0!important}
html[data-theme=dark] body #flashcardContainer,body.dark #flashcardContainer{filter:drop-shadow(0 12px 22px rgb(0 0 0 / .55))}
#flashcardContainer>.mfsc-deck{position:absolute;inset:12px 12px 4px;border-radius:22px;background:linear-gradient(165deg,#1b4b80,#0b2e59);transform:rotate(2.6deg) translate(-8px,-5px);transition:background-color .2s .2s;pointer-events:none}
#flashcardContainer.mf-is-flipped>.mfsc-deck{background:linear-gradient(165deg,#fffdf8,#f3eee3);box-shadow:inset 0 0 0 1.5px rgb(11 46 89 / .35)}
html[data-theme=dark] #flashcardContainer>.mfsc-deck,body.dark #flashcardContainer>.mfsc-deck{background:linear-gradient(165deg,#2a5a90,#1b4b80)}
html[data-theme=dark] #flashcardContainer.mf-is-flipped>.mfsc-deck,body.dark #flashcardContainer.mf-is-flipped>.mfsc-deck{background:#22406a;box-shadow:inset 0 0 0 1.5px rgb(140 196 243 / .4)}
html body #flashcardContainer .mf-study-flipper{transition:transform .44s cubic-bezier(.3,.7,.2,1)}

/* ---------- faces ---------- */
html body #flashcardContainer :is(.mf-card-front,.mf-card-back){--ear:36px;position:relative;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:16px;min-height:280px;padding:20px 20px 18px;border:2px solid #0b2e59;border-radius:22px;box-shadow:none;color:#0b2e59;text-align:start;overflow:hidden;clip-path:polygon(var(--ear) 0,100% 0,100% 100%,0 100%,0 var(--ear));background:linear-gradient(165deg,#fffdf8 35%,#f3eee3)}
html body #flashcardContainer .mf-card-back{background:linear-gradient(165deg,#f6faff 30%,#e8f1fc)}
html[data-theme=dark] body #flashcardContainer .mf-card-front,body.dark #flashcardContainer .mf-card-front{background:linear-gradient(165deg,#173156,#11284a);border-color:#72b9ed;color:#f2f6fc}
html[data-theme=dark] body #flashcardContainer .mf-card-back,body.dark #flashcardContainer .mf-card-back{background:linear-gradient(165deg,#13294a,#0e203b);border-color:#378ae6;color:#f2f6fc}
/* the face that is turned away takes the visible face's size, so a long answer never stretches a short question */
html body #flashcardContainer:not(.mf-is-flipped) .mf-card-back,html body #flashcardContainer.mf-is-flipped .mf-card-front{position:absolute;inset:0}
@media(min-width:640px){html body #flashcardContainer :is(.mf-card-front,.mf-card-back){--ear:46px;min-height:340px;padding:30px 38px 24px}}

/* header row inside each face */
#flashcardContainer .mfsc-meta{display:flex;align-items:center;gap:8px;min-height:22px;padding-left:calc(var(--ear) - 4px);font:800 12px/1.4 'Cairo',sans-serif;color:inherit}
#flashcardContainer .mfsc-chip{display:none;align-items:center;font:800 11px/1.5 'Cairo',sans-serif;color:#1e64b4;background:#e3f0fd;border-radius:999px;padding:1px 9px}
html[data-theme=dark] #flashcardContainer .mfsc-chip,body.dark #flashcardContainer .mfsc-chip{background:#1b3a62;color:#9ed4f5}
#flashcardContainer[data-weak=true] .mfsc-chip{display:inline-flex;animation:mfscIn .3s ease}

/* question */
html body #flashcardContainer #cardQuestionText{margin:0;max-width:none;font:700 19px/1.85 'Cairo',sans-serif!important;color:inherit!important;text-align:start;direction:rtl;unicode-bidi:plaintext;text-wrap:pretty;letter-spacing:0}
html body #flashcardContainer[data-len=long] #cardQuestionText{font-size:17px!important}
html body #flashcardContainer[data-len=short] #cardQuestionText{margin-block:auto}
@media(min-width:640px){html body #flashcardContainer #cardQuestionText{font-size:27px!important;line-height:1.75!important}html body #flashcardContainer[data-len=long] #cardQuestionText{font-size:21px!important;line-height:1.85!important}}
html body #flashcardContainer #cardDiagramBox{margin-inline:auto}

/* answer */
html body #flashcardContainer #cardAnswerSection{width:100%;max-width:none;margin:0;padding:0!important;border:0!important}
html body #flashcardContainer #openPdfRefFromAnswerBtn{display:block;width:100%;padding:0!important;margin:0;border:0!important;border-radius:10px;background:none!important;box-shadow:none!important;text-align:start;color:inherit!important;cursor:pointer;min-height:44px}
html body #flashcardContainer #openPdfRefFromAnswerBtn:focus-visible{outline:2px solid #378ae6;outline-offset:6px}
html body #flashcardContainer #cardAnswerMain{font:500 16px/1.95 'Cairo',sans-serif!important;color:inherit!important;text-align:start;direction:rtl;unicode-bidi:plaintext;text-wrap:pretty}
html body #flashcardContainer[data-len=short] #cardAnswerMain{font-size:18px!important;font-weight:600!important}
html body #flashcardContainer[data-len=short] .mf-card-back #cardAnswerSection{margin-block:auto}
@media(min-width:640px){html body #flashcardContainer #cardAnswerMain{font-size:18px!important}html body #flashcardContainer[data-len=short] #cardAnswerMain{font-size:22px!important}}

/* automatic formatting (assets/study-card.js) */
#flashcardContainer .mffmt{display:contents}
#flashcardContainer bdi.mfen{font-family:'Inter',sans-serif;font-size:.9em;font-weight:600;color:#378ae6}
html[data-theme=dark] #flashcardContainer bdi.mfen,body.dark #flashcardContainer bdi.mfen{color:#72b9ed}
#flashcardContainer .mfnum{unicode-bidi:isolate;direction:ltr}
#flashcardContainer :is(.mfen,.mffx,.mfnum) :is(sub,sup){font-size:.68em;line-height:0}
#flashcardContainer .mfp{display:block}
#flashcardContainer .mfp+.mfp,#flashcardContainer .mfol+.mfp,#flashcardContainer .mfp+.mfol,#flashcardContainer .mffx+*{margin-top:12px}
#flashcardContainer .mfol{display:flex;flex-direction:column;gap:10px}
#flashcardContainer .mffx+.mfol,#flashcardContainer .mfol+.mffx{margin-top:12px}
#flashcardContainer .mfli{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:baseline}
#flashcardContainer .mfk{display:inline-grid;place-items:center;min-width:24px;height:24px;border-radius:8px;font:800 13px 'Inter',sans-serif;background:rgb(55 138 230 / .14);color:inherit}
#flashcardContainer .mffx{display:block;direction:ltr;unicode-bidi:isolate;text-align:center;font:600 15px/1.6 'Inter',sans-serif;padding:10px 12px;border-radius:12px;background:rgb(55 138 230 / .09);text-wrap:balance;font-variant-numeric:tabular-nums}
@media(min-width:640px){#flashcardContainer .mffx{font-size:18px}}
#flashcardContainer[data-len=short] .mfp{text-align:start}

/* footers: two-tone rule + wordmark signature */
#flashcardContainer .mfsc-foot{margin-top:auto;display:flex;justify-content:space-between;align-items:flex-end;gap:12px;direction:rtl}
#flashcardContainer .mfsc-rule{display:flex;flex-direction:column;gap:5px;align-items:flex-start}
#flashcardContainer .mfsc-rule b{display:block;height:4px;border-radius:4px}
#flashcardContainer .mfsc-rule b:first-child{width:46px;background:currentColor}
#flashcardContainer .mfsc-rule b:last-child{width:28px;background:#378ae6}
#flashcardContainer .mfsc-wm{display:inline-flex;gap:.34em;direction:ltr;unicode-bidi:isolate;font:900 11px/1 'Inter',sans-serif;letter-spacing:.08em;white-space:nowrap;user-select:none}
#flashcardContainer .mfsc-wm b{font-weight:900;color:#0b2e59}
#flashcardContainer .mfsc-wm i{font-style:normal;color:#378ae6}
html[data-theme=dark] #flashcardContainer .mfsc-wm b,body.dark #flashcardContainer .mfsc-wm b{color:#eaf2ff}
html[data-theme=dark] #flashcardContainer .mfsc-wm i,body.dark #flashcardContainer .mfsc-wm i,html[data-theme=dark] #flashcardContainer .mfsc-rule b:last-child{color:#72b9ed;background-color:#72b9ed}
html[data-theme=dark] #flashcardContainer .mfsc-wm i{background:none}
@media(min-width:640px){#flashcardContainer .mfsc-wm{font-size:12.5px}}
#flashcardContainer .mfsc-srcbar{margin-top:auto;padding-top:12px;border-top:1px dashed rgb(11 46 89 / .25);display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;direction:rtl}
html[data-theme=dark] #flashcardContainer .mfsc-srcbar{border-color:rgb(234 242 255 / .2)}
html body #flashcardContainer .mfsc-src{display:inline-flex;align-items:center;gap:7px;min-height:36px;padding:0;border:0;background:none;color:#1e64b4;font:700 13px/1.4 'Cairo',sans-serif;cursor:pointer}
html[data-theme=dark] body #flashcardContainer .mfsc-src{color:#9ed4f5}
#flashcardContainer .mfsc-src svg{width:16px;height:16px;flex:none}
#flashcardContainer .mfsc-src:hover span{text-decoration:underline;text-underline-offset:3px}
#flashcardContainer .mfsc-src:focus-visible{outline:2px solid #378ae6;outline-offset:3px;border-radius:6px}

/* ---------- the dog-ear star = weak-spot button ---------- */
html body #flashcardContainer .mfsc-ear{position:absolute!important;top:0;left:0;z-index:3!important;width:var(--ear);height:var(--ear);padding:0;margin:0;border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
#flashcardContainer .mfsc-ear::before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,transparent 50%,#0b2e59 50%);border-radius:0 0 7px 0;transition:background .25s}
#flashcardContainer .mf-card-back .mfsc-ear::before{background:linear-gradient(135deg,transparent 50%,#378ae6 50%)}
html[data-theme=dark] #flashcardContainer .mfsc-ear::before,body.dark #flashcardContainer .mfsc-ear::before{background:linear-gradient(135deg,transparent 50%,#72b9ed 50%)}
#flashcardContainer .mfsc-ear .mfsc-hit{position:absolute;inset:-8px -10px -12px -8px}
#flashcardContainer .mfsc-ear svg{position:absolute;width:46%;height:46%;right:10%;bottom:10%;overflow:visible;transition:filter .3s}
#flashcardContainer .mfsc-ear svg path{fill:none;stroke:#fff;stroke-width:9;stroke-linejoin:round;transition:fill .25s,stroke .25s}
html[data-theme=dark] #flashcardContainer .mfsc-ear svg path,body.dark #flashcardContainer .mfsc-ear svg path{stroke:#06182e}
#flashcardContainer .mfsc-ear:focus-visible{outline:2px solid #378ae6;outline-offset:2px;border-radius:6px}
#flashcardContainer[data-weak=true] .mfsc-ear::before{background:linear-gradient(135deg,transparent 50%,#378ae6 50%)}
html[data-theme=dark] #flashcardContainer[data-weak=true] .mfsc-ear::before,body.dark #flashcardContainer[data-weak=true] .mfsc-ear::before{background:linear-gradient(135deg,transparent 50%,#9ed4f5 50%)}
#flashcardContainer[data-weak=true] .mfsc-ear svg path{fill:#fff;stroke:#fff}
html[data-theme=dark] #flashcardContainer[data-weak=true] .mfsc-ear svg path,body.dark #flashcardContainer[data-weak=true] .mfsc-ear svg path{fill:#0b2e59;stroke:#0b2e59}
#flashcardContainer[data-weak=true] .mfsc-ear svg{filter:drop-shadow(0 0 3px #9ed4f5) drop-shadow(0 0 7px rgb(55 138 230 / .55))}
#flashcardContainer .mfsc-ear.is-pop svg{animation:mfscPop .62s cubic-bezier(.2,1.4,.3,1)}
#flashcardContainer .mfsc-ear .mfsc-ring{position:absolute;right:31%;bottom:31%;width:12px;height:12px;margin:-6px;border-radius:50%;border:2px solid #9ed4f5;opacity:0;pointer-events:none}
#flashcardContainer .mfsc-ear.is-pop .mfsc-ring{animation:mfscRing .6s ease-out}
#flashcardContainer .mfsc-ear .mfsc-spk{position:absolute;right:31%;bottom:31%;width:4px;height:4px;margin:-2px;border-radius:50%;background:#9ed4f5;opacity:0;pointer-events:none}
#flashcardContainer .mfsc-ear.is-pop .mfsc-spk{animation:mfscSpark .55s ease-out}
#flashcardContainer .mfsc-ear .mfsc-spk:nth-of-type(1){--dx:18px;--dy:-14px}#flashcardContainer .mfsc-ear .mfsc-spk:nth-of-type(2){--dx:22px;--dy:10px}#flashcardContainer .mfsc-ear .mfsc-spk:nth-of-type(3){--dx:-4px;--dy:22px}#flashcardContainer .mfsc-ear .mfsc-spk:nth-of-type(4){--dx:-14px;--dy:-18px}
#flashcardContainer .mfsc-hint{position:absolute;top:2px;left:calc(var(--hint-x,48px) + 10px);z-index:6;max-width:min(260px,70vw);background:#0b2e59;color:#fff;font:700 12px/1.5 'Cairo',sans-serif;padding:6px 10px;border-radius:10px;box-shadow:0 6px 16px -6px rgb(11 46 89 / .5);pointer-events:none;animation:mfscIn .3s ease}
#flashcardContainer .mfsc-hint::before{content:"";position:absolute;top:11px;left:-5px;width:10px;height:10px;background:inherit;transform:rotate(45deg)}
#flashcardContainer .mfsc-hint[hidden]{display:none}
html[data-theme=dark] #flashcardContainer .mfsc-hint{background:#9ed4f5;color:#06182e}
@media(min-width:640px){#flashcardContainer .mfsc-hint{--hint-x:58px}}

/* the separate header bookmark is replaced by the star; keep the slot so the counters stay centered */
html body #pureStudyScreen #toggleWeakSpotCardBtn{display:none!important}
html body #pureStudyScreen .mf-study-weak{min-width:42px;justify-content:flex-end}

/* ---------- rating: paper segment with a sliding ink ---------- */
html body #ratingBtnsContainer .mfsc-rates{--again:#e11d48;--hard:#d97706;--good:#378ae6;--easy:#059669;position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;padding:5px;border-radius:20px;background:linear-gradient(165deg,#fffdf8 35%,#f3eee3);border:2px solid #0b2e59}
html[data-theme=dark] body #ratingBtnsContainer .mfsc-rates,body.dark #ratingBtnsContainer .mfsc-rates{--again:#fb7185;--hard:#fbbf24;--good:#6aaef0;--easy:#34d399;background:linear-gradient(165deg,#173156,#11284a);border-color:#72b9ed}
#ratingBtnsContainer .mfsc-ink{position:absolute;top:5px;bottom:5px;left:5px;width:0;border-radius:15px;background:linear-gradient(165deg,#1b4b80,#0b2e59);opacity:0;pointer-events:none;transition:left .3s cubic-bezier(.3,1.25,.4,1),width .3s,opacity .15s;box-shadow:0 8px 16px -8px #0b2e59}
html[data-theme=dark] #ratingBtnsContainer .mfsc-ink{background:linear-gradient(165deg,#9ed4f5,#72b9ed)}
html body #ratingBtnsContainer .mfsc-rb,html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:62px;padding:6px 2px!important;margin:0;border:0!important;border-radius:15px;background:transparent!important;box-shadow:none!important;color:#0b2e59!important;font:800 14px/1.25 'Cairo',sans-serif;cursor:pointer;transition:transform .1s,color .2s;-webkit-tap-highlight-color:transparent}
html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb{color:#f2f6fc!important}
html body #ratingBtnsContainer .mfsc-rb:nth-of-type(1){--rc:var(--again)}html body #ratingBtnsContainer .mfsc-rb:nth-of-type(2){--rc:var(--hard)}html body #ratingBtnsContainer .mfsc-rb:nth-of-type(3){--rc:var(--good)}html body #ratingBtnsContainer .mfsc-rb:nth-of-type(4){--rc:var(--easy)}
html body #ratingBtnsContainer .mfsc-rb span{color:inherit!important}
html body #ratingBtnsContainer .mfsc-rb .mfsc-ivl{font:700 11px/1.3 'Inter','Cairo',sans-serif;color:#5b6b80!important}
html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb .mfsc-ivl{color:#a6b8ce!important}
html body #ratingBtnsContainer .mfsc-rb .mfsc-ico{display:block;width:22px;height:22px;color:var(--rc)!important}
#ratingBtnsContainer .mfsc-ico svg{display:block;width:100%;height:100%}
@media(hover:hover){html body #ratingBtnsContainer .mfsc-rb:not(:disabled):hover{background:rgb(11 46 89 / .06)!important}html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb:not(:disabled):hover{background:rgb(234 242 255 / .07)!important}}
html body #ratingBtnsContainer .mfsc-rb:not(:disabled):active{transform:scale(.94)}
html body #ratingBtnsContainer .mfsc-rb:disabled{opacity:.5;cursor:default}
html body #ratingBtnsContainer .mfsc-rb:focus-visible{outline:2.5px solid #378ae6;outline-offset:2px}
html body #ratingBtnsContainer .mfsc-rb.is-on{color:#fcf9f2!important;background:transparent!important}
html body #ratingBtnsContainer .mfsc-rb.is-on .mfsc-ivl{color:#b5ddf4!important}
html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb.is-on,html[data-theme=dark] body #ratingBtnsContainer .mfsc-rb.is-on .mfsc-ivl{color:#06182e!important}
#ratingBtnsContainer .mfsc-rb.is-on .mfsc-ico{animation:mfscPop .5s cubic-bezier(.2,1.4,.3,1)}
#ratingBtnsContainer .mfsc-rb .mfsc-spk{position:absolute;top:16px;left:50%;width:4px;height:4px;margin-left:-2px;border-radius:50%;background:var(--rc);opacity:0;pointer-events:none}
#ratingBtnsContainer .mfsc-rb.is-on .mfsc-spk{animation:mfscSpark .5s ease-out}
#ratingBtnsContainer .mfsc-rb .mfsc-spk:nth-of-type(1){--dx:-18px;--dy:-12px}#ratingBtnsContainer .mfsc-rb .mfsc-spk:nth-of-type(2){--dx:18px;--dy:-12px}#ratingBtnsContainer .mfsc-rb .mfsc-spk:nth-of-type(3){--dx:-15px;--dy:12px}#ratingBtnsContainer .mfsc-rb .mfsc-spk:nth-of-type(4){--dx:15px;--dy:12px}

@keyframes mfscPop{0%{transform:scale(1)}28%{transform:scale(.62) rotate(-18deg)}62%{transform:scale(1.45) rotate(10deg)}100%{transform:scale(1)}}
@keyframes mfscRing{0%{opacity:.9;transform:scale(.4)}100%{opacity:0;transform:scale(4.2)}}
@keyframes mfscSpark{0%{opacity:1;transform:translate(0,0)}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.4)}}
@keyframes mfscIn{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}

@media (prefers-reduced-motion:reduce){
  #flashcardContainer .mfsc-ear *,#flashcardContainer .mfsc-chip,#flashcardContainer .mfsc-hint,#ratingBtnsContainer *{animation:none!important;transition:none!important}
  #flashcardContainer>.mfsc-deck{transition:none}
}
/* A formula always reads left to right inside Arabic text, and its small digits share its colour. */
#flashcardContainer bdi.mfen{direction:ltr;unicode-bidi:isolate}
#flashcardContainer bdi.mfen :is(sub,sup){color:inherit}
