.image-studio-view {
    width: 100%;
    min-width: 0;
    padding: 24px 0 44px;
    flex-direction: column;
}

.image-studio-view.active-view {
    box-sizing: border-box;
    height: 100dvh;
    min-height: 0;
    padding: 12px 14px;
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow: hidden;
    background: #f4f5f7;
}

.image-studio-view.active-view #betaPhotoEditor {
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
}

body.dark-mode .image-studio-view.active-view {
    background: #0d0e11;
}

body.phone-preview-mode #navStudioBtn .nav-icon {
    color: #b75d19;
    background: #fff0e3;
}

body.phone-preview-mode #navStudioBtn.active .nav-icon {
    color: #17120e;
    background: var(--accent);
}

#navStudioBtn .nav-label small {
    margin-left: 4px;
    padding: 2px 5px;
    border-radius: 999px;
    color: #17120e;
    background: var(--accent);
    font-size: 0.46rem;
    font-weight: 800;
}

.gsc-editor {
    --editor-bg: #eceef2;
    --editor-panel: #ffffff;
    --editor-panel-2: #f6f7f9;
    --editor-ink: #1c1d22;
    --editor-muted: #777b85;
    --editor-line: #e0e2e7;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    color: var(--editor-ink);
    font-family: Inter, Arial, sans-serif;
}

body.dark-mode .gsc-editor {
    --editor-bg: #0e0f12;
    --editor-panel: #17181d;
    --editor-panel-2: #202126;
    --editor-ink: #f2f2f3;
    --editor-muted: #9698a1;
    --editor-line: #2d2f36;
}

.gsc-editor button,
.gsc-editor input,
.gsc-editor select {
    font: inherit;
}

.gsc-editor button {
    cursor: pointer;
}

.gsc-editor-head {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.gsc-editor-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.gsc-editor-kicker {
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #d86f1c;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.gsc-editor-kicker span {
    padding: 3px 7px;
    border-radius: 999px;
    color: #17120e;
    background: var(--accent);
    font-size: 0.55rem;
    letter-spacing: 0.07em;
}

.gsc-editor-head h2 {
    margin: 0;
    color: var(--editor-ink);
    font: 500 clamp(1.8rem, 4vw, 2.65rem)/1.05 "Space Grotesk", sans-serif;
    letter-spacing: -0.045em;
}

.image-studio-view.active-view .gsc-editor-head h2 {
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.gsc-editor-head p {
    margin: 8px 0 0;
    color: var(--editor-muted);
    font-size: 0.76rem;
}

.gsc-editor-privacy {
    padding: 9px 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--editor-line);
    border-radius: 12px;
    color: var(--editor-muted);
    background: var(--editor-panel);
    font-size: 0.64rem;
    white-space: nowrap;
}

.gsc-editor-privacy svg {
    width: 14px;
    height: 14px;
    color: #38a679;
}

.gsc-editor-shell {
    height: auto;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid var(--editor-line);
    border-radius: 22px;
    background: var(--editor-panel);
    box-shadow: 0 18px 55px rgba(22, 24, 30, 0.09);
}

.gsc-editor-topbar {
    min-width: 0;
    min-height: 62px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--editor-line);
    background: var(--editor-panel);
    position: relative;
}

.gsc-editor-file,
.gsc-editor-history,
.gsc-editor-export-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.gsc-editor-file {
    flex: 1;
}

.gsc-editor-file-copy {
    min-width: 0;
}

.gsc-editor-file-copy strong,
.gsc-editor-file-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gsc-editor-file-copy strong {
    max-width: 230px;
    color: var(--editor-ink);
    font: 700 0.73rem "Space Grotesk", sans-serif;
}

.gsc-editor-file-copy span {
    margin-top: 2px;
    color: var(--editor-muted);
    font-size: 0.57rem;
}

.gsc-editor-icon-button,
.gsc-editor-text-button,
.gsc-editor-primary-button {
    min-height: 40px;
    border: 1px solid var(--editor-line);
    border-radius: 11px;
    color: var(--editor-ink);
    background: var(--editor-panel-2);
    font-weight: 700;
}

