.h4bs-slider-builder {
    --h4bs-editor-accent: #b31217;
    --h4bs-editor-focus: #005fcc;
    color: #1d2327;
}

.h4bs-slider-builder *,
.h4bs-slider-builder *::before,
.h4bs-slider-builder *::after {
    box-sizing: border-box;
}

.h4bs-slider-builder__intro {
    margin: 0 0 14px;
    font-size: 14px;
}

.h4bs-slider-builder__app {
    container-name: h4bs-slider-editor;
    container-type: inline-size;
}

.h4bs-slider-builder button,
.h4bs-slider-builder input,
.h4bs-slider-builder select,
.h4bs-slider-builder textarea,
.h4bs-slider-builder summary {
    min-height: 44px;
}

.h4bs-slider-builder :is(button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--h4bs-editor-focus);
    outline-offset: 2px;
    box-shadow: none;
}

.h4bs-slider-builder__toolbar,
.h4bs-slider-builder__devicebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #c3c4c7;
    padding: 10px;
    background: #f6f7f7;
}

.h4bs-slider-builder__toolbar {
    border-radius: 8px 8px 0 0;
}

.h4bs-slider-builder__devicebar {
    border-top: 0;
    background: #ffffff;
}

.h4bs-slider-builder__slides,
.h4bs-slider-builder__slide-actions,
.h4bs-slider-builder__devicebar > div,
.h4bs-slider-builder__workspace-actions,
.h4bs-slider-builder__add-layer,
.h4bs-slider-layer-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.h4bs-slider-builder__workspace-actions .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.h4bs-slider-builder__workspace-actions .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    line-height: 18px;
}

.h4bs-slider-builder__slides {
    flex: 1 1 420px;
    max-width: 100%;
    overflow-x: auto;
}

.h4bs-slider-slide-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 120px;
    border: 2px solid #8c8f94;
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    color: #1d2327;
    text-align: left;
    cursor: pointer;
}

.h4bs-slider-slide-chip span {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    min-height: 26px;
    border-radius: 50%;
    background: #1d2327;
    color: #ffffff;
    font-weight: 700;
}

.h4bs-slider-slide-chip.is-active,
.h4bs-slider-builder__devicebar .is-active {
    border-color: var(--h4bs-editor-accent);
    box-shadow: inset 0 0 0 1px var(--h4bs-editor-accent);
}

.h4bs-slider-builder__workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    min-height: 650px;
    border: 1px solid #c3c4c7;
    border-top: 0;
    background: #e7e9ec;
}

.h4bs-slider-builder__stage {
    min-width: 0;
    padding: 22px;
}

.h4bs-slider-canvas-wrap {
    min-width: 0;
}

.h4bs-slider-canvas {
    --h4bs-editor-bg: #090909;
    --h4bs-editor-overlay: #000000;
    --h4bs-editor-overlay-opacity: 0.35;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    overflow: hidden;
    border: 2px solid #50575e;
    border-radius: 6px;
    background: var(--h4bs-editor-bg);
    box-shadow: 0 18px 50px rgb(0 0 0 / 18%);
    transition: max-width 180ms ease;
}

.h4bs-slider-canvas::before {
    content: "";
    position: absolute;
    z-index: 4;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgb(255 255 255 / 10%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 10%) 1px, transparent 1px);
    background-size: 10% 10%;
}

.h4bs-slider-canvas__background,
.h4bs-slider-canvas__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.h4bs-slider-canvas__background {
    object-fit: var(--h4bs-editor-fit, cover);
    object-position: var(--h4bs-editor-position-x, 50%) var(--h4bs-editor-position-y, 50%);
}

.h4bs-slider-canvas__overlay {
    background: var(--h4bs-editor-overlay);
    opacity: var(--h4bs-editor-overlay-opacity);
}

.h4bs-slider-canvas__layer {
    position: absolute;
    z-index: 5;
    min-width: 30px;
    min-height: 28px;
    border: 2px solid transparent;
    overflow-wrap: anywhere;
    cursor: move;
    line-height: 1.15;
}

