@import url("theme.css");

:root {
    color-scheme: dark;
    --bg: var(--jian-bg);
    --panel: var(--jian-panel);
    --panel-2: var(--jian-panel-raised);
    --soft: #202025;
    --soft-2: #292930;
    --ink: var(--jian-ink);
    --muted: var(--jian-muted);
    --line: var(--jian-line);
    --line-strong: var(--jian-accent-line);
    --brand: var(--jian-accent);
    --brand-dark: var(--jian-accent-text);
    --brand-soft: var(--jian-accent-soft);
    --danger: #ff6d95;
    --shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
    --text-xs: 10px;
    --text-sm: 11px;
    --text-body: 12px;
    --text-md: 13px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-page: 20px;
    --leading-tight: 1.25;
    --leading-title: 1.35;
    --leading-body: 1.65;
    --space-title-content: 12px;
    --space-section-block: 24px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: var(--text-body);
    letter-spacing: 0;
    line-height: var(--leading-body);
}

button,
input,
textarea {
    font: inherit;
}

input,
textarea,
[contenteditable="true"] {
    caret-color: #ffffff;
}

button {
    cursor: pointer;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.global-loading-backdrop {
    z-index: 1200;
    backdrop-filter: blur(18px);
    background: rgba(6, 7, 14, 0.78);
}

#appConfirmModal {
    z-index: 5400;
}

body.library-picker-open .global-loading-backdrop {
    z-index: 40;
}

.global-loading-modal {
    min-width: 320px;
    max-width: 420px;
    padding: 34px 30px 28px;
    border: 1px solid rgba(124, 108, 255, 0.22);
    border-radius: 28px;
    background:
        radial-gradient(circle at top, rgba(124, 108, 255, 0.22), transparent 55%),
        rgba(18, 19, 29, 0.96);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.34);
    text-align: center;
}

.global-loading-modal h2 {
    margin: 0 0 8px;
    font-size: 22px;
    line-height: 1.2;
}

.global-loading-modal p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.global-loading-spinner {
    position: relative;
    width: 74px;
    height: 74px;
    margin: 0 auto 18px;
}

.global-loading-spinner span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    animation: global-loading-spin 1.4s linear infinite;
}

.global-loading-spinner span:nth-child(1) {
    border-top-color: rgba(124, 108, 255, 0.95);
    border-right-color: rgba(124, 108, 255, 0.4);
}

.global-loading-spinner span:nth-child(2) {
    inset: 8px;
    border-top-color: rgba(168, 159, 255, 0.9);
    border-left-color: rgba(168, 159, 255, 0.34);
    animation-direction: reverse;
    animation-duration: 1.1s;
}

.global-loading-spinner span:nth-child(3) {
    inset: 18px;
    border-top-color: rgba(255, 255, 255, 0.95);
    border-right-color: rgba(255, 255, 255, 0.18);
    animation-duration: 0.85s;
}

@keyframes global-loading-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(90, 75, 243, 0.24);
    outline-offset: 2px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    min-height: 60px;
    height: auto;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(72, 76, 130, 0.045);
    backdrop-filter: blur(16px);
    overflow: visible;
}

.brand {
    display: inline-flex;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
}

.brand-logo {
    display: block;
    height: 39px;
    width: auto;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 12px;
    background: rgba(17, 19, 31, 0.92);
    color: #d9d4ff;
}

.mobile-modal-back {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 12px;
    background: rgba(17, 19, 31, 0.92);
    color: #d9d4ff;
}

.mobile-nav-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
}

.mobile-modal-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.generate-modal h3 
 {
  padding: 12px 0;

 }

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: clamp(2px, 0.55vw, 10px);
    margin-left: clamp(8px, 1vw, 16px);
    min-width: 0;
    overflow: visible;
}

.topbar-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 48%;
    overflow: visible;
    flex-wrap: wrap;
}

.main-nav > .nav-item {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    padding-inline: clamp(4px, 0.75vw, 12px);
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.topbar-actions > * {
    min-width: 0;
    max-width: 100%;
}

.topbar-actions .nav-item-utility {
    flex: 0 1 auto;
    max-width: 9ch;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.topbar-actions .auth-status {
    flex: 0 0 auto;
}

.topbar-actions .nav-exit-link {
    flex: 0 1 auto;
    min-width: auto;
    max-width: none;
    width: auto;
    padding: 0 4px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.topbar-actions .nav-exit-link svg {
    display: none;
}

body.auth-locked .topbar,
body.auth-locked .app-shell {
    visibility: hidden;
}

.auth-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.auth-status::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    min-width: 232px;
    height: 14px;
}

.auth-status-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(112, 120, 176, 0.18);
    border-radius: 999px;
    background: rgba(21, 23, 36, 0.96);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.auth-status-avatar svg {
    width: 24px;
    height: 24px;
    display: block;
}

.auth-status-points {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 2px;
    padding: 0 9px;
    border: 1px solid rgba(139, 120, 255, 0.42);
    border-radius: 999px;
    background: rgba(76, 61, 153, 0.24);
    color: #d9d2ff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.auth-status-copy .auth-status-popover-points {
    justify-self: start;
    margin-top: 3px;
    margin-left: 0;
}

.auth-status-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: grid;
    gap: 10px;
    min-width: 232px;
    padding: 12px;
    border: 1px solid rgba(151, 157, 210, 0.13);
    border-radius: 16px;
    background: rgba(18, 19, 29, 0.98);
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.34);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.auth-status:hover .auth-status-popover,
.auth-status.is-focus-open .auth-status-popover,
.auth-status.is-trial-preview .auth-status-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.auth-status-copy {
    display: grid;
    gap: 4px;
}

.auth-status-copy strong {
    font-size: 13px;
    line-height: 1.1;
    color: #eef1ff;
}

.auth-status-copy span {
    font-size: 11px;
    line-height: 1.1;
    color: #a7adc8;
}

.auth-status-copy .auth-status-trial {
    margin-top: 3px;
    padding-top: 7px;
    border-top: 1px solid rgba(151, 157, 210, 0.13);
    color: #f0c96d;
    font-weight: 700;
}

.auth-logout-btn {
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: rgba(151, 157, 210, 0.08);
    color: #a7adc8;
    font-size: 11px;
    font-weight: 700;
}

.auth-status-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.auth-redeem-btn {
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(141, 123, 255, 0.42);
    border-radius: 8px;
    background: rgba(124, 108, 255, 0.14);
    color: #d7d1ff;
    font-size: 11px;
    font-weight: 800;
}

.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background:
        linear-gradient(180deg, rgba(4, 5, 10, 0.68), rgba(4, 5, 10, 0.82)),
        url("../img_static/texture-bg.png") center center / cover no-repeat;
    backdrop-filter: blur(10px);
}

.auth-backdrop.is-hidden {
    display: none;
}

.auth-modal {
    width: min(420px, calc(100vw - 32px));
    padding: 28px 28px 26px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(18, 21, 34, 0.96), rgba(24, 27, 44, 0.96));
    border: 1px solid rgba(132, 145, 255, 0.18);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.nav-item-beta {
    position: relative;
    overflow: visible;
    color: #b9adff;
    background: transparent;
    box-shadow: none;
}

.nav-item-beta:hover {
    color: #d8d4ff;
    background: transparent;
}

.nav-item-beta i {
    position: absolute;
    top: 2px;
    right: 1px;
    display: grid;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    min-height: 12px;
    border-radius: 999px;
    padding: 0 4px;
    background: #ff335f;
    color: #ffffff;
    font-size: 7px;
    text-transform: uppercase;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    transform: translate(42%, -42%);
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(255, 51, 95, 0.32);
}

.nav-item-beta.is-active {
    color: #d8d4ff;
    background: transparent;
    box-shadow: none;
}

.nav-item-beta.is-active::after {
    background: #8d7bff;
}

.nav-item-beta.nav-item-coming-soon,
.nav-item-beta.nav-item-coming-soon:hover,
.nav-item-beta.nav-item-coming-soon:disabled {
    color: #676a7c;
    background: transparent;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.72;
}

.nav-item-coming-soon i {
    background: #ff335f;
    color: #fff;
}

.assistant-frame-view,
.studio3d-frame-view,
.director-frame-view,
.infinite-canvas-frame-view {
    min-height: calc(100vh - 112px);
    padding: 18px;
}

.assistant-frame-view iframe,
.studio3d-frame-view iframe,
.director-frame-view iframe,
.infinite-canvas-frame-view iframe {
    display: block;
    width: 100%;
    height: calc(100vh - 132px);
    min-height: 640px;
    border: 1px solid rgba(134, 124, 255, 0.16);
    border-radius: 8px;
    background: #080a12;
}

.director-frame-view {
    height: calc(100vh - 60px);
    min-height: 0;
    padding: 8px;
    overflow: hidden;
}

.director-frame-view iframe {
    height: 100%;
    min-height: 0;
}

body.assistant-fullscreen {
    overflow: hidden;
}

body.assistant-fullscreen .topbar {
    position: sticky;
    top: 0;
}

body.assistant-fullscreen .app-shell {
    height: calc(100vh - 60px);
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

body.assistant-fullscreen .assistant-frame-view,
body.assistant-fullscreen .studio3d-frame-view,
body.assistant-fullscreen .director-frame-view,
body.assistant-fullscreen .infinite-canvas-frame-view {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

body.assistant-fullscreen .assistant-frame-view iframe,
body.assistant-fullscreen .studio3d-frame-view iframe,
body.assistant-fullscreen .director-frame-view iframe,
body.assistant-fullscreen .infinite-canvas-frame-view iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
}

.pose-panorama-picker {
    width: min(760px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 32px));
    border: 2px solid rgba(190, 151, 255, 0.92);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(231, 209, 255, 0.18);
}

.auth-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 16px;
}

.auth-logo {
    display: block;
    width: auto;
    height: 42px;
}

.auth-modal h2 {
    margin: 0 0 8px;
    color: #f4f6ff;
    font-size: 24px;
}

.auth-modal-subtitle {
    margin: 0 0 20px;
    color: #aeb6dc;
    font-size: 13px;
    line-height: 1.7;
}

.auth-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.auth-mode-tabs button {
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(9, 12, 22, 0.78);
    color: #b8c2e8;
    font-size: 13px;
    font-weight: 800;
}

.auth-mode-tabs button.is-active {
    background: linear-gradient(135deg, #6f5cff, #8d7bff);
    color: #fff;
}

.auth-field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-field span {
    color: #edf1ff;
    font-size: 13px;
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(132, 145, 255, 0.18);
    border-radius: 14px;
    background: rgba(9, 12, 22, 0.88);
    color: #f4f6ff;
}

.auth-code-field {
    margin-bottom: 12px;
}

.auth-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
}

.auth-code-row button {
    height: 46px;
    border: 1px solid rgba(132, 145, 255, 0.22);
    border-radius: 14px;
    background: rgba(111, 92, 255, 0.15);
    color: #cfc8ff;
    font-size: 12px;
    font-weight: 800;
}

.auth-code-row button:disabled {
    opacity: 0.52;
    cursor: not-allowed;
}

.auth-forgot-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 12px;
}

.auth-forgot-row button {
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(191, 199, 232, 0.58);
    font-size: 12px;
    font-weight: 700;
}

.auth-forgot-row button:hover {
    color: #cfc8ff;
}

.auth-error {
    margin: 2px 0 14px;
    color: #ffb3b8;
    font-size: 13px;
    line-height: 1.6;
}

.auth-login-extra {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.auth-hint-text {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(53, 58, 92, 0.38);
    color: #dce4ff;
    font-size: 12px;
    line-height: 1.7;
}

.auth-login-btn {
    width: 100%;
    height: 46px;
    border-radius: 14px;
}

.nav-item-utility {
    min-width: auto;
    padding: 0 16px;
    flex: 0 0 auto;
}

.nav-item-settings {
    position: relative;
}

.settings-update-dot {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff4968;
    box-shadow: 0 0 0 2px rgba(10, 11, 17, 0.96), 0 0 8px rgba(255, 73, 104, 0.6);
    pointer-events: none;
}

.settings-update-dot.is-hidden {
    display: none;
}

.nav-task-status {
    position: relative;
    flex: 0 0 auto;
    z-index: 30;
}

.nav-task-status.is-hidden {
    display: none;
}

.nav-task-trigger {
    min-width: 116px;
    max-width: 168px;
    min-height: 40px;
    gap: 4px;
    padding: 0 21px 0 9px;
    border-radius: 999px;
    border-color: rgba(90, 75, 243, 0.14);
    background: rgba(90, 75, 243, 0.06);
    box-shadow: none;
    align-items: center;
}

.nav-task-trigger:hover {
    border-color: rgba(90, 75, 243, 0.22);
    background: rgba(90, 75, 243, 0.09);
}

.nav-task-status .library-task-summary {
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-task-status .library-task-glow {
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-task-popover {
    left: 0;
    right: auto;
    width: min(360px, calc(100vw - 32px));
}

.nav-item {
    position: relative;
    min-width: 70px;
    height: 40px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: #20243c;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.nav-item.is-active {
    color: var(--brand-dark);
    background: rgba(90, 75, 243, 0.065);
    box-shadow: 0 18px 34px rgba(90, 75, 243, 0.17);
}

.nav-item.is-nav-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.nav-item.is-active::after {
    content: "";
    position: absolute;
    left: 25px;
    right: 25px;
    bottom: 3px;
    height: 2px;
    border-radius: 999px;
    background: var(--brand);
}

.back-link svg,
.more svg,
.host-pill svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-exit-link {
       display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #7570eb;
    font-size: 13px;
    font-weight: 800;
   
}

.director-frame-host-picker {
    display: inline-flex;
    min-width: 216px;
    max-width: 280px;
    height: 34px;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
    padding: 0 8px;
    border: 1px solid rgba(124, 108, 255, 0.28);
    border-radius: 9px;
    background: rgba(20, 19, 39, 0.92);
    color: #c9c5e8;
}
.director-frame-host-picker.is-hidden { display: none; }
.director-frame-host-label {
    flex: 0 0 auto;
    color: #aaa5c9;
    font-size: 11px;
    white-space: nowrap;
}
.director-frame-host-picker select {
    min-width: 0;
    max-width: 145px;
    height: 26px;
    padding: 0 20px 0 5px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f3f0ff;
    font-size: 11px;
    text-overflow: ellipsis;
    cursor: pointer;
}
.director-frame-host-picker select:focus { color: #fff; }
.director-frame-host-picker select option { background: #17162a; color: #f3f0ff; }
.director-frame-host-status {
    min-width: 0;
    overflow: hidden;
    color: #8f8aa8;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.director-frame-host-status.is-ready { color: #6fd39b; }
.director-frame-host-status.is-busy { color: #e6c878; }
.director-frame-host-status.is-error { color: #e58b99; }

.nav-exit-link svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-exit-link:hover {
    background: transparent;
    border-color: transparent;
    color: #5a4bf3;
}

.nav-refresh-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #7570eb;
    flex: 0 0 auto;
}

.nav-refresh-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-refresh-link:hover {
    color: #665ff0;
}

.nav-task-stack {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: min(58vw, 760px);
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.nav-task-stack::-webkit-scrollbar {
    display: none;
}

.nav-task-pill {
    display: inline-grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 6px;
    min-width: 220px;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid rgba(111, 92, 255, 0.2);
    border-radius: 16px;
    background: rgba(17, 19, 30, 0.92);
    color: #f2efff;
    box-shadow: 0 16px 34px rgba(15, 15, 32, 0.28);
    cursor: pointer;
}

.nav-task-pill--compact {
    flex: 0 0 228px;
    min-width: 228px;
    max-width: 228px;
    padding: 8px 10px;
    border-radius: 14px;
    column-gap: 10px;
}

.nav-task-pill:hover {
    border-color: rgba(111, 92, 255, 0.34);
    background: rgba(21, 23, 37, 0.98);
}

.nav-task-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.nav-task-copy strong {
    color: #f7f4ff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-task-copy span {
    color: rgba(224, 218, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-task-percent {
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.nav-task-track {
    grid-column: 1 / -1;
    display: block;
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
        rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-task-track span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)),
        linear-gradient(90deg, #6f5cff, #b6a8ff, #51d6ff);
    box-shadow: 0 0 16px rgba(111, 92, 255, 0.5), 0 0 28px rgba(81, 214, 255, 0.22);
}

.app-shell {
    padding: 20px 20px 64px;
}

.studio-view > .back-link {
    display: none;
}

.studio-view > .resource-band {
    display: none;
}

.project-home h1 {
    margin: 34px 0 68px;
    text-align: center;
    font-size: var(--text-page);
    font-weight: 800;
    line-height: var(--leading-title);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 24px;
}

.project-new,
.project-card {
    min-height: 188px;
    border-radius: 8px;
    background: #fff;
}

.project-new {
    display: grid;
    place-items: center;
    border: 3px dashed #e3e1ff;
    color: #beb8ff;
}

.project-new span,
.add-shot {
    font-size: 36px;
    font-weight: 200;
    line-height: 1;
}

.project-card {
    position: relative;
    padding: 22px 24px;
    border: 1px solid #f0f0fb;
    text-align: left;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.project-card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 116px;
}

.project-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: var(--text-lg);
    line-height: var(--leading-title);
}

.project-card span {
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.project-card:hover {
    border-color: rgba(90, 75, 243, 0.18);
    box-shadow: 0 18px 32px rgba(90, 75, 243, 0.08);
}

.project-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.project-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand);
    font-size: var(--text-body);
    font-weight: 700;
}

.project-link-danger {
    color: #ff8cab;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 20px;
    border: 0;
    background: transparent;
    color: #2d314c;
    font-size: var(--text-md);
    font-weight: 700;
    line-height: var(--leading-tight);
}

.workspace-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.workspace-head .back-link {
    margin-bottom: 0;
}

.ghost-btn {
    
    padding: 5px 16px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.08);
    color: var(--brand-dark);
    font-size: var(--text-sm);
    font-weight: 800;
}

.resource-band,
.story-band,
.library-panel {
    border: 0;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(77, 80, 140, 0.055);
}

.resource-band {
    min-height: 232px;
    padding: 20px 27px 14px;
    margin-bottom: 14px;
}

.resource-band h2,
.story-band h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 800;
    line-height: var(--leading-title);
}

.resource-band h2 {
    margin-bottom: 10px;
}

.library-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    min-height: 48px;
    border-bottom: 1px solid #eeeffb;
}

.library-tabs.compact {
    border-radius: 8px;
    border-bottom: 0;
    background: #fff;
    overflow: visible;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.library-tabs .tab:not(.more) {
    min-width: 108px;
    padding: 0 16px;
}

.library-tabs.compact .tab:not(.more) {
    min-width: 86px;
    padding: 0 12px;
}

.library-tabs .tab.more {
    margin-left: auto;
    min-width: 96px;
    padding: 0 12px;
}

.tab,
.fold {
    position: relative;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: #3f435a;
    font-size: 13px;
    font-weight: 800;
}

.library-tabs.compact .tab.is-active {
    background: var(--brand);
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 6px 14px rgba(75, 63, 220, 0.18);
}

.library-panel .tab.is-active {
    color: var(--brand);
}

.library-panel .tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--brand);
}

.more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.fold {
    margin-left: 10px;
    border-radius: 999px;
    background: #f0effc;
    color: var(--brand);
}

.resource-row,
.library-grid {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding-top: 0;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    padding: 24px 14px 0;
}

.resource-tile,
.asset-card {
    position: relative;
    border: 0;
    border-radius: 7px;
    background: #fff;
    text-align: center;
}

.resource-tile {
    width: 104px;
    min-height: 116px;
}

.resource-tile img,
.asset-card img {
    display: block;
    width: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.resource-tile img {
    cursor: zoom-in;
}

.resource-tile img {
    height: 78px;
    border-radius: 7px;
}

.asset-card img {
    height: 236px;
}

.asset-zoom {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: zoom-in;
}

.asset-card .asset-media.audio {
    display: grid;
    place-items: center;
    height: 236px;
    border-radius: 8px;
    background: #f5f5ff;
    color: #b6b0ff;
}

.resource-tile .asset-media.audio {
    display: grid;
    place-items: center;
    width: 100%;
    height: 78px;
    border-radius: 7px;
    background: #f5f5ff;
    color: #b6b0ff;
    overflow: hidden;
}

.resource-tile .asset-media.audio video,
.asset-card .asset-media.audio video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    background: rgba(8, 10, 18, 0.82);
}

.resource-tile strong,
.asset-card strong {
    display: block;
    padding-top: 9px;
    color: #172033;
    font-size: 13px;
    font-weight: 800;
    line-height: var(--leading-title);
}

.asset-name-wrap {
    padding-top: 9px;
}

.asset-name-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.asset-edit-link {
    flex: 0 0 auto;
    font-size: 11px;
}

.asset-icon-btn,
.asset-download-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #7e88b8;
    padding: 0;
    transition: color 0.18s ease, background 0.18s ease;
}

.asset-icon-btn:hover,
.asset-download-inline:hover {
    color: #edf0ff;
    background: rgba(80, 85, 146, 0.18);
}

.asset-download-inline svg,
.asset-download-fab svg {
    width: 14px;
    height: 14px;
    display: block;
}

.asset-action-spacer {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
}

.asset-name-input-inline {
    flex: 1;
    min-width: 0;
    text-align: left;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #aeb4d3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-name-input-inline-centered {
    text-align: center;
}

.resource-tile:hover .asset-name-input-inline,
.asset-card:hover .asset-name-input-inline {
    background: transparent;
    color: #edf0ff;
    border-color: transparent;
}

.asset-name-input-inline:focus {
    padding: 2px 4px;
    border-radius: 6px;
    border: 1px solid rgba(43, 96, 255, 0.36);
    background: rgba(80, 85, 146, 0.2);
    box-shadow: 0 0 0 3px rgba(43, 96, 255, 0.1);
}

.asset-name-input {
    width: 100%;
    border: 1px solid rgba(31, 45, 74, 0.08);
    border-radius: 6px;
    background: rgb(18 19 29);
    color: #747293;
    font-size: 13px;
    font-weight: 800;
    line-height: var(--leading-title);
    text-align: center;
    padding: 4px 6px;
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.resource-tile:hover .asset-name-input,
.asset-card:hover .asset-name-input {
    border-color: rgba(43, 96, 255, 0.28);
    background: #505592;
    color: #0f1728;
}

.asset-name-input:focus {
    border-color: rgba(43, 96, 255, 0.46);
    background: #505592;
    box-shadow: 0 0 0 3px rgba(43, 96, 255, 0.14);
}

.asset-name-input::placeholder {
    color: #6d768a;
}

.resource-tile:hover strong,
.asset-card:hover strong {
    color: #111a2c;
}


.resource-add,
.asset-add {
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: #f4f4fc;
    color: var(--brand);
}

.resource-add {
    width: 108px;
    min-height: 116px;
}

.asset-add {
    min-height: 236px;
}

.asset-add-actions {
    align-content: center;
    gap: 16px;
    padding: 20px 18px;
    text-align: center;
}

.asset-add-icon {
    font-size: 48px;
    font-weight: 200;
    line-height: 1;
}

.asset-add-buttons {
    display: grid;
    gap: 10px;
    width: 100%;
}

.asset-add-btn {
    width: 100%;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(72, 86, 168, 0.16);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.asset-add-btn:hover {
    transform: translateY(-1px);
}

.asset-add-btn-primary {
    border: 1px solid #616a9e;
    background: none;
    color: #fff;
    box-shadow: 0 10px 24px rgba(80, 102, 255, 0.22);
}

.asset-add-btn-secondary {
 border: 1px solid #616a9e;
    background: none;
    color: #fff;
    box-shadow: 0 10px 24px rgba(80, 102, 255, 0.22);
}

.resource-add span,
.asset-add span {
    font-size: 48px;
    font-weight: 200;
}

.remove-x {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    border: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
}

.asset-download-fab {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(15, 16, 28, 0.84);
    color: #f7f5ff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.asset-download-fab-audio {
    right: 10px;
    bottom: 10px;
}

.asset-remove {
    top: 10px;
    right: 10px;
    line-height: 0px;
    font-weight: bold;
    color: #fff;
}

.story-band {
    padding: 24px 26px 28px;
}

.basic-script-band {
    margin-bottom: 16px;
}

.basic-script-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding-bottom: 12px;
}

.basic-script-head h2 {
    flex: 0 0 auto;
    margin-right: 0;
}

.basic-script-head .storyboard-to-animation-btn {
    margin-left: auto;
    flex: 0 0 auto;
    min-width: 0;
}

.basic-script-exit-btn {
    flex: 0 0 auto;
    min-width: 132px;
    height: 36px;
    padding: 0 13px;
    border-color: rgba(132, 112, 255, 0.58);
    background: rgba(93, 72, 190, 0.12);
    color: #d7d0ff;
}

.basic-script-exit-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.basic-script-exit-btn:hover:not(:disabled) {
    border-color: #8c79ff;
    background: rgba(111, 87, 226, 0.22);
    color: #ffffff;
}

.storyboard-pages-band {
    margin-bottom: 16px;
}

.storyboard-progress-hub {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    min-height: 64px;
    margin: 0 0 16px;
    padding: 8px 12px;
    border: 1px solid rgba(122, 111, 210, 0.32);
    border-radius: 8px;
    background: rgba(18, 18, 31, 0.92);
    overflow: hidden;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.storyboard-progress-hub.is-complete {
    border-color: rgba(151, 124, 255, 0.9);
    background: rgba(54, 39, 116, 0.2);
    box-shadow: inset 0 0 0 1px rgba(151, 124, 255, 0.14);
}

.storyboard-progress-hub.is-error {
    border-color: rgba(207, 88, 112, 0.62);
    background: rgba(91, 29, 44, 0.16);
}

.storyboard-progress-hub.is-paused {
    border-color: rgba(206, 158, 76, 0.54);
}

.storyboard-progress-hub-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.storyboard-progress-hub-title strong {
    color: #f2efff;
    font-size: 13px;
    white-space: nowrap;
}

.storyboard-progress-hub-title strong::before {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: #806cff;
    box-shadow: 0 0 8px rgba(128, 108, 255, 0.72);
    content: "";
    vertical-align: 1px;
}

.storyboard-progress-hub-title span {
    overflow: hidden;
    max-width: 100%;
    color: #928dac;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-progress-hub.is-complete .storyboard-progress-hub-title strong,
.storyboard-progress-hub.is-complete .storyboard-progress-hub-title span {
    color: #c9baff;
}

.storyboard-progress-hub.is-complete .storyboard-progress-hub-title strong::before {
    background: #35d98a;
    box-shadow: 0 0 8px rgba(53, 217, 138, 0.62);
}

.storyboard-progress-hub-content {
    display: grid;
    align-items: center;
    min-width: 0;
}

.storyboard-pages-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    min-width: 0;
}

.storyboard-pages-head h2 {
    flex: 0 0 auto;
    margin: 0;
}

.storyboard-pages-head .storyboard-chapter-tabs {
    flex: 1 1 auto;
}

.storyboard-pages-export-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    margin-left: auto;
}

.storyboard-pages-export-actions .storyboard-export-btn {
    width: auto;
    min-width: 118px;
    height: 36px;
    padding: 0 15px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
}

.storyboard-pages-export-actions .storyboard-to-director-btn {
    border-color: rgba(120, 104, 246, .5);
    color: #d8d3ff;
}

.storyboard-export-options-modal,
.story-video-batch-complete-modal {
    width: min(520px, calc(100vw - 32px));
}

.storyboard-export-options-modal {
    box-sizing: border-box;
    padding: 58px 34px 28px;
}

.storyboard-export-options-modal > p {
    margin: 0 0 22px;
    line-height: 1.7;
    color: var(--muted);
    text-align: center;
}

.storyboard-export-options-list {
    display: grid;
    gap: 10px;
    width: 100%;
}

.storyboard-export-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid rgba(151, 143, 255, .18);
    border-radius: 10px;
    background: rgba(24, 25, 38, .72);
    color: var(--text-primary, #f3f0ff);
    cursor: pointer;
}

.storyboard-export-option-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    flex: 0 0 20px;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(190, 184, 255, .65);
    border-radius: 5px;
    background: rgba(11, 12, 23, .72);
    cursor: pointer;
}

.storyboard-export-option-row input[type="checkbox"]:checked {
    border-color: #8067ff;
    background: #8067ff;
    box-shadow: 0 0 0 3px rgba(128, 103, 255, .16);
}

.storyboard-export-option-row input[type="checkbox"]:checked::after {
    content: "";
    display: block;
    width: 5px;
    height: 10px;
    margin: 2px 0 0 6px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.storyboard-export-scale-select {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    margin: 12px 0 8px;
    padding: 0 14px;
}

.storyboard-export-options-modal .modal-actions {
    margin: 24px 0 0;
}

.storyboard-automation-bar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 30px minmax(0, 1fr) 30px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    width: 90%;
    margin: -6px auto 18px;
    padding-right: 76px;
}

.storyboard-automation-column {
    min-width: 0;
}

.storyboard-automation-materials {
    grid-column: 4;
}

.storyboard-automation-videos {
    grid-column: 6;
}

.storyboard-video-batch-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.storyboard-material-batch-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.storyboard-import-assets-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 76px !important;
    padding-inline: 12px !important;
}

.storyboard-media-mode-tabs {
    display: inline-flex;
    align-items: stretch;
    min-width: 0;
    border-bottom: 1px solid rgba(139, 124, 239, 0.28);
}

.storyboard-shot-image-action {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    width: 100%;
    margin-left: 0;
    min-width: 0;
}

.storyboard-media-mode-radios {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
    min-width: 0;
}

.storyboard-media-mode-radio {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
}

.storyboard-media-mode-radio input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--brand);
}

.storyboard-media-mode-radio:has(input:checked) {
    color: var(--ink);
    font-weight: 800;
}

.storyboard-media-mode-radio:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.48;
}

.storyboard-reextract-assets-btn {
    flex: 0 0 auto !important;
    min-width: 76px !important;
    padding-inline: 12px !important;
    white-space: nowrap;
}

.story-batch-gen-bar.is-panel-actions .storyboard-reextract-assets-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    line-height: 1;
}

.story-batch-gen-bar.is-panel-actions .storyboard-reextract-assets-btn .story-automation-action-icon {
    align-self: center;
    margin: 0;
}

.story-batch-gen-bar.is-panel-actions .storyboard-reextract-assets-btn .tone-tool-label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    line-height: 1;
}

.storyboard-shot-image-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 118px;
    padding: 8px 12px;
    border: 1px solid rgba(139, 124, 239, 0.45);
    border-radius: 7px;
    background: #24233b;
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.storyboard-shot-image-btn:hover:not(:disabled) {
    border-color: var(--brand);
    background: #2b2947;
}

.storyboard-shot-image-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.storyboard-shot-image-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    color: #fff;
    line-height: 1;
}

.storyboard-shot-image-arrow svg {
    width: 24px;
    height: 24px;
}

.storyboard-media-mode-select {
    width: 142px;
    min-width: 0;
    padding: 8px 24px 8px 9px;
    border: 1px solid rgba(139, 124, 239, 0.38);
    border-radius: 7px;
    background: #151525;
    color: var(--ink);
    font-size: 11px;
}

.storyboard-media-mode-select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.storyboard-shot-media-panel {
    min-width: 0;
}

.storyboard-shot-media-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(139, 124, 239, 0.28);
}

.storyboard-shot-media-tab {
    position: relative;
    padding: 5px 8px 7px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
}

.storyboard-shot-media-tab::after {
    content: "";
    position: absolute;
    right: 7px;
    bottom: -1px;
    left: 7px;
    height: 2px;
    background: transparent;
}

.storyboard-shot-media-tab.is-active {
    color: var(--ink);
}

.storyboard-shot-media-tab.is-active::after {
    background: var(--brand);
}

.storyboard-shot-media-tab:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.storyboard-generated-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-height: 140px;
}

.storyboard-generated-image-card {
    min-width: 0;
    padding: 5px;
    border: 1px solid rgba(139, 124, 239, 0.22);
    border-radius: 6px;
    background: #10101c;
}

.storyboard-generated-image-card.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px rgba(139, 124, 239, 0.35);
}

.storyboard-shot-image-status {
    display: block;
    min-width: 0;
    margin: 0 0 7px;
    padding: 5px 7px;
    border: 1px solid rgba(139, 124, 239, 0.24);
    border-radius: 5px;
    background: rgba(17, 17, 29, 0.86);
    color: var(--ink);
    font-size: 10px;
}

.storyboard-shot-image-status-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.storyboard-shot-image-status i {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #8c86a9;
}

.storyboard-shot-image-status.is-working i {
    background: #f0b56b;
    box-shadow: 0 0 0 3px rgba(240, 181, 107, 0.12);
}

.storyboard-shot-image-status.is-complete i {
    background: #65cf9a;
}

.storyboard-shot-image-status.is-error i {
    background: #e78292;
}

.storyboard-shot-image-status strong {
    flex: 0 0 auto;
}

.storyboard-shot-image-status small {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-shot-image-status-track {
    height: 3px;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(139, 124, 239, 0.2);
}

.storyboard-shot-image-status-track span {
    display: block;
    height: 100%;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6354df 0%, #a998ff 45%, #e0d9ff 55%, #7566ef 100%);
    transform: translateX(-120%);
}

.storyboard-shot-image-status-track.is-active span {
    animation: storyboard-shot-image-progress 1.35s linear infinite;
}

@keyframes storyboard-shot-image-progress {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

.storyboard-generated-image-empty {
    position: relative;
}

.storyboard-generated-image-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 8px;
    min-height: 178px;
    padding: 8px;
    border: 1px dashed rgba(139, 124, 239, 0.42);
    border-radius: 6px;
    /* Keep the complete preview surface black, including the thumbnail rail. */
    background: #050509;
}

.storyboard-generated-image-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.storyboard-generated-image-actions .shot-action {
    min-width: 88px;
}

.storyboard-generated-image-main {
    min-width: 0;
    min-height: 0;
    background: #050509;
}

.storyboard-generated-image-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 162px;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: #050509;
    color: var(--ink);
    cursor: pointer;
}

.storyboard-generated-image-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.storyboard-generated-image-stage.is-generating {
    flex-direction: column;
    gap: 14px;
    cursor: default;
}

.storyboard-generated-image-stage.is-generating .storyboard-shot-image-status {
    width: min(82%, 360px);
    margin: 0;
}

.storyboard-generated-image-rail {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    max-height: 162px;
    overflow-y: auto;
    background: #050509;
}

.storyboard-generated-image-thumb {
    position: relative;
    display: block;
    flex: 0 0 45px;
    width: 48px;
    height: 45px;
    padding: 2px;
    overflow: hidden;
    border: 1px solid rgba(139, 124, 239, 0.22);
    border-radius: 4px;
    background: #10101c;
    cursor: pointer;
}

.storyboard-generated-image-thumb.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px rgba(139, 124, 239, 0.42);
}

.storyboard-generated-image-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.storyboard-generated-image-thumb span {
    position: absolute;
    right: 2px;
    bottom: 2px;
    left: 2px;
    padding: 2px 0;
    background: rgba(56, 42, 142, 0.86);
    color: #fff;
    font-size: 8px;
    line-height: 1;
    text-align: center;
}

.storyboard-generated-image-board .empty-media {
    width: 100%;
    height: 100%;
}

.storyboard-generated-image-card .shot-image-preview {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 0;
    border-radius: 4px;
    background: #080810;
}

.storyboard-generated-image-card .shot-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.storyboard-generated-image-select {
    width: 100%;
    margin-top: 5px;
    padding: 4px 5px;
    border: 1px solid rgba(139, 124, 239, 0.3);
    border-radius: 4px;
    background: transparent;
    color: var(--ink);
    font-size: 10px;
    cursor: pointer;
}

.storyboard-media-mode-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 8px 10px 9px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.storyboard-media-mode-tab::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: -1px;
    left: 10px;
    height: 2px;
    background: transparent;
}

.storyboard-media-mode-tab.is-active {
    color: var(--ink);
}

.storyboard-media-mode-tab.is-active::after {
    background: var(--brand);
}

.storyboard-media-mode-tab .tone-tool-vip {
    display: inline-flex;
    width: 13px;
    height: 13px;
}

.storyboard-media-mode-tab .tone-tool-vip svg {
    width: 13px;
    height: 13px;
}

.storyboard-material-batch-actions #assignAllStoryAssetsBtn,
.storyboard-material-batch-actions #generateAllStoryImagesBtn {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding-inline: 10px;
    white-space: nowrap;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.storyboard-material-batch-actions #generateAllStoryImagesBtn {
    width: auto;
    max-width: none;
}

.storyboard-material-batch-actions #assignAllStoryAssetsBtn.storyboard-import-assets-btn {
    width: auto;
    max-width: none;
}

.storyboard-material-batch-actions #assignAllStoryAssetsBtn {
    flex: none;
}

.storyboard-material-batch-actions #generateAllStoryImagesBtn {
    flex: none;
    background: #1b1c2d;
    border: 1px solid rgba(139, 124, 239, 0.34);
    color: #b9b5d2;
    box-shadow: none;
    font-size: 11px;
}

.story-workflow-step {
    position: relative;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

body :is(#storyWriterGenerateBtn, #agentGenerateStoryboardBtn, #storyAssetBatchGenBtn,
    #generateAllStoryVideosBtn) {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
    box-shadow: none !important;
}

body :is(#assignAllStoryAssetsBtn, #generateAllStoryImagesBtn) {
    background: var(--soft-2) !important;
    border-color: var(--line-strong) !important;
    color: var(--ink) !important;
    box-shadow: none !important;
}

body #generateAllStoryImagesBtn.storyboard-media-mode-tab {
    width: auto;
    min-width: 0;
    padding: 8px 10px 9px;
    border: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0;
    background: transparent !important;
    color: var(--muted) !important;
    box-shadow: none !important;
    font-size: 12px;
}

body #generateAllStoryImagesBtn.storyboard-media-mode-tab.is-active {
    color: var(--ink) !important;
}

body #generateAllStoryImagesBtn.storyboard-shot-image-btn {
    width: auto !important;
    min-width: 118px !important;
    padding: 8px 12px !important;
    border: 1px solid rgba(139, 124, 239, 0.45) !important;
    border-radius: 7px;
    background: var(--jian-button-fill) !important;
    color: #fff !important;
    font-size: 12px;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn,
.storyboard-video-batch-actions #generateAllStoryVideosBtn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
    white-space: nowrap;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.storyboard-video-batch-actions .story-video-batch-quick-cancel {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(239, 121, 139, 0.55);
    border-radius: 8px;
    background: rgba(104, 37, 52, 0.32);
    color: #ff9cac;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.storyboard-video-batch-actions .story-video-batch-quick-cancel:hover {
    background: rgba(142, 48, 68, 0.48);
    border-color: rgba(255, 142, 160, 0.82);
    color: #ffd3da;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn svg,
.storyboard-video-batch-actions #generateAllStoryVideosBtn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: #fff;
    fill: #fff;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn > span,
.storyboard-video-batch-actions #generateAllStoryVideosBtn > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn .tone-tool-vip,
.storyboard-video-batch-actions #generateAllStoryVideosBtn .tone-tool-vip,
.storyboard-to-animation-btn .tone-tool-vip,
.storyboard-generate-agent-btn .tone-tool-vip,
.storyboard-material-batch-actions #assignAllStoryAssetsBtn .tone-tool-vip,
.storyboard-material-batch-actions #generateAllStoryImagesBtn .tone-tool-vip,
.story-batch-gen-btn .tone-tool-vip {
    width: 12px;
    height: 10px;
    flex: 0 0 12px;
    overflow: visible;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn .tone-tool-vip svg,
.storyboard-video-batch-actions #generateAllStoryVideosBtn .tone-tool-vip svg,
.storyboard-to-animation-btn .tone-tool-vip svg,
.storyboard-generate-agent-btn .tone-tool-vip svg,
.storyboard-material-batch-actions #assignAllStoryAssetsBtn .tone-tool-vip svg,
.storyboard-material-batch-actions #generateAllStoryImagesBtn .tone-tool-vip svg,
.story-batch-gen-btn .tone-tool-vip svg {
    width: 12px;
    height: 10px;
    flex: 0 0 12px;
}

.story-automation-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 26px !important;
    width: 26px;
    min-width: 26px !important;
    height: 26px;
    overflow: visible !important;
    border: 1px solid rgba(196, 181, 253, 0.26);
    border-radius: 7px;
    background: rgba(17, 18, 34, 0.38);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 8px rgba(7, 8, 18, 0.2);
    line-height: 1;
    transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

body .story-automation-action-icon svg {
    display: block;
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    overflow: visible;
    color: inherit;
}

.story-automation-action-icon.is-pipeline {
    border-color: rgba(167, 139, 250, 0.42);
    background: rgba(76, 29, 149, 0.25);
}

.story-automation-action-icon.is-assets {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(30, 64, 175, 0.23);
}

.story-automation-action-icon.is-storyboard {
    border-color: rgba(129, 140, 248, 0.42);
    background: rgba(49, 46, 129, 0.28);
}

.story-automation-action-icon.is-prompt {
    border-color: rgba(216, 180, 254, 0.4);
    background: rgba(107, 33, 168, 0.24);
}

.story-automation-action-icon.is-video {
    border-color: rgba(94, 234, 212, 0.4);
    background: rgba(15, 118, 110, 0.24);
}

button:hover:not(:disabled) > .story-automation-action-icon.is-play,
button:hover:not(:disabled) .storyboard-shot-image-arrow .story-automation-action-icon.is-play {
    transform: translateY(-1px) scale(1.04);
    border-color: rgba(224, 231, 255, 0.64);
    background-color: rgba(31, 33, 58, 0.52);
}

.story-automation-action-icon.is-pause {
    border-color: rgba(253, 164, 175, 0.48);
    background: rgba(91, 33, 54, 0.25);
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn.is-batch-running,
.storyboard-video-batch-actions #generateAllStoryVideosBtn.is-batch-running,
.storyboard-video-batch-actions #generateCurrentStoryVideosBtn.is-batch-paused,
.storyboard-video-batch-actions #generateAllStoryVideosBtn.is-batch-paused {
    color: #fff;
    background: #7868f6;
    border-color: #9184ff;
}

.storyboard-video-batch-actions #generateCurrentStoryVideosBtn.is-batch-running:hover:not(:disabled),
.storyboard-video-batch-actions #generateAllStoryVideosBtn.is-batch-running:hover:not(:disabled),
.storyboard-video-batch-actions #generateCurrentStoryVideosBtn.is-batch-paused:hover:not(:disabled),
.storyboard-video-batch-actions #generateAllStoryVideosBtn.is-batch-paused:hover:not(:disabled) {
    background: #8576ff;
    border-color: #a69cff;
}

.storyboard-video-batch-actions .storyboard-export-btn {
    flex: 0 1 auto;
    width: auto;
    min-width: 116px;
    white-space: nowrap;
}

.storyboard-export-interpolate {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 5px;
    color: #c7c3df;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}

.storyboard-export-interpolate input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--brand);
}

.storyboard-export-download {
    flex: 0 0 auto;
    white-space: nowrap;
}

.storyboard-automation-column .secondary-btn,
.storyboard-automation-column .primary-btn {
    width: 100%;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
}

.storyboard-automation-progress {
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid rgba(126, 115, 213, 0.22);
    border-radius: 7px;
    background: rgba(25, 25, 42, 0.64);
}

.storyboard-automation-progress > div:first-child {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 7px;
    color: #c7c9df;
    font-size: 12px;
}

.storyboard-automation-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    margin-left: 2px;
}

.storyboard-automation-progress .story-batch-cancel-btn {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 12px;
}

.storyboard-automation-progress strong {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-automation-progress #storyboardAutomationDetail {
    flex: 0 1 46%;
    min-width: 0;
    overflow: hidden;
    color: #969bbd;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-automation-progress.is-complete {
    border-color: rgba(35, 190, 112, 0.72);
    background: rgba(7, 68, 40, 0.72);
}

.storyboard-automation-progress.is-complete strong,
.storyboard-automation-progress.is-complete #storyboardAutomationCount {
    color: #f4f0ff;
}

.storyboard-automation-progress.is-paused {
    border-color: rgba(206, 158, 76, 0.48);
}

.storyboard-automation-progress.is-error {
    border-color: rgba(207, 88, 112, 0.58);
    background: rgba(91, 29, 44, 0.18);
}

.storyboard-automation-progress.is-error strong,
.storyboard-automation-progress.is-error #storyboardAutomationCount {
    color: #f1a7b6;
}

.storyboard-automation-track {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.storyboard-automation-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7465ed, #a797ff);
    transition: width 0.22s ease;
}

.storyboard-automation-progress.is-running .storyboard-automation-track span {
    background: linear-gradient(90deg, #7063e9 0%, #a894ff 72%, #d9d0ff 100%);
    box-shadow: 0 0 9px rgba(151, 127, 255, 0.52);
}

.storyboard-automation-progress.is-complete .storyboard-automation-track span {
    background: #2ed184;
    box-shadow: 0 0 10px rgba(46, 209, 132, 0.62);
}

.mine-ai-grid.automation-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
}

.automation-host-field {
    grid-column: 1 / -1;
}

.automation-story-creation-settings {
    grid-column: 1 / -1;
}

.automation-parameter-group {
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
}

.automation-parameter-group-image {
    grid-column: 1 / -1;
    border-color: rgba(151, 143, 255, 0.22);
    background: rgba(124, 108, 255, 0.055);
}

.automation-parameter-group-video {
    grid-column: 1 / -1;
    border-color: rgba(73, 185, 169, 0.2);
    background: rgba(56, 164, 151, 0.045);
}

.automation-parameter-group-export {
    grid-column: 1 / -1;
    border-color: rgba(81, 162, 242, 0.22);
    background: rgba(81, 162, 242, 0.045);
}

.automation-parameter-group-export .automation-parameter-title { color: #bddcff; }
.automation-parameter-group-export .automation-parameter-icon { color: #8fc5ff; }
.automation-export-fields { grid-template-columns: minmax(260px, 520px); }
.automation-export-fields small { color: var(--muted); line-height: 1.45; }

.automation-parameter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    color: #d9d5ff;
    font-size: 14px;
    font-weight: 850;
}

.automation-section-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.automation-parameter-group-video .automation-parameter-title {
    color: #bceae2;
}

.automation-parameter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border: 1px solid rgba(196, 181, 253, 0.22);
    border-radius: 9px;
    background: rgba(124, 108, 255, 0.12);
    color: #bcb4ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 5px 12px rgba(5, 7, 20, 0.24);
}

.automation-parameter-group-video .automation-parameter-icon {
    color: #8edbd0;
}

.automation-parameter-icon svg {
    width: 25px;
    height: 25px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.automation-parameter-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 14px 16px;
}

.hermes-effort-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.hermes-effort-pair select {
    min-width: 0;
    width: 100%;
}

.automation-parameter-group-video .automation-parameter-fields {
    align-items: start;
}

.automation-image-task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.automation-image-task {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 14px 16px;
    min-width: 0;
    max-width: 100%;
    padding: 14px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 7px;
    background: rgba(18, 19, 31, 0.46);
}

.automation-image-task-title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 28px;
    color: #f0edff;
    font-size: 13px;
}

.automation-task-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border: 1px solid rgba(196, 181, 253, 0.2);
    border-radius: 9px;
    color: #beb6ff;
    background: rgba(124, 108, 255, 0.11);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 5px 12px rgba(5, 7, 20, 0.22);
}

.automation-task-icon svg {
    width: 27px;
    height: 27px;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.automation-cluster-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    overflow: hidden;
    border: 1px solid rgba(153, 246, 228, 0.18);
    border-radius: 8px;
    background: rgba(15, 118, 110, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 10px rgba(3, 15, 17, 0.24);
}

.automation-cluster-icon .automation-color-icon {
    width: 23px;
    height: 23px;
}

.automation-parameter-icon .automation-color-icon,
.automation-task-icon .automation-color-icon,
.automation-cluster-icon .automation-color-icon {
    stroke: none;
    filter: drop-shadow(0 1px 1px rgba(3, 7, 18, 0.34));
}

.automation-icon-hermes {
    border-color: rgba(167, 139, 250, 0.34);
    background: linear-gradient(145deg, rgba(109, 40, 217, 0.3), rgba(8, 145, 178, 0.18));
}

.automation-icon-host {
    border-color: rgba(56, 189, 248, 0.32);
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.28), rgba(8, 145, 178, 0.17));
}

.automation-icon-story {
    border-color: rgba(244, 114, 182, 0.28);
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.27), rgba(190, 24, 93, 0.14));
}

.automation-icon-image {
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(145deg, rgba(79, 70, 229, 0.3), rgba(14, 165, 233, 0.16));
}

.automation-icon-character {
    border-color: rgba(249, 168, 212, 0.32);
    background: linear-gradient(145deg, rgba(190, 24, 93, 0.23), rgba(109, 40, 217, 0.17));
}

.automation-icon-scene {
    border-color: rgba(103, 232, 249, 0.32);
    background: linear-gradient(145deg, rgba(14, 165, 233, 0.24), rgba(5, 150, 105, 0.16));
}

.automation-icon-prop {
    border-color: rgba(253, 186, 116, 0.34);
    background: linear-gradient(145deg, rgba(234, 88, 12, 0.24), rgba(190, 24, 93, 0.14));
}

.automation-icon-storyboard {
    border-color: rgba(165, 180, 252, 0.32);
    background: linear-gradient(145deg, rgba(49, 46, 129, 0.34), rgba(124, 58, 237, 0.16));
}

.automation-icon-video {
    border-color: rgba(94, 234, 212, 0.3);
    background: linear-gradient(145deg, rgba(15, 118, 110, 0.29), rgba(190, 24, 93, 0.13));
}

.automation-icon-model {
    border-color: rgba(165, 180, 252, 0.3);
    background: rgba(79, 70, 229, 0.2);
}

.automation-icon-controls {
    border-color: rgba(253, 186, 116, 0.3);
    background: rgba(154, 52, 18, 0.2);
}

.automation-icon-output {
    border-color: rgba(125, 211, 252, 0.3);
    background: rgba(29, 78, 216, 0.2);
}

.automation-icon-export {
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(145deg, rgba(29, 78, 216, 0.28), rgba(5, 150, 105, 0.16));
}

.automation-image-task .automation-image-model-field {
    padding: 0;
    border: 0;
    background: transparent;
}

.automation-image-task > .automation-video-optimization-field {
    grid-column: auto;
    align-self: stretch;
    padding-top: 14px;
    border-top: 1px solid rgba(151, 143, 255, 0.14);
}

.automation-image-task .automation-optimization-step {
    grid-template-columns: 24px repeat(2, minmax(0, 1fr));
}

.automation-image-task .automation-optimization-step > select:nth-of-type(1) {
    grid-column: 2;
}

.automation-image-task .automation-optimization-step > select:nth-of-type(2) {
    grid-column: 3;
}

.automation-image-task .automation-step-guidance {
    grid-column: 1 / -1;
}

.automation-image-task .automation-optimization-actions {
    grid-column: 2 / -1;
    justify-self: end;
}

.automation-image-task[data-automation-image-task="storyboard"] .automation-custom-resolution-fields {
    padding: 0;
    border: 0;
    background: transparent;
}

.automation-video-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 10px;
}

.automation-video-settings-cluster {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(73, 185, 169, 0.16);
    border-radius: 7px;
    background: rgba(12, 26, 29, 0.24);
}

.automation-video-settings-cluster:first-child {
    padding-left: 12px;
    border: 1px solid rgba(73, 185, 169, 0.16);
}

.automation-video-settings-cluster:nth-child(3) {
    padding-right: 12px;
}

.automation-cluster-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    color: #dff7f2;
    font-size: 12px;
}

.automation-cluster-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #bceae2;
    background: rgba(56, 164, 151, 0.16);
    font-size: 11px;
    font-weight: 850;
}

.automation-video-number-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.automation-video-reoptimize-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    color: #dff7f2;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.automation-video-reoptimize-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}

.automation-video-prompt-chain {
    grid-column: 1 / -1;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(73, 185, 169, 0.16);
}

.automation-lora-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 8px;
}

.automation-custom-resolution-fields {
    align-content: end;
}

.automation-resolution-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.automation-resolution-inputs > span {
    color: var(--muted);
}

.automation-resolution-inputs input {
    width: 100%;
    min-width: 0;
}

.automation-image-model-field {
    align-self: stretch;
    align-content: start;
    padding: 12px;
    border: 1px solid rgba(151, 143, 255, 0.14);
    border-radius: 8px;
    background: rgba(18, 19, 31, 0.42);
}

.automation-image-model-lora {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 8px;
}

.automation-category-resolution-field {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.automation-category-resolution-field > span {
    color: rgba(175, 180, 212, 0.82);
    font-size: 11px;
    font-weight: 700;
}

.automation-image-model-lora label {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.automation-image-model-lora label > span {
    color: rgba(175, 180, 212, 0.82);
    font-size: 11px;
    font-weight: 700;
}

.automation-image-model-field > select,
.automation-image-model-lora select,
.automation-image-model-lora input {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    padding: 0 14px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    font: inherit;
}

.automation-duration-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.automation-video-optimization-field {
    grid-column: 1 / -1;
}

.automation-optimization-chain {
    display: grid;
    gap: 8px;
}

.automation-optimization-step {
    display: grid;
    grid-template-columns: 26px 112px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
}

.automation-step-guidance {
    grid-column: 2 / -1;
    display: grid;
    min-width: 0;
    gap: 4px;
}

.automation-step-selected {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.automation-optimization-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.mine-field .automation-optimization-step select {
    min-width: 0;
    width: 100%;
    height: 38px;
    padding-top: 0;
    padding-bottom: 0;
}

.automation-optimization-actions {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.automation-optimization-actions button,
.automation-add-optimization {
    border: 0;
    background: transparent;
    color: #aeb3cd;
    cursor: pointer;
}

.automation-optimization-actions button {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    font-size: 15px;
}

.automation-optimization-actions button:hover,
.automation-add-optimization:hover {
    color: #e5e2ff;
    background: rgba(124, 108, 255, 0.12);
}

.automation-optimization-actions button:disabled {
    opacity: 0.28;
    cursor: default;
    background: transparent;
}

.automation-skill-instruction {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    min-height: 52px;
    height: 52px;
    resize: vertical;
    padding: 7px 10px;
    border: 1px solid rgba(142, 219, 208, 0.18);
    border-radius: 7px;
    outline: none;
    background: var(--panel-2);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
}

.automation-skill-instruction:focus {
    border-color: rgba(151, 143, 255, 0.62);
    box-shadow: 0 0 0 2px rgba(124, 108, 255, 0.1);
}

.automation-add-optimization {
    justify-self: start;
    padding: 5px 7px;
    font-size: 12px;
    font-weight: 750;
}

.automation-video-optimization-field > small {
    color: rgba(175, 180, 212, 0.64);
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .automation-optimization-step {
        grid-template-columns: 24px minmax(88px, 0.7fr) minmax(120px, 1.3fr);
    }

    .automation-optimization-actions {
        grid-column: 2 / -1;
        justify-self: end;
    }
}

.automation-duration-range > span {
    color: var(--muted);
    white-space: nowrap;
}

.mine-field .automation-duration-range input {
    min-width: 0;
    width: 100%;
}

.mine-field .automation-lora-control input,
.mine-field .automation-lora-control select {
    min-width: 0;
}

.automation-host-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 14px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    background: rgba(24, 25, 38, 0.96);
}

.automation-host-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    gap: 8px;
    padding: 5px 4px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mine-field .automation-host-option input {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
}

.automation-host-copy {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    min-width: 0;
    gap: 7px;
    text-align: left;
}

.automation-host-copy strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.automation-host-copy em {
    flex: 0 0 auto;
    color: rgba(175, 180, 212, 0.72);
    font-size: 11px;
    font-style: normal;
    font-weight: 650;
}

.automation-host-option .status-dot {
    width: 8px;
    height: 8px;
}

.automation-smart-host-toggle {
    display: grid;
    grid-template-columns: 16px auto;
    align-items: center;
    gap: 7px 8px;
    margin-top: 10px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
}

.automation-smart-host-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand);
}

.automation-smart-host-toggle small {
    grid-column: 2;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.status-checking {
    background: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.automation-host-option-all {
    color: #cfc9ff;
}

.automation-settings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
}

.automation-settings-actions .mine-status {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    line-height: 1.65;
}

.automation-settings-actions .primary-btn {
    flex: 0 0 auto;
    min-width: 126px;
}

.automation-vip-readonly-note {
    align-self: flex-start;
    padding: 5px 10px;
    border: 1px solid rgba(167, 139, 250, 0.42);
    border-radius: 6px;
    color: #bdb4ff;
    background: rgba(124, 108, 255, 0.1);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.automation-panel-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}

.automation-reset-defaults {
    min-width: 96px;
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    white-space: nowrap;
}

#automationSettingsPanel.is-vip-readonly .automation-settings-grid {
    opacity: 0.58;
}

#automationSettingsPanel.is-vip-readonly input,
#automationSettingsPanel.is-vip-readonly select,
#automationSettingsPanel.is-vip-readonly textarea,
#automationSettingsPanel.is-vip-readonly button {
    cursor: not-allowed;
}

#automationSettingsPanel.is-vip-readonly .automation-host-option,
#automationSettingsPanel.is-vip-readonly .automation-parameter-group {
    filter: saturate(0.58);
}

#automationSettingsPanel.is-vip-readonly .automation-settings-actions .mine-status {
    color: #aaa4c2;
}

@media (max-width: 1080px) {
    .mine-ai-grid.automation-settings-grid {
        grid-template-columns: 1fr;
    }

    .automation-video-prompt-chain {
        margin-top: 0;
    }
}

@media (max-width: 920px) {
    .storyboard-automation-progress {
        min-width: 0;
    }
}

@media (max-width: 760px) {
    .storyboard-automation-bar {
        grid-template-columns: 42px minmax(0, 1fr);
        padding-right: 0;
    }

    .storyboard-automation-materials,
    .storyboard-automation-videos {
        grid-column: 2;
    }

    .storyboard-video-batch-actions {
        flex-wrap: wrap;
    }

    .storyboard-material-batch-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .automation-parameter-fields {
        grid-template-columns: 1fr;
    }

    .automation-image-task {
        grid-template-columns: 1fr;
    }

    .automation-image-task > .automation-video-optimization-field {
        padding-top: 14px;
        padding-left: 0;
        border-top: 1px solid rgba(151, 143, 255, 0.14);
        border-left: 0;
    }

    .automation-settings-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .automation-settings-actions .primary-btn {
        align-self: flex-end;
    }

    .storyboard-automation-bar {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .storyboard-automation-materials,
    .storyboard-automation-videos {
        grid-column: 1;
    }

    .storyboard-progress-hub {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .storyboard-progress-hub-title {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-right: 0;
        padding-bottom: 5px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .storyboard-agent-build {
        grid-template-columns: 1fr;
    }
}


.storyboard-chapter-tabs {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    padding: 3px 2px 5px;
}

.storyboard-chapter-add,
.storyboard-chapter-tab {
    flex: 0 0 auto;
    height: 34px;
    border: 1px solid rgba(119, 112, 216, 0.28);
    background: rgba(20, 21, 36, 0.82);
    color: #aeb3d1;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.storyboard-chapter-item {
    position: relative;
    flex: 0 0 auto;
}

.storyboard-chapter-add {
    width: 34px;
    border-radius: 9px;
    color: #b5a5ff;
    font-size: 20px;
}

.storyboard-chapter-tab {
    min-width: 104px;
    max-width: 190px;
    padding: 0 28px 0 14px;
    border-radius: 9px;
}

.storyboard-chapter-tab .storyboard-chapter-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-chapter-delete {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 7px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(202, 205, 229, 0.66);
    font-size: 17px;
    line-height: 18px;
    cursor: pointer;
    transform: translateY(-50%);
}

.storyboard-chapter-delete:hover {
    background: rgba(255, 100, 121, 0.16);
    color: #ff8798;
}

.storyboard-chapter-tab.is-active + .storyboard-chapter-delete {
    color: rgba(255, 255, 255, 0.78);
}

.storyboard-chapter-tab.is-active {
    border-color: rgba(139, 119, 255, 0.7);
    background: #6757ec;
    color: #fff;
}

.storyboard-chapter-name-input {
    width: 100%;
    min-width: 70px;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: center;
}

.story-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 298px;
    gap: 24px;
    align-items: stretch;
    width: 84%;
    margin: 0 auto 24px;
}

.storyboard-composer {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 18px 18px 20px;
    border: 1px solid rgba(106, 101, 189, 0.22);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(18, 19, 31, 0.98), rgba(22, 24, 39, 0.98));
    box-shadow: 0 18px 42px rgba(8, 10, 20, 0.28);
}

.story-role-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
    gap: 2px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    overflow: hidden;
    padding: 18px 18px 20px;
    border: 1px solid rgba(106, 101, 189, 0.22);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(18, 19, 31, 0.98), rgba(22, 24, 39, 0.98));
    box-shadow: 0 18px 42px rgba(8, 10, 20, 0.28);
}

.story-role-head h3 {
    margin: 0 0 6px;
    color: #f1f2ff;
    font-size: 16px;
    font-weight: 800;
}

.story-role-head,
.story-role-head-actions {
    min-width: 0;
}

.story-role-head-actions {
    flex: 0 0 auto;
}

.story-role-head-actions .prompt-reset-link {
    padding-bottom: 0;
    white-space: nowrap;
}

.story-role-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.story-role-head-row h3 {
    margin: 0;
}

/* ===== 一键生成素材：面板底部通栏主按钮（默认 / 进行中 / 取消）===== */
.story-batch-gen-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    margin-top: auto;
    padding: 12px 0 0;
}

.story-batch-gen-bar.is-panel-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    align-items: stretch;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    padding: 12px 0 0;
}

.story-batch-gen-bar.is-panel-actions > button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

.story-batch-gen-bar.is-panel-actions > button .tone-tool-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-batch-gen-bar.is-panel-actions .story-asset-head-btn {
    flex: 1 1 0 !important;
    width: auto;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(139, 124, 239, 0.52);
    border-radius: 9px;
    background: #202038;
    color: #f2f0ff;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.story-batch-gen-bar.is-panel-actions .story-asset-head-btn:hover:not(:disabled) {
    border-color: var(--brand);
    background: #292747;
}

.story-batch-gen-bar.is-panel-actions #storyAssetBatchGenBtn {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.story-batch-gen-bar.is-panel-actions :is(#assignAllStoryAssetsBtn, #storyboardReextractAssetsBtn) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 28px;
    padding-block: 0 !important;
    padding-inline: 14px !important;
}

.story-batch-gen-btn {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c6cf0, #5a4bd4);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(96, 82, 220, 0.35);
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.story-batch-gen-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #8d7ef5, #6a5be0);
    box-shadow: 0 10px 24px rgba(96, 82, 220, 0.45);
}

.story-batch-gen-btn:active:not(:disabled) {
    transform: scale(0.985);
}

.story-batch-gen-btn .batch-spinner {
    display: inline-block;
    flex: 0 0 14px;
    width: 14px;
    min-width: 14px;
    height: 14px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: batch-spin 0.8s linear infinite;
}

.story-batch-gen-btn.is-busy {
    cursor: default;
    background: linear-gradient(135deg, #4a4296, #37316e);
    box-shadow: none;
}

.story-batch-gen-btn,
.storyboard-video-batch-actions .primary-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-right: 12px;
}

.story-batch-gen-btn .tone-tool-vip,
.storyboard-video-batch-actions .primary-btn .tone-tool-vip {
    position: static;
}

.story-batch-gen-btn .tone-tool-label,
.storyboard-video-batch-actions .primary-btn .tone-tool-label {
    display: inline-block;
    line-height: 1;
}

.story-batch-continue-btn {
    flex: 1 1 140px;
    border: 1px solid rgba(157, 139, 255, 0.72);
    background: rgba(102, 83, 214, 0.2);
    box-shadow: none;
}

.story-batch-continue-btn:hover:not(:disabled) {
    background: rgba(124, 108, 240, 0.34);
    box-shadow: 0 8px 18px rgba(96, 82, 220, 0.2);
}

@keyframes batch-spin {
    to { transform: rotate(360deg); }
}

.story-batch-cancel-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 10px;
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 10px;
    background: rgba(255, 107, 107, 0.12);
    color: #ff9d9d;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.story-batch-confirm-modal {
    width: min(480px, calc(100vw - 40px));
}

.story-batch-confirm-modal .modal-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
}

.story-batch-confirm-modal .modal-actions .primary-btn,
.story-batch-confirm-modal .modal-actions .secondary-btn {
    width: 100%;
    min-width: 0;
    padding-inline: 12px;
    white-space: nowrap;
}

.story-batch-confirm-modal .modal-actions .story-batch-restart-choice {
    border: 1px solid rgba(255, 139, 150, 0.42);
    background: rgba(255, 104, 122, 0.1);
    color: #ffb1ba;
}

.story-batch-confirm-summary {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(132, 113, 255, 0.32);
    border-radius: 8px;
    background: rgba(124, 108, 240, 0.08);
    color: #c9c5e8;
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-line;
}

@media (max-width: 560px) {
    .story-batch-confirm-modal .modal-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .story-batch-confirm-modal .modal-actions .primary-btn,
    .story-batch-confirm-modal .modal-actions .secondary-btn {
        height: 40px;
        padding-inline: 4px;
        font-size: 11px;
    }
}

.story-batch-cancel-btn:hover {
    background: rgba(255, 107, 107, 0.24);
    border-color: rgba(255, 107, 107, 0.65);
}

.story-asset-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
   
    border: 1px solid rgba(119, 112, 216, 0.26);
    border-radius: 999px;
    background: rgba(12, 14, 24, 0.78);
}

.story-asset-tabs button {
    min-width: 50px;
    height: 30px;
    padding: 0 11px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #a8aecb;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.story-asset-tabs button:hover {
    color: #f0f1ff;
    background: rgba(124, 104, 255, 0.16);
}

.story-asset-tabs button.is-active {
    color: #fff;
    background: linear-gradient(135deg, #6357f4, #8068ff);
    box-shadow: 0 10px 24px rgba(111, 92, 255, 0.32);
}

.story-role-head p {
    margin: 0;
    color: #9298b6;
    font-size: 13px;
    line-height: 1.6;
}

.story-role-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
    align-self: stretch;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 4px 12px 0;
    scrollbar-gutter: stable;
}

.story-role-card {
    position: relative;
    min-width: 0;
    display: grid;
    gap: 7px;
    justify-items: center;
}

.story-role-card strong,
.story-role-name {
    width: 100%;
    min-width: 0;
    color: #f3f1ff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-role-name {
    display: block;
    padding: 2px 3px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: text;
    font-family: inherit;
}

.story-role-name:hover,
.story-role-name:focus-visible {
    border-color: rgba(143, 125, 255, 0.62);
    background: rgba(112, 91, 229, 0.12);
    outline: none;
}

.story-role-name-input {
    width: 100%;
    min-width: 0;
    height: 24px;
    padding: 2px 5px;
    border: 1px solid rgba(158, 139, 255, 0.92);
    border-radius: 4px;
    background: #111323;
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    outline: none;
}

.story-role-avatar {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(119, 112, 216, 0.24);
    background: rgba(12, 14, 24, 0.96);
    overflow: hidden;
    cursor: zoom-in;
    display: grid;
    place-items: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.story-role-grid.is-scene-mode .story-role-avatar {
    border-radius: 24px;
}

.story-role-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-role-avatar.is-empty {
    cursor: pointer;
    color: #9e94ff;
    font-size: 34px;
    font-weight: 300;
}

.story-role-avatar.is-suggested {
    cursor: pointer;
    border-style: dashed;
    border-color: rgba(142, 124, 255, 0.62);
    background:
        radial-gradient(circle at 50% 38%, rgba(147, 132, 255, 0.32), transparent 34%),
        rgba(20, 21, 34, 0.96);
    color: #ddd8ff;
    font-size: 22px;
    font-weight: 900;
}

.story-role-avatar.is-suggested:hover {
    border-color: rgba(190, 180, 255, 0.86);
    box-shadow: 0 0 0 3px rgba(126, 104, 255, 0.14);
}

.story-role-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 3;
    width: 22px;
    height: 22px;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transform: scale(0.92);
}

.story-role-card:hover .story-role-remove,
.story-role-remove:focus-visible {
    opacity: 1;
    transform: scale(1);
}

.story-character-voice {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.story-character-voice-select {
    min-width: 0;
    height: 24px;
    flex: 1 1 auto;
    overflow: hidden;
    padding: 0 7px;
    border: 0;
    border-radius: 999px;
    background: rgba(117, 119, 133, 0.82);
    color: #f4f4fa;
    font-size: 10px;
    font-weight: 800;
    line-height: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.story-character-voice-select.is-selected {
    background: linear-gradient(135deg, #6756ed, #8a68ff);
    color: #fff;
}

.story-character-voice.is-unassigned .story-character-voice-select {
    flex-basis: 100%;
    padding-inline: 10px;
    text-overflow: clip;
}

.story-character-voice-play {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(151, 143, 255, 0.28);
    border-radius: 999px;
    background: rgba(38, 39, 57, 0.96);
    color: #d9d5ff;
    cursor: pointer;
}

.story-character-voice-play span {
    font-size: 9px;
    line-height: 1;
}

.story-character-voice-play.is-playing {
    border-color: #8068ff;
    background: #654df0;
    color: #fff;
}

.story-character-voice-play:disabled {
    opacity: 0.34;
    cursor: default;
}

.story-voice-popover {
    position: fixed;
    z-index: 5200;
    max-height: calc(100vh - 24px);
    overflow: hidden;
    border: 1px solid rgba(151, 143, 255, 0.6);
    border-radius: 14px;
    background: rgba(19, 20, 32, 0.99);
    box-shadow: 0 26px 72px rgba(0, 0, 0, 0.62);
}

.story-voice-popover-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.14);
}

.story-voice-popover-head > div {
    display: grid;
    gap: 4px;
}

.story-voice-popover-head .story-voice-popover-head-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.story-voice-popover-head strong {
    color: #f5f3ff;
    font-size: 15px;
}

.story-voice-popover-head small {
    color: #989db7;
    font-size: 11px;
}

.story-voice-popover-head button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: rgba(43, 41, 71, 0.94);
    color: #d8d3ff;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.story-voice-popover-head .story-voice-clear {
    width: auto;
    height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(198, 102, 116, 0.38);
    border-radius: 7px;
    background: rgba(108, 42, 54, 0.3);
    color: #e4a0aa;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.story-voice-popover-head .story-voice-clear:hover,
.story-voice-popover-head .story-voice-clear:focus-visible {
    border-color: rgba(224, 117, 132, 0.72);
    background: rgba(126, 48, 61, 0.48);
    color: #ffd6dc;
    outline: none;
}

.story-voice-group-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.14);
}

.story-voice-group-tabs button {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(132, 124, 210, 0.3);
    border-radius: 7px 7px 0 0;
    background: rgba(31, 32, 50, 0.72);
    color: #a8abc1;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.story-voice-group-tabs button small {
    color: #7f849f;
    font-size: 9px;
}

.story-voice-group-tabs button.is-active {
    border-color: rgba(128, 104, 255, 0.76);
    background: rgba(102, 78, 239, 0.92);
    color: #fff;
}

.story-voice-group-tabs button.is-active small {
    color: #ded9ff;
}

.story-voice-popover-body {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    max-height: min(560px, calc(100vh - 120px));
    overflow-y: auto;
    padding: 16px 18px 20px;
}

.story-voice-template-groups {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.story-voice-template-group {
    min-width: 0;
}

.story-voice-template-group[hidden] {
    display: none !important;
}

.story-voice-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 14px 10px;
}

.story-voice-template-card,
.story-voice-custom-card {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: 7px;
}

.story-voice-template-card {
    padding: 8px 5px;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.story-voice-template-card.is-selected {
    border-color: rgba(139, 116, 255, 0.72);
    background: rgba(105, 82, 235, 0.22);
}

.story-voice-template-card.is-selected .story-voice-template-play {
    background: #654df0;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(111, 92, 255, 0.24);
}

.story-voice-template-play,
.story-voice-custom-card > span {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #8e9bae;
    color: #151721;
    font-size: 15px;
    cursor: pointer;
}

.story-voice-template-play.is-playing {
    background: #4e2de9;
    color: #fff;
}

.story-voice-template-name,
.story-voice-custom-card strong {
    width: 100%;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: #f0eff9;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.story-voice-custom-card {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 4px;
    border: 0;
    border-radius: 10px;
    background: rgba(25, 26, 42, 0.96);
    cursor: pointer;
}

.story-voice-custom-card > span {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(112, 104, 224, 0.72);
    border-radius: 9px;
    background: transparent;
    color: #9d94ff;
    font-size: 31px;
    font-weight: 300;
}

.voice-library-picker.is-story-character-picker {
    position: fixed;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    z-index: 5300;
    width: min(560px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 32px));
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 100vmax rgba(5, 6, 13, 0.72), 0 26px 72px rgba(0, 0, 0, 0.68);
}

@media (max-width: 720px) {
    .story-voice-popover-body {
        grid-template-columns: 72px minmax(0, 1fr);
        padding-inline: 12px;
    }

    .story-voice-group-tabs {
        grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
        padding-inline: 10px;
    }

    .story-voice-template-grid {
        grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    }
}

.role-chooser-modal {
    width: min(520px, calc(100vw - 48px));
}

.role-chooser-body {
    display: grid;
    gap: 16px;
    padding: 0 18px 18px;
}

.role-upload-stack {
    max-width: 100%;
}

.role-chooser-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.image-save-as-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: center;
    width: 100%;
    padding-top: 4px;
}

.image-save-as-actions button {
    min-width: 0;
    width: 100%;
    padding-inline: 10px;
    white-space: nowrap;
}

.shot-image-preview {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
}

.shot-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

@media (max-width: 860px) {
    .story-top-grid {
        grid-template-columns: 1fr;
    }
}

.storyboard-composer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.storyboard-generation-counts {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    flex: 0 0 auto;
}

.storyboard-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.storyboard-generation-counts .storyboard-count-inline span:first-child {
    width: 58px;
    text-align: right;
}

.storyboard-generation-counts .storyboard-duration-limit-inline span:first-child {
    width: 66px;
}

.storyboard-generation-counts .storyboard-total-duration-inline span:first-child {
    width: 52px;
}

.storyboard-generation-counts .storyboard-total-duration-inline input {
    width: 46px;
}

.storyboard-generation-counts .storyboard-total-duration-inline span:not(:first-child) {
    width: auto;
}

@media (max-width: 860px) {
    .storyboard-pages-head {
        align-items: center;
        gap: 8px;
    }

    .storyboard-chapter-tabs {
        flex: 1 1 auto;
        width: auto;
    }

    .storyboard-pages-export-actions {
        gap: 7px;
    }

    .storyboard-pages-export-actions .storyboard-export-btn {
        min-width: 104px;
        padding: 0 10px;
    }

    .storyboard-generation-counts {
        gap: 6px;
    }

    .storyboard-generation-counts .storyboard-count-inline {
        gap: 4px;
    }

    .storyboard-generation-counts .storyboard-count-inline span:first-child {
        width: auto;
    }
}

.storyboard-composer-head h3 {
    margin: 0;
    color: #f1f2ff;
    font-size: 16px;
    font-weight: 800;
}

.storyboard-composer-head p {
    margin: 0;
    color: #9298b6;
    font-size: 13px;
    line-height: 1.7;
}

.storyboard-head-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
     padding-bottom:8px;
}

.storyboard-count-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
    flex-shrink: 0;
    color: #cfd5f6;
    font-size: 13px;
    font-weight: 700;
}
.storyboard-count-inline span{width:38px;}

.storyboard-count-inline input {
    width: 54px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid rgba(110, 115, 172, 0.28);
    background: rgba(16, 18, 29, 0.94);
    color: #f3f5ff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.storyboard-count-inline input:focus {
    outline: none;
    border-color: rgba(88, 76, 236, 0.36);
    box-shadow: 0 0 0 4px rgba(92, 82, 237, 0.11);
}

.storyboard-duration-limit-inline input.is-invalid {
    border-color: #e04957;
    box-shadow: 0 0 0 4px rgba(224, 73, 87, 0.14);
}

.storyboard-cancel-btn,
.secondary-btn.storyboard-cancel-btn {
    flex-shrink: 0;
    min-width: auto;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #8f97ff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    box-shadow: none;
}

.storyboard-cancel-btn:hover,
.secondary-btn.storyboard-cancel-btn:hover {
    color: #a9b0ff;
    background: none;
}

.storyboard-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.storyboard-ai-btn span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(105, 84, 255, 0.2), rgba(140, 95, 255, 0.08));
    color: #5a52d6;
    font-size: 12px;
    font-weight: 900;
}

.storyboard-script-box {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.storyboard-script-box textarea,
.storyboard-config-grid textarea {
    width: 100%;
    min-height: 260px;
    resize: vertical;
    border: 1px solid rgba(119, 112, 216, 0.24);
    border-radius: 12px;
    background: rgba(12, 14, 24, 0.96);
    color: #eef1ff;
    font-size: 14px;
    line-height: normal;
    padding: 16px 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.storyboard-script-box textarea::placeholder,
.storyboard-config-grid textarea::placeholder,
.storyboard-config-grid input::placeholder {
    color: #737b9a;
}

.storyboard-script-box textarea {
    flex: 1 1 auto;
}

.storyboard-script-composer {
    display: flex;
    flex-direction: column;
    min-height: 260px;
    overflow: hidden;
    border: 1px solid rgba(119, 112, 216, 0.3);
    border-radius: 10px;
    background: rgba(12, 14, 24, 0.96);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.storyboard-script-composer:focus-within,
.storyboard-script-composer.is-dragging {
    border-color: rgba(123, 108, 255, 0.72);
    box-shadow: 0 0 0 3px rgba(92, 82, 237, 0.12);
}

.storyboard-script-composer.is-dragging {
    background: rgba(37, 34, 72, 0.96);
}

.storyboard-script-composer > textarea {
    width: 100%;
    min-height: 205px;
    flex: 1 1 auto;
    resize: vertical;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: #eef1ff;
    font-size: 14px;
    line-height: 1.65;
    padding: 16px 18px 12px;
    box-shadow: none;
}

.storyboard-script-composer > textarea::placeholder {
    color: #737b9a;
}

.story-writer-toolbar,
.story-writer-link-row,
.story-writer-references {
    border-top: 1px solid rgba(119, 112, 216, 0.22);
}

.story-writer-toolbar {
    min-height: 50px;
    display: flex;
    align-items: center;
    padding: 7px 10px;
    background: rgba(29, 31, 53, 0.94);
}

.story-writer-tools {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
}

.story-writer-tool {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #c9c9ef;
}

.story-writer-tool:hover {
    background: rgba(124, 106, 255, 0.14);
    color: #ffffff;
}

.story-script-library-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    margin-left: 7px;
    padding: 0 6px;
    color: #cfc9ff;
    white-space: nowrap;
}

.story-script-library-tool + .story-script-library-tool {
    margin-left: 8px;
}

.story-script-library-tool svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.story-script-library-tool:hover {
    color: #fff;
}

.story-script-library-tool span {
    font-size: 12px;
    font-weight: 900;
}

.storyboard-script-version-time {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

.prompt-library-body.storyboard-script-library-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-writer-tool svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.story-writer-model {
    min-width: 0;
    margin-left: 8px;
    flex: 1 1 auto;
    overflow: hidden;
    color: #969cb9;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-writer-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(25, 27, 47, 0.96);
}

.story-writer-link-row input {
    min-width: 0;
    flex: 1 1 auto;
    height: 36px;
    border: 1px solid rgba(119, 112, 216, 0.28);
    border-radius: 6px;
    background: rgba(10, 12, 22, 0.88);
    color: #eef1ff;
    padding: 0 10px;
}

.story-writer-link-row .secondary-btn {
    min-width: 64px;
    height: 36px;
    padding: 0 14px;
}

.story-writer-references {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 9px 10px;
    background: rgba(20, 22, 39, 0.95);
}

.story-writer-reference {
    min-width: 0;
    max-width: min(240px, 100%);
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(120, 110, 235, 0.3);
    border-radius: 6px;
    background: rgba(47, 45, 78, 0.72);
    padding: 3px 5px 3px 4px;
}

.story-writer-reference img,
.story-writer-reference-kind {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 4px;
}

.story-writer-reference img {
    object-fit: cover;
    background: #090a11;
}

.story-writer-reference-kind {
    display: inline-grid;
    place-items: center;
    background: rgba(116, 101, 255, 0.18);
    color: #bdb7ff;
    font-size: 9px;
    font-weight: 800;
}

.story-writer-reference-name {
    min-width: 0;
    overflow: hidden;
    color: #e6e8f7;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-writer-reference button {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #8f95b2;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.story-writer-reference button:hover {
    background: rgba(255, 112, 132, 0.12);
    color: #ff9aaa;
}

.storyboard-script-box textarea:focus,
.storyboard-config-grid textarea:focus,
.storyboard-config-grid input:focus,
.storyboard-config-grid select:focus,
.shot-textarea:focus {
    outline: none;
    border-color: rgba(88, 76, 236, 0.36);
    box-shadow: 0 0 0 4px rgba(92, 82, 237, 0.11);
}

.storyboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.storyboard-action-buttons {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    margin-left: auto;
}

.story-processing-method-picker {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.story-processing-method-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: #f0edf9;
    padding: 2px 4px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}

.story-processing-method-trigger strong {
    color: #f7f4ff;
    font-weight: 800;
}

.story-processing-method-trigger svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: #b8afff;
    stroke-width: 2.2;
    transition: transform 0.16s ease;
}

.story-processing-method-picker.is-open .story-processing-method-trigger svg {
    transform: rotate(180deg);
}

.story-processing-method-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    z-index: 24;
    width: 216px;
    padding: 10px;
    border: 1px solid rgba(158, 147, 232, 0.66);
    border-radius: 12px;
    background: #7772ad;
    box-shadow: 0 16px 38px rgba(4, 4, 13, 0.38);
}

.story-processing-method-menu::after {
    content: "";
    position: absolute;
    right: 28px;
    bottom: -10px;
    width: 18px;
    height: 18px;
    border-right: 1px solid rgba(158, 147, 232, 0.66);
    border-bottom: 1px solid rgba(158, 147, 232, 0.66);
    background: #7772ad;
    transform: rotate(45deg);
}

.story-processing-method-menu button {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #f8f5ff;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.story-processing-method-menu button:hover,
.story-processing-method-menu button.is-selected {
    background: rgba(211, 205, 255, 0.52);
    color: #151421;
}

.storyboard-generation-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.storyboard-generation-buttons .prompt-agent-process {
    min-width: 132px;
    height: 38px;
}

.automation-story-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.automation-story-method {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px 10px;
    min-width: 0;
}

.automation-story-mode-switch {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--soft);
    border-radius: 6px;
}

.automation-story-mode-switch label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 6px;
    min-width: 0;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
}

.automation-story-mode-switch label.is-selected {
    background: var(--brand);
    color: #fff;
}

.automation-story-mode-switch input[type="radio"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--brand);
}

.automation-selected-summary {
    padding: 4px 0;
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.automation-generation-config {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 10px;
    border: 1px solid #686879;
    border-radius: 6px;
    background: var(--panel, #22222c);
}

.automation-generation-config.is-hidden { display: none; }

.automation-generation-config .automation-storyboard-agent-field textarea {
    min-height: 60px;
    height: 60px;
    padding: 8px 10px;
}

.automation-generation-config.is-active {
    border-color: var(--brand);
    box-shadow: inset 3px 0 0 var(--brand);
}

.automation-generation-config.is-inactive {
    border-color: #686879;
    color: var(--muted, #a4a4b2);
    background: var(--soft);
}

.automation-generation-config.is-inactive .mine-field > span {
    color: var(--muted);
}

.automation-generation-config-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.automation-generation-config.is-active .automation-generation-config-head {
    color: var(--brand);
}

.automation-generation-config.is-inactive .automation-generation-config-head {
    color: var(--muted, #a4a4b2);
}

.automation-generation-config .mine-field,
.automation-generation-config select {
    min-width: 0;
    width: 100%;
}

.automation-story-method > strong {
    grid-column: 1 / -1;
    color: #eeebff;
    font-size: 13px;
}

.prompt-agent-process.is-tag-method {
    border-color: rgba(91, 84, 139, 0.62);
    background: #222135;
    color: #e4e0f4;
}

.prompt-agent-process.is-tag-method:hover {
    border-color: rgba(124, 113, 190, 0.74);
    background: #2b2942;
}

.prompt-agent-process.is-agent-method {
    border-color: rgba(157, 140, 255, 0.7);
    background: rgba(92, 82, 151, 0.88);
}

@media (max-width: 900px) {
    .automation-story-method-grid {
        grid-template-columns: 1fr;
    }

    .storyboard-action-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .storyboard-generation-buttons {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* One global dialogue audit belongs between the batch controls and the shots,
   not repeated inside every video tab bar. */
.studio-view .storyboard-dialogue-check-bar {
    display: grid;
    align-items: center;
    grid-template-columns: 46px minmax(0, 1.1fr) 20px minmax(0, 0.92fr) 20px minmax(0, 0.92fr);
    column-gap: clamp(12px, 1.8vw, 28px);
    min-height: 48px;
    padding: 4px 0 8px;
}

.studio-view .storyboard-dialogue-check-all {
    min-height: 30px;
    height: 30px;
    padding: 0 13px;
    border-color: rgba(103, 163, 255, 0.28);
    border-radius: 7px;
    background: rgba(11, 23, 48, 0.72);
    color: #c4d6ff;
    font-size: 10px;
    font-weight: 800;
    grid-column: 6;
    justify-self: center;
}

.studio-view .storyboard-dialogue-check-all:hover:not(:disabled) {
    border-color: rgba(115, 180, 255, 0.58);
    background: rgba(62, 91, 182, 0.28);
    color: #f4f7ff;
}

/* Kept as a defensive rule for already-open clients that still have the old
   template cached. The script editor starts directly below the workflow. */
.studio-view .basic-script-head > :is(h1, h2, h3) {
    display: none !important;
}

.studio-view .shot-dialogue-check-button {
    position: absolute;
    right: 48px;
    bottom: 9px;
    z-index: 6;
    min-width: 66px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(103, 163, 255, 0.24);
    border-radius: 7px;
    background: rgba(9, 17, 36, 0.82);
    color: #b7c9ff;
    font-size: 10px;
    font-weight: 800;
}

.studio-view .shot-dialogue-check-button:hover:not(:disabled) {
    border-color: rgba(115, 180, 255, 0.58);
    background: rgba(62, 91, 182, 0.28);
    color: #f4f7ff;
}

@media (max-width: 1160px) {
    .studio-view .storyboard-dialogue-check-bar {
        grid-template-columns: 42px minmax(0, 1fr) 16px minmax(0, 0.94fr) 16px minmax(0, 0.94fr);
        column-gap: 12px;
    }
}

@media (max-width: 900px) {
    .studio-view .storyboard-dialogue-check-bar {
        display: flex;
        justify-content: flex-end;
        min-height: 44px;
        padding: 5px 0 8px;
    }

    .studio-view .storyboard-dialogue-check-all {
        justify-self: auto;
    }
}

@media (max-width: 760px) {
    .studio-view .shot-dialogue-check-button {
        display: none;
    }
}

.storyboard-action-buttons .storyboard-writer-agent-tools {
    order: 1;
}

.storyboard-action-buttons .storyboard-generate-agent-tools {
    order: 2;
}

.storyboard-to-animation-btn {
    min-width: 148px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.storyboard-to-animation-btn svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: #fff;
    fill: #fff;
}

.storyboard-to-animation-btn.is-pipeline-paused {
    color: #f2efff;
    border-color: rgba(137, 117, 255, 0.72);
    background: rgba(104, 84, 220, 0.32);
}

.storyboard-to-animation-btn.is-pipeline-pausing {
    opacity: 0.76;
}

.primary-btn.is-generating,
.secondary-btn.is-generating,
.ghost-btn.is-generating,
#generateStoryboardBtn.is-generating,
.shot-action.is-generating {
    position: relative;
    overflow: hidden;
}

.primary-btn.is-generating,
.secondary-btn.is-generating,
.ghost-btn.is-generating,
#generateStoryboardBtn.is-generating,
.shot-action.is-generating {
    border-color: rgba(153, 145, 255, 0.58);
    box-shadow: 0 0 0 1px rgba(145, 138, 255, 0.18), 0 12px 24px rgba(90, 75, 240, 0.28);
}

.image-prompt-tools #optimizeImagePromptBtn.is-generating,
.image-prompt-tools #optimizeVideoPromptBtn.is-generating,
.image-prompt-tools #optimizeImagePromptBtn.is-generating:disabled,
.image-prompt-tools #optimizeVideoPromptBtn.is-generating:disabled {
    opacity: 1;
    color: #f7f4ff;
    background: linear-gradient(135deg, rgba(96, 74, 244, 0.96), rgba(142, 102, 255, 0.92));
    border-color: rgba(172, 154, 255, 0.62);
    box-shadow: 0 12px 28px rgba(86, 62, 219, 0.36);
    filter: none;
}

.primary-btn.is-generating::after,
.secondary-btn.is-generating::after,
.ghost-btn.is-generating::after,
#generateStoryboardBtn.is-generating::after,
.shot-action.is-generating::after {
    content: "";
    position: absolute;
    top: -28%;
    bottom: -28%;
    left: -42%;
    width: 34%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.12) 38%, rgba(255,255,255,0.72) 50%, rgba(255,255,255,0.12) 62%, rgba(255,255,255,0) 100%);
    transform: skewX(-22deg);
    animation: storyboard-button-scan 1.15s linear infinite;
    pointer-events: none;
}

@keyframes storyboard-button-scan {
    0% {
        left: -42%;
    }
    100% {
        left: 118%;
    }
}

.storyboard-result {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(13, 15, 26, 0.88);
    border: 1px solid rgba(96, 98, 170, 0.18);
}

.storyboard-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.storyboard-result-head strong {
    color: #f1f3ff;
    font-size: 14px;
    font-weight: 800;
}

.storyboard-result-head span {
    color: #98a0c4;
    font-size: 12px;
    font-weight: 800;
}

.storyboard-scene-list {
    display: grid;
    gap: 12px;
}

.storyboard-scene-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(24, 27, 42, 0.96);
    border: 1px solid rgba(113, 109, 192, 0.18);
}

.storyboard-scene-card strong {
    display: block;
    margin-bottom: 8px;
    color: #edf0ff;
    font-size: 13px;
    font-weight: 900;
}

.storyboard-scene-card p,
.storyboard-raw {
    margin: 0;
    color: #a9b0cf;
    font-size: 13px;
    line-height: 1.72;
    white-space: pre-wrap;
}

.storyboard-config-modal {
    width: min(920px, calc(100vw - 48px));
    padding: 24px 28px 22px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(18, 19, 29, 0.98), rgba(12, 13, 22, 0.98));
    border: 1px solid rgba(151, 143, 255, 0.18);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.storyboard-config-modal h2 {
    margin: 0 0 8px;
    color: #f3f5ff;
    font-size: 26px;
    font-weight: 800;
    text-align: left;
}

#storyboardConfigModal {
    z-index: 180;
}

.storyboard-deploy-modal {
    width: min(560px, calc(100vw - 40px));
}

.storyboard-deploy-text {
    margin: 6px 0 0;
    color: #9198bd;
    font-size: 14px;
    line-height: 1.7;
}

.storyboard-deploy-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.storyboard-deploy-actions .secondary-btn,
.storyboard-deploy-actions .primary-btn {
    min-width: 124px;
}

.storyboard-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.storyboard-config-grid label {
    display: grid;
    gap: 8px;
}

.storyboard-config-grid span {
    color: #dbe1ff;
    font-size: 13px;
    font-weight: 800;
    text-align: left;
}

.storyboard-config-grid input,
.storyboard-config-grid select {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(114, 109, 202, 0.28);
    border-radius: 10px;
    background: rgba(12, 14, 24, 0.96);
    color: #eef1ff;
    padding: 0 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.storyboard-config-grid select {
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #aeb7ff 50%),
        linear-gradient(135deg, #aeb7ff 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 38px;
}

.storyboard-config-grid select option {
    background: #121622;
    color: #eef1ff;
}

.storyboard-config-modal .modal-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.storyboard-config-modal .modal-actions .secondary-btn,
.storyboard-config-modal .modal-actions .primary-btn {
    min-width: 112px;
}

.storyboard-config-span-full {
    grid-column: 1 / -1;
}

.storyboard-config-span-full textarea {
    min-height: 168px;
}

@media (max-width: 900px) {
    .storyboard-head-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .storyboard-config-modal .modal-actions {
        display: flex;
        grid-template-columns: none;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .storyboard-deploy-actions {
        display: flex;
        grid-template-columns: none;
        flex-wrap: nowrap;
        justify-content: center;
    }

    .storyboard-cancel-btn {
        width: 100%;
    }
}

.shot-list {
    display: grid;
    gap: 28px;
    overflow-anchor: none;
}

.shot-empty {
    width: min(70%, 980px);
    min-height: 40px;
    margin: 0 auto;
    border: 1px dashed rgba(151, 143, 255, 0.2);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-align: center;
    font-size: var(--text-md);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.02);
}

.shot-row {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 30px minmax(0, 1fr) 30px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    width: 90%;
    margin: 0 auto;
    padding-right: 76px;
    cursor: grab;
}

.shot-row:active {
    cursor: grabbing;
}

.shot-row.is-dragging {
    opacity: 0.86;
    transform: scale(0.996);
    box-shadow: 0 18px 44px rgba(92, 82, 237, 0.14);
}

.shot-index-stack {
    --shot-mode-color: #6f5cff;
    --shot-mode-shadow: rgba(111, 92, 255, 0.28);
    align-self: center;
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 58px;
}

.shot-index-stack.is-independent {
    --shot-mode-color: #665d83;
    --shot-mode-shadow: rgba(102, 93, 131, 0.24);
}

.shot-index-stack.is-reference-continuity {
    --shot-mode-color: #705cff;
    --shot-mode-shadow: rgba(112, 92, 255, 0.34);
}

.shot-index-stack.is-motion-context {
    --shot-mode-color: #a34df2;
    --shot-mode-shadow: rgba(163, 77, 242, 0.4);
}

.shot-index-stack .shot-index {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--shot-mode-color);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 8px 22px var(--shot-mode-shadow);
}

.shot-continuity-tag {
    display: block;
    max-width: 58px;
    color: color-mix(in srgb, var(--shot-mode-color) 64%, #ffffff 36%);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
}

.shot-insert-between {
    position: absolute;
    top: -14px;
    left: 21px;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(151, 143, 255, 0.26);
    background: rgba(21, 22, 35, 0.56);
    color: rgba(195, 190, 255, 0.48);
    display: grid;
    place-items: center;
    font-size: 16px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.42;
    transition: opacity 0.16s ease, color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
    z-index: 2;
}

.shot-insert-between:hover {
    opacity: 1;
    color: #fff;
    border-color: rgba(151, 143, 255, 0.78);
    background: rgba(101, 91, 255, 0.86);
    transform: translate(-50%, -50%) scale(1.06);
}

.flow-arrow {
    color: #31364d;
    font-size: 24px;
    font-weight: 300;
    align-self: center;
}

.shot-card {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-width: 0;
    min-height: 198px;
    border-radius: 8px;
    background: #fff;
}

.shot-card h3 {
    margin: 0;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    line-height: var(--leading-title);
}

.shot-card > h3 {
    display: grid;
    place-items: center;
    min-height: 36px;
}

.shot-card-title-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin: 0;
}

.shot-card-title-row h3 {
    margin: 0;
}

.shot-duration-editor {
    position: absolute;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.shot-duration-editor input {
    width: 48px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid rgba(139, 126, 255, 0.34);
    border-radius: 6px;
    background: rgba(24, 24, 38, 0.92);
    color: var(--ink);
    text-align: center;
    font: inherit;
    outline: none;
}

.shot-duration-editor input:focus {
    border-color: rgba(139, 126, 255, 0.82);
    box-shadow: 0 0 0 2px rgba(111, 92, 255, 0.12);
}

.shot-source-tabs {
    display: flex;
    align-items: stretch;
    width: max-content;
    max-width: 100%;
    min-height: 32px;
    margin: 0 auto 8px;
    background: transparent;
}

.shot-source-tabs button {
    position: relative;
    min-width: 82px;
    height: 32px;
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: #a4a7ba;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.shot-source-tabs button::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: transparent;
}

.shot-source-tabs button.is-active {
    color: #f5f3ff;
}

.shot-source-tabs button.is-active::after {
    background: #835fff;
}

.shot-reference-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(56px, 1fr));
    align-content: start;
    align-items: start;
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 20px;
    border-radius: 5px;
    background: #090a11;
    overflow-x: auto;
    overflow-y: hidden;
}

.shot-reference-card,
.shot-reference-add {
    position: relative;
    min-width: 0;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 6px;
}

.shot-reference-card {
    border: 1px solid rgba(151, 143, 255, 0.24);
    background: #0d0e16;
}

.shot-reference-preview,
.shot-reference-audio {
    position: relative;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0d0e16;
}

.shot-reference-preview img,
.shot-reference-preview video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shot-reference-audio {
    display: grid;
    place-content: center;
    gap: 3px;
    color: #c9c3ff;
    text-align: center;
}

.shot-reference-audio span {
    font-size: 20px;
}

.shot-reference-audio small {
    font-size: 9px;
}

.shot-reference-card > span {
    position: absolute;
    right: 3px;
    bottom: 3px;
    left: 3px;
    overflow: hidden;
    padding: 2px 3px;
    border-radius: 3px;
    background: rgba(7, 8, 14, 0.8);
    color: #f1efff;
    font-size: 8px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.shot-reference-card > span strong,
.shot-reference-card > span small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shot-reference-card > span small {
    margin-top: 1px;
    color: #b8b6c8;
    font-size: 7px;
    font-weight: 600;
}

.shot-reference-card .remove-x {
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    font-size: 14px;
    line-height: 18px;
}

.shot-reference-add {
    display: grid;
    place-content: center;
    gap: 3px;
    border: 1px dashed rgba(151, 143, 255, 0.5);
    background: rgba(31, 32, 49, 0.84);
    color: #cfc8ff;
    text-align: center;
}

.shot-reference-add:hover {
    border-color: rgba(185, 156, 255, 0.95);
    background: rgba(45, 44, 68, 0.96);
}

.shot-reference-add span {
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
}

.shot-reference-add strong {
    font-size: 10px;
    white-space: nowrap;
}

.shot-content {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(76, 80, 130, 0.07);
}

.shot-content.shot-reference-board {
    display: flex;
    align-items: stretch;
    box-sizing: border-box;
    padding: 10px;
    border: 1px dashed rgba(151, 143, 255, 0.38);
    background: rgba(13, 14, 22, 0.82);
    box-shadow: none;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.shot-content.shot-reference-board.is-dragover,
.shot-content.shot-reference-board.is-paste-target {
    border-color: rgba(185, 156, 255, 0.96);
    background: rgba(35, 34, 56, 0.94);
    box-shadow: inset 0 0 0 1px rgba(185, 156, 255, 0.2);
}

.shot-text {
    border: 1px solid #f0f0fa;
    background: #fff;
    box-shadow: 0 18px 44px rgba(73, 78, 130, 0.09);
    overflow: hidden;
}

.shot-text p {
    margin: 0;
    padding: 22px 24px 18px;
    color: #5c6179;
    font-size: 13px;
    line-height: 1.75;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.shot-textarea {
    width: 100%;
    height: 100%;
    min-height: 100%;
    resize: none;
    border: 0;
    background: transparent;
    color: #e5edff;
    font-size: 13px;
    line-height: 1.75;
    padding: 22px 24px 18px;
}

.shot-img,
.shot-video {
    padding: 0;
    overflow: hidden;
    background: #f5f5fc;
}

.shot-img img,
.shot-video img,
.shot-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.shot-img,
.shot-video {
    aspect-ratio: 16 / 9;
    height: auto;
}

.shot-img .video-wrap,
.shot-video .video-wrap {
    width: 100%;
    height: 100%;
}

.shot-video .video-wrap video {
    display: block;
    background: #0f1018;
}

.shot-media-selector {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
    background: rgba(18, 19, 29, 0.72);
}

.shot-dialogue-check-status {
    position: absolute;
    z-index: 5;
    bottom: 14px;
    right: 14px;
    left: auto;
    display: inline-flex;
    max-width: calc(100% - 92px);
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border: 1px solid rgba(132, 128, 161, 0.42);
    border-radius: 5px;
    background: rgba(10, 11, 18, 0.82);
    color: #ccc9df;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.1;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
}

span.shot-dialogue-check-status {
    cursor: default;
    pointer-events: none;
}

.shot-dialogue-check-status i,
.shot-dialogue-check-status b {
    display: inline-grid;
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    place-items: center;
    border-radius: 50%;
    background: #8b8d9b;
    color: #11121b;
    font-size: 9px;
    font-weight: 900;
    font-style: normal;
}

.shot-dialogue-check-status.is-queued,
.shot-dialogue-check-status.is-running {
    border-color: rgba(249, 196, 75, 0.58);
    color: #f3dfa8;
}

.shot-dialogue-check-status.is-queued i,
.shot-dialogue-check-status.is-running i {
    background: #f6bd2f;
    box-shadow: 0 0 8px rgba(246, 189, 47, 0.35);
}

.shot-dialogue-check-status.is-pass {
    border-color: rgba(54, 210, 145, 0.56);
    color: #b6edd2;
}

.shot-dialogue-check-status.is-pass i {
    background: #32cf89;
}

.shot-dialogue-check-status.is-pass .review-passed-check { background: #32cf89; color: #073420; }
.shot-dialogue-check-status.is-editable { padding: 0; gap: 0; overflow: visible; }
.shot-review-details { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 4px 6px; background: transparent; border: 0; color: inherit; font: inherit; }
.shot-review-menu { position: relative; align-self: stretch; }
.shot-review-menu summary { display: grid; place-items: center; width: 24px; height: 100%; min-height: 24px; cursor: pointer; list-style: none; border-left: 1px solid currentColor; }
.shot-review-menu summary::-webkit-details-marker { display: none; }
.shot-review-menu [role="menu"] { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; display: grid; gap: 2px; width: 124px; padding: 4px; background: #18171d; border: 1px solid #474052; border-radius: 6px; box-shadow: 0 6px 18px #0008; }
.shot-review-menu [role="menuitemradio"] { min-height: 30px; padding: 5px 8px; text-align: left; font-size: 11px; color: #e5e3ec; border: 0; background: transparent; }
.shot-review-menu [role="menuitemradio"]:hover, .shot-review-menu [aria-checked="true"] { background: #302a40; }

.shot-dialogue-check-status.is-warning {
    border-color: rgba(245, 135, 113, 0.74);
    color: #ffd1c7;
}

.shot-dialogue-check-status.is-warning b {
    background: #ff806d;
}

.shot-dialogue-check-status.is-error,
.shot-dialogue-check-status.is-uncertain {
    border-color: rgba(190, 133, 237, 0.56);
    color: #dfc4fb;
}

.shot-dialogue-check-status.is-error i,
.shot-dialogue-check-status.is-uncertain i {
    background: #ba82e9;
}

.app-confirm-modal #appConfirmText {
    max-height: min(48vh, 430px);
    padding-right: 4px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.55;
}

.shot-media-selector > .shot-media-main:only-child,
.shot-media-selector:not(:has(> .shot-media-rail)) > .shot-media-main {
    grid-column: 1 / -1;
}

.shot-media-main {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(10, 11, 18, 0.72);
}

.shot-media-missing-label {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: none;
    place-items: center;
    padding: 18px 34px;
    color: rgba(226, 225, 238, 0.72);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    pointer-events: none;
}

.shot-media-main.is-missing .shot-media-missing-label {
    display: grid;
}

.shot-media-main.is-missing .shot-image-preview img,
.shot-media-main.is-missing .video-thumb-stage {
    visibility: hidden;
}

.shot-media-main .video-thumb-stage,
.shot-media-main > .video-thumb-stage {
    width: 100%;
    height: 100%;
}

.shot-video-live-preview {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    place-items: center;
    border: 1px solid rgba(137, 111, 255, 0.42);
    background: #080910;
}

.shot-media-selector:has(.shot-dispatch-status) {
    position: relative;
}

.shot-dispatch-status {
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 8px;
    right: 8px;
    pointer-events: none;
    min-width: 0;
}

.shot-dispatch-status.is-compact .shot-dispatch-caption {
    padding: 4px 7px;
    margin: 0;
    border: 0;
    background: rgba(10, 10, 13, 0.76);
}

.shot-dispatch-status.is-compact strong { font-size: 10px; line-height: 18px; }
.shot-dispatch-status.is-compact strong span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-dispatch-status.is-compact .shot-dispatch-spinner { width: 10px; height: 10px; flex-basis: 10px; }
.shot-dispatch-status.has-preview { bottom: 8px; }
.shot-dispatch-status.has-preview .shot-dispatch-preview { display: block; width: 100%; height: 100%; object-fit: contain; background: #08080b; }
.shot-dispatch-status.has-preview .shot-dispatch-caption { position: absolute; top: 0; left: 0; right: 0; }
.shot-dispatch-meter-compact { position: absolute; width: 1px; height: 1px; overflow: hidden; }

.shot-dispatch-status.is-paused {
    right: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 4px 3px 8px;
    border: 1px solid #34313f;
    border-radius: 6px;
    background: rgba(17, 17, 21, 0.92);
    color: #c2bdce;
    font-size: 11px;
    pointer-events: auto;
}

.shot-dispatch-status.is-paused button {
    width: 24px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.shot-media-selector > .shot-dispatch-status.is-paused {
    right: auto;
}

.shot-dispatch-status.is-empty {
    bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: #0b0b0e;
}

.shot-dispatch-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shot-dispatch-caption {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #34313f;
    border-radius: 6px;
    background: rgba(17, 17, 21, 0.92);
    color: #eeecf5;
}

.shot-dispatch-status.is-empty .shot-dispatch-caption {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
}

.shot-media-selector:has(> .shot-media-rail) > .shot-dispatch-status {
    right: 78px;
}

.shot-media-selector:has(> .shot-dialogue-check-status) .shot-dispatch-status.is-empty .shot-dispatch-caption {
    bottom: 38px;
}

.shot-dispatch-status.has-video .shot-dispatch-caption {
    margin-right: 28px;
}

.shot-dispatch-caption strong {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
}

.shot-dispatch-caption small {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.5;
    color: #aaa6b7;
}

.shot-dispatch-spinner {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border: 2px solid #464150;
    border-top-color: #b5a4ff;
    border-radius: 50%;
    animation: shot-dispatch-spin 0.9s linear infinite;
}

.shot-dispatch-meter {
    height: 3px;
    margin-top: 7px;
    overflow: hidden;
    background: #302c39;
    border-radius: 2px;
}

.shot-dispatch-meter span {
    display: block;
    height: 100%;
    background: #a18bf7;
}

.shot-dispatch-meter.is-indeterminate span {
    animation: shot-dispatch-wait 1.6s ease-in-out infinite alternate;
}

@keyframes shot-dispatch-spin { to { transform: rotate(360deg); } }
@keyframes shot-dispatch-wait { to { transform: translateX(230%); } }
@media (prefers-reduced-motion: reduce) {
    .shot-dispatch-spinner, .shot-dispatch-meter.is-indeterminate span { animation: none; }
}

.shot-video-live-preview-canvas {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: var(--video-preview-aspect, 16 / 9);
    overflow: hidden;
    background: #05060a;
}

.shot-video-live-preview-canvas.is-landscape {
    width: 100%;
    height: 100%;
}

.shot-video-live-preview-canvas.is-portrait {
    width: 31.640625%;
    height: 100%;
}

.shot-video-live-preview-canvas img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #080910;
}

.shot-video-live-empty {
    color: rgba(211, 208, 232, 0.58);
    font-size: 12px;
}

.shot-video-live-preview.is-waiting::before {
    content: "";
    position: absolute;
    width: 26px;
    height: 2px;
    margin-top: -28px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #8c72ff, transparent);
    animation: shot-live-preview-wait 1.8s ease-in-out infinite;
}

.shot-video-live-status {
    position: absolute;
    right: 7px;
    bottom: 7px;
    left: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 5px 7px;
    border-radius: 5px;
    color: #f2f0ff;
    background: rgba(10, 10, 18, 0.78);
    backdrop-filter: blur(5px);
}

.shot-video-live-status strong,
.shot-video-live-status small {
    overflow: hidden;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.shot-video-live-status small {
    color: rgba(224, 220, 242, 0.76);
}

@keyframes shot-live-preview-wait {
    0%, 100% { opacity: 0.28; transform: translateX(-18px); }
    50% { opacity: 1; transform: translateX(18px); }
}

.shot-media-rail {
    display: grid;
    grid-template-rows: 14px minmax(0, 1fr) 14px;
    gap: 3px;
    min-width: 0;
    min-height: 0;
}

.shot-media-thumbs {
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 4px;
    min-height: 0;
}

.shot-media-thumb {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 5px;
    background: #10111a;
    cursor: pointer;
}

.shot-media-thumb:hover {
    border-color: rgba(151, 143, 255, 0.72);
}

.shot-media-thumb.is-selected {
    border: 2px solid #795fff;
    box-shadow: 0 0 0 1px rgba(121, 95, 255, 0.28);
}

.shot-media-thumb img,
.shot-media-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* 分镜视频保持固定外框，横屏和竖屏都完整显示，空余区域使用黑边。 */
[data-shot-media-region="video"] .shot-media-main,
[data-shot-media-region="video"] .video-thumb-stage,
[data-shot-media-region="video"] .shot-media-thumb {
    background: #05060a;
}

[data-shot-media-region="video"] .video-thumb-stage video,
[data-shot-media-region="video"] .shot-media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    object-position: center;
    background: #05060a;
}

.shot-media-thumb span {
    position: absolute;
    right: 2px;
    bottom: 2px;
    padding: 1px 3px;
    border-radius: 3px;
    background: #745aff;
    color: #fff;
    font-size: 9px;
    line-height: 1.3;
    pointer-events: none;
}

.shot-media-arrow {
    display: grid;
    place-items: center;
    width: 100%;
    height: 14px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9f93ff;
    cursor: pointer;
}

.shot-media-arrow svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shot-media-arrow:disabled {
    opacity: 0.22;
    cursor: default;
}

.shot-content:has(.empty-image) {
    border: 1px dashed #deddf5;
    background: #fff;
    box-shadow: none;
}

.shot-content:has(.empty-video) {
    background: #f5f5fc;
    box-shadow: none;
}

/* The storyboard image board must stay opaque black even when it contains
   the generic empty-image state, which otherwise applies a light background. */
.shot-content.storyboard-generated-image-board {
    background: #050509 !important;
    background-color: #050509 !important;
    background-image: none !important;
    box-shadow: none !important;
}

.empty-media {
    display: grid;
    place-items: center;
    gap: 12px;
    height: 100%;
    align-content: center;
    justify-items: center;
    color: #8d92a8;
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 700;
}

.empty-image {
    gap: 0;
}

.empty-media svg {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: #5f57db;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.video-wrap {
    position: relative;
}

.play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
}

.play::before {
    content: "";
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.28);
    border: 2px solid rgba(255, 255, 255, 0.72);
}

.play::after {
    content: "";
    z-index: 1;
    margin-left: 5px;
    border-left: 16px solid #fff;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.shot-action {
    display: block;
    width: 100%;
    margin-top: 10px;
    border: 0;
    border-radius: 999px;
    background: #f0effb;
    color: var(--brand);
    font-size: 13px;
    font-weight: 800;
}

.shot-split-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.shot-video-actions .shot-action {
    font-size: 12px;
}

.shot-video-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    position: relative;
    overflow: visible;
    z-index: 4;
}

.shot-video-actions .story-batch-shot-controls {
    min-width: 0;
    padding: 0;
    white-space: nowrap;
}

.story-batch-shot-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    min-height: 30px;
    padding: 3px 8px 0;
    color: #9b9caf;
    font-size: 11px;
    font-weight: 700;
}

.story-batch-shot-controls.is-compact {
    min-height: 0;
    padding: 0;
    gap: 6px;
    font-size: 10px;
}

.story-batch-shot-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.story-batch-shot-status i {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #8d8d9d;
}

.story-batch-shot-status.is-working i {
    background: #36d477;
    box-shadow: 0 0 7px rgba(54, 212, 119, .45);
}

.story-batch-shot-status.is-complete i {
    background: #36d477;
}

.story-batch-shot-status.is-stopped i {
    background: #e8b84a;
}

.story-batch-shot-status.is-cancelled i {
    background: #c97883;
}

.story-batch-shot-control {
    min-width: 42px;
    height: 25px;
    padding: 0 9px;
    border: 1px solid rgba(139, 126, 255, .3);
    border-radius: 999px;
    background: rgba(29, 29, 51, .72);
    color: #c9c6df;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.story-batch-shot-control:hover:not(:disabled) {
    border-color: rgba(139, 126, 255, .75);
    color: #fff;
}

.story-batch-shot-control.is-danger {
    color: #d798a1;
}

.story-batch-shot-control:disabled {
    opacity: .55;
    cursor: wait;
}

.shot-video-view-tabs {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
    margin: 0 0 -1px;
    padding: 0 4px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.shot-video-view-tabs .story-batch-shot-controls {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 32px;
    margin-left: auto;
    padding: 0 0 0 3px;
    gap: 3px;
    font-size: 10px;
    white-space: nowrap;
}

.shot-video-view-tabs .story-batch-shot-control {
    height: 22px;
    min-width: 32px;
    padding: 0 5px;
    font-size: 10px;
}

.shot-video-view-tabs button {
    width: 112px;
    height: 32px;
    flex: 0 1 112px;
    min-width: 0;
    padding: 0 8px;
    border: 1px solid rgba(139, 126, 255, 0.24);
    border-bottom-color: rgba(139, 126, 255, 0.32);
    border-radius: 6px 6px 0 0;
    background: rgba(29, 29, 51, 0.78);
    color: #aaa8c1;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.shot-video-view-tabs button.is-active {
    border-color: rgba(137, 106, 255, 0.82);
    border-bottom-color: #7658e9;
    background: #7658e9;
    color: #fff;
}

.shot-video-view-tabs .shot-custom-video-button,
.storyboard-shot-media-tabs .shot-custom-storyboard-image-button {
    width: auto;
    height: 26px;
    flex: 0 0 auto;
    margin: 0 2px 3px 0;
    padding: 0 5px;
    border-color: transparent;
    background: transparent;
    color: #77758d;
    font-size: 9px;
    font-weight: 600;
}

.shot-video-view-tabs .shot-dialogue-check-actions {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin: 0 1px 0 auto;
    min-width: 0;
}

.shot-video-view-tabs .shot-dialogue-check-actions .shot-custom-video-button {
    margin-bottom: 3px;
    color: #aaa8c1;
}

.shot-video-view-tabs .shot-dialogue-check-all-button {
    color: #8e87c8;
}

.shot-video-view-tabs .shot-custom-video-button:hover,
.storyboard-shot-media-tabs .shot-custom-storyboard-image-button:hover:not(:disabled) {
    border-color: rgba(139, 126, 255, 0.2);
    background: rgba(139, 126, 255, 0.06);
    color: #aaa8c1;
}

.storyboard-shot-media-tabs .shot-custom-storyboard-image-button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

.shot-video-view-panel {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
}

.shot-video-view-panel > .shot-content,
.shot-video-view-panel > .shot-final-prompt {
    border-top-left-radius: 4px;
}

.shot-video-view-panel > .shot-content {
    height: 100%;
}

.shot-final-prompt {
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    resize: none;
    padding: 16px;
    border: 1px solid rgba(139, 126, 255, 0.32);
    border-radius: 8px;
    outline: none;
    background: #0b0c14;
    color: #e7e5f3;
    font: inherit;
    font-size: 12px;
    line-height: 1.65;
    overflow-y: auto;
}

.shot-final-prompt:focus {
    border-color: rgba(156, 126, 255, 0.9);
    box-shadow: inset 0 0 0 1px rgba(156, 126, 255, 0.16);
}

.shot-video-details-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 0 13px;
    background: rgba(32, 31, 66, 0.96);
    color: #e8e5ff;
}

.shot-video-details-action:disabled,
.shot-storyboard-regenerate-action:disabled {
    background: rgba(32, 31, 66, 0.58);
    color: rgba(232, 229, 255, 0.42);
    opacity: 0.62;
    filter: none;
}

.shot-video-details-label {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.shot-video-details-label svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shot-video-statuses {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    overflow: hidden;
}

.shot-video-status {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    color: #a9aac0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.shot-video-status i {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #696b75;
}

.shot-video-status.is-working i {
    background: #f6bd2f;
    box-shadow: 0 0 8px rgba(246, 189, 47, 0.34);
}

.shot-video-status.is-working,
.shot-video-status.is-complete {
    color: #e6e3f8;
}

.shot-video-status.is-complete i {
    background: #29d565;
    box-shadow: 0 0 8px rgba(41, 213, 101, 0.34);
}

.shot-video-status.is-error {
    color: #ffb1bd;
}

.shot-video-status.is-error i {
    background: #f05268;
    box-shadow: 0 0 8px rgba(240, 82, 104, 0.3);
}

.shot-video-repeat-action {
    min-width: 88px;
    padding-inline: 10px;
}

.shot-reference-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.shot-reference-actions .shot-action {
    min-width: 0;
    padding: 0 13px;
    font-size: 12px;
    white-space: nowrap;
}

.storyboard-shot-prompt-popover {
    --prompt-agent-pointer-x: calc(75% + 2px);
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 24;
    width: min(350px, calc(100vw - 32px));
    min-height: 116px;
    padding: 14px 16px 12px;
    border: 1px solid rgba(151, 143, 255, 0.58);
    border-radius: 7px;
    background: #202132;
    color: #eceaff;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.48);
}

.storyboard-shot-prompt-popover::after {
    content: "";
    position: absolute;
    right: 22%;
    bottom: -8px;
    width: 14px;
    height: 14px;
    border: solid rgba(151, 143, 255, 0.58);
    border-width: 0 1px 1px 0;
    background: #202132;
    transform: rotate(45deg);
}

.is-video-prompt-batch .prompt-agent-status-detail {
    max-height: 120px;
}

.is-video-prompt-batch .prompt-agent-status-detail span {
    display: block;
    white-space: pre-wrap;
    -webkit-line-clamp: unset;
}

.prompt-agent-status-popover.is-video-prompt-batch,
.prompt-agent-status-popover.is-video-prompt-batch::after {
    background: var(--jian-panel-raised);
    border-color: var(--jian-accent-line);
    color: var(--jian-ink);
}

.is-video-prompt-batch :is(.prompt-agent-status-text, .prompt-agent-status-detail) { color: var(--jian-ink); }
.is-video-prompt-batch :is(.prompt-agent-status-meta, .prompt-agent-status-detail-label) { color: var(--jian-muted); }

.storyboard-shot-prompt-popover[data-state="complete"] .prompt-agent-status-dot {
    background: #42d392;
    box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.12);
}

.storyboard-shot-prompt-popover[data-state="error"] .prompt-agent-status-dot,
.storyboard-shot-prompt-popover[data-state="cancelled"] .prompt-agent-status-dot {
    background: #ff7f9f;
    box-shadow: 0 0 0 4px rgba(255, 127, 159, 0.12);
}

.shot-split-actions .shot-action {
    margin-top: 0;
    line-height: 32px;
}

.shot-split-actions .shot-text-agent-tools {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.shot-split-actions .shot-text-agent-tools .prompt-agent-process {
    width: 100%;
    min-width: 0;
    height: 32px;
    margin: 0;
    padding: 0 10px;
    line-height: 1;
}

.shot-action-secondary {
    background: rgba(30, 33, 48, 0.9);
    color: #d9defe;
}

.shot-action.is-generating {
    position: relative;
    overflow: hidden;
    border-color: rgba(153, 145, 255, 0.58);
    box-shadow: 0 0 0 1px rgba(145, 138, 255, 0.18), 0 12px 24px rgba(90, 75, 240, 0.16);
}

.shot-action.is-generating::after {
    content: "";
    position: absolute;
    top: -28%;
    bottom: -28%;
    left: -42%;
    width: 34%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.12) 38%, rgba(255,255,255,0.72) 50%, rgba(255,255,255,0.12) 62%, rgba(255,255,255,0) 100%);
    transform: skewX(-22deg);
    animation: storyboard-button-scan 1.15s linear infinite;
    pointer-events: none;
}

.shot-drag-handle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #8f95b3;
    display: grid;
    place-items: center;
    cursor: inherit;
}

.shot-drag-handle:active {
    cursor: inherit;
}

.shot-drag-handle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
}

.nav-exit-link svg path {
    fill: none !important;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shot-row.is-drag-over {
    outline: 2px dashed rgba(108, 101, 230, 0.55);
    outline-offset: 6px;
    background: rgba(91, 83, 236, 0.04);
}

.delete-shot {
    position: absolute;
    bottom: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #9296aa;
}

.delete-shot svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.add-shot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: min(84%, 820px);
    height: 96px;
    margin: 30px auto 0;
    border: 1.5px dashed #dfddff;
    border-radius: 8px;
    background: transparent;
    color: var(--brand);
}

.add-shot strong {
    font-size: var(--text-md);
    font-weight: 800;
    line-height: 1;
}

.lightbox-modal {
    position: relative;
    width: min(92vw, 1180px);
    min-height: 320px;
    padding: 24px 72px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(18, 19, 29, 0.98), rgba(10, 11, 18, 0.98));
    border: 1px solid rgba(151, 143, 255, 0.18);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

#lightboxModal {
    z-index: 140;
}

#lightboxModal .lightbox-modal {
    z-index: 141;
}

.lightbox-modal img {
    display: block;
    width: 100%;
    max-height: calc(90vh - 110px);
    object-fit: contain;
    border-radius: 12px;
    background: #05060a;
}

.lightbox-modal video {
    display: block;
    width: 100%;
    max-height: calc(90vh - 110px);
    object-fit: contain;
    border-radius: 12px;
    background: #05060a;
}

.lightbox-stage {
    position: relative;
}

.lightbox-asset-prompt {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(151, 143, 255, 0.24);
    border-radius: 8px;
    background: rgba(25, 26, 42, 0.72);
    color: rgba(235, 234, 255, 0.86);
}

.lightbox-asset-prompt summary {
    width: fit-content;
    color: #b9afff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.lightbox-asset-prompt p {
    max-height: 150px;
    margin: 10px 0 0;
    overflow: auto;
    color: rgba(245, 244, 255, 0.88);
    font-size: 13px;
    line-height: 1.65;
    text-align: left;
    white-space: pre-wrap;
}

.lightbox-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.lightbox-progress {
    flex: 1 1 0;
    min-width: 0;
    color: rgba(234, 236, 255, 0.88);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-tools {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    flex: 0 0 auto;
    gap: 5px;
}

.lightbox-frame-interpolation {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lightbox-frame-interpolation select {
    width: 76px;
    min-width: 76px;
    height: 40px;
    padding: 0 30px 0 12px;
    border: 1px solid rgba(151, 143, 255, 0.35);
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(17, 18, 30, 0.92);
    background-image:
        linear-gradient(45deg, transparent 50%, #c7c0ff 50%),
        linear-gradient(135deg, #c7c0ff 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 13px) calc(50% - 3px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    color: #f4f1ff;
    font: inherit;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.lightbox-frame-interpolation select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(126, 101, 255, 0.16);
}

.lightbox-frame-interpolation .primary-btn {
    min-width: 68px;
    height: 40px;
    padding: 0 16px;
    background: var(--brand);
    color: #fff;
}

.lightbox-frame-interpolation .lightbox-tail-reference-btn {
    min-width: 146px;
    white-space: nowrap;
}

.lightbox-frame-interpolation .lightbox-mirror-video-btn {
    min-width: 88px;
    white-space: nowrap;
}

.lightbox-frame-interpolation .lightbox-last-frame-btn {
    min-width: 112px;
    white-space: nowrap;
}

.lightbox-tools .secondary-btn {
   
    background: rgba(17, 18, 30, 0.92);
    color: #f4f1ff;
    border: 1px solid rgba(151, 143, 255, 0.24);
    backdrop-filter: blur(12px);
}

.lightbox-tools .secondary-btn.is-active {
    border-color: rgba(151, 143, 255, 0.5);
    background: rgba(68, 55, 190, 0.24);
    color: #ffffff;
}

.lightbox-tools.is-story-asset-tools {
    gap: 4px;
}

.lightbox-tools.is-story-asset-tools .secondary-btn {
    min-width: 0;
    height: 32px;
    padding: 0 9px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.lightbox-tools.is-story-asset-tools .tone-tool-btn > svg,
.lightbox-tools.is-story-asset-tools .tone-tool-vip svg {
    width: 14px;
    height: 14px;
}

.lightbox-footer-video {
    justify-content: center;
    min-height: 0;
}

.lightbox-footer-video .lightbox-progress,
.lightbox-footer-video .tone-adjust-popover {
    display: none !important;
}

.lightbox-footer-video.lightbox-footer-processing .lightbox-progress {
    display: block !important;
}

.lightbox-crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 80;
    cursor: crosshair;
}

.lightbox-crop-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 10, 0.34);
}

.lightbox-crop-selection {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.94);
    box-shadow: 0 0 0 9999px rgba(5, 6, 10, 0.42);
    background: rgba(255, 255, 255, 0.08);
    cursor: move;
}

.lightbox-crop-confirm-chip {
    position: absolute;
    right: 18px;
    bottom: 18px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid rgba(154, 143, 255, 0.48);
    border-radius: 999px;
    background: rgba(18, 19, 31, 0.92);
    color: #f5f4ff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 14px 30px rgba(7, 9, 19, 0.32);
    cursor: pointer;
}

.lightbox-crop-confirm-chip:hover {
    background: rgba(92, 79, 208, 0.94);
    border-color: rgba(184, 174, 255, 0.68);
}

.lightbox-modal p {
    margin: 14px 4px 0;
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 700;
    text-align: center;
}

.lightbox-caption-row {
    display: flex;
    justify-content: center;
    min-height: 32px;
    margin: 10px 4px 0;
}

.lightbox-caption-button {
    min-width: 0;
    max-width: min(100%, 720px);
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: var(--text-md);
    font-weight: 700;
    cursor: default;
}

.lightbox-caption-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox-caption-button svg {
    display: none;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox-caption-button.is-editable {
    cursor: pointer;
}

.lightbox-caption-button.is-editable svg {
    display: block;
    opacity: 0.72;
}

.lightbox-caption-button.is-editable:hover,
.lightbox-caption-button.is-editable:focus-visible {
    background: rgba(151, 143, 255, 0.1);
    color: #fff;
    outline: none;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(19, 22, 33, 0.92);
    color: #f3f5ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
    z-index: 2;
}

.lightbox-nav:hover {
    background: rgba(41, 45, 67, 0.98);
    border-color: rgba(126, 111, 255, 0.32);
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox-prev {
    left: 12px;
}

.lightbox-next {
    right: 12px;
}

.library-view .back-link {
    margin-left: -8px;
}

.mine-view {
    display: grid;
    gap: 18px;
}

.settings-category-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 8px;
    border: 1px solid rgba(151, 157, 210, 0.14);
    border-radius: 13px;
    background: rgba(18, 19, 29, 0.94);
    box-shadow: var(--shadow);
}

.settings-category-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 58px;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #aeb4cb;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.settings-category-tab:hover,
.settings-category-tab:focus-visible {
    border-color: rgba(151, 143, 255, 0.3);
    color: #f7f5ff;
    outline: none;
}

.settings-category-tab.is-active {
    border-color: rgba(151, 143, 255, 0.42);
    background: rgba(124, 108, 255, 0.18);
    box-shadow: inset 0 -2px 0 #8374ff;
    color: #ffffff;
}

.settings-category-tab-icon {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.settings-category-tab-icon svg {
    width: 22px;
    height: 22px;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.settings-category-tab-icon-host { color: #58b7ff; }
.settings-category-tab-icon-ai { color: #b59cff; }
.settings-category-tab-icon-automation { color: #5ee6ae; }
.settings-category-tab-icon-other { color: #ffd166; }

[data-settings-group].is-settings-tab-hidden {
    display: none !important;
}

.mine-header-band,
.mine-panel {
    border-radius: 13px;
    background: rgba(18, 19, 29, 0.94);
    border: 1px solid rgba(151, 157, 210, 0.12);
    box-shadow: var(--shadow);
}

.mine-header-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 26px 28px;
}

.mine-header-band h1 {
    margin: 0;
    font-size: var(--text-page);
    font-weight: 800;
    line-height: var(--leading-title);
}

.mine-header-band p {
    margin: 8px 0 0;
    color: var(--muted);
}

.settings-header-version {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-width: 0;
}

.settings-header-version-label {
    color: #d7daeb;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.mine-version {
    color: #a9afc8;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.mine-version-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.mine-update-notice {
    appearance: none;
    cursor: pointer;
    padding: 6px 12px;
    border: 1px solid rgba(124, 108, 255, 0.24);
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.12);
    color: #f4f1ff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.mine-update-notice.is-checking,
.mine-update-notice.is-current {
    cursor: default;
    border-color: rgba(94, 230, 174, 0.22);
    background: rgba(94, 230, 174, 0.1);
    color: #a7f3d0;
}

.mine-update-notice.is-checking {
    border-color: rgba(169, 175, 200, 0.18);
    background: rgba(169, 175, 200, 0.08);
    color: #a9afc8;
}

.mine-update-notice.has-update {
    cursor: pointer;
}

.mine-update-notice:hover {
    border-color: rgba(151, 143, 255, 0.56);
    background: rgba(124, 108, 255, 0.22);
}

.mine-update-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    width: min(380px, calc(100vw - 48px));
    padding: 18px;
    border: 1px solid rgba(151, 143, 255, 0.34);
    border-radius: 16px;
    background: rgba(16, 17, 28, 0.98);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
    color: rgba(244, 241, 255, 0.9);
    text-align: left;
}

.mine-update-popover-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #f5f3ff;
    cursor: pointer;
}

.mine-update-popover-body {
    max-height: 360px;
    overflow: auto;
    padding-right: 28px;
    font-size: 13px;
    line-height: 1.7;
}

.mine-update-popover-body h1,
.mine-update-popover-body h2,
.mine-update-popover-body h3 {
    margin: 0 0 10px;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.35;
}

.mine-update-popover-body p {
    margin: 0 0 10px;
}

.mine-update-popover-body a {
    color: #a89fff;
    font-weight: 800;
    text-decoration: none;
}

.mine-update-popover-body a:hover {
    text-decoration: underline;
}

.mine-update-loading {
    color: var(--muted);
}

.mine-version-history {
    display: grid;
    gap: 12px;
}

.mine-version-entry {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid rgba(151, 157, 210, 0.12);
    border-radius: 14px;
    background: rgba(12, 14, 24, 0.72);
}

.mine-version-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mine-version-entry strong {
    color: #eef1ff;
    font-size: 14px;
    font-weight: 800;
}

.mine-version-entry time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.mine-version-entry p {
    margin: 0;
    color: #a9afc8;
    font-size: 13px;
    line-height: 1.6;
}

.mine-title-row,
.mine-ai-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mine-title-row h1,
.mine-ai-title-row h2 {
    margin: 0;
}

.mine-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 30px;
    border: 1px solid rgba(151, 143, 255, 0.24);
    border-radius: 999px;
    padding: 0 12px;
    background: rgba(124, 108, 255, 0.12);
    color: #dcd7ff;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mine-refresh-btn:hover:not(:disabled),
.mine-refresh-btn:focus-visible {
    border-color: rgba(151, 143, 255, 0.52);
    background: rgba(124, 108, 255, 0.22);
    color: #ffffff;
}

.mine-refresh-btn:disabled {
    cursor: wait;
    opacity: 0.58;
}

.mine-panel {
    padding: 24px 28px 28px;
}

.mine-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.mine-panel-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.mine-panel-head p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.mine-project-path-card {
    display: grid;
    gap: 14px;
}

.mine-project-path {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 14px;
    background: rgba(18, 20, 31, 0.92);
    color: #d8dcff;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
}

.mine-toolbar {
    display: grid;
    grid-template-columns: 220px 280px auto;
    gap: 16px;
    align-items: end;
}

.mine-toolbar-add {
    grid-template-columns: minmax(0, 1fr) auto;
}

.mine-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.mine-field-wide {
    min-width: 0;
}

.mine-mobile-access {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid rgba(151, 157, 210, 0.12);
    border-radius: 14px;
    background: rgba(12, 14, 24, 0.74);
}

.mine-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.mine-mobile-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

.mine-mobile-panel {
    display: grid;
    gap: 10px;
}

.mine-mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mine-mobile-row strong {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
}

.mine-mobile-copy {
    min-width: 96px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.mine-mobile-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(19, 21, 33, 0.88);
    border: 1px solid rgba(124, 108, 255, 0.18);
    color: #dcd7ff;
    text-decoration: none;
    word-break: break-all;
}

.mine-mobile-hint {
    margin: 0;
}

.mine-field input,
.mine-field select {
    width: 100%;
    height: 46px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    padding: 0 14px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.mine-ai-field-note {
    margin-left: 6px;
    color: rgba(166, 171, 206, 0.72);
    font-size: 11px;
    font-weight: 650;
}

.mine-field input.is-invalid {
    border-color: rgba(255, 92, 126, 0.72);
    box-shadow: 0 0 0 2px rgba(255, 92, 126, 0.1);
}

.mine-model-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.mine-ai-profile-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

.mine-ai-profile-action {
    min-width: 58px;
    height: 46px;
    padding: 0 12px;
    border-radius: 8px;
}

.mine-ai-profile-action.is-danger {
    color: #ff9aaf;
}

.mine-ai-profile-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mine-model-help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    max-width: 184px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 8px;
    padding: 0 12px;
    background: rgba(24, 25, 38, 0.96);
    color: #d8dcff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mine-model-help-trigger:hover,
.mine-model-help-trigger:focus-visible {
    border-color: rgba(138, 114, 255, 0.58);
    background: rgba(46, 39, 78, 0.92);
    color: #ffffff;
}

.mine-model-help-trigger svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mine-model-help-trigger span {
    white-space: normal;
    text-align: left;
}

.model-help-modal {
    width: min(100%, 720px);
    max-height: min(92vh, 860px);
    padding: 24px;
    text-align: left;
    overflow: hidden;
    border: 1px solid rgba(151, 143, 255, 0.24);
    background:
        radial-gradient(circle at 16% 0%, rgba(124, 108, 255, 0.22), transparent 32%),
        linear-gradient(180deg, rgba(19, 20, 34, 0.98), rgba(9, 10, 18, 0.98));
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.model-help-modal h2 {
    margin-bottom: 18px;
    text-align: center;
    color: #f4f6ff;
}

.model-help-body {
    display: grid;
    gap: 14px;
    max-height: calc(min(82vh, 760px) - 104px);
    padding-right: 4px;
    overflow: auto;
    color: rgba(216, 220, 255, 0.76);
    font-size: 13px;
    line-height: 1.65;
}

.model-help-body section {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 8px;
    background: rgba(17, 19, 32, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.model-help-body h3,
.model-help-body p {
    margin: 0;
}

.model-help-body h3 {
    color: #f4f6ff;
    font-size: 14px;
    font-weight: 900;
}

.model-help-body code,
.model-help-body pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.model-help-body code {
    color: #bfb8ff;
    font-size: 12px;
    word-break: break-all;
}

.model-help-body pre {
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 8px;
    background: rgba(5, 6, 12, 0.72);
    color: #f2f0ff;
    overflow: auto;
}

.model-help-body pre code {
    color: inherit;
    font-size: 12px;
    line-height: 1.55;
    word-break: normal;
}

.model-help-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.model-help-links a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid rgba(151, 143, 255, 0.3);
    border-radius: 8px;
    padding: 0 12px;
    background: linear-gradient(135deg, rgba(124, 108, 255, 0.94), rgba(86, 219, 190, 0.24));
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.model-help-links a:hover {
    border-color: rgba(151, 143, 255, 0.62);
    background: linear-gradient(135deg, rgba(142, 121, 255, 0.98), rgba(86, 219, 190, 0.32));
}

.mine-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mine-ai-thinking-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    color: #f0efff;
    font-weight: 800;
    cursor: pointer;
}

.mine-ai-thinking-toggle input {
    inline-size: 18px;
    block-size: 18px;
    accent-color: #8c72ff;
    cursor: pointer;
}

.mine-ai-thinking-toggle input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.mine-ai-thinking-field small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.mine-actions .secondary-btn,
.mine-actions .primary-btn {
    min-width: 126px;
}

#testAiReasoningBtn.is-testing {
    border-color: rgba(151, 143, 255, 0.48);
    color: #d9d5ff;
}

.danger-btn {
    min-width: 120px;
    height: 48px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 109, 149, 0.16);
    color: #ff8dac;
    font-size: var(--text-body);
    font-weight: 800;
}

.mine-status {
    margin: 18px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.mine-status[data-state="testing"] {
    color: #c9c5ff;
}

.mine-status[data-state="success"] {
    color: #9cebc5;
}

.mine-status[data-state="warning"] {
    color: #f0c77a;
}

.mine-status[data-state="error"] {
    color: #ff91aa;
}

.mine-host-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.mine-ai-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.mine-ai-host-badge {
    display: inline-flex;
    align-items: center;
    max-width: min(420px, 48vw);
    min-height: 28px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(124, 108, 255, 0.1);
    color: #d8d4ff;
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mine-ai-host-badge[data-status="idle"] {
    border-color: rgba(65, 226, 147, 0.28);
    background: rgba(65, 226, 147, 0.1);
    color: #a9f6cf;
}

.mine-ai-host-badge[data-status="busy"] {
    border-color: rgba(255, 199, 93, 0.3);
    background: rgba(255, 199, 93, 0.1);
    color: #ffe0a1;
}

.mine-ai-host-badge[data-status="offline"] {
    border-color: rgba(151, 157, 210, 0.16);
    background: rgba(151, 157, 210, 0.08);
    color: var(--muted);
}

.mine-ai-gpu-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.72fr) minmax(150px, 1fr);
    align-items: center;
    gap: 10px;
}

.mine-ai-gpu-field small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    min-width: 0;
}

.mine-ai-gpu-highlight {
    color: #8b6cff;
    font-weight: 800;
}

.mine-host-empty {
    align-items: start;
    gap: 8px;
    padding: 18px;
    text-align: left;
}

.mine-host-empty strong {
    color: var(--ink);
    font-size: 14px;
}

.mine-host-card,
.config-card {
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 10px;
    background: rgba(24, 25, 38, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.mine-host-card {
    position: relative;
    padding: 18px;
    cursor: pointer;
    min-width: 0;
}

.mine-host-card.is-active {
    border-color: rgba(151, 143, 255, 0.4);
    box-shadow: 0 18px 40px rgba(81, 66, 194, 0.18);
    min-width: 277px;
}

.mine-host-top,
.config-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mine-host-top strong,
.config-card-head strong {
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 800;
}

.mine-host-inline-tag {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.14);
    color: #d8d4ff;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.mine-host-top b {
    margin-left: auto;
    color: var(--muted);
    font-size: var(--text-xs);
}

.mine-host-card p,
.config-card p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.mine-host-actions {
   
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
}

.mine-host-mini {
    min-width: 0;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.mine-host-use {
    width: auto;
}

.mine-host-delete {
    color: #ff9ab6;
    border-color: rgba(255, 109, 149, 0.18);
    background: rgba(255, 109, 149, 0.08);
}

.mine-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.config-result-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-height: 30px;
    color: var(--muted);
    font-size: var(--text-sm);
}

.config-clear-info-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #a99cff;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 800;
    padding: 0;
}

.config-clear-info-btn:hover {
    color: #c9c1ff;
}

.config-card {
    padding: 18px;
}

.config-item-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.config-item {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 12px 11px;
    border: 1px solid rgba(151, 143, 255, 0.12);
    border-radius: 10px;
    background: rgba(19, 21, 33, 0.88);
}

.config-item-error {
    border-color: rgba(255, 109, 149, 0.28);
    background: rgba(49, 19, 29, 0.52);
    cursor: help;
}

.config-item-warn {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(58, 38, 9, 0.52);
    cursor: help;
}

.config-item-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.config-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.config-item-copy strong {
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
    line-height: 1.4;
    word-break: break-word;
}

.config-item-copy span,
.config-item-copy em {
    color: var(--muted);
    font-size: var(--text-xs);
    font-style: normal;
    line-height: 1.5;
    word-break: break-word;
}

.config-item[data-hint]::after {
    content: attr(data-hint);
    position: absolute;
    left: 12px;
    top: calc(100% + 8px);
    z-index: 200;
    display: none;
    max-width: min(360px, 80vw);
    padding: 10px 12px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 10px;
    background: rgba(14, 16, 25, 0.98);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    color: #f4f1ff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
}

.config-item[data-hint]:hover::after,
.config-item[data-hint]:focus-within::after {
    display: block;
}

.config-item-tag {
    flex: 0 0 auto;
    padding: 2px 7px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(224, 218, 255, 0.8);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;
    text-transform: uppercase;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.status-idle {
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.14);
}

.status-ok {
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.14);
}

.status-busy {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.status-warn {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.status-offline {
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

.status-error {
    background: #ff6d95;
    box-shadow: 0 0 0 4px rgba(255, 109, 149, 0.14);
}

.library-switch {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 22px 0 30px;
}

.library-task-status:not(.nav-task-status) {
    position: relative;
}

.library-task-trigger {
    position: relative;
    width: 100%;
    display: grid;
    gap: 8px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 14px;
    background: rgba(24, 25, 38, 0.96);
    color: #f4f1ff;
    text-align: left;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.library-task-title {
    color: rgba(224, 218, 255, 0.72);
    font-size: 12px;
    font-weight: 800;
}

.library-task-summary {
    position: relative;
    z-index: 1;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.45;
}

.library-task-glow {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.9);
    box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.4);
}

.library-task-status.has-active-tasks .library-task-glow {
    background: #60a5fa;
    animation: library-task-pulse 1.4s ease-out infinite;
}

@keyframes library-task-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.38);
        opacity: 0.85;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(96, 165, 250, 0);
        opacity: 1;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0);
        opacity: 0.85;
    }
}

.library-task-popover {
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 10px);
    z-index: 12;
    display: grid;
    gap: 12px;
    min-width: 0;
    width: min(360px, calc(100vw - 32px));
    max-height: 420px;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 14px;
    background: rgba(19, 21, 33, 0.98);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.library-task-status:hover .library-task-popover,
.library-task-status:focus-within .library-task-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.library-task-empty,
.library-task-section-title {
    color: rgba(224, 218, 255, 0.72);
    font-size: 12px;
    font-weight: 800;
}

.library-task-section {
    display: grid;
    gap: 8px;
}

.library-task-item {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    padding: 12px 12px 10px;
    border: 1px solid rgba(151, 143, 255, 0.14);
    border-radius: 12px;
    background: rgba(28, 31, 48, 0.96);
    color: #f7f4ff;
    text-align: left;
    cursor: default;
}

.library-task-item:hover {
    border-color: rgba(151, 143, 255, 0.3);
    background: rgba(33, 36, 56, 1);
}

.library-task-item.is-openable {
    cursor: pointer;
}

.library-task-item-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.library-task-item-copy strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-task-agent-badge {
    display: inline-flex;
    align-items: center;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(124, 109, 255, 0.2);
    color: #cfc8ff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.library-task-item-copy span {
    color: rgba(224, 218, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-task-item b {
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.library-task-item-track {
    grid-column: 1 / -1;
    display: block;
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
        rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.library-task-item-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)),
        linear-gradient(90deg, #6f5cff, #b6a8ff, #51d6ff);
    box-shadow: 0 0 16px rgba(111, 92, 255, 0.42), 0 0 28px rgba(81, 214, 255, 0.18);
}

.library-pagination {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    background:
        radial-gradient(circle at top left, rgba(112, 92, 255, 0.18), rgba(112, 92, 255, 0) 42%),
        rgba(18, 21, 34, 0.94);
    box-shadow: 0 18px 42px rgba(8, 10, 18, 0.22);
}

.library-pagination-meta {
    color: rgba(224, 218, 255, 0.72);
    font-size: 12px;
    font-weight: 700;
}

.library-pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.library-pagination-actions span {
    color: #f4f1ff;
    font-size: 12px;
    font-weight: 800;
}

.library-pagination-actions .secondary-btn {
    min-width: 92px;
    height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border-color: rgba(151, 143, 255, 0.2);
    background: rgba(39, 43, 66, 0.96);
    color: #f7f4ff;
    box-shadow: none;
}

.library-pagination-actions .secondary-btn:hover:not(:disabled) {
    border-color: rgba(151, 143, 255, 0.36);
    background: rgba(48, 53, 79, 1);
}

.library-pagination-actions .secondary-btn:disabled {
    border-color: rgba(151, 143, 255, 0.12);
    background: rgba(29, 32, 48, 0.7);
    color: rgba(224, 218, 255, 0.34);
}

.library-switch button,
.modal-tabs button {
    min-width: 172px;
    height: 48px;
    border: 0;
    border-radius: 8px;
    background: #f1f1fb;
    color: #6c7190;
    font-size: var(--text-body);
    font-weight: 700;
}

.library-switch button.is-active,
.modal-tabs button.is-active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 12px 30px rgba(90, 75, 243, 0.18);
}

.library-panel {
    position: relative;
    padding: 0 14px 32px;
}

.library-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 48px;
    padding: 0 8px;
    border-bottom: 1px solid #eeeffb;
}

.library-delete-all-link {
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: #b8677d;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.library-delete-all-link:hover:not(:disabled) {
    color: #ff789d;
}

.library-delete-all-link:disabled {
    opacity: 0.45;
}

.history-asset-card {
    gap: 12px;
}

.history-asset-meta {
    display: grid;
    gap: 4px;
}

.history-asset-meta small {
    color: rgb(114 107 162 / 52%);
    font-size: 11px;
    font-weight: 600;
}

.history-empty {
    padding: 46px 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 30px;
    background: rgba(246, 247, 252, 0.78);
    overscroll-behavior: contain;
}

html.modal-scroll-locked,
body.modal-scroll-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.modal-backdrop:not(.is-hidden),
.cloud-ad-backdrop:not(.is-hidden),
.modal-library-picker:not(.is-hidden) {
    overscroll-behavior: contain;
}

.cloud-ad-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11, 11, 14, 0.92);
    backdrop-filter: blur(6px);
}

.cloud-ad-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}

.cloud-ad-content {
    width: 496px;
    height: 526px;
    overflow: hidden;
    border-radius: 28px;
    background: #343949;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.cloud-ad-close {
    width: 83px;
    height: 83px;
    padding: 0;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cloud-ad-close svg {
    display: block;
    width: 43px;
    height: 43px;
}

.cloud-ad-empty {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 16px;
    font-weight: 700;
}

.cloud-ad-backdrop.is-hidden {
    display: none;
}

.modal-backdrop.dim {
    background: rgba(21, 24, 33, 0.48);
}

.image-save-as-modal {
    z-index: 3100;
}

.save-name-backdrop {
    z-index: 3300;
    background: rgba(7, 8, 16, 0.68);
    backdrop-filter: blur(10px);
}

.save-name-modal {
    width: min(480px, calc(100vw - 36px));
    padding: 28px;
    border: 1px solid rgba(151, 143, 255, 0.34);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(25, 24, 43, 0.98), rgba(16, 17, 30, 0.98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    color: #fff;
}

.save-name-modal h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 900;
}

.save-name-modal p {
    margin: 8px 0 22px;
    color: #aaa8cb;
    font-size: 14px;
    font-weight: 700;
}

.save-name-field {
    display: grid;
    gap: 10px;
}

.save-name-field span {
    color: #d7d3ff;
    font-size: 14px;
    font-weight: 800;
}

.save-name-field input {
    width: 100%;
    height: 48px;
    border: 1px solid rgba(151, 143, 255, 0.32);
    border-radius: 12px;
    background: rgba(8, 9, 18, 0.78);
    color: #fff;
    padding: 0 14px;
    font-size: 16px;
    font-weight: 800;
    outline: none;
}

.save-name-field input:focus {
    border-color: rgba(139, 111, 255, 0.92);
    box-shadow: 0 0 0 4px rgba(117, 93, 255, 0.18);
}

.save-name-modal .modal-actions {
    margin-top: 24px;
}

.image-save-as-modal .dialog {
    position: relative;
    z-index: 3101;
    width: min(520px, calc(100vw - 48px));
    padding: 26px 26px 24px;
    border: 1px solid rgba(151, 143, 255, 0.24);
    border-radius: 18px;
    background:
        radial-gradient(circle at 78% 0%, rgba(124, 108, 255, 0.14), transparent 42%),
        rgba(18, 19, 29, 0.98);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(18px);
    overflow: visible;
}

.image-save-as-modal .modal-head {
    margin-bottom: 22px;
}

.image-save-as-modal .modal-head h2 {
    margin: 0 0 6px;
    color: #f4f2ff;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 900;
}

.image-save-as-modal .modal-head p {
    margin: 0;
    color: rgba(214, 214, 238, 0.68);
    font-size: 14px;
    line-height: 1.5;
}

.image-save-as-modal .role-chooser-body {
    padding: 0;
}

.is-hidden {
    display: none !important;
}

.name-modal,
.generate-modal,
.voice-modal,
.video-modal,
.music-modal {
    position: relative;
    width: min(100%, 760px);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 65px rgba(60, 60, 115, 0.13);
    overflow: visible;
}

.name-modal {
    min-height: 260px;
    padding: 24px;
    text-align: center;
}

.delete-project-modal {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: 32px 28px;
}

.delete-history-modal {
    width: min(460px, calc(100vw - 40px));
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 32px 28px;
}

.delete-history-modal h2,
.delete-history-modal p {
    margin: 0;
}

.delete-history-modal p {
    color: var(--muted);
    font-size: var(--text-body);
    line-height: 1.6;
}

.delete-project-modal h2 {
    margin: 0;
}

.delete-project-modal p {
    margin: 0;
}

.delete-project-modal .delete-project-check {
    justify-content: center;
    margin: 0 auto;
}

.name-modal h2 {
    margin: 0 0 30px;
    font-size: var(--text-xl);
    font-weight: 800;
    line-height: var(--leading-title);
}

.name-modal input {
    width: 100%;
    height: 56px;
    border: 2px solid var(--line-strong);
    border-radius: 8px;
    padding: 0 18px;
    color: var(--ink);
    font-size: var(--text-md);
}

.name-modal input::placeholder,
.size-row input::placeholder,
.prompt-box textarea::placeholder,
.text-card textarea::placeholder {
    color: #b7bad0;
}

.modal-close {
    position: absolute;
    top: -28px;
    right: -28px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: #f6f6ff;
    color: #a1a4b8;
    font-size: 40px;
    line-height: 1;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 24px;
}

.delete-project-check {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    color: var(--muted);
    font-size: var(--text-md);
    font-weight: 700;
}

.delete-project-check input {
    width: 16px;
    height: 16px;
}

.primary-btn,
.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0px 22px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    font-size: var(--text-body);
    font-weight: 800;
    line-height: 1;
    transition: transform 0.14s ease, filter 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.primary-btn {
    background: var(--brand);
    color: #fff;
}

.primary-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled),
.ghost-btn:hover:not(:disabled),
#generateStoryboardBtn:hover:not(:disabled),
.shot-action:hover:not(:disabled) {
    filter: brightness(1.08) saturate(1.08);
    transform: translateY(-1px);
}

.primary-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled),
#generateStoryboardBtn:active:not(:disabled),
.shot-action:active:not(:disabled),
.primary-btn.is-pressed:not(:disabled),
.secondary-btn.is-pressed:not(:disabled),
.ghost-btn.is-pressed:not(:disabled),
#generateStoryboardBtn.is-pressed:not(:disabled),
.shot-action.is-pressed:not(:disabled) {
    transform: translateY(1px) scale(0.985);
    filter: brightness(0.78) saturate(0.92);
    box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(161, 145, 255, 0.24);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
#generateStoryboardBtn:disabled,
.shot-action:disabled {
    cursor: not-allowed;
    opacity: 0.52;
    filter: saturate(0.75);
    box-shadow: none;
}

.primary-btn:disabled {
    background: var(--soft-2);
    border: 1px solid var(--line);
    color: rgba(156, 162, 188, 0.62);
}

.secondary-btn:disabled {
    background: var(--soft-2);
    border: 1px solid var(--line);
    color: rgba(156, 162, 188, 0.62);
}

.ghost-btn:disabled,
#generateStoryboardBtn:disabled,
.shot-action:disabled {
    background: var(--soft-2);
    border: 1px solid var(--line);
    color: rgba(156, 162, 188, 0.62);
}

.primary-btn:disabled svg,
.secondary-btn:disabled svg,
.ghost-btn:disabled svg,
#generateStoryboardBtn:disabled svg,
.shot-action:disabled svg {
    filter: grayscale(1);
    opacity: 0.62;
}

.secondary-btn {
    background: #f0f0fa;
    color: var(--brand);
}

.generate-modal {
    position: relative;
    isolation: isolate;
    width: min(94vw, 1210px);
    max-height: min(94vh, 920px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) 74px;
}

#imageModal .generate-modal {
    grid-template-rows: auto minmax(0, 1fr) 74px;
}

.modal-library-picker {
    position: absolute;
    top: 78px;
    right: 32px;
    bottom: 88px;
    z-index: 300;
    display: flex;
    width: min(520px, calc(100% - 64px));
    flex-direction: column;
    border: 2px solid #b99cff;
    border-radius: 10px;
    background: rgba(18, 19, 29, 0.98);
    box-shadow: 0 0 0 1px rgba(185, 156, 255, 0.18), 0 26px 70px rgba(0, 0, 0, 0.56);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.modal-library-picker.is-shot-reference-picker {
    position: fixed;
    top: 86px;
    right: 28px;
    bottom: 28px;
    z-index: 2100;
    width: min(560px, calc(100vw - 56px));
}

.modal-backdrop.is-picker-top-layer .modal-grid,
.modal-backdrop.is-picker-top-layer .video-modal-grid,
.modal-backdrop.is-picker-top-layer .voice-grid {
    position: relative;
    z-index: 1;
}

.modal-backdrop.is-picker-top-layer .modal-library-picker {
    z-index: 300;
}

#imageModal.is-picker-top-layer,
#videoModal.is-picker-top-layer,
#voiceModal.is-picker-top-layer,
#shotImagePickerModal.is-picker-top-layer,
#shotVideoPickerModal.is-picker-top-layer,
#roleLibraryPickerModal.is-picker-top-layer {
    z-index: 1300;
}

.standalone-picker-modal {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: min(520px, calc(100vw - 40px));
    max-height: min(92vh, 860px);
    margin: auto;
}

.assistant-library-picker-backdrop.is-director-library-picker {
    padding: 20px;
    overflow: hidden;
}

.assistant-library-picker-backdrop.is-director-library-picker .assistant-library-picker-panel {
    width: min(860px, calc(100vw - 40px));
    height: min(760px, calc(100vh - 40px));
    max-height: calc(100vh - 40px);
}

.assistant-library-picker-backdrop.is-director-library-picker .picker-head,
.assistant-library-picker-backdrop.is-director-library-picker .picker-tabs {
    flex: 0 0 auto;
}

.assistant-library-picker-backdrop.is-director-library-picker .picker-tabs {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    min-height: auto;
    overflow: visible;
}

.assistant-library-picker-backdrop.is-director-library-picker .picker-tabs button {
    min-width: 0;
    width: 100%;
    padding: 0 6px;
}

.assistant-library-picker-backdrop.is-director-library-picker .picker-grid {
    flex: 1 1 auto;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    overflow-y: auto;
}

.assistant-library-picker-backdrop.is-director-library-picker .picker-card {
    width: 100%;
}

.picker-actions {
    display: flex;
    justify-content: flex-end;
    margin: 14px;
}

.picker-card.is-active {
    border-color: rgba(126, 111, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(126, 111, 255, 0.24), 0 12px 28px rgba(74, 61, 189, 0.16);
    background: rgba(34, 36, 54, 0.96);
}

.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid rgba(151, 157, 210, 0.13);
}

.picker-source-tabs {
    display: flex;
    align-items: center;
    gap: 42px;
    min-width: 0;
}

.picker-source-tabs button {
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(169, 173, 203, 0.62);
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.picker-source-tabs button.is-active,
.picker-source-tabs button:first-child {
    color: #f6f4ff;
}

.picker-source-tabs button:hover {
    color: #ffffff;
}

.picker-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: var(--text-lg);
    font-weight: 800;
    line-height: var(--leading-title);
}

.picker-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 700;
}

.picker-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(124, 108, 255, 0.14);
    color: #c7c0ff;
    font-size: 24px;
    line-height: 1;
}

.picker-tabs {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-height: 56px;
    box-sizing: border-box;
    padding: 12px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.picker-tabs::-webkit-scrollbar {
    display: none;
}

.picker-tabs button {
    flex: 0 0 auto;
    min-width: 62px;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(31, 32, 47, 0.95);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.picker-tabs button.is-active {
    background: linear-gradient(135deg, #6f5cff, #8d7bff);
    color: #fff;
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 156px);
    justify-content: start;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 6px;
    min-height: 0;
    padding: 12px;
    overflow-x: hidden;
    overflow-y: auto;
}

.picker-card {
    position: relative;
    width: 156px;
    border: 1px solid rgba(151, 143, 255, 0.14);
    border-radius: 8px;
    background: rgba(24, 25, 38, 0.92);
    color: var(--ink);
    overflow: hidden;
    text-align: left;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.picker-card:hover {
    transform: translateY(-2px);
    border-color: rgba(151, 143, 255, 0.34);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.26);
}

.picker-card img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.04) brightness(0.88);
}

.picker-card video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: rgba(12, 14, 24, 0.92);
    filter: saturate(0.92) contrast(1.04) brightness(0.88);
}

.picker-card strong {
    display: block;
    padding: 10px 12px 12px;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
}

.picker-empty {
    grid-column: 1 / -1;
    margin: 24px 0;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.modal-grid {
    display: grid;
    grid-template-columns: 388px minmax(0, 1fr);
    gap: 27px;
    min-height: 0;
    padding: 20px 24px 24px;
    overflow: auto;
}

.image-modal-top-tabs {
    display: flex;
    justify-content: center;
    padding: 24px 24px 0;
}

.pose-embed-modal {
    grid-column: 1 / -1;
    min-height: min(76vh, 860px);
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(10, 14, 24, 0.9);
}

.pose-embed-frame {
    display: block;
    width: 100%;
    min-height: min(76vh, 860px);
    height: min(76vh, 860px);
    border: 0;
    background: #070d16;
}

.image-modal-pose-entry .modal-grid {
    grid-template-columns: 1fr;
    gap: 18px;
}

#imageModal.image-modal-text .control-col {
    min-height: 620px;
}

.camera-angle-section {
    display: grid;
    gap: 12px;
}

.camera-angle-upload {
    margin-bottom: 0;
    justify-items: start;
}

.camera-angle-upload .dashed-upload {
    width: 110px;
    min-height: 110px;
    height: 110px;
}

.camera-angle-upload .dashed-upload.has-selection {
    min-height: 210px;
    height: 210px;
}

.camera-angle-upload .reference-thumb {
    object-fit: cover;
}

.camera-rig-section {
    display: grid;
    gap: 18px;
    margin-top: 2px;
}

.camera-rig-panel {
    width: min(100%, 560px);
    margin: 0 auto 0 0;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(16, 19, 30, 0.96), rgba(12, 15, 24, 0.96));
    padding: 14px;
    box-sizing: border-box;
}

.camera-rig-frame {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 460px;
    border: 0;
    border-radius: 14px;
    background: #10131b;
}

.camera-rig-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(120, 102, 255, 0.12), rgba(120, 102, 255, 0.02) 48%, transparent 68%),
        linear-gradient(180deg, rgba(24, 28, 42, 0.94), rgba(13, 15, 24, 0.98));
    overflow: hidden;
}

.camera-rig-ring {
    width: 138px;
    height: 138px;
    border: 1px dashed rgba(146, 138, 255, 0.42);
    border-radius: 50%;
}

.camera-rig-axis {
    position: absolute;
    background: rgba(146, 138, 255, 0.18);
}

.camera-rig-axis-h {
    width: 156px;
    height: 1px;
}

.camera-rig-axis-v {
    width: 1px;
    height: 156px;
}

.camera-rig-subject {
    position: absolute;
    width: 42px;
    height: 84px;
    border-radius: 24px 24px 18px 18px;
    background: linear-gradient(180deg, rgba(214, 203, 184, 0.98), rgba(192, 182, 163, 0.98));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
}

.camera-rig-subject::before {
    content: "";
    position: absolute;
    top: -18px;
    left: 50%;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transform: translateX(-50%);
    background: rgba(214, 203, 184, 0.98);
}

.camera-rig-camera {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transform: translate(calc(-50% + var(--camera-x)), calc(-50% + var(--camera-y)));
    background: #8f83ff;
    box-shadow: 0 0 0 5px rgba(143, 131, 255, 0.16), 0 10px 24px rgba(95, 81, 255, 0.42);
}

.camera-rig-label {
    position: absolute;
    color: rgba(233, 237, 255, 0.62);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.camera-rig-label.front { top: 26px; }
.camera-rig-label.back { bottom: 26px; }
.camera-rig-label.left { left: 26px; }
.camera-rig-label.right { right: 26px; }

.camera-rig-readout {
    display: grid;
    gap: 6px;
    padding-top: 12px;
}

.camera-rig-readout strong {
    color: #f2f4ff;
    font-size: 14px;
    font-weight: 800;
}

.camera-rig-readout span {
    color: var(--muted);
    font-size: 12px;
}

.camera-preset-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.camera-preset-btn {
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(49, 53, 78, 0.78);
    color: #d9ddf7;
    font-size: 12px;
    font-weight: 700;
}

.camera-slider-grid {
    display: grid;
    gap: 14px;
}

.camera-slider-grid label {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 52px;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
}

.camera-slider-grid input[type="range"] {
    width: 100%;
}

.camera-slider-grid strong {
    text-align: right;
    color: #f2f4ff;
    font-size: 12px;
}

.modal-tabs {
    display: inline-flex;
    gap: 0;
    margin: 0 0 8px;
    padding: 2px;
    border-radius: 10px;
    background: rgba(31, 32, 47, 0.92);
}

.modal-tabs.centered {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
}

.modal-tabs-centered-wide {
    margin: 0;
    max-width: min(100%, 860px);
    flex-wrap: wrap;
    justify-content: center;
}

.modal-tabs button {
    min-width: 120px;
    height: 42px;
    box-shadow: none;
}

.modal-tabs-unified,
.video-flow-tabs {
    display: inline-flex;
    gap: 0;
    margin: 0 0 24px;
    padding: 2px;
    border-radius: 10px;
    background: rgba(31, 32, 47, 0.92);
}

.audio-mode-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(100%, 560px);
    overflow: hidden;
}

.audio-mode-tabs button {
    min-width: 0;
    padding-inline: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-tabs button,
.modal-tabs-unified button,
.video-flow-tabs button {
    min-width: 88px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #a8add0;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
    padding: 0 12px;
}

.modal-tabs button.is-active,
.modal-tabs-unified button.is-active,
.video-flow-tabs button.is-active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 12px 30px rgba(90, 75, 243, 0.18);
}

.control-col h3,
.preview-col h2,
.voice-modal h2 {
    margin: 12px 0 0 0;
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--leading-title);
}

#imageReferenceSection,
#imageModelSection,
#videoGlobalPromptGroup {
    display: grid;
   
}

#imageSizeSection {
    display: grid;
    gap: var(--space-title-content);
}

.reference-picks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: var(--space-section-block);
}

#imageReferenceSection .reference-picks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wash-reference-picks {
    display: grid;
    grid-template-columns: repeat(4, 76px);
    gap: 12px 14px;
    align-items: start;
    margin-bottom: var(--space-section-block);
}

.wash-reference-item {
    display: grid;
    width: 76px;
    min-width: 0;
    gap: 5px;
}

.wash-reference-item .dashed-upload,
.wash-reference-item .dashed-upload.has-selection {
    width: 76px;
    height: 76px;
    min-height: 76px;
    padding: 5px;
    border-radius: 6px;
}

.wash-reference-item .dashed-upload span {
    font-size: 30px;
}

.wash-reference-item .dashed-upload strong {
    margin: 2px 0 0;
    font-size: 10px;
    line-height: 1.2;
}

.wash-reference-item .reference-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.wash-reference-item .upload-clear {
    width: 20px;
    height: 20px;
    top: 3px;
    right: 3px;
    font-size: 14px;
}

.wash-reference-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wash-reference-item .upload-library-btn {
    width: 76px;
    height: 24px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 10px;
    line-height: 22px;
    text-align: center;
}

.image-modal-wash-entry #imageModelSection .size-row {
    grid-template-columns: 1fr;
}

.image-modal-wash-entry .image-preview-grid--fixed {
    height: auto;
    max-height: 100%;
    grid-auto-rows: minmax(160px, auto);
    overflow-y: auto;
}

.image-modal-wash-entry .image-preview-card {
    min-height: 160px;
}

.image-modal-wash-entry .image-grid-zoom {
    position: relative;
}

.wash-result-name {
    position: absolute;
    right: 6px;
    bottom: 6px;
    left: 6px;
    overflow: hidden;
    padding: 4px 7px;
    border-radius: 4px;
    background: rgba(7, 8, 14, 0.72);
    color: rgba(245, 244, 255, 0.92);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.upload-stack {
    display: grid;
    gap: 10px;
    align-items: start;
}

.upload-stack-wide {
    margin-bottom: 18px;
}

.image-reference-hint {
    display: block;
    min-height: 18px;
    color: #aaa2ec;
    font-size: var(--text-xs);
    line-height: 1.45;
    text-align: left;
}

.upload-input {
    display: none;
}

.dashed-upload {
    display: grid;
    place-items: center;
    min-height: 132px;
    padding: 16px;
    border: 2px dashed rgba(151, 143, 255, 0.28);
    border-radius: 8px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    overflow: hidden;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashed-upload.is-dragover,
.dashed-upload.is-paste-target,
.dashed-upload:hover {
    border-color: rgba(130, 116, 255, 0.72);
    background: rgba(34, 36, 54, 0.98);
    box-shadow: 0 18px 42px rgba(58, 46, 132, 0.28);
}

.dashed-upload span {
    display: block;
    color: #b4adff;
    font-size: 50px;
    font-weight: 200;
    line-height: 0.9;
}

.dashed-upload strong {
    display: block;
    margin: 10px 0 8px;
    font-size: var(--text-sm);
    line-height: var(--leading-title);
    color: var(--ink);
}

.dashed-upload small {
    display: block;
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.5;
    text-align: center;
}

.upload-library-btn {
    height: 34px;
    padding: 0 16px;
    justify-self: start;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 8px;
    background: rgba(111, 92, 255, 0.12);
    color: #cfc8ff;
    font-size: var(--text-xs);
    font-weight: 800;
    line-height: 34px;
}

.upload-library-btn:hover {
    background: rgba(111, 92, 255, 0.18);
    border-color: rgba(151, 143, 255, 0.34);
    color: #f1eeff;
}

.dashed-upload.has-selection {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    justify-items: stretch;
    gap: 0;
    min-height: 132px;
    height: 132px;
    border-style: solid;
    padding: 8px;
    position: relative;
}

.video-upload.has-selection {
    min-height: 160px;
    height: 160px;
}

.reference-thumb {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(5, 6, 10, 0.7);
}

.upload-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: rgba(8, 10, 18, 0.82);
    color: #f3efff;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.upload-clear:hover {
    background: rgba(111, 92, 255, 0.9);
}

.size-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: var(--space-section-block);
    padding-bottom: 12px;
}

.size-row label {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.size-row input {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 6px;
    padding: 0 12px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.size-row select {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 6px;
    padding: 0 12px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.image-qwen-parameters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0 0 var(--space-section-block);
    padding: 12px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 7px;
    background: rgba(19, 20, 32, 0.48);
}

.image-qwen-parameters > label:first-child {
    display: grid;
    flex: 0 0 150px;
    grid-template-columns: 60px 76px;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.image-qwen-parameters input[type="number"] {
    width: 76px;
    height: 38px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 6px;
    padding: 0 10px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.image-qwen-toggle {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
    white-space: nowrap;
}

.image-qwen-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

@media (max-width: 780px) {
    .image-qwen-parameters {
        align-items: flex-start;
    }

    .image-qwen-parameters > label:first-child {
        flex-basis: 100%;
    }
}

.image-size-control-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 16px;
    margin-bottom: var(--space-section-block);
    padding-bottom: 12px;
}

.image-keep-original-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
}

.image-keep-original-size input {
    accent-color: var(--accent);
}

.image-resolution-preset-row.is-disabled,
.image-custom-size-row.is-disabled {
    opacity: 0.5;
}

.image-resolution-preset-row {
    min-width: 0;
}

.image-resolution-preset-field {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.image-resolution-preset-field .minimax-resolution-control {
    grid-template-columns: minmax(0, 1fr) 40px;
}

.image-resolution-preset-field .minimax-resolution-select-wrap select {
    width: 100%;
    height: 40px;
    min-width: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 6px;
    padding: 0 36px 0 12px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.image-resolution-preset-field .minimax-resolution-swap {
    width: 40px;
    height: 40px;
}

.image-custom-size-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

.image-size-control-row > .image-custom-size-row:not(.is-hidden) {
    grid-column: 1 / -1;
    width: 100%;
}

.image-custom-size-row label {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.image-custom-size-row input {
    width: 100%;
    height: 40px;
    min-width: 0;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 6px;
    padding: 0 12px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.image-resolution-preset-row.is-hidden + .image-custom-size-row {
    grid-column: 1 / -1;
}

@media (max-width: 760px) {
    .image-size-control-row {
        grid-template-columns: 1fr;
    }

    .image-resolution-preset-row.is-hidden + .image-custom-size-row {
        grid-column: auto;
    }

    .image-size-control-row > .image-custom-size-row:not(.is-hidden) {
        grid-column: auto;
    }
}

.prompt-box,
.text-card,
.music-prompt {
    position: relative;
    display: block;
}

.prompt-library-backdrop {
    z-index: 21000;
    background: rgba(4, 5, 9, 0.64);
    backdrop-filter: blur(5px);
}

.camera-movement-backdrop {
    z-index: 21200;
    background: rgba(4, 5, 9, 0.72);
    backdrop-filter: blur(6px);
}

.camera-movement-modal {
    width: min(920px, calc(100vw - 48px));
    max-height: min(900px, calc(100vh - 32px));
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 16px;
    overflow: hidden;
    padding: 24px;
    text-align: left;
}

.camera-movement-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.16);
}

.camera-movement-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0 13px;
    background: transparent;
    color: #8e899f;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.camera-movement-tab small {
    color: currentColor;
    font-size: 9px;
    opacity: 0.58;
}

.camera-movement-tab:hover,
.camera-movement-tab:focus-visible {
    color: #d6d0ff;
    outline: none;
}

.camera-movement-tab.is-active {
    border-bottom-color: #8f78ff;
    color: #f3f0ff;
}

.camera-movement-close {
    top: 18px;
    right: 18px;
}

.camera-movement-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-right: 52px;
}

.camera-movement-head h2,
.camera-movement-head p {
    margin: 0;
}

.camera-movement-head p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.camera-movement-head small {
    flex: 0 0 auto;
    color: rgba(188, 181, 232, 0.58);
    font-size: 10px;
}

.camera-movement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(100px, auto);
    align-content: start;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 5px 2px 2px;
}

.camera-movement-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 100px;
    overflow: hidden;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 8px;
    padding: 0;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.camera-movement-card:hover,
.camera-movement-card:focus-visible {
    border-color: rgba(164, 142, 255, 0.86);
    background: rgba(34, 33, 53, 0.98);
    outline: none;
    transform: translateY(-1px);
}

.camera-movement-image-wrap {
    display: grid;
    place-items: center;
    width: 76px;
    height: 58px;
    margin: 10px;
    overflow: hidden;
    border-radius: 5px;
    background: #08090f;
}

.camera-movement-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-movement-image-empty,
.camera-movement-empty {
    color: var(--muted);
    font-size: 12px;
}

.camera-movement-empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 260px;
}

.camera-movement-card-copy {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px 10px 0;
}

.camera-movement-card-copy strong {
    color: #f2efff;
    font-size: 13px;
    line-height: 18px;
}

.camera-movement-card-copy > span {
    display: -webkit-box;
    min-height: 30px;
    overflow: hidden;
    color: #aaa6bd;
    font-size: 11px;
    line-height: 15px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.camera-movement-card-copy small {
    display: block;
    overflow: hidden;
    color: #887fd0;
    font-size: 10px;
    line-height: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-library-modal {
    width: min(860px, calc(100vw - 48px));
    max-height: min(900px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-right: 24px;
    text-align: left;
}

.prompt-library-close {
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    background: rgba(36, 34, 58, 0.96);
    color: #ddd8ff;
    font-size: 32px;
    box-shadow: none;
}

.prompt-library-close:hover {
    border-color: rgba(151, 143, 255, 0.42);
    background: rgba(88, 75, 185, 0.36);
    color: #fff;
}

.prompt-library-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-right: 58px;
    flex: 0 0 auto;
}

.prompt-library-head h2 {
    margin-bottom: 8px;
}

.prompt-library-head p {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.prompt-library-body {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
    height: min(680px, calc(100vh - 180px));
    min-height: 320px;
    max-height: min(680px, calc(100vh - 180px));
    overflow: hidden;
    padding-right: 6px;
}

.prompt-library-section {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.prompt-library-section h3 {
    margin: 0;
    color: var(--ink);
    font-size: var(--text-md);
}

.prompt-library-list {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.prompt-library-empty {
    display: grid;
    min-height: 110px;
    place-items: center;
    border: 1px dashed rgba(151, 143, 255, 0.18);
    border-radius: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
}

.prompt-library-item {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    padding: 12px;
    background: rgba(19, 20, 32, 0.96);
}

.prompt-library-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.prompt-library-item-head-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 10px;
}

.prompt-library-item-title {
    min-width: 0;
    padding-top: 2px;
    overflow: hidden;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-library-item-text {
    display: -webkit-box;
    overflow: hidden;
    color: #b8bbd4;
    font-size: var(--text-xs);
    line-height: 1.55;
    text-align: left;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    white-space: pre-wrap;
}

.prompt-library-item.is-expanded .prompt-library-item-text {
    display: block;
    max-height: 220px;
    overflow: auto;
}

.prompt-library-item:not(.is-expanded) .prompt-library-item-text {
    display: none;
}

.prompt-library-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.prompt-library-text-btn {
    border: 0;
    padding: 0;
    background: transparent;
    color: #d8d3ff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.prompt-library-text-btn:hover {
    color: #fff;
}

.prompt-library-text-btn.is-danger {
    color: #d9838d;
}

.prompt-library-text-btn.is-danger:hover {
    color: #ffb0b7;
}

.prompt-library-arrow-btn {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: #d8d3ff;
    cursor: pointer;
}

.prompt-library-arrow-btn::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.16s ease;
}

.prompt-library-item.is-expanded .prompt-library-arrow-btn::before {
    transform: translateY(2px) rotate(225deg);
}

.prompt-library-arrow-btn:hover {
    color: #fff;
}

.prompt-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 0;
}

.prompt-heading h2,
.prompt-heading h3 {
    margin: 0;
}

.prompt-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prompt-ai-btn {
    min-width: 126px;
}

.image-prompt-tools {
    justify-content: flex-end;
    gap: 6px;
}

.image-prompt-tools .prompt-ai-btn,
.image-prompt-tools .camera-movement-trigger,
.image-prompt-tools .prompt-reset-btn,
.image-prompt-tools .prompt-output-language-select,
.image-prompt-tools #optimizeImagePromptBtn,
.image-prompt-tools #optimizeVideoPromptBtn,
.image-prompt-tools #optimizeMusicPromptBtn {
    min-width: 0;
    height: 28px;
    padding: 0 10px;
    border-radius: 7px;
    font-size: 11px;
    line-height: 28px;
}

.camera-movement-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 74px;
    border: 1px solid rgba(112, 96, 210, 0.4);
    background: rgba(25, 24, 47, 0.94);
    color: #c8c1ff;
    cursor: pointer;
}

.camera-movement-trigger:hover,
.camera-movement-trigger:focus-visible {
    border-color: rgba(145, 126, 255, 0.72);
    color: #fff;
    outline: none;
}

.camera-movement-trigger svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.camera-movement-trigger strong {
    font-size: 11px;
    line-height: 1;
}

.camera-movement-trigger .camera-movement-trigger-arrow {
    width: 10px;
    height: 10px;
}

@media (max-width: 760px) {
    .camera-movement-modal {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 28px);
        padding: 18px;
    }

    .camera-movement-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.prompt-output-language-select {
    box-sizing: border-box;
    width: 88px;
    min-width: 88px;
    flex: 0 0 62px;
    height: 28px;
    border: 1px solid rgba(112, 96, 210, 0.4);
    border-radius: 7px;
    padding: 0 36px 0 12px;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(25, 24, 47, 0.94);
    background-image:
        linear-gradient(45deg, transparent 50%, #a99cff 50%),
        linear-gradient(135deg, #a99cff 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 14px) calc(50% - 2px);
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    color: #c8c1ff;
    color-scheme: dark;
    font-size: 11px;
    font-weight: 800;
    line-height: 28px;
    text-align: left;
    cursor: pointer;
}

.prompt-output-language-select:hover,
.prompt-output-language-select:focus {
    border-color: rgba(145, 126, 255, 0.72);
    color: #f5f2ff;
    outline: none;
}

.prompt-output-language-select:disabled {
    cursor: default;
    opacity: 0.55;
}

.common-prompt-trigger {
    min-width: 0;
    height: auto;
    border: 0;
    padding: 0 2px;
    background: transparent;
    color: #b8adff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    cursor: pointer;
}

.common-prompt-trigger:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.image-prompt-tools .prompt-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.image-prompt-tools .prompt-ai-btn span {
    font-size: 10px;
    line-height: 1;
}

.image-prompt-tools .prompt-ai-btn strong {
    font-size: 11px;
    line-height: 1;
}

.music-idea-heading {
    align-items: center;
    margin-bottom: 8px;
}

.music-idea-heading h2 {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--text-md);
    line-height: var(--leading-title);
}

.image-prompt-box textarea {
    padding: 16px;
}

.prompt-input-wrap {
    position: relative;
}

.prompt-box textarea,
.music-prompt textarea,
.director-segment-prompt {
    padding-right: 16px;
}

.prompt-save-mini {
    height: auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #cfc9ff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
    cursor: pointer;
}

.prompt-save-mini:hover {
    background: transparent;
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prompt-footer-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
    min-height: 28px;
}

.prompt-footer-tools .common-prompt-trigger,
.prompt-footer-tools .prompt-reset-link {
    flex: 0 0 auto;
}

.image-prompt-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 8px;
}

.image-prompt-meta span {
    position: static;
    color: #8589a2;
    font-size: var(--text-xs);
}

.prompt-box textarea,
.text-card textarea {
    width: 100%;
    resize: none;
    border: 0;
    border-radius: 8px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

.prompt-box textarea {
    height: 136px;
    padding: 16px;
}

.prompt-box span,
.text-card span {
    position: absolute;
    right: 18px;
    bottom: 12px;
    color: #8589a2;
    font-size: var(--text-xs);
}

.image-preview {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 320px;
    overflow: hidden;
    border-radius: 8px;
    background: #05060a;
    border: 1px solid rgba(151, 143, 255, 0.16);
}

.image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #05060a;
}

.image-preview-zoom {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.image-preview-zoom:disabled {
    cursor: crosshair;
}

.image-crop-overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
}

.image-crop-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 10, 0.34);
}

.image-crop-overlay-empty::after {
    content: "拖拉选择裁剪区域";
    position: absolute;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 16, 26, 0.78);
    color: #f4f1ff;
    font-size: 12px;
    font-weight: 700;
}

.image-crop-selection {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.94);
    box-shadow: 0 0 0 9999px rgba(5, 6, 10, 0.42);
    background: rgba(255, 255, 255, 0.08);
    cursor: move;
}

.image-crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.96);
    background: #6f5cff;
    box-shadow: 0 0 0 2px rgba(5, 6, 10, 0.64);
}

.handle-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.handle-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.handle-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.handle-n,
.handle-s {
    left: calc(50% - 6px);
    cursor: ns-resize;
}
.handle-n { top: -6px; }
.handle-s { bottom: -6px; }
.handle-w,
.handle-e {
    top: calc(50% - 6px);
    cursor: ew-resize;
}
.handle-w { left: -6px; }
.handle-e { right: -6px; }

.preview-tools button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

.image-preview-placeholder,
.video-preview-placeholder {
    color: rgba(207, 200, 255, 0.5);
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.preview-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    padding: 0 12px 10px;
    background: linear-gradient(180deg, rgba(5, 6, 10, 0) 0%, rgba(5, 6, 10, 0.72) 48%, rgba(5, 6, 10, 0.96) 100%);
    pointer-events: none;
}

.preview-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    color: #e7e2ff;
    font-size: 12px;
    font-weight: 700;
}

.preview-progress-side {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.preview-progress-meta strong {
    min-width: 0;
    max-width: calc(100% - 76px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
}

.preview-cancel {
    border: 0;
    background: transparent;
    color: #b66d6d;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
}

.preview-cancel:hover {
    color: #d48a8a;
}

.preview-progress-track {
    height: 4px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
        rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.preview-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0)),
        linear-gradient(90deg, #6f5cff 0%, #b6a8ff 55%, #51d6ff 100%);
    box-shadow: 0 0 18px rgba(111, 92, 255, 0.5), 0 0 30px rgba(81, 214, 255, 0.2);
}

.video-effect-preview-panel {
    width: min(230px, 44%);
    margin-top: 22px;
    margin-left: 2px;
}

.video-effect-preview-panel.is-multi {
    width: 100%;
    max-width: 100%;
}

.video-effect-preview-panel.is-active {
    width: 100%;
    max-width: 100%;
}

.video-effect-preview-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
}

.video-effect-preview-title small {
    color: rgba(207, 200, 255, 0.62);
    font-size: 10px;
    font-weight: 600;
}

.video-effect-preview-frame {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(139, 118, 255, 0.48);
    border-radius: 6px;
    background: #05060a;
    color: rgba(207, 200, 255, 0.48);
    font-size: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.video-effect-preview-panel.is-portrait:not(.is-active) {
    width: min(230px, 44%);
}

.video-effect-preview-panel.is-portrait:not(.is-active) .video-effect-preview-frame {
    aspect-ratio: 16 / 9;
}

.video-effect-preview-panel.is-active .video-effect-preview-frame {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: start;
    justify-items: stretch;
    align-items: start;
    gap: 7px;
    aspect-ratio: auto;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.image-model-select-control {
    position: relative;
    display: block;
    width: 100%;
}

.image-model-select-control select {
    width: 100%;
}

.image-model-select-control.is-chatgpt select {
    padding-left: 38px;
}

.image-gpt-model-icon {
    position: absolute;
    z-index: 1;
    left: 12px;
    top: 50%;
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    pointer-events: none;
}

.image-gpt-model-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.gpt-image-reference-picks {
    margin-bottom: var(--space-section-block);
}

.gpt-image-media-board {
    min-height: 126px;
    padding: 10px;
}

.gpt-image-media-board .minimax-media-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.gpt-image-media-board .minimax-media-card,
.gpt-image-media-board .minimax-media-add {
    width: auto;
    max-width: 200px;
    aspect-ratio: 4 / 5;
}

.video-effect-preview-panel.has-frame .video-effect-preview-title small {
    color: rgba(191, 181, 255, 0.9);
}

.video-effect-preview-item {
    width: 100%;
    min-width: 0;
}

.video-effect-preview-media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(139, 118, 255, 0.48);
    border-radius: 6px;
    background: #05060a;
    color: rgba(207, 200, 255, 0.48);
    font-size: 9px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.video-effect-preview-item.has-frame .video-effect-preview-media {
    border-color: rgba(159, 139, 255, 0.86);
}

.video-effect-preview-canvas {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: var(--video-preview-aspect, 16 / 9);
    overflow: hidden;
    background: #05060a;
}

.video-effect-preview-canvas.is-landscape {
    width: 100%;
    height: 100%;
}

.video-effect-preview-canvas.is-portrait {
    width: 31.640625%;
    height: 100%;
}

.video-effect-preview-canvas img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background: #05060a;
}

.video-effect-preview-meta,
.video-progress-segment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
    margin-top: 4px;
    color: rgba(227, 223, 255, 0.82);
    font-size: 9px;
    line-height: 1.2;
}

.video-effect-preview-meta strong,
.video-progress-segment-meta strong,
.video-progress-segment-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-effect-preview-meta small {
    flex: 0 0 auto;
    color: rgba(191, 181, 255, 0.78);
    font-size: 9px;
}

.video-progress-segments {
    display: grid;
    grid-template-columns: repeat(var(--video-progress-segment-count, 1), minmax(0, 1fr));
    gap: 7px;
}

.video-progress-segment {
    min-width: 0;
}

.video-progress-segment-meta {
    margin: 0 0 4px;
}

.video-progress-segment-meta strong {
    max-width: 44%;
}

.video-progress-segment-status {
    flex: 1 1 auto;
    min-width: 0;
    color: rgba(218, 213, 255, 0.72);
    text-align: right;
}

.video-progress-segment-cancel {
    flex: 0 0 auto;
    margin-left: 2px;
    font-size: 9px;
}

.preview-progress-track.is-indeterminate span,
.library-task-item-track.is-indeterminate span,
.nav-task-track.is-indeterminate span {
    position: relative;
    width: 44%;
    background:
        linear-gradient(90deg,
            rgba(111, 92, 255, 0) 0%,
            rgba(111, 92, 255, 0.2) 16%,
            rgba(126, 111, 255, 0.72) 38%,
            rgba(195, 188, 255, 0.96) 58%,
            rgba(81, 214, 255, 0.82) 78%,
            rgba(81, 214, 255, 0) 100%),
        radial-gradient(ellipse at 62% 50%, rgba(255, 255, 255, 0.62) 0 7%, rgba(255, 255, 255, 0.22) 18%, rgba(255, 255, 255, 0) 42%);
    box-shadow: 0 0 14px rgba(126, 111, 255, 0.46), 0 0 26px rgba(81, 214, 255, 0.24);
    filter: blur(0.15px);
    animation:
        progress-indeterminate 2.4s cubic-bezier(0.55, 0, 0.16, 1) infinite,
        progress-trail-breathe 1.8s ease-in-out infinite;
    animation-delay: var(--progress-run-delay, 0ms), var(--progress-breathe-delay, 0ms);
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-125%) scaleX(0.78);
        opacity: 0;
    }
    10% {
        opacity: 0.42;
    }
    24% {
        opacity: 0.92;
    }
    68% {
        transform: translateX(175%) scaleX(1.04);
        opacity: 0.92;
    }
    88% {
        opacity: 0.36;
    }
    100% {
        transform: translateX(330%) scaleX(0.78);
        opacity: 0;
    }
}

@keyframes progress-trail-breathe {
    0% {
        filter: blur(0.15px) saturate(1) brightness(0.96);
    }
    50% {
        filter: blur(0.25px) saturate(1.18) brightness(1.12);
    }
    100% {
        filter: blur(0.15px) saturate(1) brightness(0.96);
    }
}

.image-preview-empty {
    aspect-ratio: 16 / 9;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(var(--image-preview-columns, 1), minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 12px;
    align-content: stretch;
    align-items: stretch;
}

.image-preview-grid--fixed {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
}

.image-preview:has(.preview-progress) .image-preview-grid--fixed,
.video-preview-results:has(.preview-progress) .image-preview-grid--fixed {
    padding-bottom: 54px;
}

.image-preview-card {
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 36px;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.preview-remove {
    top: 8px;
    right: 8px;
    z-index: 8;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(8, 9, 16, 0.72);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(10px);
}

.preview-remove:hover {
    background: rgba(255, 109, 149, 0.86);
}

.preview-remove-single {
    top: 12px;
    right: 12px;
}

.image-preview-media {
    min-width: 0;
    min-height: 0;
}

.image-preview-card-meta {
    display: grid;
    gap: 8px;
    min-height: 0;
}

.image-preview-card-top,
.image-preview-card-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.image-preview-card-top strong,
.image-preview-card-bottom span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-preview-card {
    grid-template-rows: auto auto;
    padding: 10px;
    border-radius: 12px;
    background: rgba(10, 12, 20, 0.94);
    border: 1px solid rgba(151, 143, 255, 0.12);
}

.video-preview-card.is-active {
    border-color: rgba(151, 143, 255, 0.36);
    box-shadow: 0 16px 36px rgba(43, 30, 112, 0.24);
}

.video-preview-card video {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
    background: rgba(5, 6, 10, 0.85);
    object-fit: contain;
    aspect-ratio: 16 / 9;
}

.video-preview-grid .video-preview-card {
    min-height: 0;
    height: auto;
}

.video-preview-results {
    align-items: start;
    min-height: 0;
    height: auto;
    aspect-ratio: auto;
}

.video-preview-results .video-preview-grid {
    height: auto;
    align-content: start;
    grid-auto-rows: auto;
}

/* A single result uses the main preview surface directly, without a nested card. */
.video-preview-results.is-single-result > .video-preview-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.video-preview-results.is-single-result > .video-preview-card.is-active {
    border-color: transparent;
    box-shadow: none;
}

.video-preview-grid .image-preview-media {
    min-height: 0;
}

.video-thumb-stage {
    position: relative;
    display: grid;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    min-height: 0;
    border-radius: inherit;
    overflow: hidden;
    cursor: pointer;
}

.video-thumb-stage::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 38%;
    background: linear-gradient(180deg, rgba(5, 6, 10, 0) 0%, rgba(5, 6, 10, 0.56) 58%, rgba(5, 6, 10, 0.74) 100%);
    pointer-events: none;
}

.video-thumb-stage video {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
    background: rgba(5, 6, 10, 0.9);
    pointer-events: none;
}

.video-thumb-toggle {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(15, 16, 28, 0.84);
    color: #f7f5ff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.video-thumb-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.video-thumb-toggle.is-playing {
    border-color: rgba(151, 143, 255, 0.4);
    background: rgba(63, 47, 166, 0.78);
}

.video-reference-picks {
    margin-bottom: var(--space-section-block);
}

.multi-ref-video-picks .upload-stack h4 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 900;
}

.field-hint {
    margin: -2px 0 12px;
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.5;
}

.multi-audio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: var(--space-section-block);
    margin-top: 0;
}

.multi-audio-item {
    min-width: 0;
}

.multi-audio-item h3 {
    margin-top: 0;
}

.video-lora-grid {
    margin-top: 16px;
}

.lora-panel {
    margin: 12px 0 0;
    border: 1px solid rgba(128, 92, 255, 0.24);
    border-radius: 8px;
    background: rgba(15, 13, 31, 0.72);
}

.lora-panel.is-hidden {
    display: none;
}

.lora-panel summary {
    min-height: 42px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    color: var(--text);
    font-weight: 800;
}

.lora-panel summary::-webkit-details-marker {
    display: none;
}

.lora-panel summary::after {
    content: "展开";
    color: #bdb6ff;
    font-size: var(--text-xs);
    font-weight: 700;
}

.lora-panel[open] summary::after {
    content: "收起";
}

.lora-panel summary small {
    margin-left: auto;
    color: #918aad;
    font-size: var(--text-xs);
    font-weight: 700;
}

.lora-refresh-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    flex: 0 0 26px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #bdb6ff;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.lora-refresh-btn:hover {
    color: #fff;
    background: rgba(128, 92, 255, 0.18);
}

.lora-refresh-btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.lora-panel.is-loading .lora-refresh-btn span {
    animation: lora-loading-spin 0.8s linear infinite;
}

.lora-panel.is-loading summary small::after {
    content: "";
    width: 10px;
    height: 10px;
    margin-left: 7px;
    display: inline-block;
    vertical-align: -1px;
    border-radius: 50%;
    border: 2px solid rgba(189, 182, 255, 0.28);
    border-top-color: #bdb6ff;
    animation: lora-loading-spin 0.8s linear infinite;
}

@keyframes lora-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.lora-panel-body {
    padding: 0 12px 12px;
    display: grid;
    gap: 8px;
}

.lora-default-list,
.lora-custom-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.lora-default-list:empty {
    display: none;
}

.lora-custom-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px 16px;
    gap: 6px;
    align-items: center;
    min-width: 0;
    padding: 5px;
    border-radius: 8px;
    border: 1px solid rgba(128, 92, 255, 0.18);
    background: rgba(25, 22, 46, 0.72);
}

.lora-empty-item {
    grid-column: 1 / -1;
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 8px;
    color: #918aad;
    background: rgba(25, 22, 46, 0.5);
    font-size: var(--text-xs);
}

.lora-custom-item select,
.lora-custom-item input {
    width: 100%;
    min-width: 0;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(128, 92, 255, 0.24);
    color: #eeeaff;
    background: rgba(12, 10, 25, 0.92);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.lora-custom-item select {
    padding: 0 24px 0 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color-scheme: dark;
}

.lora-custom-item input {
    min-width: 58px;
    padding: 0 8px;
    text-align: center;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    appearance: textfield;
    -moz-appearance: textfield;
}

.lora-custom-item input::-webkit-outer-spin-button,
.lora-custom-item input::-webkit-inner-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.lora-remove-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 0;
    color: #9c94be;
    background: rgba(128, 92, 255, 0.12);
    cursor: pointer;
    line-height: 1;
    font-size: 12px;
    display: inline-grid;
    place-items: center;
}

.lora-remove-btn:hover {
    color: #fff;
    border-color: rgba(255, 92, 122, 0.55);
    background: rgba(255, 92, 122, 0.14);
}

.lora-add-btn {
    justify-self: start;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(128, 92, 255, 0.32);
    color: #d8d1ff;
    background: rgba(128, 92, 255, 0.16);
    font-weight: 800;
    cursor: pointer;
}

.lora-add-btn:hover {
    border-color: rgba(151, 143, 255, 0.48);
    background: rgba(126, 87, 255, 0.22);
}

@media (max-width: 760px) {
    .wash-reference-picks {
        grid-template-columns: repeat(3, 76px);
    }

    .lora-default-list,
    .lora-custom-list {
        grid-template-columns: 1fr;
    }
}

.modal-backdrop > .name-modal.story-video-range-modal {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 40px);
    min-height: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.story-video-range-modal .modal-close { top: 8px; right: 8px; width: 32px; height: 32px; }
.modal-backdrop .story-video-range-modal h2 { margin: 2px 32px 6px 0; text-align: left; font-size: 14px; }
.story-video-range-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.story-video-range-toolbar > span { margin-right: auto; }
.modal-backdrop .story-video-range-modal .secondary-btn,
.modal-backdrop .story-video-range-modal .primary-btn { height: 28px; min-height: 28px; padding: 0 10px; font-size: 11px; }
.story-video-range-toolbar button { white-space: nowrap; flex: 0 0 auto; min-width: 0; }
.story-video-range-modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 0; flex-shrink: 0; }
.story-video-range-modal .modal-actions button { flex: 0 0 auto; min-width: 76px; white-space: nowrap; }
.story-video-range-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
    align-content: start;
    flex: 0 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 4px;
}
.story-video-range-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line-strong, #51485f);
    background: var(--panel, #232233);
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.story-video-range-number[aria-pressed="true"] {
    background: #262230;
    border-color: #8b76c5;
    color: #fff;
}
.story-video-range-number:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.story-video-range-grid.with-dialogue-status { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
.with-dialogue-status .story-video-range-number {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: 18px 16px; align-content: center; align-items: center;
    position: relative; gap: 4px 6px; width: 100%; height: 58px; padding: 7px 9px; border-radius: 6px;
    min-width: 0; text-align: left; background: #19191e; border-color: #35343d;
}
.with-dialogue-status .story-video-range-number[aria-pressed="true"] { background: #262230; border-color: #8b76c5; }
.with-dialogue-status .story-video-range-number:hover { border-color: #b4a0e7; }
.story-video-range-index { font-size: 13px; line-height: 18px; }
.with-dialogue-status .story-video-range-number small { font-size: 10px; color: #b9b6c4; text-align: right; white-space: nowrap; }
.story-video-range-number.has-dialogue-status .shot-dialogue-check-status {
    grid-column: 1 / -1; position: static; width: fit-content; max-width: 100%; min-height: 0; margin: 0; padding: 0;
    border: 0; background: transparent; box-shadow: none; font-size: 10px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.story-video-range-number .story-video-perfect-check { position: static; display: inline; color: #61dfaa; background: none; font-size: 12px; }

body.mobile-client #videoModal .video-modal,
body.mobile-client .video-modal {
    grid-template-rows: minmax(0, 1fr) auto;
}

/* Art-directed workspace layer. Kept at the end so it deliberately wins over
   legacy workspace rules without changing any workflow markup or handlers. */
:root {
    --atelier-line: rgba(180, 166, 255, 0.17);
    --atelier-line-strong: rgba(178, 158, 255, 0.44);
    --atelier-panel: rgba(12, 13, 21, 0.78);
    --atelier-panel-raised: rgba(18, 18, 30, 0.94);
    --atelier-ink-muted: #908ba9;
    --atelier-violet: #9b83ff;
}

body {
    background-color: #07070b;
}

.topbar {
    min-height: 58px;
    padding: 0 clamp(14px, 2vw, 30px);
    border-bottom-color: rgba(191, 181, 255, 0.13);
    background: rgba(7, 7, 12, 0.9);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.brand-logo {
    height: 34px;
}

.main-nav {
    gap: 0;
    margin-left: clamp(12px, 1.65vw, 28px);
}

.main-nav > .nav-item,
.nav-more > summary {
    height: 34px;
    padding-inline: clamp(6px, 0.72vw, 11px);
    border-radius: 0;
    color: #a6a1bb;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0;
}

.main-nav > .nav-item:hover,
.nav-more > summary:hover {
    color: #f4f1ff;
    background: transparent;
}

.main-nav > .nav-item.is-active,
.main-nav > .nav-item.nav-item-beta.is-active {
    color: #f6f3ff;
    background: transparent;
    box-shadow: none;
}

.main-nav > .nav-item.is-active::after,
.main-nav > .nav-item.nav-item-beta.is-active::after {
    right: clamp(6px, 0.72vw, 11px);
    bottom: 0;
    left: clamp(6px, 0.72vw, 11px);
    height: 2px;
    background: #a88eff;
    box-shadow: 0 0 12px rgba(168, 142, 255, 0.74);
}

.topbar-actions {
    gap: 3px;
}

.topbar-actions .nav-item-utility {
    height: 30px;
    min-width: 0;
    padding: 0 7px;
    border-radius: 5px;
    color: #bab5cf;
    font-size: 11px;
}

.topbar-actions .nav-item-with-icon {
    min-width: 0;
}

.topbar-actions .nav-item-utility.is-active,
.topbar-actions .nav-item-utility:hover {
    background: rgba(155, 131, 255, 0.1);
    box-shadow: none;
}

.topbar-actions .nav-item-utility.is-active::after {
    display: none;
}

.nav-refresh-link {
    width: 30px;
    height: 30px;
}

.nav-exit-link {
    color: #c0b9e6;
    font-size: 11px;
}

.nav-task-trigger {
    min-width: 98px;
    min-height: 32px;
    padding: 0 17px 0 8px;
    border-radius: 7px;
    background: rgba(151, 131, 255, 0.07);
}

.nav-task-status .library-task-summary {
    font-size: 11px;
}

.studio-view {
    position: relative;
    width: min(100%, 1510px);
    padding: clamp(32px, 4.8vw, 74px) clamp(10px, 3.5vw, 64px) 146px;
}

.studio-view::before {
    position: absolute;
    top: 28px;
    bottom: 126px;
    left: clamp(20px, 2.3vw, 42px);
    width: 1px;
    background: rgba(174, 155, 255, 0.12);
    content: "";
    pointer-events: none;
}

.studio-view > .story-band,
.studio-view > .storyboard-progress-hub {
    position: relative;
    z-index: 1;
}

.studio-view .basic-script-band {
    margin-bottom: clamp(74px, 9vw, 142px);
}

.studio-view .basic-script-band::before,
.studio-view .storyboard-pages-band::before {
    position: absolute;
    top: 7px;
    left: clamp(-47px, -2.4vw, -30px);
    color: rgba(177, 156, 255, 0.74);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0;
    writing-mode: vertical-rl;
}

.studio-view .basic-script-band::before {
    content: "01";
}

.studio-view .storyboard-pages-band::before {
    content: "02";
}

.studio-view .basic-script-head {
    min-height: 42px;
    margin-bottom: clamp(28px, 3.4vw, 48px);
    padding-bottom: 17px;
    border-bottom: 1px solid var(--atelier-line);
}

.studio-view .basic-script-head h2,
.studio-view .storyboard-pages-head h2 {
    color: #f4f1ff;
    font-size: clamp(23px, 2.1vw, 31px);
    font-weight: 820;
    letter-spacing: 0;
}

.studio-view .basic-script-head h2::after,
.studio-view .storyboard-pages-head h2::after {
    display: inline-block;
    width: 30px;
    height: 1px;
    margin: 0 0 7px 13px;
    background: #9b83ff;
    box-shadow: 0 0 12px rgba(155, 131, 255, 0.8);
    content: "";
}

.studio-view .basic-script-exit-btn {
    height: 30px;
    padding: 0 0 0 11px;
    border-left: 1px solid rgba(163, 147, 255, 0.38);
    border-radius: 0;
    color: #b8b1d6;
    font-size: 11px;
}

.studio-view .story-top-grid {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 310px);
    gap: clamp(28px, 5.3vw, 82px);
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    position: relative;
    overflow: visible;
    border: 1px solid var(--atelier-line);
    border-radius: 20px 20px 7px 7px;
    background: var(--atelier-panel);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.22);
}

.studio-view .storyboard-composer::before,
.studio-view .story-role-panel::before {
    position: absolute;
    top: -1px;
    left: 26px;
    width: 86px;
    height: 2px;
    background: #a48aff;
    box-shadow: 0 0 17px rgba(164, 138, 255, 0.78);
    content: "";
}

.studio-view .storyboard-composer {
    min-height: 530px;
    gap: 19px;
    padding: clamp(21px, 2.8vw, 35px);
}

.studio-view .story-role-panel {
    min-height: 438px;
    max-height: min(676px, calc(100vh - 98px));
    padding: 20px 18px 18px;
    background: rgba(13, 14, 24, 0.66);
}

.studio-view .storyboard-composer-head {
    min-height: 34px;
    padding-bottom: 6px;
}

.studio-view .storyboard-composer-head h3,
.studio-view .story-role-head h3 {
    color: #eae6fb;
    font-size: 13px;
    font-weight: 850;
}

.studio-view .storyboard-title-row h3::before,
.studio-view .story-role-head-row::before {
    display: inline-block;
    margin-right: 8px;
    color: #a489ff;
    font-size: 9px;
    font-weight: 900;
    content: "//";
    vertical-align: 1px;
}

.studio-view .storyboard-generation-counts {
    gap: 9px;
    padding-top: 0;
}

.studio-view .storyboard-count-inline {
    gap: 5px;
    color: var(--atelier-ink-muted);
    font-size: 10px;
    font-weight: 700;
}

.studio-view .storyboard-count-inline input {
    width: 37px;
    min-height: 27px;
    padding: 0 5px;
    border-color: rgba(168, 149, 255, 0.23);
    border-radius: 5px;
    background: rgba(6, 7, 12, 0.78);
    font-size: 11px;
}

.studio-view .storyboard-script-composer {
    min-height: 357px;
    border-color: rgba(174, 158, 255, 0.2);
    border-radius: 12px 12px 5px 5px;
    background: rgba(6, 7, 12, 0.84);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.studio-view .storyboard-script-composer > textarea {
    min-height: 290px;
    padding: 25px 27px 18px;
    color: #d8d3e9;
    font-size: 13px;
    line-height: 1.92;
}

.studio-view .story-writer-toolbar {
    min-height: 45px;
    padding: 5px 13px;
    border-top-color: var(--atelier-line);
    background: rgba(22, 22, 36, 0.76);
}

.studio-view .story-writer-tool {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border-radius: 4px;
    color: #aaa3c9;
}

.studio-view .story-writer-model,
.studio-view .story-processing-method-trigger,
.studio-view .story-processing-method-trigger strong {
    color: #9f98b9;
    font-size: 11px;
}

.studio-view .story-script-library-tool {
    min-height: 28px;
    margin-left: 5px;
    padding: 0 4px;
}

.studio-view .story-script-library-tool span,
.studio-view .prompt-agent-help span {
    font-size: 11px;
}

.studio-view .storyboard-actions {
    min-height: 38px;
    padding-top: 0;
}

.studio-view .storyboard-action-buttons {
    justify-content: space-between;
    gap: 10px;
}

.studio-view .storyboard-ai-btn,
.studio-view .prompt-agent-process,
.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn {
    min-height: 34px;
    border-radius: 7px;
    font-size: 11px;
}

.studio-view .storyboard-ai-btn {
    padding: 0 8px;
    border-color: rgba(162, 144, 255, 0.22);
    background: rgba(151, 130, 255, 0.07);
}

.studio-view .storyboard-ai-btn span {
    width: 23px;
    height: 23px;
    border-radius: 5px;
    font-size: 10px;
}

.studio-view .prompt-agent-process {
    padding: 0 12px;
}

.studio-view .storyboard-generation-buttons {
    gap: 8px;
}

.studio-view .story-role-head-row {
    position: relative;
    padding: 4px 0 13px;
    border-bottom-color: var(--atelier-line);
}

.studio-view .story-role-head-row::before {
    position: absolute;
    top: 10px;
    left: 0;
}

.studio-view .story-asset-tabs {
    gap: 0;
    margin-left: 22px;
}

.studio-view .story-asset-tabs button {
    min-width: 42px;
    height: 26px;
    padding: 0 7px;
    border-radius: 0;
    color: #8882a1;
    font-size: 10px;
}

.studio-view .story-asset-tabs button.is-active {
    border-bottom: 1px solid #a68bff;
    background: transparent;
    box-shadow: none;
    color: #eee9ff;
}

.studio-view .story-role-head-actions .prompt-reset-link {
    color: #a79fcb;
    font-size: 10px;
}

.studio-view .story-role-grid {
    gap: 16px 11px;
    padding: 20px 2px 14px 0;
}

.studio-view .story-role-avatar,
.studio-view .story-role-grid.is-scene-mode .story-role-avatar {
    border: 1px solid rgba(167, 148, 255, 0.19);
    border-radius: 9px;
    background: #0a0b12;
    box-shadow: none;
}

.studio-view .story-role-card strong,
.studio-view .story-role-name {
    color: #bdb8d3;
    font-size: 10px;
    font-weight: 700;
}

.studio-view .story-batch-gen-bar {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--atelier-line);
}

.studio-view .story-batch-gen-btn {
    min-height: 36px;
    border-radius: 7px;
    font-size: 11px;
}

.studio-view > .storyboard-progress-hub {
    grid-template-columns: 142px minmax(0, 1fr);
    min-height: 60px;
    margin: 0 0 clamp(76px, 9vw, 136px);
    padding: 9px 0;
    border-top: 1px solid var(--atelier-line);
    border-bottom: 1px solid var(--atelier-line);
    border-radius: 0;
    background: transparent;
}

.studio-view .storyboard-progress-hub-title {
    padding-left: 0;
}

.studio-view .storyboard-progress-hub-title strong {
    color: #dcd7f3;
    font-size: 11px;
}

.studio-view .storyboard-progress-hub-title span {
    color: #7f7898;
    font-size: 9px;
}

.studio-view .storyboard-pages-band {
    padding-top: 0;
}

.studio-view .storyboard-pages-head {
    min-height: 46px;
    margin-bottom: 37px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--atelier-line);
}

.studio-view .storyboard-chapter-tabs {
    gap: 6px;
}

.studio-view .storyboard-chapter-tab,
.studio-view .storyboard-chapter-add {
    height: 30px;
    border-radius: 6px;
    font-size: 10px;
}

.studio-view .storyboard-pages-export-actions .storyboard-export-btn {
    height: 30px;
    border-radius: 5px;
    color: #b7b0d6;
    font-size: 10px;
}

.studio-view .storyboard-automation-bar {
    gap: 12px 42px;
    margin-bottom: 46px;
    padding-bottom: 20px;
    border-bottom-color: var(--atelier-line);
}

.studio-view .storyboard-material-batch-actions,
.studio-view .storyboard-video-batch-actions {
    gap: 7px;
}

.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 5px;
    font-size: 10px;
}

.studio-view .shot-list {
    gap: clamp(62px, 8vw, 118px);
}

.studio-view .shot-row {
    grid-template-columns: 46px minmax(0, 1.1fr) 20px minmax(0, 0.92fr) 20px minmax(0, 0.92fr);
    gap: clamp(12px, 1.8vw, 28px);
    padding-right: 0;
}

.studio-view .shot-row::before {
    position: absolute;
    top: 54px;
    bottom: -88px;
    left: 22px;
    width: 1px;
    background: rgba(164, 144, 255, 0.2);
    content: "";
}

.studio-view .shot-row:last-child::before {
    display: none;
}

.studio-view .shot-index-stack {
    position: relative;
    z-index: 1;
    width: 46px;
    padding: 5px 0;
}

.studio-view .shot-index-stack .shot-index {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(208, 195, 255, 0.2);
    background: #24203a;
    box-shadow: 0 0 0 6px #090a11, 0 8px 20px rgba(104, 81, 217, 0.22);
    color: #eeeaff;
    font-size: 15px;
}

.studio-view .shot-continuity-tag {
    margin-top: 4px;
    color: #9187bb;
    font-size: 8px;
}

.studio-view .flow-arrow {
    color: #8f80d3;
    font-size: 15px;
}

.studio-view .shot-card {
    overflow: hidden;
    border-color: rgba(171, 154, 255, 0.16);
    border-radius: 14px 14px 5px 5px;
    background: rgba(14, 15, 24, 0.76);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.18);
    transition: border-color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.studio-view .shot-row:hover .shot-card {
    border-color: rgba(176, 157, 255, 0.35);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
}

.studio-view .shot-card > h3,
.studio-view .shot-card-title-row {
    min-height: 35px;
    padding-inline: 10px;
    border-bottom-color: rgba(176, 157, 255, 0.1);
}

.studio-view .shot-card h3 {
    color: #bcb5d8;
    font-size: 10px;
    font-weight: 800;
}

.studio-view .shot-duration-editor {
    color: #8881a3;
    font-size: 9px;
}

.studio-view .shot-duration-editor input {
    width: 38px;
    height: 24px;
    border-radius: 4px;
    font-size: 10px;
}

.studio-view .shot-content,
.studio-view .shot-content.shot-reference-board,
.studio-view .shot-text {
    border-radius: 0;
}

.studio-view .shot-content.shot-reference-board {
    background: #08090f;
}

.studio-view .shot-reference-grid {
    gap: 7px;
    padding: 12px;
}

.studio-view .shot-text p {
    padding: 14px;
    color: #bdb7d0;
    font-size: 11px;
    line-height: 1.82;
}

.studio-view .shot-source-tabs button {
    min-width: 70px;
    height: 28px;
    padding: 0 9px;
    font-size: 10px;
}

.studio-view .add-shot {
    width: min(280px, 100%);
    min-height: 44px;
    margin-top: 46px;
    border: 1px dashed rgba(169, 150, 255, 0.34);
    border-radius: 7px;
    background: transparent;
    color: #ae9bff;
    box-shadow: none;
    font-size: 11px;
}

.studio-view .add-shot span {
    font-size: 22px;
}

@media (min-width: 721px) and (max-width: 1190px) {
    .topbar-actions {
        max-width: none;
        flex-wrap: nowrap;
    }
}

@media (max-width: 1120px) {
    .studio-view {
        padding-inline: 42px;
    }

    .studio-view .story-top-grid {
        grid-template-columns: minmax(0, 1fr) 258px;
        gap: 28px;
    }

    .studio-view .storyboard-composer {
        padding: 23px;
    }

    .studio-view .storyboard-action-buttons {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .studio-view {
        padding-inline: 30px;
    }

    .studio-view::before,
    .studio-view .basic-script-band::before,
    .studio-view .storyboard-pages-band::before {
        display: none;
    }

    .studio-view .story-top-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .studio-view .story-role-panel {
        position: static;
        max-height: none;
    }

    .studio-view .story-role-grid {
        grid-template-columns: repeat(5, minmax(62px, 1fr));
        max-height: 220px;
    }

    .studio-view .shot-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .studio-view .flow-arrow {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar {
        padding-inline: 12px;
    }

    .studio-view {
        padding: 26px 0 86px;
    }

    .studio-view .basic-script-band {
        margin-bottom: 58px;
    }

    .studio-view .basic-script-head h2,
    .studio-view .storyboard-pages-head h2 {
        font-size: 22px;
    }

    .studio-view .storyboard-composer,
    .studio-view .story-role-panel {
        border-radius: 13px 13px 5px 5px;
        padding: 17px;
    }

    .studio-view .storyboard-composer-head,
    .studio-view .storyboard-pages-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .studio-view .storyboard-generation-counts,
    .studio-view .storyboard-pages-export-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .studio-view .storyboard-script-composer > textarea {
        min-height: 242px;
        padding: 19px;
    }

    .studio-view .story-role-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .studio-view .shot-row::before {
        bottom: -74px;
    }
}

/* --------------------------------------------------------------------------
   Creative board refresh: preserve the existing production flow while making
   the workspace calmer, more legible, and resilient at narrower desktop widths.
   -------------------------------------------------------------------------- */

.nav-more {
    position: relative;
    display: none;
    flex: 0 0 auto;
}

.nav-more > summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    padding: 0 8px;
    color: #bdb8de;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.nav-more > summary::-webkit-details-marker {
    display: none;
}

.nav-more > summary svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 160ms ease;
}

.nav-more[open] > summary {
    color: #f1efff;
}

.nav-more[open] > summary svg {
    transform: rotate(180deg);
}

.nav-more-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    display: grid;
    min-width: 138px;
    padding: 6px;
    border: 1px solid rgba(162, 150, 255, 0.24);
    border-radius: 10px;
    background: rgba(17, 18, 29, 0.98);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.nav-more-item {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    color: #c9c5e7;
    font-size: 12px;
    text-align: left;
}

.nav-more-item:hover,
.nav-more-item.is-active {
    background: rgba(128, 109, 255, 0.16);
    color: #ffffff;
}

.nav-more-item.is-active::after {
    display: none;
}

.studio-view {
    width: min(100%, 1540px);
    margin: 0 auto;
    padding: clamp(18px, 2.4vw, 38px) clamp(4px, 1.4vw, 22px) 112px;
}

.studio-view > .story-band,
.studio-view > .storyboard-progress-hub {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.studio-view .story-band {
    padding: 0;
}

.studio-view .basic-script-band {
    margin-bottom: clamp(48px, 6vw, 92px);
}

.studio-view .basic-script-head {
    min-height: 48px;
    margin-bottom: clamp(22px, 2.5vw, 36px);
    padding: 0 0 14px;
    border-bottom: 1px solid rgba(157, 150, 207, 0.14);
}

.studio-view .basic-script-head h2,
.studio-view .storyboard-pages-head h2 {
    margin: 0;
    color: #f3f0ff;
    font-size: clamp(20px, 1.8vw, 27px);
    font-weight: 800;
    line-height: 1.15;
}

.studio-view .basic-script-exit-btn {
    min-width: 0;
    height: 32px;
    padding: 0 2px;
    border-color: transparent;
    background: transparent;
    color: #a9a1d3;
    box-shadow: none;
}

.studio-view .basic-script-exit-btn:hover:not(:disabled) {
    border-color: transparent;
    background: transparent;
    color: #f1efff;
}

.studio-view .story-top-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 318px);
    gap: clamp(22px, 3.2vw, 52px);
    width: 100%;
    margin: 0;
    align-items: start;
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    border: 1px solid rgba(159, 151, 228, 0.18);
    border-top-color: rgba(187, 178, 255, 0.34);
    border-radius: 14px;
    background: rgba(17, 18, 29, 0.9);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.2);
}

.studio-view .storyboard-composer {
    min-height: 476px;
    gap: 16px;
    padding: clamp(18px, 2vw, 28px);
}

.studio-view .story-role-panel {
    position: sticky;
    top: 80px;
    min-height: 476px;
    max-height: min(660px, calc(100vh - 104px));
    padding: 18px;
}

.studio-view .storyboard-composer-head {
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 3px;
}

.studio-view .storyboard-composer-head h3,
.studio-view .story-role-head h3 {
    color: #f5f3ff;
    font-size: 15px;
    font-weight: 850;
}

.studio-view .storyboard-generation-counts {
    padding: 7px 0 0;
}

.studio-view .storyboard-count-inline {
    color: #9d98bd;
    font-size: 11px;
}

.studio-view .storyboard-count-inline input {
    width: 42px;
    min-height: 30px;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 12px;
}

.studio-view .storyboard-script-composer {
    min-height: 318px;
    border-color: rgba(165, 156, 241, 0.2);
    border-radius: 10px;
    background: #10111a;
}

.studio-view .storyboard-script-composer > textarea {
    min-height: 252px;
    padding: 20px 21px 16px;
    font-size: 14px;
    line-height: 1.82;
}

.studio-view .story-writer-toolbar {
    min-height: 46px;
    padding: 6px 10px;
    background: rgba(26, 27, 43, 0.82);
}

.studio-view .storyboard-actions {
    min-height: 42px;
    padding-top: 4px;
}

.studio-view .storyboard-action-buttons {
    width: 100%;
    gap: 12px;
}

.studio-view .story-processing-method-trigger,
.studio-view .story-writer-model {
    color: #a9a4c7;
    font-size: 12px;
}

.studio-view .story-role-head-row {
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(157, 150, 207, 0.12);
}

.studio-view .story-asset-tabs {
    gap: 2px;
}

.studio-view .story-asset-tabs button {
    min-width: 46px;
    height: 28px;
    padding: 0 8px;
    color: #9691af;
    font-size: 11px;
}

.studio-view .story-asset-tabs button.is-active {
    background: rgba(128, 109, 255, 0.16);
    box-shadow: inset 0 -1px 0 #9a88ff;
}

.studio-view .story-role-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px 10px;
    padding-top: 16px;
}

.studio-view .story-role-avatar {
    border-radius: 10px;
}

.studio-view .story-role-grid.is-scene-mode .story-role-avatar {
    border-radius: 10px;
}

.studio-view .story-batch-gen-bar {
    margin-top: 12px;
}

.studio-view > .storyboard-progress-hub {
    grid-template-columns: 132px minmax(0, 1fr);
    min-height: 56px;
    margin: 0 0 clamp(38px, 4.5vw, 68px);
    padding: 8px 0;
    border-top: 1px solid rgba(151, 143, 255, 0.16);
    border-bottom: 1px solid rgba(151, 143, 255, 0.12);
    border-left: 0;
    border-right: 0;
    background: rgba(14, 15, 24, 0.5);
}

.studio-view .storyboard-progress-hub-title {
    padding: 0 18px;
    border-right-color: rgba(151, 143, 255, 0.16);
}

.studio-view .storyboard-progress-hub-content {
    padding-right: 18px;
}

.studio-view .storyboard-pages-band {
    margin: 0;
    padding-top: clamp(8px, 1.2vw, 18px);
}

.studio-view .storyboard-pages-head {
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 30px;
}

.studio-view .storyboard-chapter-tabs {
    min-width: 0;
    padding-bottom: 2px;
}

.studio-view .storyboard-pages-export-actions {
    gap: 7px;
}

.studio-view .storyboard-pages-export-actions .storyboard-export-btn {
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 11px;
}

.studio-view .storyboard-automation-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 28px;
    width: 100%;
    margin: 0 0 32px;
    padding: 0 0 18px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.12);
}

.studio-view .storyboard-automation-materials,
.studio-view .storyboard-automation-videos {
    grid-column: auto;
}

.studio-view .storyboard-material-batch-actions,
.studio-view .storyboard-video-batch-actions {
    justify-content: flex-start;
}

.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn {
    min-height: 34px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 12px;
}

.studio-view .shot-list {
    gap: clamp(36px, 4.5vw, 66px);
}

.studio-view .shot-row {
    grid-template-columns: 50px minmax(0, 1.08fr) 22px minmax(0, 1fr) 22px minmax(0, 1fr);
    gap: clamp(10px, 1.35vw, 20px);
    width: 100%;
    padding: 0 42px 0 0;
}

.studio-view .shot-index-stack {
    width: 50px;
}

.studio-view .shot-index-stack .shot-index {
    width: 38px;
    height: 38px;
    font-size: 17px;
}

.studio-view .shot-continuity-tag {
    max-width: 50px;
    font-size: 8px;
}

.studio-view .flow-arrow {
    color: #706996;
    font-size: 18px;
}

.studio-view .shot-card {
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(151, 143, 255, 0.15);
    border-radius: 10px;
    background: rgba(17, 18, 29, 0.68);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.15);
}

.studio-view .shot-card > h3,
.studio-view .shot-card-title-row {
    min-height: 39px;
    padding-inline: 12px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.1);
}

.studio-view .shot-card h3 {
    color: #dcd8f0;
    font-size: 12px;
}

.studio-view .shot-content {
    border-radius: 0;
    box-shadow: none;
}

.studio-view .shot-content.shot-reference-board {
    border-width: 0;
    border-radius: 0;
}

.studio-view .shot-text {
    border: 0;
    box-shadow: none;
}

.studio-view .shot-text p {
    padding: 16px;
    color: #c1bdd7;
    font-size: 12px;
    line-height: 1.75;
}

.studio-view .add-shot {
    width: min(340px, 100%);
    min-height: 52px;
    margin: 34px auto 0;
    border-radius: 8px;
    background: rgba(124, 108, 255, 0.07);
}

@media (min-width: 721px) and (max-width: 1190px) {
    .topbar {
        padding-inline: 12px;
    }

    .main-nav {
        gap: 1px;
        margin-left: 7px;
    }

    .main-nav > .nav-item[data-view="customWorkflow"],
    .main-nav > .nav-item[data-view="assistant"],
    .main-nav > .nav-item[data-view="director"],
    .main-nav > .nav-item[data-view="infiniteCanvas"] {
        display: none;
    }

    .nav-more {
        display: block;
    }

    .topbar-actions {
        margin-left: auto;
        max-width: none;
    }
}

@media (min-width: 721px) and (max-width: 1020px) {
    .main-nav > .nav-item[data-view="studio3d"] {
        display: none;
    }

    .topbar-actions .nav-task-status,
    .topbar-actions .nav-refresh-link {
        display: none;
    }

    .topbar-actions .nav-item-utility {
        min-width: 0;
        padding-inline: 6px;
        font-size: 11px;
    }
}

@media (max-width: 1120px) {
    .studio-view .story-top-grid {
        grid-template-columns: minmax(0, 1fr) 276px;
        gap: 22px;
    }

    .studio-view .storyboard-composer {
        padding: 20px;
    }

    .studio-view .storyboard-action-buttons {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .studio-view {
        padding-inline: 0;
    }

    .studio-view .story-top-grid {
        grid-template-columns: 1fr;
    }

    .studio-view .story-role-panel {
        position: static;
        min-height: 0;
        max-height: none;
    }

    .studio-view .story-role-grid {
        grid-template-columns: repeat(5, minmax(70px, 1fr));
        max-height: 230px;
    }

    .studio-view .storyboard-automation-bar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .studio-view .shot-row {
        grid-template-columns: 46px minmax(0, 1fr);
        padding-right: 0;
    }

    .studio-view .shot-row .flow-arrow {
        display: none;
    }
}

@media (max-width: 720px) {
    .nav-more {
        display: none !important;
    }

    .studio-view {
        padding: 10px 0 72px;
    }

    .studio-view .basic-script-head {
        align-items: flex-start;
    }

    .studio-view .basic-script-head h2,
    .studio-view .storyboard-pages-head h2 {
        font-size: 20px;
    }

    .studio-view .storyboard-composer-head,
    .studio-view .storyboard-pages-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .studio-view .storyboard-generation-counts {
        width: 100%;
        flex-wrap: wrap;
    }

    .studio-view .storyboard-pages-export-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .studio-view .story-role-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .studio-view .storyboard-composer,
    .studio-view .story-role-panel {
        padding: 16px;
        border-radius: 10px;
    }

    .studio-view .storyboard-script-composer > textarea {
        min-height: 230px;
        padding: 16px;
    }
}

/* Keep the storyboard-only action in the same dark visual language when
   multi-parameter video mode disables it. */
.shot-video-details-action:disabled,
.shot-storyboard-regenerate-action:disabled {
    background: rgba(32, 31, 66, 0.58);
    color: rgba(232, 229, 255, 0.42);
    opacity: 0.62;
    filter: none;
}

/* Saved automation choices remain visible when a Tag, Skill, model, LoRA, or
   host is unavailable. Availability styling must never change the saved value. */
#automationSettingsPanel .is-missing-selection,
#automationSettingsPanel select.is-missing-selection {
    border-color: #e5485d !important;
    background-color: rgba(229, 72, 93, .1) !important;
    color: #ff8fa0 !important;
    box-shadow: 0 0 0 1px rgba(229, 72, 93, .2) inset;
}

#automationSettingsPanel .automation-host-option.is-missing-selection em,
#automationSettingsPanel .automation-optimization-step.is-missing-selection [data-current-selection] {
    color: #ff8fa0 !important;
}

#automationSettingsPanel select.is-partial-selection {
    border-color: #d98b2b !important;
    background-color: rgba(217, 139, 43, .1) !important;
    color: #f0b766 !important;
}

#videoIndexesRow.is-hidden {
    display: none;
}


.image-preview-grid img {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    object-fit: contain;
    background: rgba(5, 6, 10, 0.8);
    aspect-ratio: 16 / 9;
}

.image-grid-zoom {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
}

.image-grid-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 36px;
}

.image-grid-check {
    position: relative;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 28px;
    height: 28px;
    color: rgba(234, 236, 255, 0.86);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.generated-duration {
    color: rgba(224, 218, 255, 0.72);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.preview-duration-badge {
    display: inline;
    height: auto;
    margin-left: auto;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(224, 218, 255, 0.76);
    font-size: 11px;
    font-weight: 800;
    line-height: 34px;
    white-space: nowrap;
}

.preview-duration-row {
    display: flex;
    justify-content: flex-end;
    min-height: 18px;
    margin-top: 8px;
}

.preview-duration-row .preview-duration-badge {
    display: inline;
    height: auto;
    margin-left: 0;
    line-height: 1.4;
}

.image-grid-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--brand);
    cursor: pointer;
}

.image-grid-check.is-disabled {
    opacity: 0.55;
}

.image-preview-card.is-saved img {
    opacity: 0.82;
}

.image-preview-slot-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
    border: 1px dashed rgba(151, 143, 255, 0.22);
    background: rgba(15, 17, 26, 0.96);
    color: rgba(207, 200, 255, 0.48);
    font-size: 12px;
    font-weight: 700;
}

.image-grid-meta--placeholder {
    grid-template-columns: 1fr;
    align-items: center;
    min-height: 36px;
    color: rgba(207, 200, 255, 0.42);
    font-size: 11px;
    text-align: center;
}

.preview-tools {
    position: relative;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 20px;
}

.preview-tools button {
    min-width: 100px;
    height: 34px;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 999px;
    background: rgba(24, 25, 38, 0.98);
    color: #d6d0ff;
    font-size: var(--text-xs);
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.preview-tools button:hover {
    border-color: rgba(151, 143, 255, 0.38);
    background: rgba(36, 38, 58, 0.98);
    color: #f4f1ff;
}

.preview-tools button.is-active {
    border-color: rgba(151, 143, 255, 0.5);
    background: rgba(68, 55, 190, 0.24);
    color: #ffffff;
}

.preview-tools .preview-download-icon-btn {
    min-width: 0;
    width: 34px;
    padding: 0;
    border-radius: 999px;
}

.preview-tools .preview-download-icon-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.image-grid-actions,
.voice-preview-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.preview-download-inline {
    color: #8e98c5;
}

.preview-download-inline:hover {
    color: #f1f4ff;
}

.audio-download-btn {
    min-width: 0;
}

.preview-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-head-side {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.preview-limit-note {
    color: rgba(183, 189, 228, 0.62);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.preview-clear-btn {
    border: 0;
    background: transparent;
    color: rgba(181, 169, 255, 0.9);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.preview-clear-btn:hover {
    color: #f0edff;
    text-decoration: underline;
}

.preview-clear-btn:disabled {
    color: rgba(135, 138, 175, 0.48);
    cursor: default;
    text-decoration: none;
}

.preview-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(132, 126, 205, 0.24);
    background: rgba(17, 19, 31, 0.92);
    color: #bfc4e8;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.preview-status-chip strong {
    font-weight: 800;
}

.preview-status-spinner {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(195, 186, 255, 0.18);
    border-top-color: #a89cff;
    border-right-color: #7f71ff;
    flex: 0 0 auto;
}

.preview-status-chip.is-idle .preview-status-spinner {
    display: none;
}

.preview-status-chip.is-loading {
    color: #f3efff;
    border-color: rgba(157, 145, 255, 0.38);
    background: rgba(46, 35, 116, 0.52);
    box-shadow: 0 10px 24px rgba(62, 43, 166, 0.18);
}

.preview-status-chip.is-loading .preview-status-spinner {
    animation: preview-status-spin 0.9s linear infinite;
}

.preview-status-chip.is-complete {
    color: #d9d4ff;
    border-color: rgba(112, 219, 187, 0.24);
    background: rgba(24, 58, 56, 0.84);
}

.preview-status-chip.is-complete .preview-status-spinner {
    display: none;
}

.voice-head .preview-status-chip {
    color: #bfc4e8;
}

.voice-head .preview-status-chip.is-loading {
    color: #f3efff;
}

.voice-head .preview-status-chip.is-complete {
    color: #d9d4ff;
}

@keyframes preview-status-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tone-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tone-tool-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex: 0 0 auto;
}

.tone-tool-vip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 10px;
    flex: 0 0 12px;
    overflow: visible;
}

.tone-tool-vip svg {
    width: 12px;
    height: 10px;
    flex: 0 0 12px;
    display: block;
}

.tone-adjust-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    z-index: 6;
    width: min(320px, calc(100vw - 48px));
}

.preview-col {
    position: relative;
    overflow: visible;
}

.voice-grid > .preview-col,
.voice-clone-grid > .music-preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.voice-grid > .preview-col > .audio-list,
.voice-clone-grid .voice-clone-preview-list {
    min-height: 0;
    max-height: calc(min(88vh, 780px) - 190px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    align-content: start;
    align-items: start;
}

.preview-col .tone-adjust-popover {
    top: 74px;
    right: 18px;
    bottom: auto;
    width: 258px;
}

.lightbox-footer .tone-adjust-popover {
    top: 88px;
    bottom: auto;
    right: 96px;
    width: 258px;
}

.tone-adjust-card {
    display: grid;
    gap: 18px;
    padding: 18px 18px 16px;
    border-radius: 24px;
    border: 1px solid rgba(113, 104, 205, 0.18);
    background: linear-gradient(180deg, rgba(22, 23, 37, 0.98), rgba(16, 17, 29, 0.98));
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
}

.tone-adjust-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tone-adjust-head strong {
    color: #f7f7ff;
    font-size: 15px;
    font-weight: 800;
}

.tone-adjust-grid {
    display: grid;
    gap: 18px;
}

.tone-adjust-section {
    display: grid;
    gap: 10px;
}

.tone-adjust-section h4 {
    margin: 0;
    color: #f6f4ff;
    font-size: 13px;
    font-weight: 700;
}

.tone-adjust-rgb-stack {
    display: grid;
    gap: 8px;
}

.tone-adjust-row {
    display: grid;
    align-items: center;
    gap: 10px;
    color: #d6daf4;
    font-size: 12px;
    font-weight: 700;
}

.tone-adjust-row-rgb {
    grid-template-columns: 20px minmax(0, 1fr) 20px 36px;
}

.tone-adjust-row-single {
    grid-template-columns: 20px minmax(0, 1fr) 20px 36px;
}

.tone-adjust-row input[type="range"] {
    width: 100%;
    accent-color: #6d63ff;
}

.tone-adjust-row strong {
    text-align: right;
    color: #d4d8f6;
    font-size: 11px;
}

.tone-adjust-edge-label {
    color: rgba(176, 181, 216, 0.72);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.tone-adjust-edge-label-right {
    color: rgba(224, 228, 248, 0.8);
}

.tone-adjust-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tone-adjust-actions .secondary-btn {
    min-width: 88px;
    height: 34px;
    font-size: 12px;
}

.tone-adjust-card input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    background: transparent;
}

.tone-adjust-card input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(83, 77, 160, 0.52);
}

.tone-adjust-card input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border: 0;
    border-radius: 999px;
    background: #6f5cff;
    box-shadow: 0 0 0 4px rgba(111, 92, 255, 0.12);
}

.tone-adjust-card input[type="range"]::-moz-range-track {
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: rgba(83, 77, 160, 0.52);
}

.tone-adjust-card input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 999px;
    background: #6f5cff;
    box-shadow: 0 0 0 4px rgba(111, 92, 255, 0.12);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
    min-height: 74px;
    padding: 0 32px;
    border-top: 1px solid #eeeef9;
    background: #fff;
}

.video-modal > .modal-footer {
    position: sticky;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 7;
    border-radius: 0 0 8px 8px;
}

.modal-footer > div {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
}

#imageModal .modal-footer > div {
    max-width: min(100%, 640px);
}

#imageModal .modal-footer > div > button {
    flex: 0 0 auto;
}

.host-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #f4f5fb;
    color: #4d526d;
    padding: 0 16px;
    font-size: var(--text-xs);
    font-weight: 700;
}

.host-pill strong {
    font-weight: 700;
}

.host-pill span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.modal-footer > .generation-host-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
}

.host-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 6px;
    border: 1px solid var(--jian-line);
    border-radius: 6px;
    background: var(--jian-panel-raised);
    color: var(--jian-muted);
    cursor: pointer;
}

.host-refresh-btn:hover:not(:disabled) { color: var(--jian-ink); border-color: var(--jian-line-hover); }
.host-refresh-btn:focus-visible { outline: 2px solid var(--jian-accent); outline-offset: 2px; }
.host-refresh-btn:disabled { cursor: wait; opacity: 0.6; }
.host-refresh-btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.host-refresh-btn.is-refreshing svg { animation: host-refresh-spin 0.8s linear infinite; }
.host-popover-head > span { margin-inline-start: auto; }
@keyframes host-refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .host-refresh-btn.is-refreshing svg { animation: none; } }

.host-popover {
    position: fixed;
    z-index: 220;
    width: 320px;
    border-radius: 12px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    background: rgba(18, 19, 29, 0.98);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.host-popover-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(151, 143, 255, 0.12);
}

.host-popover-head strong {
    color: var(--ink);
    font-size: var(--text-md);
}

.host-popover-head span {
    color: var(--muted);
    font-size: var(--text-xs);
}

.host-popover-list {
    display: grid;
    padding: 10px;
}

.host-option {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    text-align: left;
}

.host-option:hover,
.host-option.is-active {
    background: rgba(124, 108, 255, 0.12);
}

.host-option strong {
    display: block;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
}

.host-option em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-style: normal;
}

.voice-modal {
    width: min(94vw, 1280px);
    max-height: min(94vh, 900px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) 74px;
}

.voice-grid {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 74px;
    min-height: 0;
    padding: 24px;
    overflow: auto;
}

.voice-panel {
    min-height: 0;
}

.voice-library-picker {
    top: 88px;
    right: 42px;
    bottom: 88px;
    width: min(500px, calc(100% - 84px));
}

.video-library-picker {
    top: 88px;
    right: 36px;
    bottom: 88px;
    width: min(520px, calc(100% - 72px));
    z-index: 300;
}

.text-card {
    margin-bottom: 36px;
    margin-top:24px;
}

.text-card textarea {
    height: 158px;
    padding: 22px 24px;
}

.text-card.large textarea {
    height: 180px;
}

.voice-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.voice-head span {
    color: #30344f;
    font-size: var(--text-sm);
    font-weight: 700;
}

.audio-list {
    display: grid;
    gap: 22px;
}

.audio-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 58px 34px;
    align-items: center;
    gap: 20px;
    min-height: 82px;
    padding: 0 18px;
    border-radius: 8px;
    background: #fbfbff;
}

.audio-play {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f2f1ff;
    color: var(--brand);
}

.audio-play::before {
    content: "";
    margin-left: 3px;
    border-left: 10px solid currentColor;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

.audio-play.is-playing::before {
    width: 10px;
    height: 12px;
    margin-left: 0;
    border: 0;
    background:
        linear-gradient(90deg, currentColor 0 38%, transparent 38% 62%, currentColor 62% 100%);
}

.wave {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 46px;
}

.wave i {
    width: 3px;
    border-radius: 999px;
    background: #9c91ff;
}

.audio-item time,
.audio-item .dots {
    color: #3c415b;
    font-size: var(--text-sm);
    font-weight: 700;
}

.audio-meta-actions {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    white-space: nowrap;
}

.audio-generated-at {
    color: #8a90ad;
    font-size: 11px;
    font-weight: 700;
}

.image-prompt-tools .prompt-reset-btn {
    padding: 0 9px;
}

.prompt-reset-link {
    min-width: 0;
    height: auto;
    padding: 0 0 11px 0;
    border: 0;
    background: transparent;
    color: rgba(181, 169, 255, 0.92);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 900;
    cursor: pointer;
}

.prompt-reset-link:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prompt-reset-link:disabled {
    color: rgba(135, 138, 175, 0.55);
    cursor: default;
    text-decoration: none;
}

.prompt-auto-script-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: max-content;
    color: #ddd8ff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.prompt-auto-script-toggle span,
.prompt-box .prompt-auto-script-toggle span,
.music-prompt .prompt-auto-script-toggle span,
.prompt-input-wrap .prompt-auto-script-toggle span {
    position: static;
    right: auto;
    bottom: auto;
    display: inline;
}

.prompt-auto-script-toggle input {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin: 0;
    appearance: auto;
    accent-color: #8d7bff;
    cursor: pointer;
}

.prompt-auto-script-toggle.is-disabled,
.prompt-auto-script-toggle:has(input:disabled) {
    color: rgba(135, 138, 175, 0.58);
    cursor: default;
}

.prompt-auto-script-toggle:has(input:disabled) input {
    cursor: default;
}

.audio-save-btn,
.audio-saved-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 68px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.audio-save-btn {
    border: 1px solid rgba(111, 92, 255, 0.3);
    background: rgba(111, 92, 255, 0.12);
    color: #6f5cff;
}

.save-library-icon {
    display: block;
    width: 1.18em;
    height: 1.18em;
    flex: 0 0 1.18em;
}

.audio-saved-tag {
    border: 1px solid rgba(86, 204, 122, 0.18);
    background: rgba(86, 204, 122, 0.12);
    color: #57cf78;
}

.audio-empty {
    padding: 18px 0;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
}

.audio-preview-item {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
}

.audio-preview-item time {
    min-width: 44px;
}

.audio-trailing {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.voice-preview-item {
    grid-template-columns: minmax(0, 1fr);
    min-height: 124px;
    height: 124px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(151, 157, 210, 0.12);
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.voice-preview-main {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.voice-preview-player {
    display: block;
    width: 100%;
    min-width: 0;
    height: 42px;
    filter: hue-rotate(8deg) saturate(0.9) brightness(0.94);
}

.voice-preview-inline-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.voice-preview-duration {
    color: rgba(247, 248, 255, 0.86);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.voice-preview-submeta {
    display: flex;
    justify-content: flex-end;
    transform: translateY(-4px);
}

.voice-preview-submeta time {
    min-width: 0;
    color: rgba(183, 189, 228, 0.64);
    font-size: 11px;
    font-weight: 600;
}

.audio-list.has-preview-progress {
    position: relative;
    padding-bottom: 52px;
}

.preview-progress-inline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
}

.resource-tile[data-audio-play],
.asset-audio-play {
    cursor: pointer;
}

.resource-tile[data-audio-play].is-playing,
.asset-audio-play.is-playing {
    box-shadow: 0 0 0 1px rgba(111, 92, 255, 0.28), 0 16px 28px rgba(111, 92, 255, 0.12);
}

.music-modal {
    width: min(94vw, 1180px);
    height: min(94vh, 900px);
    max-height: min(94vh, 900px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) 74px;
    overflow: visible;
}

.music-modal > .modal-footer {
    position: relative;
    z-index: 5;
}

.video-modal {
    position: relative;
    width: min(94vw, 1320px);
    max-height: min(94vh, 940px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) 74px;
    border-radius: 8px;
    background: rgba(18, 19, 29, 0.94);
    border: 1px solid rgba(151, 157, 210, 0.12);
    box-shadow: var(--shadow);
    overflow: visible;
}

.video-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.85fr);
    align-items: start;
    gap: 26px;
    min-height: 0;
    max-height: none;
    padding: 28px;
    overflow: auto;
}

.minimax-h3-panel {
    display: grid;
    gap: 12px;
}

.minimax-h3-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.minimax-reference-select {
    position: relative;
    display: inline-flex;
    width: 112px;
    flex: 0 0 112px;
}

.minimax-reference-select select {
    appearance: none;
    -webkit-appearance: none;
    width: auto;
    min-width: 112px;
    height: 30px;
    padding: 0 30px 0 11px;
    border: 1px solid rgba(147, 136, 255, 0.3);
    border-radius: 6px;
    background: rgba(38, 36, 64, 0.96);
    color: #e7e3ff;
    font-size: 12px;
    font-weight: 650;
    line-height: 30px;
    cursor: pointer;
}

.minimax-reference-select svg {
    position: absolute;
    top: 50%;
    right: 9px;
    width: 14px;
    height: 14px;
    color: #a9a1e8;
    pointer-events: none;
    transform: translateY(-50%);
}

.minimax-reference-select svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.minimax-h3-heading h3 {
    margin: 0;
    color: var(--ink);
    font-size: var(--text-md);
}

.minimax-h3-heading p {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-xs);
}

.minimax-h3-heading > span {
    color: #aaa2ec;
    font-size: var(--text-xs);
    font-weight: 800;
    white-space: nowrap;
}

.minimax-media-board {
    min-height: 166px;
    padding: 16px;
    border: 1px solid rgba(151, 143, 255, 0.3);
    border-radius: 8px;
    background: rgba(14, 15, 24, 0.72);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.minimax-media-board.is-dragover,
.minimax-media-board.is-paste-target {
    border-color: rgba(141, 123, 255, 0.9);
    background: rgba(32, 31, 52, 0.88);
    box-shadow: inset 0 0 0 1px rgba(141, 123, 255, 0.2), 0 18px 40px rgba(58, 46, 132, 0.2);
}

.minimax-media-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-content: start;
    gap: 10px;
}

.minimax-media-card,
.minimax-media-add {
    position: relative;
    aspect-ratio: 4 / 5;
    min-width: 0;
    border-radius: 7px;
    overflow: hidden;
}

.minimax-media-card {
    display: block;
    border: 1px solid rgba(151, 143, 255, 0.2);
    background: rgba(24, 25, 38, 0.96);
}

.minimax-media-card::after {
    content: none;
}

.minimax-media-card img,
.minimax-media-card video {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    background: #080910;
}

.minimax-media-preview {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.reference-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding-left: 2px;
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: 50%;
    background: rgba(8, 9, 16, 0.7);
    color: #fff;
    font-size: 12px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.minimax-media-caption {
    position: absolute;
    right: 4px;
    bottom: 4px;
    left: 4px;
    z-index: 1;
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(8, 9, 16, 0.84);
    pointer-events: none;
}

.minimax-media-caption strong,
.minimax-media-caption small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimax-media-caption strong {
    color: #f1efff;
    font-size: 9px;
}

.minimax-media-caption small {
    color: #b8b6c8;
    font-size: 8px;
}

.minimax-media-card > strong {
    overflow: hidden;
    padding: 7px 9px;
    color: var(--ink);
    font-size: 11px;
    line-height: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimax-media-card .remove-x {
    top: 5px;
    right: 5px;
    z-index: 2;
}

.minimax-media-add {
    display: grid;
    place-content: center;
    gap: 6px;
    border: 1px dashed rgba(151, 143, 255, 0.48);
    background: rgba(28, 29, 44, 0.72);
    color: #cfc8ff;
    text-align: center;
}

.minimax-media-add:hover {
    border-color: rgba(141, 123, 255, 0.92);
    background: rgba(39, 39, 60, 0.94);
}

.minimax-media-add > span {
    font-size: 34px;
    font-weight: 200;
    line-height: 0.9;
}

.minimax-media-add strong {
    font-size: 11px;
}

.video-form-grid-tight.minimax-settings-grid {
    grid-template-columns: 210px 96px minmax(180px, 1fr);
    margin-top: 6px;
}

.video-form-grid-tight.minimax-custom-size-row {
    grid-template-columns: repeat(2, minmax(140px, 220px)) minmax(180px, 1fr);
    align-items: end;
    margin-top: 8px;
}

.minimax-custom-size-row small {
    align-self: center;
    color: var(--muted);
    font-size: 12px;
}

.minimax-resolution-field {
    width: 210px;
}

.minimax-resolution-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    gap: 8px;
    width: 100%;
}

.minimax-resolution-select-wrap {
    position: relative;
    display: block;
    min-width: 0;
}

.video-form-grid .minimax-resolution-select-wrap select {
    width: 100%;
    min-width: 0;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
}

.minimax-resolution-select-wrap > svg {
    position: absolute;
    top: 50%;
    right: 11px;
    width: 14px;
    height: 14px;
    color: #aaa2ec;
    pointer-events: none;
    transform: translateY(-50%);
}

.minimax-resolution-select-wrap > svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.minimax-resolution-swap {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(151, 143, 255, 0.28);
    border-radius: 8px;
    background: rgba(34, 33, 54, 0.96);
    color: #cfc8ff;
    cursor: pointer;
}

.minimax-resolution-swap:hover,
.minimax-resolution-swap:focus-visible {
    border-color: rgba(151, 143, 255, 0.72);
    color: #fff;
    outline: none;
}

.video-form-grid-tight.minimax-sampling-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    justify-content: start;
    margin-top: 8px;
}

.video-form-grid-tight.minimax-primary-sampling-grid {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    margin-top: 8px;
}

.minimax-primary-sampling-grid .minimax-steps-field input {
    width: 100%;
    min-width: 0;
}

.minimax-primary-sampling-grid .minimax-lora-grid {
    margin: 0;
    min-width: 0;
}

.minimax-primary-sampling-grid .lora-custom-list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.minimax-lora-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
}

.minimax-media-caption input[data-minimax-asset-name] {
    width: 100%;
    min-width: 0;
    padding: 3px 5px;
    font-size: 12px;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
}

.minimax-advanced-panel {
    margin-top: 8px;
}

.minimax-advanced-panel .minimax-sampling-grid {
    padding: 0 12px 12px;
}

.minimax-sampling-grid label {
    min-width: 0;
}

.minimax-sampling-grid input,
.minimax-sampling-grid select,
.minimax-duration-field input {
    width: 100%;
    min-width: 0;
}

.minimax-vae-field select,
.minimax-clip-field select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimax-seed-field.is-disabled {
    opacity: 0.48;
}

.minimax-resolution-swap svg {
    width: 19px;
    height: 19px;
}

.minimax-resolution-swap svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.minimax-settings-grid select {
    min-width: 0;
}

.minimax-duration-field {
    width: 96px;
}

.minimax-duration-field input {
    width: 100%;
}

.minimax-main-model-field {
    min-width: 0;
}

.minimax-main-model-field select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimax-prompt-heading {
    margin-top: 2px;
}

.minimax-prompt-box textarea {
    min-height: 122px;
    max-height: 420px;
    overflow-y: hidden;
    resize: none;
}

.minimax-mention-menu {
    position: fixed;
    z-index: 1000012;
    display: grid;
    width: min(300px, calc(100vw - 24px));
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid rgba(176, 153, 255, 0.88);
    border-radius: 8px;
    background: rgba(18, 18, 29, 0.99);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(122, 99, 255, 0.18);
}

.minimax-mention-menu.is-hidden {
    display: none;
}

.minimax-mention-option {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 4px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    text-align: left;
}

.minimax-mention-option:hover,
.minimax-mention-option.is-active {
    background: rgba(115, 93, 225, 0.24);
}

.minimax-mention-option img,
.minimax-mention-option video,
.minimax-mention-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 5px;
    object-fit: cover;
    background: #090a11;
    color: #c8c0ff;
}

.minimax-mention-option strong,
.minimax-mention-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.minimax-mention-option strong {
    font-size: 12px;
}

.minimax-mention-option small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.minimax-lora-grid {
    margin-top: 0;
}

.minimax-media-add small {
    color: var(--muted);
    font-size: 10px;
}

.minimax-audio-preview,
.picker-audio-tile {
    display: grid;
    place-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: 92px;
    background: rgba(13, 14, 23, 0.96);
    color: #bdb5ff;
    text-align: center;
}

button.minimax-audio-preview,
button.shot-reference-audio {
    padding: 0;
    border: 0;
    cursor: pointer;
}

button.minimax-audio-preview:hover,
button.minimax-audio-preview.is-playing,
button.shot-reference-audio:hover,
button.shot-reference-audio.is-playing {
    background: rgba(54, 48, 92, 0.96);
    color: #fff;
}

.minimax-audio-preview span,
.picker-audio-tile span {
    font-size: 32px;
}

.minimax-audio-preview small,
.picker-audio-tile small {
    color: var(--muted);
    font-size: 11px;
}

.picker-audio-tile .picker-audio-name {
    display: block;
    width: 100%;
    padding: 0 10px 10px;
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-selection-mark {
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(10, 11, 18, 0.78);
    color: transparent;
    font-size: 12px;
}

.picker-card.is-active .picker-selection-mark {
    border-color: #8d7bff;
    background: #7563ff;
    color: #fff;
}

.video-picker-actions,
.image-picker-actions {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin: 0;
    border-top: 1px solid rgba(151, 157, 210, 0.13);
}

.video-picker-actions > span,
.image-picker-actions > span {
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 800;
}

.video-picker-actions .primary-btn,
.image-picker-actions .primary-btn {
    min-width: 124px;
    height: 36px;
}

@media (max-width: 760px) {
    .video-model-family-tabs {
        width: min(100% - 40px, 360px);
        margin-top: 14px;
    }

    .minimax-media-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .video-form-grid-tight.minimax-settings-grid {
        grid-template-columns: minmax(0, 1fr) 96px;
    }

    .minimax-resolution-field {
        width: 100%;
    }

    .minimax-main-model-field {
        grid-column: 1 / -1;
    }

    .video-form-grid-tight.minimax-sampling-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .minimax-clip-field {
        grid-column: 1 / -1;
    }
}

.video-control-col {
    min-height: 0;
    min-width: 0;
}

.video-preview-col {
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.video-scroll {
    display: grid;
    gap: 18px;
    max-height: none;
    padding-right: 0;
    overflow: visible;
}

.video-scroll h3,
.video-head h2 {
    margin: 0 0 var(--space-title-content);
    color: var(--ink);
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--leading-title);
}

.video-upload {
    min-height: 160px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 var(--space-title-content);
}

.section-title-row h3 {
    margin: 0;
}

.advanced-model-link {
    border: 0;
    background: transparent;
    color: #9f93ff;
    font-size: var(--text-sm);
    font-weight: 800;
    cursor: pointer;
}

.advanced-model-link.is-custom {
    color: #8f323b;
}

.video-advanced-model-row {
    margin: 2px 0 10px;
}

.advanced-model-popover {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 5, 9, 0.64);
    backdrop-filter: blur(5px);
}

.advanced-model-popover.is-hidden {
    display: none !important;
}

.advanced-model-panel {
    width: min(92vw, 520px);
    display: grid;
    gap: 16px;
    padding: 20px;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 10px;
    background: rgba(20, 21, 32, 0.98);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.advanced-model-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.advanced-model-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: var(--text-lg);
}

.advanced-model-head p,
.advanced-model-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.advanced-model-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 800;
}

.advanced-model-field select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13, 14, 22, 0.92);
    color: var(--ink);
    padding: 0 12px;
}

.advanced-model-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.video-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.video-form-grid-tight {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.video-form-grid.compact {
    align-items: end;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.video-field-wide {
    grid-column: 1 / -1;
}

.video-form-grid label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

.video-form-grid input,
.video-form-grid select {
    width: 100%;
    height: 44px;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    padding: 0 14px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
}

.video-prompt-box textarea {
    min-height: 140px;
}

#imageReferenceSection .reference-picks,
#imageModelSection .size-row,
#videoGlobalPromptGroup .prompt-box {
    margin-bottom: 0;
}

.control-col > .size-row,
.control-col > .prompt-box,
.music-controls > .text-card,
.music-controls > .music-prompt,
.music-controls > .upload-stack,
.music-controls > .emotion-grid,
.video-scroll > [data-video-panel] > .upload-stack,
.video-scroll > [data-video-panel] > .video-form-grid,
.video-scroll > [data-video-panel] > .multi-audio-grid,
.video-scroll > [data-video-panel] > .reference-picks,
.video-scroll > [data-video-panel] > #videoGlobalPromptGroup,
.video-scroll > [data-video-panel] > .prompt-box {
    margin-bottom: var(--space-section-block);
}

.control-col > :last-child,
.music-controls > :last-child,
.video-scroll > [data-video-panel] > :last-child {
    margin-bottom: 0;
}

.video-head {
    align-items: flex-start;
    margin-bottom: 18px;
}

.video-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.director-workbench {
    display: grid;
    gap: 12px;
}

.director-settings {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.director-settings label,
.director-global-prompt {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 800;
}

.director-settings input,
.director-settings select,
.director-global-prompt textarea,
.director-segment-prompt,
.director-strength input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13, 14, 22, 0.86);
    color: var(--ink);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.director-settings input,
.director-settings select,
.director-strength input {
    height: 38px;
    padding: 0 10px;
}

.director-global-prompt textarea {
    min-height: 58px;
    resize: vertical;
    padding: 10px;
    line-height: 1.5;
}

.director-global-prompt {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(18, 19, 29, 0.52);
}

.director-global-prompt summary {
    cursor: pointer;
    color: var(--ink);
    font-size: var(--text-sm);
}

.director-segment-prompt {
    min-height: 82px;
    resize: vertical;
    padding: 12px;
    line-height: 1.5;
}

.director-settings input:focus,
.director-settings select:focus,
.director-global-prompt textarea:focus,
.director-segment-prompt:focus,
.director-strength input:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 4px var(--brand-soft);
    background: rgba(17, 18, 29, 0.96);
}

.director-panel {
    display: grid;
    gap: 10px;
}

.director-toolbar,
.director-playbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(18, 19, 29, 0.76);
}

.director-toolbar {
    flex-wrap: wrap;
}

.director-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.director-btn,
.director-icon-btn {
    min-height: 40px;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 8px;
    background: rgba(34, 35, 53, 0.92);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, filter 0.14s ease;
}

.director-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
}

.director-btn svg {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.director-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    padding: 0;
}

.director-btn:hover,
.director-icon-btn:hover {
    border-color: var(--line-strong);
    background: var(--brand-soft);
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.director-btn-danger {
    color: #ffd5df;
    border-color: rgba(255, 109, 149, 0.28);
}

.director-btn-danger:hover {
    background: rgba(255, 109, 149, 0.14);
}

.director-timeline-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 9, 15, 0.9);
}

.director-timeline-canvas {
    display: block;
    width: 100%;
    min-width: 600px;
    cursor: pointer;
}

.director-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.director-icon-btn[aria-pressed="true"] {
    border-color: var(--line-strong);
    background: var(--brand-soft);
    color: #ffffff;
}

.director-audio-toggle {
    color: rgba(170, 174, 205, 0.62);
}

.director-audio-toggle svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.director-audio-toggle[aria-pressed="true"] {
    color: #ffffff;
}

.director-segment-editor {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(18, 19, 29, 0.74);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.director-segment-editor.is-active {
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
    background: rgba(28, 29, 40, 0.94);
}

.director-segment-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: 800;
}

.director-segment-title {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.director-segment-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border: 1px solid #ffffff;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.director-prompt-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.director-prompt-tools .director-prompt-config-btn,
.director-prompt-optimize {
    height: 32px;
    padding: 0 12px;
    font-size: var(--text-xs);
}

.director-prompt-tools .common-prompt-trigger {
    height: auto;
    padding: 0 2px;
}

.director-prompt-tools .director-prompt-config-btn {
    min-width: 118px;
}

.director-prompt-tools .prompt-output-language-select {
    height: 32px;
    line-height: 32px;
}

.director-prompt-optimize.is-generating {
    opacity: 0.82;
}

.director-insert-menu {
    position: fixed;
    z-index: 12000;
    display: grid;
    gap: 6px;
    min-width: 128px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(20, 21, 32, 0.98);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
}

.director-insert-menu button {
    min-height: 34px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 7px;
    background: rgba(34, 35, 53, 0.92);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
    text-align: left;
    padding: 0 10px;
}

.director-insert-menu button:hover {
    border-color: var(--line-strong);
    background: var(--brand-soft);
}

.director-time-readout {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: nowrap;
}

.director-time-readout strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1;
}

.director-time-readout span {
    font-size: 12px;
    line-height: 1;
}

.director-seek {
    flex: 1 1 auto;
    min-width: 120px;
    accent-color: var(--danger);
}

.director-strength {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    font-size: var(--text-xs);
    font-weight: 800;
    white-space: nowrap;
}

.director-strength input {
    width: 64px;
    text-align: center;
}

@media (max-width: 1100px) {
    .director-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .director-toolbar,
    .director-playbar {
        align-items: stretch;
        flex-direction: column;
    }

    .director-time-readout {
        width: 100%;
    }
}

.video-result-card,
.video-progress-card {
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 10px;
    background: rgba(24, 25, 38, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.video-result-card {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    box-sizing: border-box;
}

.director-result-note {
    margin: 8px 2px 0;
    color: rgba(184, 179, 218, 0.72);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.video-preview-col .image-preview {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    max-height: min(46vh, 420px);
    aspect-ratio: 16 / 9;
    box-sizing: border-box;
}

.video-result-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #090a10;
    border: 1px solid rgba(151, 143, 255, 0.16);
    display: grid;
    place-items: center;
}

.video-result-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: saturate(0.92) contrast(1.04) brightness(0.88);
}

.video-result-stage img.is-hidden {
    display: none;
}

.video-stage-play {
    position: absolute;
    inset: 0;
    border: 0;
    background: transparent;
}

.video-stage-play::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 74px;
    height: 74px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(8, 10, 18, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.72);
}

.video-stage-play::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-35%, -50%);
    border-left: 20px solid #fff;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
}

.video-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.video-result-meta span {
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.12);
    color: #c7c0ff;
    font-size: var(--text-xs);
    font-weight: 800;
    line-height: 30px;
}

.video-progress-card {
    margin-top: 18px;
    padding: 18px;
}

.video-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.video-progress-head strong,
.video-progress-head span {
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 800;
}

.video-progress-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(151, 143, 255, 0.16);
    overflow: hidden;
}

.video-progress-track span {
    display: block;
    width: 84%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6f5cff, #9f93ff);
}

.video-progress-card p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.music-empty {
    display: grid;
    place-items: center;
    gap: 18px;
    min-height: 0;
    padding: 120px 48px 48px;
    text-align: center;
    overflow: auto;
}

.music-mode-tabs {
    z-index: 3;
    min-width: 0;
    justify-content: center;
}

.music-mode-tabs button {
    flex: 1 1 0;
    min-width: 0;
}

.music-panel {
    min-height: 0;
    overflow: hidden;
}

.music-prompt-lg textarea {
    height: 160px;
}

.music-prompt-xl textarea {
    height: 200px;
}

.music-empty h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 800;
    line-height: var(--leading-title);
}

.music-empty p {
    max-width: 420px;
    margin: 0;
    color: var(--muted);
    font-size: var(--text-body);
}

.music-empty-mark {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border: 1px solid rgba(151, 143, 255, 0.2);
    border-radius: 50%;
    background: rgba(124, 108, 255, 0.12);
    color: #c7c0ff;
    font-size: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}

.music-grid {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    align-items: start;
    gap: 64px;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    padding: 32px 46px 22px;
    overflow: auto;
}

.music-controls,
.music-preview {
    min-height: 0;
    min-width: 0;
}

.music-controls {
    overflow: visible;
}

.music-preview {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.music-preview .audio-list {
    min-height: 0;
    overflow: auto;
}

.music-controls h2,
.music-preview h2 {
    margin: 0 0 14px;
    color: #171a31;
    font-size: var(--text-md);
    font-weight: 800;
    line-height: var(--leading-title);
}

.music-upload {
    display: grid;
    place-items: center;
    width: 260px;
    height: 106px;
    margin-bottom: 0;
    border: 1.5px dashed rgba(151, 143, 255, 0.28);
    border-radius: 8px;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.music-upload.is-dragover,
.music-upload:hover {
    border-color: rgba(130, 116, 255, 0.72);
    background: rgba(34, 36, 54, 0.98);
    box-shadow: 0 18px 42px rgba(58, 46, 132, 0.28);
}

.music-upload.has-selection {
    justify-items: stretch;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px;
    border-style: solid;
    position: relative;
}

.music-upload span {
    color: var(--brand);
    font-size: 48px;
    font-weight: 200;
    line-height: 0.82;
}

.music-upload strong {
    margin-top: 8px;
    font-size: var(--text-sm);
    font-weight: 800;
}

.music-upload small {
    margin-top: 8px;
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1.45;
    text-align: center;
}

.reference-wave {
    display: grid;
    place-items: center;
    width: 100%;
    height: 52px;
    border-radius: 6px;
    background: rgba(5, 6, 10, 0.42);
}

.reference-wave svg {
    width: 100%;
    max-width: 152px;
    height: auto;
}

.music-upload.has-selection strong,
.music-upload.has-selection small {
    text-align: center;
}

.voice-reference-player {
    display: grid;
    gap: 10px;
    width: 100%;
    align-items: stretch;
    align-self: end;
    margin-top: auto;
}

.voice-reference-player audio {
    width: 100%;
    height: 40px;
    filter: hue-rotate(8deg) saturate(0.88) brightness(0.96);
}

.upload-stack-voice .upload-library-btn {
    width: max-content;
}

.multi-audio-grid .upload-stack-voice .music-upload {
    width: 100%;
    min-width: 0;
}

.multi-audio-grid .upload-stack-voice .upload-library-btn {
    width: 100%;
}

.upload-file-name {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 132px;
    height: 28px;
    margin-top: 8px;
    border-radius: 6px;
    background: #f0effb;
    color: var(--brand);
    font-size: var(--text-xs);
    font-weight: 800;
    line-height: 28px;
    text-align: center;
}

.emotion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
    row-gap: 14px;
    margin-bottom: 26px;
}

.emotion-grid label {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: #252a42;
    font-size: var(--text-sm);
    font-weight: 800;
}

.picker-audio-player,
.audio-player-card {
    display: grid;
    align-items: center;
    width: 100%;
}

.picker-audio-player audio,
.audio-player-card audio {
    width: 100%;
    height: 40px;
    filter: hue-rotate(8deg) saturate(0.9) brightness(0.94);
}

.resource-audio-tile {
    padding: 10px 10px 12px;
}

.resource-audio-tile .asset-media.audio {
    height: auto;
    min-height: 48px;
    padding: 6px;
    border-radius: 10px;
}

.resource-audio-tile .asset-media.audio:has(video) {
    height: 78px;
    min-height: 78px;
    padding: 0;
    overflow: hidden;
}

.asset-card .asset-media.audio {
    position: relative;
    display: grid;
    align-items: center;
    height: auto;
    min-height: 76px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(24, 25, 38, 0.92);
}

.asset-card .asset-media.audio:has(video) {
    height: 236px;
    min-height: 236px;
    padding: 0;
    overflow: hidden;
}

.resource-video-tile,
.asset-card-video,
.history-asset-card {
    position: relative;
}

.asset-video-card {
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(8, 10, 18, 0.82);
}

.asset-video-card-small {
    width: 100%;
    height: 78px;
    min-height: 78px;
    padding: 0;
    border-radius: 7px;
}

.asset-video-card-large {
    width: 100%;
    height: 236px;
    min-height: 236px;
    padding: 0;
    border-radius: 12px;
}

.resource-video-tile .asset-video-card video,
.asset-card-video .asset-video-card video,
.history-asset-card .asset-video-card video {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    margin: auto;
    background: rgba(8, 10, 18, 0.82);
}

.picker-card-audio {
    display: grid;
    gap: 12px;
    align-items: stretch;
}

.voice-library-picker .picker-card-audio {
    gap: 8px;
    width: 100%;
    padding: 12px;
}

.voice-library-picker .picker-audio-player {
    padding: 0;
}

.voice-library-picker .picker-grid {
    grid-template-columns: minmax(0, 1fr);
}

.picker-audio-toggle {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(151, 143, 255, 0.18);
    border-radius: 10px;
    background: rgba(17, 19, 30, 0.94);
    color: #eef2ff;
    font-size: 13px;
    font-weight: 800;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.picker-audio-toggle:hover {
    border-color: rgba(151, 143, 255, 0.36);
    background: rgba(23, 26, 40, 0.98);
}

.picker-audio-toggle.is-playing {
    border-color: rgba(124, 108, 255, 0.42);
    background: linear-gradient(135deg, #6f5cff, #8d7bff);
}

.voice-library-picker .picker-card strong {
    padding: 0;
    font-size: 12px;
}

.picker-select-btn {
    justify-self: start;
    min-width: 76px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.16);
    color: #d6d0ff;
    font-size: 12px;
    font-weight: 800;
    padding: 0 14px;
}

.emotion-grid input[type="range"] {
    width: 100%;
    accent-color: var(--brand);
}

.emotion-grid input[type="range"] {
    height: 16px;
    appearance: none;
    background: transparent;
}

.emotion-grid input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(151, 157, 210, 0.28);
}

.emotion-grid input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5px;
    appearance: none;
    border-radius: 50%;
    background: #8d7bff;
    box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.16);
}

.music-prompt {
    display: block;
}

.music-prompt textarea {
    width: 100%;
    height: 122px;
    min-height: 122px;
    resize: none;
    border: 0;
    border-radius: 8px;
    background: #f7f7fd;
    padding: 18px 22px;
    color: #4d526d;
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

.music-preview-list {
    display: grid;
    gap: 22px;
}

.voice-clone-preview-list {
    display: grid;
    gap: 22px;
}

.music-preview-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 58px 34px;
    align-items: center;
    gap: 20px;
    min-height: 82px;
    padding: 0 18px;
    border-radius: 8px;
    background: #fbfbff;
}

.music-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: #d9d5ea;
}

.music-bar span {
    position: absolute;
    left: 0;
    top: 50%;
    height: 3px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: #9f96ff;
}

.music-bar i {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(90, 75, 243, 0.18);
}

.music-preview-item time,
.music-preview-item .dots {
    color: #3c415b;
    font-size: var(--text-sm);
    font-weight: 800;
}

.picker-card-audio {
    padding: 14px 12px 12px;
}

.picker-audio-visual {
    display: grid;
    place-items: center;
    width: 100%;
    height: 88px;
    border-radius: 8px;
    background: rgba(9, 10, 16, 0.5);
}

.picker-audio-visual svg {
    width: 100%;
    max-width: 116px;
    height: auto;
}

.toast {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 2600;
    transform: translate(-50%, -50%);
    width: auto;
    min-width: 0;
    max-width: min(420px, calc(100vw - 40px));
    padding: 11px 18px;
    border-radius: 999px;
    text-align: center;
    border: 1px solid rgba(151, 157, 210, 0.16);
    background: rgba(18, 19, 29, 0.96);
    color: #edf1ff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.02em;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(12px);
    pointer-events: none;
}

.global-notice {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 120;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 420px;
    max-width: min(92vw, 680px);
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid rgba(171, 161, 255, 0.3);
    background:
        radial-gradient(circle at 50% 50%, rgba(112, 92, 255, 0.22), rgba(112, 92, 255, 0) 48%),
        rgba(14, 16, 25, 0.98);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(141, 123, 255, 0.08) inset;
    animation: notice-slide-down 220ms ease;
}

.global-notice-copy {
    display: grid;
    gap: 2px;
    flex: 1;
}

.global-notice-copy strong {
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-shadow: 0 0 14px rgba(159, 147, 255, 0.24);
}

.global-notice-copy span {
    color: rgba(238, 234, 255, 0.88);
    font-size: 12px;
    font-weight: 600;
}

.global-notice-link {
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(111, 92, 255, 0.28);
    color: #f5f1ff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(111, 92, 255, 0.18);
}

.global-notice-link:hover {
    background: rgba(111, 92, 255, 0.28);
    color: #fff;
}

@keyframes notice-slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 1120px) {
    .topbar {
        grid-template-columns: max-content minmax(0, 1fr);
        padding: 0 12px;
    }

    .main-nav {
        justify-content: flex-start;
        overflow: visible;
        gap: 3px;
        scrollbar-width: none;
    }

    .topbar-actions {
        margin-left: 4px;
        flex: 0 0 auto;
        max-width: 43%;
        gap: 3px;
    }

    .main-nav > .nav-item {
        min-width: 0;
        flex: 0 0 auto;
        padding-inline: 6px;
        font-size: 12px;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .nav-item-utility {
        padding-inline: 8px;
    }

    .topbar-actions .nav-item-utility {
        max-width: 6ch;
    }

    .nav-task-trigger {
        min-width: 108px;
        max-width: 138px;
        padding-inline: 8px 19px;
    }

    .nav-task-status .library-task-summary {
        font-size: 12px;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .mine-host-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mine-ai-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal-grid,
    .voice-grid,
    .video-modal-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .video-control-col,
    .video-preview-col {
        min-height: auto;
        max-width: none;
    }

    .mine-toolbar {
        grid-template-columns: 1fr;
    }

    .mine-actions {
        justify-content: flex-start;
    }

    .mine-model-select-row {
        grid-template-columns: minmax(0, 1fr) minmax(126px, auto);
    }

    .mine-host-grid {
        grid-template-columns: 1fr;
    }

    .mine-ai-grid {
        grid-template-columns: 1fr;
    }

    .mine-ai-title-row {
        flex-wrap: wrap;
    }

    .mine-ai-host-badge {
        max-width: 100%;
    }

    .mine-ai-gpu-row {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 900px) and (min-width: 721px) {
    .topbar {
        grid-template-columns: max-content minmax(0, 1fr);
        padding-inline: 8px;
    }

    .brand-logo {
        max-width: 100%;
        height: 34px;
    }

    .main-nav {
        gap: 0;
    }

    .main-nav > .nav-item {
        max-width: none;
        padding-inline: 4px;
        font-size: 11px;
        white-space: nowrap;
    }

    .topbar-actions {
        margin-left: 2px;
        max-width: 38%;
    }

    .topbar-actions .nav-item-utility {
        max-width: 4ch;
        padding-inline: 4px;
    }

    .nav-task-trigger {
        min-width: 70px;
        max-width: 90px;
        padding-inline: 5px 15px;
    }

    .nav-task-status .library-task-summary {
        font-size: 10px;
    }
}

@media (max-width: 760px) {
    .shot-row {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .flow-arrow,
    .delete-shot {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar {
        height: auto;
        grid-template-columns: 1fr auto;
        gap: 10px;
        padding: 14px;
    }

    .main-nav {
        grid-column: 1 / -1;
        order: 3;
    }

    .topbar-actions {
        margin-left: auto;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .nav-task-status {
        order: 2;
    }

    .nav-task-trigger {
        min-width: min(180px, calc(100vw - 48px));
        max-width: min(220px, calc(100vw - 48px));
    }

    .brand-name {
        font-size: 18px;
    }

    .app-shell {
        padding: 22px 14px 54px;
    }

    .project-home h1 {
        margin: 20px 0 40px;
        font-size: 22px;
    }

    .resource-band,
    .story-band,
    .mine-panel,
    .mine-header-band {
        padding: 20px 16px 22px;
    }

    .mine-header-band {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-header-version {
        width: 100%;
        justify-content: space-between;
    }

    .settings-category-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-category-tab {
        justify-content: flex-start;
        min-height: 52px;
        padding: 9px 11px;
    }

    .resource-band h2,
    .story-band h2 {
        font-size: 17px;
    }

    .shot-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .shot-index-stack .shot-index {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .shot-card h3 {
        text-align: left;
    }

    .shot-card-title-row {
        justify-content: space-between;
    }

    .shot-card-title-row .shot-duration-editor {
        position: static;
    }

    .shot-content {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .shot-img img,
    .shot-video img {
        height: 100%;
    }

    .library-tabs {
        display: flex;
        overflow-x: auto;
        padding-bottom: 0;
    }

    .tab {
        min-width: 112px;
    }

    .fold {
        min-width: 80px;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .name-modal {
        padding: 78px 24px 38px;
    }

    .modal-actions,
    .reference-picks,
    .size-row,
    .video-form-grid,
    .video-form-grid-tight {
        grid-template-columns: 1fr;
    }

    .video-field-wide {
        grid-column: auto;
    }

    .generate-modal,
    .voice-modal,
    .video-modal {
        width: 100%;
        max-height: 92vh;
    }

    .modal-library-picker {
        top: 72px;
        right: 14px;
        bottom: 92px;
        width: calc(100% - 28px);
    }

    .modal-grid,
    .voice-grid,
    .video-modal-grid {
        padding:24px;
    }

    .camera-rig-panel {
        width: 100%;
        padding: 10px;
    }

    .camera-rig-frame {
        min-height: min(78vw, 420px);
    }

    .video-modal-grid {
        overflow: auto;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column;
        height: auto;
        padding: 14px;
    }

    .modal-footer > div {
        width: 100%;
    }

    .primary-btn,
    .secondary-btn {
        min-width: 0;
        flex: 1;
    }

    body.mobile-client .topbar {
        position: sticky;
        z-index: 270;
        gap: 12px;
        padding: 12px 12px 10px;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        align-items: center;
    }

    body.mobile-client .brand {
        grid-column: 2;
        justify-self: center;
        position: relative;
        z-index: 271;
    }

    body.mobile-client .brand-logo {
        height: 34px;
    }

    body.mobile-client .mobile-modal-back {
        display: none;
        grid-column: 1;
        justify-self: start;
        position: relative;
        z-index: 271;
    }

    body.mobile-client .mobile-nav-toggle {
        display: inline-flex;
        grid-column: 3;
        justify-self: end;
        position: relative;
        z-index: 271;
    }

    body.mobile-client.mobile-modal-open .mobile-modal-back {
        display: inline-flex;
    }

    body.mobile-client .main-nav {
        position: fixed;
        top: 64px;
        right: 12px;
        left: auto;
        margin-left: 0;
        width: min(360px, calc(100vw - 24px));
        z-index: 260;
        display: none;
        grid-template-columns: 1fr;
        align-content: start;
        gap: 10px;
        padding: 14px;
        border-radius: 18px;
        background: rgba(13, 15, 24, 0.96);
        border: 1px solid rgba(151, 143, 255, 0.16);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.34);
        backdrop-filter: blur(16px);
        max-height: calc(100dvh - 88px);
        overflow-y: auto;
        scrollbar-width: none;
    }

    body.mobile-client .main-nav::-webkit-scrollbar {
        display: none;
    }

    body.mobile-nav-open .main-nav {
        display: grid;
    }

    body.mobile-nav-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 240;
        background: rgba(4, 6, 12, 0.36);
        backdrop-filter: blur(3px);
    }

    body.mobile-client .topbar-actions {
        display: grid;
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: nowrap;
    }

    body.mobile-client .nav-item {
        width: 100%;
        min-height: 42px;
        justify-content: center;
        padding: 0 14px;
        font-size: 13px;
        text-align: center;
    }

    body.mobile-client .topbar-actions .nav-refresh-link,
    body.mobile-client .topbar-actions .nav-exit-link,
    body.mobile-client .topbar-actions .auth-status,
    body.mobile-client .topbar-actions .nav-task-stack,
    body.mobile-client .topbar-actions .nav-task-status,
    body.mobile-client .topbar-actions .nav-item {
        width: 310px;
    }

    body.mobile-client .topbar-actions .nav-refresh-link,
    body.mobile-client .topbar-actions .nav-exit-link,
    body.mobile-client .topbar-actions .library-task-trigger,
    body.mobile-client .topbar-actions .auth-status-avatar {
        justify-content: center;
        text-align: center;
    }

    body.mobile-client .topbar-actions .auth-status {
        display: grid;
        place-items: center;
    }

    body.mobile-client .resource-row,
    body.mobile-client .project-grid,
    body.mobile-client .library-grid,
    body.mobile-client .mine-host-grid {
        overflow-x: auto;
    }

    body.mobile-client .story-top-grid,
    body.mobile-client .mine-ai-grid {
        grid-template-columns: 1fr;
    }

    body.mobile-client .story-top-grid {
        width: 100%;
        margin: 0 0 16px;
        gap: 14px;
    }

    body.mobile-client .story-band {
        padding: 16px 12px 18px;
        overflow-x: hidden;
    }

    body.mobile-client .story-band h2 {
        margin-bottom: 12px;
    }

    body.mobile-client .basic-script-head h2 {
        margin-bottom: 0;
    }

    body.mobile-client .storyboard-composer {
        padding: 14px 14px 16px;
    }

    body.mobile-client .storyboard-composer-head {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 6px;
    }

    body.mobile-client .storyboard-composer-head > div:first-child {
        display: flex;
        gap: 4px;
    }

    body.mobile-client .storyboard-generation-counts .storyboard-count-inline {
        gap: 3px;
        font-size: 11px;
    }

    body.mobile-client .storyboard-generation-counts .storyboard-count-inline span {
        width: auto;
    }

    body.mobile-client .storyboard-generation-counts .storyboard-count-inline input {
        width: 42px;
        padding-inline: 6px;
    }

    body.mobile-client .storyboard-composer-head p {
        display: none;
    }

    body.mobile-client .storyboard-head-meta {

        display: block;
    }

    body.mobile-client .storyboard-script-box textarea {
        min-height: 120px;
        padding: 12px 14px;
    }

    body.mobile-client .storyboard-count-inline {
        justify-self: start;
        padding-top: 0;
    }

    body.mobile-client .storyboard-actions {
        gap: 10px;
    }

    body.mobile-client .library-tabs,
    body.mobile-client .library-tabs.compact,
    body.mobile-client .modal-tabs,
    body.mobile-client .modal-tabs-unified,
    body.mobile-client .video-flow-tabs,
    body.mobile-client .picker-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    body.mobile-client .library-tabs::-webkit-scrollbar,
    body.mobile-client .library-tabs.compact::-webkit-scrollbar,
    body.mobile-client .modal-tabs::-webkit-scrollbar,
    body.mobile-client .modal-tabs-unified::-webkit-scrollbar,
    body.mobile-client .video-flow-tabs::-webkit-scrollbar,
    body.mobile-client .picker-tabs::-webkit-scrollbar {
        display: none;
    }

    body.mobile-client .library-tabs .tab,
    body.mobile-client .library-tabs.compact .tab,
    body.mobile-client .modal-tabs button,
    body.mobile-client .modal-tabs-unified button,
    body.mobile-client .video-flow-tabs button,
    body.mobile-client .picker-tabs button {
        flex: 0 0 auto;
        min-width: max-content;
        white-space: nowrap;
    }

    body.mobile-client .audio-mode-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        overflow: hidden;
    }

    body.mobile-client .audio-mode-tabs button {
        min-width: 0;
        width: 100%;
        white-space: nowrap;
    }

    body.mobile-client .image-modal-top-tabs,
    body.mobile-client .video-head,
    body.mobile-client .voice-head,
    body.mobile-client .music-head {
        display: flex;
        justify-content: flex-start;
        overflow-x: auto;
        padding-inline: 14px;
        scrollbar-width: none;
    }

    body.mobile-client .image-modal-top-tabs::-webkit-scrollbar,
    body.mobile-client .video-head::-webkit-scrollbar,
    body.mobile-client .voice-head::-webkit-scrollbar,
    body.mobile-client .music-head::-webkit-scrollbar {
        display: none;
    }

    body.mobile-client .image-modal-top-tabs .modal-tabs-centered-wide,
    body.mobile-client .video-head .video-flow-tabs,
    body.mobile-client .voice-head .modal-tabs-unified,
    body.mobile-client .music-head .modal-tabs-unified {
        min-width: max-content;
        justify-content: flex-start;
    }

    body.mobile-client .mine-toolbar-add,
    body.mobile-client .mine-mobile-row,
    body.mobile-client .storyboard-action-buttons,
    body.mobile-client .shot-split-actions,
    body.mobile-client .storyboard-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    body.mobile-client .mine-mobile-copy,
    body.mobile-client .storyboard-action-buttons .primary-btn,
    body.mobile-client .storyboard-action-buttons .ghost-btn,
    body.mobile-client .shot-split-actions .shot-action {
        width: 100%;
    }

    body.mobile-client .lightbox-modal,
    body.mobile-client .name-modal,
    body.mobile-client .storyboard-config-modal,
    body.mobile-client .upgrade-modal {
        width: 100%;
        max-width: 100%;
    }

    body.mobile-client .video-preview-grid,
    body.mobile-client .image-preview-grid--fixed {
        grid-template-columns: 1fr;
    }

    body.mobile-client .shot-list,
    body.mobile-client .shot-row,
    body.mobile-client .shot-card {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.mobile-client .shot-list {
        gap: 18px;
        padding-right: 0;
        margin-right: 0;
    }

    body.mobile-client .shot-row {
        padding-right: 0;
    }

    body.mobile-client .shot-drag-handle {
        display: none !important;
    }

    body.mobile-client .modal-backdrop {
        padding: 68px 0 0;
    }

    body.mobile-client .modal-close,
    body.mobile-client .picker-close {
        display: none !important;
    }

    body.mobile-client .generate-modal,
    body.mobile-client .video-modal,
    body.mobile-client .voice-modal,
    body.mobile-client .music-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: calc(100dvh - 68px);
        height: calc(100dvh - 68px);
        border-radius: 0;
        border: 0;
    }

    body.mobile-client .image-modal-top-tabs,
    body.mobile-client .video-flow-tabs,
    body.mobile-client .voice-grid .modal-tabs,
    body.mobile-client .music-grid .modal-tabs {
        margin-top: 8px;
    }

    body.mobile-client .modal-grid,
    body.mobile-client .video-modal-grid,
    body.mobile-client .voice-grid,
    body.mobile-client .music-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        height: auto;
        max-height: none;
        padding: 12px 14px calc(112px + env(safe-area-inset-bottom));
        overflow-y: auto;
        scrollbar-width: none;
    }

    body.mobile-client .modal-grid::-webkit-scrollbar,
    body.mobile-client .video-modal-grid::-webkit-scrollbar,
    body.mobile-client .voice-grid::-webkit-scrollbar,
    body.mobile-client .music-grid::-webkit-scrollbar,
    body.mobile-client .video-scroll::-webkit-scrollbar {
        display: none;
    }

    body.mobile-client .preview-col,
    body.mobile-client .video-preview-col,
    body.mobile-client .music-preview {
        order: -2;
    }

    body.mobile-client .video-modal-grid > .video-control-col,
    body.mobile-client .voice-grid > .control-col,
    body.mobile-client .music-grid > .music-controls {
        display: contents;
    }

    body.mobile-client .video-flow-tabs,
    body.mobile-client .voice-grid .modal-tabs,
    body.mobile-client .music-grid .modal-tabs {
        order: -3;
    }

    body.mobile-client .control-col,
    body.mobile-client .video-control-col,
    body.mobile-client .music-controls {
        display: flex;
        flex-direction: column;
        min-width: 0;
        width: 100%;
    }

    body.mobile-client .video-scroll {
        width: 100%;
        min-width: 0;
        gap: 14px;
    }

    body.mobile-client .size-row,
    body.mobile-client .video-form-grid,
    body.mobile-client .video-form-grid-tight,
    body.mobile-client .video-form-grid.compact {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    body.mobile-client .control-col > *,
    body.mobile-client .video-control-col > *,
    body.mobile-client .music-controls > *,
    body.mobile-client .size-row label,
    body.mobile-client .video-form-grid label,
    body.mobile-client .video-form-grid-tight label,
    body.mobile-client .mine-field,
    body.mobile-client .storyboard-count-inline {
        min-width: 0;
    }

    body.mobile-client .control-col input,
    body.mobile-client .control-col select,
    body.mobile-client .control-col textarea,
    body.mobile-client .video-control-col input,
    body.mobile-client .video-control-col select,
    body.mobile-client .video-control-col textarea,
    body.mobile-client .mine-field input,
    body.mobile-client .mine-field select,
    body.mobile-client .storyboard-count-inline input {
        width: 100%;
        min-width: 0;
    }

    body.mobile-client .assistant-frame-view,
    body.mobile-client .studio3d-frame-view,
    body.mobile-client .director-frame-view,
    body.mobile-client .infinite-canvas-frame-view {
        padding: 10px;
    }

    body.mobile-client .assistant-frame-view iframe,
    body.mobile-client .studio3d-frame-view iframe,
    body.mobile-client .director-frame-view iframe,
    body.mobile-client .infinite-canvas-frame-view iframe {
        height: calc(100vh - 92px);
        min-height: 580px;
        border-radius: 8px;
    }

    body.mobile-client.assistant-fullscreen .app-shell {
        height: calc(100vh - 60px);
        overflow: hidden;
        padding: 0;
    }

    body.mobile-client.assistant-fullscreen .assistant-frame-view,
    body.mobile-client.assistant-fullscreen .studio3d-frame-view,
    body.mobile-client.assistant-fullscreen .director-frame-view,
    body.mobile-client.assistant-fullscreen .infinite-canvas-frame-view {
        height: 100%;
        min-height: 0;
        overflow: hidden;
        padding: 0;
    }

    body.mobile-client.assistant-fullscreen .assistant-frame-view iframe,
    body.mobile-client.assistant-fullscreen .studio3d-frame-view iframe,
    body.mobile-client.assistant-fullscreen .director-frame-view iframe,
    body.mobile-client.assistant-fullscreen .infinite-canvas-frame-view iframe {
        height: 100%;
        min-height: 0;
        border: 0;
        border-radius: 0;
    }

    body.mobile-client .mine-model-select-row {
        grid-template-columns: minmax(0, 1fr) 118px;
    }

    body.mobile-client .mine-model-help-trigger {
        max-width: 118px;
        padding: 0 9px;
        font-size: 11px;
    }

    body.mobile-client .mine-model-help-trigger svg {
        width: 16px;
        height: 16px;
    }

    body.mobile-client .model-help-modal {
        width: min(100%, calc(100vw - 24px));
        max-height: calc(100vh - 44px);
        padding: 18px;
    }

    body.mobile-client .preview-col .image-preview,
    body.mobile-client .video-preview-col .image-preview,
    body.mobile-client .music-preview .audio-list {
        margin-bottom: 4px;
    }

    body.mobile-client .preview-col .image-preview,
    body.mobile-client .video-preview-col .image-preview {
        min-height: 220px;
    }

    body.mobile-client .preview-tools {
        flex-wrap: wrap;
        gap: 10px;
    }

    body.mobile-client .preview-tools > button {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
    }

    body.mobile-client .modal-footer {
        position: sticky;
        bottom: 50px;
        z-index: 2;
        background: rgba(14, 16, 24, 0.96);
        backdrop-filter: blur(14px);
        padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
        min-height: 92px;
    }

    body.mobile-client .modal-footer > div {
        width: 100%;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 10px;
    }

    body.mobile-client .modal-footer > div > button,
    body.mobile-client .modal-footer > button {
        min-height: 42px;
        padding: 8px 24px;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .pose-embed-modal {
        order: -3;
        margin: 0;
        display: block;
        min-height: 58dvh;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .pose-embed-frame {
        min-height: 66dvh;
        height: 66dvh;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .preview-col {
        order: 2;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .control-col {
        order: 3;
    }

    body.mobile-client #imageModal.image-modal-camera-entry .camera-rig-section {
        order: -3;
        margin-top: 0;
        gap: 12px;
    }

    body.mobile-client #imageModal.image-modal-camera-entry .camera-rig-panel {
        width: 100%;
        margin: 0;
        padding: 0;
        border-radius: 18px;
        overflow: hidden;
    }

    body.mobile-client #imageModal.image-modal-camera-entry .camera-rig-frame {
        min-height: 56dvh;
        height: 56dvh;
        aspect-ratio: auto;
    }

    body.mobile-client .modal-library-picker {
        inset: 0;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }
}

@media (max-width: 720px) {
    body.mobile-client .modal-backdrop {
        align-items: stretch;
        justify-content: stretch;
        padding: 68px 0 0;
        overflow: hidden;
    }

    body.mobile-client .generate-modal,
    body.mobile-client .video-modal,
    body.mobile-client .voice-modal,
    body.mobile-client .music-modal {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        height: calc(100dvh - 68px);
        max-height: calc(100dvh - 68px);
        min-height: 0;
        overflow: hidden;
    }

    body.mobile-client #imageModal .generate-modal,
    body.mobile-client #videoModal .video-modal,
    body.mobile-client #voiceModal .voice-modal,
    body.mobile-client #musicModal .music-modal {
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    body.mobile-client #videoModal .video-modal,
    body.mobile-client #voiceModal .voice-modal,
    body.mobile-client #musicModal .music-modal {
        grid-template-rows: minmax(0, 1fr) auto;
    }

    body.mobile-client .video-modal {
        grid-template-rows: minmax(0, 1fr) auto;
    }

    body.mobile-client .image-modal-top-tabs {
        position: relative;
        z-index: 4;
        flex: 0 0 auto;
        margin: 0;
        padding: 10px 14px 8px;
        background: rgba(14, 16, 24, 0.98);
        border-bottom: 1px solid rgba(151, 143, 255, 0.12);
    }

    body.mobile-client .modal-tabs-centered-wide {
        flex-wrap: nowrap;
        max-width: none;
    }

    body.mobile-client .modal-grid,
    body.mobile-client .video-modal-grid,
    body.mobile-client .voice-grid,
    body.mobile-client .music-grid {
        min-height: 0;
        height: 100%;
        max-height: none;
        padding: 12px 14px calc(128px + env(safe-area-inset-bottom));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.mobile-client .video-modal-grid {
        padding-top: 0;
    }

    body.mobile-client .video-control-col {
        display: flex;
        flex-direction: column;
        order: -3;
        min-height: 0;
        width: 100%;
    }

    body.mobile-client .video-modal-grid > .video-control-col {
        display: flex;
    }

    body.mobile-client .video-control-col > .video-flow-tabs {
        position: sticky;
        top: 0;
        z-index: 5;
        order: -4;
        width: calc(100% + 28px);
        margin: 0 -14px 12px;
        padding: 10px 14px 8px;
        min-height: 56px;
        align-items: center;
        border-radius: 0;
        background: rgba(18, 19, 29, 0.98);
        border-bottom: 1px solid rgba(151, 143, 255, 0.12);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    }

    body.mobile-client .video-flow-tabs button {
        height: 38px;
        min-width: max-content;
        padding: 0 14px;
    }

    body.mobile-client .video-preview-col {
        order: -2;
    }

    body.mobile-client .video-head {
        display: grid;
        gap: 10px;
        padding: 0;
        overflow: visible;
    }

    body.mobile-client .video-head .preview-head-side {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    body.mobile-client .modal-footer,
    body.mobile-client .video-modal > .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 8;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        min-height: 0;
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
        border-radius: 0;
        border-top: 1px solid rgba(151, 143, 255, 0.14);
        background: rgba(12, 14, 22, 0.98);
        box-shadow: 0 -18px 36px rgba(0, 0, 0, 0.32);
        backdrop-filter: blur(14px);
    }

    body.mobile-client .modal-footer .host-pill {
        width: 100%;
        justify-content: flex-start;
        min-width: 0;
    }

    body.mobile-client .modal-footer .host-pill strong {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.mobile-client .modal-footer > div {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
    }

    body.mobile-client .modal-footer > div > button,
    body.mobile-client .modal-footer > button {
        width: 100%;
        min-width: 0;
        min-height: 48px;
        padding: 8px 10px;
        white-space: normal;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    body.mobile-client #imageModal .modal-footer > div > button.is-hidden,
    body.mobile-client #videoModal .modal-footer > div > button.is-hidden {
        display: none !important;
    }

    body.mobile-client #imageModal .modal-footer > div > .primary-btn:last-child,
    body.mobile-client #videoModal .modal-footer > div > .primary-btn:last-child {
        grid-column: 2;
    }

    body.mobile-client #videoModal .preview-download-icon-btn {
        min-height: 48px;
        aspect-ratio: auto;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .modal-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding-top: 10px;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .pose-embed-modal {
        order: -3;
        min-height: min(54dvh, 520px);
        max-height: min(54dvh, 520px);
        overflow: hidden;
    }

    body.mobile-client #imageModal.image-modal-pose-entry .pose-embed-frame {
        min-height: min(54dvh, 520px);
        height: min(54dvh, 520px);
    }

    body.mobile-client #imageModal.image-modal-pose-entry .preview-col {
        min-height: auto;
    }

    body.mobile-client .reference-picks,
    body.mobile-client #imageReferenceSection .reference-picks,
    body.mobile-client .video-reference-picks,
    body.mobile-client .multi-ref-video-picks {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Cinematic dark theme */
body {
    background:
        radial-gradient(circle at 18% -12%, rgba(124, 108, 255, 0.18), transparent 28rem),
        radial-gradient(circle at 88% 12%, rgba(40, 58, 130, 0.2), transparent 30rem),
        linear-gradient(180deg, #0b0c13 0%, var(--bg) 42%, #07080d 100%);
}

.topbar {
    background: rgba(10, 11, 17, 0.88);
    border-bottom: 1px solid rgba(155, 160, 210, 0.11);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}

.brand,
.nav-item,
.back-link,
.shot-card h3,
.resource-band h2,
.story-band h2,
.music-controls h2,
.music-preview h2,
.video-scroll h3,
.control-col h3,
.preview-col h2,
.voice-modal h2,
.video-head h2,
.video-progress-head strong,
.video-progress-head span {
    color: var(--ink);
}

.brand-badge,
.library-tabs.compact .tab.is-active,
.library-switch button.is-active,
.modal-tabs button.is-active,
.primary-btn,
.shot-index-stack .shot-index {
    background: linear-gradient(135deg, #6f5cff, #8d7bff);
    color: #fff;
}

.shot-index-stack.is-independent .shot-index {
    background: linear-gradient(135deg, #514a69, #746b91);
}

.shot-index-stack.is-reference-continuity .shot-index {
    background: linear-gradient(135deg, #6350e8, #8572ff);
}

.shot-index-stack.is-motion-context .shot-index {
    background: linear-gradient(135deg, #8840d4, #b45cf4);
}

.modal-tabs,
.modal-tabs-unified,
.video-flow-tabs {
    background: rgba(31, 32, 47, 0.92);
}

.nav-item.is-active {
    color: #d8d4ff;
    background: rgba(124, 108, 255, 0.16);
    box-shadow: 0 18px 44px rgba(76, 62, 180, 0.24);
}

.nav-item-beta,
.nav-item-beta.is-active {
    color: #b9adff;
    background: transparent;
    box-shadow: none;
}

.nav-item-beta:hover,
.nav-item-beta.is-active:hover {
    color: #d8d4ff;
    background: transparent;
}

.nav-item-beta.is-active {
    color: #d8d4ff;
    background: transparent;
    box-shadow: none;
}

.nav-item-beta.is-active::after {
    background: #8d7bff;
}

.nav-item-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-item-with-icon svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    fill: #ffc620;
    stroke: #ffc620;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Keep the two utility destinations visually stable when their active view changes. */
.topbar-actions .nav-item-utility {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    min-width: 64px;
    margin: 0;
    padding: 0 10px;
    border-radius: 8px;
    line-height: 1;
    transform: none;
    transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.topbar-actions .nav-item-with-icon {
    min-width: 88px;
}

.topbar-actions .nav-item-utility:hover {
    background: rgba(124, 108, 255, 0.09);
}

.topbar-actions .nav-item-utility.is-active {
    background: rgba(124, 108, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(157, 145, 255, 0.18);
}

.topbar-actions .nav-item-utility.is-active::after {
    right: 10px;
    bottom: 2px;
    left: 10px;
    height: 2px;
    background: #9e91ff;
}

.resource-band,
.story-band,
.library-panel,
.project-card,
.project-new,
.name-modal,
.generate-modal,
.voice-modal,
.video-modal,
.music-modal {
    background: rgba(18, 19, 29, 0.94);
    border: 1px solid rgba(151, 157, 210, 0.12);
    box-shadow: var(--shadow);
}

.library-tabs.compact,
.resource-tile,
.asset-card,
.shot-card {
    background: transparent;
}

.library-tabs {
    border-bottom-color: rgba(151, 157, 210, 0.14);
}

.tab,
.fold,
.project-card span,
.resource-tile strong,
.asset-card strong,
.shot-text p,
.empty-media,
.voice-head span,
.audio-item time,
.audio-item .dots,
.music-preview-item time,
.music-preview-item .dots,
.video-head p,
.video-progress-card p,
.host-pill,
.size-row label,
.radio-row,
.video-form-grid label,
.emotion-grid label,
.project-card em {
    color: var(--muted);
}

.fold,
.secondary-btn,
.shot-action,
.dashed-upload em,
.music-upload em {
    background: rgba(124, 108, 255, 0.13);
    color: #c7c0ff;
}

.resource-add,
.asset-add,
.shot-content,
.shot-text,
.dashed-upload,
.video-form-grid input,
.video-form-grid select,
.music-upload,
.prompt-box textarea,
.text-card textarea,
.music-prompt textarea,
.audio-item,
.music-preview-item,
.host-pill,
.name-modal input,
.size-row input {
    background: rgba(24, 25, 38, 0.96);
    border-color: rgba(151, 143, 255, 0.16);
    color: var(--ink);
}

.shot-text {
    border: 1px solid rgba(151, 143, 255, 0.18);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
}

.shot-content:has(.empty-image) {
    background: rgba(18, 19, 29, 0.5);
    border-color: rgba(151, 143, 255, 0.28);
}

.shot-content:has(.empty-video),
.shot-img,
.shot-video,
.asset-card .asset-media.audio {
    background: rgba(24, 25, 38, 0.92);
}

.empty-media svg,
.delete-shot svg,
.more svg,
.host-pill svg {
    stroke: currentColor;
}

.empty-media svg {
    stroke: #9f93ff;
}

.flow-arrow,
.delete-shot,
.remove-x,
.dashed-upload span,
.music-upload span {
    color: #9f93ff;
}

.project-new,
.add-shot,
.dashed-upload,
.music-upload {
    border-color: rgba(151, 143, 255, 0.28);
}

.resource-add,
.project-new,
.asset-add {
    color: #9f93ff;
}

.resource-tile img,
.asset-card img,
.shot-img img,
.shot-video img,
.shot-video video,
.image-preview img,
.video-result-stage img {
    filter: saturate(0.92) contrast(1.04) brightness(0.88);
}

.modal-backdrop {
    background: rgba(4, 5, 9, 0.68);
    backdrop-filter: blur(4px);
}

.modal-backdrop.dim {
    background: rgba(2, 3, 7, 0.72);
}

/* The scale picker is opened from inside the image/video lightbox. Keep it
   above that owner modal and above task/status overlays. */
#upscaleScaleChoiceModal.modal-backdrop {
    z-index: 10000000;
}

.modal-close {
    background: #1b1d2a;
    color: #c7cadb;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
}

.modal-footer {
    background: rgba(14, 15, 23, 0.98);
    border-top-color: rgba(151, 157, 210, 0.13);
}

.modal-tabs,
.library-switch button,
.modal-tabs button {
    background: rgba(31, 32, 47, 0.95);
    color: var(--muted);
}

.image-preview {
    background: #05060a;
}

.video-result-card,
.video-progress-card,
.video-result-stage {
    background: rgba(24, 25, 38, 0.96);
}

.music-bar {
    background: rgba(134, 130, 170, 0.34);
}

.music-bar span,
.wave i {
    background: #9f93ff;
}

.music-bar i {
    background: #f5f3ff;
    box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.16);
}

.audio-play {
    background: rgba(124, 108, 255, 0.16);
    color: #a89fff;
}

input::placeholder,
textarea::placeholder,
.name-modal input::placeholder,
.size-row input::placeholder,
.prompt-box textarea::placeholder,
.text-card textarea::placeholder {
    color: #6f748e;
}

.toast {
    background: rgba(18, 19, 29, 0.96);
    border: 1px solid rgba(151, 157, 210, 0.16);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
}

.toast[data-state="success"] {
    background:
        radial-gradient(circle at top, rgba(124, 108, 255, 0.18), transparent 58%),
        rgba(18, 19, 29, 0.98);
    border-color: rgba(141, 123, 255, 0.28);
    color: #d8d4ff;
}

.toast[data-state="error"] {
    background:
        radial-gradient(circle at top, rgba(255, 109, 149, 0.16), transparent 58%),
        rgba(28, 17, 23, 0.98);
    border-color: rgba(255, 109, 149, 0.24);
    color: #ffb5c6;
}

.toast[data-state="info"] {
    background: rgba(18, 19, 29, 0.96);
    border-color: rgba(151, 157, 210, 0.16);
    color: #c6cbe4;
}

.toast.toast-enter {
    animation: toast-pop-in 180ms ease;
}

.upgrade-modal {
    height: auto;
    min-height: 0;
    max-height: min(92vh, 960px);
    display: flex;
    flex-direction: column;
}

#upgradeModal,
#vipAccessModal {
    z-index: 260;
}

#upgradeModal .upgrade-modal,
#vipAccessModal .upgrade-modal {
    position: relative;
    z-index: 261;
}

@media (max-width: 900px) {
    .preview-col .tone-adjust-popover,
    .lightbox-footer .tone-adjust-popover {
        width: min(258px, calc(100vw - 52px));
        right: 12px;
        top: 72px;
    }
}

.upgrade-modal .upgrade-modal-body {
    overflow-y: auto;
    padding-right: 4px;
}

.upgrade-modal-body .external-help-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid rgba(151, 146, 255, 0.28);
    border-radius: 10px;
    background: rgba(124, 109, 255, 0.12);
    color: #d8d4ff;
    padding: 0 12px;
    font-weight: 760;
    text-decoration: none;
}

.upgrade-modal-body .external-help-link:hover {
    border-color: rgba(151, 146, 255, 0.48);
    background: rgba(124, 109, 255, 0.2);
    color: #ffffff;
}

.upgrade-modal-host-help {
    display: flex;
    justify-content: center;
    margin: 18px 0 26px;
}

.upgrade-modal .modal-actions,
.delete-project-modal .modal-actions {
    grid-template-columns: repeat(2, minmax(132px, 168px));
    justify-content: center;
    align-self: center;
    width: 100%;
    margin: 0;
}

.modal-tabs button.is-vip-gated,
.video-flow-tabs button.is-vip-gated {
    position: relative;
    padding-right: 28px;
}

.modal-tabs button.is-feature-hidden,
.video-flow-tabs button.is-feature-hidden {
    display: none !important;
}

.modal-tabs button.is-vip-gated::after,
.video-flow-tabs button.is-vip-gated::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 4px;
    width: 8px;
    height: 6.5px;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='13' viewBox='0 0 16 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.60988 12.3469C7.15594 12.3469 6.73227 12.1553 6.41957 11.8224L0.427669 5.32613C-0.127136 4.72089 -0.147311 3.79285 0.397407 3.16743L2.66706 0.554805C2.96969 0.201747 3.41353 0 3.88764 0H11.3624C11.8264 0 12.2702 0.201747 12.5729 0.554805L14.8526 3.16743C15.3973 3.79285 15.3872 4.72089 14.8223 5.32613L8.7901 11.8224C8.48748 12.1553 8.05372 12.3469 7.60988 12.3469Z' fill='%2351A2F2'/%3E%3Cpath d='M7.52929 8.69528C7.42842 8.69528 7.31745 8.65493 7.23676 8.57423L3.30268 4.53928C3.15137 4.37789 3.15137 4.1257 3.31277 3.9643C3.47417 3.81299 3.72635 3.81299 3.88775 3.97439L7.53938 7.7168L11.3827 3.9643C11.5441 3.81299 11.7962 3.81299 11.9576 3.97439C12.109 4.13579 12.109 4.38797 11.9476 4.54937L7.81174 8.58432C7.73104 8.65493 7.63016 8.69528 7.52929 8.69528Z' fill='%23FFF7E1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    opacity: 0.96;
}

.upgrade-modal {
    width: min(520px, calc(100vw - 40px));
}

.upgrade-modal-body {
    margin: 8px 0 0;
}

.upgrade-modal p,
.upgrade-modal-body p {
    margin: 8px 0 0;
    color: #a9afc8;
    font-size: 14px;
    line-height: 1.7;
}

.upgrade-modal-body h3 {
    margin: 0 0 10px;
    color: #eef1ff;
    font-size: 17px;
}

.upgrade-modal-reason {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(141, 123, 255, 0.22);
    border-radius: 12px;
    background: rgba(124, 108, 255, 0.12);
    color: #d8d4ff;
    font-size: 13px;
    line-height: 1.6;
}

.upgrade-modal-loading {
    color: #a9afc8;
    font-size: 14px;
    line-height: 1.7;
}

.vip-cdkey-form {
    margin: 18px 0 16px;
    padding: 14px;
    border: 1px solid rgba(141, 123, 255, 0.28);
    border-radius: 10px;
    background: rgba(124, 108, 255, 0.08);
}

.vip-cdkey-form > label {
    display: block;
    margin-bottom: 9px;
    color: #eef1ff;
    font-size: 14px;
    font-weight: 760;
}

.vip-cdkey-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.vip-cdkey-input-row input {
    min-width: 0;
    height: 42px;
    border: 1px solid rgba(151, 146, 255, 0.34);
    border-radius: 8px;
    background: rgba(11, 12, 20, 0.72);
    color: #f7f5ff;
    padding: 0 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.vip-cdkey-input-row input:focus {
    border-color: #8d7bff;
    box-shadow: 0 0 0 3px rgba(141, 123, 255, 0.14);
    outline: none;
}

.vip-cdkey-input-row .primary-btn {
    min-width: 104px;
    height: 42px;
    padding: 0 14px;
}

.vip-cdkey-status {
    margin: 10px 0 0 !important;
    color: #b8b3d8 !important;
    font-size: 13px !important;
}

.vip-cdkey-status[data-state="success"] {
    color: #73dfab !important;
}

.vip-cdkey-status[data-state="error"] {
    color: #ff9db1 !important;
}

@media (max-width: 560px) {
    .vip-cdkey-input-row {
        grid-template-columns: 1fr;
    }

    .vip-cdkey-input-row .primary-btn {
        width: 100%;
    }
}

@keyframes toast-pop-in {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 14px)) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}


.upload-stack-voice .music-upload.has-selection { align-content: end; }
.voice-clone-preview-list .voice-preview-item, #audioList .voice-preview-item { width: 100%; }
.voice-preview-inline-meta .audio-save-btn, .voice-preview-inline-meta .audio-saved-tag { justify-self: end; }
.voice-preview-inline-meta .preview-download-inline { justify-self: end; }

.library-task-cancel {
    border: 0;
    background: transparent;
    color: #c8cdf2;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
}

.library-task-cancel:hover {
    color: #ffffff;
}


.voice-clone-grid h2 + .emotion-grid { margin-top: 12px; }

@media (max-width: 900px) {
    .multi-audio-grid {
        grid-template-columns: 1fr;
    }
}


.storyboard-ai-btn {
    justify-content: center;
}

.storyboard-ai-btn-preserved {
    display: none !important;
}

.prompt-agent-tools.storyboard-agent-tools {
    order: initial;
    flex: 0 0 auto;
    margin-left: auto;
    gap: 7px;
}

.story-writer-toolbar .storyboard-agent-tools {
    justify-content: flex-end;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .story-writer-tools {
        flex-wrap: wrap;
    }

    .story-writer-model {
        flex-basis: calc(100% - 126px);
    }

    .story-writer-toolbar .storyboard-agent-tools {
        width: 100%;
    }
}

.storyboard-agent-tools .prompt-agent-process {
    min-width: 112px;
}

.prompt-agent-tools.storyboard-generate-agent-tools {
    order: 2;
    margin-left: 0;
    gap: 7px;
}

.storyboard-generate-agent-btn {
    min-width: 126px;
    height: 44px;
    border-radius: 8px;
    background: rgba(92, 78, 216, 0.2);
}

.storyboard-agent-build {
    position: relative;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    min-height: 44px;
    padding: 5px 8px 10px;
    border: 1px solid rgba(135, 119, 255, 0.3);
    border-radius: 7px;
    background: rgba(25, 25, 42, 0.64);
}

.storyboard-agent-build.is-complete {
    border-color: rgba(35, 190, 112, 0.46);
    background: rgba(7, 56, 35, 0.26);
}

.storyboard-agent-build.is-error {
    border-color: rgba(207, 88, 112, 0.58);
    background: rgba(91, 29, 44, 0.18);
}

.storyboard-agent-build.is-paused {
    border-color: rgba(206, 158, 76, 0.48);
}

.storyboard-agent-build-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    min-width: 0;
}

.storyboard-agent-build-head strong {
    flex: 0 0 auto;
    font-size: 11px;
    color: #f3f1ff;
}

.storyboard-agent-build-head span {
    overflow: hidden;
    max-width: calc(100% - 64px);
    color: #aaa4d2;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-agent-build.is-complete .storyboard-agent-build-head strong,
.storyboard-agent-build.is-complete .storyboard-agent-build-head span {
    color: #bdf7d7;
}

.storyboard-agent-build-assets {
    display: flex;
    overflow: visible;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
    margin-bottom: 0;
    min-width: 0;
    max-width: none;
}

.storyboard-agent-build-asset,
.storyboard-agent-build-shot {
    min-width: 0;
    border: 1px solid rgba(132, 121, 224, 0.26);
    background: rgba(30, 30, 48, 0.82);
    color: #aaa6c6;
    transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.storyboard-agent-build-asset {
    flex: 0 0 auto;
    max-width: 100%;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
}

.storyboard-agent-build-asset.is-complete,
.storyboard-agent-build-shot.is-complete {
    border-color: rgba(30, 199, 111, 0.74);
    color: #d9ffea;
    background: rgba(5, 73, 40, 0.86);
}

.storyboard-agent-build-asset.is-complete::after,
.storyboard-agent-build-shot.is-complete::after {
    margin-left: 5px;
    color: #64eba6;
    content: "✓";
}

.storyboard-agent-build-chapters {
    display: flex;
    grid-column: 1 / -1;
    overflow: visible;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.storyboard-agent-build-chapter {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.storyboard-agent-build-chapter > strong {
    display: inline-block;
    margin: 0;
    color: #dcd8ff;
    font-size: 11px;
}

.storyboard-agent-build-shot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.storyboard-agent-build-shot {
    width: auto;
    min-width: 52px;
    min-height: 24px;
    padding: 3px 5px;
    border-radius: 4px;
}

.storyboard-agent-build-shot b,
.storyboard-agent-build-shot span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-agent-build-shot b {
    margin: 0;
    font-size: 9px;
}

.storyboard-agent-build-shot span {
    display: none;
}

.storyboard-agent-build-track {
    position: absolute;
    right: 8px;
    bottom: 3px;
    left: 8px;
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
}

.storyboard-agent-build-track span {
    display: block;
    width: 6%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7465ed, #b9a9ff);
    box-shadow: 0 0 8px rgba(151, 127, 255, 0.52);
    transition: width 0.28s ease;
}

.storyboard-agent-build.is-indeterminate .storyboard-agent-build-track span {
    width: 28%;
    animation: storyboard-agent-build-indeterminate 1.15s ease-in-out infinite;
}

@keyframes storyboard-agent-build-indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(430%); }
}

.storyboard-agent-build.is-complete .storyboard-agent-build-track span {
    background: #2ed184;
    box-shadow: 0 0 8px rgba(46, 209, 132, 0.58);
}

@media (max-width: 720px) {
    .storyboard-agent-build {
        grid-template-columns: 1fr;
    }

    .storyboard-agent-build-head {
        flex: 0 0 auto;
    }

    .storyboard-agent-build-assets {
        grid-column: 1;
        max-width: 100%;
    }

    .storyboard-agent-build-chapters {
        grid-column: 1;
    }
}

.automation-storyboard-agent-field {
    grid-column: 1 / -1;
}

.automation-storyboard-agent-field textarea {
    width: 100%;
    min-height: 76px;
    padding: 14px;
    border: 1px solid rgba(151, 143, 255, 0.22);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    background: rgba(24, 25, 38, 0.96);
    color: var(--ink);
    font: inherit;
    line-height: 1.55;
}

.automation-storyboard-agent-field textarea:focus {
    border-color: rgba(151, 143, 255, 0.62);
    box-shadow: 0 0 0 2px rgba(124, 108, 255, 0.1);
}

.automation-storyboard-agent-field textarea::placeholder {
    color: rgba(166, 171, 206, 0.62);
}

.story-video-prompt-confirm-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.story-video-prompt-confirm-actions button {
    width: 100%;
    min-width: 0;
    white-space: normal;
}

@media (max-width: 680px) {
    .story-video-prompt-confirm-actions {
        grid-template-columns: 1fr;
    }
}

.automation-storyboard-agent-field small {
    color: #8f8ba8;
    line-height: 1.55;
}

.automation-storyboard-agent-field .prompt-reset-link {
    align-self: flex-start;
}

.storyboard-ai-btn strong {
    white-space: nowrap;
}

.storyboard-ai-btn-arrow {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    opacity: 0.82;
}

.storyboard-preset-bar {
    margin: 0 0 12px;
}

.storyboard-preset-tabs {
    display: block;
    min-height: 0;
    overflow: visible;
    padding: 2px 8px 4px;
}

.storyboard-preset-category-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    width: max-content;
    max-width: 100%;
    margin: 0 auto 10px;
    padding: 3px;
    border: 1px solid rgba(132, 123, 255, 0.18);
    border-radius: 7px;
    background: rgba(18, 20, 34, 0.86);
}

.storyboard-preset-category {
    min-width: 74px;
    height: 30px;
    padding: 0 13px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #9299ba;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.storyboard-preset-category:hover {
    color: #eef1ff;
    background: rgba(111, 92, 255, 0.1);
}

.storyboard-preset-category.is-active {
    color: #ffffff;
    background: #705cff;
}

.storyboard-preset-chip-panel {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    min-height: 32px;
}

.storyboard-preset-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid rgba(132, 123, 255, 0.2);
    background: rgba(22, 24, 39, 0.92);
    color: #bcc4ea;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.storyboard-preset-chip:hover {
    border-color: rgba(132, 123, 255, 0.42);
    background: rgba(31, 34, 55, 0.96);
    color: #eef1ff;
}

.storyboard-preset-chip.is-active {
    background: linear-gradient(135deg, rgba(94, 77, 255, 0.96), rgba(136, 103, 255, 0.88));
    border-color: rgba(146, 130, 255, 0.75);
    color: #ffffff;
    box-shadow: 0 10px 26px rgba(89, 71, 224, 0.26);
}

.storyboard-preset-chip.is-default:not(.is-active) {
    border-color: rgba(118, 104, 255, 0.38);
}

.storyboard-preset-chip.is-gold {
    border-color: rgba(148, 112, 43, 0.48);
    background: rgba(37, 31, 19, 0.94);
    color: #b99a55;
    box-shadow: inset 0 0 0 1px rgba(183, 143, 57, 0.04);
}

.storyboard-preset-chip.is-gold:hover {
    border-color: rgba(174, 135, 54, 0.68);
    background: rgba(47, 38, 21, 0.98);
    color: #cfb36f;
}

.storyboard-preset-chip.is-gold.is-active {
    border-color: rgba(187, 145, 61, 0.74);
    background: linear-gradient(135deg, #604719, #876a2d);
    color: #ead69c;
    box-shadow: 0 8px 20px rgba(102, 76, 26, 0.22);
}

.storyboard-preset-chip.is-custom {
    border-color: rgba(103, 232, 249, 0.38);
    background: rgba(9, 30, 43, 0.92);
    color: #9be7f5;
}

.storyboard-preset-chip.is-custom.is-active {
    border-color: rgba(103, 232, 249, 0.72);
    background: linear-gradient(135deg, rgba(23, 108, 132, 0.96), rgba(84, 91, 255, 0.82));
    color: #ffffff;
}

.storyboard-preset-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #f3f5ff;
    color: #171827;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}

.storyboard-preset-delete:hover {
    background: #ffffff;
    color: #6f5cff;
}

.storyboard-preset-add-chip {
    width: 34px;
    min-width: 34px;
    justify-content: center;
    padding: 0;
    border-style: dashed;
    border-color: rgba(111, 92, 255, 0.52);
    background: rgba(111, 92, 255, 0.12);
    color: #d9d3ff;
}

.storyboard-preset-add-chip span {
    font-size: 20px;
    line-height: 1;
}

.storyboard-preset-add-chip:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.storyboard-preset-empty {
    color: rgba(199, 205, 232, 0.7);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 2px;
}

.storyboard-preset-chip small {
    padding: 1px 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
}

.image-prompt-tools .prompt-ai-btn strong {
    max-width: 82px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storyboard-ai-source-card {
    position: absolute;
    top: 22px;
    right: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid rgba(129, 120, 233, 0.16);
    background: rgba(80, 83, 173, 0.22);
    color: #e7ebff;
    text-align: left;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
    z-index: 2;
}

.storyboard-ai-source-card:hover {
    border-color: rgba(129, 120, 233, 0.34);
    background: rgba(92, 96, 192, 0.28);
}

.storyboard-ai-source-card strong {
    color: #8f9bd8;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.storyboard-ai-source-card span {
    color: #8d74ff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .storyboard-ai-source-card {
        position: static;
        margin-bottom: 14px;
        max-width: 100%;
    }

    .storyboard-preset-tabs {
        padding-right: 0;
    }
}

.prompt-box:has(.prompt-footer-tools),
.music-prompt:has(.prompt-footer-tools),
.prompt-input-wrap:has(.prompt-footer-tools) {
    position: relative;
    display: grid;
    gap: 0;
    border: 1px solid rgba(151, 143, 255, 0.16);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(24, 25, 38, 0.96);
}

.prompt-box:has(.prompt-footer-tools) textarea,
.music-prompt:has(.prompt-footer-tools) textarea,
.prompt-input-wrap:has(.prompt-footer-tools) .director-segment-prompt {
    display: block;
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: rgba(24, 25, 38, 0.96);
    padding: 16px 20px;
}

.music-prompt:has(.prompt-footer-tools) textarea {
    padding: 18px 22px;
}

.prompt-input-wrap:has(.prompt-footer-tools) .director-segment-prompt {
    padding: 12px 16px;
}

.prompt-box .prompt-footer-tools,
.music-prompt .prompt-footer-tools,
.prompt-input-wrap .prompt-footer-tools {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 0;
    padding: 4px 12px;
    border-top: 1px solid rgba(151, 143, 255, 0.28);
    border-radius: 0;
    background: rgba(31, 32, 48, 0.99);
}

.prompt-agent-tools {
    order: 10;
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
    width: auto;
    max-width: none !important;
    color: inherit;
    font-size: inherit;
}

/* The canvas bridge uses this invisible element only as the anchor for the
   existing Agent chooser. Keep it fixed even though normal prompt tools are
   intentionally laid out statically. */
.prompt-agent-tools.infinite-canvas-agent-anchor {
    position: fixed !important;
    display: block !important;
    margin: 0 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

.prompt-agent-tools span,
.prompt-box .prompt-agent-tools span,
.music-prompt .prompt-agent-tools span,
.prompt-input-wrap .prompt-agent-tools span {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    display: inline-flex;
    width: auto;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Keep the storyboard toolbar icons stable when a packaged/custom theme
   supplies broad button or SVG rules. Inline SVG paths must stay stroked
   icons instead of falling back to the browser's black fill. */
.story-writer-toolbar .story-writer-tool > svg,
.story-writer-toolbar .story-script-library-tool > svg {
    display: block;
    box-sizing: border-box;
    flex: 0 0 auto;
    fill: none !important;
    stroke: currentColor !important;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    opacity: 1;
}

.story-writer-toolbar .story-writer-tool > svg {
    width: 20px;
    height: 20px;
}

.story-writer-toolbar .story-script-library-tool > svg {
    width: 15px;
    height: 15px;
}

.story-writer-toolbar .story-script-library-tool {
    background: transparent !important;
    min-width: 0;
    overflow: hidden;
}

.story-writer-toolbar .story-script-library-tool > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-agent-help,
.prompt-agent-process,
.prompt-agent-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    border: 0;
    background: transparent;
    color: #d8d3ff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.prompt-agent-help {
    padding: 0 2px;
    color: #ddd8ff;
}

.prompt-agent-help:hover {
    color: #fff;
}

.prompt-agent-process {
    gap: 5px;
    min-width: 112px;
    padding: 0 14px;
    border: 1px solid rgba(157, 140, 255, 0.62);
    border-radius: 66px;
    background: rgba(92, 82, 151, 0.82);
    color: #f6f3ff;
}

.prompt-agent-process:hover {
    background: rgba(104, 85, 178, 0.82);
    color: #fff;
}

.prompt-agent-process:disabled {
    cursor: wait;
    opacity: 0.62;
}

.prompt-agent-cancel {
    padding: 0 4px;
    color: #d8a2aa;
}

.prompt-agent-cancel:hover {
    color: #ffbdc6;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.prompt-agent-cancel.is-hidden {
    display: none;
}

.prompt-agent-ai {
    display: inline-grid !important;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 4px;
    background: #806cff;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
}

.prompt-agent-process [data-method-ai-icon].is-hidden {
    display: none !important;
}

.prompt-agent-skill-chooser {
    position: fixed;
    z-index: 1000006;
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow);
    font-size: 12px;
}

.prompt-agent-skill-chooser::after {
    content: "";
    position: absolute;
    left: var(--agent-chooser-pointer, 50%);
    width: 12px;
    height: 12px;
    background: var(--panel);
    border: solid var(--line-strong);
    border-width: 0 1px 1px 0;
    transform: translateX(-50%) rotate(45deg);
    bottom: -7px;
}

.prompt-agent-skill-chooser[data-placement="below"]::after {
    top: -7px;
    bottom: auto;
    transform: translateX(-50%) rotate(225deg);
}

.prompt-agent-chooser-heading,
.prompt-agent-chooser-heading > div,
.prompt-agent-chooser-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.prompt-agent-chooser-heading button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--soft);
    font-size: 18px;
    cursor: pointer;
}

.prompt-agent-skill-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    align-content: start;
    gap: 4px;
    min-height: 40px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    color: var(--muted);
}

.prompt-agent-skill-option {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    min-height: 58px;
    height: 58px;
    padding: 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--soft);
    color: var(--ink);
    font: inherit;
    line-height: 1.25;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.prompt-agent-chooser-heading strong {
    font-size: 14px;
}

.prompt-agent-skill-option .prompt-agent-skill-name {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-agent-skill-option .prompt-agent-skill-summary {
    margin: 0;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--muted);
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.prompt-agent-skill-option:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
}

.prompt-agent-skill-chooser :is(button, textarea):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.prompt-agent-chooser-instruction {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    min-height: 0;
}

.prompt-agent-chooser-instruction textarea {
    width: 100%;
    height: 56px;
    min-height: 48px;
    padding: 8px;
    resize: none;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--panel-2);
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
}

.prompt-agent-chooser-instruction textarea::placeholder {
    color: var(--muted);
}

.prompt-agent-chooser-footer {
    justify-content: flex-end;
}

.prompt-agent-chooser-footer button {
    min-width: 72px;
    min-height: 32px;
    padding: 4px 14px;
    font-size: 12px;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .prompt-agent-skill-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .prompt-agent-skill-chooser { padding: 12px; }
}

.prompt-agent-help-popover {
    --prompt-agent-help-pointer-x: 50%;
    position: fixed;
    z-index: 1000005;
    width: min(320px, calc(100vw - 24px));
    padding: 12px 14px;
    border: 1px solid rgba(151, 143, 255, 0.5);
    border-radius: 7px;
    background: #202132;
    color: #eceaff;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
    font-size: 12px;
    line-height: 1.6;
}

.prompt-agent-help-popover strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
    font-size: 13px;
}

.prompt-agent-help-popover p {
    margin: 0;
    color: #c6c3d6;
}

.prompt-agent-help-popover code {
    display: block;
    margin-top: 7px;
    color: #b9adff;
    white-space: normal;
}

.prompt-agent-status-popover {
    --prompt-agent-pointer-x: 78%;
    position: fixed;
    z-index: 1000007;
    width: min(350px, calc(100vw - 24px));
    min-height: 116px;
    padding: 14px 16px 12px;
    border: 1px solid rgba(151, 143, 255, 0.58);
    border-radius: 7px;
    background: #202132;
    color: #eceaff;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.48);
}

.prompt-agent-status-popover.is-suspended {
    display: none;
}

.prompt-agent-status-popover::after {
    content: "";
    position: absolute;
    left: var(--prompt-agent-pointer-x);
    width: 14px;
    height: 14px;
    border: solid rgba(151, 143, 255, 0.58);
    background: #202132;
    transform: translateX(-50%) rotate(45deg);
}

.prompt-agent-status-popover[data-placement="above"]::after {
    bottom: -8px;
    border-width: 0 1px 1px 0;
}

.prompt-agent-status-popover[data-placement="below"]::after {
    top: -8px;
    border-width: 1px 0 0 1px;
}

.prompt-agent-status-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
}

.prompt-agent-status-head strong {
    color: #f5f2ff;
    font-size: 12px;
}

.prompt-agent-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #9d8cff;
    box-shadow: 0 0 0 4px rgba(128, 108, 255, 0.16);
    animation: prompt-agent-status-pulse 1.4s ease-in-out infinite;
}

.prompt-agent-status-text {
    min-height: 20px;
    max-height: 48px;
    overflow: auto;
    color: #c9c3ff;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.prompt-agent-status-meta {
    margin-top: 4px;
    color: #77728f;
    font-size: 10px;
    line-height: 1.4;
}

.prompt-agent-status-detail-label {
    margin-top: 9px;
    color: #b3acd8;
    font-size: 10px;
    font-weight: 700;
}

.prompt-agent-status-detail {
    display: grid;
    gap: 3px;
    max-height: 76px;
    margin-top: 4px;
    overflow: auto;
    color: #9690ba;
    font-size: 10px;
    line-height: 1.4;
}

.prompt-agent-status-detail:empty {
    display: none;
}

.prompt-agent-status-detail span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}

.prompt-agent-status-track {
    position: relative;
    height: 3px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.prompt-agent-status-track i {
    position: absolute;
    inset: 0 auto 0 -42%;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, #806cff 42%, #bfb6ff 70%, transparent);
    animation: prompt-agent-status-slide 2.4s ease-in-out infinite;
}

.prompt-agent-status-popover.is-determinate .prompt-agent-status-track i {
    inset: 0 auto 0 0;
    width: var(--agent-progress, 0%);
    background: linear-gradient(90deg, #7160ed, #a597ff);
    animation: none;
    transition: width 220ms ease;
}

.prompt-agent-status-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.prompt-agent-status-actions button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #e1b1b9;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.prompt-agent-status-actions button:hover {
    color: #ffd1d7;
}

.prompt-agent-status-popover[data-state="complete"] .prompt-agent-status-dot {
    background: #68d6a1;
    animation: none;
}

.prompt-agent-status-popover[data-state="complete"] .prompt-agent-status-track i,
.prompt-agent-status-popover[data-state="cancelled"] .prompt-agent-status-track i,
.prompt-agent-status-popover[data-state="error"] .prompt-agent-status-track i {
    animation: none;
    width: 100%;
    left: 0;
}

.prompt-agent-status-popover[data-state="error"] .prompt-agent-status-dot,
.prompt-agent-status-popover[data-state="cancelled"] .prompt-agent-status-dot {
    background: #dc7f8f;
    animation: none;
}

@keyframes prompt-agent-status-pulse {
    0%, 100% { opacity: 0.45; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes prompt-agent-status-slide {
    0% { left: -42%; opacity: 0; }
    14% { opacity: 1; }
    86% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* Project-scoped custom workflows */
.nav-item-custom-workflow {
    position: relative;
}

.custom-workflow-view {
    min-height: calc(100vh - 76px);
    padding: 32px clamp(28px, 4vw, 68px) 64px;
    background: #0e0f18;
    color: #f4f2ff;
}

.custom-workflow-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #292940;
}

.custom-workflow-kicker {
    display: block;
    margin-bottom: 8px;
    color: #8d7aff;
    font-size: 11px;
    font-weight: 800;
}

.custom-workflow-head h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0;
}

.custom-workflow-head p {
    margin: 8px 0 0;
    color: #9291a7;
    font-size: 14px;
}

.custom-workflow-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-workflow-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 24px 0 16px;
    color: #8f8da4;
}

.custom-workflow-summary strong {
    color: #fff;
    font-size: 22px;
}

.custom-workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 14px;
}

.custom-workflow-card {
    position: relative;
    min-height: 220px;
    overflow: hidden;
    border: 1px solid #303049;
    border-radius: 7px;
    background: #171824;
    cursor: pointer;
    transition: border-color .18s ease, transform .18s ease;
}

.custom-workflow-card:hover {
    border-color: #6f5dcc;
    transform: translateY(-2px);
}

.custom-workflow-card:focus-visible {
    outline: 2px solid #8d7aff;
    outline-offset: 2px;
}

.custom-workflow-card-visual {
    display: grid;
    place-items: center;
    height: 112px;
    border-bottom: 1px solid #2b2b43;
    background-color: #11121b;
    background-image: linear-gradient(#24243a 1px, transparent 1px), linear-gradient(90deg, #24243a 1px, transparent 1px);
    background-size: 22px 22px;
}

.custom-workflow-card-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid #7866d8;
    border-radius: 7px;
    background: #25223f;
    color: #b4a8ff;
    font-size: 13px;
    font-weight: 800;
}

.custom-workflow-card-copy {
    padding: 14px;
}

.custom-workflow-card-copy h3 {
    overflow: hidden;
    margin: 0;
    color: #f6f4ff;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-card-copy p {
    margin: 7px 0 13px;
    color: #8e8da3;
    font-size: 12px;
}

.custom-workflow-card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-workflow-card-actions button {
    border: 0;
    background: transparent;
    color: #a99cff;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}

.custom-workflow-card-actions button[data-custom-workflow-delete] {
    margin-left: auto;
    color: #b96d78;
}

.custom-workflow-empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 320px;
    border: 1px dashed #393852;
    border-radius: 7px;
    color: #7f7e94;
    text-align: center;
}

.custom-workflow-run-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1180px, calc(100vw - 70px));
    max-height: calc(100vh - 58px);
    overflow: hidden;
    border: 1px solid #4a416f;
    border-radius: 7px;
    background: #11121c;
    box-shadow: 0 28px 90px #000a;
}

.custom-workflow-run-modal > .modal-close {
    top: 12px;
    right: 12px;
    z-index: 30;
    width: 42px;
    height: 42px;
    font-size: 30px;
}

.custom-workflow-run-head,
.custom-workflow-run-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #292940;
}

.custom-workflow-run-head {
    padding-right: 72px;
}

.custom-workflow-run-head > div {
    min-width: 0;
}

.custom-workflow-run-head span:first-child {
    color: #8f82e7;
    font-size: 11px;
    font-weight: 700;
}

.custom-workflow-run-head h2 {
    overflow: hidden;
    margin: 4px 0 0;
    font-size: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-output-badge {
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid #4e447b;
    border-radius: 4px;
    color: #b5aaff;
    font-size: 12px;
}

.custom-workflow-run-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(390px, 1.1fr);
    min-height: 0;
    overflow: hidden;
}

.custom-workflow-controls-col,
.custom-workflow-result-col {
    min-height: 0;
    overflow-y: auto;
    padding: 22px 24px;
}

.custom-workflow-result-col {
    border-left: 1px solid #292940;
}

.custom-workflow-detected-note {
    margin-bottom: 16px;
    color: #8b899e;
    font-size: 12px;
}

.custom-workflow-controls {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.custom-workflow-section {
    min-width: 0;
}

.custom-workflow-section > h3 {
    margin: 0 0 10px;
    color: #f2f0ff;
    font-size: 14px;
}

.custom-workflow-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
    gap: 10px;
}

.custom-workflow-media-control {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
    color: #aaa7be;
    font-size: 11px;
}

.custom-workflow-media-control > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-media-frame {
    position: relative;
    min-width: 0;
}

.custom-workflow-media-add {
    position: relative;
    display: flex;
    width: 100%;
    aspect-ratio: 1 / .78;
    min-height: 82px;
    overflow: hidden;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px;
    border: 1px dashed #59517f;
    border-radius: 6px;
    background: #181925;
    color: #a99cff;
    cursor: pointer;
}

.custom-workflow-media-add:hover {
    border-color: #9382ff;
    background: #1d1d2d;
}

.custom-workflow-media-add b {
    font-size: 27px;
    font-weight: 400;
    line-height: 1;
}

.custom-workflow-media-add small {
    display: block;
    width: 100%;
    overflow: hidden;
    color: #c7c2e5;
    font-size: 10px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-media-add.has-selection {
    border-style: solid;
    padding: 0;
    background: #08090f;
}

.custom-workflow-media-add.has-selection img,
.custom-workflow-media-add.has-selection video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-workflow-media-add.has-selection small {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 5px 7px;
    background: rgba(7, 8, 14, .78);
    text-align: left;
}

.custom-workflow-audio-preview {
    font-size: 30px;
}

.custom-workflow-media-clear {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 1px solid #5d557c;
    border-radius: 50%;
    background: rgba(19, 19, 30, .9);
    color: #ddd7ff;
    cursor: pointer;
}

.custom-workflow-compact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px 12px;
}

.custom-workflow-control {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
    color: #a9a7ba;
    font-size: 12px;
}

.custom-workflow-control-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-control.is-wide {
    grid-column: 1 / -1;
}

.custom-workflow-control-check {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #35344d;
    border-radius: 6px;
    background: #181824;
}

.custom-workflow-control-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    accent-color: #7967de;
}

.custom-workflow-control input,
.custom-workflow-control select,
.custom-workflow-control textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #35344d;
    border-radius: 6px;
    outline: 0;
    background: #191a27;
    color: #f1efff;
    font: inherit;
    font-size: 13px;
}

.custom-workflow-control input,
.custom-workflow-control select {
    height: 38px;
    padding: 0 10px;
}

.custom-workflow-control select {
    padding-right: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-control textarea {
    min-height: 116px;
    resize: vertical;
    padding: 12px;
    line-height: 1.6;
}

.custom-workflow-control input:focus,
.custom-workflow-control select:focus,
.custom-workflow-control textarea:focus {
    border-color: #7967de;
}

.custom-workflow-file-input {
    padding: 9px !important;
}

.custom-workflow-seed-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 6px;
}

.custom-workflow-seed-control {
    grid-column: span 2;
}

.custom-workflow-seed-row input:disabled {
    opacity: .46;
    cursor: not-allowed;
}

.custom-workflow-prompt-shell {
    min-width: 0;
}

.custom-workflow-prompt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.custom-workflow-prompt-head > strong,
.custom-workflow-prompt-head > h3 {
    margin: 0;
    color: #f2f0ff;
    font-size: 14px;
}

.custom-workflow-prompt-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.custom-workflow-prompt-actions select,
.custom-workflow-prompt-actions button {
    width: auto;
    max-width: 180px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #484265;
    border-radius: 6px;
    background: #1b1b2a;
    color: #d8d3fb;
    font-size: 11px;
}

.custom-workflow-prompt-actions button {
    border-color: transparent;
    background: #26233f;
    cursor: pointer;
}

.custom-workflow-prompt-actions .custom-workflow-prompt-config {
    display: inline-flex;
    width: auto;
    max-width: 210px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    border-color: #484265;
    background: #1b1b2a;
}

.custom-workflow-prompt-config strong {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-workflow-prompt-box {
    overflow: hidden;
    border: 1px solid #393653;
    border-radius: 7px;
    background: #191a27;
}

.custom-workflow-prompt-box textarea {
    display: block;
    width: 100%;
    min-height: 190px;
    max-height: 380px;
    resize: vertical;
    padding: 14px 16px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f1efff;
    font: inherit;
    font-size: 13px;
    line-height: 1.65;
}

.custom-workflow-prompt-box textarea:focus {
    box-shadow: inset 0 0 0 1px #7967de;
}

.custom-workflow-advanced {
    border: 1px solid #35344d;
    border-radius: 6px;
    background: #151620;
}

.custom-workflow-advanced > summary {
    padding: 12px 14px;
    color: #c9c5e4;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.custom-workflow-advanced > summary small {
    margin-left: 5px;
    color: #817b9e;
}

.custom-workflow-advanced > .custom-workflow-compact-grid {
    padding: 2px 14px 14px;
}

.custom-workflow-media-picker {
    z-index: 18000;
}

.custom-workflow-media-picker .modal-library-picker {
    border: 2px solid #a791ff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .72), 0 0 24px rgba(121, 103, 222, .22);
}

.custom-workflow-no-controls {
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px dashed #393852;
    color: #8c8a9e;
    font-size: 13px;
}

.custom-workflow-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.custom-workflow-result-head h3 {
    margin: 0;
    font-size: 16px;
}

.custom-workflow-result {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid #292940;
    border-radius: 6px;
    background: #08090f;
}

.custom-workflow-result-empty {
    place-items: center;
    color: #6f6e82;
}

.custom-workflow-result-item {
    position: relative;
    min-height: 170px;
    overflow: hidden;
    background: #05060a;
}

.custom-workflow-result-item img,
.custom-workflow-result-item video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.custom-workflow-result-item audio {
    width: calc(100% - 24px);
    margin: 72px 12px;
}

.custom-workflow-error {
    max-height: 180px;
    overflow: auto;
    margin: 12px 0 0;
    padding: 12px;
    border: 1px solid #6d313e;
    border-radius: 5px;
    background: #251218;
    color: #f0a8b4;
    font-size: 12px;
    white-space: pre-wrap;
}

.custom-workflow-run-footer {
    border-top: 1px solid #292940;
    border-bottom: 0;
}

.custom-workflow-run-footer > div {
    display: flex;
    gap: 10px;
}

/* Keep generated-video metadata aligned with the media edge. */
.video-preview-card .image-grid-meta {
    width: 100%;
    grid-template-columns: minmax(64px, 1fr) auto;
    gap: 4px;
    text-align: left;
}

.video-preview-card .image-grid-check {
    width: 100%;
    min-width: 64px;
    justify-content: flex-start;
    gap: 6px;
}

.video-preview-card .generated-duration {
    min-width: 40px;
    font-variant-numeric: tabular-nums;
}

.video-preview-card .image-grid-meta > span {
    min-width: 0;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-preview-card .image-grid-actions {
    align-self: center;
    justify-self: end;
    flex-wrap: nowrap;
    gap: 3px;
    min-width: 0;
}

.video-preview-card .preview-download-inline {
    flex: 0 0 22px;
    width: 22px;
    height: 26px;
}

.video-preview-card .audio-save-btn,
.video-preview-card .audio-saved-tag {
    flex: 0 0 auto;
    min-width: 54px;
    height: 27px;
    gap: 3px;
    padding: 0 7px;
    font-size: 11px;
    white-space: nowrap;
}

.video-preview-card .save-library-icon {
    width: 13px;
    height: 13px;
    flex-basis: 13px;
}

@media (max-width: 900px) {
    .custom-workflow-run-grid {
        display: block;
        overflow-y: auto;
    }
    .custom-workflow-controls-col,
    .custom-workflow-result-col {
        overflow: visible;
    }
    .custom-workflow-result-col {
        border-top: 1px solid #292940;
        border-left: 0;
    }
    .custom-workflow-compact-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .custom-workflow-seed-control {
        grid-column: 1 / -1;
    }
    .custom-workflow-prompt-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .custom-workflow-prompt-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.prompt-agent-help-popover::after {
    content: "";
    position: absolute;
    left: calc(var(--prompt-agent-help-pointer-x) - 7px);
    width: 14px;
    height: 14px;
    background: #202132;
    transform: rotate(45deg);
}

.prompt-agent-help-popover[data-placement="above"]::after {
    bottom: -8px;
    border-right: 1px solid rgba(151, 143, 255, 0.5);
    border-bottom: 1px solid rgba(151, 143, 255, 0.5);
}

.prompt-agent-help-popover[data-placement="below"]::after {
    top: -8px;
    border-top: 1px solid rgba(151, 143, 255, 0.5);
    border-left: 1px solid rgba(151, 143, 255, 0.5);
}

@media (max-width: 720px) {
    .prompt-agent-tools {
        margin-left: 0;
    }

    .prompt-footer-tools {
        flex-wrap: wrap;
    }
}

.prompt-box .prompt-footer-tools > *,
.music-prompt .prompt-footer-tools > *,
.prompt-input-wrap .prompt-footer-tools > * {
    min-width: 0;
    max-width: 100%;
}

.prompt-box .prompt-footer-tools .common-prompt-trigger,
.music-prompt .prompt-footer-tools .common-prompt-trigger,
.prompt-input-wrap .prompt-footer-tools .common-prompt-trigger {
    order: 1;
    flex: 0 0 auto;
    height: 30px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.prompt-box .prompt-footer-tools .prompt-auto-script-toggle,
.music-prompt .prompt-footer-tools .prompt-auto-script-toggle,
.prompt-input-wrap .prompt-footer-tools .prompt-auto-script-toggle {
    order: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: max-content;
    max-width: none;
}

.prompt-box .prompt-footer-tools .prompt-auto-script-toggle span,
.music-prompt .prompt-footer-tools .prompt-auto-script-toggle span,
.prompt-input-wrap .prompt-footer-tools .prompt-auto-script-toggle span {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    display: inline !important;
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.prompt-box .prompt-footer-tools .common-prompt-trigger,
.prompt-box .prompt-footer-tools .prompt-reset-link,
.music-prompt .prompt-footer-tools .common-prompt-trigger,
.music-prompt .prompt-footer-tools .prompt-reset-link,
.prompt-input-wrap .prompt-footer-tools .common-prompt-trigger,
.prompt-input-wrap .prompt-footer-tools .prompt-reset-link {
    color: #ddd8ff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.prompt-box .prompt-footer-tools .prompt-save-mini,
.music-prompt .prompt-footer-tools .prompt-save-mini,
.prompt-input-wrap .prompt-footer-tools .prompt-save-mini {
    order: 2;
    flex: 0 0 auto;
    height: 30px;
    width: auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #ddd8ff;
    font-size: 12px;
    box-shadow: none;
}

.prompt-box .prompt-footer-tools .prompt-save-mini:hover,
.music-prompt .prompt-footer-tools .prompt-save-mini:hover,
.prompt-input-wrap .prompt-footer-tools .prompt-save-mini:hover {
    background: transparent;
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.mobile-client #videoModal .video-modal,
body.mobile-client .video-modal {
    grid-template-rows: minmax(0, 1fr) auto;
}

/* Final creative-board visual layer: follows the production sequence rather
   than the legacy card dashboard. This must stay last in this stylesheet. */
.topbar {
    min-height: 58px;
    padding: 0 clamp(14px, 2vw, 30px);
    border-bottom-color: rgba(191, 181, 255, 0.13);
    background: rgba(7, 7, 12, 0.9);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.brand-logo { height: 34px; }

.main-nav {
    gap: 0;
    margin-left: clamp(12px, 1.65vw, 28px);
}

.main-nav > .nav-item,
.nav-more > summary {
    height: 34px;
    padding-inline: clamp(6px, 0.72vw, 11px);
    border-radius: 0;
    color: #a6a1bb;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0;
}

.main-nav > .nav-item.is-active,
.main-nav > .nav-item.nav-item-beta.is-active {
    color: #f6f3ff;
    background: transparent;
    box-shadow: none;
}

.main-nav > .nav-item.is-active::after,
.main-nav > .nav-item.nav-item-beta.is-active::after {
    right: clamp(6px, 0.72vw, 11px);
    bottom: 0;
    left: clamp(6px, 0.72vw, 11px);
    height: 2px;
    background: #a88eff;
    box-shadow: 0 0 12px rgba(168, 142, 255, 0.74);
}

.topbar-actions { gap: 3px; }

.topbar-actions .nav-item-utility {
    height: 30px;
    min-width: 0;
    padding: 0 7px;
    border-radius: 5px;
    color: #bab5cf;
    font-size: 11px;
}

.topbar-actions .nav-item-with-icon { min-width: 0; }

.topbar-actions .nav-item-utility.is-active,
.topbar-actions .nav-item-utility:hover {
    background: rgba(155, 131, 255, 0.1);
    box-shadow: none;
}

.topbar-actions .nav-item-utility.is-active::after { display: none; }
.nav-refresh-link { width: 30px; height: 30px; }

.nav-task-trigger {
    min-width: 98px;
    min-height: 32px;
    padding: 0 17px 0 8px;
    border-radius: 7px;
    background: rgba(151, 131, 255, 0.07);
}

.nav-task-status .library-task-summary { font-size: 11px; }

.studio-view {
    position: relative;
    width: min(100%, 1510px);
    padding: clamp(32px, 4.8vw, 74px) clamp(10px, 3.5vw, 64px) 146px;
}

.studio-view::before {
    position: absolute;
    top: 28px;
    bottom: 126px;
    left: clamp(20px, 2.3vw, 42px);
    width: 1px;
    background: rgba(174, 155, 255, 0.12);
    content: "";
    pointer-events: none;
}

.studio-view .basic-script-band,
.studio-view .storyboard-pages-band { position: relative; }

.studio-view .basic-script-band { margin-bottom: clamp(74px, 9vw, 142px); }

.studio-view .basic-script-band::before,
.studio-view .storyboard-pages-band::before {
    position: absolute;
    top: 7px;
    left: clamp(-47px, -2.4vw, -30px);
    color: rgba(177, 156, 255, 0.74);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 0;
    writing-mode: vertical-rl;
}

.studio-view .basic-script-band::before { content: "01"; }
.studio-view .storyboard-pages-band::before { content: "02"; }

.studio-view .basic-script-head {
    min-height: 42px;
    margin-bottom: clamp(28px, 3.4vw, 48px);
    padding-bottom: 17px;
    border-bottom: 1px solid var(--atelier-line);
}

.studio-view .basic-script-head h2,
.studio-view .storyboard-pages-head h2 {
    color: #f4f1ff;
    font-size: clamp(23px, 2.1vw, 31px);
    font-weight: 820;
    letter-spacing: 0;
}

.studio-view .basic-script-head h2::after,
.studio-view .storyboard-pages-head h2::after {
    display: inline-block;
    width: 30px;
    height: 1px;
    margin: 0 0 7px 13px;
    background: #9b83ff;
    box-shadow: 0 0 12px rgba(155, 131, 255, 0.8);
    content: "";
}

.studio-view .basic-script-exit-btn {
    height: 30px;
    padding: 0 0 0 11px;
    border-left: 1px solid rgba(163, 147, 255, 0.38);
    border-radius: 0;
    color: #b8b1d6;
    font-size: 11px;
}

.studio-view .story-top-grid {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 310px);
    gap: clamp(28px, 5.3vw, 82px);
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    position: relative;
    overflow: visible;
    border: 1px solid var(--atelier-line);
    border-radius: 20px 20px 7px 7px;
    background: var(--atelier-panel);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.22);
}

.studio-view .storyboard-composer::before,
.studio-view .story-role-panel::before {
    position: absolute;
    top: -1px;
    left: 26px;
    width: 86px;
    height: 2px;
    background: #a48aff;
    box-shadow: 0 0 17px rgba(164, 138, 255, 0.78);
    content: "";
}

.studio-view .storyboard-composer {
    min-height: 530px;
    gap: 19px;
    padding: clamp(21px, 2.8vw, 35px);
}

.studio-view .story-role-panel {
    min-height: 438px;
    max-height: min(676px, calc(100vh - 98px));
    padding: 20px 18px 18px;
    background: rgba(13, 14, 24, 0.66);
}

.studio-view .storyboard-composer-head {
    min-height: 34px;
    padding-bottom: 6px;
}

.studio-view .storyboard-composer-head h3,
.studio-view .story-role-head h3 {
    color: #eae6fb;
    font-size: 13px;
    font-weight: 850;
}

.studio-view .storyboard-title-row h3::before,
.studio-view .story-role-head-row::before {
    display: inline-block;
    margin-right: 8px;
    color: #a489ff;
    font-size: 9px;
    font-weight: 900;
    content: "//";
    vertical-align: 1px;
}

.studio-view .storyboard-generation-counts { gap: 9px; padding-top: 0; }

.studio-view .storyboard-count-inline {
    gap: 5px;
    color: var(--atelier-ink-muted);
    font-size: 10px;
    font-weight: 700;
}

.studio-view .storyboard-count-inline input {
    width: 37px;
    min-height: 27px;
    padding: 0 5px;
    border-color: rgba(168, 149, 255, 0.23);
    border-radius: 5px;
    background: rgba(6, 7, 12, 0.78);
    font-size: 11px;
}

.studio-view .storyboard-script-composer {
    min-height: 357px;
    border-color: rgba(174, 158, 255, 0.2);
    border-radius: 12px 12px 5px 5px;
    background: rgba(6, 7, 12, 0.84);
}

.studio-view .storyboard-script-composer > textarea {
    min-height: 290px;
    padding: 25px 27px 18px;
    color: #d8d3e9;
    font-size: 13px;
    line-height: 1.92;
}

.studio-view .story-writer-toolbar {
    min-height: 45px;
    padding: 5px 13px;
    border-top-color: var(--atelier-line);
    background: rgba(22, 22, 36, 0.76);
}

.studio-view .story-writer-tool {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border-radius: 4px;
    color: #aaa3c9;
}

.studio-view .story-writer-model,
.studio-view .story-processing-method-trigger,
.studio-view .story-processing-method-trigger strong {
    color: #9f98b9;
    font-size: 11px;
}

.studio-view .story-script-library-tool { min-height: 28px; margin-left: 5px; padding: 0 4px; }
.studio-view .story-script-library-tool span,
.studio-view .prompt-agent-help span { font-size: 11px; }

.studio-view .storyboard-actions { min-height: 38px; padding-top: 0; }
.studio-view .storyboard-action-buttons { justify-content: space-between; gap: 10px; }

.studio-view .storyboard-ai-btn,
.studio-view .prompt-agent-process,
.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn {
    min-height: 34px;
    border-radius: 7px;
    font-size: 11px;
}

.studio-view .storyboard-ai-btn {
    padding: 0 8px;
    border-color: rgba(162, 144, 255, 0.22);
    background: rgba(151, 130, 255, 0.07);
}

.studio-view .storyboard-ai-btn span { width: 23px; height: 23px; border-radius: 5px; font-size: 10px; }
.studio-view .prompt-agent-process { padding: 0 12px; }
.studio-view .storyboard-generation-buttons { gap: 8px; }

.studio-view .story-role-head-row {
    position: relative;
    padding: 4px 0 13px;
    border-bottom-color: var(--atelier-line);
}

.studio-view .story-role-head-row::before { position: absolute; top: 10px; left: 0; }
.studio-view .story-asset-tabs { gap: 0; margin-left: 22px; }

.studio-view .story-asset-tabs button {
    min-width: 42px;
    height: 26px;
    padding: 0 7px;
    border-radius: 0;
    color: #8882a1;
    font-size: 10px;
}

.studio-view .story-asset-tabs button.is-active {
    border-bottom: 1px solid #a68bff;
    background: transparent;
    box-shadow: none;
    color: #eee9ff;
}

.studio-view .story-role-head-actions .prompt-reset-link { color: #a79fcb; font-size: 10px; }
.studio-view .story-role-grid { gap: 16px 11px; padding: 20px 2px 14px 0; }

.studio-view .story-role-avatar,
.studio-view .story-role-grid.is-scene-mode .story-role-avatar {
    border: 1px solid rgba(167, 148, 255, 0.19);
    border-radius: 9px;
    background: #0a0b12;
    box-shadow: none;
}

.studio-view .story-role-card strong,
.studio-view .story-role-name { color: #bdb8d3; font-size: 10px; font-weight: 700; }

.studio-view .story-batch-gen-bar { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--atelier-line); }
.studio-view .story-batch-gen-btn { min-height: 36px; border-radius: 7px; font-size: 11px; }

.studio-view > .storyboard-progress-hub {
    grid-template-columns: 142px minmax(0, 1fr);
    min-height: 60px;
    margin: 0 0 clamp(76px, 9vw, 136px);
    padding: 9px 0;
    border-top: 1px solid var(--atelier-line);
    border-bottom: 1px solid var(--atelier-line);
    border-radius: 0;
    background: transparent;
}

.studio-view .storyboard-progress-hub-title { padding-left: 0; }
.studio-view .storyboard-progress-hub-title strong { color: #dcd7f3; font-size: 11px; }
.studio-view .storyboard-progress-hub-title span { color: #7f7898; font-size: 9px; }
.studio-view .storyboard-pages-band { padding-top: 0; }

.studio-view .storyboard-pages-head {
    min-height: 46px;
    margin-bottom: 37px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--atelier-line);
}

.studio-view .storyboard-chapter-tabs { gap: 6px; }
.studio-view .storyboard-chapter-tab,
.studio-view .storyboard-chapter-add { height: 30px; border-radius: 6px; font-size: 10px; }

.studio-view .storyboard-pages-export-actions .storyboard-export-btn {
    height: 30px;
    border-radius: 5px;
    color: #b7b0d6;
    font-size: 10px;
}

.studio-view .storyboard-automation-bar {
    gap: 12px 42px;
    margin-bottom: 46px;
    padding-bottom: 20px;
    border-bottom-color: var(--atelier-line);
}

.studio-view .storyboard-material-batch-actions,
.studio-view .storyboard-video-batch-actions { gap: 7px; }

.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 5px;
    font-size: 10px;
}

.studio-view .shot-list { gap: clamp(62px, 8vw, 118px); }

.studio-view .shot-row {
    grid-template-columns: 46px minmax(0, 1.1fr) 20px minmax(0, 0.92fr) 20px minmax(0, 0.92fr);
    gap: clamp(12px, 1.8vw, 28px);
    padding-right: 0;
}

.studio-view .shot-row::before {
    position: absolute;
    top: 54px;
    bottom: -88px;
    left: 22px;
    width: 1px;
    background: rgba(164, 144, 255, 0.2);
    content: "";
}

.studio-view .shot-row:last-child::before { display: none; }

.studio-view .shot-index-stack {
    position: relative;
    z-index: 1;
    width: 46px;
    padding: 5px 0;
}

.studio-view .shot-index-stack .shot-index {
    width: 35px;
    height: 35px;
    border: 1px solid rgba(208, 195, 255, 0.2);
    background: #24203a;
    box-shadow: 0 0 0 6px #090a11, 0 8px 20px rgba(104, 81, 217, 0.22);
    color: #eeeaff;
    font-size: 15px;
}

.studio-view .shot-continuity-tag { margin-top: 4px; color: #9187bb; font-size: 8px; }
.studio-view .flow-arrow { color: #8f80d3; font-size: 15px; }

.studio-view .shot-card {
    overflow: hidden;
    border-color: rgba(171, 154, 255, 0.16);
    border-radius: 14px 14px 5px 5px;
    background: rgba(14, 15, 24, 0.76);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.18);
    transition: border-color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.studio-view .shot-row:hover .shot-card {
    border-color: rgba(176, 157, 255, 0.35);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
}

.studio-view .shot-card > h3,
.studio-view .shot-card-title-row {
    min-height: 35px;
    padding-inline: 10px;
    border-bottom-color: rgba(176, 157, 255, 0.1);
}

.studio-view .shot-card h3 { color: #bcb5d8; font-size: 10px; font-weight: 800; }
.studio-view .shot-duration-editor { color: #8881a3; font-size: 9px; }
.studio-view .shot-duration-editor input { width: 38px; height: 24px; border-radius: 4px; font-size: 10px; }

.studio-view .shot-content,
.studio-view .shot-content.shot-reference-board,
.studio-view .shot-text { border-radius: 0; }

.studio-view .shot-content.shot-reference-board { background: #08090f; }
.studio-view .shot-reference-grid { gap: 7px; padding: 12px; }

.studio-view .shot-text p {
    padding: 14px;
    color: #bdb7d0;
    font-size: 11px;
    line-height: 1.82;
}

.studio-view .shot-source-tabs button { min-width: 70px; height: 28px; padding: 0 9px; font-size: 10px; }

.studio-view .add-shot {
    width: min(280px, 100%);
    min-height: 44px;
    margin-top: 46px;
    border: 1px dashed rgba(169, 150, 255, 0.34);
    border-radius: 7px;
    background: transparent;
    color: #ae9bff;
    box-shadow: none;
    font-size: 11px;
}

.studio-view .add-shot span { font-size: 22px; }

@media (min-width: 721px) and (max-width: 1190px) {
    .topbar-actions { max-width: none; flex-wrap: nowrap; }
}

@media (max-width: 1120px) {
    .studio-view { padding-inline: 42px; }
    .studio-view .story-top-grid { grid-template-columns: minmax(0, 1fr) 258px; gap: 28px; }
    .studio-view .storyboard-composer { padding: 23px; }
    .studio-view .storyboard-action-buttons { justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 900px) {
    .studio-view { padding-inline: 30px; }
    .studio-view::before,
    .studio-view .basic-script-band::before,
    .studio-view .storyboard-pages-band::before { display: none; }
    .studio-view .story-top-grid { grid-template-columns: 1fr; gap: 22px; }
    .studio-view .story-role-panel { position: static; max-height: none; }
    .studio-view .story-role-grid { grid-template-columns: repeat(5, minmax(62px, 1fr)); max-height: 220px; }
    .studio-view .shot-row { grid-template-columns: 42px minmax(0, 1fr); }
    .studio-view .flow-arrow { display: none; }
}

@media (max-width: 720px) {
    .topbar { padding-inline: 12px; }
    .studio-view { padding: 26px 0 86px; }
    .studio-view .basic-script-band { margin-bottom: 58px; }
    .studio-view .basic-script-head h2,
    .studio-view .storyboard-pages-head h2 { font-size: 22px; }
    .studio-view .storyboard-composer,
    .studio-view .story-role-panel { border-radius: 13px 13px 5px 5px; padding: 17px; }
    .studio-view .storyboard-composer-head,
    .studio-view .storyboard-pages-head { align-items: flex-start; flex-wrap: wrap; }
    .studio-view .storyboard-generation-counts,
    .studio-view .storyboard-pages-export-actions { width: 100%; flex-wrap: wrap; }
    .studio-view .storyboard-script-composer > textarea { min-height: 242px; padding: 19px; }
    .studio-view .story-role-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .studio-view .shot-row::before { bottom: -74px; }
}

/* Production-workbench corrections: alignment, hierarchy, and real material. */
.studio-view {
    isolation: isolate;
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-repeat: repeat;
    background-size: 960px auto;
    background-blend-mode: soft-light;
}

.studio-view::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(5, 5, 9, 0.72);
    content: "";
    pointer-events: none;
}

.studio-view .story-top-grid { align-items: start; }

.studio-view .story-role-panel {
    position: relative;
    top: auto;
    align-self: start;
    min-height: 530px;
}

.studio-view .storyboard-composer-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.studio-view .storyboard-title-row { min-width: 0; }
.studio-view .storyboard-generation-counts { justify-content: flex-end; }

.studio-view .storyboard-actions {
    border-top: 1px solid rgba(184, 168, 255, 0.1);
    padding-top: 13px;
}

.studio-view .storyboard-action-buttons {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
}

.studio-view .storyboard-ai-btn-preserved { display: none; }
.studio-view .story-processing-method-picker { justify-self: start; }

.studio-view .storyboard-generation-buttons {
    justify-self: end;
    display: flex;
    align-items: center;
}

.studio-view .storyboard-generation-buttons .prompt-agent-process,
.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .story-batch-gen-btn,
.studio-view .storyboard-pages-export-actions .storyboard-to-director-btn {
    border: 1px solid rgba(204, 195, 255, 0.28);
    background: #7659e8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px rgba(94, 67, 208, 0.22);
    color: #ffffff;
}

.studio-view .storyboard-generation-buttons .prompt-agent-process:hover,
.studio-view .storyboard-automation-bar .primary-btn:hover,
.studio-view .story-batch-gen-btn:hover,
.studio-view .storyboard-pages-export-actions .storyboard-to-director-btn:hover {
    background: #8568f3;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 12px 28px rgba(112, 83, 234, 0.34);
}

.studio-view .storyboard-generation-buttons .prompt-agent-process .prompt-agent-ai {
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
}

.studio-view .storyboard-automation-bar .secondary-btn,
.studio-view .storyboard-pages-export-actions .storyboard-export-btn:not(.storyboard-to-director-btn) {
    border: 1px solid rgba(181, 166, 255, 0.22);
    background: rgba(14, 15, 24, 0.74);
    box-shadow: none;
    color: #c7c0e6;
}

.studio-view .storyboard-automation-bar .secondary-btn:hover,
.studio-view .storyboard-pages-export-actions .storyboard-export-btn:not(.storyboard-to-director-btn):hover {
    border-color: rgba(190, 173, 255, 0.46);
    background: rgba(123, 96, 239, 0.12);
    color: #ffffff;
}

.studio-view .story-writer-toolbar .prompt-agent-process {
    min-height: 29px;
    padding-inline: 9px;
    border: 1px solid rgba(183, 168, 255, 0.25);
    border-radius: 5px;
    background: rgba(122, 93, 231, 0.48);
    box-shadow: none;
    font-size: 10px;
}

.studio-view .story-batch-gen-bar { display: grid; }
.studio-view .story-batch-gen-btn { width: 100%; justify-content: center; }

.studio-view .story-role-grid:empty::before {
    align-self: center;
    grid-column: 1 / -1;
    padding: 26px 12px;
    border: 1px dashed rgba(178, 161, 255, 0.22);
    border-radius: 8px;
    color: #8983a1;
    font-size: 11px;
    line-height: 1.7;
    text-align: center;
    content: "从剧本提取角色、场景和互动道具";
}

.studio-view .story-role-grid { min-height: 170px; }

.studio-view .storyboard-automation-bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
}

.studio-view .storyboard-automation-column { position: relative; padding: 0 20px 0 0; }

.studio-view .storyboard-automation-column + .storyboard-automation-column {
    padding: 0 0 0 20px;
    border-left: 1px solid rgba(178, 161, 255, 0.13);
}

.studio-view .storyboard-material-batch-actions,
.studio-view .storyboard-video-batch-actions { min-height: 36px; }

.studio-view .shot-row { align-items: start; }

.studio-view .shot-card {
    background-color: rgba(11, 12, 19, 0.86);
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-size: 620px auto;
    background-blend-mode: soft-light;
}

.studio-view .shot-card > * { position: relative; z-index: 1; }

.studio-view .shot-card::after {
    position: absolute;
    top: 0;
    right: 12px;
    width: 32px;
    height: 1px;
    background: rgba(182, 164, 255, 0.62);
    box-shadow: 0 0 9px rgba(167, 141, 255, 0.5);
    content: "";
}

.studio-view .shot-content,
.studio-view .shot-text { background-color: rgba(8, 9, 14, 0.9); }

@media (max-width: 900px) {
    .studio-view .story-role-panel { min-height: 0; }
    .studio-view .storyboard-action-buttons { grid-template-columns: 1fr; gap: 11px; }
    .studio-view .storyboard-generation-buttons { justify-self: start; }
}

@media (max-width: 720px) {
    .studio-view { background-size: 680px auto; }
    .studio-view .storyboard-composer-head { grid-template-columns: 1fr; gap: 11px; }
    .studio-view .storyboard-generation-counts { justify-content: flex-start; }
    .studio-view .storyboard-automation-bar { grid-template-columns: 1fr; }
    .studio-view .storyboard-automation-column,
    .studio-view .storyboard-automation-column + .storyboard-automation-column { padding: 0; border-left: 0; }
}

/* The writing area is the creation command surface: configuration stays left,
   the next irreversible action stays on the right. */
.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    border-color: rgba(181, 161, 255, 0.23);
    background-color: rgba(10, 10, 17, 0.76);
    background-image:
        linear-gradient(180deg, rgba(142, 113, 245, 0.08), transparent 132px),
        url("../img_static/studio-surface-texture-v1.png");
    background-size: auto, 720px auto;
    background-position: top left;
    background-blend-mode: screen, soft-light;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.035);
}

.studio-view .storyboard-composer {
    border-radius: 22px 22px 8px 22px;
    padding: 26px 26px 0;
}

.studio-view .story-role-panel {
    border-radius: 22px 22px 22px 8px;
    padding: 19px 18px 15px;
}

.studio-view .storyboard-composer::before,
.studio-view .story-role-panel::before {
    height: 2px;
    background: linear-gradient(90deg, rgba(174, 148, 255, 0.95), rgba(174, 148, 255, 0.16) 54%, transparent 76%);
    box-shadow: 0 0 18px rgba(146, 114, 248, 0.42);
}

.studio-view .storyboard-composer-head {
    min-height: 40px;
    padding: 0 1px 15px;
}

.studio-view .storyboard-composer-head h3,
.studio-view .story-role-head-row {
    letter-spacing: 0;
}

.studio-view .storyboard-composer-head h3 {
    color: #f2efff;
    font-size: 13px;
}

.studio-view .storyboard-title-row h3::after {
    display: inline-block;
    width: 28px;
    height: 1px;
    margin: 0 0 3px 9px;
    background: rgba(175, 152, 255, 0.74);
    content: "";
    vertical-align: middle;
}

.studio-view .storyboard-generation-counts {
    gap: 9px;
    padding: 4px 6px 4px 11px;
    border: 1px solid rgba(182, 164, 255, 0.14);
    border-radius: 12px 12px 4px 12px;
    background: rgba(6, 7, 13, 0.45);
}

.studio-view .storyboard-count-inline {
    gap: 5px;
    color: #a8a0c0;
    font-size: 10px;
    font-weight: 750;
}

.studio-view .storyboard-count-inline input {
    min-height: 27px;
    border-color: rgba(186, 169, 255, 0.16);
    border-radius: 7px 7px 3px 7px;
    background: rgba(2, 3, 7, 0.72);
    color: #ece8ff;
    font-size: 11px;
}

.studio-view .storyboard-script-composer {
    min-height: 306px;
    border-color: rgba(185, 167, 255, 0.2);
    border-radius: 14px 14px 5px 14px;
    background-color: rgba(4, 5, 10, 0.76);
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-size: 560px auto;
    background-blend-mode: soft-light;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 14px 32px rgba(0, 0, 0, 0.15);
}

.studio-view .storyboard-script-composer > textarea {
    min-height: 232px;
    padding: 21px 22px;
    color: #d9d4e9;
    font-size: 13px;
    line-height: 1.8;
}

.studio-view .storyboard-script-composer > textarea::placeholder { color: #7c7690; }

.studio-view .story-writer-toolbar {
    min-height: 46px;
    padding: 6px 11px;
    border-top-color: rgba(184, 165, 255, 0.12);
    background: rgba(20, 19, 32, 0.72);
}

.studio-view .story-writer-tool {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border: 1px solid transparent;
    border-radius: 8px 8px 3px 8px;
    color: #aaa1ce;
}

.studio-view .story-writer-tool:hover,
.studio-view .story-script-library-tool:hover {
    border-color: rgba(182, 164, 255, 0.23);
    background: rgba(128, 101, 231, 0.14);
    color: #ffffff;
}

.studio-view .story-writer-model { color: #77718b; font-size: 10px; }
.studio-view .story-script-library-tool { min-height: 29px; border-radius: 7px 7px 3px 7px; }
.studio-view .story-script-library-tool span { font-size: 10px; }

.studio-view .storyboard-actions {
    min-height: 66px;
    margin: 18px -26px 0;
    padding: 11px 26px 13px;
    border-top: 1px solid rgba(189, 171, 255, 0.15);
    background: rgba(8, 8, 14, 0.58);
}

.studio-view .storyboard-action-buttons {
    gap: 17px;
    padding: 0;
}

.studio-view .story-processing-method-picker {
    min-height: 37px;
    padding-left: 12px;
    border-left: 2px solid rgba(150, 118, 247, 0.78);
}

.studio-view .story-processing-method-trigger {
    min-height: 37px;
    gap: 7px;
    color: #9e96b5;
    font-size: 10px;
}

.studio-view .story-processing-method-trigger strong {
    color: #e5dfff;
    font-size: 11px;
}

.studio-view .storyboard-generation-buttons { gap: 9px; }

.studio-view .storyboard-generation-buttons .prompt-agent-process {
    position: relative;
    min-width: 112px;
    height: 38px;
    overflow: hidden;
    border-radius: 11px 11px 3px 11px;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0;
}

.studio-view #storyWriterGenerateBtn {
    border-color: rgba(185, 169, 255, 0.28);
    background: rgba(27, 25, 45, 0.92);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
    color: #d8d2ee;
}

.studio-view #storyWriterGenerateBtn:hover {
    border-color: rgba(190, 173, 255, 0.54);
    background: rgba(48, 40, 81, 0.94);
}

.studio-view #agentGenerateStoryboardBtn {
    min-width: 128px;
    border-color: rgba(221, 212, 255, 0.36);
    background: #775be8;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.23), 0 10px 22px rgba(86, 61, 205, 0.3);
}

.studio-view #agentGenerateStoryboardBtn::after,
.studio-view .story-batch-gen-btn::after {
    position: absolute;
    right: 8px;
    bottom: 7px;
    width: 12px;
    height: 1px;
    background: rgba(255, 255, 255, 0.48);
    content: "";
}

.studio-view #agentGenerateStoryboardBtn:hover {
    background: #8569f0;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.28), 0 13px 28px rgba(86, 61, 205, 0.38);
}

.studio-view .story-role-head {
    padding-bottom: 13px;
    border-bottom: 1px solid rgba(185, 167, 255, 0.12);
}

.studio-view .story-asset-tabs {
    padding: 3px;
    border: 1px solid rgba(185, 167, 255, 0.12);
    border-radius: 10px 10px 3px 10px;
    background: rgba(3, 4, 8, 0.42);
}

.studio-view .story-asset-tabs button {
    min-width: 45px;
    min-height: 27px;
    border-radius: 7px 7px 2px 7px;
    color: #8f87aa;
    font-size: 10px;
}

.studio-view .story-asset-tabs button.is-active {
    background: rgba(127, 98, 237, 0.24);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
    color: #f2efff;
}

.studio-view .story-role-head-actions .prompt-reset-link {
    color: #9d95b9;
    font-size: 10px;
}

.studio-view .story-role-grid {
    align-content: start;
    min-height: 315px;
    padding: 18px 1px 16px;
}

.studio-view .story-role-grid:empty::before {
    background: rgba(8, 8, 14, 0.45);
    color: #89829e;
}

.studio-view .story-batch-gen-bar { padding-top: 8px; border-top: 1px solid rgba(185, 167, 255, 0.12); }

.studio-view .story-batch-gen-btn {
    position: relative;
    min-height: 40px;
    overflow: hidden;
    border-radius: 11px 11px 3px 11px;
    font-size: 11px;
}

.studio-view .storyboard-pages-band { margin-top: 74px; }

.studio-view .storyboard-pages-head {
    min-height: 52px;
    padding-bottom: 13px;
    border-bottom: 1px solid rgba(186, 168, 255, 0.13);
}

.studio-view .storyboard-pages-head h2 { font-size: 18px; }

.studio-view .storyboard-chapter-tabs {
    align-self: stretch;
    padding: 3px;
    border: 1px solid rgba(184, 166, 255, 0.12);
    border-radius: 11px 11px 4px 11px;
    background: rgba(5, 6, 11, 0.35);
}

.studio-view .storyboard-automation-bar {
    margin-top: 18px;
    padding: 12px 0;
    border-top: 1px solid rgba(187, 169, 255, 0.1);
    border-bottom: 1px solid rgba(187, 169, 255, 0.1);
    border-radius: 0;
    background: rgba(5, 6, 11, 0.28);
}

.studio-view .storyboard-automation-bar .primary-btn,
.studio-view .storyboard-automation-bar .secondary-btn,
.studio-view .storyboard-pages-export-actions .storyboard-export-btn {
    min-height: 34px;
    border-radius: 9px 9px 3px 9px;
    font-size: 10px;
}

@media (prefers-reduced-motion: no-preference) {
    .studio-view .storyboard-generation-buttons .prompt-agent-process,
    .studio-view .story-batch-gen-btn,
    .studio-view .story-writer-tool,
    .studio-view .story-role-panel {
        transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
    }

    .studio-view .storyboard-generation-buttons .prompt-agent-process:hover,
    .studio-view .story-batch-gen-btn:hover { transform: translateY(-1px); }
}

@media (max-width: 900px) {
    .studio-view .storyboard-composer { padding: 22px 22px 0; }
    .studio-view .storyboard-actions { margin-inline: -22px; padding-inline: 22px; }
    .studio-view .story-role-grid { min-height: 200px; }
}

@media (max-width: 720px) {
    .studio-view .storyboard-composer { padding: 18px 18px 0; }
    .studio-view .story-role-panel { padding: 16px; }
    .studio-view .storyboard-actions { margin-inline: -18px; padding: 11px 18px 13px; }
    .studio-view .storyboard-generation-buttons { width: 100%; }
    .studio-view .storyboard-generation-buttons .prompt-agent-tools { flex: 1; }
    .studio-view .storyboard-generation-buttons .prompt-agent-process { width: 100%; min-width: 0; }
    .studio-view .storyboard-pages-band { margin-top: 52px; }

    .topbar {
        grid-template-columns: max-content minmax(0, 1fr);
        gap: 8px;
        padding: 10px 12px 8px;
    }

    .main-nav {
        grid-column: 1 / -1;
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding-bottom: 3px;
        scrollbar-width: none;
    }

    .main-nav::-webkit-scrollbar { display: none; }

    .topbar-actions {
        grid-column: 2;
        grid-row: 1;
        width: auto;
        min-width: 0;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .topbar-actions .nav-task-status,
    .topbar-actions .nav-refresh-link { display: none; }

    .topbar-actions .nav-item-utility {
        min-width: 30px;
        padding-inline: 5px;
        font-size: 10px;
    }

    .nav-task-popover {
        right: 0;
        left: auto;
        width: min(340px, calc(100vw - 24px));
    }
}

/* Compact, persistent workflow rail: it reports progress without becoming a
   second toolbar or competing with the production controls below. */
.studio-view .story-workflow-rail {
    display: grid;
    grid-template-columns: repeat(var(--story-workflow-step-count, 4), minmax(0, 1fr));
    gap: 7px;
    max-width: 760px;
    margin: 0 0 18px;
    padding: 5px;
    border: 1px solid rgba(183, 164, 255, 0.14);
    border-radius: 14px 14px 4px 14px;
    background: rgba(5, 5, 10, 0.46);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.studio-view .story-workflow-rail-step {
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #8b849f;
    text-align: left;
    cursor: pointer;
}

.studio-view .story-workflow-rail-step:hover {
    border-color: rgba(183, 164, 255, 0.2);
    background: rgba(126, 98, 233, 0.08);
    color: #ddd6f6;
}

.studio-view .story-workflow-rail-index {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #fff;
    color: #6041bc;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.studio-view .story-workflow-rail-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.studio-view .story-workflow-rail-copy strong {
    overflow: visible;
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.studio-view .story-workflow-rail-copy small {
    color: var(--jian-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1;
}

.studio-view .story-workflow-rail-step.is-active {
    border-color: rgba(192, 176, 255, 0.35);
    background: rgba(119, 91, 232, 0.22);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 6px 18px rgba(95, 70, 205, 0.16);
    color: #f4f1ff;
}

.studio-view .story-workflow-rail-step.is-active small { color: #c6b8ff; }

.studio-view .story-workflow-rail-step.is-complete small { color: #78bba6; }

/* One small control language for the whole creative workflow. */
.studio-view :is(
    .storyboard-generation-buttons .prompt-agent-process,
    .story-batch-gen-btn,
    .storyboard-automation-bar .primary-btn,
    .storyboard-automation-bar .secondary-btn,
    .storyboard-pages-export-actions .storyboard-export-btn,
    .storyboard-shot-image-btn,
    .story-asset-head-btn
) {
    min-height: 28px !important;
    height: 28px;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: 11px !important;
    font-weight: 650;
    letter-spacing: 0;
}

.studio-view :is(
    .storyboard-generation-buttons .prompt-agent-process,
    .story-batch-gen-btn,
    .storyboard-automation-bar .primary-btn
) {
    border-color: rgba(221, 212, 255, 0.31) !important;
    background: var(--jian-button-fill) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.18), 0 7px 16px rgba(83, 60, 190, 0.2) !important;
    color: #ffffff !important;
}

.studio-view :is(
    .storyboard-automation-bar .secondary-btn,
    .storyboard-pages-export-actions .storyboard-export-btn,
    .storyboard-shot-image-btn,
    .story-asset-head-btn
) {
    border-color: rgba(182, 165, 255, 0.2) !important;
    background: var(--jian-panel-raised) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04) !important;
    color: #c9c2df !important;
}

.studio-view :is(
    .storyboard-generation-buttons .prompt-agent-process,
    .story-batch-gen-btn,
    .storyboard-automation-bar .primary-btn,
    .storyboard-automation-bar .secondary-btn,
    .storyboard-pages-export-actions .storyboard-export-btn,
    .storyboard-shot-image-btn,
    .story-asset-head-btn
):hover:not(:disabled) {
    transform: none;
}

.studio-view :is(
    .storyboard-generation-buttons .prompt-agent-process,
    .story-batch-gen-btn,
    .storyboard-automation-bar .primary-btn,
    .storyboard-automation-bar .secondary-btn,
    .storyboard-pages-export-actions .storyboard-export-btn,
    .storyboard-shot-image-btn,
    .story-asset-head-btn
):focus-visible,
.studio-view .story-workflow-rail-step:focus-visible {
    outline: 2px solid #bbaaff;
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .studio-view .story-workflow-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        max-width: none;
    }
}

/* App-wide material language. Page workflows remain distinct, but their
   controls, overlays and text now share the creative board's compact system. */
:root {
    --atelier-panel: rgba(14, 14, 22, 0.94);
    --atelier-control: rgba(27, 26, 40, 0.94);
    --atelier-control-hover: rgba(42, 35, 68, 0.96);
    --atelier-border: rgba(188, 174, 255, 0.16);
    --atelier-border-strong: rgba(190, 174, 255, 0.32);
    --atelier-text: #f1eef9;
    --atelier-muted: #a19bb2;
    --atelier-accent: #8061e5;
}

:is(.project-home, .library-view, .custom-workflow-view, .mine-view) {
    position: relative;
    isolation: isolate;
    background-color: #09090f;
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-position: center;
    background-size: 768px auto;
    color: var(--atelier-text);
}

:is(.project-home, .library-view, .custom-workflow-view, .mine-view)::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(6, 6, 11, 0.58);
    content: "";
    pointer-events: none;
}

:is(.project-home, .library-view, .custom-workflow-view, .mine-view) :is(h1, h2, h3) {
    color: var(--atelier-text);
    letter-spacing: 0;
}

:is(.project-home, .library-view, .custom-workflow-view, .mine-view) :is(p, small, label, span, em) {
    letter-spacing: 0;
}

.library-panel,
.custom-workflow-summary,
.custom-workflow-card,
.mine-header-band,
.mine-settings-panel,
.settings-category-tabs,
.project-card,
.project-new {
    border-color: var(--atelier-border);
    border-radius: 12px 12px 4px 12px;
    background-color: var(--atelier-panel);
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-size: 620px auto;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 18px 42px rgba(0, 0, 0, 0.2);
}

:is(.library-view, .custom-workflow-view, .mine-view) :is(.tab, .library-switch button, .settings-category-tab) {
    min-height: 31px;
    border-radius: 7px 7px 2px 7px;
    color: var(--atelier-muted);
    font-size: 11px;
    font-weight: 750;
}

:is(.library-view, .custom-workflow-view, .mine-view) :is(.tab.is-active, .library-switch button.is-active, .settings-category-tab.is-active) {
    background: rgba(128, 97, 229, 0.22);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
    color: #f7f4ff;
}

/* One compact action language for non-creative surfaces and all dialogs. */
:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) :is(.primary-btn, .secondary-btn, .ghost-btn) {
    min-height: 32px;
    height: 32px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 8px 8px 3px 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .primary-btn {
    border-color: rgba(221, 212, 255, 0.3);
    background: #7559df;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.16), 0 7px 16px rgba(77, 55, 180, 0.2);
    color: #fff;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .secondary-btn,
:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .ghost-btn {
    border-color: var(--atelier-border);
    background: var(--atelier-control);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
    color: #d2cce5;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .danger-btn {
    min-height: 32px;
    height: 32px;
    padding: 0 11px;
    border: 1px solid rgba(255, 150, 174, 0.28);
    border-radius: 8px 8px 3px 8px;
    background: rgba(91, 34, 51, 0.78);
    color: #ffc1d0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) :is(.primary-btn, .secondary-btn, .ghost-btn):hover:not(:disabled) {
    background: var(--atelier-control-hover);
    filter: none;
    transform: translateY(-1px);
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .primary-btn:hover:not(:disabled) {
    background: #876bea;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) .danger-btn:hover:not(:disabled) {
    background: rgba(124, 43, 66, 0.9);
    filter: none;
    transform: translateY(-1px);
}

/* Overlay mechanics: short tips are dismissible, dialogs are always visibly closable. */
.modal-backdrop,
.cloud-ad-backdrop {
    padding: 20px;
    background: rgba(3, 3, 7, 0.76);
    backdrop-filter: blur(8px);
}

.modal-backdrop.dim { background: rgba(2, 2, 6, 0.82); }

.modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal),
.modal-backdrop > .dialog,
.cloud-ad-content {
    border: 1px solid var(--atelier-border);
    border-radius: 12px 12px 4px 12px;
    background-color: var(--atelier-panel);
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-size: 680px auto;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 26px 72px rgba(0, 0, 0, 0.48);
    color: var(--atelier-text);
}

.modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal)::before,
.modal-backdrop > .dialog::before {
    position: absolute;
    top: 0;
    right: 14px;
    left: 14px;
    height: 1px;
    background: rgba(212, 201, 255, 0.36);
    content: "";
    pointer-events: none;
}

.modal-backdrop :is(h1, h2, h3, h4) {
    color: var(--atelier-text);
    font-size: clamp(16px, 1.35vw, 20px);
    font-weight: 820;
    letter-spacing: 0;
}

.modal-backdrop :is(p, small, label, .video-head p, .voice-head span) {
    color: var(--atelier-muted);
    font-size: 11px;
    letter-spacing: 0;
}

.modal-close,
.picker-close,
.global-notice-close {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--atelier-border);
    border-radius: 7px 7px 2px 7px;
    background: rgba(23, 22, 34, 0.96);
    box-shadow: none;
    color: #c7c0dc;
    font-size: 20px;
    line-height: 1;
}

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

.modal-close:hover,
.picker-close:hover,
.global-notice-close:hover {
    border-color: var(--atelier-border-strong);
    background: rgba(57, 45, 89, 0.95);
    color: #fff;
}

.modal-backdrop :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
    min-height: 34px;
    border: 1px solid var(--atelier-border);
    border-radius: 7px 7px 2px 7px;
    background: rgba(9, 9, 15, 0.76);
    color: var(--atelier-text);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    letter-spacing: 0;
}

.modal-backdrop textarea { padding: 10px 11px; }

.modal-backdrop :is(input, select, textarea):focus-visible {
    border-color: rgba(190, 174, 255, 0.65);
    box-shadow: 0 0 0 2px rgba(128, 97, 229, 0.16);
    outline: none;
}

.modal-backdrop .modal-tabs,
.modal-backdrop .video-flow-tabs,
.modal-backdrop .picker-tabs,
.modal-backdrop .picker-source-tabs {
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--atelier-border);
    border-radius: 8px 8px 3px 8px;
    background: rgba(7, 7, 12, 0.52);
}

.modal-backdrop :is(.modal-tabs button, .video-flow-tabs button, .picker-tabs button, .picker-source-tabs button) {
    min-height: 28px;
    padding: 0 9px;
    border-radius: 6px 6px 2px 6px;
    color: var(--atelier-muted);
    font-size: 10px;
    font-weight: 760;
}

.modal-backdrop :is(.modal-tabs button.is-active, .video-flow-tabs button.is-active, .picker-tabs button.is-active, .picker-source-tabs button.is-active) {
    background: rgba(128, 97, 229, 0.28);
    color: #f8f5ff;
}

.modal-backdrop .modal-footer {
    min-height: 54px;
    padding: 10px 14px;
    border-top-color: var(--atelier-border);
    background: rgba(8, 8, 13, 0.76);
}

.modal-backdrop .host-pill {
    min-height: 30px;
    border: 1px solid var(--atelier-border);
    border-radius: 7px 7px 2px 7px;
    background: rgba(20, 20, 31, 0.92);
    color: #bcb5d0;
    font-size: 10px;
}

.toast {
    z-index: 10000020;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(460px, calc(100vw - 32px));
    padding: 9px 10px 9px 13px;
    border-radius: 10px 10px 3px 10px;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0;
    pointer-events: auto;
}

.toast-message { flex: 1; min-width: 0; }

.toast-close {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    padding: 0;
    border: 1px solid rgba(218, 209, 255, 0.18);
    border-radius: 5px 5px 2px 5px;
    background: rgba(255, 255, 255, 0.04);
    color: currentColor;
    font-size: 16px;
    line-height: 1;
}

.toast-close:hover { background: rgba(255, 255, 255, 0.12); }

.global-notice {
    z-index: 10000010;
    min-width: 0;
    width: min(620px, calc(100vw - 28px));
    gap: 10px;
    padding: 10px 11px 10px 14px;
    border-color: var(--atelier-border-strong);
    border-radius: 10px 10px 3px 10px;
    background-color: rgba(14, 14, 22, 0.98);
    background-image: url("../img_static/studio-surface-texture-v1.png");
    background-size: 520px auto;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 18px 44px rgba(0, 0, 0, 0.38);
}

.global-notice-copy strong { font-size: 12px; }
.global-notice-copy span { font-size: 10px; }
.global-notice-link { min-height: 30px; padding: 0 10px; border-radius: 7px 7px 2px 7px; font-size: 10px; }
.global-notice-close { position: static; flex: 0 0 26px; width: 26px; height: 26px; font-size: 17px; }

@media (max-width: 720px) {
    .modal-backdrop,
    .cloud-ad-backdrop { padding: 10px; }

    .modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal),
    .modal-backdrop > .dialog { border-radius: 10px 10px 3px 10px; }

    .modal-backdrop .modal-actions { gap: 8px; margin: 16px 0 0; }
    .global-notice { top: 10px; }
}

/* Neutral glass surfaces share the same violet action accents across modules. */
:root {
    --atelier-panel: var(--jian-panel);
    --atelier-panel-raised: var(--jian-panel-raised);
    --atelier-control: var(--jian-panel-raised);
    --atelier-control-hover: var(--jian-control-hover);
    --atelier-border: var(--jian-line);
    --atelier-border-strong: var(--jian-accent-line);
    --atelier-line: var(--jian-line);
    --atelier-line-strong: var(--jian-accent-line);
    --atelier-text: var(--jian-ink);
    --atelier-muted: var(--jian-muted);
    --atelier-ink-muted: var(--jian-muted);
    --atelier-violet: var(--jian-accent-text);
    --atelier-accent: var(--jian-accent);
}

body,
:is(.project-home, .library-view, .custom-workflow-view, .mine-view),
.studio-view {
    background-color: var(--jian-bg);
    background-image: none;
    background-repeat: no-repeat;
    background-size: cover;
}

:is(.project-home, .library-view, .custom-workflow-view, .mine-view)::before,
.studio-view::after {
    background: transparent;
}

/* The numbered writing-mode marks compete with actual storyboard numbering. */
.studio-view::before,
.studio-view .basic-script-band::before,
.studio-view .storyboard-pages-band::before {
    display: none;
    content: none;
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel,
.studio-view .shot-card,
.library-panel,
.custom-workflow-summary,
.custom-workflow-card,
.mine-header-band,
.mine-panel,
.mine-settings-panel,
.settings-category-tabs,
.project-card,
.project-new {
    border: 1px solid var(--jian-line);
    border-radius: 10px;
    background-color: var(--jian-panel);
    background-image: var(--jian-surface-light);
    background-blend-mode: normal;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        var(--jian-shadow);
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    border-radius: 14px;
}

.studio-view .shot-card {
    border-radius: 10px;
}

.studio-view .shot-card::after,
.studio-view .storyboard-composer::before,
.studio-view .story-role-panel::before {
    background: linear-gradient(90deg, rgba(173, 151, 241, 0.5), transparent);
    box-shadow: none;
}

.studio-view .shot-content,
.studio-view .shot-text,
.studio-view .shot-content.shot-reference-board,
.studio-view .storyboard-script-composer {
    background-color: var(--jian-control);
    background-image: none;
    background-blend-mode: normal;
}

.studio-view .story-writer-toolbar,
.studio-view .storyboard-actions,
.studio-view .shot-split-actions,
.studio-view .shot-video-view-tabs {
    background: var(--jian-panel-raised);
    border-color: var(--jian-line);
}

/* Split-card controls must have a dependable grid and enough room for actions. */
.studio-view .shot-split-actions,
.studio-view .shot-video-actions,
.studio-view .shot-reference-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 10px;
}

.studio-view .shot-video-actions {
    grid-template-columns: minmax(0, 1fr) auto;
}

.studio-view .shot-split-actions .shot-action,
.studio-view .shot-video-actions .shot-action,
.studio-view .shot-split-actions .prompt-agent-process {
    min-width: 0;
    min-height: 32px;
    margin: 0;
    border-radius: 7px;
    font-size: 11px;
    white-space: nowrap;
}

.studio-view .shot-video-details-action {
    justify-content: flex-start;
    gap: 7px;
    overflow: hidden;
}

.studio-view .shot-video-details-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-view .shot-storyboard-regenerate-action,
.studio-view .shot-video-repeat-action,
.studio-view .shot-action-secondary {
    width: auto;
    padding-inline: 13px;
}

.studio-view .delete-shot {
    right: 10px;
    bottom: 9px;
    z-index: 6;
    width: 30px;
    height: 30px;
    border: 1px solid var(--jian-line);
    border-radius: 7px;
    background: var(--jian-panel-raised);
    color: var(--jian-muted);
}

.studio-view .delete-shot:hover {
    border-color: rgba(255, 126, 172, 0.7);
    background: rgba(99, 29, 61, 0.58);
    color: #ffd4e4;
}

/* Shared dialogs retain the same glass planes without becoming oversized. */
.modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal),
.modal-backdrop > .dialog,
.cloud-ad-content,
.global-notice {
    border-color: var(--jian-line-hover);
    background-color: var(--jian-panel);
    background-image: var(--jian-surface-light);
    background-blend-mode: normal;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        0 28px 80px rgba(0, 0, 0, 0.54);
}

.modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal)::before,
.modal-backdrop > .dialog::before {
    background: linear-gradient(90deg, rgba(173, 151, 241, 0.45), transparent 78%);
}

.modal-backdrop :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) {
    min-height: 30px;
    height: 30px;
    padding-inline: 9px;
    font-size: 11px;
}

.modal-backdrop textarea {
    min-height: 112px;
    padding: 10px 11px;
}

.modal-backdrop .modal-footer,
.modal-backdrop .modal-actions {
    gap: 9px;
}

.modal-backdrop .modal-footer :is(.primary-btn, .secondary-btn, .ghost-btn),
.modal-backdrop .modal-actions :is(.primary-btn, .secondary-btn, .ghost-btn) {
    min-width: 88px;
}

/* The task menu lives at the right end of the top bar; anchoring it from the
   left made even its hidden state widen the document on desktop. */
.topbar-actions .nav-task-popover {
    right: 0;
    left: auto;
    width: min(360px, calc(100vw - 24px));
}

/* One spacing grid connects workflow, script, materials and shot controls. */
.studio-view {
    --studio-gap: 16px;
    --studio-inset: 16px;
    display: grid;
    gap: 24px;
    padding: 8px 16px 40px;
}

.studio-view .basic-script-band {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.studio-view .story-workflow-rail {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 3px;
}

.studio-view .basic-script-head {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    position: static;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.studio-view .basic-script-exit-btn {
    min-height: 30px;
    padding-inline: 12px;
    border-radius: 7px;
    font-size: 10px;
}

.studio-view .story-top-grid {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: stretch;
    gap: var(--studio-gap);
    margin: 0;
}

.studio-view .storyboard-composer,
.studio-view .story-role-panel {
    align-self: stretch;
    min-height: 0;
    gap: 12px;
    padding: var(--studio-inset);
}

.studio-view .storyboard-composer {
    padding-bottom: 0;
}

.studio-view .story-role-panel {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    contain: size;
}

.studio-view .storyboard-composer-head,
.studio-view .story-role-head,
.studio-view .story-role-head-row {
    min-height: 36px;
    align-items: center;
    margin: 0;
    padding: 0;
    border: 0;
}

.studio-view .storyboard-composer-head,
.studio-view .story-role-head-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.studio-view .storyboard-title-row h3::before,
.studio-view .storyboard-title-row h3::after,
.studio-view .story-role-head-row::before {
    display: none;
}

.studio-view .storyboard-generation-counts {
    flex-wrap: wrap;
    max-width: 100%;
    padding: 3px 6px;
}

.studio-view .storyboard-script-composer {
    min-height: 0;
    border-radius: 8px;
}

.studio-view .storyboard-script-composer > textarea {
    height: 200px;
    min-height: 180px;
    padding: 12px;
    line-height: 1.7;
}

.studio-view .story-writer-toolbar {
    min-height: 40px;
    padding: 4px 8px;
}

.studio-view .storyboard-actions {
    min-height: 52px;
    margin: 0 calc(-1 * var(--studio-inset));
    padding: 9px var(--studio-inset);
    border-radius: 0 0 14px 14px;
}

.studio-view .storyboard-action-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.studio-view .story-processing-method-picker {
    min-height: 32px;
    padding-left: 0;
    border-left: 0;
}

.studio-view .story-processing-method-trigger {
    min-height: 32px;
}

.studio-view .storyboard-generation-buttons {
    margin-left: auto;
}

.studio-view .story-role-grid {
    min-height: 0;
    max-height: none;
    padding: 0;
    gap: 12px 8px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.studio-view .story-batch-gen-bar {
    min-height: 52px;
    width: auto;
    margin: 0 calc(-1 * var(--studio-inset));
    padding: 9px var(--studio-inset);
    border-radius: 0 0 14px 14px;
    background: var(--jian-panel-raised);
}

.studio-view .story-role-panel:has(.story-batch-gen-bar:not(.is-hidden)) {
    padding-bottom: 0;
}

.studio-view > .storyboard-progress-hub {
    min-height: 48px;
    margin: 0;
    padding: 8px 0;
}

.studio-view .storyboard-pages-band {
    margin: 0;
    padding: 0;
}

.studio-view .storyboard-pages-head {
    min-height: 40px;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding-bottom: 8px;
}

.studio-view .storyboard-automation-bar {
    gap: 12px 16px;
    margin: 0 0 8px;
    padding: 10px 12px;
}

.studio-view .storyboard-automation-column,
.studio-view .storyboard-automation-column + .storyboard-automation-column {
    padding: 0;
    border-left: 0;
}

.studio-view .storyboard-media-mode-radios {
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px;
}

.studio-view .storyboard-media-mode-radio {
    min-height: 28px;
    padding: 0 6px;
}

.studio-view .storyboard-dialogue-check-bar #generateCurrentStoryVideosBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
}

.studio-view #generateAllStoryVideosBtn {
    flex: 0 1 160px;
    width: 160px;
    max-width: 100%;
    margin-left: auto;
}

.studio-view .storyboard-dialogue-check-bar {
    display: flex;
    justify-content: flex-end;
    min-height: 36px;
    padding: 0 0 6px;
}

.studio-view .storyboard-dialogue-check-all {
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
    padding-inline: 12px;
}

body .studio-view :is(#storyWriterGenerateBtn, #agentGenerateStoryboardBtn, #storyAssetBatchGenBtn, #storyboardReextractAssetsBtn, #generateAllStoryImagesBtn, #generateAllStoryVideosBtn) {
    position: relative;
    gap: 8px;
    padding: 0 12px 0 36px !important;
}

body .studio-view :is(#storyWriterGenerateBtn, #agentGenerateStoryboardBtn, #storyAssetBatchGenBtn, #storyboardReextractAssetsBtn, #generateAllStoryImagesBtn, #generateAllStoryVideosBtn)::before {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    color: #6041bc;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    pointer-events: none;
}

.studio-view #storyWriterGenerateBtn::before { content: "1"; }
.studio-view #agentGenerateStoryboardBtn::before { content: "2"; }
.studio-view #storyAssetBatchGenBtn::before { content: "3"; }
.studio-view #storyboardReextractAssetsBtn::before { content: "3"; }
.studio-view #generateAllStoryImagesBtn::before { content: "4"; }
.studio-view #generateAllStoryVideosBtn::before { content: "4"; }
.studio-view.is-shot-image-workflow #generateAllStoryVideosBtn::before { content: "5"; }

.studio-view :is(#storyWriterGenerateBtn, #agentGenerateStoryboardBtn, #storyAssetBatchGenBtn, #storyboardReextractAssetsBtn, #generateAllStoryVideosBtn) > :is(.prompt-agent-ai, .story-automation-action-icon) {
    display: none !important;
}

.studio-view :is(#storyWriterGenerateBtn, #agentGenerateStoryboardBtn, #storyAssetBatchGenBtn, #storyboardReextractAssetsBtn, #generateAllStoryVideosBtn)::after {
    display: none;
}

.studio-view .shot-list {
    gap: 24px;
}

.studio-view .shot-row::before {
    left: 23px;
    bottom: 8px;
}

.studio-view .shot-insert-between {
    top: -12px;
    left: 23px;
    width: 32px;
    height: 32px;
    opacity: 1;
    background: var(--jian-panel);
    color: var(--jian-muted);
    border-color: var(--jian-line-hover);
    box-shadow: 0 0 0 3px var(--jian-bg);
}

.studio-view .shot-insert-between:hover {
    background: var(--jian-control-hover);
    color: var(--jian-ink);
    border-color: var(--jian-accent-line);
}

.studio-view .add-shot {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    min-height: 42px;
    margin-top: 16px;
    padding: 8px 16px;
    line-height: 1.4;
}

.studio-view .add-shot strong { margin: 0; line-height: 1.4; font-size: 11px; }

.studio-view .add-shot span {
    margin: 0;
    font-size: 16px;
    line-height: 1;
}

@media (max-width: 900px) {
    .studio-view .basic-script-band {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .studio-view .story-workflow-rail {
        grid-column: 1;
    }

    .studio-view .basic-script-head {
        grid-column: 2;
    }

    .studio-view .story-top-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .studio-view .story-role-panel {
        contain: none;
        grid-template-rows: auto minmax(0, 1fr) auto;
        max-height: 340px;
    }

    .studio-view .story-role-grid {
        max-height: 210px;
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }
}

@media (max-width: 620px) {
    .studio-view {
        --studio-inset: 12px;
        padding-inline: 0;
        gap: 20px;
    }

    .studio-view .basic-script-band {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .studio-view .basic-script-head {
        grid-column: 1;
        grid-row: 2;
    }

    .studio-view .story-top-grid {
        grid-row: 3;
    }

    .studio-view .storyboard-composer-head {
        flex-wrap: wrap;
        gap: 8px;
    }

    .studio-view .storyboard-action-buttons {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
}

@media (max-width: 1160px) {
    .studio-view .shot-row {
        grid-template-columns: 42px minmax(0, 1fr) 16px minmax(0, 0.94fr) 16px minmax(0, 0.94fr);
        gap: 12px;
    }

    .studio-view .shot-insert-between,
    .studio-view .shot-row::before {
        left: 21px;
    }
}

@media (max-width: 900px) {
    .studio-view .shot-row {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 12px 10px;
    }

    .studio-view .shot-index-stack {
        grid-column: 1;
        grid-row: 1 / span 3;
        align-self: start;
        width: 40px;
        padding-top: 8px;
    }

    .studio-view .shot-row > .shot-card {
        grid-column: 2;
        width: 100%;
    }

    .studio-view .shot-row > .flow-arrow {
        display: none;
    }

    .studio-view .shot-insert-between,
    .studio-view .shot-row::before {
        left: 20px;
    }

    .studio-view .shot-split-actions,
    .studio-view .shot-video-actions,
    .studio-view .shot-reference-actions {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

@media (max-width: 620px) {
    .studio-view .shot-split-actions,
    .studio-view .shot-video-actions,
    .studio-view .shot-reference-actions {
        grid-template-columns: 1fr;
    }

    .studio-view .shot-split-actions .shot-action,
    .studio-view .shot-video-actions .shot-action,
    .studio-view .shot-split-actions .prompt-agent-process {
        width: 100%;
    }
}

/* Image generator: one continuous glass sheet.  The old texture rule left its
   680px repeat size behind after the gradient replacement, which created the
   visible two-tone split in wide dialogs. */
.modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal),
.modal-backdrop > .dialog,
.cloud-ad-content,
.global-notice {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
}

.modal-backdrop :is(.primary-btn, .secondary-btn, .ghost-btn, .danger-btn) {
    border-radius: 8px;
}

#imageModal .generate-modal {
    grid-template-rows: auto minmax(0, 1fr) auto;
    border-radius: 12px;
    background-color: var(--jian-panel);
    background-image: var(--jian-surface-light);
    background-size: cover;
    background-repeat: no-repeat;
    overflow: hidden;
}

.modal-backdrop > :is(.voice-modal, .video-modal, .music-modal) {
    grid-template-rows: minmax(0, 1fr) auto;
}

#imageModal .modal-grid,
#imageModal .control-col,
#imageModal .preview-col,
#imageModal .image-modal-top-tabs {
    background: transparent;
}

#imageModal .image-modal-top-tabs {
    padding: 12px 16px 0;
}

#imageModal .modal-grid {
    gap: 16px;
    padding: 14px 16px 16px;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    overflow-x: hidden;
}

#imageModal :is(.control-col, .preview-col) {
    min-width: 0;
}

#imageModal .modal-tabs {
    overflow: hidden;
    border: 1px solid var(--jian-line);
    border-radius: 8px;
    background: var(--jian-control);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

#imageModal .modal-tabs button {
    border-radius: 0;
    background: transparent;
    color: var(--jian-muted);
}

#imageModal .modal-tabs button.is-active {
    background: var(--jian-accent-soft);
    color: var(--jian-accent-text);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

#imageModal :is(.image-qwen-parameters, .lora-panel, .prompt-box) {
    border: 1px solid var(--jian-line);
    border-radius: 8px;
    background: var(--jian-control);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

#imageModal .image-qwen-parameters {
    padding: 11px 12px;
}

#imageModal .lora-panel {
    margin-top: 12px;
}

#imageModal .lora-panel summary {
    min-height: 40px;
}

#imageModal .lora-panel-body {
    padding: 0 10px 10px;
}

#imageModal .lora-custom-item,
#imageModal .lora-empty-item {
    border: 1px solid var(--jian-line);
    border-radius: 7px;
    background: var(--jian-panel);
}

#imageModal :is(
    .size-row select,
    .size-row input,
    .image-model-select-control select,
    .image-qwen-parameters input,
    .lora-custom-item select,
    .lora-custom-item input,
    .prompt-output-language-select
) {
    border: 1px solid var(--jian-line-hover);
    border-radius: 7px;
    background-color: var(--jian-control);
    color: var(--jian-ink);
    box-shadow: none;
}

#imageModal :is(
    .size-row select,
    .size-row input,
    .image-model-select-control select,
    .image-qwen-parameters input,
    .lora-custom-item select,
    .lora-custom-item input
):hover,
#imageModal :is(
    .size-row select,
    .size-row input,
    .image-model-select-control select,
    .image-qwen-parameters input,
    .lora-custom-item select,
    .lora-custom-item input,
    .prompt-output-language-select
):focus {
    border-color: var(--jian-accent-line);
    outline: none;
}

#imageModal .prompt-box {
    overflow: hidden;
}

#imageModal .prompt-box textarea {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--jian-ink);
}

#imageModal .prompt-box textarea::placeholder {
    color: var(--jian-faint);
}

#imageModal .modal-footer {
    border-top-color: var(--jian-line);
    border-radius: 0;
    background: var(--jian-panel);
}

#imageModal .image-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: min(320px, 40vw);
    border: 1px solid var(--jian-line);
    border-radius: 9px;
    background: #050506;
}

.topbar {
    background: rgba(9, 9, 11, 0.94);
    border-bottom-color: var(--jian-line);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.studio-view :is(.story-workflow-rail, .storyboard-automation-bar, .storyboard-chapter-tabs, .storyboard-generation-counts) {
    background: var(--jian-control);
    border-color: var(--jian-line);
    border-radius: 8px;
}

:is(.studio-view, .library-view, .custom-workflow-view, .mine-view, .modal-backdrop) :is(.secondary-btn, .ghost-btn) {
    border-color: var(--jian-line);
    color: #d5d3de;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop) :is(.primary-btn, .secondary-btn, .ghost-btn, .danger-btn) {
    padding-inline: 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    transform: none;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop) .primary-btn {
    background: var(--jian-button-fill);
    border-color: rgba(189, 166, 255, 0.28);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.12), 0 4px 12px rgba(61, 38, 122, 0.16);
}

:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop) :is(.primary-btn, .secondary-btn, .ghost-btn, .danger-btn):hover:not(:disabled) {
    transform: none;
}

.modal-backdrop :is(h1, h2, h3, h4) {
    font-size: 13px;
    font-weight: 650;
}

.modal-backdrop :is(.modal-close, .picker-close),
.global-notice-close {
    border-radius: 7px;
    background: var(--jian-panel-raised);
    color: var(--jian-muted);
}

.modal-backdrop :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
    border-color: var(--jian-line);
    border-radius: 7px;
    background-color: var(--jian-control);
    color: var(--jian-ink);
    font-weight: 500;
}

.modal-backdrop :is(.lora-panel, .image-qwen-parameters, .prompt-box, .prompt-input-wrap, .minimax-media-board) {
    border-color: var(--jian-line);
    background: var(--jian-control);
    border-radius: 8px;
}

.modal-backdrop :is(.modal-footer, .prompt-footer-tools, .video-modal-footer) {
    border-color: var(--jian-line);
    background: var(--jian-panel-raised);
}

.modal-backdrop :is(.dashed-upload, .lora-custom-item, .lora-empty-item, .reference-pick) {
    border-color: var(--jian-line-hover);
    background-color: var(--jian-panel-raised);
}

.modal-backdrop :is(.modal-tabs, .video-flow-tabs, .picker-tabs, .picker-source-tabs) {
    border-radius: 8px;
    background: var(--jian-control);
}

.modal-backdrop :is(.modal-tabs button, .video-flow-tabs button, .picker-tabs button, .picker-source-tabs button) {
    border-radius: 5px;
    height: 28px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 600;
}

.modal-backdrop :is(.prompt-agent-process, .lora-add-btn) {
    border-color: var(--jian-accent-line);
    background: var(--jian-accent-soft);
    color: var(--jian-accent-text);
    border-radius: 7px;
}

:is(.mine-view, .modal-backdrop) :is(input[type="checkbox"], input[type="radio"], input[type="range"]) {
    accent-color: var(--jian-accent);
}

.mine-view :is(.mine-field, .mine-ai-grid, .automation-parameter-fields) {
    min-width: 0;
}

.mine-view :is(.automation-parameter-group, .automation-image-task, .automation-cluster, .mine-mobile-access, .mine-ai-card, .mine-host-card) {
    border-color: var(--jian-line);
    background: var(--jian-panel);
    box-shadow: none;
    border-radius: 8px;
}

.mine-view :is(.mine-project-path, .mine-mobile-link, .automation-chain-step, .automation-optimization-step) {
    border-color: var(--jian-line);
    background: var(--jian-control);
    color: var(--jian-muted);
}

.mine-view :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
    min-width: 0;
    min-height: 36px;
    border-radius: 7px;
    background: var(--jian-control);
    color: var(--jian-ink);
    font-size: 12px;
    font-weight: 500;
}

.mine-view :is(input, select, textarea):not(.is-invalid) {
    border-color: var(--jian-line);
}

.mine-view :is(input, select, textarea):focus-visible {
    outline: 2px solid var(--jian-accent-line);
    outline-offset: 2px;
}

#mineAiPanel .mine-ai-grid {
    max-width: 1120px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 18px 20px;
}

#mineAiPanel .mine-field {
    min-width: 0;
    align-content: start;
    gap: 6px;
    font-size: 12px;
}

#mineAiPanel .mine-field > span {
    line-height: 18px;
}

#mineAiPanel :is(input:not([type="checkbox"]), select, .mine-ai-profile-action, .mine-model-help-trigger, .mine-actions button) {
    height: 32px;
    min-height: 32px;
    max-width: 100%;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1.4;
}

#mineAiPanel .mine-ai-profile-action {
    min-width: 48px;
}

#mineAiPanel :is(.mine-ai-field-note, .mine-ai-thinking-field small, .mine-ai-gpu-field small) {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
}

#mineAiPanel .mine-model-select-row {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) 32px;
    gap: 8px;
}

#mineAiPanel .mine-model-help-trigger {
    width: 32px;
    padding: 0;
}

#mineAiPanel .mine-model-help-trigger span {
    display: none;
}

#mineAiPanel .mine-ai-gpu-row {
    grid-template-columns: 1fr;
    gap: 6px;
}

#mineAiPanel :is(#settingsAiThinkingMode, #settingsAiLocalDevice) {
    max-width: 180px;
}

#mineAiPanel #settingsAiPort {
    max-width: 100px;
}

#mineAiPanel .mine-ai-parallel-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 32px;
}

#mineAiPanel .mine-ai-parallel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    cursor: pointer;
}

#mineAiPanel #settingsAiPromptParallel {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

#mineAiPanel #settingsAiPromptConcurrency {
    width: 86px;
    flex: 0 0 86px;
}

#mineAiPanel #settingsAiHostBadge[hidden] {
    display: none;
}

#mineAiPanel .mine-actions {
    margin-top: 18px;
    gap: 10px;
}

#mineAiPanel .mine-actions button {
    min-width: 88px;
    border-radius: 7px;
}

@media (max-width: 1100px) {
    #mineAiPanel .mine-ai-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    #mineAiPanel .mine-ai-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
}

.mine-view .settings-category-tab {
    min-height: 40px;
    gap: 8px;
    color: var(--jian-muted);
    font-size: 12px;
    font-weight: 600;
    border-radius: 7px;
}

.mine-view .settings-category-tab.is-active {
    border-color: var(--jian-accent-line);
    background: var(--jian-accent-soft);
    color: var(--jian-accent-text);
    box-shadow: none;
}

.modal-backdrop :is(.host-pill, .video-result-card, .video-progress-card, .video-result-stage, .music-preview-item, .audio-item) {
    background: var(--jian-panel-raised);
    border-color: var(--jian-line);
    border-radius: 8px;
}

.modal-backdrop .preview-tools button {
    border-color: var(--jian-line);
    background: var(--jian-panel-raised);
    color: var(--jian-muted);
    box-shadow: none;
}

.modal-backdrop .preview-tools button:hover:not(:disabled) {
    border-color: var(--jian-line-hover);
    background: var(--jian-control-hover);
    color: var(--jian-ink);
}

.modal-backdrop .preview-tools button.is-active {
    border-color: var(--jian-accent-line);
    background: var(--jian-accent-soft);
    color: var(--jian-accent-text);
}

@media (max-width: 900px) {
    .modal-backdrop > :is(.name-modal, .generate-modal, .voice-modal, .video-modal, .music-modal, .custom-workflow-run-modal, .modal-library-picker, .lightbox-modal, .auth-modal, .global-loading-modal),
    .modal-backdrop > .dialog {
        border-radius: 10px;
    }

    #imageModal .modal-grid {
        grid-template-columns: minmax(0, 1fr);
        padding: 16px;
    }

    #imageModal .image-size-control-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .modal-backdrop :is(.prompt-heading, .prompt-tools) {
        flex-wrap: wrap;
    }

    .modal-backdrop .prompt-heading {
        gap: 8px;
        margin-bottom: 8px;
    }

    .modal-backdrop .prompt-heading :is(h2, h3) {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .modal-backdrop .prompt-tools {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .modal-backdrop .modal-footer > div {
        flex-wrap: wrap;
    }

    #imageModal .image-modal-top-tabs {
        padding: 14px 46px 0 16px;
    }

    #imageModal .modal-tabs-centered-wide {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    #imageModal .modal-tabs button {
        min-width: 0;
        height: 28px;
    }

    #imageModal .modal-footer > div {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        max-width: 100%;
    }

    #imageModal .modal-footer > div > button {
        min-width: 0;
        padding-inline: 6px;
    }
}

/* Workflow controls share the same numbering and column geometry as the shots. */
.studio-view .story-workflow-run-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--jian-accent-line);
    border-radius: 7px;
    background: var(--jian-button-fill);
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
}

.automation-video-check-settings { grid-column: 1 / -1; }
.automation-check-description { margin: -4px 0 0; color: var(--jian-muted); font-size: 11px; line-height: 1.5; }
.automation-check-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; min-width: 0; margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--jian-line); }
.automation-check-options legend { padding: 0 8px 0 0; color: var(--jian-muted); font-size: 11px; }
.automation-check-options label, .automation-check-unavailable { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; line-height: 1.5; }
.automation-check-options input, .automation-check-unavailable input { width: 14px; height: 14px; margin: 0; flex: 0 0 14px; }
.automation-check-options > small { flex-basis: 100%; color: var(--jian-muted); font-size: 10px; line-height: 1.6; }
.automation-check-options:disabled { opacity: .45; }
.automation-check-unavailable { color: var(--jian-faint); opacity: .6; cursor: not-allowed; }
.automation-check-unavailable small { font-size: 10px; }

.studio-view .story-workflow-run-btn svg { width: 13px; height: 13px; fill: currentColor; }
.studio-view .story-workflow-run-btn.is-pipeline-paused { box-shadow: inset 0 0 0 1px var(--jian-accent-line); }
.studio-view .story-workflow-run-btn:focus-visible { outline: 2px solid var(--jian-accent-text); outline-offset: 3px; }
.studio-view .basic-script-head { max-width: 246px; }
.studio-view .story-workflow-rail-step { min-height: 40px; padding: 5px 6px; gap: 6px; }

.studio-view .storyboard-automation-bar {
    display: grid;
    grid-template-columns: 46px minmax(0, 1.1fr) 20px minmax(0, .92fr) 20px minmax(0, .92fr);
    column-gap: clamp(12px, 1.8vw, 28px);
    padding: 8px 0;
}

.studio-view .storyboard-automation-materials { grid-column: 1 / 3; grid-row: 1; padding-left: 12px; }
.studio-view .storyboard-automation-videos { grid-column: 6; grid-row: 1; padding-right: 12px; }
.studio-view .storyboard-automation-column + .storyboard-automation-column { padding-right: 12px; }
.studio-view .storyboard-shot-image-action { grid-column: 4; grid-row: 1; justify-content: center; }
.studio-view #generateAllStoryImagesBtn {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    color: #fff;
    border: 1px solid var(--jian-accent-line);
    background: var(--jian-button-fill);
}
.studio-view #generateAllStoryImagesBtn .storyboard-shot-image-arrow { display: none; }
.studio-view .storyboard-video-batch-actions { min-width: 0; justify-content: flex-end; }
.studio-view .storyboard-media-mode-radios { margin: 0; }

/* A single tab-strip edge replaces separate tab borders and negative margins. */
.studio-view .shot-card:has(.shot-video-view-tabs) { border-radius: 8px; overflow: hidden; }
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) {
    width: 100%;
    max-width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 0;
    gap: 0;
    align-items: stretch;
    border: 0;
    border-bottom: 1px solid var(--jian-line);
    border-radius: 0;
    background: var(--jian-panel-raised);
    overflow-x: auto;
}
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) > button {
    flex: 1 0 auto;
    width: auto;
    min-width: 0;
    height: 32px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--jian-muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
}
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) > button::after { display: none; }
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) > button.is-active {
    background: var(--jian-accent-soft);
    color: var(--jian-ink);
    box-shadow: inset 0 -2px var(--jian-accent);
}
.studio-view .storyboard-shot-media-tabs > .shot-custom-storyboard-image-button { flex: 0 0 auto; padding-inline: 8px; }
.studio-view .storyboard-shot-media-panel > .shot-content,
.studio-view .shot-video-view-tabs + .shot-content { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }

.studio-view .shot-card-title-row {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 10px;
}
.studio-view .shot-card-title-row h3 { min-width: 0; font-size: 11px; }
.studio-view .shot-card-title-row .shot-duration-editor { position: static; flex: 0 0 auto; margin-left: auto; }
.studio-view .shot-duration-editor input {
    flex: 0 0 var(--jian-number-short);
    width: var(--jian-number-short);
    min-width: var(--jian-number-short);
    height: var(--jian-control-compact-height);
    min-height: var(--jian-control-compact-height);
    padding: 0 6px;
    font-size: 11px;
    line-height: normal;
    text-align: center;
}

/* Compact commands, not compact prose: editor and chat bodies remain readable. */
:is(.library-view, .custom-workflow-view, .mine-view, .modal-backdrop, .cloud-ad-backdrop) :is(.primary-btn, .secondary-btn, .ghost-btn, .danger-btn),
.modal-backdrop :is(.prompt-agent-process, .lora-add-btn, .prompt-config-trigger, .prompt-preset-select, .preview-tools button) {
    min-height: 28px;
    height: 28px;
    padding-inline: 10px;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
}
.modal-backdrop :is(label, small, .size-row, .lora-panel summary, .prompt-footer-tools, .prompt-heading, .video-advanced-grid) { font-size: 11px; }
.modal-backdrop :is(.control-col, .preview-col, .video-form, .video-form-grid) :is(h2, h3, h4) { font-size: 13px; }
.modal-backdrop .lora-refresh-btn { width: 26px; height: 26px; font-size: 16px; }
.modal-backdrop :is(.control-col, .video-form) { --space-section-block: 16px; --space-title-content: 8px; }
.modal-backdrop .lora-panel summary { min-height: 32px; padding-block: 6px; }
.modal-backdrop :is(.prompt-box, .prompt-input-wrap) textarea { font-size: 13px; line-height: 1.65; }
.modal-backdrop .modal-footer { min-height: 48px; padding: 8px 14px; }
.mine-view :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) { height: 30px; min-height: 30px; font-size: 11px; }

@media (max-width: 1160px) {
    .studio-view .basic-script-head { max-width: 130px; }
    .studio-view .storyboard-automation-bar {
        grid-template-columns: 42px minmax(0, 1fr) 16px minmax(0, .94fr) 16px minmax(0, .94fr);
        column-gap: 12px;
    }
}
@media (max-width: 900px) {
    .studio-view .storyboard-automation-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 8px 12px; }
    .studio-view .storyboard-automation-materials { grid-column: 1; grid-row: 1; padding: 0; }
    .studio-view .storyboard-automation-videos { grid-column: 2; grid-row: 1; padding: 0; }
    .studio-view.is-shot-image-workflow .storyboard-automation-videos { grid-row: 2; }
    .studio-view .storyboard-shot-image-action { grid-column: 1; grid-row: 2; }
    .studio-view .storyboard-automation-column + .storyboard-automation-column { padding: 0; }
}
@media (max-width: 620px) {
    .studio-view .basic-script-head { max-width: none; width: 100%; }
    .studio-view .story-workflow-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .studio-view .story-workflow-rail-step:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Form sizing follows the value: short counts, medium dimensions, long seeds. */
.modal-backdrop :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select) {
    height: var(--jian-control-height);
    min-height: var(--jian-control-height);
    padding-block: 0;
    line-height: normal;
}
.modal-backdrop input[type="number"] {
    width: var(--jian-number-medium);
    max-width: 100%;
    padding-inline: 8px;
    text-align: center;
}
.modal-backdrop :is(.primary-btn, .secondary-btn, .ghost-btn, .lora-add-btn, .prompt-agent-process, .camera-movement-trigger),
.modal-backdrop :is(.modal-tabs, .video-flow-tabs, .picker-tabs, .picker-source-tabs) button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--jian-control-height);
    min-height: var(--jian-control-height);
    padding-block: 0;
    line-height: 1.2;
    vertical-align: middle;
}
.modal-backdrop .minimax-resolution-control {
    grid-template-columns: minmax(0, 1fr) var(--jian-control-height);
    align-items: center;
    gap: 8px;
}
.modal-backdrop .minimax-resolution-swap {
    width: var(--jian-control-height);
    height: var(--jian-control-height);
    min-height: var(--jian-control-height);
    margin: 0;
    padding: 0;
    border-radius: 7px;
}
.modal-backdrop .minimax-resolution-swap svg { width: 16px; height: 16px; }
.modal-backdrop :is(.prompt-heading, .prompt-tools, .prompt-footer-tools, .preview-tools) { align-items: center; gap: 8px; }
.modal-backdrop .host-pill { min-height: var(--jian-control-height); height: var(--jian-control-height); }

#imageModal #imageModelSection .size-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding-bottom: 0;
    margin-bottom: 10px;
}
#imageModal #imageModelSection .size-row label { grid-template-columns: auto minmax(0, 1fr); gap: 8px; min-width: 0; }
#imageModal #imageBatchCountField { grid-template-columns: auto var(--jian-number-short); }
#imageModal #imageBatchCount { width: var(--jian-number-short); }
#imageModal .image-size-control-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-bottom: 0; }
#imageModal .image-custom-size-row { grid-template-columns: repeat(2, max-content); justify-content: start; gap: 12px; }
#imageModal .image-custom-size-row label { grid-template-columns: auto var(--jian-number-medium); gap: 8px; }
#imageModal .image-qwen-parameters { align-items: center; gap: 8px 12px; padding: 8px 10px; }
#imageModal .image-qwen-parameters > label:first-child {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: auto 60px;
    gap: 8px;
}
#imageModal #imageQwenSteps { width: 60px; min-width: 60px; }
#imageModal .image-qwen-toggle { min-height: var(--jian-control-height); gap: 6px; }
#imageModal .image-qwen-toggle input { width: 14px; height: 14px; margin: 0; }
#imageModal :is(.lora-custom-list, .lora-default-list) { grid-template-columns: minmax(0, 1fr); }

.modal-backdrop .lora-custom-item { grid-template-columns: minmax(0, 1fr) 64px 26px; align-items: center; gap: 6px; }
.modal-backdrop .lora-custom-item :is(select, input) { height: var(--jian-control-height); min-height: var(--jian-control-height); }
.modal-backdrop .lora-custom-item input { width: 64px; min-width: 64px; padding-inline: 6px; }
.modal-backdrop .lora-custom-item .lora-remove-btn { width: 26px; height: var(--jian-control-height); padding: 0; display: grid; place-items: center; border-radius: 6px; line-height: 1; }

#videoModal .video-form-grid { align-items: end; gap: 10px 12px; }
#videoModal .video-modal-grid { gap: 16px; padding: 16px; }
#videoModal .minimax-h3-heading { gap: 10px; }
#videoModal .minimax-h3-heading p { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
#videoModal .video-form-grid > label { min-width: 0; gap: 6px; line-height: 20px; align-content: start; }
#videoModal .minimax-settings-grid { grid-template-columns: minmax(154px, 184px) 68px minmax(0, 1fr); }
#videoModal .minimax-resolution-field { width: auto; min-width: 0; }
#videoModal #minimaxH3Duration { width: 68px; }
#videoModal .minimax-custom-size-row { grid-template-columns: var(--jian-number-medium) var(--jian-number-medium) minmax(0, 1fr); }
#videoModal .minimax-custom-size-row small { font-size: 10px; }
#videoModal .minimax-primary-sampling-grid { grid-template-columns: var(--jian-number-short) minmax(0, 1fr); align-items: start; }
#videoModal .minimax-steps-field { grid-template-rows: 20px 42px; }
#videoModal #minimaxH3Steps { width: var(--jian-number-short); align-self: center; }
#videoModal .minimax-primary-sampling-grid .minimax-lora-grid { margin: 0; border: 0; background: transparent; box-shadow: none; }
#videoModal .minimax-lora-heading { height: 20px; min-height: 20px; padding: 0; margin-bottom: 6px; }
#videoModal .minimax-lora-heading .lora-refresh-btn { width: 20px; height: 20px; flex-basis: 20px; }
#videoModal .minimax-primary-sampling-grid .lora-panel-body { padding: 0; gap: 6px; }
#videoModal .minimax-primary-sampling-grid .lora-empty-item { min-height: 42px; }
#videoModal .minimax-sampling-grid { grid-template-columns: 84px minmax(0, 1fr); }
#videoModal #minimaxH3Seed { width: 100%; max-width: 190px; text-align: left; }
#videoModal :is(.minimax-vae-field, .minimax-clip-field) { grid-column: 1 / -1; }

.mine-view input[type="number"] { width: var(--jian-number-medium); max-width: 100%; padding-inline: 8px; text-align: center; }
.mine-view .automation-resolution-inputs { grid-template-columns: var(--jian-number-medium) auto var(--jian-number-medium); justify-content: start; }
.mine-view .automation-lora-control input[type="number"] { width: 100%; }
.mine-view .automation-lora-control { grid-template-columns: minmax(0, 1fr) 64px; }
.mine-view :is(#automationVideoCount, #automationVideoSteps, #canvasImageCount, #canvasVideoCount) { width: var(--jian-number-short); }
.modal-backdrop :is(#musicBpm, #directorFrameRate) { width: var(--jian-number-short); }
.modal-backdrop #directorGuideStrength { width: 64px; }

@media (max-width: 900px) {
    #videoModal .minimax-h3-heading { padding-right: 30px; }
}

@media (max-width: 760px) {
    #videoModal .minimax-settings-grid { grid-template-columns: minmax(0, 1fr) 68px; }
    #videoModal .minimax-main-model-field { grid-column: 1 / -1; }
    #videoModal .minimax-custom-size-row { grid-template-columns: var(--jian-number-medium) var(--jian-number-medium); }
    #videoModal .minimax-custom-size-row small { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
    #imageModal #imageModelSection .size-row { grid-template-columns: minmax(0, 1fr); }
    #imageModal #imageBatchCountField { justify-self: start; }
    #imageModal .image-custom-size-row { column-gap: 10px; }
}

@media (max-width: 340px) {
    #videoModal .minimax-primary-sampling-grid {
        grid-template-columns: 40px minmax(0, 1fr);
        column-gap: 8px;
    }
    #videoModal #minimaxH3Steps { width: 40px; min-width: 40px; padding-inline: 6px; }
}

/* Generation editors keep a stable viewport-sized shell across mode switches. */
#imageModal,
#videoModal { padding: 12px; }
#imageModal .generate-modal,
#videoModal .video-modal {
    height: min(94vh, calc(100vh - 24px));
    height: min(94dvh, calc(100dvh - 24px));
    max-height: min(94vh, calc(100vh - 24px));
    max-height: min(94dvh, calc(100dvh - 24px));
    max-width: 100%;
}
#imageModal.image-modal-text .control-col { min-height: 0; }
#imageModal .prompt-box textarea,
#videoModal :is(.prompt-box textarea, .director-segment-prompt) {
    height: clamp(240px, 32vh, 480px);
    height: clamp(240px, 32dvh, 480px);
    min-height: 240px;
    max-height: none;
    overflow-y: auto;
    resize: none;
}
#videoModal .minimax-prompt-box textarea {
    height: clamp(280px, 36vh, 520px);
    height: clamp(280px, 36dvh, 520px);
    min-height: 280px;
}
/* The dialog body owns scrolling, never the left column or its parameters. */
#imageModal .modal-grid,
#videoModal .video-modal-grid {
    min-height: 0;
    align-items: start;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}
#imageModal :is(.control-col, .preview-col, .generation-parameters),
#videoModal :is(.video-control-col, .video-preview-col, .minimax-h3-panel, .generation-parameters) {
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
}
#videoModal .generation-parameters { display: grid; gap: 12px; align-content: start; }
#imageModal .control-col > .prompt-heading { margin: 12px 0 8px; }

/* Status and header actions occupy layout space instead of overlapping content. */
.studio-view .shot-video-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    min-height: 40px;
    padding: 6px 8px;
}
.studio-view .shot-video-toolbar > .shot-video-details-action {
    flex: 0 0 auto;
    width: auto;
    height: 28px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
}
.studio-view .shot-video-row-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; margin-inline-start: auto; }
.studio-view .shot-video-row-tools :is(.shot-video-repeat-action, .shot-dialogue-check-button, .delete-shot) {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: 28px;
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
    white-space: nowrap;
}
.studio-view .shot-video-row-tools .delete-shot { width: 28px; padding: 0; }
.studio-view .shot-video-row-tools .delete-shot svg { width: 16px; height: 16px; }

/* All three columns share a header, a 16:9 display and a compact action row. */
@media (min-width: 901px) {
    .studio-view .shot-row {
        grid-template-columns: 42px minmax(0, 1fr) 16px minmax(0, 1fr) 16px minmax(0, 1fr);
    }
}
.studio-view .shot-row > .shot-card {
    min-height: 0;
    padding: 0;
    align-self: start;
}
.studio-view .shot-card-title-row,
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) {
    flex: 0 0 40px;
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
}
.studio-view .shot-card-title-row { flex-wrap: nowrap; padding: 6px 10px; }
.studio-view :is(.shot-video-view-tabs, .shot-source-tabs) > button { height: 39px; }
.studio-view .storyboard-shot-media-panel { flex: 0 0 auto; min-height: 0; }
.studio-view .shot-card > .shot-content,
.studio-view .storyboard-shot-media-panel > .shot-content,
.studio-view .shot-video-view-panel {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    box-sizing: border-box;
}
.studio-view .shot-text > .shot-textarea {
    position: absolute;
    inset: 0;
    display: block;
    height: 100%;
    min-height: 0;
    padding: 12px;
    overflow-y: auto;
}
.studio-view .shot-card > .shot-split-actions {
    flex: 0 0 auto;
    margin: 0;
    min-height: 40px;
    padding: 5px 8px;
    box-sizing: border-box;
    border-top: 1px solid var(--jian-line);
}
.studio-view .shot-reference-grid {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    overflow-x: hidden;
    overflow-y: auto;
}
.studio-view .shot-reference-actions .shot-action,
.studio-view .shot-text-actions .prompt-agent-process {
    height: 28px;
    min-height: 28px;
    line-height: 1.4;
}
.studio-view .shot-card > .shot-reference-actions { grid-template-columns: minmax(0, 1fr) auto; }
.studio-view .shot-card > .shot-text-actions { display: flex; align-items: center; gap: 8px; }
.studio-view .shot-text-actions .shot-text-agent-tools { order: 1; width: auto; margin: 0; }
.studio-view .shot-text-actions .prompt-agent-process { width: auto; padding: 0 10px; }
.studio-view .shot-text-actions .shot-clear-text {
    order: 0;
    flex: 0 0 auto;
    width: auto;
    height: 28px;
    min-height: 28px;
    margin: 0 auto 0 0;
    padding: 0 4px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    box-shadow: none;
    color: var(--jian-muted);
    font: inherit;
    font-size: 11px;
    line-height: 1.4;
    cursor: pointer;
}
.studio-view .shot-clear-text:hover { color: var(--jian-ink); text-decoration: underline; }
.studio-view .shot-clear-text:focus-visible { outline: 2px solid var(--jian-accent); outline-offset: 2px; }

.service-health-notice {
    position: sticky;
    z-index: 19;
    top: 60px;
    max-height: min(220px, 30vh);
    overflow-y: auto;
    border-bottom: 1px solid rgba(241, 168, 118, 0.22);
    background: rgba(28, 21, 22, 0.97);
    color: #efdfda;
    animation: service-health-reveal 180ms ease-out;
}
.service-health-notice[hidden] { display: none; }
body.assistant-fullscreen .app-shell,
body.mobile-client.assistant-fullscreen .app-shell { height: calc(100dvh - var(--service-health-nav-height, 60px) - var(--service-health-notice-height, 0px)); }
.service-health-notice-inner {
    display: flex;
    align-items: start;
    gap: 16px;
    max-width: 1510px;
    margin-inline: auto;
    padding: 10px 24px;
}
.service-health-notice-label { flex: 0 0 auto; padding-top: 5px; font-size: 11px; color: #edb4a0; }
.service-health-notice ul { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; list-style: none; }
.service-health-item { display: flex; align-items: center; gap: 16px; min-width: 0; padding-block: 3px; }
.service-health-item + .service-health-item { border-top: 1px solid rgba(241, 168, 118, 0.12); margin-top: 5px; padding-top: 8px; }
.service-health-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.service-health-copy strong { font-size: 12px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.service-health-copy small { font-size: 11px; line-height: 1.5; color: #b7a8a8; overflow-wrap: anywhere; }
.service-health-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.service-health-actions button { min-height: 28px; padding: 0 10px; border: 1px solid rgba(232, 198, 185, 0.2); border-radius: 6px; background: transparent; color: #ead8d3; font-size: 11px; white-space: nowrap; cursor: pointer; }
.service-health-actions button:hover { background: rgba(232, 198, 185, 0.08); }
.service-health-actions button:focus-visible { outline: 2px solid #b8a0ef; outline-offset: 2px; }
@keyframes service-health-reveal { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
    .service-health-notice-inner { display: block; padding: 8px 14px; }
    .service-health-notice-label { display: block; padding: 0 0 3px; }
    .service-health-item { align-items: start; flex-wrap: wrap; gap: 5px 12px; }
    .service-health-copy { flex-basis: 100%; }
    .service-health-actions { margin-inline-start: auto; }
}
@media (prefers-reduced-motion: reduce) { .service-health-notice { animation: none; } }

.nav-task-status .library-task-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline: 9px;
}
.nav-task-status .library-task-summary { flex: 1 1 auto; min-width: 0; }
.nav-task-status .library-task-glow {
    position: static;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    transform: none;
}

.nav-task-status { display: flex; align-items: center; gap: 6px; }
.nav-task-status .nav-task-popover { left: auto; right: 0; }
.nav-task-status .nav-task-cancel-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 48px;
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #e9bfc4;
    font-size: 11px;
    white-space: nowrap;
}
.nav-task-cancel-all:hover:not(:disabled) { text-decoration: underline; }
.nav-task-cancel-all:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.nav-task-cancel-all:disabled { opacity: .45; cursor: default; }
.library-task-popover-head {
    position: sticky;
    top: -14px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -14px -14px 0;
    padding: 12px 14px;
    border-bottom: 1px solid #333039;
    background: #141318;
    font-size: 12px;
}
.library-task-popover-head .library-task-cancel { padding: 5px 8px; font-size: 11px; white-space: nowrap; }

.modal-backdrop .audio-mode-tabs { min-width: 0; max-width: 100%; }
.modal-backdrop .audio-mode-tabs button {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
}
.modal-backdrop :is(.voice-grid, .music-grid) > :is(.control-col, .preview-col) { min-width: 0; }
.modal-backdrop :is(.preview-title-row, .voice-head) {
    min-width: 0;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.modal-backdrop :is(.preview-title-row, .voice-head) > h2 {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}
.modal-backdrop .preview-head-side {
    min-width: 0;
    max-width: 100%;
    margin-inline-start: auto;
    gap: 8px;
}
.modal-backdrop .preview-clear-btn {
    flex: 0 0 auto;
    min-height: var(--jian-control-height);
    padding: 0 4px;
    white-space: nowrap;
}
:is(#voiceModal, #musicModal) .voice-head,
#videoModal .video-preview-col > .video-head { padding-inline-end: 36px; }
.modal-backdrop .music-idea-heading { flex-wrap: wrap; }
.modal-backdrop .music-idea-heading > h2 { flex: 1 0 auto; }

@media (max-width: 1120px) {
    :is(#voiceModal, #musicModal) .music-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding: 24px;
    }
    :is(#voiceModal, #musicModal) :is(.voice-grid, .music-grid) {
        grid-template-rows: max-content max-content;
        align-content: start;
    }
}
@media (max-width: 600px) {
    .modal-backdrop .audio-mode-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 3px;
    }
    :is(#voiceModal, #musicModal) .control-col > .audio-mode-tabs { max-width: calc(100% - 28px); }
    body.mobile-client :is(#voiceModal, #musicModal) .control-col > .audio-mode-tabs { max-width: 100%; }
    body.mobile-client :is(#voiceModal, #musicModal) :is(.audio-mode-tabs, .preview-col) { flex-shrink: 0; }
    .modal-backdrop .music-idea-heading .prompt-tools { flex-wrap: wrap; min-width: 0; }
}

.studio-view .shot-content.shot-text.has-repair-warning {
    display: flex;
    flex-direction: column;
    background: rgba(166, 42, 60, .12);
    border-color: rgba(237, 111, 128, .5);
    box-shadow: inset 0 0 0 1px rgba(237, 111, 128, .4);
}
.studio-view .shot-text.has-repair-warning > .shot-textarea {
    position: static;
    inset: auto;
    flex: 1 1 0;
    width: 100%;
    height: 0;
    min-height: 0;
    background: rgba(166, 42, 60, .08);
    border-color: rgba(237, 111, 128, .4);
}
.studio-view .shot-repair-warning {
    flex: 0 0 auto;
    padding: 6px 10px;
    color: #f2abb6;
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.studio-view .shot-repair-button {
    flex: 0 0 auto;
    width: auto;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
}
.studio-view .storyboard-dialogue-check-bar { gap: 8px; flex-wrap: wrap; }
.story-video-range-grid.with-dialogue-status .shot-dialogue-check-status.is-warning i { background: #ed6f80; }
.studio-view .storyboard-dialogue-check-bar .storyboard-dialogue-check-all { margin-left: 0; }
.studio-view .storyboard-repair-all {
    flex: 0 0 auto;
    width: auto;
}
