        :root {
            --sidebar-width: 250px;
        }

        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
            overflow: hidden;
        }

        .layout {
            display: flex;
            height: 100vh;
            margin-top: 0;
            position: relative;
        }

        .toolbar {
            width: var(--sidebar-width);
            background: #34495e;
            overflow-y: auto;
            padding: 20px;
            color: white;
        }

        .toolbar h1 {
            margin: 0;
            font-size: 24px;
            color: white;
        }

        .editor-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .editor-back-button {
            width: 34px;
            height: 34px;
            min-width: 34px;
            margin: 0;
            padding: 0;
            border: 1px solid rgba(255, 255, 255, 0.25);
            border-radius: 7px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.08);
        }

        .editor-back-button svg {
            width: 20px;
            height: 20px;
            fill: currentColor;
        }

        .editor-save-status {
            width: 100%;
            color: #c8d9e5;
            font-size: 12px;
            line-height: 1.2;
        }

        .editor-save-status.dirty {
            color: #ffd18d;
            font-weight: 700;
        }

        .editor-save-status.saved-flash {
            color: #2fbf71;
            font-weight: 700;
        }

        .layout > .canvas-container {
            flex: 1;
            background: #ecf0f1;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            padding: 20px 20px 122px;
            position: relative;
        }

        .canvas-wrapper > .canvas-container {
            flex: 0 0 auto;
            display: block;
            padding: 0;
            background: transparent;
            overflow: visible;
        }

        .canvas-wrapper {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: flex-start;
            align-items: flex-start;
            transition: none;
        }

        #canvas {
            border: 0;
            margin: auto;
            display: block;
        }

        .layers-panel {
            width: var(--sidebar-width);
            background: #34495e;
            padding: 0;
            color: white;
            position: fixed;
            right: 0;
            top: 0;
            height: 100vh;
            overflow: visible;
            box-sizing: border-box;
            transform: translateX(0);
            transition: transform 0.3s ease;
            z-index: 250;
            box-shadow: -12px 0 24px rgba(0, 0, 0, 0.18);
        }

        .layers-panel.collapsed {
            transform: translateX(100%);
        }

        .layers-panel-inner {
            height: 100%;
            overflow-y: auto;
            box-sizing: border-box;
            padding: 20px;
        }

        .layers-toggle {
            position: absolute;
            left: -30px;
            top: 50%;
            transform: translateY(-50%);
            width: 30px;
            height: 72px;
            background: #34495e;
            border-radius: 7px 0 0 7px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 260;
            box-shadow: -3px 0 10px rgba(0, 0, 0, 0.18);
        }

        .layers-toggle svg {
            width: 18px;
            height: 18px;
            fill: white;
            transition: transform 0.3s ease;
        }

        .layers-panel.collapsed .layers-toggle svg {
            transform: rotate(180deg);
        }

        .tool-section {
            margin-bottom: 20px;
        }

        .tool-section h3 {
            margin-bottom: 10px;
            color: #3498db;
        }

        button {
            background: #3498db;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            margin: 5px 0;
            width: 100%;
            text-align: center;
        }

        button:hover {
            background: #2980b9;
        }

        #layers-list {
            list-style: none;
            padding: 0;
        }

        .layer-item {
            padding: 8px;
            background: #2c3e50;
            border: 1px solid transparent;
            margin: 5px 0;
            border-radius: 4px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: move;
            user-select: none;
            transition: background-color 0.3s ease;
        }

        .layer-item:hover {
            border-color: #3498db;
        }

        .layer-item.active {
            background: #3498db;
        }

        .layer-item span {
            flex: 1;
        }

        .layer-name {
            border: none;
            background: none;
            color: white;
            font-size: inherit;
            padding: 0;
            margin: 0;
            width: 100%;
        }

        .layer-name:focus {
            background: #34495e;
            outline: none;
            padding: 2px;
            border-radius: 2px;
        }

        .font-controls {
            display: flex;
            gap: 5px;
            margin: 5px 0;
            align-items: center;
        }

        .font-controls select,
        .font-controls input[type="number"],
        .font-controls input[type="color"] {
            flex: 1;
            min-width: 0;
        }

        .font-select {
            width: auto;
        }

        #font-size {
            width: 60px;
            flex: 0 0 auto;
        }

        .color-picker {
            width: 30px !important;
            height: 30px;
            padding: 0;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }

        .color-picker::-webkit-color-swatch-wrapper {
            padding: 0;
        }

        .color-picker::-webkit-color-swatch {
            border: none;
            border-radius: 4px;
        }

        .color-picker::-moz-color-swatch {
            border: none;
            border-radius: 4px;
        }

        .dimension-group {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
            align-items: center;
        }

        .dimension-group input {
            width: 45px;
            flex-shrink: 0;
        }

        .panel-label {
            display: block;
            margin: 10px 0 4px;
        }

        .screen-property-input {
            width: 100%;
            margin-bottom: 10px;
            box-sizing: border-box;
        }

        .screen-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 10px;
        }

        .screen-toggle input {
            margin: 0;
        }

        .hidden-toggle {
            display: none !important;
        }

        .grid-tool-section {
            margin-bottom: 18px;
            padding-bottom: 14px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        }

        .grid-tool-section .screen-toggle {
            margin-top: 0;
            color: #fff;
            font-weight: 700;
        }

        .grid-tool-section #grid-settings {
            margin-top: 8px;
        }

        .grid-size-row {
            display: grid;
            grid-template-columns: 62px minmax(0, 1fr);
            gap: 8px;
            align-items: center;
            margin-bottom: 8px;
        }

        .grid-size-row input {
            width: 62px;
        }

        .grid-size-row button {
            margin: 0;
            min-width: 0;
            padding: 8px 10px;
        }

        .dimension-group button {
            margin: 0;
            white-space: nowrap;
        }

        .canvas-presets {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            margin-top: 6px;
        }

        .canvas-preset-button {
            margin: 0;
            min-width: 0;
            height: 38px;
            padding: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid rgba(255, 255, 255, 0.16);
        }

        .canvas-preset-button:hover {
            border-color: rgba(255, 255, 255, 0.36);
        }

        .preset-icon {
            display: block;
            border: 2px solid currentColor;
            border-radius: 2px;
            position: relative;
        }

        .preset-icon::after {
            content: '';
            position: absolute;
            left: 50%;
            bottom: 2px;
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background: currentColor;
            transform: translateX(-50%);
        }

        .preset-a4-portrait {
            width: 18px;
            height: 26px;
        }

        .preset-a4-landscape {
            width: 28px;
            height: 18px;
        }

        .preset-phone-portrait {
            width: 14px;
            height: 28px;
            border-radius: 5px;
        }

        .preset-phone-landscape {
            width: 30px;
            height: 14px;
            border-radius: 5px;
        }

        .preset-a4-portrait::after,
        .preset-a4-landscape::after {
            display: none;
        }

        .text-controls {
            display: flex;
            gap: 5px;
            margin: 5px 0;
        }

        .text-controls button {
            flex: 1;
            padding: 8px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .text-controls button.active {
            background: #2980b9;
        }

        .text-stroke-controls {
            display: flex;
            gap: 5px;
            margin: 5px 0;
            align-items: center;
        }

        .stroke-width-input {
            width: calc(100% - 35px);
            padding: 5px;
        }

        #stroke-color {
            width: 50%;
        }

        .text-align-controls button.active,
        .text-style-controls button.active {
            background: #2980b9;
        }

        .dimension-input::-webkit-inner-spin-button,
        .dimension-input::-webkit-outer-spin-button {
            -webkit-appearance: none;
            appearance: none;
            margin: 0;
        }

        .dimension-input {
            -moz-appearance: textfield;
        }

        .shape-controls {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin: 5px 0;
        }

        .shape-control-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .shape-control-item {
            display: flex;
            min-width: 0;
            flex-direction: column;
            gap: 4px;
            color: #3498db;
            font-size: 13px;
        }

        .shape-control-item input[type="color"] {
            width: 100%;
            height: 30px;
            padding: 2px;
        }

        .shape-control-item input[type="number"] {
            width: 100%;
            min-width: 0;
            box-sizing: border-box;
            padding: 6px;
        }

        .shape-toggle-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .shape-toggle {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
            color: #ffffff;
            font-size: 14px;
            line-height: 1.2;
        }

        .shape-toggle input {
            flex: 0 0 auto;
        }

        .dropdown {
            position: relative;
            display: block;
            width: 100%;
        }

        .dropdown > button {
            width: 100%;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 10px;
            z-index: 1;
        }

        .dropdown.show .dropdown-content {
            display: block;
        }

        .dropdown-content button {
            display: block;
            width: 100%;
            padding: 5px;
            text-align: left;
            border: none;
            background: none;
            color: #333;
            cursor: pointer;
        }

        .dropdown-content button:hover {
            background-color: #ddd;
        }

        .gauss-blur-controls {
            display: flex;
            flex-direction: column;
            gap: 5px;
            margin: 5px 0;
        }

        .gauss-blur-controls label {
            color: #3498db;
            font-size: 14px;
            margin-bottom: 2px;
        }

        .toolbar-footer {
            margin-top: auto;
            padding-top: 20px;
            border-top: 1px solid #2c3e50;
            display: flex;
            justify-content: space-between;
            gap: 4px;
            flex-wrap: nowrap;
            overflow-x: hidden;
        }

        .toolbar-footer button {
            flex: 1 1 0;
            min-width: 0;
            width: auto;
            padding: 5px 2px;
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            border-radius: 4px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            font-size: 11px;
            line-height: 1.15;
            text-align: center;
            white-space: normal;
            overflow-wrap: anywhere;
        }

        .toolbar-footer button.hidden {
            display: none;
        }

        .toolbar-footer button:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .toolbar-footer svg {
            width: 22px;
            height: 22px;
            fill: white;
            margin-bottom: 4px;
            flex-shrink: 0;
        }

        #instruction-link {
            position: absolute;
            bottom: 12px;
            left: 12px;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            background: #2c3e50;
            border: 1px solid rgba(255, 255, 255, .35);
            border-radius: 50%;
            text-decoration: none;
            z-index: 100;
            font-weight: 700;
            line-height: 1;
            box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
        }

        #instruction-link:hover {
            background: #3498db;
        }

        #instruction-popup {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            border: 1px solid #ccc;
            padding: 24px;
            z-index: 1000;
            width: min(720px, calc(100vw - 48px));
            max-height: calc(100vh - 64px);
            overflow-y: auto;
            box-shadow: 0 4px 18px rgba(0,0,0,0.25);
            color: #111;
        }

        #instruction-popup h2 {
            margin: 0 44px 18px 0;
        }

        #instruction-popup h3 {
            margin: 18px 0 8px;
        }

        #instruction-popup ul {
            margin-top: 8px;
            padding-left: 22px;
        }

        #instruction-popup li {
            margin-bottom: 6px;
        }

        .instruction-close-icon {
            position: absolute;
            top: 14px;
            right: 14px;
            width: 34px;
            height: 34px;
            padding: 0;
            margin: 0;
            border-radius: 50%;
            background: #e9eef2;
            color: #1f2933;
            font-size: 24px;
            line-height: 1;
        }

        .instruction-close-icon:hover {
            background: #d9e2ea;
        }

        .instruction-close-button {
            margin-top: 14px;
        }

        .interactive-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.interactive-properties {
    display: none;
}

.interactive-readonly-box {
    color: #818181;
    font-size: 12px;
    line-height: 1;
    margin-bottom: 8px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    min-height: auto;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

#interactive-role-text {
    font-size: 18px;
    margin-bottom: 4px;
}

#interactive-name-text {
    font-size: 16px;
    margin-bottom: 14px;
}

.interactive-properties input,
.interactive-properties select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px;
    border-radius: 4px;
    border: none;
    margin-bottom: 8px;
}

.interactive-properties label {
    display: block;
    color: #3498db;
    font-size: 14px;
    margin-bottom: 4px;
}

.interactive-note {
    font-size: 12px;
    color: #cfd8dc;
    line-height: 1.4;
    margin-top: 8px;
}

.interactive-row {
    margin-bottom: 10px;
}

.interactive-section-title {
    margin: 0;
    font-size: 18px;
}

.interactive-section-title.sounds {
    color: #f1c40f;
}

.interactive-section-title.animations {
    color: #ff00aa;
}

.collapsible-section {
    margin-bottom: 10px;
}

.collapsible-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 0;
    cursor: pointer;
    list-style: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.collapsible-section summary::-webkit-details-marker {
    display: none;
}

.section-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform .18s ease;
    color: #cfd8dc;
}

.collapsible-section[open] .section-chevron {
    transform: rotate(180deg);
}

.collapsible-section-body {
    padding-top: 8px;
}

.image-control-row,
.sound-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-control-row {
    margin-top: 4px;
}

.sound-control-row {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sound-control-row:last-of-type {
    border-bottom: none;
}

.sound-control-main {
    flex: 1;
    min-width: 0;
}

.sound-control-main label {
    margin: 0 0 2px 0;
}

.sound-file-name {
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sound-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.image-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.icon-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.icon-button svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.icon-button.remove {
    background: #7f8c8d;
}

.icon-button.remove:hover {
    background: #6f7f80;
}

.layer-type-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    margin-left: 6px;
    color: #dfe6e9;
}

.interactive-panel {
    width: 280px;
    background: #3b3b3b;
    color: white;
    padding: 18px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
    display: block;
    position: absolute;
    left: calc(var(--sidebar-width) + 40px);
    top: 0;
    z-index: 90;
    box-shadow: 12px 0 24px rgba(0, 0, 0, .18);
    transform: translateX(-105%);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s ease, opacity .2s ease;
    will-change: transform;
}

.interactive-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.interactive-panel h3 {
    margin-top: 0;
    margin-bottom: 14px;
    color: #3498db;
}

.interactive-panel .collapsible-section summary .interactive-section-title {
    margin: 0;
}

.interactive-panel .interactive-properties {
    display: block;
}

.interactive-panel .tool-section {
    margin-bottom: 0;
}

.screen-rail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: stretch;
    min-height: 102px;
    padding: 12px 18px;
    background: transparent;
    box-shadow: none;
    color: #fff;
    box-sizing: border-box;
    pointer-events: none;
}

.screen-rail-actions {
    display: flex;
    gap: 8px;
    width: auto;
    align-items: center;
    pointer-events: auto;
}

.screen-rail-actions button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.screen-rail-actions svg {
    width: 18px;
    height: 18px;
    min-width: 18px;
    fill: currentColor;
}

.screen-strip {
    min-width: 0;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
    pointer-events: auto;
}

.screen-item {
    width: 176px;
    min-width: 176px;
    background: #223448;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    padding: 8px 10px;
    cursor: pointer;
    color: white;
    transition: border-color 0.2s ease, background 0.2s ease;
    display: grid;
    grid-template-columns: 26px 1fr;
    column-gap: 8px;
    align-items: center;
    align-content: center;
    box-sizing: border-box;
}

.screen-item:hover {
    border-color: #7cc8f4;
}

.screen-item.active {
    background: #3498db;
    border-color: #bde8ff;
}

.screen-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
}

.danger-action {
    background: #c0392b !important;
}

.danger-action:hover {
    background: #a93226 !important;
}

.screen-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.screen-item-chosen {
    border-color: #bde8ff;
}

.screen-item-ghost {
    opacity: 0.45;
}

.screen-setup-overlay {
    position: fixed;
    inset: 0;
    z-index: 2600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.28);
    box-sizing: border-box;
}

.screen-setup-overlay.open {
    display: flex;
}

.screen-setup-dialog {
    position: relative;
    width: min(1280px, calc(100vw - 56px));
    height: min(820px, calc(100vh - 56px));
    background: #fff;
    border: 1px solid #704622;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    color: #111;
}

.screen-setup-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(390px, 42%) minmax(0, 1fr);
    gap: 34px;
    padding: 30px 28px 24px;
    overflow: hidden;
}

.screen-setup-form,
.screen-template-panel {
    min-height: 0;
}

.screen-setup-form h2,
.screen-template-panel h2 {
    margin: 0 0 24px;
    font-size: 24px;
    line-height: 1.15;
}

.screen-setup-label {
    display: block;
    margin: 18px 0 10px;
    font-size: 18px;
    line-height: 1.2;
}

