body {
      font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    }

    /* Mejoras de legibilidad KaTeX en móvil y modo oscuro */
    .katex-display {
      overflow-x: auto;
      overflow-y: hidden;
      padding: 0.45rem 0.25rem;
      margin: 0.6rem 0;
      -webkit-overflow-scrolling: touch;
    }
    .katex {
      font-size: 1.03em;
    }
    .dark .katex {
      color: #e2e8f0;
    }

    /* Transiciones suaves para desplegables */
    .accordion-content {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 0.26s ease-out;
    }
    .accordion-content.open {
      grid-template-rows: 1fr;
    }
    .accordion-inner {
      overflow: hidden;
    }

    /* Scrollbar sutil */
    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(148, 163, 184, 0.35);
      border-radius: 9999px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: rgba(148, 163, 184, 0.55);
    }

    /* Visualizaciones matemáticas SVG (LP, Funciones, Diagramas de árbol) */
    .edu-viz {
      margin: 0.9rem 0;
      border-radius: 0.85rem;
      border: 1px solid #e2e8f0;
      background: #f8fafc;
      padding: 0.75rem 0.75rem 0.6rem;
    }
    .dark .edu-viz {
      border-color: #334155;
      background: #0f172a;
    }
    .edu-viz-title {
      font-size: 0.75rem;
      font-weight: 700;
      color: #475569;
      margin-bottom: 0.4rem;
      text-align: center;
      letter-spacing: 0.01em;
    }
    .dark .edu-viz-title {
      color: #cbd5e1;
    }
    .edu-viz svg {
      display: block;
      width: 100%;
      max-width: 560px;
      height: auto;
      margin: 0 auto;
      font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    }
    .viz-grid { stroke: #e2e8f0; stroke-width: 1; }
    .dark .viz-grid { stroke: #1e293b; }
    .viz-axis { stroke: #64748b; stroke-width: 1.5; }
    .dark .viz-axis { stroke: #94a3b8; }
    .viz-tick-text { fill: #64748b; font-size: 10px; font-family: 'JetBrains Mono', monospace; }
    .dark .viz-tick-text { fill: #94a3b8; }
    .viz-region { fill: rgba(11, 94, 215, 0.16); stroke: none; }
    .dark .viz-region { fill: rgba(96, 165, 250, 0.22); }
    .viz-area { fill: rgba(16, 185, 129, 0.20); stroke: none; }
    .dark .viz-area { fill: rgba(52, 211, 153, 0.22); }
    .viz-line { stroke: #2563eb; stroke-width: 1.7; fill: none; }
    .dark .viz-line { stroke: #60a5fa; }
    .viz-line-sec { stroke: #0ea5e9; stroke-width: 1.6; stroke-dasharray: 5 4; fill: none; }
    .dark .viz-line-sec { stroke: #38bdf8; }
    .viz-curve { stroke: #0b5ed7; stroke-width: 2.3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
    .dark .viz-curve { stroke: #60a5fa; }
    .viz-tangent { stroke: #f59e0b; stroke-width: 1.9; stroke-dasharray: 6 4; fill: none; }
    .dark .viz-tangent { stroke: #fbbf24; }
    .viz-asym { stroke: #ef4444; stroke-width: 1.4; stroke-dasharray: 5 4; fill: none; }
    .dark .viz-asym { stroke: #f87171; }
    .viz-opt-edge { stroke: #059669; stroke-width: 4; stroke-linecap: round; fill: none; }
    .dark .viz-opt-edge { stroke: #34d399; }
    .viz-dot { fill: #0b5ed7; stroke: #ffffff; stroke-width: 1.8; }
    .dark .viz-dot { fill: #60a5fa; stroke: #0f172a; }
    .viz-dot-opt { fill: #059669; stroke: #ffffff; stroke-width: 2; }
    .dark .viz-dot-opt { fill: #34d399; stroke: #0f172a; }
    .viz-dot-hole { fill: #f8fafc; stroke: #0b5ed7; stroke-width: 2.2; }
    .dark .viz-dot-hole { fill: #0f172a; stroke: #60a5fa; }
    .viz-label { fill: #1e293b; font-size: 11px; font-weight: 700; paint-order: stroke; stroke: #f8fafc; stroke-width: 3.5px; stroke-linejoin: round; }
    .dark .viz-label { fill: #f1f5f9; stroke: #0f172a; }
    .viz-label-opt { fill: #047857; font-size: 11px; font-weight: 800; paint-order: stroke; stroke: #f8fafc; stroke-width: 3.5px; stroke-linejoin: round; }
    .dark .viz-label-opt { fill: #6ee7b7; stroke: #0f172a; }
    .viz-tree-edge { stroke: #94a3b8; stroke-width: 1.8; fill: none; }
    .dark .viz-tree-edge { stroke: #64748b; }
    .viz-tree-node { fill: #ffffff; stroke: #cbd5e1; stroke-width: 1.4; }
    .dark .viz-tree-node { fill: #1e293b; stroke: #475569; }
    .viz-tree-root { fill: #eff6ff; stroke: #2563eb; stroke-width: 1.6; }
    .dark .viz-tree-root { fill: #172554; stroke: #60a5fa; }
    .viz-tree-prob-bg { fill: #f8fafc; stroke: #cbd5e1; stroke-width: 1; }
    .dark .viz-tree-prob-bg { fill: #0f172a; stroke: #334155; }
    .viz-tree-text { fill: #1e293b; font-size: 11.5px; font-weight: 700; }
    .dark .viz-tree-text { fill: #f1f5f9; }
    .viz-tree-prob { fill: #1d4ed8; font-size: 10.5px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
    .dark .viz-tree-prob { fill: #93c5fd; }
.ad-slot { overflow: hidden; }
.viz-region { fill: rgba(11, 94, 215, 0.16); }
.dark .viz-region { fill: rgba(96, 165, 250, 0.22); }
.viz-line { stroke: #2563eb; }
.dark .viz-line { stroke: #60a5fa; }
.viz-curve { stroke: #0b5ed7; }
.dark .viz-curve { stroke: #60a5fa; }
.viz-dot { fill: #0b5ed7; }
.dark .viz-dot { fill: #60a5fa; }
.viz-dot-hole { stroke: #0b5ed7; }
.dark .viz-dot-hole { stroke: #60a5fa; }
.viz-tree-root { fill: #eff6ff; stroke: #2563eb; }
.dark .viz-tree-root { fill: #172554; stroke: #60a5fa; }
.viz-tree-prob { fill: #1d4ed8; }
.dark .viz-tree-prob { fill: #93c5fd; }
