/* Independent layer inside a positioned viewer. Context/dock placement belongs to the caller. */
.lms-ct-schema { position: absolute; inset: 0; pointer-events: none; z-index: 4; color: #fff; }
.lms-ct-schema__toolbar { position: absolute; z-index: 2; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; width: max-content; max-width: 100%; pointer-events: auto; }
.lms-ct-schema__toolbar:has(.lms-ct-schema-menu:not([hidden])) { align-items: center; flex-wrap: nowrap; max-width: none; }
.lms-ct-schema__choice { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.lms-ct-schema__choice:disabled .lms-ct-schema__swatch { box-shadow: none; }
.lms-ct-viewer[data-ct-changing] .lms-ct-schema__swatch { box-shadow: var(--ct-navigation-schema-shadow, none); }
.lms-ct-schema__choice-tip { display: inline-flex; flex: none; }
.lms-ct-schema__swatch { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid #0007; box-shadow: 0 0 0 1px #fff7; color: #24152f; }
.lms-ct-schema__swatch--stammhirn { background: #f4ed25; }
.lms-ct-schema__swatch--kleinhirn { background: linear-gradient(135deg, #ff9627 41%, #f4ed25 41%, #f4ed25 59%, #ff9627 59%); }
.lms-ct-schema__swatch--marklager { background: #ff9627; }
.lms-ct-schema__swatch--rinde { background: #ed393c; }
.lms-ct-schema__check { visibility: hidden; font: bold 18px/1 sans-serif; }
.lms-ct-schema__choice[aria-pressed="true"] .lms-ct-schema__swatch { outline: 2px solid #fff; outline-offset: 2px; }
.lms-ct-schema__choice[aria-pressed="true"] .lms-ct-schema__check { visibility: visible; }
.lms-ct-schema button:disabled { cursor: default; }
/* Colours and selection stay legible while a temporary input lock is active. */
.lms-ct-schema__frame { position: absolute; z-index: 1; }
.lms-ct-schema__frame[hidden] { display: none; }
.lms-ct-schema__drag { position: absolute; inset: 0; outline: 1px dashed #b38edba0; cursor: move; pointer-events: auto; touch-action: none; user-select: none; }
.lms-ct-schema__drag img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.lms-ct-schema__caption { position: absolute; bottom: 100%; margin-block: 3px; left: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: #18131e; border-radius: 3px; padding: 1px 5px; font: 12px/18px sans-serif; pointer-events: none; }
.lms-ct-schema__frame[data-schema-caption-inside="true"] .lms-ct-schema__caption { bottom: auto; top: 0; }
.lms-ct-schema__grip { position: absolute; right: max(-18px, var(--ct-schema-edge-right, -18px)); bottom: max(-18px, var(--ct-schema-edge-bottom, -18px)); width: 36px; height: 36px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.lms-ct-schema__grip-tip { position: absolute; right: 0; bottom: 0; width: 0; height: 0; pointer-events: auto; }
.lms-ct-schema__grip span { display: grid; place-items: center; width: 24px; height: 24px; background: #71499b; color: white; border: 1px solid #c6a5e9; border-radius: 4px; font: 22px/1 sans-serif; }
.lms-ct-schema__drag:focus-visible, .lms-ct-schema button:focus-visible { outline: 3px solid #c6a5e9; outline-offset: 3px; }
.lms-ct-schema__frame[aria-disabled="true"] .lms-ct-schema__drag { cursor: default; }
.lms-ct-schema__status { position: absolute; z-index: 3; top: var(--ct-schema-content-top, 64px); left: 50%; transform: translateX(-50%); max-width: calc(100% - 16px); background: #18131e; border-radius: 4px; font: 14px/1.4 sans-serif; }
.lms-ct-schema__status > span:not(.lms-ct-schema__sr) { display: block; padding: 5px 8px; }
.lms-ct-schema__status button { pointer-events: auto; margin: 4px 8px 8px; padding: 4px 8px; border: 1px solid #b38edb; border-radius: 4px; background: #30213e; color: #fff; }
.lms-ct-schema__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (any-pointer: coarse) {
    .lms-ct-schema__toolbar { gap: 0; }
    .lms-ct-schema__grip { width: 44px; height: 44px; right: max(-22px, var(--ct-schema-edge-right, -22px)); bottom: max(-22px, var(--ct-schema-edge-bottom, -22px)); }
    .lms-ct-schema__status button { min-height: 44px; }
}
@media (max-width: 767.98px) { .lms-ct-schema { display: none; } }
@media (min-width: 768px) {
    .lms-ct-viewer--schema .lms-ct-schema__toolbar { max-width: max(28px, calc(100% - 120px)); }
    .lms-ct-viewer--schema .lms-ct-viewer__context { top: var(--ct-schema-context-top, 60px); white-space: normal; overflow-wrap: anywhere; text-align: center; }
    .lms-ct-viewer--schema .lms-ct-viewer__context[data-ct-neutral="true"], .lms-ct-viewer--schema .lms-ct-viewer__context:empty { display: none; }
}

/* JPG menu and its portal have their own size rules; text popovers stay unchanged. */
.lms-ct-schema-menu { margin-left: 23px; flex: none; width: 36px; height: 36px; pointer-events: auto; }
.lms-ct-schema-menu[hidden] { display: none; }
/* The editor's generic MudButton minimum height must not stretch the circular FAB. */
.lms-ct-schema-menu__trigger { width: 36px !important; height: 36px !important; min-width: 36px !important; min-height: 36px !important; border-radius: 50% !important; transform: none !important; }
.lms-ct-schema-menu__trigger .mud-icon-root { width: 20px; height: 20px; }
.lms-ct-viewer[data-ct-changing] .lms-ct-schema-menu__trigger[data-ct-navigation-snapshot] {
    color: var(--ct-navigation-menu-color) !important; background-color: var(--ct-navigation-menu-background-color) !important;
    box-shadow: var(--ct-navigation-menu-box-shadow) !important; opacity: var(--ct-navigation-menu-opacity) !important; transition: none !important;
}
.lms-ct-viewer[data-ct-changing] .lms-ct-schema-menu__trigger[data-ct-navigation-snapshot]::before {
    color: var(--ct-navigation-menu-face-color) !important; background-color: var(--ct-navigation-menu-face-background-color) !important;
    box-shadow: var(--ct-navigation-menu-face-box-shadow) !important; opacity: var(--ct-navigation-menu-face-opacity) !important; transition: none !important;
}
/* Closing the provider must disable even an empty shell before interop catches up. */
.lms-ct-schema-menu__popover:not(.mud-popover-open),
.lms-ct-schema-menu__list-portal:not(.mud-popover-open) { visibility: hidden !important; pointer-events: none !important; }
.lms-ct-schema-menu__list-portal {
    position: fixed !important; left: var(--menu-left, 16px) !important; top: var(--menu-top, 60px) !important;
    right: auto !important; bottom: auto !important; transform: none !important;
    width: max-content; max-width: calc(100vw - 32px) !important; max-height: var(--menu-height, calc(100dvh - 92px));
    margin: 0 !important; padding: 0; overflow: visible; overscroll-behavior: contain; background: transparent; border-radius: 0;
    box-shadow: none; z-index: calc(var(--mud-zindex-popover) + 1) !important;
}
.lms-ct-schema-menu__list-portal--scroll { overflow: auto; }
.lms-ct-schema-menu__items [aria-pressed="true"] { outline: 2px solid #fff; outline-offset: -3px; }
.lms-ct-schema-menu__popover {
    position: fixed !important; left: var(--picture-left, 16px) !important; top: var(--picture-top, 60px) !important;
    right: auto !important; bottom: auto !important; transform: none !important;
    width: var(--picture-width, 0px) !important; height: var(--picture-height, 0px) !important; max-width: calc(100vw - 32px) !important;
    padding: 0; overflow: hidden; z-index: calc(var(--mud-zindex-popover) - 1) !important; background: white; border: 0; outline: 1px solid #756487; border-radius: 6px;
}
.lms-ct-schema-menu__panel { position: relative; height: 100%; width: 100%; color: #211827; }
.lms-ct-schema-menu__drag { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; overflow: hidden; cursor: move; touch-action: none; user-select: none; }
.lms-ct-schema-menu__drag:disabled { cursor: default; }
.lms-ct-schema-menu__drag img { display: block; width: 100%; height: 100%; max-width: none; user-select: none; pointer-events: none; }
.lms-ct-schema-menu__drag img[hidden] { display: none; }
.lms-ct-schema-menu__actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.lms-ct-schema-menu__actions button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid #a394b1; border-radius: 6px; background: #241a31ed; color: white; cursor: pointer; }
.lms-ct-schema-menu__actions button:disabled { opacity: .65; cursor: default; }
.lms-ct-schema-menu__actions [data-schema-menu-close] { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: #503866; }
.lms-ct-schema-menu__close-face { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d5c9df; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px #0003; }
.lms-ct-schema-menu__close-face .mud-icon-root { width: 20px; height: 20px; }
.lms-ct-schema-menu__actions [data-schema-menu-close]:hover .lms-ct-schema-menu__close-face { background: #f0e8f7; }
.lms-ct-schema-menu__resize-tip { position: absolute; right: 4px; bottom: 4px; }
.lms-ct-schema-menu__resize { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: #503866; cursor: nwse-resize; touch-action: none; }
.lms-ct-schema-menu__resize-face { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #d5c9df; border-radius: 5px; background: #fff; box-shadow: 0 1px 5px #0003; }
.lms-ct-schema-menu__resize-face .mud-icon-root { width: 20px; height: 20px; }
.lms-ct-schema-menu__resize:hover .lms-ct-schema-menu__resize-face { background: #f0e8f7; }
.lms-ct-schema-menu__resize:disabled { cursor: default; opacity: .65; }
.lms-ct-schema-menu__status { position: absolute; left: 12px; right: 50px; top: 16px; pointer-events: none; }
.lms-ct-schema-menu__status button { pointer-events: auto; }
.lms-ct-schema-menu__status button, .lms-ct-schema-menu__retry { min-height: 44px; padding: 8px; background: #241a31; color: white; border: 1px solid #a394b1; border-radius: 5px; }
.lms-ct-schema-menu__panel :focus-visible { outline: 3px solid #71499b; outline-offset: -3px; }
@media (any-pointer: coarse) {
    .lms-ct-schema-menu { margin-left: 44px; width: 44px; height: 44px; }
    .lms-ct-schema-menu__trigger { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; background: transparent !important; box-shadow: none !important; }
    .lms-ct-schema-menu__trigger::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--mud-palette-primary); box-shadow: var(--mud-elevation-6); }
    .lms-ct-schema-menu__trigger:hover::before { background: var(--mud-palette-primary-darken); }
    .lms-ct-schema-menu__trigger:disabled::before { opacity: .5; }
    .lms-ct-schema-menu__trigger .mud-icon-root { position: relative; }
    .lms-ct-schema-menu__actions [data-schema-menu-close] { width: 44px; height: 44px; }
    .lms-ct-schema-menu__resize { width: 44px; height: 44px; }
}
@media (max-width: 767.98px) { .lms-ct-schema-menu__popover, .lms-ct-schema-menu__list-portal { display: none !important; } }

/* Tool, schema and menu geometry share the viewer's measured fullscreen scale. */
html[data-ct-fullscreen="true"] .lms-ct-schema__choice {
    width: var(--ct-tool-size, 44px); height: var(--ct-tool-size, 44px);
}
html[data-ct-fullscreen="true"] .lms-ct-schema__swatch {
    width: var(--ct-schema-size, 34px); height: var(--ct-schema-size, 34px);
}
html[data-ct-fullscreen="true"] .lms-ct-schema__check { font-size: calc(var(--ct-schema-size, 34px) * .64); }
html[data-ct-fullscreen="true"] .lms-ct-schema-menu {
    width: var(--ct-tool-size, 44px); height: var(--ct-tool-size, 44px); margin-left: calc(var(--ct-tool-size, 44px) * .64);
}
html[data-ct-fullscreen="true"] .lms-ct-schema-menu__trigger {
    width: var(--ct-tool-size, 44px) !important; height: var(--ct-tool-size, 44px) !important;
    min-width: var(--ct-tool-size, 44px) !important; min-height: var(--ct-tool-size, 44px) !important;
}
html[data-ct-fullscreen="true"] .lms-ct-schema-menu__trigger .mud-icon-root {
    width: var(--ct-tool-icon-size, 26px); height: var(--ct-tool-icon-size, 26px);
}
