.photo-editor-app {
    --editor-bg: #080b12;
    --editor-panel: rgba(13, 18, 30, 0.96);
    --editor-panel-2: rgba(19, 27, 43, 0.92);
    --editor-line: rgba(148, 163, 184, 0.22);
    --editor-text: #edf5ff;
    --editor-muted: #aab8cb;
    --editor-blue: #67e8f9;
    --editor-pink: #ff69b4;
    color: var(--editor-text);
    min-height: 100vh;
    height: 100vh;
    padding-top: 88px;
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 10%, rgba(103, 232, 249, 0.14), transparent 30%),
        radial-gradient(circle at 90% 8%, rgba(255, 105, 180, 0.12), transparent 30%),
        linear-gradient(135deg, #090d15, #080812 70%);
}

.photo-editor-app * {
    box-sizing: border-box;
}

.photo-editor-app ~ footer {
    display: none;
}

.editor-topbar {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    border-block: 1px solid var(--editor-line);
    background: rgba(5, 8, 14, 0.92);
    position: relative;
    top: auto;
    z-index: 30;
    backdrop-filter: blur(14px);
}

.editor-back,
.editor-topbar button,
.editor-sidebar button,
.editor-bottombar button {
    border: 1px solid var(--editor-line);
    background: rgba(255, 255, 255, 0.07);
    color: var(--editor-text);
    min-height: 36px;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
}

.editor-topbar button:hover,
.editor-sidebar button:hover,
.editor-bottombar button:hover,
.editor-back:hover {
    border-color: var(--editor-blue);
    color: var(--editor-blue);
    background: rgba(103, 232, 249, 0.1);
}

.editor-topbar button.primary,
.editor-sidebar button.primary {
    background: var(--editor-blue);
    color: #031018;
    border-color: transparent;
}

.editor-topbar button.pink,
.editor-sidebar button.pink {
    background: var(--editor-pink);
    color: #fff;
}

.editor-topbar i {
    width: 16px;
    height: 16px;
}

.editor-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.editor-brand > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-logo {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(103, 232, 249, 0.65);
    background:
        radial-gradient(circle at 25% 20%, rgba(255, 105, 180, 0.65), transparent 36%),
        linear-gradient(135deg, rgba(103, 232, 249, 0.22), rgba(255, 105, 180, 0.18));
    color: #ffffff;
    font-family: var(--font-display, inherit);
    font-size: 20px;
    font-weight: 950;
    line-height: 1;
    box-shadow: 0 0 22px rgba(103, 232, 249, 0.22);
}

.editor-brand span {
    color: #fff;
    font-weight: 900;
    font-size: 16px;
}

.editor-brand small {
    color: var(--editor-muted);
    font-size: 11px;
}

.editor-top-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.mobile-only {
    display: none;
}

.editor-shell {
    display: grid;
    grid-template-columns: 320px minmax(420px, 1fr) 340px;
    height: calc(100vh - 146px);
    min-height: 0;
}

.editor-sidebar {
    background: var(--editor-panel);
    border-right: 1px solid var(--editor-line);
    padding: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 146px);
    scrollbar-width: thin;
}

.editor-tool-tabs {
    position: sticky;
    top: -12px;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 0 0 10px;
    background: linear-gradient(180deg, rgba(13, 18, 30, 1), rgba(13, 18, 30, 0.94));
}

.editor-tool-tabs button {
    min-height: 38px;
    border: 1px solid var(--editor-line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--editor-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.editor-tool-tabs button.is-active {
    background: var(--editor-blue);
    color: #031018;
    border-color: transparent;
    box-shadow: 0 0 18px rgba(103, 232, 249, 0.2);
}

.left-panel .panel-section {
    display: none;
}

.left-panel[data-active-panel="setup"] [data-tool-panel="setup"],
.left-panel[data-active-panel="create"] [data-tool-panel="create"],
.left-panel[data-active-panel="edit"] [data-tool-panel="edit"] {
    display: block;
}

.right-panel {
    border-right: 0;
    border-left: 1px solid var(--editor-line);
}

.panel-section {
    border: 1px solid var(--editor-line);
    background: rgba(255, 255, 255, 0.035);
    padding: 12px;
    margin-bottom: 10px;
}

.panel-section h2 {
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 10px;
}

.panel-section label {
    display: grid;
    gap: 6px;
    color: var(--editor-muted);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.editor-input,
.panel-section input[type="number"],
.panel-section input[type="text"],
.panel-section textarea,
.panel-section select {
    width: 100%;
    border: 1px solid var(--editor-line);
    background: rgba(5, 8, 14, 0.9);
    color: var(--editor-text);
    min-height: 36px;
    padding: 8px;
}

.panel-section textarea {
    min-height: 92px;
    resize: vertical;
    line-height: 1.45;
}

.ai-panel {
    border-color: rgba(103, 232, 249, 0.34);
    background: linear-gradient(135deg, rgba(103, 232, 249, 0.08), rgba(255, 105, 180, 0.06));
}

.localized-panel {
    border-color: rgba(34, 197, 94, 0.28);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.07), rgba(103, 232, 249, 0.04));
}

.brand-kit-panel {
    border-color: rgba(255, 105, 180, 0.28);
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.07), rgba(103, 232, 249, 0.05));
}

