/* Frações Visuais 1.0.0 — estilos isolados dentro de .fv-app */
.fv-app {
  --fv-a: #3b82f6; --fv-b: #f59e0b; --fv-r: #10b981; --fv-p: #8b5cf6; --fv-red: #ef4444;
  --fv-ink: #1e293b; --fv-mid: #64748b; --fv-line: #e2e8f0; --fv-bg: #f8fafc;
  font-family: ui-rounded, "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--fv-ink);
  background: #fff;
  border: 2px solid var(--fv-line);
  border-radius: 20px;
  padding: 18px;
  margin: 1.5em 0;
  font-size: 16px;
  line-height: 1.5;
  box-sizing: border-box;
  max-width: 100%;
  text-align: left;
}
.fv-app *, .fv-app *::before, .fv-app *::after { box-sizing: border-box; }
.fv-app p { margin: 0 0 12px; }
.fv-app b { font-weight: 800; }

/* reset de botões e campos (temas costumam estilizar) */
.fv-app button {
  font: inherit; margin: 0; text-transform: none; letter-spacing: normal; line-height: 1.2;
  box-shadow: none; cursor: pointer; text-decoration: none; min-height: 0; width: auto;
}
.fv-app button:disabled { cursor: not-allowed; opacity: .4; }
.fv-app button:focus-visible, .fv-app input:focus-visible, .fv-app select:focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }
.fv-app input, .fv-app select { font: inherit; margin: 0; box-shadow: none; max-width: 100%; }

