/* ============ MATRICES ============ */

/* Altura del título igual a la de triángulos (archivo solo de matrices) */
.page-head {
    padding-top: clamp(1.1rem, 3.5vw, 2.2rem);
    text-align: center;
}

.mat-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.mat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(14px) saturate(1.3);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: clamp(18px, 3vw, 28px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.mat-card:hover { border-color: var(--accent-soft); box-shadow: var(--shadow-md); }

.mat-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.mat-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    margin: 0;
}

.mat-card-title i { font-size: 17px; }

.mat-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---------- gestor de matrices ---------- */
.mat-manager {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.mat-matrix-card {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    position: relative;
    min-width: 0;
    transition: border-color .25s ease, transform .25s ease;
}

.mat-matrix-card:hover { border-color: var(--accent-soft); transform: translateY(-2px); }

.mat-matrix-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.mat-matrix-letter {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--accent);
    line-height: 1;
}

.mat-btn-delete {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.mat-btn-delete:hover { background: rgba(208, 68, 108, .14); color: #d0446c; border-color: #d0446c; }

.mat-matrix-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: .85rem;
    color: var(--muted);
    font-weight: 600;
}

.mat-dim-input {
    width: 48px;
    padding: 5px 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    font-size: .9rem;
}

.mat-dim-input:focus { outline: none; border-color: var(--accent); }

.mat-grid {
    display: grid;
    gap: 5px;
    width: 100%;
    min-width: 0;
}

.mat-cell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 7px 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    font-family: 'STIX Two Text', serif;
    box-sizing: border-box;
}

.mat-cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- operación (expresión math.js) ---------- */
.mat-preview {
    min-height: 60px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    color: var(--muted);
    font-size: .85rem;
}

.mat-preview-scroll {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.mat-preview-scroll > * {
    flex-shrink: 0;
    margin: 0 auto;
}

.mat-preview-scroll::-webkit-scrollbar { display: none; }

.mat-op-input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-size: .95rem;
    font-weight: 500;
    font-family: inherit;
    margin-bottom: 16px;
    text-align: center;
    box-sizing: border-box;
}

.mat-op-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- botones ---------- */
.mat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 24px;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 700;
    font-size: .92rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mat-btn i { flex-shrink: 0; }

.mat-btn-primary {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.mat-btn-primary:hover {
    background: var(--accent);
    color: var(--accent-text-on);
    transform: translateY(-3px) scale(1.01);
}

.mat-btn-soft {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-soft);
}
.mat-btn-soft:hover {
    background: var(--accent);
    color: var(--accent-text-on);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.mat-btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--accent-soft);
    transform: translateY(-2px);
}

.mat-btn-sm { padding: 9px 15px; font-size: .82rem; }

/* quick ops row */
.mat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

/* ---------- resultados ---------- */
.mat-results-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: stretch;
}

.mat-result-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mat-result-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 8px;
}

.mat-result-box {
    flex: 1;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    overflow-x: auto;
    color: var(--muted);
    font-size: .85rem;
}

.mat-frac-box {
    font-family: 'STIX Two Text', serif;
    font-size: 14px;
}

@media (max-width: 640px) {
    .mat-results-row { grid-template-columns: 1fr; }
}

/* ---------- propiedades ---------- */
.mat-prop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 20px 0 0;
}

.mat-prop {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}

.mat-prop-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.mat-prop-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

/* ---------- análisis / selector ---------- */
.mat-select-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.mat-select-row label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* selector "Analizar" + chevron (mismo diseno que .int-select-wrap / .int-select-chevron) */
.mat-select-wrap { position: relative; display: flex; align-items: center; }

