:root {
    --ink: #12141a;
    --ink-soft: #262a33;
    --paper: #f1f2f4;
    --paper-strong: #f7f7f9;
    --paper-muted: #d9dbe1;
    --line: #aeb2bc;
    --line-dark: #565c6a;
    --signal: #df6a57;
    --signal-dark: #9f4638;
    --lime: #7f72ae;
    --cyan: #6faeb4;
    --amber: #d6a85c;
    --black: #090a0e;
    --radius: 6px;
    --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "Cascadia Mono", monospace;
    --bg-color: var(--black);
    --sidebar-bg: var(--ink);
    --card-bg: rgba(241, 242, 244, 0.035);
    --border-color: rgba(241, 242, 244, 0.16);
    --accent: var(--lime);
    --accent-hover: #9488be;
    --studio-control-height: 40px;
}

html {
    background: var(--ink);
}

body.studio-shell {
    min-width: 320px;
    background: var(--black);
    color: var(--paper);
    font-family: var(--font-sans);
    font-size: 15px;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}

body.studio-shell * {
    letter-spacing: 0;
}

body.studio-shell .hidden {
    display: none !important;
}

body.studio-shell .noise {
    display: none;
}

body.studio-shell button:focus-visible,
body.studio-shell a:focus-visible,
body.studio-shell input:focus-visible,
body.studio-shell textarea:focus-visible,
body.studio-shell select:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

body.studio-shell ::selection {
    background: var(--lime);
    color: var(--paper);
}

.studio-sidebar-header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(241, 242, 244, 0.18);
}

.studio-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.studio-brand-mark {
    position: relative;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}

.studio-brand-mark::before,
.studio-brand-mark::after {
    position: absolute;
    inset: 2px;
    content: "";
    clip-path: polygon(
        50% 0,
        58% 38%,
        100% 50%,
        58% 62%,
        50% 100%,
        42% 62%,
        0 50%,
        42% 38%
    );
}

.studio-brand-mark::before {
    background: var(--paper);
}

.studio-brand-mark::after {
    inset: 7px;
    background: var(--ink);
}

.studio-brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.05;
}

.studio-brand-name {
    color: var(--paper);
    font-size: 15px;
    font-weight: 700;
}

.studio-brand-division {
    margin-top: 4px;
    overflow: hidden;
    color: rgba(241, 242, 244, 0.46);
    font-family: var(--font-mono);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-topbar {
    position: relative;
    z-index: 40;
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(241, 242, 244, 0.18);
    background: rgba(18, 20, 26, 0.96);
}

.studio-view-tabs {
    display: flex;
    height: 68px;
    align-items: stretch;
    gap: 24px;
}

.studio-view-tabs .view-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: rgba(241, 242, 244, 0.54) !important;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.studio-view-tabs .view-tab::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    content: "";
    background: var(--lime);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 160ms ease;
}

.studio-view-tabs .view-tab:hover,
.studio-view-tabs .view-tab.active {
    color: var(--paper) !important;
}

.studio-view-tabs .view-tab.active::after {
    transform: scaleX(1);
}

.studio-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.studio-topbar-actions > *,
#auth-section,
#login-btn-wrap,
#user-info,
.profile-dropdown {
    min-width: 0;
}

#auth-section {
    display: flex;
    height: var(--studio-control-height);
    align-items: center;
}

#login-btn-wrap,
#user-info {
    height: var(--studio-control-height);
    align-items: center;
}

#login-btn-wrap:not(.hidden),
#user-info:not(.hidden) {
    display: flex;
}

.studio-system-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(241, 242, 244, 0.52);
    font-family: var(--font-mono);
    font-size: 9px;
    line-height: 1.25;
}

.studio-status-light {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    background: var(--lime);
    box-shadow: 0 0 0 4px rgba(127, 114, 174, 0.13);
}

.studio-system-status[data-state="error"] .studio-status-light {
    background: var(--signal);
    box-shadow: 0 0 0 4px rgba(223, 106, 87, 0.13);
}

.studio-system-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.studio-system-copy span:last-child {
    margin-top: 2px;
    color: rgba(241, 242, 244, 0.3);
}

