.retouch-studio {
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.09));
    border-radius: 18px;
    background: var(--bg-card, #fff);
    box-shadow: 0 16px 36px rgba(24, 24, 27, 0.06);
    padding: 1rem;
}

.retouch-studio-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.9rem;
}

.retouch-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--accent-gold, #a67c37);
    background: var(--accent-gold-soft, rgba(166, 124, 55, 0.12));
    color: var(--accent-gold, #a67c37);
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    margin-bottom: 0.45rem;
}

.retouch-title {
    font-size: 1.45rem;
    font-weight: 750;
    margin-bottom: 0.25rem;
}

.retouch-lead {
    color: var(--text-secondary, #52525b);
    margin-bottom: 0;
    max-width: 42rem;
}

.retouch-head-actions,
.retouch-tools,
.retouch-presets,
.retouch-crop-actions,
.retouch-aspects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.retouch-studio-body {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.8fr);
    gap: 1rem;
    align-items: start;
}

.retouch-stage-frame {
    position: relative;
    min-height: 320px;
    border-radius: 14px;
    border: 1px dashed var(--border-subtle, rgba(24, 24, 27, 0.12));
    background:
        linear-gradient(45deg, var(--accent-gold-soft, rgba(166, 124, 55, 0.12)) 25%, transparent 25%),
        linear-gradient(-45deg, var(--accent-gold-soft, rgba(166, 124, 55, 0.12)) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--accent-gold-soft, rgba(166, 124, 55, 0.12)) 75%),
        linear-gradient(-45deg, transparent 75%, var(--accent-gold-soft, rgba(166, 124, 55, 0.12)) 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
    background-color: var(--bg-soft-sand, #f2efe9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.retouch-stage-frame.is-dragover {
    border-color: var(--accent-gold, #a67c37);
    box-shadow: inset 0 0 0 3px rgba(22, 123, 199, 0.16);
}

.retouch-empty[hidden],
.retouch-canvas-wrap[hidden] {
    display: none !important;
}

.retouch-empty {
    flex: 1 1 auto;
    align-self: stretch;
    width: 100%;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    cursor: pointer;
}

.retouch-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.75rem;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold, #a67c37);
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.7rem;
}

.retouch-canvas-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.retouch-image-tools {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 4;
    display: flex;
    gap: 0.35rem;
}

.retouch-icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    color: #0f5f9f;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.retouch-icon-btn:hover {
    background: var(--accent-gold, #a67c37);
    color: #fff;
}

.retouch-icon-btn-danger:hover {
    background: #dc3545;
    color: #fff;
}

.retouch-canvas {
    display: block;
    max-width: 100%;
    max-height: 68vh;
    width: auto;
    height: auto;
}

.retouch-variant-home .retouch-canvas {
    max-height: 440px;
}

.retouch-tools,
.retouch-status {
    margin-top: 0.7rem;
}

.retouch-status {
    min-height: 1.25rem;
    color: var(--text-muted, #71717a);
    font-size: 0.86rem;
}

.retouch-preset-label {
    flex: 1 0 100%;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    color: var(--text-muted, #71717a);
}

.retouch-btn,
.retouch-preset,
.retouch-aspect {
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.12));
    background: var(--bg-solid-card, #fff);
    color: var(--text-primary, #18181b);
    border-radius: 999px;
    padding: 0.38rem 0.78rem;
    font-size: 0.86rem;
    line-height: 1.2;
}

.retouch-btn:hover:not(:disabled),
.retouch-preset:hover,
.retouch-aspect:hover,
.retouch-btn:focus-visible:not(:disabled),
.retouch-preset:focus-visible,
.retouch-aspect:focus-visible {
    border-color: var(--accent-gold, #a67c37);
    color: var(--accent-gold, #a67c37);
    background: var(--accent-gold-soft, rgba(166, 124, 55, 0.12));
    outline: none;
}

.retouch-preset.is-active,
.retouch-aspect.is-active,
.retouch-btn.is-active,
.retouch-preset.is-active:hover,
.retouch-aspect.is-active:hover,
.retouch-btn.is-active:hover {
    border-color: var(--btn-primary-border, #c4a15e);
    color: var(--btn-primary-text, #18181b);
    background: var(--btn-primary-bg, #e5c687);
}

.retouch-btn:active:not(:disabled),
.retouch-preset:active,
.retouch-aspect:active {
    border-color: var(--accent-gold-hover, #8c6526);
    background: var(--btn-primary-hover, #d4b06a);
    color: var(--btn-primary-text, #18181b);
}

.retouch-btn:disabled,
.retouch-btn:disabled:hover {
    opacity: 0.45;
    background: var(--bg-solid-card, #fff);
    color: var(--text-muted, #71717a);
    border-color: var(--border-subtle, rgba(24, 24, 27, 0.12));
}

.retouch-btn-primary {
    background: var(--btn-primary-bg, #e5c687);
    border-color: var(--btn-primary-border, #c4a15e);
    color: var(--btn-primary-text, #18181b);
}

.retouch-btn-primary:hover:not(:disabled),
.retouch-btn-primary:focus-visible:not(:disabled) {
    color: var(--btn-primary-text, #18181b);
    background: var(--btn-primary-hover, #d4b06a);
    border-color: var(--accent-gold, #a67c37);
}

.retouch-btn-primary:active:not(:disabled) {
    background: var(--accent-gold-hover, #8c6526);
    color: var(--btn-primary-text, #18181b);
}

.retouch-panel {
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.09));
    border-radius: 14px;
    background: var(--bg-card, rgba(255, 255, 255, 0.88));
    padding: 0.85rem;
}

.retouch-panel-title {
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    color: var(--text-muted, #71717a);
    margin: 0.85rem 0 0.45rem;
}

.retouch-panel-title:first-child {
    margin-top: 0;
}

.retouch-slider {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.6rem;
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
}

.retouch-slider input {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--accent-gold, #a67c37);
}

.retouch-film-strength[hidden] {
    display: none;
}

.retouch-film-strength {
    margin: 0.2rem 0 0.9rem;
    padding: 0.65rem 0.75rem 0.4rem;
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.09));
    border-radius: 12px;
    background: var(--bg-soft-sand, #f2efe9);
}

.retouch-film-strength strong {
    color: var(--accent-gold, #a67c37);
    font-weight: 650;
}

.retouch-film-hint {
    margin: 0 0 0.3rem;
    color: var(--text-muted, #71717a);
    font-size: 0.8rem;
    line-height: 1.4;
}

.retouch-slider-value {
    color: var(--accent-gold, #a67c37);
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.retouch-region {
    margin: 0.35rem 0 0.7rem;
    padding: 0.55rem 0.7rem 0.15rem;
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.09));
    border-radius: 12px;
    background: var(--bg-soft-sand, #f2efe9);
}

.retouch-region-title {
    margin: 0 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.retouch-region-skin .retouch-region-title {
    color: #a35a3a;
}

.retouch-region-sky .retouch-region-title {
    color: #1d4fa8;
}

.retouch-region-leaf .retouch-region-title {
    color: #1d7a40;
}

.retouch-curves {
    margin-bottom: 0.8rem;
}

.retouch-curve-channels,
.retouch-curve-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.retouch-curve-channels {
    margin-bottom: 0.45rem;
}

.retouch-curve-channel {
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.12));
    background: var(--bg-solid-card, #fff);
    color: var(--text-secondary, #52525b);
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 650;
}

.retouch-curve-channel:hover,
.retouch-curve-channel:focus-visible {
    border-color: var(--accent-gold, #a67c37);
    color: var(--accent-gold, #a67c37);
    background: var(--accent-gold-soft, rgba(166, 124, 55, 0.12));
    outline: none;
}

.retouch-curve-channel.is-active,
.retouch-curve-channel.is-active:hover {
    border-color: var(--btn-primary-border, #c4a15e);
    background: var(--btn-primary-bg, #e5c687);
    color: var(--btn-primary-text, #18181b);
}

.retouch-curve-channel[data-curve-channel="r"].is-active,
.retouch-curve-channel[data-curve-channel="r"].is-active:hover {
    border-color: #d64545;
    background: rgba(214, 69, 69, 0.14);
    color: #a32626;
}

.retouch-curve-channel[data-curve-channel="g"].is-active,
.retouch-curve-channel[data-curve-channel="g"].is-active:hover {
    border-color: #2f9e57;
    background: rgba(47, 158, 87, 0.14);
    color: #1d7a40;
}

.retouch-curve-channel[data-curve-channel="b"].is-active,
.retouch-curve-channel[data-curve-channel="b"].is-active:hover {
    border-color: #2f6fd6;
    background: rgba(47, 111, 214, 0.14);
    color: #1d4fa8;
}

[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="r"].is-active,
[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="r"].is-active:hover {
    color: #f0a8a8;
}

[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="g"].is-active,
[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="g"].is-active:hover {
    color: #8ed7a8;
}

[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="b"].is-active,
[data-bs-theme="dark"] .retouch-curve-channel[data-curve-channel="b"].is-active:hover {
    color: #a9c4f5;
}

.retouch-curve-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.12));
    border-radius: 12px;
    background: var(--bg-input, #faf8f5);
    touch-action: none;
    cursor: crosshair;
}

.retouch-curve-actions {
    margin-top: 0.45rem;
}

.retouch-quality {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.7rem;
    font-size: 0.86rem;
    color: var(--text-secondary, #52525b);
}

.retouch-quality input {
    flex: 1;
    accent-color: var(--accent-gold, #a67c37);
}

.retouch-locked {
    margin-top: 0.65rem;
    border-radius: 12px;
    padding: 0.55rem 0.7rem 0.6rem;
    background: var(--bg-soft-sand, #f2efe9);
    border: 1px solid var(--border-subtle, rgba(24, 24, 27, 0.09));
}

.retouch-locked-title {
    margin: 0 0 0.15rem;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
}

.retouch-locked p {
    margin: 0 0 0.4rem;
    color: var(--text-secondary, #52525b);
    font-size: 0.8rem;
    line-height: 1.35;
}

.retouch-locked .retouch-btn {
    padding: 0.28rem 0.68rem;
    font-size: 0.8rem;
}

.retouch-crop {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.48);
    cursor: move;
    touch-action: none;
    box-sizing: border-box;
}

.retouch-crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid var(--accent-gold, #a67c37);
    border-radius: 3px;
}

.retouch-crop-handle[data-handle="nw"] { left: -7px; top: -7px; cursor: nwse-resize; }
.retouch-crop-handle[data-handle="ne"] { right: -7px; top: -7px; cursor: nesw-resize; }
.retouch-crop-handle[data-handle="sw"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.retouch-crop-handle[data-handle="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }

.retouch-crop-tools {
    margin-top: 0.55rem;
}

.retouch-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 991.98px) {
    .retouch-studio-head,
    .retouch-studio-body {
        display: block;
    }

    .retouch-head-actions {
        margin-top: 0.8rem;
    }

    .retouch-panel {
        margin-top: 0.85rem;
    }

    .retouch-stage-frame {
        min-height: 240px;
    }
}