.mat-select {
    padding: 8px 36px 8px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    font-size: .9rem;
    text-align: left;
    text-align-last: left;
    appearance: none; -webkit-appearance: none; cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.mat-select-chevron {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    pointer-events: none; color: var(--muted); opacity: .7; font-size: 14px;
}

.mat-select:hover { border-color: var(--accent-soft); background: var(--surface); }
.mat-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- chip de vista 2D/3D (misma base que la chip de Dominio de ecuaciones) ---------- */
/* Copia de .eq-domain-pill / .eq-domain-opt de css/ecuaciones.css: ese CSS no se carga aqui. */
.eq-domain-pill {
    display: flex; align-items: stretch; gap: 4px; padding: 4px; height: 46px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
}
.eq-domain-opt {
    flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 8px 8px; border: 1px solid transparent; border-radius: 999px;
    background: transparent; color: var(--muted);
    font-family: inherit; font-size: .84rem; font-weight: 700; letter-spacing: .2px;
    cursor: pointer; white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.eq-domain-opt:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.eq-domain-opt.is-active { color: #15803d; background: color-mix(in srgb, #22c55e 16%, transparent); border-color: color-mix(in srgb, #22c55e 45%, transparent); }
[data-theme="dark"] .eq-domain-opt.is-active { color: #4ade80; }
/* la vista 2D activa va en azul, igual que "Complejos" en ecuaciones.html */
.eq-domain-opt[data-vista="2d"].is-active { color: #0369a1; background: color-mix(in srgb, #0ea5e9 16%, transparent); border-color: color-mix(in srgb, #0ea5e9 45%, transparent); }
[data-theme="dark"] .eq-domain-opt[data-vista="2d"].is-active { color: #38bdf8; }
/* mas aire horizontal entre el texto de la chip y su borde */
.mat-vista-pill .eq-domain-opt { padding-left: 26px; padding-right: 26px; }
.eq-domain-opt:focus-visible { outline: 2px solid var(--border); outline-offset: 1px; }
.mat-vista-pill { flex-shrink: 0; }
.mat-select-row select[hidden] { display: none; }

/* el selector "Analizar" toma la misma altura que la chip de vista (46px) */
.mat-select { height: 46px; padding-top: 0; padding-bottom: 0; }

/* En pantallas estrechas la fila "Analizar + Vista" se apila centrada en vez de
   partirse en dos lineas a media anchura; las chips respiran menos. */
@media (max-width: 640px) {
    .mat-select-row { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
    .mat-select-wrap, .mat-select { width: 100%; }
    .mat-vista-pill { width: 100%; max-width: 320px; }
    .mat-vista-pill .eq-domain-opt { padding-left: 14px; padding-right: 14px; font-size: .8rem; }
}

/* gráfica */
#mat-plot {
    width: 100%;
    height: 420px;
    margin-top: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
}

/* ---------- paso a paso / guía ---------- */
.mat-guide-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text);
    line-height: 2;
    font-size: .92rem;
}

.mat-guide-list code {
    background: var(--surface-2);
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--accent);
}

.mat-guide-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 18px 0;
    font-size: .9rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.mat-guide-table th, .mat-guide-table td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

.mat-guide-table tr:last-child td { border-bottom: none; }

.mat-guide-table th {
    background: var(--surface-2);
    font-weight: 700;
    color: var(--accent);
}

/* ---------- icono de ayuda (?) al lado del título ---------- */
/* fila del input de operacion + chip de ayuda (mismo diseno que .rc-sintaxis-chip) */
.mat-op-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.mat-op-row .mat-op-input { flex: 1 1 auto; min-width: 0; margin-bottom: 0; height: 46px; padding-top: 0; padding-bottom: 0; }

.mat-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 700;
    transition: background .2s, color .2s, border-color .2s;
}

.mat-help-btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }

/* ---------- modal de guía ---------- */
.modal-guia { max-width: 520px !important; max-height: 86vh; overflow-y: auto; }

.mat-guide-modal { padding-top: 6px; }

/* ---------- modal operaciones rápidas: resolver sistema ---------- */
.qk-box,
.qk-pairs {
    width: 100%;
}

.qk-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-top: 12px;
    text-align: left;
    box-sizing: border-box;
}

.qk-pasos { padding-top: 6px; padding-bottom: 14px; }

.qk-pasos-ttl {
    margin: 6px 0 10px;
    color: var(--accent);
    font-size: .95rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

/* ---------- paso a paso (mismo estilo que triangulos) ---------- */
.qk-paso {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    animation: pasoIn .45s ease forwards;
    opacity: 0;
}

.qk-paso:last-child { border-bottom: none; }

@keyframes pasoIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.qk-paso-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
}

.qk-paso-body {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    font-size: .85rem;
    line-height: 1.6;
    color: var(--text);
    opacity: .92;
    text-align: left;
}

.qk-paso-ttl {
    margin: 0 0 3px;
    color: var(--text);
    font-size: .88rem;
    font-weight: 700;
}

.qk-paso-desc {
    margin: 6px 0 4px;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.7;
}

.qk-paso-desc code {
    background: var(--surface);
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--accent);
    font-size: .78rem;
}

