/* Flashcard view modes (study.php, flashcards.js). Enhances the myre-fc
   markup stored in each set's page content; that markup's inline styles
   use !important, hence the specificity/!important here. */
.myre-fc-wrap.fcx { --x-bg: transparent; --x-ink: #1d2733; --x-muted: #5b6b7a; --x-bar: #fff; --x-bar-line: #dfe5ec; --x-chip: #f1f4f8; --x-chip-on: #1d506d; --x-chip-on-ink: #fff;
  --x-front: #048bce; --x-front-ink: #fff; --x-back: #2c3e50; --x-back-ink: #fff; --x-card-line: transparent; --x-shadow: 0 4px 8px rgba(0, 0, 0, .2); --x-accent: #048bce;
  position: relative; max-width: 960px; padding: 16px; border-radius: 20px; background: var(--x-bg); color: var(--x-ink); font-family: Montserrat, "Open Sans", system-ui, sans-serif; transition: background .4s; isolation: isolate; overflow: hidden; }
.myre-fc-wrap.fcx .myre-fc-hint { color: var(--x-muted); }

/* Toolbar */
.fcx-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; }
.fcx-seg { display: inline-flex; padding: 3px; border: 1px solid var(--x-bar-line); border-radius: 999px; background: var(--x-bar); }
.myre-fc-wrap.fcx .fcx-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin: 0; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--x-ink); font: 600 14px/1 Montserrat, "Open Sans", system-ui, sans-serif; letter-spacing: 0; text-transform: none; cursor: pointer; box-shadow: none; white-space: nowrap; }
.myre-fc-wrap.fcx .fcx-btn:hover { background: var(--x-chip); }
.myre-fc-wrap.fcx .fcx-btn[aria-pressed="true"] { background: var(--x-chip-on); color: var(--x-chip-on-ink); }
.myre-fc-wrap.fcx .fcx-tool { border: 1px solid var(--x-bar-line); background: var(--x-bar); }
.myre-fc-wrap.fcx .fcx-btn:focus-visible { outline: 3px solid var(--x-accent); outline-offset: 2px; }
.fcx-btn svg { width: 16px; height: 16px; flex: none; }

/* Grid mode: themed faces */
.myre-fc-wrap.fcx .myre-fc-inner { box-shadow: var(--x-shadow); border-radius: 16px; }
.myre-fc-wrap.fcx .myre-fc-face { border-radius: 16px; border: 1px solid var(--x-card-line); }
.myre-fc-wrap.fcx .myre-fc-front { background: var(--x-front); color: var(--x-front-ink); }
.myre-fc-wrap.fcx .myre-fc-back { background: var(--x-back); color: var(--x-back-ink); }
.myre-fc-wrap.fcx .myre-fc-card.fcx-known .myre-fc-front::after { content: "✓"; position: absolute; top: 10px; right: 12px; font-size: 14px; font-weight: 800; opacity: .8; }

/* Definitions first */
.myre-fc-wrap.fcx-rev .myre-fc-inner { transform: rotateY(180deg); }
.myre-fc-wrap.fcx-rev .myre-fc-card.is-flipped .myre-fc-inner { transform: none; }

