/* ============================================================
   Fraction Visualiser — tool-specific styles
   ============================================================ */

.panel-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin: 0 0 0.8rem; }

.fv-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }
.fv-tab {
  font: inherit; font-weight: 800; font-size: 0.9rem; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 0.5rem 1rem; transition: all 0.15s ease;
}
.fv-tab:hover { border-color: var(--brand); color: var(--brand-strong); }
.fv-tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.fv-view { margin-bottom: 1rem; }

/* ---- Visual model ---- */
.model-grid { display: grid; grid-template-columns: 340px 1fr; gap: 1.6rem; align-items: start; }
.model-toggle { border: none; padding: 0; margin: 0.9rem 0 0; display: flex; gap: 1.1rem; }
.model-toggle legend { margin-bottom: 0.3rem; padding: 0; }
.model-toggle label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; font-weight: 600; cursor: pointer; }

.fraction-readout { display: flex; align-items: center; gap: 1.1rem; margin-top: 1.2rem; background: var(--brand-softer); border: 1px solid #d3ece5; border-radius: var(--r-md); padding: 0.8rem 1rem; }
.big-fraction { display: inline-flex; flex-direction: column; align-items: center; font-weight: 850; font-size: 2.1rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.big-fraction.inline { font-size: 1.7rem; }
.frac-line { width: 100%; min-width: 1.6em; border-top: 3.5px solid currentColor; margin: 3px 0; border-radius: 2px; }
.fraction-words { margin: 0; font-weight: 800; font-size: 1.05rem; }
.fraction-equiv { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }

.model-stage { background: repeating-linear-gradient(-45deg, #fdfcf6, #fdfcf6 18px, #f6f4e8 18px, #f6f4e8 36px); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.6rem; }
.model-stage svg { width: 100%; height: auto; display: block; }
.model-caption { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 0.6rem 0 0; }

/* ---- Quiz views (equivalent / compare / add) ---- */
.fv-context { color: var(--muted); font-size: 0.92rem; margin: 0.2rem 0 0.9rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.fv-score { font-weight: 800; color: var(--brand-strong); font-variant-numeric: tabular-nums; }

.equiv-target { display: flex; align-items: center; gap: 1.4rem; justify-content: center; background: var(--brand-softer); border: 1px solid #d3ece5; border-radius: var(--r-md); padding: 0.9rem; margin-bottom: 1rem; }
.equiv-target svg, .compare-stage svg { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px; }

.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; }
.option-btn {
  font: inherit; font-weight: 800; font-size: 1.15rem; cursor: pointer;
  border: 2px solid var(--line); background: #fff; border-radius: var(--r-md);
  padding: 0.65rem 0.4rem; transition: all 0.12s ease; font-variant-numeric: tabular-nums;
}
.option-btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-softer); }
.option-btn.correct { border-color: var(--ok); background: var(--ok-bg); }
.option-btn.incorrect { border-color: var(--bad); background: var(--bad-bg); }
.option-btn:disabled { cursor: default; }

/* ---- Compare ---- */
.compare-stage { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto auto; align-items: center; gap: 0.8rem 1.4rem; justify-items: center; }
.compare-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; gap: 0.5rem; }
.sign-btn {
  font: inherit; font-weight: 850; font-size: 1.5rem; cursor: pointer;
  width: 64px; height: 56px; border-radius: var(--r-md);
  border: 2px solid var(--line); background: #fff; color: var(--ink); transition: all 0.12s ease;
}
.sign-btn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-softer); }
.sign-btn.correct { border-color: var(--ok); background: var(--ok-bg); }
.sign-btn.incorrect { border-color: var(--bad); background: var(--bad-bg); }
.compare-stage svg { grid-column: 1; }
#compareSvgB { grid-column: 3; grid-row: 1; }
#viewCompare .compare-fraction:first-of-type { grid-column: 1; grid-row: 2; }
#viewCompare .compare-fraction:last-of-type { grid-column: 3; grid-row: 2; }

/* ---- Add / subtract ---- */
.add-stage { text-align: center; }
.add-equation { font-size: 1.9rem; font-weight: 850; letter-spacing: 0.02em; margin: 0.4rem 0 1.1rem; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .model-grid { grid-template-columns: 1fr; }
  .compare-stage { grid-template-columns: 1fr; }
  .compare-actions { grid-row: auto; grid-column: auto; flex-direction: row; }
  .compare-stage svg { grid-column: auto; }
  #compareSvgB, #viewCompare .compare-fraction:first-of-type, #viewCompare .compare-fraction:last-of-type { grid-column: auto; grid-row: auto; }
}