.studio-icon-button {
    display: inline-flex;
    width: var(--studio-control-height);
    height: var(--studio-control-height);
    flex: 0 0 var(--studio-control-height);
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(241, 242, 244, 0.22);
    border-radius: 3px;
    background: transparent;
    color: rgba(241, 242, 244, 0.7);
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.studio-icon-button:hover {
    border-color: var(--paper);
    background: var(--paper);
    color: var(--ink);
}

body.studio-shell .sidebar {
    width: 360px !important;
    flex: 0 0 360px;
    border-right: 1px solid rgba(241, 242, 244, 0.18);
    background: var(--ink);
    transition: width 180ms ease, flex-basis 180ms ease, transform 180ms ease;
}

body.studio-sidebar-collapsed .desktop-sidebar {
    width: 0 !important;
    flex-basis: 0;
    border-right: 0;
    transform: translateX(-100%);
}

body.studio-shell .desktop-sidebar > .flex-1 {
    padding: 18px;
}

body.studio-shell .desktop-sidebar > .flex-1 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 14px;
}

body.studio-shell .desktop-sidebar hr {
    border-color: rgba(241, 242, 244, 0.14);
}

body.studio-shell .section-label {
    margin-bottom: 9px;
    color: rgba(241, 242, 244, 0.42);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
}

body.studio-shell .desktop-sidebar details.group,
body.studio-shell .mobile-bar-content details.group {
    overflow: hidden;
    border: 1px solid rgba(241, 242, 244, 0.14);
    border-radius: 4px;
    padding: 0;
    background: rgba(241, 242, 244, 0.018);
}

body.studio-shell .desktop-sidebar details.group > summary,
body.studio-shell .mobile-bar-content details.group > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 !important;
    padding: 0 12px;
    color: rgba(241, 242, 244, 0.58);
    user-select: none;
}

body.studio-shell .desktop-sidebar details.group > summary::before,
body.studio-shell .mobile-bar-content details.group > summary::before {
    width: 3px;
    height: 14px;
    flex: 0 0 3px;
    content: "";
    background: rgba(127, 114, 174, 0.5);
}

body.studio-shell .desktop-sidebar details.group > summary > span:first-of-type,
body.studio-shell .mobile-bar-content details.group > summary > span:first-of-type {
    flex: 1;
}

body.studio-shell .desktop-sidebar details.group > summary .chevron,
body.studio-shell .mobile-bar-content details.group > summary .chevron {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(241, 242, 244, 0.12);
    border-radius: 3px;
    color: rgba(241, 242, 244, 0.52) !important;
    transform: rotate(-90deg);
}

body.studio-shell .desktop-sidebar details.group[open] > summary,
body.studio-shell .mobile-bar-content details.group[open] > summary {
    border-bottom: 1px solid rgba(241, 242, 244, 0.12);
    color: var(--paper);
}

body.studio-shell .desktop-sidebar details.group[open] > summary .chevron,
body.studio-shell .mobile-bar-content details.group[open] > summary .chevron {
    border-color: rgba(127, 114, 174, 0.55);
    color: var(--paper) !important;
    transform: rotate(0deg);
}

body.studio-shell .desktop-sidebar details.group > summary + div,
body.studio-shell .mobile-bar-content details.group > summary + div {
    margin: 0 !important;
    padding: 12px;
}

body.studio-shell .desktop-sidebar details.group > summary + textarea,
body.studio-shell .mobile-bar-content details.group > summary + textarea {
    width: calc(100% - 24px) !important;
    margin: 12px !important;
}

body.studio-shell .input-field,
body.studio-shell .select-styled {
    border: 1px solid rgba(241, 242, 244, 0.19);
    border-radius: 4px !important;
    background-color: #191c23;
    color: var(--paper);
    box-shadow: none;
}

body.studio-shell .input-field:hover,
body.studio-shell .select-styled:hover {
    border-color: rgba(241, 242, 244, 0.34);
}

body.studio-shell .input-field:focus,
body.studio-shell .select-styled:focus {
    border-color: var(--lime);
    background-color: #1d2028;
}

body.studio-shell .prompt-highlight-input {
    background: transparent;
    border: 0;
    color: transparent !important;
    caret-color: var(--paper);
    display: block;
    outline: 0;
    -webkit-text-fill-color: transparent;
}

body.studio-shell .prompt-highlight-layer,
body.studio-shell .prompt-highlight-input {
    width: 100%;
}

body.studio-shell .prompt-highlight-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    border: 1px solid rgba(241, 242, 244, 0.19);
    border-radius: 4px;
    background: #191c23;
    transition: border-color 150ms ease, background-color 150ms ease;
}

