.frame-renderer-host {
    width: 100%;
    height: 100%;
    min-height: 180px;
}

.frame-renderer-stage {
    width: 100%;
    height: 100%;
    min-height: 180px;
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: color-mix(in srgb, var(--color-surface, #f8fafc) 88%, #000 4%);
    touch-action: none;
}

.frame-renderer-fit {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    transform-origin: center center;
    will-change: transform;
}

.frame-renderer-artboard {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    color: #111827;
}

.frame-renderer-element {
    position: absolute;
    box-sizing: border-box;
    border-radius: 0 !important;
    transform-origin: center center;
}

.frame-renderer-drawing {
    overflow: visible;
    background: transparent;
    border: 0;
}

.frame-renderer-text {
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.frame-renderer-block {
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

.frame-renderer-block img,
.frame-renderer-block video,
.frame-renderer-snapshot {
    width: 100%;
    height: 100%;
    display: block;
}

.frame-renderer-svg-block,
.frame-renderer-svg-block svg {
    width: 100%;
    height: 100%;
    display: block;
}

.frame-renderer-text-block,
.frame-renderer-code-block,
.frame-renderer-ds-block,
.frame-renderer-audio-chip,
.frame-renderer-block--missing,
.frame-renderer-legacy {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    overflow: hidden;
    font: 500 18px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.frame-renderer-text-block strong,
.frame-renderer-code-block strong,
.frame-renderer-ds-title {
    font-weight: 750;
    line-height: 1.1;
}

.frame-renderer-code-block {
    background: #0f172a;
    color: #e2e8f0;
}

.frame-renderer-code-block pre {
    margin: 0;
    white-space: pre-wrap;
    font: 400 13px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.78;
}

.frame-renderer-audio-chip {
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, #0f172a, #334155);
    color: #fff;
}

.frame-renderer-audio-chip span {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    position: relative;
}

.frame-renderer-audio-chip span::before,
.frame-renderer-audio-chip span::after {
    content: "";
    position: absolute;
    inset: 17px 14px;
    border-left: 7px solid #fff;
    border-right: 7px solid #fff;
}

.frame-renderer-ds-block {
    background: #fff;
    color: #111827;
}

.frame-renderer-ds-swatches {
    display: flex;
    gap: 6px;
}

.frame-renderer-ds-swatches span {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.frame-renderer-ds-type {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
}

.frame-renderer-block--missing,
.frame-renderer-legacy,
.frame-renderer-empty {
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(15, 23, 42, 0.58);
    background: repeating-linear-gradient(135deg, rgba(148, 163, 184, 0.14), rgba(148, 163, 184, 0.14) 8px, rgba(248, 250, 252, 0.86) 8px, rgba(248, 250, 252, 0.86) 16px);
}

.frame-renderer-empty {
    position: absolute;
    inset: 0;
    display: flex;
    font: 600 24px/1.2 system-ui, sans-serif;
    background: transparent;
}

.sp-frame-view-section {
    width: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.sp-frame-view-container {
    height: calc(100dvh - 180px);
    min-height: 260px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    background: var(--main-background-color-secondary, #f8fafc);
}

.sp-frame-view-meta {
    flex: 0 0 auto;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--color-ink-light, #64748b);
    font-size: 12px;
}

.frame-static-preview {
    width: 100%;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.frame-static-preview-artboard {
    position: relative;
    width: 100%;
    max-height: 150px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.frame-static-preview-artboard span {
    position: absolute;
    display: block;
    opacity: 0.82;
}

.frame-static-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.frame-static-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--color-ink-light, #64748b);
}

.frame-static-preview-meta strong {
    color: var(--color-ink, #0f172a);
    font-weight: 700;
}

.dpg-media-frame,
.block-frame-preview,
.library-tile-media-frame {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(14, 165, 233, 0.08));
}

.ppl-presentation-slide-frame {
    width: 100%;
    height: 100%;
}

.ppl-presentation-frame-host {
    width: 100%;
    height: 100%;
}

.cn-block-frame-host {
    width: 100%;
    height: 100%;
    min-height: 100%;
    pointer-events: none;
}

.frame-modality-host {
    width: 100%;
    min-height: 520px;
}

.frame-editor-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    overflow: hidden;
    background: var(--main-background-color, #fff);
}

.frame-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 15px 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    background: color-mix(in srgb, var(--main-background-color-secondary, #f8fafc) 88%, #fff 12%);
    overflow-x: auto;
}

.frame-editor-toolbar-group {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
    padding-right: 6px;
    margin-right: 3px;
    border-right: 1px solid color-mix(in srgb, var(--border-color, #e5e7eb) 70%, transparent);
}

.frame-editor-toolbar-group:last-child {
    padding-right: 0;
    margin-right: 0;
    border-right: 0;
}

.frame-editor-toolbar button,
.frame-editor-block-row,
.frame-editor-layer-row {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: var(--main-background-color, #fff);
    color: var(--color-ink, #0f172a);
    font: 600 12px/1.1 system-ui, sans-serif;
    cursor: pointer;
}

.frame-editor-toolbar button {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.frame-editor-toolbar .frame-editor-tool-button.is-icon-only {
    width: 28px;
    padding: 0;
}

.frame-editor-toolbar button svg {
    flex: 0 0 auto;
}

.frame-editor-draw-group {
    max-width: min(620px, 48vw);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.frame-editor-draw-tool.is-active {
    border-color: color-mix(in srgb, var(--accent-color, #2563eb) 52%, var(--border-color, #e5e7eb));
    background: color-mix(in srgb, var(--accent-color, #2563eb) 14%, var(--main-background-color, #fff));
    color: var(--accent-color, #2563eb);
}

.frame-editor-draw-color,
.frame-editor-draw-range,
.frame-editor-draw-touch {
    min-height: 28px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 999px;
    background: var(--main-background-color, #fff);
    color: var(--color-ink-light, #64748b);
    font: 650 11px/1 system-ui, sans-serif;
    white-space: nowrap;
}

.frame-editor-draw-color {
    position: relative;
    width: 28px;
    overflow: hidden;
    background: conic-gradient(from 90deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7, #ef4444);
}

.frame-editor-draw-color input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.frame-editor-draw-range,
.frame-editor-draw-touch {
    padding: 0 9px;
}

.frame-editor-draw-range input {
    width: 68px;
    accent-color: var(--accent-color, #2563eb);
}

.frame-editor-draw-touch input {
    accent-color: var(--accent-color, #2563eb);
}

.frame-editor-tool-text {
    font-size: 11px;
    line-height: 1;
}

.frame-editor-toolbar button:hover,
.frame-editor-block-row:hover,
.frame-editor-layer-row:hover,
.frame-editor-layer-row.is-layer-drop-target,
.frame-editor-layer-row.is-selected {
    border-color: color-mix(in srgb, var(--accent-color, #2563eb) 45%, var(--border-color, #e5e7eb));
    /* background: color-mix(in srgb, var(--accent-color, #2563eb) 8%, #fff); */
}

.frame-editor-layer-row {
    cursor: grab;
}

.frame-editor-layer-row:active,
.frame-editor-layer-row.is-layer-dragging {
    cursor: grabbing;
}

.frame-editor-layer-row.is-layer-dragging {
    opacity: 0.55;
}

.frame-editor-layer-row.is-layer-drop-target {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-color, #2563eb) 40%, transparent);
}

.frame-editor-save {
    color: #fff !important;
    background: var(--accent-color, #2563eb) !important;
    border-color: var(--accent-color, #2563eb) !important;
}

.frame-editor-body {
    display: grid;
    grid-template-columns: minmax(160px, 210px) minmax(260px, 1fr) minmax(170px, 230px);
    flex: 1 1 auto;
    min-height: 0;
}

.frame-editor-sidebar,
.frame-editor-inspector {
    padding: 12px;
    overflow: auto;
    background: var(--main-background-color-secondary, #f8fafc);
}

.frame-editor-sidebar {
    border-right: 1px solid var(--border-color, #e5e7eb);
}

.frame-editor-inspector {
    border-left: 1px solid var(--border-color, #e5e7eb);
}

.frame-editor-stage-panel {
    min-width: 0;
    min-height: 560px;
    padding: 14px;
    background: radial-gradient(circle at 12px 12px, rgba(100, 116, 139, 0.16) 1px, transparent 1px) 0 0 / 24px 24px,
        color-mix(in srgb, var(--main-background-color-secondary, #f8fafc) 94%, #000 3%);
}

.frame-editor-stage-mount {
    width: 100%;
    height: 100%;
    min-height: 530px;
    touch-action: none;
}

.frame-editor-stage-mount[data-frame-draw-tool="pen"],
.frame-editor-stage-mount[data-frame-draw-tool="highlighter"] {
    cursor: crosshair;
}

.frame-editor-stage-mount[data-frame-draw-tool="eraser"] {
    cursor: cell;
}

.frame-editor-live-drawing {
    position: absolute;
    inset: 0;
    z-index: 2147482998;
    pointer-events: none;
}

.frame-editor-section-title {
    margin: 2px 0 8px;
    color: var(--color-ink-light, #64748b);
    font: 750 11px/1.2 system-ui, sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.frame-editor-block-list,
.frame-editor-layer-list,
.frame-editor-ds-sources,
.frame-editor-ds-add-list,
.frame-editor-token-font-list,
.frame-editor-token-pills {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.frame-editor-design-system {
    margin-bottom: 16px;
}

.frame-editor-block-row,
.frame-editor-layer-row,
.frame-editor-ds-add-row,
.frame-editor-ds-source-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    text-align: left;
}

.frame-editor-ds-source-row {
    border: 1px solid color-mix(in srgb, var(--accent-color, #2563eb) 28%, var(--border-color, #e5e7eb));
    border-radius: 10px;
    /* background: color-mix(in srgb, var(--accent-color, #2563eb) 7%, #fff); */
    color: var(--color-ink, #0f172a);
    font: 650 12px/1.1 system-ui, sans-serif;
}

.frame-editor-ds-source-row button,
.frame-editor-ds-add-row,
.frame-editor-token-font,
.frame-editor-token-pill {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: var(--main-background-color, #fff);
    color: var(--color-ink, #0f172a);
    font: 650 11px/1.1 system-ui, sans-serif;
    cursor: pointer;
}

.frame-editor-ds-source-row button {
    padding: 5px 7px;
}

.frame-editor-ds-add-row {
    padding: 8px 10px;
}

.frame-editor-token-grid,
.frame-editor-token-gradients {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(24px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.frame-editor-token-swatch,
.frame-editor-token-gradient {
    width: 100%;
    aspect-ratio: 1;
    min-width: 24px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.frame-editor-token-gradient {
    aspect-ratio: 2.2 / 1;
    grid-column: span 2;
}

.frame-editor-token-font,
.frame-editor-token-pill {
    padding: 8px 10px;
    text-align: left;
}

.frame-editor-token-pill {
    text-transform: capitalize;
}

.frame-editor-block-row span,
.frame-editor-layer-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frame-editor-block-row small,
.frame-editor-layer-row small,
.frame-editor-empty-list {
    color: var(--color-ink-lighter, #94a3b8);
    font-size: 11px;
}

.frame-editor-inspector-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.frame-editor-inspector label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--color-ink-light, #64748b);
    font: 650 11px/1.2 system-ui, sans-serif;
}

.frame-editor-inspector input,
.frame-editor-inspector select,
.frame-editor-inspector textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 9px;
    padding: 8px;
    background: var(--main-background-color, #fff);
    color: var(--color-ink, #0f172a);
    font: 500 12px/1.25 system-ui, sans-serif;
}

.frame-editor-inspector .frame-editor-check {
    flex-direction: row;
    align-items: center;
    gap: 7px;
}

.frame-editor-inspector .frame-editor-check input {
    width: auto;
}

.frame-editor-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.frame-renderer-element.is-frame-editor-selected {
    outline: 3px solid var(--accent-color, #2563eb);
    outline-offset: 3px;
}

.frame-editor-selection-box {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid var(--accent-color, #2563eb);
    pointer-events: none;
    transform-origin: center center;
    z-index: 2147483000;
}

.frame-editor-selection-box [data-frame-handle] {
    position: absolute;
    display: block;
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--accent-color, #2563eb);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.24);
    line-height: 0;
    pointer-events: auto;
    cursor: nwse-resize;
}

.frame-editor-resize-handle.is-e {
    right: -10px;
    top: calc(50% - 9px);
    cursor: ew-resize;
}

.frame-editor-resize-handle.is-s {
    bottom: -10px;
    left: calc(50% - 9px);
    cursor: ns-resize;
}

.frame-editor-resize-handle.is-se {
    right: -10px;
    bottom: -10px;
}

.frame-editor-rotate-handle {
    top: -42px;
    left: calc(50% - 9px);
    cursor: grab;
}

.frame-editor-guide {
    position: absolute;
    z-index: 2147482999;
    background: #22c55e;
    pointer-events: none;
}

.frame-editor-guide.is-x {
    top: 0;
    bottom: 0;
    width: 2px;
}

.frame-editor-guide.is-y {
    left: 0;
    right: 0;
    height: 2px;
}

.frame-exporting .frame-renderer-element.is-frame-editor-selected {
    outline: none !important;
}

.frame-exporting .frame-editor-selection-box,
.frame-exporting .frame-editor-guide {
    display: none !important;
}

.sp-frame-editor-mount {
    width: 100%;
    height: calc(100dvh - 120px);
    min-height: 620px;
}

.sp-frame-edit-slot {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.sp-frame-editor-mount > .frame-modality-host,
.sp-frame-editor-mount > .frame-modality-host > .frame-editor-shell {
    height: 100%;
    min-height: 0;
}

.sp-frame-editor-mount > .frame-modality-host > .frame-editor-shell > .frame-editor-body {
    flex: 1 1 auto;
    min-height: 0;
}

.sp-frame-editor-mount > .frame-modality-host > .frame-editor-shell .frame-editor-stage-panel,
.sp-frame-editor-mount > .frame-modality-host > .frame-editor-shell .frame-editor-stage-mount {
    min-height: 0;
}

@media (max-width: 760px) {
    .frame-editor-body {
        grid-template-columns: 1fr;
    }

    .frame-editor-sidebar,
    .frame-editor-inspector {
        max-height: 220px;
        border: 0;
        border-bottom: 1px solid var(--border-color, #e5e7eb);
    }

    .frame-editor-inspector {
        border-top: 1px solid var(--border-color, #e5e7eb);
    }
}

@media (pointer: coarse) {
    .frame-editor-toolbar button,
    .frame-editor-draw-color,
    .frame-editor-draw-range,
    .frame-editor-draw-touch {
        min-height: 40px;
    }

    .frame-editor-toolbar .frame-editor-tool-button.is-icon-only {
        width: 40px;
    }

    .frame-editor-draw-color {
        width: 40px;
    }

    .frame-editor-selection-box [data-frame-handle] {
        width: 28px;
        height: 28px;
    }

    .frame-editor-resize-handle.is-e {
        right: -16px;
        top: calc(50% - 14px);
    }

    .frame-editor-resize-handle.is-s {
        bottom: -16px;
        left: calc(50% - 14px);
    }

    .frame-editor-resize-handle.is-se {
        right: -16px;
        bottom: -16px;
    }

    .frame-editor-rotate-handle {
        top: -54px;
        left: calc(50% - 14px);
    }
}