.h4bs-slider-canvas__layer.is-selected {
    border-color: #ffcc00;
    box-shadow: 0 0 0 2px rgb(0 0 0 / 75%);
}

.h4bs-slider-canvas__layer.is-device-hidden {
    opacity: 0.28 !important;
    filter: grayscale(1);
}

.h4bs-slider-canvas__layer img,
.h4bs-slider-canvas__layer video {
    display: block;
    width: 100%;
    max-width: 100%;
}

.h4bs-slider-canvas__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 2px solid currentColor;
    padding: 0 16px;
    font-weight: 750;
}

.h4bs-slider-canvas__handle {
    position: absolute;
    right: -9px;
    bottom: -9px;
    width: 18px;
    height: 18px;
    border: 2px solid #111111;
    border-radius: 3px;
    background: #ffcc00;
    cursor: nwse-resize;
}

.h4bs-slider-canvas__empty {
    position: absolute;
    z-index: 3;
    inset: 50% auto auto 50%;
    max-width: 280px;
    margin: 0;
    transform: translate(-50%, -50%);
    color: #ffffff;
    text-align: center;
}

.h4bs-slider-builder__canvas-help {
    margin: 8px auto 0;
    max-width: 820px;
    color: #50575e;
    text-align: center;
}

.h4bs-slider-builder__add-layer {
    justify-content: center;
    margin-top: 18px;
}

.h4bs-slider-builder__panels {
    overflow: auto;
    border-left: 1px solid #c3c4c7;
    background: #ffffff;
}

.h4bs-slider-builder.is-settings-collapsed .h4bs-slider-builder__workspace {
    grid-template-columns: minmax(0, 1fr);
}

.h4bs-slider-builder.is-settings-collapsed .h4bs-slider-builder__panels {
    display: none;
}

.h4bs-slider-inspector {
    padding: 16px;
    border-bottom: 1px solid #dcdcde;
}

.h4bs-slider-inspector h3 {
    margin: 0 0 14px;
    font-size: 15px;
}

.h4bs-slider-field {
    display: grid;
    gap: 5px;
    margin-bottom: 13px;
}

.h4bs-slider-field > span:first-child {
    font-weight: 650;
}

.h4bs-slider-field :is(input:not([type="checkbox"]), select, textarea) {
    width: 100%;
}

.h4bs-slider-field input[type="color"] {
    min-width: 80px;
    padding: 3px;
}

.h4bs-slider-field small {
    color: #50575e;
}