body.studio-shell .prompt-highlight-wrap:hover {
    border-color: rgba(241, 242, 244, 0.34);
}

body.studio-shell .prompt-highlight-wrap:focus-within {
    border-color: var(--lime);
    background: #1d2028;
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

body.studio-shell .prompt-highlight-layer {
    position: absolute;
    inset: 0 0 auto;
    z-index: 0;
    overflow: hidden;
    color: var(--paper);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    overflow-wrap: break-word;
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
    transition: none;
}

body.studio-shell .prompt-highlight-input {
    position: relative;
    z-index: 1;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    overflow-wrap: break-word;
}

body.studio-shell .prompt-highlight-input:focus {
    background: transparent;
    outline: 0;
}

body.studio-shell .prompt-highlight-input::placeholder {
    color: rgba(241, 242, 244, 0.3);
    -webkit-text-fill-color: rgba(241, 242, 244, 0.3);
}

body.studio-shell .meta-token-highlight {
    border-radius: 2px;
    background: rgba(127, 114, 174, 0.25);
    color: #c7bee7;
}

body.studio-shell .btn-primary {
    border: 1px solid var(--lime);
    border-radius: 4px !important;
    background: var(--lime);
    color: var(--paper);
    box-shadow: none;
}

body.studio-shell .btn-primary:hover:not(:disabled) {
    border-color: var(--paper);
    background: var(--paper);
    color: var(--ink);
    box-shadow: none;
    transform: translateY(-1px);
}

body.studio-shell .btn-secondary,
body.studio-shell .swap-btn,
body.studio-shell .aspect-btn,
body.studio-shell .profile-btn,
body.studio-shell .mobile-menu-toggle {
    border: 1px solid rgba(241, 242, 244, 0.18);
    border-radius: 4px !important;
    background: rgba(241, 242, 244, 0.035);
    color: rgba(241, 242, 244, 0.68);
    box-shadow: none;
}

body.studio-shell .btn-secondary:hover,
body.studio-shell .swap-btn:hover,
body.studio-shell .aspect-btn:hover,
body.studio-shell .profile-btn:hover,
body.studio-shell .mobile-menu-toggle:hover {
    border-color: rgba(241, 242, 244, 0.42);
    background: rgba(241, 242, 244, 0.07);
    color: var(--paper);
}

body.studio-shell .aspect-btn.active {
    border-color: var(--lime);
    background: rgba(127, 114, 174, 0.17);
    color: var(--paper);
}

body.studio-shell .glass-panel {
    border: 1px solid rgba(241, 242, 244, 0.16);
    border-radius: var(--radius) !important;
    background: rgba(18, 20, 26, 0.92);
    backdrop-filter: none;
    box-shadow: none;
}

body.studio-shell .char-block {
    border-radius: 4px;
    background: rgba(241, 242, 244, 0.025);
}

body.studio-shell .char-block.active {
    border-color: var(--lime);
    background: rgba(127, 114, 174, 0.12);
}

body.studio-shell #char-list-toggle,
body.studio-shell #mobile-char-list-toggle {
    min-height: 38px;
    justify-content: space-between;
    border: 1px solid rgba(241, 242, 244, 0.12);
    border-radius: 4px;
    padding: 0 12px;
    background: rgba(241, 242, 244, 0.018);
    color: rgba(241, 242, 244, 0.52) !important;
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
}

body.studio-shell #char-list-toggle:hover,
body.studio-shell #mobile-char-list-toggle:hover {
    border-color: rgba(241, 242, 244, 0.32);
    color: var(--paper) !important;
}

body.studio-shell #characters-section > .flex > button {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 3px;
}

body.studio-shell #characters-section > .flex > button:hover {
    border-color: rgba(241, 242, 244, 0.16);
    background: rgba(241, 242, 244, 0.035);
}

body.studio-shell .range-slider {
    height: 3px;
    border-radius: 0;
    background: rgba(241, 242, 244, 0.18);
}

body.studio-shell .range-slider::-webkit-slider-thumb {
    width: 13px;
    height: 13px;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    box-shadow: 0 0 0 1px rgba(241, 242, 244, 0.45);
}

