/* AI Design Studio — pro editor layout */

.nl-manual-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
}

.nl-manual-editor-modal.is-open {
    display: flex;
}

.nl-manual-editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px);
}

/* Pro studio shell */
.nl-studio-pro-shell {
    position: relative;
    z-index: 1;
    width: min(1280px, 100%);
    max-height: calc(100vh - 1.5rem);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid rgba(0, 255, 157, 0.28);
    background: linear-gradient(165deg, #12121a 0%, #08080c 55%, #0a1210 100%);
    box-shadow: 0 0 0 1px rgba(0, 255, 157, 0.08), 0 32px 100px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.nl-studio-pro-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 255, 157, 0.12);
    background: linear-gradient(90deg, rgba(0, 255, 157, 0.06), transparent 60%);
}

.nl-studio-pro-brand {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.nl-studio-ai-pulse {
    width: 10px;
    height: 10px;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: #00ff9d;
    box-shadow: 0 0 12px #00ff9d;
    animation: nlAiPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes nlAiPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.85); }
}

.nl-studio-pro-header h3 {
    margin: 0 0 0.2rem;
    font-size: 1.12rem;
    color: #fff;
}

.nl-studio-pro-header p {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.58);
}

.nl-studio-pro-header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.nl-studio-pro-header-actions button {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.74rem;
    font-family: inherit;
    cursor: pointer;
}

.nl-studio-pro-header-actions button:hover {
    border-color: rgba(0, 255, 157, 0.4);
    background: rgba(0, 255, 157, 0.1);
}

.nl-studio-pro-body {
    display: grid;
    grid-template-columns: 200px 1fr 250px;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}

.nl-studio-pro-sidebar {
    padding: 0.85rem 0.75rem;
    overflow-x: hidden;
    min-height: 0;
}

.nl-studio-tools {
    padding-bottom: 1.5rem;
}

.nl-studio-inspector {
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 1.25rem;
}

.nl-studio-pro-sidebar:not(.nl-studio-inspector) {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.nl-studio-section-label {
    margin: 0 0 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(0, 255, 157, 0.75);
}

.nl-studio-tools .nl-studio-section-label:not(:first-child) {
    margin-top: 0.85rem;
}

.nl-studio-tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
}

.nl-studio-tool-grid button,
.nl-studio-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.88);
    border-radius: 10px;
    padding: 0.45rem 0.25rem;
    font-size: 0.68rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.nl-studio-tool-grid button span:first-child {
    font-size: 1rem;
    font-weight: 700;
    color: #00ff9d;
}

.nl-studio-tool-grid button.is-active,
.nl-studio-tool-grid button:hover,
.nl-studio-upload-btn:hover {
    border-color: rgba(0, 255, 157, 0.45);
    background: rgba(0, 255, 157, 0.08);
    box-shadow: 0 0 16px rgba(0, 255, 157, 0.12);
}

.nl-studio-ai-chips {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nl-studio-ai-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    text-align: left;
    border: 1px solid rgba(0, 255, 157, 0.2);
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.07), rgba(0, 0, 0, 0.2));
    color: #fff;
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

.nl-studio-ai-chip strong {
    font-size: 0.72rem;
    color: #00ff9d;
}

.nl-studio-ai-chip span {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.5);
}

.nl-studio-ai-chip:hover {
    transform: translateX(2px);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.15);
}

.nl-studio-chip-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.nl-studio-chip-row button {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    border-radius: 8px;
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
}

.nl-studio-chip-row button:hover {
    border-color: rgba(0, 255, 157, 0.4);
}

.nl-studio-slider {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.45rem;
}

.nl-studio-slider input[type="range"] {
    width: 100%;
}

.nl-studio-pro-canvas-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.65rem;
    background: rgba(0, 0, 0, 0.25);
}

.nl-studio-align-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nl-studio-align-bar button {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    padding: 0.25rem 0.45rem;
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
}

.nl-studio-align-bar button:hover {
    border-color: rgba(0, 255, 157, 0.4);
    color: #00ff9d;
}

.nl-studio-align-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 0.15rem;
}

.nl-manual-editor-canvas-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    padding: 0.5rem;
    border-radius: 14px;
    background: repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    border: 1px solid rgba(0, 255, 157, 0.15);
    box-shadow: inset 0 0 40px rgba(0, 255, 157, 0.04);
    position: relative;
}