.screen-size-row {
    display: grid;
    grid-template-columns: 126px 18px 126px minmax(140px, 1fr);
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
}

.screen-size-row label {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.screen-size-row input,
.screen-grid-size-row input,
.screen-property-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #111;
    border-radius: 0;
    background: #eef3f4;
    box-sizing: border-box;
    padding: 0 12px;
    font-size: 15px;
    color: #111;
}

.screen-size-separator {
    align-self: center;
    font-size: 24px;
    line-height: 1;
    margin-top: 18px;
}

.screen-size-row #apply-size {
    height: 38px;
    min-width: 150px;
    margin: 0;
    border-radius: 0;
    font-size: 15px;
    font-weight: 700;
}

.screen-setup-overlay:not(.compact) .screen-size-row {
    grid-template-columns: 126px 18px 126px;
}

.screen-setup-overlay:not(.compact) .screen-size-row #apply-size {
    display: none;
}

.screen-setup-form .canvas-presets {
    display: flex;
    gap: 8px;
    margin: 0 0 18px;
}

.screen-setup-form .canvas-preset-button {
    width: 58px;
    min-width: 58px;
    height: 46px;
    margin: 0;
    border: none;
    border-radius: 4px;
    color: #fff;
}

.screen-setup-form .screen-toggle {
    color: #111;
    font-size: 15px;
}

.screen-property-input {
    margin: 0 0 14px;
}

.screen-property-input:disabled {
    opacity: 0.72;
    color: #48535d;
}

.screen-template-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.screen-template-tabs {
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0 44px 22px 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.screen-template-tab {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0 0 8px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #111;
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
}

.screen-template-tab:hover {
    background: transparent;
}

.screen-template-tab.active {
    border-bottom-color: #111;
    font-weight: 700;
}

.screen-template-grid {
    min-height: 0;
    overflow-y: auto;
    padding: 0 16px 22px 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    grid-auto-flow: dense;
    gap: 18px;
    align-content: start;
    scrollbar-width: thin;
}

.screen-template-card {
    width: 100%;
    min-height: 164px;
    margin: 0;
    padding: 0;
    border: 2px solid #704622;
    border-radius: 4px;
    background: #f4f4f4;
}

.screen-template-card:hover,
.screen-template-card:focus {
    border-color: #159947;
    background: #f4f4f4;
    box-shadow: 0 0 0 2px rgba(21, 153, 71, 0.18);
}

.screen-template-card.tall {
    min-height: 244px;
}

.screen-template-card.wide {
    min-height: 158px;
}

.screen-setup-close {
    position: absolute;
    top: 34px;
    right: 26px;
    width: 34px;
    height: 34px;
    min-width: 34px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #4a5568;
    font-size: 34px;
    line-height: 1;
    z-index: 2;
}

.screen-setup-close:hover {
    background: transparent;
    color: #1f2933;
}

.screen-setup-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    padding: 12px 28px 14px;
    border-top: 1px solid #704622;
    background: #fff;
}

.screen-setup-footer button {
    margin: 0;
    min-height: 42px;
    border-radius: 4px;
    font-size: 17px;
}

.screen-setup-cancel {
    background: #b24858;
}

.screen-setup-cancel:hover {
    background: #9e3c4b;
}

.screen-setup-save {
    background: #8ac8a5;
}

.screen-setup-save:hover {
    background: #72b991;
}

.screen-setup-overlay.compact .screen-setup-dialog {
    width: min(590px, calc(100vw - 56px));
    height: auto;
    max-height: calc(100vh - 56px);
}

.screen-setup-overlay.compact .screen-setup-body {
    display: block;
    overflow-y: auto;
    padding: 34px 34px 24px;
}

.screen-setup-overlay.compact .screen-template-panel {
    display: none;
}

.screen-setup-overlay.compact .screen-setup-close {
    top: 18px;
    right: 18px;
}

.screen-setup-overlay.compact .screen-size-row {
    grid-template-columns: 126px 18px 126px minmax(120px, 1fr);
}

.screen-setup-overlay.compact .screen-setup-footer {
    grid-template-columns: 1fr 1fr;
    padding: 12px 34px 34px;
    border-top: none;
}

@media (max-width: 980px) {
    .screen-setup-body {
        display: block;
        overflow-y: auto;
    }

    .screen-template-panel {
        margin-top: 28px;
    }

    .screen-template-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 720px) {
    .screen-setup-overlay {
        padding: 10px;
    }

    .screen-setup-dialog,
    .screen-setup-overlay.compact .screen-setup-dialog {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
        max-height: none;
    }

    .screen-setup-body,
    .screen-setup-overlay.compact .screen-setup-body {
        padding: 22px 18px 18px;
    }

    .screen-size-row,
    .screen-setup-overlay.compact .screen-size-row {
        grid-template-columns: 1fr 18px 1fr;
    }

    .screen-size-row #apply-size {
        grid-column: 1 / -1;
    }

    .screen-template-tabs {
        gap: 20px;
        margin-right: 0;
    }

    .screen-template-grid {
        grid-template-columns: 1fr;
    }

    .screen-setup-footer,
    .screen-setup-overlay.compact .screen-setup-footer {
        padding: 12px 18px 18px;
        gap: 10px;
    }
}

.clipart-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.38);
    box-sizing: border-box;
}

.clipart-picker-overlay.open {
    display: flex;
}

.clipart-picker {
    width: min(1280px, calc(100vw - 56px));
    height: min(820px, calc(100vh - 56px));
    background: #fff;
    border: 1px solid #704622;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    color: #1f2933;
}

.clipart-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px 6px;
}

.clipart-picker-header h2 {
    margin: 0;
    font-size: 22px;
}

.clipart-search-row {
    padding: 8px 28px 10px;
}

.clipart-search {
    width: 100%;
    min-height: 42px;
    border: 1px solid #b7c1c9;
    border-radius: 7px;
    padding: 0 14px;
    font-size: 16px;
    color: #1f2933;
    box-sizing: border-box;
}

.clipart-search:focus {
    outline: 2px solid rgba(52, 152, 219, 0.28);
    border-color: #3498db;
}

.clipart-picker-close {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #4a5568;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.clipart-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    column-gap: 22px;
    row-gap: 8px;
    max-height: 112px;
    padding: 6px 28px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
}

.clipart-filter {
    width: auto;
    min-width: 0;
    margin: 0;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 4px 0 5px;
    background: transparent;
    color: #111;
    font-size: 17px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    flex: 0 0 auto;
}

.clipart-filter.active {
    border-bottom-color: #111;
    font-weight: 700;
}

.clipart-grid {
    min-height: 0;
    overflow-y: auto;
    padding: 0 28px 22px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    align-content: start;
}

.clipart-tile {
    min-height: 150px;
    border: 2px solid #704622;
    background: #f4f4f4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    box-sizing: border-box;
    cursor: pointer;
    color: #1f2933;
    text-align: center;
}

.clipart-tile:hover,
.clipart-tile.selected {
    border-color: #159947;
    box-shadow: 0 0 0 2px rgba(21, 153, 71, 0.18);
}

.clipart-tile img {
    max-width: 100%;
    max-height: 106px;
    object-fit: contain;
    pointer-events: none;
}

.clipart-tile-name {
    width: 100%;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clipart-upload-tile {
    background: #d9f5fb;
    border-style: dashed;
    font-weight: 700;
    font-size: 20px;
}

.clipart-upload-tile svg {
    width: 54px;
    height: 54px;
    fill: currentColor;
}

.clipart-upload-tile.drag-over {
    background: #c3eff9;
    border-color: #159947;
}

.clipart-empty {
    grid-column: 1 / -1;
    padding: 28px;
    color: #667085;
    text-align: center;
}

.clipart-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
    padding: 12px 28px;
    border-top: 1px solid #704622;
    background: #fff;
}

.clipart-picker-footer button {
    min-width: 150px;
    margin: 0;
    padding: 10px 18px;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.clipart-cancel {
    background: #b24858;
}

.clipart-use {
    background: #078c3f;
}

.clipart-use:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 720px) {
    .clipart-picker-overlay {
        padding: 10px;
    }

    .clipart-picker {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
    }

    .clipart-grid {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
        gap: 10px;
    }

    .clipart-tile {
        min-height: 126px;
    }

    .clipart-picker-footer {
        gap: 10px;
    }

    .clipart-picker-footer button {
        min-width: 0;
        flex: 1;
    }
}

/* Modern UI refresh: visual-only layer, mechanics stay on existing ids/classes. */
:root {
    --sidebar-width: 300px;
    --ui-bg: #f4f7fb;
    --ui-surface: rgba(255, 255, 255, 0.94);
    --ui-surface-solid: #ffffff;
    --ui-muted-surface: #f3f6fb;
    --ui-line: #dfe6f2;
    --ui-line-strong: #cfd8ea;
    --ui-text: #172b4d;
    --ui-muted: #72819a;
    --ui-blue: #4b7cff;
    --ui-purple: #5b45f6;
    --ui-purple-soft: #f1efff;
    --ui-mint: #2fbf9c;
    --ui-mint-soft: #eaf8f3;
    --ui-red: #e34d47;
    --ui-red-soft: #fff0ef;
    --ui-orange: #f39b22;
    --ui-shadow: 0 20px 50px rgba(23, 43, 77, 0.12);
    --ui-shadow-soft: 0 10px 28px rgba(23, 43, 77, 0.08);
    --ui-radius: 18px;
    --ui-radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    background: var(--ui-bg);
    overflow: hidden;
}

body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--ui-text);
}

.layout {
    background:
        radial-gradient(circle at 45% 10%, rgba(91, 69, 246, 0.08), transparent 32%),
        radial-gradient(circle at 85% 82%, rgba(47, 191, 156, 0.10), transparent 34%),
        linear-gradient(135deg, #f7f9fd 0%, #eef3f8 100%);
}

.toolbar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: calc(100vh - 4px);
    margin: 2px 0 2px 2px;
    padding: 28px 26px 110px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    color: var(--ui-text);
    background: var(--ui-surface);
    border: 1px solid rgba(223, 230, 242, 0.82);
    border-radius: 0 var(--ui-radius) var(--ui-radius) 0;
    box-shadow: var(--ui-shadow-soft);
    scrollbar-width: thin;
    scrollbar-color: #c7d2e5 transparent;
}

@supports not (scrollbar-gutter: stable) {
    .toolbar {
        overflow-y: scroll;
    }
}

.toolbar::-webkit-scrollbar,
.interactive-panel::-webkit-scrollbar,
.layers-panel-inner::-webkit-scrollbar,
.screen-strip::-webkit-scrollbar,
.clipart-grid::-webkit-scrollbar,
.clipart-filter-row::-webkit-scrollbar,
.screen-template-grid::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.toolbar::-webkit-scrollbar-thumb,
.interactive-panel::-webkit-scrollbar-thumb,
.layers-panel-inner::-webkit-scrollbar-thumb,
.screen-strip::-webkit-scrollbar-thumb,
.clipart-grid::-webkit-scrollbar-thumb,
.clipart-filter-row::-webkit-scrollbar-thumb,
.screen-template-grid::-webkit-scrollbar-thumb {
    background: #c7d2e5;
    border-radius: 999px;
}

.editor-header {
    position: relative;
    display: grid;
    grid-template-columns: 38px 1fr;
    column-gap: 14px;
    row-gap: 2px;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ui-line);
}

.editor-back-button {
    grid-row: 1 / span 2;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: 1px solid #dbe3f3;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff, #eef3ff);
    color: var(--ui-purple);
    box-shadow: 0 8px 20px rgba(91, 69, 246, 0.12);
}

.editor-back-button:hover {
    background: var(--ui-purple-soft);
    border-color: #c5bcff;
    color: var(--ui-purple);
}

.toolbar h1 {
    margin: 0;
    color: var(--ui-text);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: 0;
}

.editor-save-status {
    width: auto;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 600;
}

.editor-save-status.dirty {
    color: #b97000;
}

.editor-save-status.saved-flash {
    color: #24a86a;
}

.tool-section {
    margin-bottom: 24px;
}

.tool-section h3,
.interactive-panel h3,
.layers-panel h3 {
    margin: 0 0 14px;
    color: var(--ui-text);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
}

.toolbar > .tool-section > h3,
.toolbar .collapsible-section summary h3 {
    color: var(--ui-purple);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.toolbar details.tool-section {
    border-top: 1px solid var(--ui-line);
    padding-top: 22px;
}

button,
.dropdown-content button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    border-radius: var(--ui-radius-sm);
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--ui-purple), #745cff);
    color: #fff;
    font-weight: 700;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease, color .18s ease;
}

button:hover {
    background: linear-gradient(135deg, #4c37e8, #684fff);
    box-shadow: 0 10px 22px rgba(91, 69, 246, 0.18);
}

button:active {
    transform: translateY(1px);
}

.toolbar > .tool-section button,
.interactive-controls button,
.dropdown > button {
    min-height: 44px;
    margin: 0 0 10px;
    padding: 0 14px 0 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    background: linear-gradient(135deg, #f6f4ff, #f0f6ff);
    color: var(--ui-text);
    border-color: transparent;
    box-shadow: none;
    text-align: left;
}

.toolbar > .tool-section button::before,
.interactive-controls button::before,
.dropdown > button::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    border-radius: 5px;
    background: var(--ui-purple);
    box-shadow: 0 0 0 4px rgba(91, 69, 246, 0.10);
}

#add-image::before {
    border-radius: 4px;
    background:
        linear-gradient(135deg, transparent 48%, #fff 49% 57%, transparent 58%),
        var(--ui-purple);
}

.dropdown > button::before {
    border-radius: 50%;
}

#text-dropdown > button::before {
    content: "T";
    width: 20px;
    height: 20px;
    color: var(--ui-purple);
    background: transparent;
    box-shadow: none;
    font-size: 19px;
    font-weight: 900;
    line-height: 20px;
    text-align: center;
}

.toolbar > .tool-section button:hover,
.dropdown > button:hover {
    background: linear-gradient(135deg, #efecff, #eaf4ff);
    border-color: #d6d0ff;
    box-shadow: 0 8px 20px rgba(91, 69, 246, 0.10);
    color: var(--ui-purple);
}

.interactive-controls button {
    background: linear-gradient(135deg, #eaf8f3, #effbf8);
}

.toolbar .interactive-controls button {
    background: linear-gradient(135deg, #eaf8f3, #effbf8);
    color: var(--ui-text);
}

.interactive-controls button::before {
    background: var(--ui-mint);
    box-shadow: 0 0 0 4px rgba(47, 191, 156, 0.12);
}

.toolbar .interactive-controls button::before {
    background: var(--ui-mint);
    box-shadow: 0 0 0 4px rgba(47, 191, 156, 0.12);
}

.interactive-controls button:hover {
    background: linear-gradient(135deg, #dff5ee, #ecfbf6);
    border-color: #beeade;
    color: #0f856d;
}

.toolbar .interactive-controls button:hover {
    background: linear-gradient(135deg, #dff5ee, #ecfbf6);
    border-color: #beeade;
    color: #0f856d;
}

.grid-tool-section {
    margin: 0 0 24px;
    padding: 0 0 22px;
    border-bottom: 1px solid var(--ui-line);
}

.grid-tool-section .screen-toggle,
.screen-toggle {
    min-height: 42px;
    margin: 0;
    padding: 0;
    color: var(--ui-text);
    font-weight: 700;
}

.grid-tool-section > .screen-toggle {
    flex-direction: row-reverse;
    justify-content: space-between;
    gap: 14px;
}

.screen-toggle input[type="checkbox"],
.shape-toggle input[type="checkbox"],
.interactive-row input[type="checkbox"] {
    width: 34px;
    height: 20px;
    min-width: 34px;
    margin: 0;
    appearance: none;
    border: 1px solid #cbd5e5;
    border-radius: 999px;
    background: #c8d1e0;
    position: relative;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.screen-toggle input[type="checkbox"]::after,
.shape-toggle input[type="checkbox"]::after,
.interactive-row input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(23, 43, 77, 0.18);
    transition: transform .18s ease;
}

.screen-toggle input[type="checkbox"]:checked,
.shape-toggle input[type="checkbox"]:checked,
.interactive-row input[type="checkbox"]:checked {
    background: var(--ui-purple);
    border-color: var(--ui-purple);
}

.screen-toggle input[type="checkbox"]:checked::after,
.shape-toggle input[type="checkbox"]:checked::after,
.interactive-row input[type="checkbox"]:checked::after {
    transform: translateX(14px);
}

.grid-size-row {
    grid-template-columns: 68px 1fr;
    gap: 10px;
}

input,
select,
textarea,
.interactive-properties input,
.interactive-properties select,
.screen-size-row input,
.screen-grid-size-row input,
.screen-property-input,
.clipart-search {
    min-height: 40px;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-sm);
    background: #fff;
    color: var(--ui-text);
    padding: 0 12px;
    box-shadow: inset 0 1px 0 rgba(23, 43, 77, 0.02);
}

input:focus,
select:focus,
textarea:focus,
.interactive-properties input:focus,
.interactive-properties select:focus,
.clipart-search:focus {
    outline: none;
    border-color: #9b8cff;
    box-shadow: 0 0 0 3px rgba(91, 69, 246, 0.14);
}

.screen-toggle input[type="checkbox"],
.shape-toggle input[type="checkbox"],
.interactive-row input[type="checkbox"] {
    min-height: 20px;
    padding: 0;
    border-radius: 999px;
    box-shadow: none;
}

.dropdown-content {
    min-width: 100%;
    padding: 8px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--ui-shadow-soft);
    z-index: 500;
}

.dropdown-content button {
    min-height: 36px;
    margin: 0;
    padding: 0 10px;
    color: var(--ui-text);
    background: transparent;
    border-radius: 7px;
    font-weight: 650;
}

.dropdown-content button::before {
    display: none;
}

.dropdown-content button:hover {
    color: var(--ui-purple);
    background: var(--ui-purple-soft);
    box-shadow: none;
}

.shape-control-item,
.gauss-blur-controls label,
.interactive-properties label {
    color: var(--ui-text);
    font-weight: 700;
}

.shape-toggle,
.interactive-note,
.sound-file-name {
    color: var(--ui-muted);
}

.visibility-condition-settings {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.visibility-condition-settings select {
    width: 100%;
}

#text-properties {
    overflow-x: hidden;
}

#text-properties .font-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 60px 56px;
    gap: 8px;
    align-items: center;
    margin: 8px 0 12px;
}

#text-properties .font-controls select,
#text-properties .font-controls input {
    width: 100%;
    min-width: 0;
}

#text-properties .font-controls .color-picker,
#text-properties #stroke-color {
    width: 56px !important;
    height: 40px;
    min-height: 40px;
    padding: 3px;
    border: 1px solid var(--ui-line);
    border-radius: var(--ui-radius-sm);
    background: #fff;
}

