/* Verificador de cálculo · paleta "azul cobalto". Contrastes verificados (AA, 4,5:1 o más) en claro y oscuro: texto, texto
   de acento y de los veredictos sobre las superficies, rótulos del gráfico sobre su fondo y texto de los botones sobre su color. */
:root {
  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --pad: #FAFBFE;
  --text: #141B26;
  --muted: #4F5B6E;
  --border: #D5DDEA;
  --accent: #1D5FA6;
  --accent-fill: #1D5FA6;   /* con texto blanco */
  --accent-ink: #FFFFFF;
  --accent-text: #17508F;
  --warm: #E8A33D;
  --warm-ink: #3A2504;
  --error: #B93A30;
  --ok: #1F7A4D;
  --duda: #8A5A00;
  --input: #FFFFFF;
  /* gráfico */
  --g-grid: #DCE3EE;
  --g-eje: #323C4C;
  --g-num: #5F6A7C;
  --g-curva: #1D5FA6;
  --g-asintota: #6B7385;
  --g-rot: #141B26;
  --g-sombra: #CADBF2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F141C;
    --surface: #18202B;
    --pad: #141B24;
    --text: #E6ECF5;
    --muted: #A3B0C2;
    --border: #2E3A4B;
    --accent: #8DB8EE;
    --accent-fill: #8DB8EE;
    --accent-ink: #0F141C;
    --accent-text: #A3C6F3;
    --warm: #F2B960;
    --warm-ink: #2A1B04;
    --error: #F07A6F;
    --ok: #6FD6A0;
    --duda: #E3B04F;
    --input: #0F141C;
    --g-grid: #2A3442;
    --g-eje: #C9D2E0;
    --g-num: #9AA6B8;
    --g-curva: #8DB8EE;
    --g-asintota: #8E98AA;
    --g-rot: #E6ECF5;
    --g-sombra: #22385A;
    color-scheme: dark;
  }
}

.muted { color: var(--muted); font-size: 0.9rem; }
.top { display: flex; align-items: center; gap: 12px; padding: 8px 0 12px; }
.logo { border-radius: 10px; flex: none; }
h1 { font-size: 1.5rem; line-height: 1.2; color: var(--accent-text); }
.tagline { color: var(--muted); font-size: 0.95rem; }
.intro { color: var(--muted); margin-bottom: 14px; }
h2 { font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
[hidden] { display: none !important; }
.card { margin-bottom: 14px; }

/* Modos */
.modos { display: flex; gap: 6px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px; }
.modos button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--muted); }
.modos button[aria-selected="true"] { background: var(--accent-fill); color: var(--accent-ink); }