.nl-studio-marquee-box {
    position: absolute;
    border: 2px dashed rgba(0, 255, 157, 0.85);
    background: rgba(0, 255, 157, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 24px rgba(0, 255, 157, 0.25);
    pointer-events: none;
    z-index: 5;
    border-radius: 4px;
}

.nl-studio-ai-select-actions {
    margin-bottom: 0.75rem;
}

.nl-studio-seg-hint {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0.35rem 0 0;
    line-height: 1.4;
}

.nl-studio-seg-actions button {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.65rem;
    padding: 0.35rem 0.4rem;
}

.nl-manual-editor-canvas-wrap canvas {
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Layers panel */
.nl-studio-layers {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nl-studio-layer {
    display: grid;
    grid-template-columns: 24px 1fr repeat(5, auto);
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.4rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.8);
    transition: background 0.12s, border-color 0.12s;
}

.nl-studio-layer.is-locked {
    border-color: rgba(255, 200, 80, 0.25);
}

.nl-studio-layer:hover {
    background: rgba(255, 255, 255, 0.04);
}

.nl-studio-layer.is-active {
    border-color: rgba(0, 255, 157, 0.45);
    background: rgba(0, 255, 157, 0.1);
    box-shadow: 0 0 12px rgba(0, 255, 157, 0.1);
}

.nl-studio-layer.is-hidden {
    opacity: 0.45;
}

.nl-studio-layer-bg {
    cursor: default;
    opacity: 0.7;
}

.nl-studio-layer-icon {
    font-size: 0.7rem;
    font-weight: 700;
    color: #00ff9d;
    text-align: center;
}

.nl-studio-layer-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nl-studio-layer-eye,
.nl-studio-layer-del,
.nl-studio-layer-lock,
.nl-studio-layer-up,
.nl-studio-layer-down {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0 0.1rem;
    line-height: 1;
}

.nl-studio-layer-up,
.nl-studio-layer-down {
    font-size: 0.55rem;
    opacity: 0.7;
}

.nl-studio-layer-up:hover,
.nl-studio-layer-down:hover {
    color: #00ff9d;
}

.nl-studio-layer-del:hover {
    color: #ff6b6b;
}

/* Properties */
.nl-studio-props-empty {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    line-height: 1.45;
}

.nl-studio-prop {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.45rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.6);
    flex: 1;
}

.nl-studio-prop span {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.6rem;
}

.nl-studio-prop input,
.nl-studio-prop select {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    padding: 0.3rem 0.4rem;
    font-family: inherit;
    font-size: 0.78rem;
    width: 100%;
}

.nl-studio-prop-row {
    display: flex;
    gap: 0.4rem;
}

.nl-prop-check {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
}

.nl-studio-pro-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.nl-manual-editor-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #00ff9d;
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.28);
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    margin-bottom: 0.3rem;
}

.nl-manual-editor-close {
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.4rem;
    cursor: pointer;
}

.nl-manual-editor-note {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.4);
}

