/* Optional equation-helper styling. Each helper's registry entry distinguishes
   approved source preservation from newly adapted implementation. */
.eq-action-copy {
    position: absolute !important;
    z-index: 18;
    margin: 0 !important;
    padding: 0.08em 0.14em;
    border-radius: 5px;
    background: transparent;
    box-shadow: none;
    transform-origin: center;
    pointer-events: none;
    will-change: transform;
}

.eq-action-overlay {
    position: absolute;
    inset: 0;
    z-index: 16;
    overflow: visible;
    pointer-events: none;
}

.eq-action-connector {
    fill: none;
    stroke: #c2402a;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eq-action-connector-label {
    position: absolute;
    z-index: 17;
    transform: translate(-50%, -50%);
    padding: 4px 8px;
    border: 1px solid rgba(194, 64, 42, 0.22);
    border-radius: 999px;
    background: rgba(250, 248, 242, 0.98);
    color: #a93524;
    font: 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    pointer-events: none;
}

.eq-action-landing {
    border-radius: 5px;
    background: rgba(194, 64, 42, 0.16);
    box-shadow: 0 0 0 4px rgba(194, 64, 42, 0.07);
}

@media (prefers-reduced-motion: reduce) {
    .eq-action-copy,
    .eq-action-overlay,
    .eq-action-connector-label {
        display: none !important;
    }
}

/* The distribution treatment is also callable from a freehand board. These
   selectors are the measured treatment's load-bearing geometry, not a board
   layout or lesson template. */
.svk-distribution-treatment { width: 100%; min-width: 0; }

.svk-distribution__groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.svk-distribution__group {
    position: relative;
    display: grid;
    grid-template-rows: minmax(63px, auto) minmax(30px, auto);
    min-width: 0;
    min-height: 102px;
    padding: 4px 8px 7px;
    border: 1px solid rgba(34, 48, 58, .11);
    border-radius: 8px;
    background: rgba(250, 248, 242, .72);
}

.svk-distribution__expression {
    position: relative;
    z-index: 1;
    display: inline-flex;
    gap: 3px;
    align-items: baseline;
    justify-self: center;
    align-self: end;
    min-width: 0;
    padding: 31px 2px 7px;
    white-space: nowrap;
}

.svk-distribution__factor { margin-right: 1px; color: var(--svk-red, #c2402a); }
.svk-distribution__factor .katex,
.svk-distribution__term .katex,
.svk-distribution__operator .katex,
.svk-distribution__paren .katex { font-size: 1.26em; }

.svk-distribution__facts {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px 16px;
    min-height: 27px;
    padding-top: 6px;
    border-top: 1px solid rgba(34, 48, 58, .09);
    color: var(--svk-muted, #68737a);
    font-size: .82em;
}

.svk-distribution__fact { white-space: nowrap; }

.svk-measured-arrows {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: visible;
    pointer-events: none;
}

.svk-measured-arrow__shaft {
    fill: none;
    stroke: var(--svk-red, #c2402a);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.svk-measured-arrow__head { fill: var(--svk-red, #c2402a); }

/* Standalone measured arrows share the reviewed shaft/head visual treatment.
   The overlay follows its author's container without imposing board layout. */
.eq-measured-arrow-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.eq-measured-arrow-shaft {
    fill: none;
    stroke: var(--eq-arrow-color, var(--svk-red, #c2402a));
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eq-measured-arrow-head { fill: var(--eq-arrow-color, var(--svk-red, #c2402a)); }


/* Horizontal token-relative cancellation, with no surrounding board layout. */
.svk-cancel-slash {
    position: absolute;
    z-index: 3;
    left: -7%;
    right: -7%;
    top: 50%;
    height: 2px;
    background: var(--svk-red);
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

/* Measured fraction emphasis stays outside normal math layout. Geometry uses
   local em units, so responsive font sizes and container scaling stay aligned. */
.eq-term-highlight,
.eq-emphasis-measure {
    position: absolute;
    display: block;
    left: 0;
    top: 0;
    width: 1em;
    height: 1em;
    margin: 0;
    padding: 0;
    border: 0;
    pointer-events: none;
}
.eq-term-highlight { border-radius: 2px; background: transparent; }
.eq-emphasis-measure { visibility: hidden; }