.pro-panel {
    border-color: rgba(245, 158, 11, 0.32);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(103, 232, 249, 0.05));
}

.ai-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: -2px 0 12px;
}

.ai-preset-grid button {
    min-height: 34px;
    border: 1px solid rgba(103, 232, 249, 0.28);
    background: rgba(103, 232, 249, 0.08);
    color: var(--editor-text);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.ai-preset-grid button:hover {
    border-color: var(--editor-pink);
    color: #ffffff;
    background: rgba(255, 105, 180, 0.12);
}

.muted {
    color: var(--editor-muted);
    font-size: 12px;
    line-height: 1.45;
    margin: 10px 0 0;
}

.muted.is-error {
    color: #fecaca;
}

.muted.is-success {
    color: #bbf7d0;
}

.panel-section input[type="color"] {
    width: 100%;
    height: 36px;
    border: 1px solid var(--editor-line);
    background: rgba(5, 8, 14, 0.9);
}

.panel-section input[type="range"] {
    width: 100%;
}

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

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.button-grid .full,
button.full {
    grid-column: 1 / -1;
}

.upload-drop {
    min-height: 108px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed rgba(103, 232, 249, 0.48);
    background: rgba(103, 232, 249, 0.08);
    color: var(--editor-blue) !important;
    text-align: center;
    cursor: pointer;
}

.upload-drop.is-dragover {
    background: rgba(103, 232, 249, 0.18);
    border-color: var(--editor-blue);
}

.upload-drop i {
    width: 28px;
    height: 28px;
}

.editor-workspace {
    min-width: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 50px;
    background:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        #0b101a;
    background-size: 28px 28px;
}

.canvas-stage {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 18px;
    min-width: 0;
}

.canvas-container {
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.42);
    transition: transform 120ms ease;
}

.editor-bottombar {
    border-top: 1px solid var(--editor-line);
    background: rgba(5, 8, 14, 0.88);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 12px;
    color: var(--editor-muted);
    font-size: 12px;
}

.editor-bottombar label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layers-list {
    display: grid;
    gap: 8px;
}

.layer-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--editor-line);
    background: rgba(0, 0, 0, 0.22);
    padding: 8px;
    color: var(--editor-text);
    font-size: 12px;
}

.layer-row.is-active {
    border-color: var(--editor-blue);
}

.layer-row button {
    min-height: 28px;
    padding: 4px 7px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.section-title-row button {
    min-height: 28px;
    padding: 4px 8px;
}

.export-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.64);
    display: grid;
    place-items: center;
    padding: 20px;
}

.export-modal[hidden] {
    display: none;
}

.export-card {
    width: min(420px, 100%);
    background: #0d1320;
    border: 1px solid var(--editor-line);
    padding: 22px;
    position: relative;
}

.export-card h2 {
    margin: 0 0 16px;
    color: #fff;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

@media (max-width: 1100px) {
    .editor-shell {
        grid-template-columns: 290px minmax(0, 1fr);
    }
    .right-panel {
        position: fixed;
        top: 152px;
        right: 0;
        width: min(320px, 92vw);
        bottom: 0;
        z-index: 40;
        transform: translateX(102%);
        transition: transform 180ms ease;
    }
    .right-panel.is-open {
        transform: translateX(0);
    }
    .mobile-only {
        display: inline-flex;
    }
}

@media (max-width: 760px) {
    .photo-editor-app {
        padding-top: 78px;
    }
    .editor-topbar {
        top: auto;
        height: auto;
        min-height: 58px;
        flex-wrap: wrap;
    }
    .editor-shell {
        grid-template-columns: 1fr;
    }
    .left-panel {
        position: fixed;
        top: 142px;
        left: 0;
        width: min(320px, 92vw);
        bottom: 0;
        z-index: 40;
        transform: translateX(-102%);
        transition: transform 180ms ease;
    }
    .left-panel.is-open {
        transform: translateX(0);
    }
    .editor-workspace {
        min-height: calc(100vh - 142px);
        grid-template-rows: minmax(0, 1fr) 58px;
    }
    .canvas-stage {
        padding: 18px;
    }
    .editor-bottombar {
        overflow-x: auto;
    }
}