.nl-manual-editor-save {
    border: none;
    border-radius: 12px;
    padding: 0.62rem 1.2rem;
    font-size: 0.84rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    color: #0a1410;
    background: linear-gradient(135deg, #00ff9d, #00d4aa);
    box-shadow: 0 4px 20px rgba(0, 255, 157, 0.25);
}

.nl-manual-editor-save:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nl-manual-edit-btn {
    border: none;
    background: #e11d2e;
    color: #ffffff;
    border-radius: 10px;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: none;
    text-shadow: none;
    letter-spacing: 0.02em;
}

.nl-manual-edit-btn:hover {
    background: #b91c1c;
    color: #ffffff;
    box-shadow: none;
    transform: none;
    filter: none;
}

/* Video modal (unchanged base) */
.nl-video-editor-preview {
    margin-bottom: 0.75rem;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
}

.nl-video-editor-preview video {
    width: 100%;
    max-height: 340px;
    display: block;
}

.nl-manual-editor-shell {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 157, 0.25);
    background: linear-gradient(160deg, #141418 0%, #0d0d10 100%);
    padding: 1.1rem 1.2rem;
}

@media (max-width: 960px) {
    .nl-manual-editor-modal {
        padding: 0;
        align-items: stretch;
    }

    .nl-studio-pro-shell {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .nl-studio-pro-header {
        padding: 0.75rem 0.85rem;
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .nl-studio-pro-header h3 {
        font-size: 0.95rem;
    }

    .nl-studio-pro-header p {
        font-size: 0.72rem;
    }

    .nl-studio-pro-body {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .nl-studio-pro-sidebar {
        border-right: none;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        max-height: none;
        padding: 0.65rem 0.75rem;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nl-studio-pro-canvas-area {
        order: 1;
        flex: 0 0 auto;
        padding: 0.5rem;
        min-height: 0;
        display: flex !important;
        flex-direction: column;
    }

    .nl-studio-tools {
        order: 2;
        display: none;
    }

    .nl-studio-inspector {
        order: 2;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        display: none;
    }

    .nl-studio-tool-grid {
        grid-template-columns: repeat(4, minmax(64px, 1fr));
        gap: 0.4rem;
    }

    .nl-studio-tool-grid button,
    .nl-studio-upload-btn {
        min-height: 52px;
        padding: 0.45rem 0.35rem;
        font-size: 0.62rem;
        touch-action: manipulation;
    }

    .nl-studio-tool-grid button span:first-child {
        font-size: 1.05rem;
    }

    .nl-studio-align-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nl-studio-align-bar::-webkit-scrollbar {
        display: none;
    }

    .nl-studio-align-bar button {
        min-height: 40px;
        min-width: 40px;
        flex-shrink: 0;
    }

    .nl-manual-editor-canvas-wrap {
        padding: 0.35rem;
        flex: 1 1 auto;
        min-height: 0;
    }

    .nl-manual-editor-canvas-wrap canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .nl-studio-layers {
        max-height: 120px;
    }

    .nl-studio-layer {
        grid-template-columns: 22px 1fr repeat(5, 36px);
        min-height: 40px;
        font-size: 0.72rem;
    }

    .nl-studio-layer-eye,
    .nl-studio-layer-del,
    .nl-studio-layer-lock,
    .nl-studio-layer-up,
    .nl-studio-layer-down {
        min-width: 36px;
        min-height: 36px;
    }

    .nl-studio-sel-dock {
        position: fixed;
        left: 50%;
        bottom: calc(4.5rem + env(safe-area-inset-bottom));
        transform: translateX(-50%);
        max-width: calc(100vw - 1rem);
        z-index: 12005;
    }

    .nl-studio-sel-dock button {
        min-height: 36px;
        padding: 0.35rem 0.65rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 640px) {
    .nl-studio-pro-header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .nl-studio-pro-header-actions button {
        min-height: 40px;
        padding: 0.45rem 0.75rem;
    }

    .nl-studio-pro-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.65rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
    }

    .nl-manual-editor-note {
        font-size: 0.68rem;
        text-align: center;
        line-height: 1.35;
    }

    .nl-manual-editor-save {
        width: 100%;
        min-height: 48px;
        font-size: 0.88rem;
    }

    .nl-studio-tool-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nl-studio-chip-row button {
        min-height: 40px;
        flex: 1 1 auto;
    }

    .nl-studio-ai-chip {
        min-height: 44px;
    }

    .nl-studio-restyle-btn {
        min-height: 44px;
    }

    .nl-studio-swatch {
        width: 32px;
        height: 32px;
    }

    .nl-studio-font-chip {
        min-height: 44px;
    }
}

/* Selection dock + AI busy + palette/fonts */
.nl-manual-editor-canvas-wrap {
    position: relative;
}

.nl-studio-sel-dock {
    position: absolute;
    z-index: 6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    padding: 0.35rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 157, 0.35);
    background: rgba(8, 12, 14, 0.92);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    max-width: min(92%, 520px);
}

.nl-studio-sel-dock[hidden] {
    display: none !important;
}

.nl-studio-sel-dock button {
    border: 0;
    border-radius: 999px;
    padding: 0.28rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #dfffee;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    white-space: nowrap;
}

.nl-studio-sel-dock button:hover {
    background: rgba(0, 255, 157, 0.22);
    color: #fff;
}

.nl-studio-ai-busy {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 8, 10, 0.55);
    backdrop-filter: blur(6px);
}

.nl-studio-ai-busy[hidden] {
    display: none !important;
}

.nl-studio-ai-busy-card {
    text-align: center;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(0, 255, 157, 0.28);
    background: rgba(10, 14, 16, 0.92);
    min-width: 220px;
}

.nl-studio-ai-busy-orbit {
    width: 42px;
    height: 42px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 157, 0.2);
    border-top-color: #00ff9d;
    animation: nlStudioSpin 0.85s linear infinite;
}

@keyframes nlStudioSpin {
    to { transform: rotate(360deg); }
}

.nl-studio-ai-busy-title {
    margin: 0 0 0.35rem;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
}

.nl-studio-ai-busy-sub {
    margin: 0 0 0.85rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.nl-studio-ai-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nl-studio-ai-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.42);
}

.nl-studio-ai-steps li.is-done {
    color: rgba(0, 255, 157, 0.9);
}

.nl-studio-ai-steps li.is-active {
    color: #fff;
    font-weight: 700;
}

.nl-studio-step-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.nl-studio-ai-steps li.is-done .nl-studio-step-mark {
    background: #00ff9d;
    box-shadow: 0 0 8px rgba(0, 255, 157, 0.55);
}

.nl-studio-ai-steps li.is-active .nl-studio-step-mark {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 255, 157, 0.25);
    animation: nlAiPulse 1.1s ease-in-out infinite;
}