body.studio-shell .main-content {
    position: relative;
    min-width: 0;
    background-color: var(--black);
    background-image:
        linear-gradient(rgba(241, 242, 244, 0.034) 1px, transparent 1px),
        linear-gradient(90deg, rgba(241, 242, 244, 0.034) 1px, transparent 1px);
    background-size: 72px 72px;
}

body.studio-shell .main-content::after {
    position: absolute;
    inset: 68px 0 0;
    z-index: 0;
    content: "";
    background: rgba(9, 10, 14, 0.57);
    pointer-events: none;
}

body.studio-shell .main-content > * {
    position: relative;
    z-index: 1;
}

.studio-empty-state {
    width: min(680px, 100%);
    color: var(--paper);
    text-align: left;
}

.studio-classification {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--lime);
    font-family: var(--font-mono);
    font-size: 10px;
}

.studio-classification::before {
    width: 30px;
    height: 1px;
    content: "";
    background: var(--lime);
}

.studio-empty-title {
    margin: 24px 0 0;
    font-size: clamp(42px, 5vw, 72px);
    font-weight: 600;
    line-height: 0.86;
}

.studio-empty-title span {
    display: block;
    margin-top: 14px;
    color: rgba(241, 242, 244, 0.46);
    font-family: var(--font-mono);
    font-size: clamp(12px, 1.5vw, 18px);
    font-weight: 400;
    line-height: 1.35;
}

.studio-dossier {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 36px 0 0;
    border-top: 1px solid rgba(241, 242, 244, 0.34);
    border-bottom: 1px solid rgba(241, 242, 244, 0.16);
}

.studio-dossier > div {
    min-width: 0;
    padding: 14px 16px 14px 0;
    border-right: 1px solid rgba(241, 242, 244, 0.12);
}

.studio-dossier > div + div {
    padding-left: 16px;
}

.studio-dossier > div:last-child {
    border-right: 0;
}

.studio-dossier dt,
.studio-dossier dd {
    margin: 0;
    font-family: var(--font-mono);
}

.studio-dossier dt {
    color: rgba(241, 242, 244, 0.34);
    font-size: 8px;
}