.gsc-editor-icon-button {
    width: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.gsc-editor-icon-button svg,
.gsc-editor-text-button svg,
.gsc-editor-primary-button svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.9;
}

.gsc-editor-icon-button:disabled {
    cursor: default;
    opacity: 0.35;
}

.gsc-editor-text-button,
.gsc-editor-primary-button {
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 0.65rem;
}

.gsc-editor-primary-button {
    border-color: var(--accent);
    color: #17120e;
    background: var(--accent);
}

.gsc-editor-body {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) 280px;
}

.gsc-editor-tools {
    padding: 12px 9px;
    display: flex;
    overflow-y: auto;
    flex-direction: column;
    gap: 7px;
    border-right: 1px solid var(--editor-line);
    background: var(--editor-panel);
}

.gsc-editor-tool {
    min-height: 57px;
    padding: 7px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 0;
    border-radius: 13px;
    color: var(--editor-muted);
    background: transparent;
    font-size: 0.52rem;
    font-weight: 700;
}

.gsc-editor-tool svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
}

.gsc-editor-tool:hover,
.gsc-editor-tool.active {
    color: #17120e;
    background: var(--accent);
}

.gsc-editor-stage-column {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    background: var(--editor-bg);
}

.gsc-editor-stage {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    position: relative;
    display: grid;
    place-items: center;
    touch-action: none;
    background-color: var(--editor-bg);
    background-image:
        linear-gradient(45deg, rgba(130, 133, 143, 0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(130, 133, 143, 0.08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(130, 133, 143, 0.08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(130, 133, 143, 0.08) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.gsc-editor-canvas-wrap {
    min-width: 100%;
    min-height: 100%;
    padding: 36px;
    display: grid;
    place-items: center;
}

.gsc-editor-canvas-holder {
    position: relative;
    line-height: 0;
    box-shadow: 0 18px 50px rgba(10, 11, 14, 0.2);
}

.gsc-editor-canvas {
    display: block;
    max-width: none;
    background: #fff;
}

.gsc-editor-canvas.is-drawing {
    cursor: crosshair;
}

.gsc-editor-canvas.is-shape-editing {
    cursor: move;
}

.gsc-editor-crop-box {
    display: none;
    position: absolute;
    border: 2px solid var(--accent);
    background: rgba(255, 179, 107, 0.08);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.48);
    pointer-events: none;
}

.gsc-editor-crop-box.visible {
    display: block;
}

.gsc-editor-crop-box.remove-selection {
    border-color: #5d9ff1;
    background: rgba(93, 159, 241, 0.1);
}

.gsc-editor-empty {
    width: min(86%, 430px);
    padding: 38px;
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 3;
    border: 1px dashed #b9bcc5;
    border-radius: 20px;
    color: var(--editor-muted);
    background: color-mix(in srgb, var(--editor-panel) 92%, transparent);
    text-align: center;
    transform: translate(-50%, -50%);
}

.gsc-editor-empty.hidden {
    display: none;
}

.gsc-editor-empty-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 15px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: #17120e;
    background: var(--accent);
}

.gsc-editor-empty-icon svg {
    width: 24px;
    height: 24px;
}

.gsc-editor-empty strong,
.gsc-editor-empty span {
    display: block;
}

.gsc-editor-empty strong {
    color: var(--editor-ink);
    font: 700 1rem "Space Grotesk", sans-serif;
}

.gsc-editor-empty span {
    margin: 7px 0 18px;
    font-size: 0.67rem;
    line-height: 1.5;
}

.gsc-editor-stage-footer {
    min-height: 48px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--editor-line);
    background: var(--editor-panel);
}

.gsc-editor-dimensions {
    color: var(--editor-muted);
    font-size: 0.59rem;
}

.gsc-editor-zoom {
    display: flex;
    align-items: center;
    gap: 7px;
}

.gsc-editor-zoom input {
    width: 110px;
    accent-color: var(--accent);
}

.gsc-editor-zoom span {
    width: 42px;
    color: var(--editor-muted);
    font-size: 0.59rem;
    text-align: right;
}

.gsc-editor-sidebar {
    min-width: 0;
    overflow-y: auto;
    border-left: 1px solid var(--editor-line);
    background: var(--editor-panel);
}

.gsc-editor-panel {
    display: none;
    padding: 18px;
}

.gsc-editor-panel.active {
    display: block;
}

.gsc-editor-panel-head {
    margin-bottom: 18px;
}

.gsc-editor-panel-head strong {
    display: block;
    color: var(--editor-ink);
    font: 700 0.9rem "Space Grotesk", sans-serif;
}

.gsc-editor-panel-head span {
    display: block;
    margin-top: 4px;
    color: var(--editor-muted);
    font-size: 0.61rem;
    line-height: 1.45;
}

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

.gsc-editor-action-grid button,
.gsc-editor-option-button,
.gsc-editor-filter {
    min-height: 44px;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--editor-line);
    border-radius: 11px;
    color: var(--editor-ink);
    background: var(--editor-panel-2);
    font-size: 0.61rem;
    font-weight: 700;
}

.gsc-editor-action-grid button svg {
    width: 15px;
    height: 15px;
}

.gsc-editor-separator {
    height: 1px;
    margin: 17px 0;
    background: var(--editor-line);
}

.gsc-editor-control {
    margin-bottom: 15px;
}

.gsc-editor-control-label {
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--editor-muted);
    font-size: 0.61rem;
    font-weight: 700;
}