/* Focus mode */
.fcx-focus { display: none; }
.myre-fc-wrap.fcx-view-focus .fcx-focus { display: block; }
.myre-fc-wrap.fcx-view-focus .fcx-controls { display: grid; }
.myre-fc-wrap.fcx-view-focus .myre-fc-grid { display: block !important; max-width: 620px; margin: 0 auto; }
.myre-fc-wrap.fcx-view-focus .myre-fc-card { display: none !important; }
.myre-fc-wrap.fcx-view-focus .myre-fc-card.fcx-current { display: block !important; height: clamp(260px, 46vh, 400px) !important; animation: fcx-in .28s ease-out; }
.myre-fc-wrap.fcx-view-focus .myre-fc-term { font-size: clamp(22px, 4vw, 32px); }
.myre-fc-wrap.fcx-view-focus .myre-fc-def { font-size: clamp(17px, 2.4vw, 21px); line-height: 1.5; }
.myre-fc-wrap.fcx-view-focus .myre-fc-face { padding: 28px; }
.myre-fc-wrap.fcx-view-focus.fcx-done .myre-fc-grid, .myre-fc-wrap.fcx-view-focus.fcx-done .fcx-controls, .myre-fc-wrap.fcx-view-focus.fcx-done .fcx-keys { display: none !important; }
@keyframes fcx-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.fcx-progress { max-width: 620px; margin: 0 auto 14px; }
.fcx-progress-top { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--x-muted); font-size: 14px; font-weight: 600; }
.fcx-track { height: 6px; border-radius: 999px; background: var(--x-chip); overflow: hidden; }
.fcx-fill { height: 100%; width: 0; border-radius: 999px; background: var(--x-accent); transition: width .3s; }
.fcx-controls { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 10px; max-width: 620px; margin: 16px auto 0; }
.myre-fc-wrap.fcx .fcx-big { justify-content: center; min-height: 50px; border-radius: 14px; font-size: 15px; }
.myre-fc-wrap.fcx .fcx-again { background: var(--x-bar); border: 1.5px solid var(--x-bar-line); }
.myre-fc-wrap.fcx .fcx-got { background: var(--x-accent); color: #fff; }
.myre-fc-wrap.fcx .fcx-got:hover { background: var(--x-accent); filter: brightness(1.08); }
.myre-fc-wrap.fcx .fcx-nav { width: 50px; padding: 0; justify-content: center; border: 1.5px solid var(--x-bar-line); background: var(--x-bar); }
.fcx-keys { margin: 12px 0 0; color: var(--x-muted); font-size: 13px; text-align: center; }
.fcx-end { display: none; max-width: 520px; margin: 8px auto; padding: 32px 24px; border-radius: 18px; background: var(--x-bar); border: 1px solid var(--x-bar-line); text-align: center; }
.myre-fc-wrap.fcx-done .fcx-end { display: block; }
.myre-fc-wrap.fcx .fcx-end h3 { margin: 0 0 8px; padding: 0; color: var(--x-ink) !important; font: 800 24px/1.25 Montserrat, "Open Sans", system-ui, sans-serif; text-transform: none; letter-spacing: 0; }
.myre-fc-wrap.fcx .fcx-end h3::after { content: none !important; }
.myre-fc-wrap.fcx .fcx-end p { margin: 0 0 18px; color: var(--x-muted); font-size: 16px; }
.fcx-end-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fcx-score { display: block; margin-bottom: 6px; font-size: 44px; line-height: 1; }

/* Dark */
.myre-fc-wrap.fcx-theme-dark { --x-bg: #0b1220; --x-ink: #e6edf7; --x-muted: #93a3b8; --x-bar: #131d31; --x-bar-line: #26344f; --x-chip: #1c2842; --x-chip-on: #38bdf8; --x-chip-on-ink: #06121f;
  --x-front: #162238; --x-front-ink: #e6edf7; --x-back: #0f2a3f; --x-back-ink: #d7ecfb; --x-card-line: #2b3b5c; --x-shadow: 0 10px 30px rgba(0, 0, 0, .45); --x-accent: #38bdf8; }
.myre-fc-wrap.fcx-theme-dark .myre-fc-header { background: #131d31; border: 1px solid #26344f; }
.myre-fc-wrap.fcx-theme-dark .myre-fc-term { color: #fff; }

/* Vibes */
.myre-fc-wrap.fcx-theme-vibes { --x-bg: linear-gradient(125deg, #1b0f3a, #43207a 28%, #8a2f86 52%, #d24a73 74%, #f39a4c); --x-ink: #fff; --x-muted: rgba(255, 255, 255, .78);
  --x-bar: rgba(255, 255, 255, .12); --x-bar-line: rgba(255, 255, 255, .28); --x-chip: rgba(255, 255, 255, .16); --x-chip-on: #fff; --x-chip-on-ink: #3b1a6b;
  --x-front: linear-gradient(145deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .08)); --x-front-ink: #fff; --x-back: linear-gradient(145deg, rgba(20, 8, 50, .72), rgba(60, 18, 80, .6)); --x-back-ink: #ffe9d6;
  --x-card-line: rgba(255, 255, 255, .35); --x-shadow: 0 14px 40px rgba(30, 5, 60, .45), 0 0 0 1px rgba(255, 255, 255, .05); --x-accent: #ff8a5b;
  background-size: 260% 260%; animation: fcx-drift 22s ease-in-out infinite alternate; }
.myre-fc-wrap.fcx-theme-vibes::before, .myre-fc-wrap.fcx-theme-vibes::after { content: ""; position: absolute; z-index: -1; width: 340px; height: 340px; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; animation: fcx-float 18s ease-in-out infinite alternate; }
.myre-fc-wrap.fcx-theme-vibes::before { top: -80px; left: -60px; background: #5de0e6; }
.myre-fc-wrap.fcx-theme-vibes::after { right: -80px; bottom: -100px; background: #ffcf5c; animation-duration: 24s; animation-direction: alternate-reverse; }
.myre-fc-wrap.fcx-theme-vibes .myre-fc-header { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); }
.myre-fc-wrap.fcx-theme-vibes .myre-fc-term { text-shadow: 0 2px 12px rgba(40, 0, 60, .35); }
.myre-fc-wrap.fcx-theme-vibes .fcx-got { color: #2a0f45; }
@keyframes fcx-drift { from { background-position: 0% 30%; } to { background-position: 100% 70%; } }
@keyframes fcx-float { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }

/* Full screen */
.myre-fc-wrap.fcx:fullscreen { max-width: none; overflow: auto; padding: 24px; border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
.myre-fc-wrap.fcx.fcx-theme-classic:fullscreen { background: #f5f7fa; }

@media (max-width: 599px) {
  .myre-fc-wrap.fcx { padding: 12px; border-radius: 16px; }
  .fcx-bar { gap: 6px; }
  .myre-fc-wrap.fcx .fcx-btn { min-height: 34px; padding: 0 11px; font-size: 13px; }
  .fcx-controls { grid-template-columns: 1fr 1fr; }
  .myre-fc-wrap.fcx .fcx-nav { display: none; }
  .myre-fc-wrap.fcx .fcx-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .myre-fc-wrap.fcx-theme-vibes, .myre-fc-wrap.fcx-theme-vibes::before, .myre-fc-wrap.fcx-theme-vibes::after { animation: none; }
  .myre-fc-wrap.fcx-view-focus .myre-fc-card.fcx-current { animation: none; }
}