.studio-dossier dd {
    margin-top: 8px;
    overflow: hidden;
    color: rgba(241, 242, 244, 0.8);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.studio-shell .result-image {
    border: 1px solid rgba(241, 242, 244, 0.24);
    border-radius: 4px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

body.studio-shell .result-action-btn {
    border-color: rgba(241, 242, 244, 0.32) !important;
    border-radius: 3px !important;
    background: rgba(18, 20, 26, 0.94) !important;
    backdrop-filter: none;
}

body.studio-shell .result-action-btn:hover {
    border-color: var(--paper) !important;
    background: var(--paper) !important;
    color: var(--ink) !important;
}

body.studio-shell .progress-bar {
    height: 2px;
    border-radius: 0;
}

body.studio-shell .progress-fill {
    border-radius: 0;
    background: var(--lime);
}

body.studio-shell .generating {
    animation: none;
}

body.studio-shell .modal-content {
    border-radius: 6px;
    background: #171920;
    backdrop-filter: none;
}

body.studio-shell .profile-dropdown {
    position: relative;
}

body.studio-shell #login-btn-wrap > button,
body.studio-shell .profile-btn {
    height: var(--studio-control-height);
    min-height: var(--studio-control-height);
    border-radius: 4px !important;
    padding: 0 13px;
}

body.studio-shell .profile-btn {
    width: clamp(150px, 18vw, 212px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}

body.studio-shell #username-display {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.studio-shell .profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 100;
    display: none;
    width: 330px;
    min-width: 330px;
    padding: 18px;
    border: 1px solid rgba(241, 242, 244, 0.18);
    border-radius: 6px;
    background: #171920;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

body.studio-shell .profile-dropdown.open .profile-menu {
    display: block;
}

body.studio-shell .profile-header {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(241, 242, 244, 0.12);
}

body.studio-shell .profile-avatar {
    display: flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(127, 114, 174, 0.62);
    border-radius: 4px;
    background: rgba(127, 114, 174, 0.18);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
}

body.studio-shell .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.studio-shell .profile-identity {
    min-width: 0;
}

body.studio-shell .profile-name,
body.studio-shell .profile-tier {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.studio-shell .profile-name {
    color: var(--paper);
    font-size: 14px;
    font-weight: 600;
}

body.studio-shell .profile-tier {
    margin-top: 3px;
    color: rgba(241, 242, 244, 0.48);
    font-family: var(--font-mono);
    font-size: 10px;
}

body.studio-shell .quota-section {
    margin-bottom: 14px;
}

body.studio-shell .quota-title {
    margin-bottom: 8px;
    color: rgba(241, 242, 244, 0.38);
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
}

body.studio-shell .quota-item {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(241, 242, 244, 0.08);
}

body.studio-shell .quota-model,
body.studio-shell .quota-value {
    font-size: 12px;
}

body.studio-shell .quota-model {
    color: rgba(241, 242, 244, 0.72);
}

body.studio-shell .quota-value {
    font-family: var(--font-mono);
}

body.studio-shell .quota-value.unlimited {
    color: #65d99a;
}

body.studio-shell .quota-value.warning {
    color: var(--amber);
}

body.studio-shell .quota-value.danger,
body.studio-shell .profile-action-btn.danger {
    color: var(--signal);
}

body.studio-shell .quota-bar {
    height: 3px;
    margin-top: 4px;
    overflow: hidden;
    background: rgba(241, 242, 244, 0.1);
}

body.studio-shell .quota-bar-fill {
    height: 100%;
    background: var(--lime);
    transition: width 180ms ease;
}

body.studio-shell .quota-bar-fill.warning {
    background: var(--amber);
}

body.studio-shell .quota-bar-fill.danger {
    background: var(--signal);
}

body.studio-shell .profile-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(241, 242, 244, 0.12);
}

body.studio-shell .profile-action-btn {
    display: flex;
    width: 100%;
    height: 42px;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(241, 242, 244, 0.14);
    border-radius: 4px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 1;
    background: rgba(241, 242, 244, 0.025);
    color: var(--paper);
    cursor: pointer;
    white-space: nowrap;
}

body.studio-shell .profile-action-btn:hover {
    border-color: rgba(241, 242, 244, 0.36);
    background: rgba(241, 242, 244, 0.07);
}

body.studio-shell .profile-action-btn.danger:hover {
    border-color: rgba(223, 106, 87, 0.48);
    background: rgba(223, 106, 87, 0.1);
}

body.studio-shell .modal-overlay {
    background: rgba(9, 10, 14, 0.9);
    backdrop-filter: none;
}

body.studio-shell #gallery-grid {
    content-visibility: auto;
    contain: layout paint style;
}

body.studio-shell #gallery-grid > button {
    contain: layout paint;
    border-radius: 4px !important;
    transition: border-color 150ms ease, opacity 150ms ease, transform 150ms ease;
}

body.studio-shell #gallery-grid > button:hover {
    border-color: rgba(241, 242, 244, 0.52);
    opacity: 1 !important;
    transform: translateY(-2px);
}

body.studio-shell #gallery-grid img {
    display: block;
    contain: strict;
}