.nl-studio-restyle-box {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.nl-studio-restyle-box textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    padding: 0.55rem 0.65rem;
    font: inherit;
    resize: vertical;
    min-height: 56px;
}

.nl-studio-restyle-btn {
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    font-weight: 800;
    font-size: 0.78rem;
    color: #04140e;
    background: linear-gradient(135deg, #00ff9d, #6dffc2);
    cursor: pointer;
}

.nl-studio-restyle-btn:hover {
    filter: brightness(1.05);
}

.nl-studio-palette-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.nl-studio-swatch {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    padding: 0;
}

.nl-studio-font-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.nl-studio-font-chip {
    text-align: left;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.nl-studio-font-chip:hover {
    border-color: rgba(0, 255, 157, 0.35);
    background: rgba(0, 255, 157, 0.08);
}

.nl-studio-marquee-box {
    position: absolute;
    border: 1.5px dashed #00ff9d;
    background: rgba(0, 255, 157, 0.08);
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* Mobile panel tabs — hidden on desktop */
.nl-studio-mobile-tabs {
    display: none;
}

@media (max-width: 960px) {
    .nl-studio-mobile-tabs {
        display: flex;
        gap: 0.35rem;
        padding: 0.45rem 0.65rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(8, 10, 12, 0.98);
        position: sticky;
        top: 0;
        z-index: 12;
    }

    .nl-studio-mobile-tabs button {
        flex: 1 1 0;
        min-height: 44px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.05);
        color: rgba(255, 255, 255, 0.82);
        font-size: 0.78rem;
        font-weight: 700;
        cursor: pointer;
        touch-action: manipulation;
    }

    .nl-studio-mobile-tabs button.is-active {
        color: #0a1410;
        background: linear-gradient(135deg, #00ff9d, #39ff14);
        border-color: transparent;
    }

    .nl-studio-pro-body[data-mobile-panel="tools"] .nl-studio-tools {
        display: block;
    }

    .nl-studio-pro-body[data-mobile-panel="tools"] .nl-studio-inspector {
        display: none !important;
    }

    /* Canvas stays visible while tools or layers are open */
    .nl-studio-pro-body[data-mobile-panel="tools"] .nl-studio-pro-canvas-area,
    .nl-studio-pro-body[data-mobile-panel="layers"] .nl-studio-pro-canvas-area {
        display: flex !important;
        flex: 0 0 auto;
        max-height: min(40vh, 340px);
    }

    .nl-studio-pro-body[data-mobile-panel="tools"] .nl-manual-editor-canvas-wrap,
    .nl-studio-pro-body[data-mobile-panel="layers"] .nl-manual-editor-canvas-wrap {
        min-height: min(32vh, 240px);
        max-height: min(38vh, 320px);
        flex: 1 1 auto;
    }

    .nl-studio-pro-body[data-mobile-panel="canvas"] .nl-studio-tools,
    .nl-studio-pro-body[data-mobile-panel="canvas"] .nl-studio-inspector {
        display: none !important;
    }

    .nl-studio-pro-body[data-mobile-panel="canvas"] .nl-studio-pro-canvas-area {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 50vh;
        max-height: none;
    }

    .nl-studio-pro-body[data-mobile-panel="canvas"] .nl-manual-editor-canvas-wrap {
        min-height: min(52vh, 420px);
        max-height: none;
        flex: 1 1 auto;
    }

    .nl-studio-pro-body[data-mobile-panel="layers"] .nl-studio-inspector {
        display: block;
    }

    .nl-studio-pro-body[data-mobile-panel="layers"] .nl-studio-tools {
        display: none !important;
    }

    .nl-studio-pro-body {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .nl-studio-pro-shell {
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100dvh;
    }
}

/* Light mode — Pro Edit modal */
html[data-theme="light"] .nl-manual-editor-backdrop {
    background: rgba(16, 32, 24, 0.55);
}

html[data-theme="light"] .nl-studio-pro-shell {
    background: linear-gradient(160deg, #f8fcf9 0%, #eef5f1 100%);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.2));
    color: var(--nl-text, #102018);
}

html[data-theme="light"] .nl-studio-pro-header,
html[data-theme="light"] .nl-studio-pro-footer {
    background: rgba(255, 255, 255, 0.92);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.16));
}

html[data-theme="light"] .nl-studio-pro-header h3,
html[data-theme="light"] .nl-studio-section-label,
html[data-theme="light"] .nl-manual-editor-badge {
    color: var(--nl-accent-strong, #005a38);
}

html[data-theme="light"] .nl-studio-pro-header p,
html[data-theme="light"] .nl-manual-editor-note,
html[data-theme="light"] .nl-studio-props-empty {
    color: var(--nl-text-muted, #3d5348);
}

html[data-theme="light"] .nl-studio-pro-sidebar {
    background: rgba(255, 255, 255, 0.96);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.14));
}

html[data-theme="light"] .nl-studio-tool-grid button,
html[data-theme="light"] .nl-studio-upload-btn,
html[data-theme="light"] .nl-studio-chip-row button,
html[data-theme="light"] .nl-studio-pro-header-actions button {
    color: var(--nl-text, #102018);
    background: var(--nl-surface-2, #eef5f1);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.18));
}

html[data-theme="light"] .nl-studio-tool-grid button.is-active {
    color: #fff;
    background: linear-gradient(135deg, #007a4d, #00995f);
}

html[data-theme="light"] .nl-manual-editor-canvas-wrap {
    background: #e8efeb;
    border-color: var(--nl-border, rgba(0, 90, 60, 0.16));
}

html[data-theme="light"] .nl-studio-mobile-tabs {
    background: #fff;
    border-bottom-color: var(--nl-border, rgba(0, 90, 60, 0.16));
}

html[data-theme="light"] .nl-studio-mobile-tabs button {
    color: var(--nl-text, #102018);
    background: var(--nl-surface-2, #eef5f1);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.18));
}

html[data-theme="light"] .nl-studio-mobile-tabs button.is-active {
    color: #fff;
    background: linear-gradient(135deg, #007a4d, #00995f);
}

html[data-theme="light"] .nl-manual-editor-save {
    color: #fff;
    background: linear-gradient(135deg, #007a4d, #00995f);
}

html[data-theme="light"] .nl-studio-sel-dock {
    background: rgba(255, 255, 255, 0.96);
    border-color: var(--nl-border, rgba(0, 90, 60, 0.22));
}

html[data-theme="light"] .nl-studio-sel-dock button {
    color: var(--nl-text, #102018);
    background: var(--nl-surface-2, #eef5f1);
}

/* Desktop — show full left/right panels (no clipped sidebars) */
@media (min-width: 961px) {
    .nl-manual-editor-modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 0.35rem;
        -webkit-overflow-scrolling: touch;
    }

    .nl-studio-pro-shell {
        width: min(1320px, 100%);
        height: auto;
        max-height: none;
        overflow: visible;
        margin: 0 auto;
    }

    .nl-studio-pro-header {
        padding: 0.75rem 1rem;
    }

    .nl-studio-pro-footer {
        padding: 0.6rem 1rem;
    }

    .nl-studio-pro-body {
        overflow: visible;
        align-items: stretch;
        grid-template-columns: 218px 1fr 252px;
        min-height: min(560px, calc(100dvh - 9rem));
        flex: none;
    }

    .nl-studio-pro-sidebar {
        overflow: visible;
        max-height: none;
        height: auto;
        padding: 0.6rem 0.65rem;
    }

    .nl-studio-tools {
        padding-bottom: 0.75rem;
    }

    .nl-studio-tools .nl-studio-section-label:not(:first-child) {
        margin-top: 0.55rem;
    }

    .nl-studio-section-label {
        margin-bottom: 0.32rem;
    }

    .nl-studio-tool-grid {
        gap: 0.28rem;
    }

    .nl-studio-tool-grid button,
    .nl-studio-upload-btn {
        padding: 0.34rem 0.2rem;
        font-size: 0.62rem;
    }

    .nl-studio-slider {
        margin-bottom: 0.28rem;
        font-size: 0.64rem;
    }

    .nl-studio-ai-chip {
        padding: 0.38rem 0.48rem;
    }

    .nl-studio-ai-chip strong {
        font-size: 0.68rem;
    }

    .nl-studio-layers {
        max-height: none;
        overflow: visible;
        margin-bottom: 0.65rem;
    }

    .nl-studio-pro-canvas-area {
        min-height: 420px;
        align-self: start;
        position: sticky;
        top: 0.35rem;
        max-height: calc(100dvh - 0.75rem);
    }

    .nl-manual-editor-canvas-wrap {
        min-height: 320px;
        max-height: calc(100dvh - 11rem);
    }
}
