/* Interactive geometry diagrams, see mxn_geometry.js */
.mxn-geo {
    margin: 20px 0;
    padding: 12px;
    background: var(--color-surface-very-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-normal);
}

.mxn-geo__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 28px;
    margin-bottom: 10px;
}

.mxn-geo__controls fieldset {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.mxn-geo__controls legend {
    float: left;
    margin: 0 8px 0 0;
    padding: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-small, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mxn-geo__controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: var(--font-size-base);
    white-space: nowrap;
}

.mxn-geo__controls input[type="range"] {
    width: 110px;
    accent-color: var(--color-link);
}

.mxn-geo__controls input[type="checkbox"] {
    accent-color: var(--color-link);
}

.mxn-geo__controls select {
    min-height: var(--control-height);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 2px 6px;
    background: var(--color-surface);
    color: var(--color-text);
}

.mxn-geo__controls output {
    min-width: 3.2em;
    color: var(--color-text-muted);
    font-family: var(--font-family-mono);
    font-variant-numeric: tabular-nums;
}

.mxn-geo__controls .mxn-geo__disabled {
    opacity: 0.4;
}

.mxn-geo__view {
    position: relative;
    width: 100%;
    height: clamp(320px, 38vw, 480px);
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-normal);
    touch-action: none;
}

.mxn-geo__view canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.mxn-geo__labels {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.mxn-geo__label {
    position: absolute;
    top: 0;
    left: 0;
    padding: 0 3px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--color-surface) 72%, transparent);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.mxn-geo__legend {
    position: absolute;
    bottom: 6px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    max-width: calc(100% - 16px);
    margin: 0;
    font-size: 12px;
    pointer-events: none;
}

.mxn-geo__legend span {
    padding: 1px 4px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--color-surface) 80%, transparent);
}

.mxn-geo__legend .mxn-geo__key {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text);
}

.mxn-geo__mark {
    display: inline-block;
    flex: none;
    width: 17px;
    height: 0;
    border-top: 2px solid var(--mark-color);
}

.mxn-geo__mark--dashed {
    border-top-style: dashed;
}

.mxn-geo__mark--point {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 50%;
    background: var(--mark-color);
}

.mxn-geo__mark--arrow {
    position: relative;
}

.mxn-geo__mark--arrow::after {
    position: absolute;
    right: -2px;
    top: -11px;
    color: var(--mark-color);
    content: '\2192';
    font-size: 16px;
}

.mxn-geo-cache-trees {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr);
    gap: 12px;
    margin: 12px 0;
}

.mxn-geo-cache-trees > div {
    min-width: 0;
}

.mxn-geo-cache-trees pre {
    overflow-x: auto;
    margin: 6px 0 0;
    white-space: pre;
}

.mxn-geo-cache {
    color: #16869b;
}

.mxn-geo-deform {
    color: #b43e6b;
}

@media (max-width: 760px) {
    .mxn-geo-cache-trees {
        grid-template-columns: minmax(0, 1fr);
    }
}

.mxn-geo__tip {
    position: absolute;
    z-index: 5;
    max-width: 280px;
    padding: 6px 9px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-normal);
    box-shadow: 0 2px 8px rgb(0 0 0 / 22%);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
}

.mxn-geo__tip[hidden] {
    display: none;
}

.mxn-geo__hint,
.mxn-geo__readout {
    margin: 8px 0 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-small, 0.85rem);
}

.mxn-geo__readout {
    color: var(--color-text);
    font-size: var(--font-size-base);
    overflow-wrap: anywhere;
}