#text-properties .text-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 12px;
}

#text-properties .text-controls button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    justify-content: center;
    text-align: center;
    color: var(--ui-text);
    background: var(--ui-purple-soft);
    border: 1px solid transparent;
    box-shadow: none;
    font-size: 15px;
}

#text-properties .text-controls button::before {
    display: none;
}

#text-properties .text-controls button svg {
    width: 17px;
    height: 17px;
}

#text-properties .text-controls button:hover {
    color: var(--ui-purple);
    background: #ebe7ff;
    border-color: #d6d0ff;
    box-shadow: none;
}

#text-properties .text-controls button.active {
    color: var(--ui-purple);
    background: #e7e2ff;
    border-color: #bdb2ff;
    box-shadow: 0 0 0 2px rgba(91, 69, 246, 0.08);
}

#text-properties .text-stroke-controls {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin: 8px 0 14px;
}

#text-properties .stroke-width-input {
    width: 100%;
    min-width: 0;
}

#dynamic-text-section {
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid var(--ui-line);
}

.interactive-panel > #text-properties,
.interactive-panel > #shape-properties,
.interactive-panel > #gauss-blur-controls {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.interactive-panel > #shape-properties {
    padding-top: 18px;
    border-top: 1px solid var(--ui-line);
}

.interactive-panel > #gauss-blur-controls {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--ui-line);
}

.interactive-panel .interactive-properties + #shape-properties {
    margin-top: 18px;
}

.toolbar-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ui-line);
    gap: 12px;
    justify-content: flex-start;
}

.toolbar-footer button {
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ui-muted);
    font-size: 0;
}

.toolbar-footer button:hover {
    background: var(--ui-muted-surface);
    border-color: var(--ui-line);
    color: var(--ui-purple);
    box-shadow: none;
}

.toolbar-footer svg {
    width: 17px;
    height: 17px;
    margin: 0;
    fill: currentColor;
}

#instruction-link {
    width: 26px;
    height: 26px;
    bottom: 18px;
    left: 26px;
    color: var(--ui-muted);
    background: #fff;
    border: 1px solid var(--ui-line);
    box-shadow: 0 8px 18px rgba(23, 43, 77, 0.10);
}

#instruction-link::after {
    content: "Нужна помощь?";
    position: absolute;
    left: 34px;
    top: 50%;
    transform: translateY(-50%);
    width: 120px;
    color: var(--ui-text);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
}

#instruction-link:hover {
    background: var(--ui-purple-soft);
    color: var(--ui-purple);
}

.layout > .canvas-container {
    background:
        linear-gradient(90deg, rgba(255,255,255,0.42) 0 1px, transparent 1px),
        linear-gradient(180deg, rgba(255,255,255,0.42) 0 1px, transparent 1px),
        radial-gradient(circle at 50% 0%, rgba(91, 69, 246, 0.08), transparent 40%),
        var(--ui-bg);
    background-size: 28px 28px, 28px 28px, auto, auto;
    padding: 36px 330px 126px 34px;
}

.canvas-wrapper > .canvas-container {
    background: transparent;
}

#canvas {
    filter: drop-shadow(0 18px 32px rgba(23, 43, 77, 0.12));
}

.interactive-panel {
    left: calc(var(--sidebar-width) + 12px);
    top: 2px;
    width: 320px;
    height: calc(100vh - 4px);
    padding: 30px 26px;
    color: var(--ui-text);
    background: var(--ui-surface);
    border: 1px solid rgba(223, 230, 242, 0.86);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.interactive-panel.open {
    transform: translateX(0);
}

.interactive-panel h3 {
    font-size: 17px;
}

.interactive-panel .interactive-properties > h3 {
    padding-right: 26px;
}

.interactive-panel::after {
    content: "×";
    position: absolute;
    right: 26px;
    top: 28px;
    color: var(--ui-muted);
    font-size: 28px;
    line-height: 1;
    pointer-events: none;
}

#interactive-role-text {
    color: var(--ui-muted);
    font-size: 13px;
    font-weight: 700;
}

#interactive-name-text {
    color: var(--ui-text);
    font-size: 14px;
    font-weight: 800;
}

.interactive-row {
    margin-bottom: 16px;
}

.interactive-properties input,
.interactive-properties select {
    margin-bottom: 0;
}

.collapsible-section summary {
    border-top: 1px solid var(--ui-line);
    border-bottom: none;
    padding: 14px 0;
}

.section-chevron {
    color: var(--ui-muted);
}

.interactive-section-title.sounds {
    color: var(--ui-orange);
}

.interactive-section-title.animations {
    color: #a855f7;
}

.icon-button {
    border-radius: 8px;
}

.icon-button.remove {
    background: #eef2f7;
    color: var(--ui-muted);
}

.icon-button.remove:hover {
    background: var(--ui-red-soft);
    color: var(--ui-red);
}

.layers-panel {
    width: 300px;
    top: 18px;
    right: 12px;
    height: calc(100vh - 36px);
    color: var(--ui-text);
    background: var(--ui-surface);
    border: 1px solid rgba(223, 230, 242, 0.86);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
}

.layers-panel.collapsed {
    transform: translateX(calc(100% + 14px));
}

.layers-panel-inner {
    padding: 28px 18px;
}

.layers-panel h3 {
    margin: 0 0 18px;
    padding: 0 8px;
}

.layers-toggle {
    left: -30px;
    width: 30px;
    height: 64px;
    background: var(--ui-surface);
    color: var(--ui-text);
    border: 1px solid var(--ui-line);
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -10px 8px 22px rgba(23, 43, 77, 0.10);
}

.layers-toggle svg {
    fill: var(--ui-text);
}

#layers-list {
    margin: 0;
}

.layer-item {
    min-height: 40px;
    margin: 0 0 8px;
    padding: 0 12px;
    color: var(--ui-text);
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(23, 43, 77, 0.04);
    gap: 10px;
}

.layer-item::before {
    display: none;
}

.layer-item .layer-icon {
    position: relative;
    display: inline-flex;
    flex: 0 0 20px;
    width: 20px;
    min-width: 20px;
    max-width: 20px;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    align-items: center;
    justify-content: center;
    align-self: center;
    border-radius: 6px;
    margin: 0 2px 0 0;
}

.layer-item .layer-icon-image {
    background:
        linear-gradient(135deg, transparent 48%, #fff 49% 57%, transparent 58%),
        var(--ui-purple);
    box-shadow: 0 0 0 4px rgba(91, 69, 246, 0.10);
}

.layer-item .layer-icon-shape {
    background: var(--ui-purple);
    box-shadow: 0 0 0 4px rgba(91, 69, 246, 0.10);
}

.layer-item .layer-icon-text {
    color: var(--ui-purple);
    background: transparent;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.layer-item .layer-icon-interactive {
    background: var(--ui-mint);
    box-shadow: 0 0 0 4px rgba(47, 191, 156, 0.12);
}

.layer-item .layer-icon-generic {
    background: #dbe4f1;
    box-shadow: 0 0 0 4px rgba(114, 129, 154, 0.10);
}

.layer-item .layer-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-item:hover {
    border-color: #c9c1ff;
    background: #fff;
}

.layer-item.active {
    color: var(--ui-purple);
    background: var(--ui-purple-soft);
    border-color: #bdb2ff;
    box-shadow: 0 0 0 2px rgba(91, 69, 246, 0.08);
}

.layer-name {
    color: inherit;
    font-weight: 700;
}

.layer-name:focus {
    background: #fff;
    color: var(--ui-text);
    box-shadow: 0 0 0 2px rgba(91, 69, 246, 0.12);
}

.layer-type-badge {
    background: #edf2f7;
    color: var(--ui-muted);
}

.screen-rail {
    left: 18px;
    right: 24px;
    bottom: 22px;
    min-height: 66px;
    padding: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.layout:has(.layers-panel:not(.collapsed)) .screen-rail {
    right: 334px;
}

.screen-rail-actions {
    gap: 12px;
}

.screen-rail-actions button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 8px;
    background: #fff;
    color: var(--ui-purple);
    border: 1px solid var(--ui-line);
    box-shadow: 0 10px 22px rgba(23, 43, 77, 0.08);
}

.screen-rail-actions button:hover {
    background: var(--ui-purple-soft);
    border-color: #c9c1ff;
    box-shadow: 0 12px 24px rgba(91, 69, 246, 0.14);
}

.screen-rail-actions .danger-action {
    background: #fff !important;
    color: var(--ui-red);
    border-color: #ffd4d1;
}

.screen-rail-actions .danger-action:hover {
    background: var(--ui-red-soft) !important;
    color: var(--ui-red);
}

.screen-strip {
    gap: 14px;
    padding: 4px 0;
}

.screen-item {
    width: 176px;
    min-width: 176px;
    min-height: 58px;
    padding: 8px 14px;
    color: var(--ui-text);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    box-shadow: 0 10px 22px rgba(23, 43, 77, 0.06);
}

.screen-item:hover {
    border-color: #c9c1ff;
    background: #fff;
}

.screen-item.active {
    color: var(--ui-text);
    background: #fff;
    border-color: var(--ui-purple);
    box-shadow: 0 0 0 2px rgba(91, 69, 246, 0.12), 0 12px 24px rgba(23, 43, 77, 0.08);
}

.screen-number {
    color: var(--ui-text);
    background: #edf2f7;
    box-shadow: inset 0 0 0 1px #d9e2ef;
}

.screen-item.active .screen-number {
    color: #fff;
    background: linear-gradient(135deg, var(--ui-purple), #2f2be8);
    box-shadow: none;
}

.screen-name {
    color: inherit;
}

.screen-setup-overlay,
.clipart-picker-overlay {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(8px);
}

.screen-setup-dialog,
.clipart-picker,
#instruction-popup {
    color: var(--ui-text);
    background: var(--ui-surface-solid);
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    box-shadow: var(--ui-shadow);
}

.screen-setup-body {
    gap: 34px;
}

.screen-setup-form h2,
.screen-template-panel h2,
.clipart-picker-header h2 {
    color: var(--ui-text);
    font-weight: 850;
    letter-spacing: 0;
}

.screen-setup-label {
    color: var(--ui-text);
    font-weight: 750;
}

.screen-size-row #apply-size {
    border-radius: 8px;
}

.screen-setup-form .canvas-preset-button {
    background: linear-gradient(135deg, var(--ui-purple), #6f59ff);
    border-radius: 8px;
}

.screen-template-tab,
.clipart-filter {
    color: var(--ui-text);
    font-size: 16px;
}

.screen-template-tab.active,
.clipart-filter.active {
    color: var(--ui-purple);
    border-bottom-color: var(--ui-purple);
}

.screen-template-card,
.clipart-tile {
    border: 1px solid var(--ui-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(23, 43, 77, 0.05);
}

.screen-template-card:hover,
.screen-template-card:focus,
.clipart-tile:hover,
.clipart-tile.selected {
    border-color: #a99dff;
    box-shadow: 0 0 0 2px rgba(91, 69, 246, 0.10), 0 12px 24px rgba(23, 43, 77, 0.08);
}

.clipart-upload-tile {
    color: var(--ui-text);
    background: #eaf7ff;
    border-style: dashed;
}

.screen-setup-close,
.clipart-picker-close,
.instruction-close-icon {
    color: var(--ui-muted);
    border-radius: 8px;
}

.screen-setup-close:hover,
.clipart-picker-close:hover,
.instruction-close-icon:hover {
    color: var(--ui-purple);
    background: var(--ui-purple-soft);
    box-shadow: none;
}

.screen-setup-footer,
.clipart-picker-footer {
    border-top: 1px solid var(--ui-line);
}

.screen-setup-cancel,
.clipart-cancel {
    background: #bb4a5d;
}

.screen-setup-cancel:hover,
.clipart-cancel:hover {
    background: #a63f51;
}

.screen-setup-save,
.clipart-use {
    background: #8acda8;
}

.screen-setup-save:hover,
.clipart-use:hover {
    background: #69bd8f;
}

.unsaved-exit-overlay {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(8px);
    box-sizing: border-box;
}

.unsaved-exit-dialog {
    width: min(460px, calc(100vw - 48px));
    color: var(--ui-text);
    background: var(--ui-surface-solid);
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    box-shadow: var(--ui-shadow);
    padding: 26px 28px 24px;
    box-sizing: border-box;
}

.unsaved-exit-dialog h2 {
    margin: 0 0 12px;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 850;
}

.unsaved-exit-dialog p {
    margin: 0;
    color: var(--ui-muted);
    font-size: 15px;
    line-height: 1.5;
}

.unsaved-exit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 24px;
}

.unsaved-exit-actions button {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 750;
    cursor: pointer;
}

.unsaved-exit-cancel {
    color: var(--ui-purple);
    background: #fff;
    border: 1px solid var(--ui-line);
}

.unsaved-exit-cancel:hover {
    background: var(--ui-purple-soft);
    border-color: #c9c1ff;
}

.unsaved-exit-confirm {
    color: #fff;
    background: var(--ui-red);
    border: 1px solid var(--ui-red);
}

.unsaved-exit-confirm:hover {
    background: #d83e38;
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 276px;
    }

    .toolbar {
        padding-left: 20px;
        padding-right: 20px;
    }

    .interactive-panel {
        width: 300px;
        left: calc(var(--sidebar-width) + 10px);
    }

    .screen-rail {
        left: 18px;
        right: 24px;
    }

    .layout:has(.layers-panel:not(.collapsed)) .screen-rail {
        right: 294px;
    }
}

@media (max-width: 900px) {
    .toolbar {
        width: 250px;
        min-width: 250px;
        padding: 18px;
    }

    .layers-panel {
        width: 260px;
    }

    .layout > .canvas-container {
        padding-right: 40px;
    }

    .screen-rail {
        left: 18px;
        right: 18px;
    }
}

/* Figma-like compact editor shell. Keeps existing IDs and mechanics intact. */
:root {
    --sidebar-width: 248px;
    --inspector-width: 316px;
    --chrome-bg: #f7f8fa;
    --work-bg: #e9edf2;
    --surface: #ffffff;
    --surface-subtle: #f4f6f8;
    --border: #d8dde6;
    --border-strong: #c7ced9;
    --text-main: #1f2937;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-soft: #eaf1ff;
    --ok: #16a34a;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --control-radius: 6px;
}

html,
body {
    background: var(--work-bg);
}

body {
    color: var(--text-main);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.layout {
    height: 100vh;
    padding-top: 48px;
    background: var(--work-bg);
}

.layout::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    z-index: 880;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.editor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 32px auto auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border: 0;
    background: transparent;
}

.editor-back-button {
    grid-row: auto;
    width: 32px;
    min-width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    color: var(--text-main);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    box-shadow: none;
}

.editor-back-button:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
    box-shadow: none;
}