/* Campos */
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo label, .campo-l { font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.campo select {
  width: 100%; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 1rem;
}
.fila-tema { display: flex; flex-direction: column; gap: 12px; }
.aciertos { font-weight: 600; font-variant-numeric: tabular-nums; }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opciones .chip { min-height: 44px; padding: 0 14px; font-weight: 600; }

/* Fórmulas (las dibuja el motor de expresiones) */
.mx { font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', Georgia, 'Times New Roman', serif; font-size: 1.1em; white-space: nowrap; font-weight: 400; }
.mx .mv { font-style: italic; }
.mx .mfnn { font-style: normal; }
.mo { margin: 0 0.2em; }
.mneg { margin: 0 0.04em 0 0; }
.mrel { margin: 0 0.4em; }
.mj { margin-left: 0.12em; }
.mf { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.15em; line-height: 1.15; }
.mfn { border-bottom: 1.5px solid currentColor; padding: 0 0.25em 0.08em; }
.mfd { padding: 0.08em 0.25em 0; }
.mf .mf { font-size: 0.92em; }
.mx sup { font-size: 0.68em; vertical-align: 0.75em; line-height: 0; margin-left: 0.06em; }
.mjf { margin-left: 0.28em; }
.mr { white-space: nowrap; }
.mra { border-top: 1.5px solid currentColor; padding: 0.05em 0.1em 0; margin-left: 0.04em; }
.mri { margin-right: -0.35em; vertical-align: 1em; }
.mlim { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin-right: 0.3em; line-height: 1.1; }
.mlims { font-size: 0.66em; }
.mint { font-size: 1.6em; vertical-align: middle; line-height: 1; }
/* En el texto, una ecuación larga puede partirse después del signo igual (y solo ahí: las piezas no se cortan) */
.enunciado .mx, .op .mx, .sol .mx { white-space: normal; }
.mx > * { white-space: nowrap; }

/* Gráfico */
.grafico { max-width: 420px; width: 100%; margin: 0 auto; }
.mg { width: 100%; height: auto; display: block; background: var(--pad); border: 1px solid var(--border); border-radius: 12px; }
.mg-grid { stroke: var(--g-grid); stroke-width: 1; }
.mg-eje { stroke: var(--g-eje); stroke-width: 1.4; }
.mg-n { font: 11px system-ui, -apple-system, sans-serif; fill: var(--g-num); }
.mg-n.c { text-anchor: middle; }
.mg-n.e { text-anchor: end; }
.mg-n.it { font-style: italic; font-size: 13px; fill: var(--g-eje); }
.mg-curva { fill: none; stroke: var(--g-curva); stroke-width: 2.6; stroke-linejoin: round; }
.mg-recta { stroke-width: 1.6; stroke-dasharray: 6 5; }
.mg-recta.asintota { stroke: var(--g-asintota); }
.mg-sombra { fill: var(--g-sombra); opacity: 0.75; }
.mg-punto { fill: var(--g-curva); }
.mg-punto.abierto { fill: var(--pad); stroke: var(--g-curva); stroke-width: 2.2; }
.mg-rot { font: 700 12px system-ui, -apple-system, sans-serif; fill: var(--g-rot); paint-order: stroke; stroke: var(--pad); stroke-width: 3px; }
.mg-rot.e { text-anchor: end; }

/* Ejercicio */
.ejercicio { display: flex; flex-direction: column; gap: 12px; }
.enunciado { line-height: 1.6; font-size: 1.0625rem; }
.enunciado .mx { font-size: 1.15em; }
.filas { display: flex; flex-direction: column; gap: 10px; }
.fila { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 1.125rem; }
.fila-r { font-size: 1rem; font-weight: 600; color: var(--muted); }
.fila .mx { font-size: 1.05em; }
.fila input {
  width: 6.5em; min-width: 0; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 2px solid var(--border);
  background: var(--input); color: var(--text); font-size: 1.0625rem; font-variant-numeric: tabular-nums;
}
.fila.slots input { width: 4.2em; text-align: center; }
.fila input.ancho { flex: 1 1 12em; width: auto; }
.fila input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.fila input.bien { border-color: var(--ok); }
.fila input.mal { border-color: var(--error); border-style: dashed; }
.fila input[readonly] { opacity: 1; }
.plantilla { font-family: 'Cambria Math', 'STIX Two Math', Georgia, 'Times New Roman', serif; white-space: nowrap; }

.teclas { display: flex; flex-wrap: wrap; gap: 6px; }
.teclas button { min-width: 48px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); font-size: 1.125rem; font-weight: 600; }
.teclas button:hover { border-color: var(--accent); }
/* Con el teclado del celular abierto, la barra flota justo arriba de él (la ubica _shared/teclado) */
.teclas.flota {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; margin: 0;
  flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgb(0 0 0 / 0.08);
}
.teclas.flota::-webkit-scrollbar { display: none; }
.teclas.flota button { flex: 0 0 auto; }

.ops { display: flex; flex-direction: column; gap: 8px; }
.op {
  width: 100%; min-height: 48px; padding: 10px 14px; text-align: left; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.0625rem; line-height: 1.5;
}
.op:hover:not([disabled]) { border-color: var(--accent); }
.op.mal { border-color: var(--error); border-style: dashed; color: var(--muted); }
.op.bien { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.op[disabled] { cursor: default; }

/* Práctica */
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.estado { min-height: 1.5rem; margin-bottom: 4px; line-height: 1.4; }
.estado.ok { color: var(--ok); font-weight: 600; }
.estado.mal { color: var(--error); font-weight: 600; }
.margen { margin-bottom: 14px; }
.sol-r { line-height: 1.7; margin-bottom: 14px; }
.sol-r .mx { font-size: 1.1em; }
.pasos { list-style: decimal; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; line-height: 1.6; }

/* Verificar */
.vform { display: flex; flex-direction: column; gap: 14px; }
.vcampos { display: flex; flex-direction: column; gap: 14px; }
.vcampo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vcampo-l { font-size: 0.9375rem; font-weight: 700; color: var(--muted); }
.vcampo-l .mx { color: var(--text); }
.vcampo input {
  width: 100%; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--input); color: var(--text); font-size: 1.0625rem;
}
.vcampo input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.vcampo input.mal { border-color: var(--error); border-style: dashed; }
.lee { min-height: 1.4em; line-height: 1.6; overflow-x: auto; padding-top: 0.2em; }
.lee:empty { display: none; }
.lee.mal { color: var(--error); font-weight: 600; }
.lee .mx { font-size: 1.1em; white-space: nowrap; }
.nota-lee { display: block; color: var(--muted); font-size: 0.9rem; }
.ayuda { color: var(--muted); font-size: 0.875rem; }
.vres-t { font-size: 1.125rem; font-weight: 700; margin-bottom: 6px; }
.vres-t.ok { color: var(--ok); }
.vres-t.mal { color: var(--error); }
.vres-t.duda { color: var(--duda); }
.vres-d { display: flex; flex-direction: column; gap: 6px; line-height: 1.55; margin-bottom: 10px; }
.vres #vvalor { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 10px; }
.vtabla summary { cursor: pointer; font-weight: 600; color: var(--accent-text); min-height: 44px; display: flex; align-items: center; }
.tablas { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 4px; }
.tabla { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
.tabla caption { text-align: left; font-weight: 600; color: var(--muted); padding-bottom: 4px; }
.tabla th, .tabla td { padding: 4px 10px 4px 0; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabla th { color: var(--muted); font-weight: 600; }

.foot { margin: 32px 0 16px; display: flex; flex-direction: column; gap: 6px; }
