/* =============================================================================
   ui/flashcards.css — پورت تحت‌اللفظی ui/flashcards/*.kt اندروید.
   DueHero r28 grape + پالس ۱۵۰۰ms · DeckTile (آیکن ۴۶ r16، پیشرفت ۷px)
   CardRow + CardEditorSheet · FlipCard سه‌بعدی ۵۲۰ms · GradeBar چهار گرادیانی
   StatTile/BarRow آمار. پیشوند .fx تا با قوانین قدیمی تداخل نکند.
   ========================================================================== */

.fx { display: flex; flex-direction: column; gap: 14px; padding-bottom: 96px; }
.fx-row { display: flex; align-items: center; gap: 8px; }
.fx-grow { flex: 1 1 auto; min-width: 0; }
.fx-title { font-size: 17px; font-weight: 800; }
.fx-sect { font-size: 13.5px; font-weight: 800; margin-top: 4px; color: var(--on-surface, inherit); }
.fx-mut { color: var(--muted); }
.fx-stagger { animation: fxIn 340ms var(--e-decel, ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes fxIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------- DueHero ---------------------------------- */
/* DueHero: گرادیان grape، گوشهٔ ۲۸، پدینگ ۲۰، دکمهٔ سفید با پالس آلفا */
.fx-hero {
  border-radius: 28px; padding: 20px;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  color: #fff;
}
.fx-hero h2 { margin: 0; font-size: 19px; font-weight: 800; }
.fx-hero p { margin: 6px 0 14px; font-size: 13px; color: rgba(255, 255, 255, .85); }
.fx-hero .fx-start {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; cursor: pointer; font: inherit; font-weight: 800;
  background: #fff; color: #4C1D95;
  padding: 10px 18px; border-radius: 18px;
  animation: fxGlow 1500ms ease-in-out infinite alternate;
  transition: transform 140ms var(--e-spring, ease);
}
.fx-hero .fx-start:active { transform: scale(.96); }
.fx-hero .fx-start[disabled] { opacity: .55; cursor: default; animation: none; }
@keyframes fxGlow { from { opacity: .75; } to { opacity: 1; } }

/* ------------------------------- DeckTile --------------------------------- */
.fx-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 14px; cursor: pointer;
  transition: transform 150ms var(--e-spring, ease), border-color 200ms ease;
}
.fx-tile:active { transform: scale(.985); }
.fx-trow { display: flex; align-items: center; gap: 12px; }
.fx-dic {
  width: 46px; height: 46px; flex: none; border-radius: 16px;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.fx-dname { font-size:16px; font-weight:800; overflow-wrap:anywhere; }
.fx-dmeta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.fx-duepill {
  flex: none; border-radius: 999px; padding: 5px 11px;
  background: linear-gradient(135deg, #FB7185, #E11D48);
  color: #fff; font-size: 13px; font-weight: 800;
}
.fx-ddel {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: none; color: #E11D48; cursor: pointer;
  display: grid; place-items: center; opacity: .85;
}
.fx-ddel:active { transform: scale(.88); }
.fx-prog { height: 7px; border-radius: 99px; background: var(--surface-2, rgba(128,128,128,.14)); margin: 12px 0; overflow: hidden; }
.fx-prog > i { display: block; height: 100%; border-radius: inherit; width: 0; transition: width 700ms var(--e-decel, ease); }
.fx-btns { display: flex; gap: 8px; }
.fx-gbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 13.5px;
  color: var(--on-primary, #fff);
  background: linear-gradient(135deg, var(--grad-a, var(--primary)), var(--primary) 55%, var(--secondary));
  border-radius: 16px; padding: 11px 16px;
  transition: transform 140ms var(--e-spring, ease);
}
.fx-gbtn:active { transform: scale(.96); }
.fx-gbtn.grow { flex: 1 1 auto; }
.fx-obtn {
  border: 1px solid var(--line); background: none; color: inherit;
  font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer;
  border-radius: 16px; padding: 10px 16px;
  transition: transform 140ms var(--e-spring, ease);
}
.fx-obtn:active { transform: scale(.96); }

/* --------------------------------- FAB ------------------------------------ */
.fx-fab {
  position: fixed; z-index: 44; inset-inline-end: 18px;
  bottom: calc(var(--nav-h, 74px) + env(safe-area-inset-bottom) + 18px);
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 13.5px;
  color: var(--on-primary, #fff);
  background: linear-gradient(135deg, var(--grad-a, var(--primary)), var(--primary) 55%, var(--secondary));
  border-radius: 18px; padding: 14px 20px;
  box-shadow: 0 14px 30px -12px rgba(var(--primary-rgb) / .9);
  transition: transform 140ms var(--e-spring, ease);
}
.fx-fab:active { transform: scale(.94); }
body.no-chrome .fx-fab { display: none; }
@media (min-width: 900px) {
  .fx-fab { bottom: 26px; inset-inline-end: 26px; }
}

/* --------------------------- DeckEditor / Import --------------------------- */
.fx-lbl { font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.fx-icons { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-icons > button {
  width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  font-size: 17px; line-height: 1;
  background: var(--surface-2, rgba(128,128,128,.14));
  transition: transform 140ms ease, background 200ms ease;
}
.fx-icons > button.on { background: rgba(var(--primary-rgb) / .18); }
.fx-icons > button:active { transform: scale(.9); }
.fx-colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fx-colors > button {
  width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer;
  transition: transform 160ms var(--e-spring, ease);
}
.fx-colors > button.on { width: 34px; height: 34px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.fx-colors > button:active { transform: scale(.9); }
.fx-code { direction: ltr; text-align: center; letter-spacing: 3px; font-weight: 800; text-transform: uppercase; }
.fx-prevcard {
  border-radius: 16px; padding: 12px; margin-top: 10px;
  background: rgba(var(--primary-rgb) / .08); border: 1px solid rgba(var(--primary-rgb) / .18);
  animation: fxIn 240ms ease both;
}
.fx-prevcard b { font-size: 14px; }
.fx-prevcard .sm { margin-top: 2px; }

/* ------------------------------- DeckScreen -------------------------------- */
.fx-head {
  border-radius: 20px; padding: 14px;
  background: rgba(var(--primary-rgb) / .07); border: 1px solid rgba(var(--primary-rgb) / .14);
}
.fx-head .fx-dic { width: 44px; height: 44px; border-radius: 15px; font-size: 20px; }
.fx-head b { font-size: 14.5px; }
.fx-head .fx-share-code { font-size: 12px; color: var(--muted); margin-top: 2px; direction: ltr; text-align: end; }
.fx-head .fx-gbtn { width: 100%; margin-top: 12px; }
.fx-hacts { display: flex; gap: 2px; }
.fx-hacts .icon-btn { width: 36px; height: 36px; }

.fx-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 12px 14px; cursor: pointer;
}
.fx-crow { display: flex; align-items: center; gap: 10px; }
.fx-type {
  flex: none; border-radius: 999px; padding: 4px 9px; font-size: 11px;
  background: var(--surface-2, rgba(128,128,128,.14)); color: var(--muted);
}
.fx-cfront {
  flex: 1 1 auto; min-width: 0; font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fx-cact { display: flex; flex: none; }
.fx-cact .icon-btn { width: 32px; height: 32px; }
.fx-cact .fx-cdel { color: #E11D48; }
.fx-cback { padding-top: 8px; animation: fxIn 220ms ease both; }
.fx-cback img { width: 100%; height: 140px; object-fit: cover; border-radius: 16px; margin-bottom: 8px; display: block; }
.fx-cback p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.8; white-space: pre-wrap; }

/* ----------------------------- CardEditor ---------------------------------- */
.fx-tchips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.fx-tchips::-webkit-scrollbar { display: none; }
.fx-tchips > button {
  flex: none; height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600;
}
.fx-tchips > button.on {
  background: rgba(var(--primary-rgb) / .12); border-color: var(--primary);
  color: var(--primary); font-weight: 700;
}
.fx-media { display: flex; gap: 8px; flex-wrap: wrap; }
.fx-chipbtn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: none; color: inherit;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 8px 13px;
}
.fx-chipbtn:active { transform: scale(.95); }
.fx-chipbtn[disabled] { opacity: .5; cursor: default; }
.fx-imgprev { width: 100%; height: 150px; object-fit: cover; border-radius: 18px; display: block; }
.fx-progbar { height: 4px; border-radius: 99px; overflow: hidden; background: var(--surface-2, rgba(128,128,128,.14)); }
.fx-progbar > i { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--primary); animation: fxSlide 900ms ease-in-out infinite; }
@keyframes fxSlide { 0% { transform: translateX(120%); } 100% { transform: translateX(-320%); } }
.fx-paste { width: 100%; height: 180px; resize: vertical; }

/* ------------------------------ ReviewScreen ------------------------------- */
.fx-rv { min-height: 70dvh; display: flex; flex-direction: column; }
.fx-rvtop { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.fx-rvtitle { font-size: 16px; font-weight: 800; }
.fx-rvsub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.fx-rprog { height: 6px; border-radius: 99px; background: var(--surface-2, rgba(128,128,128,.14)); overflow: hidden; margin-bottom: 10px; }
.fx-rprog > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width 450ms var(--e-decel, ease); }
.fx-stage { flex: 1 1 auto; display: grid; place-items: center; padding: 12px 4px; }

/* FlipCard: چرخش سه‌بعدی ۵۲۰ms — tween(520) اندروید */
.fx-flip { width: 100%; height: 52dvh; min-height: 300px; perspective: 1400px; cursor: pointer; }
.fx-flip-in {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 520ms var(--e-decel, ease);
}
.fx-flip.flip .fx-flip-in { transform: rotateY(180deg); }
.fx-face {
  position: absolute; inset: 0; border-radius: 30px; padding: 22px;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  text-align:center; overflow-y:auto; overflow-wrap:anywhere;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface-2, rgba(128,128,128,.14));
}
.fx-face.back {
  transform: rotateY(180deg);
  background: rgba(var(--secondary-rgb) / .16);
}
.fx-face .fx-fimg { width: 100%; max-height: 160px; object-fit: cover; border-radius: 20px; margin-bottom: 14px; }
.fx-ftext { font-size: 23px; font-weight: 800; line-height: 32px; white-space: pre-wrap; }
.fx-ftext.long { font-size: 17px; }
.fx-fhint { margin-top: 18px; font-size: 12px; color: var(--muted); }
.fx-fextra { margin-top: 12px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.fx-choices { width: 100%; margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.fx-choice {
  width: 100%; border: 0; cursor: pointer; font: inherit; font-size: 15px;
  text-align: start; padding: 14px; border-radius: 16px;
  background: var(--surface); color: inherit;
  transition: transform 130ms ease;
}
.fx-choice:active { transform: scale(.98); }
.fx-choice.correct { background: rgba(16, 185, 129, .25); }
.fx-choice.wrong { background: rgba(225, 29, 72, .22); }
.fx-audio {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px;
  border: 1px solid var(--line); background: none; color: inherit;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 8px 13px;
}

/* GradeBar — چهار دکمهٔ گرادیانی ۵۲px گوشهٔ ۱۷ */
.fx-grades { display: flex; gap: 8px; padding: 16px 6px 8px; }
.fx-grade {
  flex: 1 1 0; height: 52px; border: 0; border-radius: 17px; cursor: pointer;
  color: #fff; font: inherit; font-weight: 800; font-size: 14px;
  transition: transform 140ms var(--e-spring, ease);
  animation: fxGradeIn 260ms var(--e-decel, ease) both;
}
.fx-grade:active { transform: scale(.94); }
.fx-grade.g0 { background: linear-gradient(135deg, #FB7185, #E11D48); }
.fx-grade.g1 { background: linear-gradient(135deg, #FBBF24, #F97316); }
.fx-grade.g2 { background: linear-gradient(135deg, #4ADE9F, #10B981); }
.fx-grade.g3 { background: linear-gradient(135deg, #38BDF8, #2563EB); }
@keyframes fxGradeIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.fx-show {
  width: 100%; height: 54px; border: 0; border-radius: 18px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 14.5px;
  color: var(--on-primary, #fff); background: var(--primary);
  margin: 12px 6px 8px; width: calc(100% - 12px);
}

/* SessionSummary */
.fx-done { text-align: center; padding: 28px 8px; }
.fx-trophy {
  width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%;
  background: linear-gradient(135deg, #4ADE9F, #10B981);
  display: grid; place-items: center; font-size: 42px;
}
.fx-done h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.fx-done p { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }

/* -------------------------------- Stats ------------------------------------ */
.fx-stats3 { display: flex; gap: 10px; }
.fx-stat {
  flex: 1 1 0; border-radius: 22px; padding: 16px 6px; text-align: center; color: #fff;
}
.fx-stat b { display: block; font-size: 21px; font-weight: 800; }
.fx-stat span { font-size: 11px; color: rgba(255, 255, 255, .9); }
.fx-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 14px;
}
.fx-bars { display: flex; gap: 5px; align-items: flex-end; height: 120px; direction: ltr; }
.fx-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.fx-bar b { font-size: 9px; font-weight: 600; margin-bottom: 3px; }
.fx-bar i {
  width: 100%; border-radius: 6px; min-height: 4px;
  transition: height 600ms var(--e-decel, ease);
}
.fx-bar span { font-size: 9px; color: var(--muted); margin-top: 4px; }
.fx-total { margin-top: 10px; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .fx-stagger, .fx-grade, .fx-cback, .fx-prevcard { animation: none; }
  .fx-hero .fx-start { animation: none; }
  .fx-flip-in { transition: none; }
}

/* Use the active fx-* classes: fc-* belonged to the retired renderer. */
.fx-row > *, .fx-trow > *, .fx-crow > *, .fx-stage > * { min-width:0; }
.fx-ftext, .fx-fextra, .fx-cfront, .fx-cback, .fx-head { overflow-wrap:anywhere; }
/* Auto margins center a short face but collapse to zero for a long face,
   keeping its first line reachable at scrollTop=0. Never shrink text boxes. */
.fx-face > * { flex-shrink:0; max-width:100%; }
.fx-face > :first-child { margin-top:auto; }
.fx-face > :last-child { margin-bottom:auto; }