.editor-back-button svg {
    width: 18px;
    height: 18px;
}

.toolbar h1 {
    color: var(--text-main);
    font-size: 15px;
    font-weight: 750;
}

.editor-save-status {
    width: auto;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.editor-save-status.dirty {
    color: #b45309;
}

.editor-save-status.saved-flash {
    color: var(--ok);
}

.toolbar {
    order: 1;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: calc(100vh - 48px);
    margin: 0;
    padding: 12px;
    color: var(--text-main);
    background: var(--chrome-bg);
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    scrollbar-color: #b8c0cc transparent;
}

.toolbar > .tool-section,
.toolbar details.tool-section {
    margin: 0 0 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
}

.toolbar details.tool-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.tool-section h3,
.toolbar > .tool-section > h3,
.toolbar .collapsible-section summary h3,
.interactive-panel h3,
.layers-panel h3 {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.2;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0;
}

button {
    border-radius: var(--control-radius);
    background: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: none;
    color: #fff;
    font-weight: 650;
}

button:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    box-shadow: none;
}

button:active {
    transform: none;
}

.toolbar > .tool-section button,
.interactive-controls button,
.dropdown > button {
    min-height: 34px;
    margin: 0 0 6px;
    padding: 0 10px 0 32px;
    justify-content: flex-start;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: none;
    font-size: 13px;
    font-weight: 650;
}

.toolbar > .tool-section button::before,
.interactive-controls button::before,
.dropdown > button::before {
    left: 10px;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--text-muted);
    box-shadow: none;
}

#text-dropdown > button::before {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 14px;
}

.toolbar > .tool-section button:hover,
.dropdown > button:hover,
.interactive-controls button:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
    box-shadow: none;
}

.interactive-controls {
    gap: 4px;
}

.interactive-controls button::before,
.toolbar .interactive-controls button::before {
    background: #0f766e;
    box-shadow: none;
}

.grid-tool-section {
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.grid-tool-section .screen-toggle,
.screen-toggle {
    min-height: 30px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 650;
}

.grid-size-row {
    grid-template-columns: 64px 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

input,
select,
textarea,
.interactive-properties input,
.interactive-properties select,
.screen-size-row input,
.screen-grid-size-row input,
.screen-property-input,
.clipart-search {
    min-height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    background: var(--surface);
    color: var(--text-main);
    padding: 0 9px;
    font-size: 13px;
    box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.interactive-properties input:focus,
.interactive-properties select:focus,
.clipart-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.screen-toggle input[type="checkbox"],
.shape-toggle input[type="checkbox"],
.interactive-row input[type="checkbox"] {
    width: 30px;
    min-width: 30px;
    height: 18px;
    min-height: 18px;
    border-color: #b9c2d0;
    background: #cbd5e1;
}

.screen-toggle input[type="checkbox"]::after,
.shape-toggle input[type="checkbox"]::after,
.interactive-row input[type="checkbox"]::after {
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
}

.screen-toggle input[type="checkbox"]:checked,
.shape-toggle input[type="checkbox"]:checked,
.interactive-row input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.screen-toggle input[type="checkbox"]:checked::after,
.shape-toggle input[type="checkbox"]:checked::after,
.interactive-row input[type="checkbox"]:checked::after {
    transform: translateX(12px);
}

.dropdown-content {
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.dropdown-content button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 13px;
}

.shape-control-grid,
.shape-toggle-row {
    gap: 6px;
}

.shape-control-item,
.gauss-blur-controls label,
.interactive-properties label {
    color: var(--text-main);
    font-size: 12px;
    font-weight: 650;
}

.shape-toggle,
.interactive-note,
.sound-file-name {
    color: var(--text-muted);
    font-size: 12px;
}

.toolbar-footer {
    position: fixed;
    top: 7px;
    right: 12px;
    z-index: 910;
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    background: transparent;
}

.toolbar-footer button {
    flex: 0 0 auto;
    width: auto;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    margin: 0;
    padding: 0 9px;
    display: inline-flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    font-size: 12px;
    line-height: 1;
}

.toolbar-footer button:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
}

.toolbar-footer svg {
    width: 15px;
    height: 15px;
    margin: 0;
    fill: currentColor;
}

#save-cloud {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

#save-cloud:hover {
    color: #fff;
    background: #1d4ed8;
}

#instruction-link {
    left: 14px;
    bottom: 14px;
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: none;
    z-index: 240;
}

#instruction-link::after {
    display: none;
}

.layout > .canvas-container {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    padding: 24px 22px 92px;
    background:
        linear-gradient(90deg, rgba(148, 163, 184, 0.22) 1px, transparent 1px),
        linear-gradient(180deg, rgba(148, 163, 184, 0.22) 1px, transparent 1px),
        var(--work-bg);
    background-size: 24px 24px;
}

.canvas-wrapper {
    transition: none;
}

#canvas {
    filter: none;
}

.interactive-panel {
    order: 3;
    position: relative;
    left: auto;
    top: auto;
    width: var(--inspector-width);
    min-width: var(--inspector-width);
    height: calc(100vh - 48px);
    padding: 14px;
    color: var(--text-main);
    background: var(--surface);
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
}

.interactive-panel.open {
    transform: none;
}

.interactive-panel::after {
    display: none;
}

.inspector-empty {
    display: block;
    padding: 2px 2px 12px;
    border-bottom: 1px solid var(--border);
}

.interactive-panel.has-selection .inspector-empty {
    display: none;
}

.inspector-empty h2 {
    margin: 0 0 6px;
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.2;
}

.inspector-empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.interactive-panel .tool-section,
.interactive-panel > #text-properties,
.interactive-panel > #shape-properties,
.interactive-panel > #gauss-blur-controls {
    margin: 0;
    padding: 0 0 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.interactive-panel .tool-section + .tool-section,
.interactive-panel > #shape-properties,
.interactive-panel > #gauss-blur-controls {
    padding-top: 12px;
}

.interactive-panel .interactive-properties > h3,
#text-properties h3,
#shape-properties h3 {
    margin-bottom: 10px;
    color: var(--text-main);
    font-size: 15px;
    text-transform: none;
}

#interactive-role-text {
    color: var(--text-muted);
    font-size: 12px;
}

#interactive-name-text {
    color: var(--text-main);
    font-size: 13px;
}

.interactive-row {
    margin-bottom: 10px;
}

.interactive-properties input,
.interactive-properties select {
    margin-bottom: 0;
}

.visibility-condition-settings {
    gap: 6px;
}

#text-properties .font-controls {
    grid-template-columns: minmax(0, 1fr) 52px 42px;
    gap: 6px;
}

#text-properties .font-controls .color-picker,
#text-properties #stroke-color {
    width: 42px !important;
    height: 32px;
    min-height: 32px;
}

#text-properties .text-controls {
    gap: 6px;
}

#text-properties .text-controls button {
    height: 32px;
    min-height: 32px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
}

#text-properties .text-controls button:hover,
#text-properties .text-controls button.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
}

#text-properties .text-stroke-controls {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 6px;
}

.collapsible-section summary {
    min-height: 34px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    border-bottom: 0;
}

.interactive-section-title,
.interactive-section-title.sounds,
.interactive-section-title.animations {
    color: var(--text-main);
    font-size: 13px;
    text-transform: none;
}

.icon-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    border-radius: var(--control-radius);
}

.icon-button.remove,
.icon-button.remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.screen-rail {
    left: 16px;
    right: 16px;
    bottom: 16px;
    min-height: 54px;
    padding: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
}

.layout:has(.layers-panel:not(.collapsed)) .screen-rail {
    right: 16px;
}

.screen-rail-actions {
    gap: 6px;
}

.screen-rail-actions button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: none;
}

.screen-rail-actions button:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
    box-shadow: none;
}

.screen-rail-actions .danger-action,
.screen-rail-actions .danger-action:hover {
    color: var(--danger);
    background: var(--danger-soft) !important;
    border-color: #fecaca;
}

.screen-strip {
    gap: 8px;
    padding: 0;
}

.screen-item {
    width: 142px;
    min-width: 142px;
    min-height: 42px;
    padding: 6px 9px;
    grid-template-columns: 22px 1fr;
    gap: 7px;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: none;
}

.screen-item:hover,
.screen-item.active {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.screen-number {
    width: 22px;
    height: 22px;
    color: var(--text-main);
    background: var(--surface-subtle);
    box-shadow: inset 0 0 0 1px var(--border);
    font-size: 11px;
}

.screen-item.active .screen-number {
    color: #fff;
    background: var(--accent);
}

.screen-name {
    font-size: 12px;
    font-weight: 650;
}

.layers-panel {
    right: var(--inspector-width);
    top: 56px;
    width: 260px;
    height: calc(100vh - 72px);
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px 0 0 8px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
    z-index: 620;
}

.layers-panel.collapsed {
    transform: translateX(calc(100% + 1px));
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    pointer-events: none;
}

.layers-panel.collapsed .layers-panel-inner {
    visibility: hidden;
}

.layers-panel-inner {
    padding: 12px;
}

.layers-panel h3 {
    margin: 0 0 10px;
    padding: 0;
    color: var(--text-main);
    font-size: 14px;
    text-transform: none;
}

.layers-toggle {
    left: -28px;
    width: 28px;
    height: 56px;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: 7px 0 0 7px;
    box-shadow: none;
}

.layers-panel.collapsed .layers-toggle {
    pointer-events: auto;
}

.layers-toggle svg {
    fill: currentColor;
}

.layer-item {
    min-height: 34px;
    margin: 0 0 6px;
    padding: 0 9px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: none;
}

.layer-item:hover,
.layer-item.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
    box-shadow: none;
}

.screen-setup-overlay,
.clipart-picker-overlay,
.unsaved-exit-overlay {
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: none;
}

.screen-setup-dialog,
.clipart-picker,
#instruction-popup,
.unsaved-exit-dialog {
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 54px rgba(15, 23, 42, 0.22);
}

.screen-template-card,
.clipart-tile {
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: none;
}

.screen-template-card:hover,
.screen-template-card:focus,
.clipart-tile:hover,
.clipart-tile.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.screen-template-tab,
.clipart-filter {
    color: var(--text-main);
    font-size: 14px;
}

.screen-template-tab.active,
.clipart-filter.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.screen-setup-footer,
.clipart-picker-footer {
    border-top: 1px solid var(--border);
}

.screen-setup-cancel,
.clipart-cancel,
.unsaved-exit-confirm {
    background: var(--danger);
    border-color: var(--danger);
}

.screen-setup-cancel:hover,
.clipart-cancel:hover,
.unsaved-exit-confirm:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.screen-setup-save,
.clipart-use {
    background: var(--ok);
    border-color: var(--ok);
}

.screen-setup-save:hover,
.clipart-use:hover {
    background: #15803d;
    border-color: #15803d;
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 228px;
        --inspector-width: 292px;
    }

    .toolbar-footer button {
        font-size: 0;
        padding: 0 8px;
    }

    .toolbar-footer svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 900px) {
    .layout {
        min-width: 900px;
    }
}

/* Compact command-bar editor shell. */
:root {
    --topbar-height: 56px;
    --topbar-gap: 6px;
}

.layout {
    height: 100vh;
    padding-top: var(--topbar-height);
    display: flex;
    overflow: hidden;
}

.layout::before {
    height: var(--topbar-height);
    z-index: 980;
}

.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    order: 0;
    width: auto;
    min-width: 0;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    margin: 0;
    padding: 0 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--topbar-gap);
    overflow: visible;
    color: var(--text-main);
    background: var(--surface);
    border: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}

.editor-header {
    position: static;
    z-index: auto;
    flex: 0 0 auto;
    width: auto;
    height: var(--topbar-height);
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
}

.editor-header h1 {
    margin: 0;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
}

.editor-save-status {
    padding-right: 10px;
    border-right: 1px solid var(--border);
}

.toolbar > .tool-section,
.toolbar details.tool-section {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 0;
    background: transparent;
}

.toolbar > .tool-section > h3,
.top-interactive-section .interactive-note {
    display: none;
}

.top-grid-section {
    position: relative;
}

.top-grid-section .screen-toggle,
.top-tools-section > button,
.top-tools-section .dropdown > button,
.top-interactive-section > summary,
.dock-mode-button,
.save-menu-toggle {
    width: auto;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    margin: 0;
    padding: 0 10px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    box-shadow: none;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
}

.top-grid-section .screen-toggle:hover,
.top-tools-section > button:hover,
.top-tools-section .dropdown > button:hover,
.top-interactive-section > summary:hover,
.dock-mode-button:hover,
.dock-mode-button.active,
.save-menu[open] .save-menu-toggle,
.save-menu-toggle:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
}

.top-grid-section .screen-toggle::before,
.top-tools-section > button::before,
.top-tools-section .dropdown > button::before,
.top-interactive-section > summary::before {
    content: "";
    position: static;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    display: block;
    background: currentColor;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 16px 16px;
    mask-size: 16px 16px;
}

.top-grid-section .screen-toggle::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 0h8v8h-8v-8z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 0h8v8h-8v-8z'/%3E%3C/svg%3E");
}

#add-image::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16v14H4V5zm2 2v8.2l3.2-3.2 2.5 2.5 3.7-4.7L18 13.4V7H6zm0 10h12l-2.7-3.5-3.4 4.3-2.7-2.7L6 17z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16v14H4V5zm2 2v8.2l3.2-3.2 2.5 2.5 3.7-4.7L18 13.4V7H6zm0 10h12l-2.7-3.5-3.4 4.3-2.7-2.7L6 17z'/%3E%3C/svg%3E");
}

.top-tools-section .dropdown:first-of-type > button::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4h9v9H5V4zm10.5 7a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 4h9v9H5V4zm10.5 7a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9z'/%3E%3C/svg%3E");
}

#text-dropdown > button::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16v4h-2l-.4-2H13v14h2v2H9v-2h2V6H6.4L6 8H4V4z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16v4h-2l-.4-2H13v14h2v2H9v-2h2V6H6.4L6 8H4V4z'/%3E%3C/svg%3E");
}

.top-interactive-section > summary::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16v4H4V5zm0 6h7v8H4v-8zm9 0h7v8h-7v-8z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16v4H4V5zm0 6h7v8H4v-8zm9 0h7v8h-7v-8z'/%3E%3C/svg%3E");
}

.top-grid-section .screen-toggle input[type="checkbox"] {
    width: 28px;
    min-width: 28px;
    height: 16px;
    min-height: 16px;
    margin: 0;
}

.top-grid-section .screen-toggle input[type="checkbox"]::after {
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
}

.top-grid-section .screen-toggle input[type="checkbox"]:checked::after {
    transform: translateX(12px);
}

#grid-settings {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1120;
    width: 250px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

#grid-settings .screen-toggle {
    height: auto;
    min-height: 28px;
    padding: 4px 0;
    justify-content: flex-start;
    border: 0;
    background: transparent;
}

#grid-settings .screen-toggle::before {
    display: none;
}

.top-tools-section .dropdown,
.top-interactive-section,
.save-menu {
    position: relative;
}

.top-tools-section .dropdown-content,
.top-interactive-section .collapsible-section-body,
.save-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    z-index: 1120;
    min-width: 210px;
    padding: 8px;
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

.top-tools-section .dropdown-content {
    left: 0;
}

.top-tools-section .dropdown.show .dropdown-content,
.top-interactive-section[open] .collapsible-section-body,
.save-menu[open] .save-menu-panel {
    display: grid;
    gap: 4px;
}