.h4bs-slider-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.h4bs-slider-field__media {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.h4bs-slider-contrast {
    border-left: 5px solid #008a20;
    margin: 0 0 13px;
    padding: 9px 10px;
    background: #edfaef;
}

.h4bs-slider-contrast.is-warning {
    border-left-color: #b32d2e;
    background: #fcf0f1;
}

.h4bs-slider-builder__advanced {
    border: 1px solid #c3c4c7;
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #ffffff;
}

.h4bs-slider-builder__advanced summary {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 650;
}

.h4bs-slider-builder__advanced > :not(summary) {
    margin-right: 14px;
    margin-left: 14px;
}

.h4bs-slider-builder__json {
    width: calc(100% - 28px);
    font-family: Consolas, Menlo, monospace;
}

.h4bs-slider-builder__json-status {
    display: inline-block;
    min-height: 44px;
    padding: 11px 8px;
}

.h4bs-slider-canvas.is-previewing .h4bs-slider-canvas__layer {
    animation: h4bsSliderEditorEntrance var(--h4bs-editor-layer-duration, 650ms) cubic-bezier(0, 0, .58, 1) both;
    animation-delay: var(--h4bs-editor-layer-delay, 0ms);
}

.h4bs-slider-canvas.is-previewing .h4bs-slider-canvas__layer[data-entrance="none"] {
    animation: none;
}

.h4bs-slider-canvas.is-previewing .h4bs-slider-canvas__layer[data-entrance="fade_left"] {
    animation-name: h4bsSliderEditorEntranceLeft;
}

.h4bs-slider-canvas.is-previewing .h4bs-slider-canvas__layer[data-entrance="fade_right"] {
    animation-name: h4bsSliderEditorEntranceRight;
}

.h4bs-slider-canvas.is-previewing .h4bs-slider-canvas__layer[data-entrance="zoom"] {
    animation-name: h4bsSliderEditorEntranceZoom;
}

@keyframes h4bsSliderEditorEntrance {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}

@keyframes h4bsSliderEditorEntranceLeft {
    from { opacity: 0; transform: translateX(-28px); }
    to { opacity: 1; transform: none; }
}

@keyframes h4bsSliderEditorEntranceRight {
    from { opacity: 0; transform: translateX(28px); }
    to { opacity: 1; transform: none; }
}

@keyframes h4bsSliderEditorEntranceZoom {
    from { opacity: 0; transform: scale(.82); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .h4bs-slider-builder *,
    .h4bs-slider-builder *::before,
    .h4bs-slider-builder *::after {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }
}

body.h4bs-slider-workspace-expanded {
    overflow: hidden !important;
}

.h4bs-slider-builder.is-workspace-expanded {
    position: fixed;
    z-index: 150000;
    inset: 0;
    display: flex;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    overflow: hidden;
    background: #e7e9ec;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__intro,
.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__advanced {
    display: none;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__app {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__toolbar,
.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__devicebar {
    flex: 0 0 auto;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__toolbar {
    border-top: 0;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__workspace {
    min-height: 0;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
}

.h4bs-slider-builder.is-workspace-expanded.is-settings-collapsed .h4bs-slider-builder__workspace {
    grid-template-columns: minmax(0, 1fr);
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__stage,
.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__panels {
    min-height: 0;
    overflow: auto;
}

.h4bs-slider-builder.is-workspace-expanded .h4bs-slider-canvas {
    max-height: calc(100dvh - 220px);
}

@container h4bs-slider-editor (max-width: 1120px) {
    .h4bs-slider-builder__workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .h4bs-slider-builder__panels {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-top: 1px solid #c3c4c7;
        border-left: 0;
    }

    .h4bs-slider-builder.is-settings-collapsed .h4bs-slider-builder__panels {
        display: none;
    }
}

@media (max-width: 1100px) {
    .h4bs-slider-builder__workspace {
        grid-template-columns: 1fr;
    }

    .h4bs-slider-builder__panels {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-top: 1px solid #c3c4c7;
        border-left: 0;
    }

    .h4bs-slider-builder.is-settings-collapsed .h4bs-slider-builder__panels {
        display: none;
    }

    .h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
    }

    .h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__panels {
        position: fixed;
        z-index: 150010;
        right: 0;
        bottom: 0;
        display: block;
        width: min(430px, 100vw);
        max-height: calc(100dvh - 126px);
        overflow: auto;
        border: 1px solid #aeb4bb;
        border-right: 0;
        border-bottom: 0;
        background: #ffffff;
        box-shadow: -12px -6px 30px rgb(0 0 0 / 20%);
    }

    .h4bs-slider-builder.is-workspace-expanded.is-settings-collapsed .h4bs-slider-builder__panels {
        display: none;
    }
}

@media (max-width: 782px) {
    .h4bs-slider-builder__toolbar,
    .h4bs-slider-builder__devicebar {
        align-items: stretch;
        flex-direction: column;
    }

    .h4bs-slider-builder__slides {
        width: 100%;
        flex: 0 0 auto;
    }

    .h4bs-slider-builder__slide-actions,
    .h4bs-slider-builder__workspace-actions,
    .h4bs-slider-builder__devicebar > div {
        width: 100%;
    }

    .h4bs-slider-builder__stage {
        padding: 12px;
    }

    .h4bs-slider-builder__panels {
        grid-template-columns: minmax(0, 1fr);
    }

    .h4bs-slider-builder.is-workspace-expanded .h4bs-slider-builder__panels {
        max-height: 52dvh;
    }

    .h4bs-slider-field-row {
        grid-template-columns: 1fr;
    }
}
