.studio-page { min-height: 100dvh; padding: 102px clamp(16px, 3vw, 40px) 32px; background: var(--bg); }
.studio-shell { width: min(1320px, 100%); margin: 0 auto; }
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.studio-head h1 { margin-bottom: 5px; color: var(--ink); font-size: clamp(29px, 3vw, 40px); font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.studio-head p { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.studio-account-status { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.plan-badge { display: inline-flex; align-items: center; min-height: 36px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.76); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.plan-badge::before { content: ''; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--muted); }
.plan-badge.is-active::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(216,255,54,.18); }
.plan-badge.is-loading::before { background: var(--violet); }
.plan-badge.is-muted::before { background: #bfc4cc; }
.nav-actions a[href="/product"] { border-color: rgba(122,91,255,.28); background: rgba(122,91,255,.07); color: var(--ink); }

.studio-steps { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 650px; margin: 0 auto 12px; padding: 0; list-style: none; counter-reset: studio-step; }
.studio-steps li { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.studio-steps li:not(:last-child)::after { content: ''; position: absolute; top: 50%; left: calc(50% + 53px); width: calc(100% - 106px); height: 1px; background: var(--line-strong); }
.step-index { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg); color: var(--ink-2); font-family: 'JetBrains Mono', var(--font-mono); font-size: 12px; }
.studio-steps .is-active { color: var(--ink); }
.studio-steps .is-active .step-index { border-color: var(--violet); background: var(--violet); color: #fff; box-shadow: 0 0 0 4px rgba(122,91,255,.10); }
.studio-steps .is-complete { color: var(--ink-2); }
.studio-steps .is-complete .step-index { border-color: var(--accent); background: var(--accent); color: var(--ink); }

.studio-workspace { display: grid; grid-template-columns: .78fr 1.14fr 1fr; align-items: start; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--bg-card); box-shadow: 0 1px 2px rgba(11,11,14,.03), 0 18px 45px rgba(11,11,14,.06); }
.studio-pane { min-width: 0; padding: 22px; }
.studio-pane + .studio-pane { border-left: 1px solid var(--line); }
.pane-head { margin-bottom: 18px; }
.pane-head h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: -.025em; }
.pane-head p { margin-top: 5px; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.upload-zone { display: grid; min-height: 278px; place-content: center; gap: 8px; padding: 22px; border: 1px dashed var(--line-strong); border-radius: 18px; background: var(--bg-soft); color: var(--ink); cursor: pointer; outline: none; text-align: center; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.upload-zone:hover, .upload-zone:focus-visible, .upload-zone.is-dragging { border-color: var(--violet); background: rgba(122,91,255,.055); box-shadow: 0 0 0 4px rgba(122,91,255,.09); }
.upload-zone[hidden], .source-preview[hidden], .result-empty[hidden], .result-progress[hidden], .result-ready[hidden], .upload-error[hidden], .studio-access-note[hidden] { display: none; }
.upload-icon { width: 25px; height: 25px; margin: 0 auto 3px; }
.upload-zone b { font-size: 15px; font-weight: 700; }
.upload-zone span { max-width: 210px; color: var(--ink-2); font-size: 12px; line-height: 1.45; }
.upload-zone small { color: var(--muted); font-family: 'JetBrains Mono', var(--font-mono); font-size: 10px; }
.upload-error { margin: 10px 0 0; color: var(--red); font-size: 12px; line-height: 1.4; }
.source-preview { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-soft); }
.source-preview-media { position: relative; height: clamp(250px, 32vh, 320px); overflow: hidden; border-radius: 17px 17px 0 0; background: var(--bg-soft); }
.source-preview-media > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.source-file-meta { position: absolute; right: 10px; bottom: 10px; left: 10px; overflow: hidden; padding: 8px 10px; border: 1px solid rgba(255,255,255,.32); border-radius: 10px; background: rgba(11,11,14,.6); color: #fff; backdrop-filter: blur(8px); }
.source-file-meta span { display: block; overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.source-preview-actions { display: grid; grid-template-columns: minmax(0,1fr) 42px; gap: 8px; margin-top: 12px; }
.source-preview-actions .btn { min-width: 0; }
.icon-btn { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-card); color: var(--ink-2); cursor: pointer; font-size: 24px; font-weight: 400; line-height: 1; transition: border-color .16s ease, color .16s ease, background .16s ease; }
.icon-btn:hover { border-color: var(--red); background: rgba(217,75,75,.06); color: var(--red); }
.icon-btn:focus-visible { outline: 3px solid rgba(122,91,255,.25); outline-offset: 2px; }
.source-guidance { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12px; }
.source-guidance b { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; }
.source-guidance ul { display: grid; gap: 5px; padding-left: 18px; line-height: 1.35; }

.control-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.control-group + .control-group { margin-top: 18px; }
.control-group legend, .compact-field > span, .prompt-field > span { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: 11px; font-weight: 700; }
.style-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.style-option { position: relative; min-width: 0; cursor: pointer; }
.style-option input, .segmented-control input, .format-options input { position: absolute; opacity: 0; pointer-events: none; }
.style-option-body { display: grid; gap: 7px; min-height: 113px; padding: 5px; border: 1px solid transparent; border-radius: 14px; color: var(--ink-2); font-size: 11px; font-weight: 600; text-align: center; transition: border-color .16s ease, box-shadow .16s ease, color .16s ease; }
.style-thumb { position: relative; display: block; width: 100%; height: 72px; overflow: hidden; border-radius: 10px; }
.style-thumb-natural { background: linear-gradient(115deg, #e7e0d8 0%, #f6f3ef 45%, #cfc8c2 100%); }
.style-thumb-editorial { background: linear-gradient(145deg, #223142 0%, #6d8492 48%, #c4d3da 100%); }
.style-thumb-cinematic { background: linear-gradient(135deg, #291b16 0%, #5d2115 45%, #f17a2d 46%, #191416 100%); }
.style-thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(130deg, transparent 35%, rgba(255,255,255,.22) 36% 50%, transparent 51%); }
.style-option i { position: absolute; top: 9px; right: 9px; display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; background: var(--violet); color: #fff; font-size: 12px; font-style: normal; opacity: 0; transform: scale(.75); transition: opacity .16s ease, transform .16s ease; }
.style-option:has(input:checked) .style-option-body { border-color: var(--violet); color: var(--ink); box-shadow: 0 0 0 2px rgba(122,91,255,.13); }
.style-option:has(input:checked) i { opacity: 1; transform: scale(1); }
.style-option:has(input:focus-visible) .style-option-body { outline: 3px solid rgba(122,91,255,.24); outline-offset: 2px; }
.segmented-control { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.segmented-control label { min-width: 0; cursor: pointer; }
.segmented-control label span { display: flex; min-height: 36px; align-items: center; justify-content: center; padding: 6px; border: 1px solid transparent; border-radius: 9px; color: var(--ink-2); font-size: 11px; font-weight: 600; text-align: center; transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease; }
.segmented-control label:has(input:checked) span { border-color: var(--violet); background: var(--bg-card); color: var(--violet); box-shadow: 0 1px 2px rgba(11,11,14,.05); }
.segmented-control label:has(input:focus-visible) span { outline: 3px solid rgba(122,91,255,.24); outline-offset: 1px; }
.compact-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.compact-field .select { min-height: 44px; font-size: 12px; font-weight: 600; }
.format-group { margin-top: 18px; }
.format-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.format-options label { min-width: 0; cursor: pointer; }
.format-options label > span { display: flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-card); color: var(--ink-2); font-family: 'JetBrains Mono', var(--font-mono); font-size: 11px; font-weight: 600; transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease; }
.ratio-icon { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.ratio-square { width: 15px; height: 15px; }.ratio-portrait { width: 12px; height: 16px; }.ratio-story { width: 9px; height: 17px; }
.format-options label:has(input:checked) > span { border-color: var(--violet); background: rgba(122,91,255,.04); color: var(--violet); box-shadow: 0 0 0 2px rgba(122,91,255,.10); }
.format-options label:has(input:focus-visible) > span { outline: 3px solid rgba(122,91,255,.24); outline-offset: 2px; }
.prompt-field { display: block; margin-top: 18px; }
.prompt-field textarea { min-height: 104px; resize: vertical; font-size: 13px; font-weight: 500; line-height: 1.45; }

.studio-result { display: flex; flex-direction: column; }
.result-stage { position: relative; display: grid; width: min(100%, 350px); min-height: 0; aspect-ratio: 4 / 5; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-soft); }
.result-empty, .result-progress { display: grid; place-items: center; gap: 10px; max-width: 220px; padding: 24px; color: var(--muted); text-align: center; font-size: 12.5px; line-height: 1.45; }
.result-empty img { width: 24px; height: 24px; opacity: .7; }.result-progress strong { color: var(--ink); font-size: 13px; }.result-progress p { color: var(--ink-2); }
.sparkle-loader { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: rgba(122,91,255,.11); color: var(--violet); font-size: 19px; }
.result-progress::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 32%, rgba(255,255,255,.55) 48%, transparent 64%); transform: translateX(-120%); }
.result-ready { width: 100%; height: 100%; }
.result-comparison { --result-split: 50%; position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--bg-soft); touch-action: none; }
.result-after, .result-before, .result-before img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.result-before { z-index: 2; clip-path: inset(0 calc(100% - var(--result-split)) 0 0); opacity: 0; pointer-events: none; transition: opacity .18s ease, clip-path .08s linear; }
.result-divider, .result-handle { visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .18s ease, left .08s linear; }
.result-divider { position: absolute; z-index: 3; top: 0; bottom: 0; left: var(--result-split); width: 2px; transform: translateX(-50%); background: #fff; }
.result-handle { position: absolute; z-index: 4; top: 50%; left: var(--result-split); display: grid; width: 42px; height: 42px; place-items: center; transform: translate(-50%, -50%); border: 1px solid rgba(255,255,255,.85); border-radius: 50%; background: #fff; color: var(--violet); box-shadow: 0 8px 18px rgba(11,11,14,.17); cursor: ew-resize; font-size: 17px; }
.result-comparison.is-comparing .result-before, .result-comparison.is-comparing .result-divider, .result-comparison.is-comparing .result-handle { visibility: visible; opacity: 1; pointer-events: auto; }
.result-handle:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.result-compare-toggle { position: absolute; z-index: 5; top: 10px; right: 10px; min-height: 34px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.58); border-radius: 999px; background: rgba(11,11,14,.48); color: #fff; backdrop-filter: blur(8px); cursor: pointer; font: inherit; font-size: 10px; font-weight: 600; }
.result-compare-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.result-actions { display: flex; gap: 8px; margin-top: 12px; }.result-actions .btn { flex: 1; min-width: 0; padding-inline: 12px; }
.studio-error { min-height: 0; margin: 10px 0 0; color: var(--red); font-size: 12px; line-height: 1.4; }
.studio-access-note { width: min(100%, 390px); margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); color: var(--ink-2); font-size: 12px; line-height: 1.4; }.studio-access-note a { display: inline-block; margin-top: 7px; color: var(--ink); font-weight: 700; }
#generate-btn { width: min(100%, 350px); min-height: 54px; margin-top: 12px; }.result-summary { width: min(100%, 350px); margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.35; text-align: center; }
#generate-btn:disabled { border-color: var(--line); background: #e7e9ed; box-shadow: none; color: var(--muted); opacity: 1; }
.workspace-footer { display: flex; grid-column: 1 / -1; align-items: center; min-height: 50px; padding: 13px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1120px) { .studio-workspace { grid-template-columns: minmax(260px,.78fr) minmax(360px,1.15fr); }.studio-result { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0 !important; }.studio-result .result-stage, .studio-result .result-actions, .studio-result #generate-btn, .studio-result .result-summary, .studio-result .studio-access-note { align-self: center; }.studio-result .pane-head { width: 100%; }.studio-result .studio-error { align-self: center; width: min(100%,390px); } }
@media (max-width: 760px) { .studio-page { padding-top: 88px; padding-bottom: 34px; }.studio-head { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 18px; }.studio-account-status { width: 100%; justify-content: space-between; }.studio-steps { max-width: none; margin-bottom: 14px; }.studio-steps li { gap: 6px; font-size: 11px; }.studio-steps li:not(:last-child)::after { left: calc(50% + 40px); width: calc(100% - 80px); }.step-index { width: 25px; height: 25px; }.studio-workspace { grid-template-columns: 1fr; }.studio-pane, .studio-pane + .studio-pane { padding: 22px; border-left: 0; border-top: 1px solid var(--line); }.studio-source { border-top: 0 !important; }.style-options { grid-template-columns: repeat(3,minmax(0,1fr)); }.style-option-body { min-height: 104px; }.style-thumb { height: 64px; }.compact-fields { grid-template-columns: 1fr; }.result-stage, #generate-btn, .result-summary, .studio-access-note { width: min(100%, 410px); align-self: center; }.workspace-footer { min-height: 0; padding: 15px 22px; text-align: center; justify-content: center; } }
@media (max-width: 430px) { .studio-page { padding-inline: 12px; }.studio-head h1 { font-size: 29px; }.studio-account-status .btn { padding-inline: 13px; }.plan-badge { max-width: calc(100% - 108px); overflow: hidden; text-overflow: ellipsis; }.studio-steps li { flex-direction: column; gap: 4px; }.studio-steps li:not(:last-child)::after { top: 13px; left: calc(50% + 31px); width: calc(100% - 62px); }.studio-pane { padding: 18px; }.style-options { gap: 7px; }.style-option-body { min-height: 98px; padding: 4px; font-size: 10px; }.style-thumb { height: 59px; }.segmented-control label span { padding-inline: 3px; font-size: 10px; }.result-actions { flex-direction: column; }.result-actions .btn { width: 100%; }.result-stage { max-width: 100%; } }
@media (prefers-reduced-motion: no-preference) { .result-progress::before { animation: studio-shimmer 1.7s ease-in-out infinite; }.result-ready { animation: studio-appear .2s ease-out; } }
@keyframes studio-shimmer { to { transform: translateX(120%); } } @keyframes studio-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .upload-zone, .style-option-body, .style-option i, .segmented-control label span, .format-options label > span, .result-before, .result-divider, .result-handle { transition: none; } }