.top-interactive-section .collapsible-section-body {
    left: 0;
    width: 244px;
}

.top-interactive-section > summary {
    list-style: none;
    cursor: pointer;
}

.top-interactive-section > summary::-webkit-details-marker,
.save-menu > summary::-webkit-details-marker {
    display: none;
}

.top-interactive-section .interactive-section-title {
    margin: 0;
    color: inherit;
    font-size: 13px;
    text-transform: none;
}

.top-interactive-section .section-chevron {
    width: 14px;
    height: 14px;
}

.top-interactive-section .interactive-controls {
    display: grid;
    gap: 4px;
}

.top-tools-section .dropdown-content button,
.top-interactive-section .interactive-controls button,
.save-menu-panel button {
    width: 100%;
    min-height: 34px;
    margin: 0;
    padding: 0 10px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid transparent;
    box-shadow: none;
    font-size: 13px;
    text-align: left;
}

.top-tools-section .dropdown-content button:hover,
.top-interactive-section .interactive-controls button:hover,
.save-menu-panel button:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
}

.toolbar-footer.save-menu {
    position: relative;
    top: auto;
    right: auto;
    z-index: auto;
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    padding: 0;
    display: block;
    overflow: visible;
}

.save-menu-toggle {
    cursor: pointer;
}

.save-menu-toggle svg,
.dock-mode-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: currentColor;
}

.save-menu-panel {
    right: 0;
    width: 220px;
}

.save-menu-panel button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.editor-dock-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.layout > .canvas-container {
    order: 1;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: calc(100vh - var(--topbar-height));
    padding: 24px 22px 92px;
}

.interactive-panel {
    order: 2;
    flex: 0 0 var(--inspector-width);
    width: var(--inspector-width);
    min-width: var(--inspector-width);
    height: calc(100vh - var(--topbar-height));
    position: relative;
    top: auto;
    right: auto;
    left: auto;
}

.layers-panel {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: var(--inspector-width);
    height: calc(100vh - var(--topbar-height));
    color: var(--text-main);
    background: var(--surface);
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    transform: none;
    opacity: 1;
    visibility: visible;
    z-index: 720;
}

.layers-panel.collapsed {
    transform: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: var(--surface);
    border-color: var(--border);
}

.layers-panel.collapsed .layers-panel-inner {
    visibility: visible;
}

.layers-toggle {
    display: none;
}

.layers-panel-inner {
    height: 100%;
    padding: 14px;
    overflow-y: auto;
}

.layers-panel h3 {
    margin: 0 0 10px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    text-transform: none;
}

body.right-dock-layers .interactive-panel {
    pointer-events: none;
}

body.right-dock-layers .interactive-panel > * {
    visibility: hidden;
}

body:not(.right-dock-layers) .interactive-panel > * {
    visibility: visible;
}

@media (max-width: 1100px) {
    :root {
        --inspector-width: 286px;
    }

    .editor-header h1 {
        display: none;
    }

    .top-grid-section .screen-toggle span,
    .dock-mode-button span,
    .save-menu-toggle span {
        display: none;
    }
}

.toolbar > .top-tools-section,
.toolbar > .top-interactive-section,
.toolbar > .top-grid-section {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
}

.toolbar > .top-tools-section .dropdown {
    width: auto;
    min-width: max-content;
    display: inline-flex;
    flex: 0 0 auto;
}

.toolbar > .top-grid-section .screen-toggle,
.toolbar > .top-tools-section > button,
.toolbar > .top-tools-section .dropdown > button,
.toolbar > .top-interactive-section > summary,
.toolbar .dock-mode-button,
.toolbar .save-menu-toggle {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    max-width: none;
    padding: 0 10px;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.toolbar > .top-interactive-section > summary h3,
.toolbar > .top-interactive-section > summary .interactive-section-title {
    margin: 0;
    color: inherit;
    font-size: 13px;
    line-height: 1;
    text-transform: none;
}

.toolbar > .top-tools-section > button::before,
.toolbar > .top-tools-section .dropdown > button::before,
.toolbar > .top-interactive-section > summary::before,
.toolbar > .top-grid-section .screen-toggle::before {
    left: auto;
    top: auto;
    position: static;
    transform: none;
}

/* Topbar grouping, vertical screens, and calmer typography. */
:root {
    --screen-nav-width: 176px;
}

.editor-header {
    display: contents;
}

.editor-back-button {
    order: 1;
}

.editor-header h1 {
    order: 2;
}

.editor-save-status {
    order: 3;
}

.top-tools-section {
    order: 4;
}

.top-interactive-section {
    order: 5;
}

.editor-dock-tabs {
    order: 20;
    margin-left: auto;
}

.top-grid-section {
    order: 21;
}

.toolbar-footer.save-menu {
    order: 22;
    margin-left: 0;
}

.layout > .canvas-container {
    margin-left: var(--screen-nav-width);
}

.screen-rail {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 640;
    width: var(--screen-nav-width);
    height: calc(100vh - var(--topbar-height));
    min-height: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-main);
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: none;
    pointer-events: auto;
}

.screen-strip {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    pointer-events: auto;
}

.screen-item {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 7px 8px;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
}

.screen-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-rail-actions {
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    pointer-events: auto;
}

.screen-rail-actions button {
    width: 100%;
    min-width: 0;
    height: 34px;
    min-height: 34px;
}

#instruction-link {
    display: none !important;
}

.top-interactive-section .interactive-controls button {
    padding: 0 10px;
    gap: 8px;
    overflow: visible;
}

.top-interactive-section .interactive-controls button::before {
    position: static;
    left: auto;
    top: auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    flex: 0 0 14px;
    transform: none;
    margin: 0;
}

body,
button,
input,
select,
textarea,
.toolbar,
.toolbar h1,
.editor-save-status,
.dock-mode-button,
.save-menu-toggle,
.interactive-panel,
.layers-panel,
.screen-rail,
.screen-item,
.layer-item,
.interactive-properties label,
.shape-control-item,
.screen-template-tab,
.clipart-filter {
    font-weight: 400;
}

.toolbar > .top-interactive-section > summary h3,
.toolbar > .top-interactive-section > summary .interactive-section-title,
.interactive-panel h3,
.layers-panel h3,
.inspector-empty h2,
.tool-section h3,
.screen-number,
.screen-item.active .screen-name,
.layer-item.active,
.save-menu-panel button {
    font-weight: 500;
}

.interactive-readonly-box,
#interactive-name-text,
#interactive-role-text,
.layer-name,
.screen-name {
    font-weight: 400;
}

@media (max-width: 1180px) {
    :root {
        --screen-nav-width: 156px;
    }

    .editor-save-status {
        display: none;
    }

    .top-grid-section .screen-toggle span,
    .dock-mode-button span {
        display: none;
    }
}

.toolbar > .top-grid-section .screen-toggle,
.toolbar > .top-tools-section > button,
.toolbar > .top-tools-section .dropdown > button,
.toolbar > .top-interactive-section > summary,
.toolbar > .top-interactive-section > summary h3,
.toolbar > .top-interactive-section > summary .interactive-section-title,
.toolbar .dock-mode-button,
.toolbar .save-menu-toggle,
.save-menu-panel button,
.top-tools-section .dropdown-content button,
.top-interactive-section .interactive-controls button,
.screen-number,
.screen-item,
.screen-item.active .screen-name,
.layer-name,
.layer-item,
.interactive-readonly-box {
    font-weight: 400;
}

.editor-save-status.dirty {
    color: var(--text-muted);
    opacity: 0;
}

.editor-save-status.saved-flash {
    opacity: 1;
}

.save-menu-panel .legacy-save-option {
    display: none !important;
}

#save-cloud.save-primary {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

#save-cloud.save-primary:hover {
    color: #fff;
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.save-menu.needs-save .save-menu-toggle,
.save-menu.needs-save[open] .save-menu-toggle,
body.has-unsaved-project-changes .toolbar .save-menu-toggle {
    color: #fff;
    background: var(--ok);
    border-color: var(--ok);
}

.save-menu.needs-save .save-menu-toggle:hover,
body.has-unsaved-project-changes .toolbar .save-menu-toggle:hover {
    color: #fff;
    background: #15803d;
    border-color: #15803d;
}

.interactive-section-title.statistics {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.collapsible-section-body > .interactive-row:last-child {
    margin-bottom: 0;
}
.creator-session-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    margin-left: 0;
    padding: 5px 11px;
    border: 1px solid var(--border, #dbe3f3);
    border-radius: 7px;
    color: var(--accent, #2563eb);
    background: var(--surface, #fff);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.creator-session-link:hover,
.creator-session-link:focus-visible {
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
    background: var(--accent-soft, #eef4ff);
}

/* Bottom-centered editor tools and screen-scoped layers. */
:root {
    --screen-nav-width: 232px;
    --bottom-tools-height: 56px;
    --bottom-tools-bg: #20242c;
    --bottom-tools-hover: #323844;
}

.toolbar {
    overflow: visible;
}

.editor-header h1,
.editor-dock-tabs {
    display: none !important;
}

.toolbar-footer.save-menu {
    order: 50;
    margin-left: auto;
}

.editor-bottom-controls {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1250;
    width: max-content;
    height: var(--bottom-tools-height);
    transform: translateX(-50%);
    pointer-events: none;
}

.bottom-tools-panel {
    position: relative;
    height: var(--bottom-tools-height);
    padding: 0 6px;
    display: flex;
    align-items: stretch;
    gap: 0;
    color: #f8fafc;
    background: var(--bottom-tools-bg);
    border: 0;
    border-radius: 11px 11px 0 0;
    box-shadow: none;
    pointer-events: auto;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.bottom-tools-panel *,
.bottom-tools-panel .tool-group-trigger,
.bottom-tools-panel .tool-group-trigger * {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none;
}

.tool-icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.bottom-tools-panel .top-tools-section {
    position: static;
    width: auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    gap: 0;
    color: inherit;
    background: transparent;
    border: 0;
}

.bottom-tools-panel .top-tools-section > h3 {
    display: none;
}

.bottom-tools-panel .dropdown,
.bottom-tools-panel .top-interactive-section {
    position: relative;
    width: auto;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    display: block;
    color: inherit;
    background: transparent;
    border: 0;
}

.bottom-tools-panel .bottom-tool-button,
.bottom-tools-panel .top-tools-section > .bottom-tool-button,
.bottom-tools-panel .top-tools-section .dropdown > .bottom-tool-button,
.bottom-tools-panel .top-interactive-section > .bottom-tool-button {
    position: relative;
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    height: var(--bottom-tools-height);
    min-height: var(--bottom-tools-height);
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e5e7eb;
    background: transparent;
    border: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: none;
    cursor: pointer;
    list-style: none;
}

.bottom-tools-panel .bottom-tool-button::before,
.bottom-tools-panel .top-interactive-section > summary::before {
    display: none !important;
    content: none !important;
}

.bottom-tools-panel .bottom-tool-button::-webkit-details-marker {
    display: none;
}

.bottom-tools-panel .bottom-tool-button:hover,
.bottom-tools-panel .dropdown.show > .bottom-tool-button,
.bottom-tools-panel .top-interactive-section[open] > .bottom-tool-button {
    color: #fff;
    background: var(--bottom-tools-hover);
    border: 0;
}

.bottom-tools-panel .bottom-tool-button.active-tool {
    color: #fff !important;
    background: var(--accent) !important;
}

.bottom-tools-panel .bottom-tool-button > svg:not(.tool-chevron) {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    fill: currentColor;
}

.bottom-tools-panel .tool-chevron,
.bottom-tools-panel .top-interactive-section .tool-chevron {
    position: absolute;
    right: 4px;
    bottom: 5px;
    width: 10px;
    height: 10px;
    fill: currentColor;
    opacity: .72;
    transform: none;
}

.bottom-tools-panel .tool-trigger-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bottom-tools-panel .top-tools-section .dropdown-content,
.bottom-tools-panel .top-interactive-section .collapsible-section-body {
    position: absolute;
    top: auto;
    right: auto;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 1300;
    min-width: 224px;
    width: max-content;
    max-width: 310px;
    margin: 0;
    padding: 7px;
    display: none;
    color: var(--text-main);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .18);
    transform: translateX(-50%);
}

.bottom-tools-panel .top-tools-section .dropdown.show .dropdown-content,
.bottom-tools-panel .top-interactive-section[open] .collapsible-section-body {
    display: grid;
    gap: 3px;
}

.bottom-tools-panel .top-interactive-section .interactive-controls {
    display: grid;
    gap: 3px;
}

.bottom-tools-panel .top-tools-section .dropdown-content button,
.bottom-tools-panel .top-interactive-section .interactive-controls button {
    width: 100%;
    min-width: 208px;
    min-height: 40px;
    margin: 0;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    color: var(--text-main);
    background: #fff;
    border: 0;
    border-radius: 7px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.25;
    text-align: left;
    white-space: nowrap;
}

.bottom-tools-panel .top-tools-section .dropdown-content button::before,
.bottom-tools-panel .top-interactive-section .interactive-controls button::before {
    display: none !important;
    content: none !important;
}

.bottom-tools-panel .top-tools-section .dropdown-content button svg,
.bottom-tools-panel .top-interactive-section .interactive-controls button svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: currentColor;
}

.bottom-tools-panel .top-tools-section .dropdown-content button:hover,
.bottom-tools-panel .top-interactive-section .interactive-controls button:hover,
.bottom-tools-panel [data-tool-icon].active-tool-choice {
    color: var(--accent);
    background: var(--accent-soft);
    border: 0;
}

.editor-bottom-controls .top-grid-section {
    position: absolute;
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(100% + 10px);
    width: max-content;
    min-width: 52px;
    height: var(--bottom-tools-height);
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0;
    color: #e5e7eb;
    background: var(--bottom-tools-bg);
    border: 0;
    border-radius: 11px 11px 0 0;
    box-shadow: none;
    pointer-events: auto;
}

.grid-toggle-button,
.grid-snap-button {
    position: relative;
    width: 52px;
    min-width: 52px;
    height: var(--bottom-tools-height);
    min-height: var(--bottom-tools-height);
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e5e7eb;
    background: transparent;
    border: 0;
    border-radius: 9px 9px 0 0;
    cursor: pointer;
}

.grid-toggle-button:hover,
.grid-snap-button:hover {
    color: #fff;
    background: var(--bottom-tools-hover);
}

.grid-toggle-button:has(input:checked),
.grid-snap-button:has(input:checked) {
    color: #fff;
    background: var(--accent);
}

.grid-toggle-button input,
.grid-snap-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.grid-toggle-button svg,
.grid-snap-button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.editor-bottom-controls #grid-settings {
    position: static;
    top: auto;
    left: auto;
    z-index: auto;
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0 5px 0 2px;
    align-items: center;
    gap: 4px;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.grid-size-control {
    height: 34px;
    min-width: 76px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #64748b;
    background: #fff;
    border: 0;
    border-radius: 7px;
    font-size: 12px;
}

.grid-size-control input {
    width: 46px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    color: #172033;
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: 0;
    font: inherit;
    font-size: 13px;
    text-align: right;
}

.grid-size-control input::-webkit-inner-spin-button,
.grid-size-control input::-webkit-outer-spin-button {
    margin: 0;
}

.editor-bottom-controls #grid-settings .grid-snap-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    border-radius: 7px;
}

.editor-bottom-controls #grid-settings .grid-snap-button svg {
    width: 19px;
    height: 19px;
}

.layout > .canvas-container {
    margin-left: var(--screen-nav-width);
    padding-bottom: calc(var(--bottom-tools-height) + 34px);
}

.screen-rail {
    width: var(--screen-nav-width);
    padding: 10px;
    gap: 10px;
}

.screen-strip {
    order: 1;
    flex: 0 1 auto;
    max-height: 38%;
    min-height: 46px;
    overflow-x: hidden;
    overflow-y: auto;
}

.screen-rail .layers-panel,
.screen-rail .layers-panel.collapsed {
    position: static;
    order: 2;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 112px;
    margin: 0;
    padding: 0;
    color: var(--text-main);
    background: var(--surface);
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}

.screen-rail .layers-panel-inner,
.screen-rail .layers-panel.collapsed .layers-panel-inner {
    width: 100%;
    height: 100%;
    padding: 10px 0 0;
    display: flex;
    flex-direction: column;
    visibility: visible;
    overflow: hidden;
}

.screen-rail .layers-panel h3 {
    flex: 0 0 auto;
    margin: 0 0 7px;
    padding: 0 2px 8px;
    color: var(--text-muted);
    border-bottom: 0;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .02em;
    text-transform: none;
}

.screen-rail #layers-list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.screen-rail-actions {
    order: 3;
}

.layers-toggle {
    display: none !important;
}

body.right-dock-layers .interactive-panel {
    pointer-events: auto;
}

body.right-dock-layers .interactive-panel > * {
    visibility: visible;
}

@media (max-width: 1180px) {
    :root {
        --screen-nav-width: 208px;
    }

    .bottom-tools-panel .bottom-tool-button,
    .bottom-tools-panel .top-tools-section > .bottom-tool-button,
    .bottom-tools-panel .top-tools-section .dropdown > .bottom-tool-button,
    .bottom-tools-panel .top-interactive-section > .bottom-tool-button,
    .grid-toggle-button {
        width: 48px;
        min-width: 48px;
        max-width: 48px;
    }
}

/* Compact bottom notch, accordion layers, and a chrome-free editor shell. */
:root {
    --topbar-height: 0px;
    --bottom-tools-height: 42px;
}

.layout {
    height: 100vh;
    padding-top: 0;
}

.layout::before {
    display: none;
}

.toolbar {
    position: static;
    width: 0;
    min-width: 0;
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    display: contents;
    overflow: visible;
    background: transparent;
    border: 0;
}

.layout > .canvas-container,
.interactive-panel,
.screen-rail {
    top: 0;
    height: 100vh;
}

.interactive-panel {
    padding-bottom: 68px;
}

.screen-rail {
    bottom: 0;
}

.screen-rail-nav {
    order: 0;
    flex: 0 0 auto;
    width: 100%;
    min-height: 38px;
    padding: 1px 2px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.screen-rail-nav .editor-back-button {
    position: static;
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    color: var(--text-main);
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
}

.screen-rail-nav .editor-back-button:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.screen-rail-nav .editor-back-button svg {
    width: 18px;
    height: 18px;
}

.screen-rail-nav .creator-session-link {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 34px;
    margin: 0;
    padding: 7px 8px;
    justify-content: flex-start;
    color: var(--text-main);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}

.screen-rail-nav .creator-session-link:hover,
.screen-rail-nav .creator-session-link:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    border: 0;
}

.screen-strip {
    order: 1;
    flex: 1 1 auto;
    width: 100%;
    max-height: none;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-x: hidden;
    overflow-y: auto;
}

.screen-accordion-item {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.screen-accordion-item > .screen-item {
    width: 100%;
    margin: 0;
}

.screen-accordion-item.screen-item-ghost {
    opacity: .45;
}

.screen-accordion-item.screen-item-chosen {
    cursor: grabbing;
}

.screen-accordion-item .layers-panel,
.screen-accordion-item .layers-panel.collapsed {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 2px 0 1px;
    padding: 0;
    color: var(--text-main);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}

.screen-accordion-item .layers-panel-inner,
.screen-accordion-item .layers-panel.collapsed .layers-panel-inner {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 2px 3px 2px 20px;
    display: block;
    overflow: visible;
    visibility: visible;
}

.screen-accordion-item .layers-panel h3 {
    display: none;
}

.screen-accordion-item #layers-list {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
}

.screen-accordion-item .layer-item {
    width: 100%;
    min-height: 28px;
    margin: 0;
    padding: 4px 6px;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) 44px;
    align-items: center;
    column-gap: 7px;
    color: var(--text-main);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.25;
}

