/* ============================================================
   FRACTIONS & DECIMALS QUEST — self-contained styles
   Everything is scoped under .fd / .fd-page / .fd-* so it cannot
   leak into (or be overridden by) the host site.
   ============================================================ */
.fd-page { margin: 0; padding: 0; min-height: 100vh; background: #FFF7ED; }
.fd-page * { box-sizing: border-box; }

.fd {
  --fd-font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --fd-font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --fd-font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --fd-bg: #FFF7ED;
  --fd-surface: #FFFFFF;
  --fd-surface-2: #FFF1E0;
  --fd-ink: #231A2E;
  --fd-ink-soft: #5B5169;
  --fd-line: #F0DFC8;
  --fd-accent: #E11D48;
  --fd-accent-2: #F97316;
  --fd-violet: #7C3AED;
  --fd-ok: #15A150;
  --fd-ok-soft: #E7F7ED;
  --fd-bad: #D9304F;
  --fd-bad-soft: #FDECEF;
  --fd-warn: #B45309;
  --fd-gold: #F59E0B;
  --fd-shadow: 0 10px 28px rgba(80, 30, 20, .10), 0 2px 6px rgba(80, 30, 20, .06);
  font-family: var(--fd-font-body);
  color: var(--fd-ink);
  background: radial-gradient(at 8% 0%, rgba(249,115,22,.16) 0, transparent 45%), radial-gradient(at 95% 6%, rgba(225,29,72,.12) 0, transparent 40%), var(--fd-bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- top bar ---- */
.fd-top { display: flex; align-items: center; gap: 12px; padding: 12px clamp(14px, 3vw, 28px); background: #fff; border-bottom: 1px solid var(--fd-line); position: sticky; top: 0; z-index: 5; }
.fd-top__brand { display: flex; align-items: center; gap: 10px; font-family: var(--fd-font-display); font-weight: 800; font-size: 1.1rem; color: var(--fd-ink); text-decoration: none; }
.fd-top__logo { font-size: 1.5rem; }
.fd-top__spacer { flex: 1; }
.fd-pill { background: #FEF3C7; color: #92400E; font-weight: 800; font-size: .9rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.fd-iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--fd-line); background: #fff; color: var(--fd-ink); text-decoration: none; font-weight: 800; }

.fd-main { padding: clamp(14px, 3vw, 32px) clamp(14px, 3vw, 28px) 60px; }
.fd-wrap { max-width: 1040px; margin: 0 auto; }

/* ---- type ---- */
.fd-eyebrow { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--fd-accent); }
.fd-h1 { font-family: var(--fd-font-display); font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.5rem); letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 8px; }
.fd-h2 { font-family: var(--fd-font-display); font-weight: 800; font-size: clamp(1.25rem, 4vw, 1.7rem); margin: 28px 0 12px; }
.fd-lead { font-size: clamp(1rem, 2.6vw, 1.15rem); color: var(--fd-ink-soft); margin: 0 0 16px; }
.fd-hero { text-align: center; padding: 8px 0 4px; }
.fd-back { display: inline-block; margin-bottom: 12px; font-weight: 700; color: var(--fd-ink-soft); text-decoration: none; padding: 8px 4px; }

/* ---- buttons ---- */
.fd-btn { font-family: var(--fd-font-body); font-weight: 700; font-size: 1rem; min-height: 48px; padding: 12px 20px; border-radius: 14px; border: 1px solid #E5D3BA; background: #fff; color: var(--fd-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .12s ease, box-shadow .15s ease; }
.fd-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(80,30,20,.12); }
.fd-btn:focus-visible, .fd-choice:focus-visible, .fd-chip:focus-visible, .fd-in:focus-visible { outline: 3px solid rgba(225,29,72,.35); outline-offset: 2px; }
.fd-btn--primary { background: linear-gradient(135deg, var(--fd-accent), var(--fd-accent-2)); color: #fff; border-color: transparent; }
.fd-btn--gold { background: linear-gradient(135deg, #F59E0B, #EF4444); color: #fff; border-color: transparent; }
.fd-btn--lg { font-size: 1.1rem; min-height: 54px; padding: 14px 26px; }
.fd-chiprow { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.fd-link { background: none; border: none; color: var(--fd-ink-soft); text-decoration: underline; cursor: pointer; font: inherit; padding: 10px; min-height: 44px; }
.fd-foot { text-align: center; margin-top: 30px; }

/* ---- skill cards ---- */
.fd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.fd-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--fd-surface); border: 2px solid var(--fd-line); border-radius: 20px; text-decoration: none; color: var(--fd-ink); box-shadow: 0 2px 8px rgba(80,30,20,.06); min-height: 168px; transition: transform .12s ease, box-shadow .15s ease; }
.fd-card:hover { transform: translateY(-3px); box-shadow: var(--fd-shadow); }
.fd-card--rec { border-color: var(--fd-accent); box-shadow: 0 0 0 4px rgba(225,29,72,.14), var(--fd-shadow); }
.fd-card--done { background: linear-gradient(180deg, #F0FBF4, #fff); border-color: #A7E3BC; }
.fd-card__flag { position: absolute; top: -11px; right: 14px; background: var(--fd-accent); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase; }
.fd-card__emoji { font-size: 1.8rem; }
.fd-card__id { position: absolute; top: 14px; right: 16px; font-family: var(--fd-font-mono); font-weight: 700; font-size: .8rem; color: #A8957F; }
.fd-card__title { font-family: var(--fd-font-display); font-weight: 800; font-size: 1.1rem; line-height: 1.2; }
.fd-card__blurb { font-size: .86rem; color: var(--fd-ink-soft); flex: 1; }
.fd-card__foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.fd-card__state { display: flex; flex-direction: column; font-size: .8rem; color: var(--fd-ink-soft); font-weight: 600; }
.fd-ring { width: 46px; height: 46px; flex: 0 0 auto; }
.fd-ring__bg { stroke: #F1E4D0; }
.fd-ring__fg { stroke: var(--fd-accent-2); stroke-linecap: round; }
.fd-card--done .fd-ring__fg { stroke: var(--fd-ok); }
.fd-ring__txt { font-size: 9px; font-weight: 800; fill: var(--fd-ink); }
.fd-star { color: #E5D7C2; font-size: 1.05rem; letter-spacing: 1px; }
.fd-star--on { color: var(--fd-gold); }

/* ---- panels ---- */
.fd-panel { background: var(--fd-surface); border: 1px solid var(--fd-line); border-radius: 26px; padding: clamp(16px, 3vw, 30px); box-shadow: var(--fd-shadow); }
.fd-learn { font-size: 1.1rem; line-height: 1.7; }
.fd-example { margin-top: 14px; background: var(--fd-surface-2); border-left: 6px solid var(--fd-accent-2); border-radius: 14px; padding: 14px 18px; font-size: 1.08rem; line-height: 2; }
.fd-example__tag { display: block; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--fd-warn); }

/* ---- fractions in text ---- */
.fd-fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .18em; line-height: 1.12; font-weight: 800; }
.fd-fr b { font-weight: 800; padding: 0 .3em; border-bottom: .09em solid currentColor; }
.fd-fr i { font-style: normal; font-weight: 800; padding: 0 .3em; }
.fd-mix { display: inline-flex; align-items: center; }
.fd-mix__w { font-weight: 800; font-size: 1.15em; }
.fd-box { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.5em; border: 2.5px dashed var(--fd-accent); border-radius: 8px; color: var(--fd-accent); font-weight: 800; padding: 0 .3em; margin: 0 .15em; background: #FFF1F3; }
.fd-eq { display: inline-block; font-size: 1.25em; margin: 4px 0; }
.fd-bignum { font-family: var(--fd-font-mono); font-weight: 700; font-size: 2rem; letter-spacing: .04em; }
.fd-bignum--sm { font-size: 1.2rem; }
.fd-bigwrap { margin: 10px 0 0; }
.fd-ul { text-decoration-thickness: 4px; text-underline-offset: 6px; text-decoration-color: var(--fd-accent); color: var(--fd-accent); }
.fd-says { margin: 8px 0; padding: 12px 16px; background: #F5F3FF; border-radius: 14px; font-weight: 700; font-size: 1.15rem; color: #4C1D95; }
.fd-sep { margin: 0 4px; }

/* ---- question ---- */
.fd-qhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.fd-meter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fd-meter__pips { display: inline-flex; gap: 4px; }
.fd-pip { width: 14px; height: 14px; border-radius: 50%; background: #EADBC6; }
.fd-pip--ok { background: var(--fd-ok); }
.fd-pip--no { background: var(--fd-bad); }
.fd-meter__txt { font-size: .82rem; font-weight: 700; color: var(--fd-ink-soft); }
.fd-q { background: var(--fd-surface-2); border-radius: 20px; padding: clamp(14px, 3vw, 24px); }
.fd-angle { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: #fff; color: var(--fd-violet); border: 1px solid #DDD0FB; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
.fd-prompt { font-size: clamp(1.12rem, 3vw, 1.35rem); font-weight: 600; line-height: 1.7; }
.fd-visual { margin: 12px 0 4px; text-align: center; }
.fd-svg { width: 100%; max-width: 420px; height: auto; }
.fd-svg--pie { max-width: 190px; }
.fd-svg--grid { max-width: 250px; }
.fd-input { margin-top: 16px; display: flex; justify-content: center; }

/* inputs */
.fd-in { font-family: var(--fd-font-mono); font-weight: 700; font-size: 1.5rem; text-align: center; width: 84px; height: 56px; border: 2.5px solid #D9C3A5; border-radius: 14px; background: #fff; color: var(--fd-ink); }
.fd-in--wide { width: min(240px, 60vw); }
.fd-in--w { width: 70px; }
.fd-in:disabled { background: #F4EBDD; color: var(--fd-ink-soft); }
.fd-fi { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.fd-fi__bar { width: 92px; height: 4px; border-radius: 3px; background: var(--fd-ink); }
.fd-mi { display: inline-flex; align-items: center; gap: 10px; }
.fd-di { display: flex; align-items: center; gap: 10px; }
.fd-unit { font-weight: 800; color: var(--fd-ink-soft); }

/* choices */
.fd-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; width: 100%; }
.fd-choices--wide { grid-template-columns: 1fr; }
.fd-choices--two { grid-template-columns: 1fr 1fr; }
.fd-choices--three { grid-template-columns: repeat(3, 1fr); }
.fd-choice { min-height: 56px; padding: 12px 14px; font-family: var(--fd-font-body); font-size: 1.1rem; font-weight: 700; color: var(--fd-ink); background: #fff; border: 2.5px solid #D9C3A5; border-radius: 16px; cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent; }
.fd-choice--sel { border-color: var(--fd-violet); background: #F5F3FF; box-shadow: 0 0 0 3px rgba(124,58,237,.18); }
.fd-choice--right { border-color: var(--fd-ok); background: var(--fd-ok-soft); }
.fd-choice--wrong { border-color: var(--fd-bad); background: var(--fd-bad-soft); }
.fd-choice:disabled { cursor: default; }

/* order */
.fd-order { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fd-order__tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 76px; width: 100%; padding: 10px; border: 2.5px dashed #D9C3A5; border-radius: 16px; background: #fff; align-items: center; }
.fd-order__ph { color: #A8957F; font-weight: 600; }
.fd-order__pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fd-chip { position: relative; min-width: 76px; min-height: 60px; padding: 10px 16px; font-size: 1.15rem; font-weight: 700; color: var(--fd-ink); background: #fff; border: 2.5px solid #D9C3A5; border-radius: 16px; cursor: pointer; }
.fd-chip--used { opacity: .3; }
.fd-chip--in { border-color: var(--fd-violet); background: #F5F3FF; }
.fd-chip__n { position: absolute; top: -9px; left: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--fd-violet); color: #fff; font-size: .75rem; display: flex; align-items: center; justify-content: center; }

/* hint, messages, feedback */
.fd-hintbox { margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: #FEF9C3; border: 1px solid #FDE68A; }
.fd-hintbox__note { font-size: .82rem; color: var(--fd-warn); margin-top: 6px; }
.fd-msg { min-height: 24px; margin-top: 10px; text-align: center; font-weight: 700; }
.fd-msg--warn { color: var(--fd-warn); }
.fd-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.fd-actions[hidden], .fd-hintbox[hidden] { display: none; }
.fd-feedback { margin-top: 16px; padding: clamp(14px, 3vw, 22px); border-radius: 20px; border: 2px solid; }
.fd-feedback--ok { background: var(--fd-ok-soft); border-color: #86D7A5; }
.fd-feedback--bad { background: #FFF8F0; border-color: #F1B0A0; }
.fd-feedback__head { font-family: var(--fd-font-display); font-weight: 800; font-size: 1.35rem; }
.fd-feedback--ok .fd-feedback__head { color: #0E7A3B; }
.fd-feedback--bad .fd-feedback__head { color: #B4311E; }
.fd-xp { display: inline-block; margin-left: 8px; background: #FEF3C7; color: #92400E; font-size: .85rem; padding: 2px 10px; border-radius: 999px; }
.fd-feedback__note { background: #fff; border-radius: 10px; padding: 8px 12px; }
.fd-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.fd-compare > div { background: #fff; border-radius: 14px; padding: 10px 14px; }
.fd-compare__lbl { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--fd-ink-soft); }
.fd-compare__v { font-size: 1.4rem; font-weight: 800; }
.fd-compare__v--you { color: var(--fd-bad); }
.fd-compare__v--right { color: var(--fd-ok); }
.fd-howto { background: #fff; border-radius: 14px; padding: 12px 16px; }
.fd-steps { margin: 6px 0 0; padding-left: 22px; line-height: 2; }
.fd-steps li { margin-bottom: 6px; }
.fd-details { margin-top: 8px; background: #fff; border-radius: 12px; padding: 8px 14px; }
.fd-details summary { cursor: pointer; font-weight: 700; min-height: 36px; display: flex; align-items: center; }
.fd-mastered { margin: 12px 0; padding: 12px 16px; border-radius: 14px; background: linear-gradient(135deg, #FEF3C7, #FFE4E6); border: 2px solid #FCD34D; font-size: 1.05rem; }

/* ladder + columns */
.fd-ladder { border-collapse: collapse; margin: 8px 0 4px; font-family: var(--fd-font-mono); font-weight: 700; font-size: 1.1rem; background: #fff; }
.fd-ladder th { padding: 4px 12px; color: var(--fd-accent); border-right: 3px solid var(--fd-ink); text-align: center; }
.fd-ladder td { padding: 4px 14px; text-align: center; border-bottom: 1px solid #E8DAC4; }
.fd-ladder__end td { border-bottom: none; }
.fd-ladder__lcm { margin-bottom: 6px; }
.fd-col { display: inline-block; margin: 8px 0; padding: 10px 16px; background: #fff; border-radius: 12px; font-family: var(--fd-font-mono); font-weight: 700; font-size: 1.15rem; line-height: 1.4; }
.fd-fill { color: var(--fd-accent); background: #FFE4E6; border-radius: 3px; }

/* ---- small screens ---- */
@media (max-width: 560px) {
  .fd-top__brand span:last-child { font-size: .98rem; }
  .fd-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fd-card { min-height: 190px; padding: 12px; }
  .fd-compare { grid-template-columns: 1fr; }
  .fd-choices--three { gap: 6px; }
  .fd-in { width: 74px; }
}
@media (max-width: 380px) { .fd-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .fd-card, .fd-btn { transition: none; } }