/* cabeçalho e abas */
.fv-app .fv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fv-app .fv-brand { font-size: 22px; font-weight: 900; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.fv-app .fv-logo { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #ddd6fe, #bfdbfe); font-size: 22px; }
.fv-app .fv-vistoggle { display: flex; align-items: center; gap: 8px; }
.fv-app .fv-tabs { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--fv-line); margin-bottom: 16px; }
.fv-app .fv-tab {
  background: transparent; border: 0; border-bottom: 4px solid transparent; color: var(--fv-mid);
  padding: 10px 14px; font-weight: 800; font-size: 16px; border-radius: 10px 10px 0 0; margin-bottom: -2px;
}
.fv-app .fv-tab:hover { background: var(--fv-bg); color: var(--fv-ink); }
.fv-app .fv-tab[aria-selected="true"] { color: #6d28d9; border-bottom-color: var(--fv-p); background: #f5f3ff; }
.fv-app .fv-panel[hidden] { display: none; }

.fv-app .fv-intro { background: #f5f3ff; border-radius: 14px; padding: 10px 14px; color: #4c1d95; }

/* controles */
.fv-app .fv-controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; margin: 6px 0 12px; }
.fv-app .fv-ctl { display: flex; flex-direction: column; gap: 6px; }
.fv-app .fv-lbl { font-size: 13px; font-weight: 800; color: var(--fv-mid); text-transform: uppercase; letter-spacing: .04em; }
.fv-app .fv-eqrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fv-app .fv-fin { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 14px; background: color-mix(in srgb, var(--fv-c) 10%, white); border: 2px solid var(--fv-c); }
.fv-app .fv-fin-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--fv-c); }
.fv-app .fv-num {
  width: 64px; height: 42px; text-align: center; font-size: 22px; font-weight: 900; color: var(--fv-ink);
  border: 2px solid #cbd5e1; border-radius: 10px; background: #fff; padding: 2px 4px;
}
.fv-app .fv-num-r3 { width: 86px; }
.fv-app .fv-text { height: 42px; border: 2px solid #cbd5e1; border-radius: 10px; padding: 4px 10px; font-size: 17px; background: #fff; color: var(--fv-ink); width: 190px; }
.fv-app .fv-text-sm { width: 130px; font-weight: 700; }
.fv-app .fv-select { height: 42px; border: 2px solid #cbd5e1; border-radius: 10px; padding: 4px 10px; background: #fff; font-size: 16px; color: var(--fv-ink); }

.fv-app .fv-seg { display: inline-flex; background: #f1f5f9; border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.fv-app .fv-seg-btn { background: transparent; border: 0; border-radius: 9px; padding: 8px 12px; font-weight: 800; color: var(--fv-mid); font-size: 15px; }
.fv-app .fv-seg-btn:hover { color: var(--fv-ink); background: #e2e8f0; }
.fv-app .fv-seg-btn[aria-pressed="true"] { background: #fff; color: #6d28d9; box-shadow: 0 1px 3px rgba(15, 23, 42, .15); }
.fv-app .fv-seg-ops .fv-seg-btn { font-size: 26px; width: 48px; height: 48px; padding: 0; }

.fv-app .fv-btn { border-radius: 12px; padding: 10px 16px; font-weight: 800; font-size: 15px; border: 2px solid transparent; }
.fv-app .fv-btn-main { background: var(--fv-p); color: #fff; }
.fv-app .fv-btn-main:hover:not(:disabled) { background: #7c3aed; }
.fv-app .fv-btn-ghost { background: #fff; color: #5b21b6; border-color: #ddd6fe; }
.fv-app .fv-btn-ghost:hover:not(:disabled) { background: #f5f3ff; }
.fv-app .fv-btn-sm { padding: 4px 10px; font-size: 14px; margin-left: 6px; }
.fv-app .fv-btnrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; }
.fv-app .fv-chipbtn { min-width: 42px; height: 42px; border-radius: 12px; border: 2px solid #a7f3d0; background: #ecfdf5; color: #047857; font-weight: 900; font-size: 17px; padding: 0 10px; }
.fv-app .fv-chipbtn:hover:not(:disabled) { background: #d1fae5; }
.fv-app .fv-chipbtn-alt { border-color: #fbcfe8; background: #fdf2f8; color: #be185d; font-size: 15px; }
.fv-app .fv-chipbtn-alt:hover:not(:disabled) { background: #fce7f3; }
.fv-app .fv-note { font-size: 13px; color: var(--fv-mid); }

.fv-app .fv-msg:empty { display: none; }
.fv-app .fv-msg { background: #fff7ed; border: 2px solid #fed7aa; color: #9a3412; border-radius: 12px; padding: 8px 12px; margin: 8px 0; font-weight: 700; }

/* regra de três */
.fv-app .fv-r3form { display: flex; flex-direction: column; gap: 10px; background: var(--fv-bg); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.fv-app .fv-r3line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fv-app .fv-r3w { font-weight: 800; color: var(--fv-mid); min-width: 46px; }
.fv-app .fv-arrow { font-size: 22px; font-weight: 900; color: var(--fv-mid); }
.fv-app .fv-x { display: inline-grid; place-items: center; width: 86px; height: 42px; border-radius: 10px; background: #ecfdf5; border: 2px dashed var(--fv-r); font-weight: 900; font-size: 22px; color: #047857; }
.fv-app .fv-echo { font-weight: 800; min-width: 60px; }
.fv-app .fv-hint { font-size: 14px; color: #92400e; background: #fffbeb; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }

/* passo a passo */
.fv-app .fv-stepper { border: 2px solid var(--fv-line); border-radius: 18px; padding: 14px; background: #fff; }
.fv-app .fv-dots { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 10px; padding: 0; }
.fv-app .fv-dots li { display: flex; align-items: center; margin: 0; padding: 0; }
.fv-app .fv-dots li + li::before { content: ""; width: 22px; height: 3px; background: var(--fv-line); display: block; }
.fv-app .fv-dots li.is-done + li::before, .fv-app .fv-dots li.is-done + li.is-now::before { background: var(--fv-p); }
.fv-app .fv-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--fv-line); background: #fff; color: var(--fv-mid); font-weight: 900; padding: 0; font-size: 15px; }
.fv-app .is-done .fv-dot { background: #ede9fe; border-color: #c4b5fd; color: #6d28d9; }
.fv-app .is-now .fv-dot { background: var(--fv-p); border-color: var(--fv-p); color: #fff; transform: scale(1.1); }
.fv-app .fv-stage-title { font-size: 20px; font-weight: 900; margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fv-app .fv-pill { font-size: 12px; font-weight: 800; background: #ede9fe; color: #6d28d9; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

.fv-app .fv-visual { background: var(--fv-bg); border-radius: 14px; padding: 8px; overflow-x: auto; }
.fv-app .fv-svg { display: block; width: 100%; min-width: 540px; height: auto; max-height: none; overflow: visible; }
.fv-app .fv-side { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-top: 12px; }
@media (max-width: 760px) { .fv-app .fv-side { grid-template-columns: 1fr; } .fv-app { padding: 12px; } }

.fv-app .fv-explain { font-size: 17px; line-height: 1.65; background: #fff; border-left: 5px solid var(--fv-p); padding: 6px 4px 6px 14px; animation: fvIn .35s ease both; }
.fv-app .fv-tip { margin-top: 10px; background: #fefce8; border-radius: 10px; padding: 8px 10px; font-size: 15px; color: #713f12; }
.fv-app .fv-warn { margin-top: 10px; background: #fef2f2; border-radius: 10px; padding: 8px 10px; font-size: 15px; color: #991b1b; }
.fv-app .fv-answer-big { display: block; font-size: 24px; font-weight: 900; color: #047857; margin-bottom: 6px; }

/* caderno quadriculado */
.fv-app .fv-calc {
  font-family: "Comic Neue", "Comic Sans MS", "Chalkboard SE", "Segoe Print", ui-rounded, cursive, sans-serif;
  background-color: #fff;
  background-image: linear-gradient(#e0e7ff 1px, transparent 1px), linear-gradient(90deg, #e0e7ff 1px, transparent 1px);
  background-size: 20px 20px;
  border: 2px solid #c7d2fe; border-radius: 14px; padding: 10px 14px 14px; font-size: 19px; min-height: 120px;
}
.fv-app .fv-calc-h { font-family: inherit; font-weight: 900; color: #4338ca; font-size: 15px; margin-bottom: 6px; }
.fv-app .fv-line { padding: 6px 8px; border-radius: 10px; opacity: .5; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.fv-app .fv-line.is-now { opacity: 1; background: rgba(254, 240, 138, .55); animation: fvIn .4s ease both; }
.fv-app .fv-chain { opacity: 1; }

.fv-app .fv-fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .12em; line-height: 1.15; font-weight: 800; }
.fv-app .fv-fr-n { padding: 0 .25em .06em; border-bottom: .12em solid currentColor; }
.fv-app .fv-fr-d { padding: .06em .25em 0; }
.fv-app .fv-k { font-style: normal; color: #dc2626; background: #fee2e2; border-radius: .3em; padding: 0 .18em; margin-left: .1em; font-weight: 900; }
.fv-app .fv-op { font-weight: 900; margin: 0 .2em; }
.fv-app .fv-mixed { display: inline-flex; align-items: center; gap: .1em; }
.fv-app .fv-mixed-w { font-size: 1.5em; font-weight: 900; }
.fv-app .fv-ca { color: #2563eb; }
.fv-app .fv-cb { color: #d97706; }
.fv-app .fv-cr { color: #059669; }
.fv-app .fv-big { font-size: 1.4em; color: #059669; }
.fv-app .fv-answer { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; background: #d1fae5; border: 2px solid #6ee7b7; border-radius: 12px; padding: 4px 10px; font-weight: 900; color: #065f46; }

.fv-app .fv-mmc-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fv-app table.fv-mmc { border-collapse: collapse; margin: 0; font-size: 18px; width: auto; border: 0; background: transparent; }
.fv-app table.fv-mmc td { padding: 1px 10px; border: 0; background: transparent; }
.fv-app table.fv-mmc td:first-child { border-right: 3px solid var(--fv-ink); text-align: right; }
.fv-app table.fv-mmc td:last-child { color: #dc2626; font-weight: 900; }
.fv-app table.fv-r3t { border-collapse: collapse; margin: 0; width: auto; border: 0; background: transparent; font-size: 18px; }
.fv-app table.fv-r3t th, .fv-app table.fv-r3t td { border: 2px solid #94a3b8; padding: 2px 14px; text-align: center; background: rgba(255, 255, 255, .7); }

.fv-app .fv-nav { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

/* textos dentro do SVG */
.fv-app .fv-svg text { font-family: ui-rounded, "Nunito", "Segoe UI", system-ui, sans-serif; }
.fv-app .fv-cap { font-size: 15px; font-weight: 700; fill: #475569; }
.fv-app .fv-cap2 { font-size: 13px; font-weight: 700; fill: #64748b; }
.fv-app .fv-sym { font-size: 30px; font-weight: 900; fill: #334155; }
.fv-app .fv-big-sym { font-size: 42px; }
.fv-app .fv-red-t { fill: #dc2626; font-weight: 800; }
.fv-app .fv-green-t { fill: #047857; font-weight: 800; }
.fv-app .fv-chip { font-weight: 900; }
.fv-app .fv-cellnum { fill: #fff; font-weight: 900; font-size: 13px; }
.fv-app .fv-gnum { font-size: 14px; font-weight: 900; }
.fv-app .fv-gnum-in { fill: #fff !important; paint-order: stroke; stroke: rgba(0, 0, 0, .35); stroke-width: 3px; }
.fv-app .fv-th { font-size: 22px; font-weight: 900; fill: var(--fv-ink); }
.fv-app .fv-cell { font-size: 26px; font-weight: 900; }
.fv-app .fv-tick { font-size: 16px; font-weight: 900; }
.fv-app .fv-arc { font-size: 17px; font-weight: 900; }

/* animações */
.fv-app .fv-pop { transform-box: fill-box; transform-origin: center; animation: fvPop .5s cubic-bezier(.3, 1.4, .6, 1) both; }
.fv-app .fv-grow { transform-box: fill-box; transform-origin: center; animation: fvGrow .55s ease-out both; }
.fv-app .fv-growx { transform-box: fill-box; transform-origin: left center; animation: fvGrowX .55s ease-out both; }
.fv-app .fv-fadein { animation: fvFadeIn .6s ease both; }
.fv-app .fv-fade { animation: fvFadeOut 1.4s ease both; }
@keyframes fvPop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes fvGrow { from { opacity: 0; transform: scaleY(0); } to { opacity: 1; transform: scaleY(1); } }
@keyframes fvGrowX { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
@keyframes fvFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fvFadeOut { 0%, 30% { opacity: 1; } to { opacity: 0; } }
@keyframes fvIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .fv-app .fv-pop, .fv-app .fv-grow, .fv-app .fv-growx, .fv-app .fv-fadein, .fv-app .fv-explain, .fv-app .fv-line.is-now { animation: none !important; }
  .fv-app .fv-fade { animation: none !important; opacity: 0; }
}
.fv-app .fv-empty { text-align: center; color: var(--fv-mid); padding: 30px 10px; font-weight: 700; }