.screen-accordion-item .layer-item:hover {
    color: var(--text-main);
    background: rgba(37, 99, 235, .05);
    border: 0;
    box-shadow: none;
}

.screen-accordion-item .layer-item.active {
    color: var(--accent);
    background: rgba(37, 99, 235, .10);
    border: 0;
    box-shadow: none;
    font-weight: 400;
}

.layer-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.layer-action {
    width: 24px;
    min-width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 5px;
    box-shadow: none;
    cursor: pointer;
}

.layer-action::before {
    display: none !important;
    content: none !important;
}

.layer-action:hover,
.layer-action:focus-visible {
    color: var(--accent);
    background: rgba(37, 99, 235, .10);
    outline: none;
}

.layer-action svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.layer-item.is-hidden .layer-label,
.layer-item.is-hidden .layer-icon {
    opacity: .42;
}

.layer-item.is-hidden .layer-visibility,
.layer-item.is-locked .layer-lock {
    color: var(--accent);
    background: rgba(37, 99, 235, .10);
}

.layer-item.is-locked {
    cursor: default;
}

.screen-accordion-item .layer-actions {
    width: 44px;
    margin-left: 0;
    justify-self: end;
    justify-content: flex-end;
    gap: 0;
}

.screen-accordion-item .layer-action {
    width: 22px;
    min-width: 22px;
    height: 22px;
}

.screen-accordion-item .layer-item .layer-icon {
    flex: 0 0 14px;
    width: 14px;
    min-width: 14px;
    max-width: 14px;
    height: 14px;
    min-height: 14px;
    max-height: 14px;
    margin: 0;
    border-radius: 4px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
}

.screen-accordion-item .layer-item .layer-icon-image,
.screen-accordion-item .layer-item .layer-icon-shape,
.screen-accordion-item .layer-item .layer-icon-interactive,
.screen-accordion-item .layer-item .layer-icon-generic {
    box-shadow: none;
}

.screen-accordion-item .layer-item .layer-icon-text {
    font-size: 13px;
    font-weight: 500;
}

.screen-accordion-item .layer-label,
.screen-accordion-item .layer-name {
    min-width: 0;
    color: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.25;
}

.rotation-angle-badge {
    position: fixed;
    z-index: 10020;
    min-width: 48px;
    padding: 5px 8px;
    color: #fff;
    background: rgba(15, 23, 42, .92);
    border-radius: 6px;
    font: 600 12px/1.2 Arial, sans-serif;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease;
}

.rotation-angle-badge.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.screen-setup-overlay.initial-setup .screen-setup-close,
.screen-setup-overlay.initial-setup .screen-setup-cancel {
    display: none !important;
}

.screen-setup-overlay.initial-setup .screen-setup-footer {
    grid-template-columns: minmax(220px, 320px);
    justify-content: center;
}

.screen-item {
    grid-template-columns: 24px minmax(0, 1fr) 24px;
}

.screen-layers-toggle {
    width: 24px;
    min-width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 5px;
    box-shadow: none;
    cursor: pointer;
}

.screen-layers-toggle[hidden] {
    display: none !important;
}

.screen-layers-toggle:hover,
.screen-layers-toggle:focus-visible {
    color: var(--accent);
    background: rgba(37, 99, 235, .10);
    outline: none;
}

.screen-layers-toggle svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.screen-accordion-item.layers-collapsed > .layers-panel {
    display: none !important;
}

.multi-align-controls {
    margin: 16px 0 2px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.multi-align-title {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.multi-align-buttons {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
}

.multi-align-buttons button {
    width: 100%;
    min-width: 0;
    height: 32px;
    margin: 0;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: none;
}

.multi-align-buttons button:hover,
.multi-align-buttons button:focus-visible {
    color: var(--accent);
    background: rgba(37, 99, 235, .08);
    border-color: rgba(37, 99, 235, .35);
    outline: none;
}

.multi-align-buttons button:disabled {
    color: #94a3b8;
    background: var(--surface-subtle);
    border-color: var(--border);
    opacity: .38;
    cursor: not-allowed;
}

.multi-align-buttons svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.upper-canvas.center-shape-tool-active {
    cursor: crosshair !important;
}

.screen-rail-actions {
    order: 2;
}

.creator-mode-graphics .screen-strip {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    gap: 0;
}

.creator-mode-graphics .graphics-layer-stack {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.creator-mode-graphics .graphics-layer-stack .layers-panel,
.creator-mode-graphics .graphics-layer-stack .layers-panel.collapsed {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    margin: 0;
}

.creator-mode-graphics .graphics-layer-stack .layers-panel-inner,
.creator-mode-graphics .graphics-layer-stack .layers-panel.collapsed .layers-panel-inner {
    height: 100%;
    min-height: 0;
    padding: 4px 0 0;
    overflow: hidden;
}

.creator-mode-graphics .graphics-layer-stack #layers-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.creator-mode-graphics .screen-rail-actions {
    width: auto;
    margin: auto auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.creator-mode-graphics .screen-rail-actions button {
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 7px;
}

.creator-mode-graphics .screen-rail-actions button:disabled {
    color: #aab4c3;
    background: #f4f6f8;
    border-color: #e2e7ee;
    opacity: .62;
    cursor: default;
}

.creator-mode-graphics .base-layer-item {
    cursor: default;
}

.creator-mode-graphics .layer-icon-base {
    background: #fff;
    border: 1px solid #d9e0e8;
}

.bottom-tools-panel {
    height: var(--bottom-tools-height);
    padding: 0 3px;
    border-radius: 17px 17px 0 0;
}

.bottom-tools-panel .dropdown,
.bottom-tools-panel .top-interactive-section,
.bottom-tools-panel .top-tools-section {
    height: var(--bottom-tools-height);
}

.bottom-tools-panel .bottom-tool-button,
.bottom-tools-panel .top-tools-section > .bottom-tool-button,
.bottom-tools-panel .top-tools-section .dropdown > .bottom-tool-button,
.bottom-tools-panel .top-interactive-section > .bottom-tool-button {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: var(--bottom-tools-height);
    min-height: var(--bottom-tools-height);
    padding: 0;
    border-radius: 14px 14px 0 0;
}

.bottom-tools-panel .bottom-tool-button > svg:not(.tool-chevron) {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
}

.bottom-tools-panel .tool-chevron,
.bottom-tools-panel .top-interactive-section .tool-chevron {
    right: 3px;
    bottom: 3px;
    width: 8px;
    height: 8px;
}

.editor-bottom-controls .top-grid-section {
    left: calc(100% + 7px);
    min-width: 36px;
    height: var(--bottom-tools-height);
    color: #475569;
    background: transparent;
    border-radius: 0;
}

.grid-toggle-button {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: var(--bottom-tools-height);
    min-height: var(--bottom-tools-height);
    color: #475569;
    background: transparent;
    border-radius: 9px 9px 0 0;
}

.grid-toggle-button:hover,
.grid-toggle-button:has(input:checked) {
    color: var(--accent);
    background: transparent;
}

.grid-toggle-button svg {
    width: 20px;
    height: 20px;
}

.editor-bottom-controls #grid-settings {
    height: var(--bottom-tools-height);
    padding: 0 0 0 3px;
    gap: 2px;
    background: transparent;
}

.grid-size-control {
    height: 32px;
    min-width: 72px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
}

.editor-bottom-controls #grid-settings .grid-snap-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    color: #475569;
    background: transparent;
}

.editor-bottom-controls #grid-settings .grid-snap-button:hover,
.editor-bottom-controls #grid-settings .grid-snap-button:has(input:checked) {
    color: var(--accent);
    background: transparent;
}

.interactive-panel .toolbar-footer.save-menu {
    position: fixed;
    right: 12px;
    bottom: 10px;
    z-index: 1260;
    width: auto;
    margin: 0;
    padding: 0;
}

.interactive-panel .save-menu-panel {
    top: auto;
    right: 0;
    bottom: calc(100% + 8px);
}

.interactive-panel .save-menu-toggle {
    min-height: 38px;
}

/* Screen properties live in the inspector whenever no canvas object is selected. */
.screen-inspector-properties {
    display: none;
    margin: 0;
    padding: 0 0 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

.interactive-panel.screen-properties-visible .inspector-empty {
    display: none;
}

.screen-inspector-properties h3 {
    margin: 0 0 14px;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    text-transform: none;
}

.screen-inspector-field,
.screen-inspector-dimensions {
    margin-bottom: 12px;
}

.screen-inspector-field label,
.screen-inspector-dimensions label {
    display: grid;
    gap: 6px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 400;
}

.screen-inspector-properties input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.screen-inspector-dimensions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
    align-items: end;
    gap: 6px;
}

.screen-inspector-size-separator {
    align-self: end;
    padding-bottom: 7px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

.screen-inspector-presets {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 34px;
    margin: 0 0 14px;
}

.screen-inspector-preset-button,
.screen-setup-form .canvas-preset-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
}

.screen-inspector-preset-button:hover,
.screen-inspector-preset-button.active,
.screen-setup-form .canvas-preset-button:hover {
    color: var(--accent);
    background: transparent !important;
}

.screen-inspector-apply {
    width: 100%;
    min-height: 36px;
    margin: 2px 0 0;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: var(--control-radius);
    font-size: 13px;
    font-weight: 500;
}

.screen-inspector-apply:hover {
    background: #1d4ed8;
}

.screen-changes-warning {
    position: fixed;
    inset: 0;
    z-index: 4200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, .24);
}

.screen-changes-warning.open {
    display: flex;
}

.screen-changes-warning-dialog {
    width: min(390px, calc(100vw - 40px));
    padding: 22px;
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}

.screen-changes-warning-dialog h2 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 500;
}

.screen-changes-warning-dialog p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.screen-changes-warning-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.screen-changes-warning-actions button {
    min-height: 36px;
    margin: 0;
    padding: 0 16px;
    border-radius: var(--control-radius);
    font-size: 13px;
}

#reset-screen-changes {
    color: var(--text-main);
    background: var(--surface);
    border: 1px solid var(--border);
}

#confirm-screen-changes {
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
}

/* Exact end-to-end sliders: generic form padding must never affect range inputs. */
input[type="range"],
#interactive-panel input[type="range"],
.interactive-properties input[type="range"] {
    width: 100%;
    min-height: 18px;
    height: 18px;
    margin: 4px 0 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
}

input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border: 0;
    border-radius: 50%;
    background: var(--accent, #2563eb);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-moz-range-track {
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: #cbd5e1;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: var(--accent, #2563eb);
}

.drawing-properties {
    display: grid;
    gap: 8px;
}

.drawing-properties h3 {
    margin: 0 0 4px;
}

.drawing-properties .image-property-field {
    display: grid;
    gap: 6px;
}

.marquee-properties {
    display: grid;
    gap: 12px;
}

.crop-properties {
    display: grid;
    gap: 12px;
}

.crop-delete-option {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #334155;
    font-size: 14px;
    cursor: pointer;
}

.crop-delete-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #2563eb;
}

.crop-apply-button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #16a34a;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.crop-apply-button:hover:not(:disabled) {
    background: #15803d;
}

.crop-apply-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.marquee-action-buttons {
    display: grid;
    gap: 8px;
}

.marquee-action-buttons button,
.merge-selected-layers {
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    font: inherit;
    cursor: pointer;
}

.marquee-action-buttons button:hover:not(:disabled),
.merge-selected-layers:hover:not(:disabled) {
    background: #eef2ff;
    border-color: #93a4ff;
}

.marquee-action-buttons button.is-danger {
    color: #b42318;
}

.marquee-action-buttons button:disabled,
.merge-selected-layers:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.merge-selected-layers {
    width: 100%;
    margin-top: 10px;
}

#interactive-panel [hidden],
.tool-section [hidden] {
    display: none !important;
}

.editor-canvas-shell.drawing-tool-active,
.editor-canvas-shell.two-point-tool-active,
.drawing-tool-active .upper-canvas,
.two-point-tool-active .upper-canvas {
    cursor: crosshair !important;
}

.line-tool-preview {
    pointer-events: none;
}

/* Image transforms and extended geometric tools. */
.interactive-panel > #image-properties {
    margin: 0;
    padding: 0 0 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

#image-properties h3 {
    margin: 0 0 12px;
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    text-transform: none;
}

.image-property-controls {
    display: grid;
    gap: 9px;
}

.image-property-field {
    display: grid;
    gap: 6px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
}

.image-property-field select,
.image-property-controls input[type="range"],
.polygon-properties input[type="range"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.property-range-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
}

