/* Simplify Fractions Step by Step (pages/simplifying-fractions.html).
   Hero and content cards follow the fraction family (Compare Fractions, Add & Subtract). */
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: hidden; }
header .main-title { margin-bottom: 0; }
.main-content { min-width: 0; }

.sf-page { gap: 1.5rem; overflow: hidden; min-width: 0; }

/* ---------- hero ---------- */
.sf-hero { max-width: 900px; margin: 0 auto .2rem; text-align: center; }
.sf-kicker { display: inline-block; margin-bottom: .55rem; color: #5e78ad; font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.sf-hero h1 { margin: 0 0 .7rem; color: var(--primary-color, #2f66d8); font: 700 clamp(2rem, 4vw, 3.15rem)/1.15 'Raleway', sans-serif; overflow-wrap: anywhere; }
.sf-page .sf-hero p { max-width: 760px; margin: 0 auto; color: #4a5568; font-size: 1.06rem; line-height: 1.65; text-align: center; }
.sf-teacher-link { display: inline-block; margin-top: .8rem; color: #2d5fae; font-weight: 800; font-size: .95rem; text-decoration: none; }
.sf-teacher-link:hover { text-decoration: underline; }

/* ---------- tool shell ---------- */
.sf-tool {
  --blue: #3f73c9; --blue-dark: #2d5fae; --blue-soft: #edf5ff;
  --green: #2f7a55; --green-soft: #eaf7f0;
  --rose: #b3434e; --rose-soft: #fff1f3;
  --gold-soft: #fff7e6; --ink: #172033; --muted: #5b6b80;
  width: 100%; max-width: 1040px; margin: 0 auto 1.8rem; padding: 22px 22px 28px;
  background: #f5f8fc; border: 1px solid #e7edf5; border-radius: 20px; color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
.sf-tool p { max-width: none; }
.sf-tool [hidden] { display: none !important; }

.sf-topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sf-modes { display: inline-flex; padding: 4px; background: #e6edf7; border-radius: 999px; }
.sf-mode { border: 0; background: transparent; color: #44546b; font: 800 .95rem/1 inherit; padding: 9px 16px; border-radius: 999px; cursor: pointer; }
.sf-mode[aria-selected="true"] { background: #fff; color: var(--blue-dark); box-shadow: 0 2px 8px rgba(40, 60, 90, .12); }
.sf-howto-btn { border: 0; background: transparent; color: var(--blue-dark); font: 700 .92rem/1 inherit; cursor: pointer; padding: 8px 4px; }
.sf-howto-btn:hover { text-decoration: underline; }
.sf-howto { background: #fff; border: 1px solid #dde6f2; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.sf-howto ol { margin: 0 0 8px; padding-left: 1.3rem; }
.sf-howto li { margin: 4px 0; line-height: 1.5; }
.sf-tool .sf-howto-example { margin: 0; color: var(--muted); line-height: 2.1; }

/* ---------- setup ---------- */
.sf-setup { background: #fff; border: 1px solid #e2e9f2; border-radius: 16px; box-shadow: 0 10px 28px rgba(42, 61, 92, .08); padding: 20px; text-align: center; }
.sf-levels { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.sf-level { min-width: 132px; border: 2px solid #d5deea; background: #fbfdff; color: var(--ink); border-radius: 14px; padding: 10px 14px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px; }
.sf-level strong { font-size: 1rem; }
.sf-level small { color: var(--muted); font-size: .8rem; }
.sf-level[aria-checked="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(63, 115, 201, .15); }
.sf-tool .sf-setup-note { margin: 12px 0 0; color: var(--muted); font-size: .88rem; text-align: center; }
.sf-own-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px; }
.sf-own-label { font-weight: 800; color: #44546b; }
.sf-frac-input { display: grid; grid-template-rows: 44px 3px 44px; width: 86px; align-items: center; }
.sf-frac-input input, .sf-in {
  width: 100%; height: 40px; padding: 4px 6px; border: 2px solid #d5deea; border-radius: 10px; background: #fbfdff;
  color: var(--ink); font: 750 1.2rem/1 system-ui, sans-serif; text-align: center; outline: none;
}
.sf-frac-input input:focus, .sf-in:focus { border-color: #6f97dc; background: #fff; box-shadow: 0 0 0 3px rgba(63, 115, 201, .18); }
.sf-frac-line { display: block; height: 3px; border-radius: 2px; background: #33415c; }
.sf-tool .sf-setup-msg { min-height: 1.3em; margin: 10px 0 0; font-weight: 700; text-align: center; }
.sf-tool .sf-setup-msg.bad { color: var(--rose); }

/* ---------- buttons ---------- */
.sf-btn { border: 0; border-radius: 12px; padding: 11px 18px; font: 800 .98rem/1.2 inherit; cursor: pointer; }
.sf-btn:focus-visible, .sf-mode:focus-visible, .sf-level:focus-visible, .sf-howto-btn:focus-visible { outline: 3px solid #4a6fd6; outline-offset: 2px; }
.sf-primary { background: var(--blue-dark); color: #fff; box-shadow: 0 6px 16px rgba(45, 95, 174, .25); }
.sf-primary:hover { background: #24508f; }
.sf-soft { background: #e9eef6; color: #33415c; }
.sf-soft:hover { background: #dde5f1; }
.sf-soft:disabled { opacity: .55; cursor: default; }
.sf-choice { background: #fff; color: var(--blue-dark); border: 2px solid #b9cbea; }
.sf-choice:hover { background: var(--blue-soft); border-color: var(--blue); }

/* ---------- work area ---------- */
.sf-work { background: #fff; border: 1px solid #e2e9f2; border-radius: 16px; box-shadow: 0 10px 28px rgba(42, 61, 92, .08); padding: 18px 20px 20px; }
.sf-progress { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.sf-dot { width: 12px; height: 12px; border-radius: 50%; background: #dde5f0; }
.sf-dot.done { background: var(--green); }
.sf-dot.now { background: var(--blue); box-shadow: 0 0 0 3px rgba(63, 115, 201, .2); }
.sf-progress-text { margin-left: 6px; color: var(--muted); font-size: .85rem; font-weight: 700; }
.sf-problem { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sf-problem-label { color: #5e78ad; font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.sf-path { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; min-height: 96px; padding: 6px 0; }

.sf-frac { display: inline-grid; grid-template-rows: auto auto; justify-items: center; min-width: 54px; font: 800 2rem/1.1 system-ui, sans-serif; color: var(--ink); }
.sf-frac .sf-num { padding: 0 6px 4px; }
.sf-frac .sf-den { padding: 4px 6px 0; border-top: 3px solid #33415c; width: 100%; text-align: center; }
.sf-frac.is-start { color: #1f3f78; }
.sf-path.is-done .sf-frac:last-of-type:not(.is-start) { color: var(--green); }
.sf-step-frac { width: 78px; }
/* The ÷k is written on the top row and the bottom row: the top and the bottom are divided, not the fraction. */
.sf-op { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #5b6b80; font-weight: 800; font-size: .95rem; line-height: 1.1; }
.sf-op-top, .sf-op-bottom { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sf-op-arrow { font-size: 1.3rem; line-height: 1; }
.sf-op-input .sf-in { width: 58px; height: 36px; }
.sf-op-label { font-size: 1.2rem; color: #33415c; }
.sf-eq, .sf-whole { font: 800 2rem/1 system-ui, sans-serif; color: var(--green); }

.sf-panel { text-align: center; margin-top: 8px; }
.sf-tool .sf-question { margin: 6px 0 12px; font-size: 1.08rem; font-weight: 700; color: #26324a; text-align: center; line-height: 1.5; }
.sf-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sf-tool .sf-done { margin: 4px 0 8px; font-size: 1.1rem; font-weight: 800; color: var(--green); line-height: 1.6; text-align: center; }
.sf-tool .sf-shortcut, .sf-tool .sf-note { margin: 0 auto 10px; max-width: 640px; color: #44546b; line-height: 1.6; text-align: center; }
.sf-shortcut { background: var(--gold-soft); border-radius: 10px; padding: 6px 12px; }

.sf-inline-frac { display: inline-grid; vertical-align: middle; text-align: center; font-weight: 800; line-height: 1.05; margin: 0 2px; font-size: .92em; }
.sf-inline-frac > span:last-child { border-top: 2px solid currentColor; }
.sf-inline-frac > span { padding: 0 3px; white-space: nowrap; }

.sf-tool .sf-feedback { min-height: 1.4em; margin: 10px auto 0; max-width: 680px; text-align: center; font-weight: 700; line-height: 1.5; }
.sf-tool .sf-feedback.good { color: var(--green); }
.sf-tool .sf-feedback.bad { color: var(--rose); }

.sf-hint { margin: 12px auto 0; max-width: 680px; background: #fffaf0; border: 1px solid #f0dcb0; border-radius: 12px; padding: 10px 14px; color: #4c381c; }
.sf-hint p, .sf-solution p { margin: 4px 0; line-height: 1.6; }
.sf-hint-tag { display: inline-block; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #9a6a12; margin-bottom: 2px; }
.sf-f { display: inline-block; min-width: 1.6em; padding: 0 3px; margin: 1px; border-radius: 6px; text-align: center; color: #6b7280; }
.sf-f.is-common { background: #dcefe4; color: #1f5f3f; font-weight: 800; }
.sf-f.is-gcf { outline: 2px solid #1f5f3f; }

.sf-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.sf-solution { margin: 12px auto 0; max-width: 680px; background: var(--blue-soft); border: 1px solid #cddcf4; border-radius: 12px; padding: 10px 16px; }
.sf-solution h3 { margin: 4px 0 6px; font-size: 1rem; color: #1f3f78; line-height: 2; }
.sf-tool .sf-sol-answer { font-weight: 800; font-size: 1.05rem; line-height: 2.1; }

/* ---------- fraction bars ---------- */
.sf-bars { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #dbe3ee; }
.sf-bar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 8px; }
.sf-bar-label { text-align: right; font-size: 1.1rem; }
.sf-bar { min-width: 0; }
.sf-bar svg { display: block; width: 100%; height: auto; }
.sf-tool .sf-bar-note { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: .9rem; min-height: 1.2em; }

/* ---------- round summary ---------- */
.sf-summary { background: #fff; border: 1px solid #e2e9f2; border-radius: 16px; box-shadow: 0 10px 28px rgba(42, 61, 92, .08); padding: 20px; text-align: center; }
.sf-summary h2 { margin: 0 0 6px; color: #1f3f78; font-size: 1.4rem; }
.sf-summary h2 i { color: #e0a52b; }
.sf-sum-list { list-style: none; counter-reset: s; margin: 12px auto 16px; padding: 0; max-width: 520px; text-align: left; }
.sf-sum-list li { counter-increment: s; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 10px; border-bottom: 1px solid #edf1f6; }
.sf-sum-list li::before { content: counter(s) "."; font-weight: 800; color: #8a97aa; margin-right: 6px; }
.sf-sum-path { flex: 1; font-weight: 800; }
.sf-sum-tag { color: var(--muted); font-size: .88rem; }

/* ---------- learning content (same as the fraction family) ---------- */
.sf-content { display: grid; gap: 18px; max-width: 900px; margin: 0 auto; }
.content-card { background: #fff; border: 1px solid #e5ecf5; border-radius: 18px; padding: 24px 26px; box-shadow: 0 8px 22px rgba(42, 61, 92, .06); }
.content-card h2 { margin: 0 0 12px; color: #253b63; font-size: 1.35rem; text-align: left; }
.content-card h3 { margin: 14px 0 4px; color: #33415c; font-size: 1.02rem; }
.sf-page .content-card p, .content-card li { max-width: none; color: #4a5568; line-height: 1.65; text-align: left; }
.content-card ol { margin: 0; padding-left: 1.3rem; }
.content-card li p { margin: 2px 0 8px; }
.sf-example { background: #f5f8fc; border-radius: 12px; padding: 12px 16px; margin-bottom: 12px; font-weight: 800; }
.sf-example > div:first-child { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 1.15rem; color: #1f3f78; }
.sf-ex-op { color: #5b6b80; font-size: .95rem; }
.sf-ex-short { margin-top: 6px; font-weight: 600; color: #5b4a1c; font-size: .95rem; }

@media (max-width: 640px) {
  .sf-tool { padding: 16px 12px 20px; border-radius: 16px; }
  .sf-work, .sf-setup, .sf-summary { padding: 14px 12px; }
  .sf-frac { font-size: 1.6rem; min-width: 44px; }
  .sf-path { gap: 6px; min-height: 80px; }
  .sf-op-input .sf-in { width: 50px; }
  .sf-op { font-size: .85rem; }
  .sf-step-frac { width: 64px; }
  .sf-bar-row { grid-template-columns: 44px minmax(0, 1fr); gap: 6px; }
  .sf-bar-label { font-size: .95rem; }
  .sf-level { min-width: 0; flex: 1 1 30%; padding: 8px 6px; }
  .content-card { padding: 20px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