.gsc-editor-control-label output {
    color: var(--editor-ink);
    font-variant-numeric: tabular-nums;
}

.gsc-editor-control input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.gsc-editor-control input[type="text"],
.gsc-editor-control input[type="number"],
.gsc-editor-control select {
    width: 100%;
    min-height: 43px;
    padding: 0 11px;
    border: 1px solid var(--editor-line);
    border-radius: 10px;
    color: var(--editor-ink);
    background: var(--editor-panel-2);
    outline: 0;
    font-size: 0.67rem;
}

.gsc-editor-control input:focus,
.gsc-editor-control select:focus {
    border-color: var(--accent);
}

.gsc-editor-color-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
}

.gsc-editor-number-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.gsc-editor-color-row input[type="color"] {
    width: 48px;
    height: 43px;
    padding: 4px;
    border: 1px solid var(--editor-line);
    border-radius: 10px;
    background: var(--editor-panel-2);
}

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

.gsc-editor-filter {
    min-height: 58px;
    flex-direction: column;
    gap: 5px;
}

.gsc-editor-filter svg {
    width: 17px;
    height: 17px;
}

.gsc-editor-filter.active {
    border-color: var(--accent);
    color: #17120e;
    background: var(--accent);
}

.gsc-editor-tip {
    margin-top: 16px;
    padding: 11px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: 11px;
    color: var(--editor-muted);
    background: var(--editor-panel-2);
    font-size: 0.58rem;
    line-height: 1.5;
}

.gsc-editor-tip svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    color: #d86f1c;
}

.gsc-editor-wide-button {
    width: 100%;
}

.gsc-editor-ai-status {
    margin-top: 10px;
    padding: 11px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border: 1px solid var(--editor-line);
    border-radius: 11px;
    color: var(--editor-muted);
    background: var(--editor-panel-2);
    font-size: 0.58rem;
    line-height: 1.45;
}

.gsc-editor-ai-status svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    color: #5d9ff1;
}

.gsc-editor-ai-status.loading svg {
    animation: gscEditorSpin 0.85s linear infinite;
}

.gsc-editor-ai-status.success {
    border-color: rgba(56, 166, 121, 0.34);
    color: #28845f;
}

.gsc-editor-ai-status.error {
    border-color: rgba(220, 70, 81, 0.32);
    color: #c74450;
}

.gsc-editor-shape-commit {
    margin-top: 8px;
}

.gsc-editor-nudge-grid button {
    padding: 0;
}

.gsc-editor-export-sheet {
    display: none;
    padding: 15px;
    position: absolute;
    top: 56px;
    right: 10px;
    z-index: 8;
    width: 270px;
    border: 1px solid var(--editor-line);
    border-radius: 15px;
    background: var(--editor-panel);
    box-shadow: 0 18px 45px rgba(15, 16, 20, 0.2);
}