.property-range-row output {
    color: var(--text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.image-transform-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.image-transform-actions button {
    min-width: 0;
    min-height: 34px;
    margin: 0;
    padding: 0 8px;
    justify-content: center;
    color: var(--text-main);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    box-shadow: none;
    font-size: 12px;
    font-weight: 600;
}

.image-transform-actions button:hover,
.image-transform-actions button.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #bfd0ff;
    box-shadow: none;
}

.image-transform-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.polygon-properties {
    display: grid;
    gap: 10px;
    margin-top: 3px;
    padding-top: 11px;
    border-top: 1px solid var(--border);
}

.polygon-properties[hidden],
#polygon-depth-row[hidden] {
    display: none !important;
}

.polygon-star-toggle {
    min-height: 28px;
}

#polygon-depth-row {
    display: grid;
    gap: 7px;
}

/* Compact, consistent shape properties. */
#shape-properties .shape-control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

#shape-properties .shape-property-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 500;
}

#shape-properties .shape-property-row > input[type="color"],
#shape-properties .shape-stroke-fields > input[type="color"] {
    width: 34px !important;
    min-width: 34px;
    height: 30px;
    min-height: 30px;
    box-sizing: border-box;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
}

#shape-properties .shape-property-row > input[type="number"],
#shape-properties .shape-stroke-fields > input[type="number"] {
    width: 54px;
    min-width: 54px;
    height: 30px;
    min-height: 30px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 7px;
    color: var(--text-main);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

#shape-properties .shape-stroke-fields {
    display: grid;
    grid-template-columns: 34px 54px;
    align-items: center;
    gap: 6px;
}

#shape-properties .shape-property-row[hidden] {
    display: none !important;
}

/* Template publishing and real template cards */
.template-save-dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
}

.template-save-dialog::backdrop {
    background: rgba(15, 23, 42, .48);
}

.template-save-dialog form {
    position: relative;
    display: grid;
    gap: 16px;
    padding: 28px;
}

.template-save-dialog h2,
.template-save-dialog p {
    margin: 0;
}

.template-save-note {
    color: #64748b;
    line-height: 1.45;
}

.template-save-dialog label {
    display: grid;
    gap: 7px;
    color: #1e293b;
    font-weight: 600;
}

.template-save-dialog label small {
    color: #64748b;
    font-size: 12px;
    font-weight: 400;
}

.template-save-dialog input[type="text"],
.template-save-dialog input[type="file"],
.template-save-dialog textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d8e0eb;
    border-radius: 9px;
    padding: 10px 12px;
    color: #172033;
    background: #fff;
    font: inherit;
    font-weight: 400;
}

.template-save-dialog textarea {
    resize: vertical;
}

.template-save-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.template-save-actions button {
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid #d8e0eb;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.template-save-actions .template-save-submit {
    border-color: #16a34a;
    color: #fff;
    background: #16a34a;
}

.screen-template-grid .screen-template-card {
    position: relative;
    overflow: hidden;
    min-height: 172px;
    padding: 0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.screen-template-card img {
    display: block;
    width: 100%;
    height: 148px;
    flex: 0 0 148px;
    object-fit: cover;
    background: #f8fafc;
}

.screen-template-card-title {
    position: static;
    display: block;
    padding: 9px 10px 10px;
    color: #172033;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
}

.screen-template-empty {
    grid-column: 1 / -1;
    margin: 18px 0;
    color: #64748b;
    text-align: center;
}

/* Unified color picker */
input[type="color"] {
    cursor: pointer;
}

.irl-color-picker[hidden],
.irl-color-picker-panel[hidden] {
    display: none !important;
}

.irl-color-picker {
    --irl-picker-hue: #ff0000;
    --irl-picker-color: #000000;
    position: fixed;
    z-index: 5000;
    width: 240px;
    box-sizing: border-box;
    padding: 12px;
    color: #172033;
    background: #ffffff;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 7px 20px rgba(25, 35, 52, 0.09), 0 1px 4px rgba(25, 35, 52, 0.04);
    font-family: inherit;
    user-select: none;
}

.irl-color-picker-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.irl-color-picker-tab {
    position: relative;
    min-height: 28px;
    margin: 0;
    padding: 0 2px 7px;
    color: #7a8496;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.irl-color-picker-tab::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: transparent;
    border-radius: 999px;
}

.irl-color-picker-tab.active {
    color: #172033;
}

.irl-color-picker-tab.active::after {
    background: var(--irl-picker-color);
}

.irl-color-picker-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    gap: 10px;
    align-items: stretch;
}

.irl-color-sv {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    background:
        linear-gradient(to top, #000000, transparent),
        linear-gradient(to right, #ffffff, var(--irl-picker-hue));
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(20, 30, 45, 0.05);
    cursor: crosshair;
    touch-action: none;
}

.irl-color-hue {
    position: relative;
    width: 18px;
    height: 150px;
    background: linear-gradient(to bottom, #ff0000 0%, #ff00ff 16.666%, #0000ff 33.333%, #00ffff 50%, #00ff00 66.666%, #ffff00 83.333%, #ff0000 100%);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(20, 30, 45, 0.06);
    cursor: ns-resize;
    touch-action: none;
}

.irl-color-sv:focus-visible,
.irl-color-hue:focus-visible {
    outline: 2px solid #296cff;
    outline-offset: 3px;
}

.irl-color-sv-thumb,
.irl-color-hue-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    background: transparent;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.55), inset 0 0 0 1px rgba(15, 23, 42, 0.18);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.irl-color-hue-thumb {
    left: 50%;
    width: 23px;
    height: 9px;
    background: transparent;
    border-width: 2px;
}

.irl-color-opacity-heading {
    margin: 10px 0 5px;
    color: #566174;
    font-size: 10.5px;
    font-weight: 650;
}

.irl-color-opacity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 7px;
    align-items: center;
}

.irl-color-opacity-track-wrap {
    position: relative;
    height: 14px;
    overflow: hidden;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #d9dee7 25%, transparent 25%),
        linear-gradient(-45deg, #d9dee7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d9dee7 75%),
        linear-gradient(-45deg, transparent 75%, #d9dee7 75%);
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
    background-size: 10px 10px;
    border-radius: 999px;
}

.irl-color-opacity-track-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, var(--irl-picker-color));
    pointer-events: none;
}

#irl-color-opacity {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 14px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

#irl-color-opacity::-webkit-slider-runnable-track {
    height: 14px;
    background: transparent;
}

#irl-color-opacity::-moz-range-track {
    height: 14px;
    background: transparent;
}

#irl-color-opacity::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: 0;
    appearance: none;
    -webkit-appearance: none;
    background: var(--irl-picker-color);
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.4);
}

#irl-color-opacity::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--irl-picker-color);
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.4);
}

.irl-color-opacity-value {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 30px;
    box-sizing: border-box;
    padding: 0 6px;
    background: #f5f7fa;
    border: 0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 650;
}

.irl-color-opacity-value input {
    min-width: 0;
    width: 100%;
    padding: 0;
    color: #172033;
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    text-align: right;
    -moz-appearance: textfield;
}

.irl-color-opacity-value input::-webkit-inner-spin-button,
.irl-color-opacity-value input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.irl-color-opacity-value span {
    color: #7a8496;
}

.irl-color-collection {
    min-height: 196px;
}

.irl-color-collection p {
    margin: 0 0 9px;
    color: #7a8496;
    font-size: 10.5px;
}

.irl-color-collection-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
}

.irl-color-collection-swatch {
    aspect-ratio: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: var(--swatch-color);
    border: 3px solid #ffffff;
    border-radius: 7px;
    box-shadow: 0 0 0 1px rgba(20, 30, 45, 0.08), 0 2px 5px rgba(20, 30, 45, 0.08);
    cursor: pointer;
}

.irl-color-collection-swatch:hover,
.irl-color-collection-swatch.active {
    box-shadow: 0 0 0 2px #296cff, 0 3px 8px rgba(20, 30, 45, 0.16);
}

.irl-color-picker-footer {
    display: grid;
    grid-template-columns: 32px 58px minmax(0, 1fr);
    gap: 7px;
    margin-top: 10px;
}

.irl-color-picker-footer button,
.irl-color-picker-footer select,
.irl-color-picker-footer input {
    min-width: 0;
    height: 32px;
    box-sizing: border-box;
    margin: 0;
    color: #273247;
    background: #f5f7fa;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
}

.irl-color-picker-footer button {
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
}

.irl-color-picker-footer button:hover,
.irl-color-picker-footer select:hover,
.irl-color-picker-footer input:focus {
    background: #edf1f6;
    outline: 0;
}

.irl-color-eyedropper svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.irl-color-picker-footer select {
    padding: 0 8px;
    cursor: pointer;
}

.irl-color-picker-footer input {
    padding: 0 8px;
    text-transform: uppercase;
}

@media (max-width: 520px) {
    .irl-color-picker {
        width: min(240px, calc(100vw - 20px));
        padding: 12px;
    }

    .irl-color-sv,
    .irl-color-hue {
        height: 150px;
    }
}

/* Collapsible screen rail and touch-first editor controls. */
.screen-rail,
.layout > .canvas-container,
.screen-rail-toggle {
    transition: transform .18s ease, margin-left .18s ease, left .18s ease;
}

.screen-rail-toggle {
    position: fixed;
    z-index: 1270;
    top: 50%;
    left: calc(var(--screen-nav-width) - 1px);
    width: 18px;
    height: 54px;
    margin: -27px 0 0;
    padding: 0;
    display: grid;
    place-items: center;
    color: #64748b;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--border);
    border-left: 0;
    border-radius: 0 9px 9px 0;
    box-shadow: 3px 0 10px rgba(15, 23, 42, .08);
    cursor: pointer;
}

.screen-rail-toggle:hover,
.screen-rail-toggle:focus-visible {
    color: var(--accent);
    background: #fff;
    outline: 0;
}

.screen-rail-toggle svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

body.screen-rail-collapsed .screen-rail {
    transform: translateX(-100%);
    pointer-events: none;
}

body.screen-rail-collapsed .layout > .canvas-container {
    margin-left: 0;
}

body.screen-rail-collapsed .screen-rail-toggle {
    left: 0;
}

body.screen-rail-collapsed .screen-rail-toggle svg {
    transform: rotate(180deg);
}

.mobile-properties-toggle,
.mobile-tool-properties,
.mobile-marquee-actions {
    display: none;
}

.clipart-mobile-toolbar {
    display: none;
}

.object-trash-dropzone {
    position: fixed;
    z-index: 10020;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #64748b;
    background: transparent;
    border: 0;
    border-radius: 0;
    opacity: .72;
    pointer-events: none;
    transition: width .14s ease, height .14s ease, color .14s ease, background .14s ease, opacity .14s ease;
}

.object-trash-dropzone svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
    transition: width .14s ease, height .14s ease, transform .14s ease;
}

.object-trash-dropzone.is-dragging {
    opacity: 1;
}

.object-trash-dropzone.is-armed {
    top: 0;
    right: 0;
    width: 142px;
    height: 142px;
    place-items: start end;
    padding: 20px 21px;
    color: #fff;
    background: rgba(220, 38, 38, .92);
    border-bottom-left-radius: 142px;
    box-sizing: border-box;
}

.object-trash-dropzone.is-armed svg {
    width: 30px;
    height: 30px;
    transform: scale(1.08);
}

.object-trash-confirm {
    position: fixed;
    z-index: 10060;
    top: 12px;
    right: 12px;
    width: min(220px, calc(100vw - 24px));
    padding: 12px;
    display: grid;
    gap: 10px;
    color: #1f2937;
    background: rgba(255, 255, 255, .985);
    border: 1px solid rgba(148, 163, 184, .42);
    border-radius: 13px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .24);
    box-sizing: border-box;
}

.object-trash-confirm[hidden] {
    display: none;
}

.object-trash-confirm strong {
    font-size: 14px;
    text-align: center;
}

.object-trash-confirm > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.object-trash-confirm button {
    min-height: 34px;
    margin: 0;
    padding: 5px 10px;
    color: #334155;
    background: #f1f5f9;
    border: 0;
    border-radius: 8px;
}

.object-trash-confirm button.is-danger {
    color: #fff;
    background: #dc2626;
}

