.kant-formula-card {
    background: #ffffff;
    padding: 2.5em 1em;
    border-radius: 12px;
    margin: 2.5em auto;
    max-width: 600px;
    text-align: center;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    font-family: 'Lexend', 'Inter', 'IBM Plex Sans', sans-serif;
}
.kant-formula-equation {
    font-size: 2.2em;
    font-family: 'Lexend', 'Inter', 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.15em;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.2em;
}
.kant-formula-equation .operator {
    color: #64748b;
    font-weight: 600;
}
.kant-formula-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 1em;
    position: relative;
}

.kant-formula-block {
    flex: 1;
    max-width: 240px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Connecting unified single line using an absolutely positioned SVG covering the whole layout */
.kant-formula-connections {
    position: absolute;
    top: -60px; /* Adjust to point exactly to Form and Matter */
    left: 0;
    width: 100%;
    height: 100px;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.kant-formula-icon {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    margin-bottom: 1em;
    font-weight: bold;
}
.kant-formula-text {
    font-weight: 500;
    font-size: 1.1em;
    color: #1f2937;
    line-height: 1.4;
}

/* Variation for longer, complex formulas that need scaling down */
.kant-formula-equation.formula-long {
    font-size: 1.15em;
    overflow-x: auto;
    max-width: 100%;
}

/* L1 specific inline integration - blends perfectly with L1 text content */
.kant-formula-card.formula-l1 {
    box-shadow: none;
    padding: 1em 0;
    margin: 1.5em auto;
    color: inherit;
    font-family: inherit;
    border: 2px dotted rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    max-width: 100%;
    container-type: inline-size;
}
.kant-formula-card.formula-l1 .katex{
    font-family: 'IBM Plex Mono', monospace;
}
.kant-formula-card.formula-l1 .kant-formula-equation {
    color: inherit;
    font-family: inherit;
    font-weight: normal;  /* Use standard weight of the L1 text */
    font-size: clamp(0.65rem, 1.91cqi, 1.15em); 
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 5px; /* space for scrollbar if it still needs it on tiny screens */
}

.kant-formula-card.formula-l1 .kant-formula-equation .operator {
    color: inherit;
    opacity: 0.7;
}

#tab-l2 .katex-display .katex{
    font: inherit;
}