.gsc-editor-export-sheet.open {
    display: block;
}

.gsc-editor-export-sheet strong {
    display: block;
    margin-bottom: 13px;
    font: 700 0.8rem "Space Grotesk", sans-serif;
}

.gsc-editor-export-row {
    margin-top: 10px;
}

.gsc-editor-export-row label {
    margin-bottom: 6px;
    display: block;
    color: var(--editor-muted);
    font-size: 0.58rem;
    font-weight: 700;
}

.gsc-editor-export-row select,
.gsc-editor-export-row input[type="range"] {
    width: 100%;
}

.gsc-editor-export-row select {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--editor-line);
    border-radius: 9px;
    color: var(--editor-ink);
    background: var(--editor-panel-2);
}

.gsc-editor-export-sheet .gsc-editor-primary-button {
    width: 100%;
    margin-top: 15px;
}

.gsc-editor-toast {
    padding: 10px 13px;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 50;
    border-radius: 11px;
    color: #17120e;
    background: var(--accent);
    box-shadow: 0 12px 32px rgba(20, 21, 25, 0.18);
    font-size: 0.65rem;
    font-weight: 750;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: 0.2s ease;
}

.gsc-editor-toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1050px) {
    .gsc-editor-body {
        grid-template-columns: 68px minmax(0, 1fr) 250px;
    }

    .gsc-editor-file-copy {
        display: none;
    }
}

@media (max-width: 760px) {
    .image-studio-view.active-view {
        padding: 10px !important;
        overflow-y: auto;
    }

    .image-studio-view.active-view #betaPhotoEditor {
        height: auto;
        flex: 0 0 auto;
    }

    .gsc-editor {
        height: auto;
    }

    .gsc-editor-head {
        align-items: center;
        flex-direction: row;
    }

    .gsc-editor-head p,
    .gsc-editor-privacy {
        display: none;
    }

    .gsc-editor-head-actions {
        margin-left: auto;
    }

    .gsc-editor-shell {
        height: auto;
        min-height: calc(100dvh - 88px);
        overflow: visible;
        border-radius: 18px;
    }

    .gsc-editor-topbar {
        flex-wrap: wrap;
    }

    .gsc-editor-file {
        order: 1;
    }

    .gsc-editor-history {
        order: 2;
    }

    .gsc-editor-export-actions {
        width: 100%;
        order: 3;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .gsc-editor-export-actions button {
        width: auto;
    }

    .gsc-editor-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(430px, 58vh) auto;
    }

    .gsc-editor-tools {
        padding: 8px;
        position: sticky;
        top: 0;
        z-index: 5;
        overflow-x: auto;
        flex-direction: row;
        border-right: 0;
        border-bottom: 1px solid var(--editor-line);
        scrollbar-width: none;
    }

    .gsc-editor-tools::-webkit-scrollbar {
        display: none;
    }

    .gsc-editor-tool {
        min-width: 62px;
        min-height: 53px;
        flex: 0 0 62px;
    }

    .gsc-editor-stage {
        min-height: 430px;
    }

    .gsc-editor-canvas-wrap {
        padding: 24px;
    }

    .gsc-editor-sidebar {
        overflow: visible;
        border-top: 1px solid var(--editor-line);
        border-left: 0;
    }

    .gsc-editor-panel {
        padding: 17px 15px 22px;
    }

    .gsc-editor-export-sheet {
        width: calc(100% - 20px);
        top: 112px;
        right: 10px;
    }

    .gsc-editor-empty {
        width: calc(100% - 42px);
        padding: 26px 18px;
    }
}

@media (max-width: 390px) {
    .gsc-editor-head h2 {
        font-size: 1.75rem;
    }

    .gsc-editor-text-button span,
    .gsc-editor-primary-button span {
        display: none;
    }

    .gsc-editor-stage-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .gsc-editor-zoom {
        width: 100%;
    }

    .gsc-editor-zoom input {
        flex: 1;
    }
}

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