.upper-canvas,
.canvas-wrapper {
    touch-action: none;
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
    :root {
        --screen-nav-width: min(78vw, 270px);
        --mobile-bottom-tools-offset: 50px;
    }

    html,
    body,
    .layout {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .layout {
        display: block;
    }

    .layout > .canvas-container {
        position: fixed;
        inset: 0;
        width: auto;
        min-width: 0;
        height: 100dvh;
        margin: 0;
        padding: 10px 8px 112px;
    }

    .screen-rail {
        z-index: 1320;
        width: var(--screen-nav-width);
        max-width: var(--screen-nav-width);
        height: 100dvh;
        padding: 10px;
        background: rgba(255, 255, 255, .985);
        box-shadow: 10px 0 32px rgba(15, 23, 42, .14);
    }

    .screen-rail-toggle {
        z-index: 1330;
        left: var(--screen-nav-width);
        width: 20px;
        height: 50px;
        margin-top: -25px;
        border-radius: 0 10px 10px 0;
    }

    body:not(.screen-rail-collapsed) .layout > .canvas-container {
        margin-left: 0;
    }

    .editor-bottom-controls {
        z-index: 1400;
        bottom: max(0px, env(safe-area-inset-bottom));
        max-width: calc(100vw - 10px);
    }

    .bottom-tools-panel {
        max-width: calc(100vw - 10px);
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
        touch-action: pan-x;
    }

    .bottom-tools-panel .tool-group-trigger,
    .bottom-tools-panel .tool-group-trigger * {
        touch-action: none !important;
    }

    .bottom-tools-panel::-webkit-scrollbar {
        display: none;
    }

    .bottom-tools-panel .dropdown-content,
    .bottom-tools-panel .interactive-controls {
        position: fixed;
        z-index: 1450;
        left: 50%;
        right: auto;
        bottom: calc(var(--bottom-tools-height) + 10px + env(safe-area-inset-bottom));
        max-width: calc(100vw - 20px);
        transform: translateX(-50%);
    }

    .mobile-tool-group-menu {
        position: fixed;
        z-index: 10040;
        width: max-content;
        min-width: 190px;
        max-width: calc(100vw - 16px);
        max-height: min(48dvh, 330px);
        padding: 5px;
        display: grid;
        gap: 2px;
        overflow-x: hidden;
        overflow-y: auto;
        color: #172033;
        background: rgba(255, 255, 255, .985);
        border: 1px solid rgba(148, 163, 184, .34);
        border-radius: 11px;
        box-shadow: 0 14px 34px rgba(15, 23, 42, .2);
        box-sizing: border-box;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .mobile-tool-group-choice {
        width: 100%;
        min-width: 180px;
        min-height: 42px;
        margin: 0;
        padding: 8px 10px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        color: #172033;
        background: transparent;
        border: 0;
        border-radius: 7px;
        box-shadow: none;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.2;
        text-align: left;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-tool-group-choice svg {
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
        fill: currentColor;
    }

    .mobile-tool-group-choice.active,
    .mobile-tool-group-choice:active {
        color: #2563eb;
        background: #eef4ff;
    }

    .bottom-tools-panel .tool-group-trigger.mobile-group-open {
        color: #fff;
        background: var(--bottom-tools-hover);
    }

    .interactive-panel {
        position: fixed;
        z-index: 1360;
        top: auto;
        right: 6px;
        bottom: calc(var(--bottom-tools-height) + 6px + env(safe-area-inset-bottom));
        left: 6px;
        width: auto;
        min-width: 0;
        height: auto;
        max-height: min(42dvh, 390px);
        padding: 40px 12px 12px;
        overflow-x: hidden;
        overflow-y: auto;
        color: var(--text-main);
        background: rgba(255, 255, 255, .985);
        border: 1px solid rgba(148, 163, 184, .28);
        border-radius: 16px 16px 12px 12px;
        box-shadow: 0 -10px 34px rgba(15, 23, 42, .16);
        transform: translateY(0);
        transition: transform .18s ease;
        overscroll-behavior: contain;
    }

    .interactive-panel.mobile-properties-collapsed {
        transform: translateY(calc(100% - 36px));
        overflow: hidden;
    }

    .mobile-properties-toggle {
        position: absolute;
        z-index: 2;
        top: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 36px;
        margin: 0;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        color: #475569;
        background: transparent;
        border: 0;
        border-radius: 16px 16px 0 0;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
    }

    .interactive-panel .mobile-properties-toggle,
    .interactive-panel .mobile-properties-toggle:hover,
    .interactive-panel .mobile-properties-toggle:focus-visible,
    .interactive-panel .mobile-properties-toggle:active {
        color: #475569;
        background: #fff;
        border: 0;
        box-shadow: none;
        transform: none;
        outline: 0;
    }

    .mobile-properties-toggle::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        width: 34px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 999px;
        transform: translateX(-50%);
    }

    .mobile-properties-toggle-label {
        margin-top: 9px;
    }

    .mobile-properties-toggle svg {
        width: 16px;
        height: 16px;
        margin-top: 9px;
        fill: currentColor;
    }

    .interactive-panel.mobile-properties-collapsed .mobile-properties-toggle svg {
        transform: rotate(180deg);
    }

    .interactive-panel .tool-section,
    .interactive-panel > #text-properties,
    .interactive-panel > #shape-properties,
    .interactive-panel > #gauss-blur-controls,
    .screen-inspector-properties {
        padding-bottom: 4px;
    }

    .interactive-panel h3,
    .screen-inspector-properties h3 {
        margin-bottom: 9px;
        font-size: 13px;
    }

    .interactive-panel input[type="range"] {
        min-height: 30px;
    }

    .interactive-panel .toolbar-footer.save-menu {
        right: 7px;
        bottom: calc(var(--bottom-tools-height) + 7px + env(safe-area-inset-bottom));
    }

    .marquee-action-buttons {
        display: none;
    }

    .mobile-marquee-actions {
        position: fixed;
        z-index: 1390;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px;
        background: rgba(23, 32, 51, .96);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .24);
        transform: translate(-50%, 0);
    }

    .mobile-marquee-actions[hidden] {
        display: none !important;
    }

    .mobile-marquee-actions button {
        width: 38px;
        height: 38px;
        margin: 0;
        padding: 0;
        display: grid;
        place-items: center;
        color: #fff;
        background: transparent;
        border: 0;
        border-radius: 9px;
        cursor: pointer;
    }

    .mobile-marquee-actions button:hover,
    .mobile-marquee-actions button:active {
        background: rgba(255, 255, 255, .12);
    }

    .mobile-marquee-actions button.is-danger {
        color: #fca5a5;
    }

    .mobile-marquee-actions button:disabled {
        opacity: .32;
        pointer-events: none;
    }

    .mobile-marquee-actions svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

    .irl-color-picker {
        position: fixed !important;
        z-index: 1500 !important;
        top: auto !important;
        right: 8px !important;
        bottom: calc(var(--bottom-tools-height) + 8px + env(safe-area-inset-bottom)) !important;
        left: 8px !important;
        width: auto !important;
        max-height: calc(100dvh - var(--bottom-tools-height) - 20px);
        overflow-y: auto;
    }
}

/* Compact, icon-first mobile properties bar and a phone-sized image library. */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
    .interactive-panel {
        position: fixed;
        z-index: 1360;
        inset: auto 0 0 auto;
        width: 0;
        min-width: 0;
        height: 0;
        max-height: none;
        padding: 0;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        transform: none;
        pointer-events: none;
    }

    .interactive-panel > *:not(.toolbar-footer.save-menu) {
        display: none !important;
    }

    .interactive-panel .toolbar-footer.save-menu,
    body.right-dock-layers .interactive-panel .toolbar-footer.save-menu {
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-tool-properties:not([hidden]) {
        position: absolute;
        z-index: 2;
        right: auto;
        bottom: calc(100% + 6px);
        left: 50%;
        width: max-content;
        max-width: calc(100vw - 12px);
        min-height: 44px;
        padding: 4px;
        display: flex;
        align-items: center;
        gap: 3px;
        overflow-x: auto;
        overflow-y: hidden;
        color: #334155;
        background: rgba(226, 232, 240, .97);
        border: 1px solid rgba(148, 163, 184, .32);
        border-radius: 13px;
        box-shadow: 0 9px 26px rgba(15, 23, 42, .16);
        transform: translateX(-50%);
        pointer-events: auto;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        touch-action: pan-x;
    }

    .mobile-tool-properties::-webkit-scrollbar {
        display: none;
    }

    .mobile-property-button,
    .mobile-line-style-button {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
        margin: 0;
        padding: 0;
        display: grid;
        place-items: center;
        color: #475569;
        background: rgba(255, 255, 255, .72);
        border: 1px solid rgba(148, 163, 184, .28);
        border-radius: 9px;
        box-shadow: none;
    }

    .mobile-property-button svg,
    .mobile-range-property > svg,
    .mobile-select-property > svg,
    .mobile-input-property > svg {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
        fill: currentColor;
    }

    .mobile-property-button:hover,
    .mobile-property-button:active,
    .mobile-property-button.active,
    .mobile-line-style-button.active {
        color: #2563eb;
        background: #fff;
        border-color: #93b4ff;
    }

    .mobile-property-button.is-primary {
        color: #fff;
        background: #16a34a;
        border-color: #16a34a;
    }

    .mobile-property-button.is-danger {
        color: #dc2626;
    }

    .mobile-property-button:disabled,
    .mobile-line-style-button:disabled,
    .mobile-tool-properties input:disabled,
    .mobile-tool-properties select:disabled {
        opacity: .35;
        pointer-events: none;
    }

    .mobile-color-property {
        position: relative;
    }

    .mobile-color-property > svg {
        position: absolute;
        right: 2px;
        bottom: 2px;
        width: 12px;
        height: 12px;
        padding: 1px;
        color: #fff;
        background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444);
        border-radius: 50%;
        z-index: 1;
    }

    .mobile-color-swatch {
        width: 22px;
        height: 22px;
        display: block;
        background: var(--mobile-swatch, #000);
        border: 2px solid #fff;
        border-radius: 6px;
        box-shadow: 0 0 0 1px rgba(71, 85, 105, .35);
    }

    .mobile-range-property,
    .mobile-select-property,
    .mobile-input-property {
        height: 36px;
        margin: 0;
        padding: 0 7px;
        display: flex;
        align-items: center;
        gap: 5px;
        color: #475569;
        background: rgba(255, 255, 255, .72);
        border: 1px solid rgba(148, 163, 184, .28);
        border-radius: 9px;
        box-sizing: border-box;
    }

    .mobile-range-property input[type="range"] {
        width: 82px;
        min-width: 82px;
        height: 28px;
        min-height: 28px;
        margin: 0;
    }

    .mobile-select-property select {
        width: auto;
        max-width: 126px;
        height: 30px;
        min-height: 30px;
        margin: 0;
        padding: 2px 24px 2px 5px;
        color: #334155;
        background-color: transparent;
        border: 0;
        border-radius: 6px;
        box-shadow: none;
        font-size: 12px;
    }

    .mobile-input-property input {
        width: 50px;
        height: 28px;
        min-height: 28px;
        margin: 0;
        padding: 2px 5px;
        color: #334155;
        background: transparent;
        border: 0;
        border-radius: 5px;
        box-shadow: none;
        font-size: 12px;
        text-align: center;
    }

    .mobile-input-property.is-text input {
        width: 112px;
        text-align: left;
    }

    .mobile-line-style-group {
        height: 36px;
        padding: 0 3px;
        display: flex;
        align-items: center;
        gap: 2px;
        background: rgba(255, 255, 255, .72);
        border: 1px solid rgba(148, 163, 184, .28);
        border-radius: 9px;
    }

    .mobile-line-style-button {
        width: 31px;
        min-width: 31px;
        height: 30px;
        min-height: 30px;
        border: 0;
        background: transparent;
    }

    .mobile-line-style-button span {
        width: 20px;
        height: 2px;
        display: block;
        background: currentColor;
        border-radius: 999px;
    }

    .mobile-line-style-button.is-dashed span {
        background: repeating-linear-gradient(90deg, currentColor 0 6px, transparent 6px 10px);
    }

    .mobile-line-style-button.is-dotted span {
        height: 4px;
        background: radial-gradient(circle, currentColor 0 2px, transparent 2.2px) 0 0 / 7px 4px repeat-x;
    }

    .mobile-property-button.is-open {
        color: #2563eb;
        background: #fff;
        border-color: #93b4ff;
    }

    .mobile-line-style-preview {
        width: 21px;
        height: 3px;
        display: block;
        color: currentColor;
        background: currentColor;
        border-radius: 999px;
    }

    .mobile-property-button.is-dashed .mobile-line-style-preview {
        background: repeating-linear-gradient(90deg, currentColor 0 6px, transparent 6px 10px);
    }

    .mobile-property-button.is-dotted .mobile-line-style-preview {
        height: 4px;
        background: radial-gradient(circle, currentColor 0 2px, transparent 2.2px) 0 0 / 7px 4px repeat-x;
    }

    .mobile-property-floating-popover {
        position: fixed;
        z-index: 10050;
        min-width: 72px;
        padding: 6px;
        color: #334155;
        background: rgba(241, 245, 249, .985);
        border: 1px solid rgba(148, 163, 184, .38);
        border-radius: 12px;
        box-shadow: 0 12px 32px rgba(15, 23, 42, .22);
        box-sizing: border-box;
        touch-action: none;
    }

    .mobile-property-floating-popover.is-range {
        width: 64px;
        min-width: 0;
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .mobile-range-popover-content {
        min-height: 132px;
        display: grid;
        grid-template-rows: auto 108px;
        justify-items: center;
        gap: 4px;
    }

    .mobile-range-popover-content.is-compact-number-range {
        min-height: 132px;
        grid-template-rows: auto 108px;
    }

    .mobile-range-popover-content strong,
    .mobile-input-popover-content strong {
        max-width: 68px;
        overflow: visible;
        color: #64748b;
        font-size: 10px;
        font-weight: 650;
        line-height: 1.2;
        text-align: center;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: normal;
    }

    .mobile-vertical-slider {
        position: relative;
        width: 36px;
        height: 108px;
        outline: none;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .mobile-vertical-slider-track,
    .mobile-vertical-slider-fill {
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 8px;
        height: 100%;
        border-radius: 999px;
        transform: translateX(-50%);
        pointer-events: none;
    }

    .mobile-vertical-slider-track {
        background: #cbd5e1;
    }

    .mobile-vertical-slider-fill {
        background: #2563eb;
    }

    .mobile-vertical-slider-thumb {
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 24px;
        height: 24px;
        background: #2563eb;
        border: 0;
        border-radius: 50%;
        box-shadow: none;
        transform: translate(-50%, 50%);
        pointer-events: none;
    }

    .mobile-vertical-slider:focus-visible .mobile-vertical-slider-thumb {
        outline: 2px solid #fff;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, .35);
    }

    .mobile-property-floating-popover.is-choice-list {
        width: min(210px, calc(100vw - 12px));
        padding: 5px;
    }

    .mobile-property-choice-list {
        max-height: 166px;
        display: grid;
        gap: 2px;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        touch-action: pan-y;
    }

    .mobile-property-choice {
        width: 100%;
        min-height: 38px;
        margin: 0;
        padding: 7px 9px;
        display: flex;
        align-items: center;
        gap: 9px;
        color: #475569;
        background: transparent;
        border: 0;
        border-radius: 8px;
        font-size: 12px;
        text-align: left;
    }

    .mobile-property-choice.active {
        color: #1d4ed8;
        background: #dbeafe;
    }

    .mobile-line-style-choices .mobile-property-choice span {
        width: 42px;
        height: 3px;
        flex: 0 0 42px;
        color: currentColor;
        background: currentColor;
        border-radius: 999px;
    }

    .mobile-line-style-choices .mobile-property-choice.is-dashed span {
        background: repeating-linear-gradient(90deg, currentColor 0 8px, transparent 8px 13px);
    }

    .mobile-line-style-choices .mobile-property-choice.is-dotted span {
        height: 4px;
        background: radial-gradient(circle, currentColor 0 2px, transparent 2.2px) 0 0 / 9px 4px repeat-x;
    }

    .mobile-property-floating-popover.is-input {
        width: min(178px, calc(100vw - 12px));
    }

    .mobile-input-popover-content {
        display: grid;
        gap: 6px;
    }

    .mobile-input-popover-content input {
        width: 100%;
        height: 36px;
        min-height: 36px;
        margin: 0;
        padding: 5px 8px;
        color: #334155;
        background: #fff;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        box-shadow: none;
        box-sizing: border-box;
        font-size: 13px;
    }

    body:has(.mobile-tool-properties:not([hidden])) .irl-color-picker {
        bottom: calc(var(--bottom-tools-height) + 58px + env(safe-area-inset-bottom)) !important;
    }

    .mobile-marquee-actions {
        display: none !important;
    }

    .clipart-picker-overlay {
        padding: 0;
        align-items: stretch;
        background: #fff;
    }

    .clipart-picker {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .clipart-picker-header {
        min-height: 48px;
        padding: max(6px, env(safe-area-inset-top)) 10px 4px;
        box-sizing: border-box;
    }

    .clipart-picker-header h2 {
        font-size: 17px;
        line-height: 1.2;
    }

    .clipart-picker-close {
        width: 36px;
        min-width: 36px;
        height: 36px;
        margin: 0;
        font-size: 28px;
    }

    .clipart-mobile-toolbar {
        padding: 4px 10px 7px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .clipart-category-select {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        height: 38px;
        margin: 0;
        padding: 6px 34px 6px 10px;
        color: #1f2937;
        background-color: #f8fafc;
        border: 1px solid #dbe3ef;
        border-radius: 9px;
        font-size: 13px;
    }

    .clipart-search-toggle {
        width: 38px;
        min-width: 38px;
        height: 38px;
        margin: 0;
        padding: 0;
        display: grid;
        place-items: center;
        color: #475569;
        background: #f8fafc;
        border: 1px solid #dbe3ef;
        border-radius: 9px;
        box-shadow: none;
    }

    .clipart-search-toggle svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
    }

    .clipart-search-row {
        display: none;
        padding: 0 10px 7px;
    }

    .clipart-picker.mobile-search-open .clipart-search-row {
        display: block;
    }

    .clipart-search {
        height: 38px;
        padding: 6px 10px;
        border-radius: 9px;
        font-size: 14px;
    }

    .clipart-filter-row {
        display: none;
    }

    .clipart-grid {
        min-height: 0;
        padding: 5px 8px 10px;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .clipart-tile {
        width: 100%;
        min-width: 0;
        min-height: 76px;
        height: auto;
        aspect-ratio: 1 / 1.08;
        margin: 0;
        padding: 4px;
        gap: 2px;
        border-radius: 8px;
        box-sizing: border-box;
    }

    .clipart-tile img {
        width: 100%;
        min-width: 0;
        height: min(13vw, 58px);
        max-height: 58px;
        object-fit: contain;
    }

    .clipart-tile-name {
        width: 100%;
        display: block;
        overflow: hidden;
        color: #475569;
        font-size: 8px;
        line-height: 1.15;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .clipart-upload-tile svg {
        width: 24px;
        height: 24px;
    }

    .clipart-upload-tile span {
        font-size: 8px;
        line-height: 1.1;
    }

    .clipart-picker-footer {
        min-height: 52px;
        padding: 6px 8px max(6px, env(safe-area-inset-bottom));
        gap: 6px;
        box-sizing: border-box;
    }

    .clipart-picker-footer button {
        min-width: 0;
        min-height: 38px;
        padding: 7px 10px;
        border-radius: 8px;
        font-size: 13px;
    }
}
/* Product modes share the same editor core. Graphics mode only hides worksheet-only UI. */
.creator-mode-graphics .top-interactive-section {
    display: none !important;
}

.creator-mode-label {
    color: #526176;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.creator-availability-page {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f2f5f7;
    color: #172033;
    font-family: Arial, sans-serif;
}

.creator-availability-card {
    width: min(100%, 560px);
    padding: 40px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(23, 32, 51, .12);
    text-align: center;
}

.creator-availability-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 22px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    background: #2f72ed;
    color: #fff;
    font-size: 30px;
    font-weight: 700;
}

.creator-availability-card h1 {
    margin: 0;
    font-size: clamp(25px, 5vw, 36px);
    line-height: 1.15;
}

.creator-availability-card p {
    margin: 18px auto 26px;
    max-width: 460px;
    color: #657186;
    font-size: 17px;
    line-height: 1.55;
}

.creator-availability-card a {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    border-radius: 12px;
    background: #16a34a;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 560px) {
    .creator-availability-card {
        padding: 30px 22px;
        border-radius: 20px;
    }
}