body.studio-shell .viewer-overlay {
    padding: 0;
    background-color: var(--black);
    background-image:
        linear-gradient(rgba(241, 242, 244, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(241, 242, 244, 0.035) 1px, transparent 1px);
    background-size: 72px 72px;
    isolation: isolate;
}

body.studio-shell .viewer-content {
    display: grid;
    width: 100vw;
    height: 100svh;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 0;
}

body.studio-shell .viewer-media {
    position: relative;
    display: flex;
    max-height: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-right: 1px solid rgba(241, 242, 244, 0.18);
    contain: layout paint;
    cursor: zoom-in;
    isolation: isolate;
    touch-action: none;
}

body.studio-shell .viewer-media.is-zoomed {
    cursor: grab;
}

body.studio-shell .viewer-media.is-dragging {
    cursor: grabbing;
}

body.studio-shell .viewer-image {
    max-width: calc(100% - 48px);
    max-height: calc(100svh - 48px);
    border: 1px solid rgba(241, 242, 244, 0.22);
    border-radius: 3px;
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: center center;
    user-select: none;
    will-change: transform;
    -webkit-user-drag: none;
}

.viewer-toolbar {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 220;
    display: flex;
    align-items: center;
    border: 1px solid rgba(241, 242, 244, 0.2);
    border-radius: 4px;
    background: rgba(18, 20, 26, 0.96);
}

.viewer-toolbar button {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid rgba(241, 242, 244, 0.14);
    background: transparent;
    color: rgba(241, 242, 244, 0.7);
    cursor: pointer;
}

.viewer-toolbar button:hover {
    background: var(--paper);
    color: var(--ink);
}

.viewer-zoom-label {
    min-width: 62px;
    padding: 0 10px;
    color: rgba(241, 242, 244, 0.62);
    font-family: var(--font-mono);
    font-size: 9px;
    text-align: center;
}

body.studio-shell .viewer-close {
    top: 16px;
    right: 16px;
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(241, 242, 244, 0.22);
    border-radius: 3px;
    padding: 0;
    background: rgba(18, 20, 26, 0.96);
    backdrop-filter: none;
}

body.studio-shell .viewer-close:hover {
    border-color: var(--paper);
    background: var(--paper);
    color: var(--ink);
    transform: none;
}

body.studio-shell .viewer-info {
    width: 100%;
    max-height: none;
    overflow: auto;
    border: 0;
    border-radius: 0;
    padding: 82px 20px 24px;
    background: rgba(18, 20, 26, 0.98);
    backdrop-filter: none;
    box-shadow: none;
}

body.studio-shell .viewer-prompt-card {
    border: 1px solid rgba(241, 242, 244, 0.16);
    border-radius: 4px;
    background: rgba(241, 242, 244, 0.035);
}

body.studio-shell .viewer-prompt-text {
    max-height: min(42svh, 360px);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.7;
}

body.studio-shell .viewer-meta {
    gap: 0;
    border-top: 1px solid rgba(241, 242, 244, 0.15);
    font-family: var(--font-mono);
    font-size: 9px;
}

body.studio-shell .viewer-meta span {
    padding: 10px 0;
    border-bottom: 1px solid rgba(241, 242, 244, 0.1);
}

body.studio-shell .viewer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.studio-shell .viewer-actions > * {
    width: 100% !important;
    min-width: 0;
}

body.studio-shell .mobile-bottom-bar {
    border-top-color: rgba(241, 242, 244, 0.18);
    background: rgba(18, 20, 26, 0.98);
}

body.studio-shell .mobile-generate-btn {
    border: 1px solid var(--lime);
    border-radius: 4px;
    background: var(--lime);
}

@media (max-width: 1040px) {
    .studio-system-status {
        display: none;
    }
}

@media (max-width: 768px) {
    body.studio-shell .desktop-sidebar {
        width: min(94vw, 360px) !important;
        max-width: 360px;
        flex-basis: auto;
    }

    body.studio-sidebar-collapsed .desktop-sidebar {
        width: min(94vw, 360px) !important;
        transform: translateX(-102%);
    }

    .studio-topbar {
        min-height: 58px;
        padding: 0 12px;
    }

    .studio-view-tabs {
        width: 100%;
        height: 58px;
        justify-content: space-around;
        gap: 0;
    }

    .studio-view-tabs .view-tab {
        flex: 1;
        justify-content: center;
        font-size: 9px;
    }

    .studio-topbar-actions {
        display: none;
    }

    .studio-empty-state {
        padding: 0 4px;
    }

    .studio-empty-title {
        font-size: clamp(38px, 13vw, 58px);
    }

    .studio-dossier {
        grid-template-columns: 1fr;
    }

    .studio-dossier > div,
    .studio-dossier > div + div {
        padding: 11px 0;
        border-right: 0;
        border-bottom: 1px solid rgba(241, 242, 244, 0.1);
    }

    .studio-dossier > div:last-child {
        border-bottom: 0;
    }

    body.studio-shell .viewer-content {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        overflow: hidden;
    }

    body.studio-shell .viewer-media {
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid rgba(241, 242, 244, 0.18);
    }

    body.studio-shell .viewer-image {
        max-width: calc(100% - 24px);
        max-height: calc(100svh - 300px);
    }

    body.studio-shell .viewer-info {
        max-height: 280px;
        padding: 18px 14px 20px;
    }

    .viewer-toolbar {
        top: 10px;
        left: 10px;
    }

    body.studio-shell .viewer-close {
        top: 10px;
        right: 10px;
    }

    body.studio-shell .viewer-prompt-text {
        max-height: 92px;
    }

    body.studio-shell #view-generate {
        padding: 22px 16px 110px;
    }

    body.studio-shell #view-director,
    body.studio-shell #view-gallery {
        padding: 16px 12px 110px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.studio-shell *,
    body.studio-shell *::before,
    body.studio-shell *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