.qk-math {
    margin: 8px 0;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.qk-math::-webkit-scrollbar { display: none; }

.qk-load-btn {
    margin-top: 16px;
    width: 100%;
}

.qk-pairs {
    margin-top: 0;
    text-align: center;
}

.qk-pairs-label {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.qk-pairs-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.qk-pair-btn {
    margin: 0 !important;
    min-width: 104px;
    min-height: 42px;
}

/* ---------- responsive: modal operaciones rápidas en móvil ---------- */
@media (max-width: 480px) {
    /* las chips 3D/2D respiran menos en pantallas estrechas */
    .mat-vista-pill .eq-domain-opt { padding-left: 14px; padding-right: 14px; font-size: .8rem; }
    #quickModalOverlay .modal { padding: 22px 14px; }
    #quickModalOverlay .modal-title { font-size: 1.3rem; padding-right: 30px; gap: 8px; }
    #quickModalOverlay .modal-title i { font-size: 19px; }
    .qk-box { padding: 12px; }
    .qk-math { font-size: .95rem; }
    .qk-pair-btn { flex: 1 1 42%; min-width: 0; min-height: 48px; font-size: .9rem; }
    .qk-load-btn { font-size: .85rem; }
}

@media (max-width: 720px) {
    .mat-op-row .mat-op-input { font-size: .88rem; }
    .mat-manager { grid-template-columns: 1fr; }
    .mat-card { padding: 18px; }
    .mat-cell { width: 56px; font-size: .84rem; }
    #mat-plot { height: 320px; }
    .mat-matrix-card { display: flex; flex-direction: column; align-items: center; }
    .mat-grid { justify-content: center; place-items: center; gap: 4px; }
    .mat-grid .mat-cell { text-align: center; }
    .mat-quick { gap: 8px; }
    .mat-btn { padding: 12px 16px; }
}

@media (max-width: 420px) {
    .mat-card { padding: 14px; border-radius: 18px; }
    .mat-matrix-card { padding: 14px; }
    .mat-grid { gap: 3px; }
    .mat-cell { width: 52px; padding: 6px 4px; }
    .mat-results-row { gap: 12px; }
    .mat-quick .mat-btn { flex: 1 1 42%; }
    .mat-select-row { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
    .mat-select { width: 100%; }
    .mat-vista-pill .eq-domain-opt { padding-left: 11px; padding-right: 11px; }
    .mat-prop-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
}

/* ---------- boton Ejemplo (icono shuffle; solo icono en movil) ---------- */
@media (max-width: 640px) {
    .mat-btn-ejemplo .mat-btn-label { display: none; }
    .mat-btn-ejemplo { padding: 9px 12px; }
}

@media (max-width: 900px) {
    .content { padding-left: 12px; padding-right: 12px; }
}

/* ---------- boton "+" anadir matriz (mismo diseno que vectores.html) ---------- */
.btn-add-matriz {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .35s cubic-bezier(.32,.72,0,1), box-shadow var(--transition), background var(--transition);
}
.btn-add-matriz:hover {
    background: var(--accent);
    color: var(--accent-text-on);
    transform: translateY(-2px) rotate(90deg);
    box-shadow: 0 10px 22px var(--accent-soft);
}
.btn-add-matriz:active { transform: translateY(0) rotate(90deg); }

/* grupo de acciones de la cabecera de la ultima matriz: (x eliminar) (+ anadir) */
.mat-matrix-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    .btn-add-matriz { width: 30px; height: 30px; font-size: 15px; }
}

/* =========================================================================
   OPERACION PASO A PASO
   =========================================================================
   Estetica identica a la tarjeta de pasos de derivadas.html: numero de
   paso en ficha a la izquierda, regla centrada, explicacion y expresion
   LaTeX grande centrada. El ultimo paso (resultado) va resaltado. */

.mat-steps-head-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mat-zoom-ctl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

.mat-zoom-ctl i { font-size: 13px; }

.mat-zoom-ctl input[type="range"] {
    width: 90px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.mat-zoom-ctl input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.mat-zoom-ctl input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.mat-download-btn {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--muted); cursor: pointer;
    font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.mat-download-btn:hover { border-color: var(--accent); color: var(--accent); }

.mat-steps-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Numero del paso: ficha con border-radius alto a la izquierda. */
.mat-step-num {
    position: absolute;
    left: 8px;
    top: 16px;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
}

/* El ultimo paso es el resultado: la ficha va llena. */
.mat-step-es-final .mat-step-num {
    background: var(--accent);
    color: var(--accent-text-on);
}

.mat-step-cuerpo { min-width: 0; }

.mat-step-regla {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--accent);
    margin-bottom: 6px;
}

.mat-step-regla-fila { text-align: center; margin-bottom: 8px; }

/* Un paso: numero | regla+explicacion | expresion. Padding izquierdo y
   derecho compensados para que la expresion quede centrada. */
.mat-step {
    position: relative;
    padding: 16px 44px;
    border-radius: 10px;
    transition: background-color .15s ease;
}

.mat-step:hover { background-color: var(--accent-soft); }
.mat-step + .mat-step { border-top: 1px solid var(--border); }

.mat-step-detalle {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 10px;
    text-align: center;
    max-width: 68ch;
    margin-left: auto;
    margin-right: auto;
}

.mat-step-detalle .katex { font-size: 1.22em; }
.mat-step-detalle .katex-display { margin: .4em 0 .2em; }
.mat-step-detalle strong { color: var(--text); font-weight: 600; }

.mat-step-math {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    text-align: center;
    font-size: 1.65rem;
    line-height: 1.7;
}

.mat-step-math::-webkit-scrollbar { display: none; }
.mat-step-math .katex { font-size: 1em; }
.mat-step-math .katex-display { margin: .25em 0; }

/* El ultimo paso (resultado) se resalta un poco mas. */
.mat-step-es-final .mat-step-math .katex { font-weight: 500; }

@media (max-width: 640px) {
    .mat-step { padding: 13px 34px; }
    .mat-step-num { left: 4px; top: 13px; width: 22px; height: 22px; font-size: 12px; }
    .mat-step-detalle { font-size: 12.5px; }
    .mat-step-math { font-size: 1.3rem; }
    .mat-steps-head-right { gap: 8px; }
}
