#studio {
  --sv-bg: #191b29;
  --sv-line: #42475d;
  --sv-muted: #b1b7ce;
  --sv-blue: #aad8ff;
  color: #f4f4fc;
}
#studio .sv-title h1 { display: flex; align-items: center; gap: 12px; }
.sv-title-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: none; color: #cab8ff; background: linear-gradient(130deg,#383654,#242336); border: 1px solid #585072; border-radius: 12px; transform: rotate(-4deg); }
.sv-workspace { display: grid; grid-template-columns: minmax(360px, .96fr) minmax(0, 1.04fr); align-items: start; gap: clamp(12px,1.2vw,20px); padding-bottom: 28px; }
.sv-panel { min-width: 0; padding: clamp(14px,1.3vw,24px); border: 1px solid var(--sv-line); border-radius: 20px; background: linear-gradient(140deg,#1c1e2d 0,#151724 60%,#191c2b); box-shadow: inset 0 1px 0 #ffffff06, 0 10px 28px #0507112b; }
.sv-form { display: flex; flex-direction: column; gap: clamp(13px,1.1vw,19px); }
.sv-form fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.sv-form legend,.sv-label { display: block; margin: 0 0 8px; padding: 0; font-size: 15px; line-height: 1.3; font-weight: 680; color: #f4f5ff; }
.sv-label small { font-weight: 400; color: var(--sv-muted); font-size: 13px; }
.sv-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; margin: -1px; clip-path: inset(50%); border: 0; white-space: nowrap; }
.sv-modes label:has(:focus-visible),.sv-model:has(:focus-visible),.sv-file-label:has(:focus-visible),.sv-chip:has(:focus-visible) { outline: 2px solid #c9ddff; outline-offset: 3px; }
.sv-form .sv-modes { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 3px; border: 1px solid #545c7b; border-radius: 14px; background: #10121e; }
.sv-modes label { display: flex; align-items: center; justify-content: center; gap: 8px; color: #dfe4f6; border-radius: 10px; padding: 10px 4px; line-height: 1.2; font-size: clamp(12px,.95vw,16px); font-weight: 680; cursor: pointer; transition: background .16s ease; }
.sv-modes label:has(:checked) { color: #131a3b; background: linear-gradient(110deg,#b2d9ff,#a5b4ff); box-shadow: inset 0 1px 0 #ffffff70; }
.sv-model-list { display: grid; gap: 7px; }
.sv-model { display: flex; align-items: center; gap: clamp(9px,.85vw,15px); position: relative; min-width: 0; padding: 10px 12px; border: 1px solid #44495e; border-radius: 12px; background: linear-gradient(115deg,#272a3b,#1b1d2a); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.sv-model:hover,.sv-chip:hover { border-color: #9693b7; }
.sv-model:has(:checked) { border-color: #baafff; box-shadow: inset 0 0 0 1px #a192ff70, inset 0 0 14px #a67cf02a, 0 0 13px #9275f723; background: linear-gradient(115deg,#2c314c,#24283f 58%,#302747); }
.sv-model-mark { display: grid; place-items: center; flex-shrink: 0; width: clamp(40px,3.2vw,58px); aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: linear-gradient(135deg,#131722,#0a0c13); }
.sv-model-mark .model-mark { width: 100%; height: 100%; font-size: clamp(25px,2.3vw,37px); }
.sv-model-copy { min-width: 0; display: grid; gap: 3px; font-size: 14px; }
.sv-model-copy > strong { font-size: clamp(14px,1.04vw,18px); line-height: 1.14; }
.sv-model-copy small { color: #bec3d7; line-height: 1.35; font-size: 13px; font-weight: 400; }
.sv-model-meta { display: flex; align-items: center; gap: 5px 8px; flex-wrap: wrap; font-size: 13px; line-height: 1.3; font-weight: 500; color: #e4e8f9; }
.sv-model-meta > span:not(:first-child)::before,.sv-model-meta > strong::before { content: '·'; margin-right: 7px; color: #8991ad; }
.sv-model-meta > strong { color: #c5d9ff; }
.sv-radio-dot { flex: none; width: 17px; height: 17px; margin-left: auto; border: 1.5px solid #a9b1cc; border-radius: 50%; background: #111522; }
.sv-model:has(:checked) .sv-radio-dot { background: #faf1ff; border: 3.5px solid #8f77f0; outline: 1px solid #e5d8ff; }
.sv-frames { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.sv-frame { min-width: 0; }
.sv-frames:not(:has(#last-frame:not([hidden]))) { grid-template-columns: minmax(0,1fr); }
.sv-upload { min-width: 0; position: relative; border: 1px dashed #68718e; background: linear-gradient(120deg,#202536,#191d2c); border-radius: 11px; }
.sv-upload:is(:hover,.sv-drag) { border-color: #af9bff; background: #28263f; }
.sv-file-label { display: flex; align-items: center; justify-content: center; min-height: 67px; gap: 9px; padding: 9px; border-radius: inherit; cursor: pointer; }
.sv-upload-symbol { color: #b5caff; flex: none; display: grid; place-items: center; }
.sv-upload img { flex: none; width: 44px; height: 48px; object-fit: cover; border-radius: 6px; }
.sv-has-preview .sv-upload-symbol { display: none; }
.sv-has-frame .sv-file-label { padding-right: 29px; }
.sv-upload-copy { display: grid; min-width: 0; gap: 3px; }
.sv-upload-copy strong { font-size: 14px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.sv-upload-copy small { color: var(--sv-muted); font-size: 12px; font-weight: 400; line-height: 1.3; overflow-wrap: anywhere; }
.sv-remove { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 25px; height: 25px; border: 0; background: #101321; color: #dce2fa; border-radius: 7px; }
.sv-prompt-box { overflow: hidden; display: grid; border: 1px solid #565c77; border-radius: 11px; background: linear-gradient(125deg,#212536,#181b29); }
.sv-prompt-box:focus-within { border-color: #b1b9ff; }
#studio .sv-prompt-box textarea { display: block; margin: 0; width: 100%; min-height: 100px; border: 0; outline: 0; padding: 12px 14px 0; resize: vertical; background: transparent; color: #f1f3ff; font: inherit; font-size: 16px; line-height: 1.45; }
.sv-prompt-box textarea::placeholder { color: #aeb6cc; }
.sv-prompt-tools { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 0 12px 7px; color: #b9bfd5; font-size: 13px; min-height: 25px; }
.sv-prompt-tools button { margin-right: auto; border: 0; background: none; color: #c6d9ff; padding: 2px 0; font: inherit; }
.sv-settings { display: grid; gap: 18px; border-top: 1px solid #383c52; padding-top: 16px; }
.sv-chips,.sv-qualities { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; min-width: 48px; padding: 6px 11px; border: 1px solid #484e66; border-radius: 9px; font-size: 14px; font-weight: 550; background: #161925; color: #e3e7fa; cursor: pointer; }
.sv-chip:has(:checked) { border-color: #aaa7f2; color: #f6f5ff; background: linear-gradient(125deg,#35405e,#352f4d); }
.sv-qualities .sv-chip { flex: 1 1 58px; flex-direction: column; align-items: start; gap: 3px; min-height: 63px; padding: 8px 10px; background: linear-gradient(130deg,#252a3d,#1c1e2c); }
.sv-qualities .sv-chip:has(:checked) { background: linear-gradient(125deg,#34435e,#372f50); }
.sv-qualities strong { font-size: 19px; line-height: 1.1; }
.sv-qualities small { font-size: 13px; color: #c7cde5; font-weight: 450; }
.sv-duration { position: relative; }
#duration-value { position: absolute; right: 0; top: -27px; color: #c5d7ff; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
#duration-range { display: block; width: 100%; height: 26px; margin: 0 0 5px; accent-color: #b2b4ff; cursor: pointer; }
.sv-aspect { display: block; width: 19px; height: 12px; border: 1.6px solid currentColor; border-radius: 2px; color: #c0cce9; flex: none; }
.sv-aspect[data-ratio="9:16"] { width: 11px; height: 18px; }
.sv-aspect[data-ratio="1:1"] { width: 15px; height: 15px; }
.sv-aspect[data-ratio="2:3"] { width: 12px; height: 17px; }
.sv-aspect[data-ratio="3:2"] { width: 18px; height: 13px; }
.sv-aspect[data-ratio="auto"] { width: 16px; height: 16px; border-style: dashed; }
#settings-note,#ratio-hint { margin: 6px 0 0; color: var(--sv-muted); font-size: 13px; line-height: 1.45; }
#settings-note { margin: 0; padding: 9px 11px; border-left: 2px solid #afa9ff; background: #232638; color: #e2e7fb; }
#settings-note:empty,#ratio-hint:empty { display: none; }
#studio #generate { display: flex; width: 100%; justify-content: center; align-items: center; gap: 9px; padding: 12px 10px; min-height: 48px; border: 1px solid #b5b4ff; border-radius: 12px; background: linear-gradient(110deg,#98d2ff,#a9adff 58%,#b992fa); box-shadow: 0 3px 14px #7667be30; color: #171a37; font-size: clamp(15px,1.1vw,19px); font-weight: 750; cursor: pointer; }
#studio #generate:hover:enabled { filter: brightness(1.07); }
#studio #generate:disabled { opacity: .7; cursor: default; }
#studio-access,#studio #form-message { font-size: 14px; color: #c9cee3; line-height: 1.4; text-align: center; margin: 8px 0 0; }
#studio-access:empty,#studio #form-message:empty { display: none; }
#studio-access a,#studio #form-message a,#studio-access button { color: #c2d9ff; background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sv-output { align-self: start; }
.sv-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sv-preview-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: clamp(18px,1.45vw,26px); line-height: 1.2; }
.sv-preview-head h2 > span { display: grid; place-items: center; flex: none; width: 27px; height: 27px; border: 1.5px solid #c2ceff; border-radius: 50%; color: #d8e1ff; box-shadow: 0 0 9px #879cff47; }
#preview-meta { font-size: 11px; color: #d6daf1; border: 1px solid #454b65; background: #1e2231; border-radius: 7px; padding: 4px 8px; line-height: 1.3; }
#preview-meta:empty { display:none; }
.sv-player { position: relative; display: grid; overflow: hidden; place-items: center; width: 100%; aspect-ratio: 16 / 10; background: #080a10; border: 1px solid #46495a; border-radius: 15px; }
.sv-player video { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.sv-play { display: grid; place-items: center; position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: clamp(48px,5vw,80px); aspect-ratio: 1; padding: 0; background: #141421b5; border: 1px solid #e8eaffb8; border-radius: 50%; color: #fff; box-shadow: 0 3px 24px #0304114d; backdrop-filter: blur(7px); }
.sv-play:hover { background: #302b47da; }
.sv-play svg { margin-left: 3px; }
.sv-demo-caption { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; justify-content: space-between; margin: 12px 2px 0; }
.sv-demo-caption strong { color: #f1f3fc; font-size: 14px; }
.sv-demo-caption span { color: var(--sv-muted); font-size: 12px; }
.sv-player-message { margin: 6px 0; color: #cad4ed; font-size: 13px; }
.sv-player-message:empty { display: none; }
.sv-output .result-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.sv-output .result-actions:empty { display: none; }
.sv-output .result-actions > * { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 1 1 auto; min-height: 43px; padding: 8px 12px; border: 1px solid #565f7d; border-radius: 10px; background: linear-gradient(120deg,#282c42,#1d2234); color: #f1f2ff; font-size: 14px; font-weight: 650; text-align: center; }
.sv-output .result-actions > button { color: #161b38; background: linear-gradient(120deg,#b0d6ff,#aba9ff); border-color: #c0c9ff; }
.sv-library-link { display: inline-block; color: var(--sv-blue); font-size: 13px; margin-top: 9px; }
.sv-job-state,.sv-empty { display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; padding: 24px; min-height: clamp(220px,26vw,450px); border: 1px solid var(--sv-line); border-radius: 14px; background: radial-gradient(ellipse at 50% 40%, #2a2945,#141725 66%); }
.sv-job-state p { max-width: 330px; color: var(--sv-muted); margin: 0; font-size: 14px; line-height: 1.5; }
.sv-state-icon { display: grid; place-items: center; color: #bcb4ff; }
.sv-working { animation: sv-pulse 2s ease-in-out infinite alternate; }
@keyframes sv-pulse { to { opacity: .55; } }
#studio-recent:not(:empty) { margin-top: 18px; padding-top: 16px; border-top: 1px solid #36394b; }
@media(max-width: 1090px) {
  .sv-workspace { grid-template-columns: minmax(320px,.93fr) minmax(0,1fr); }
  .sv-frames:has(#last-frame:not([hidden])) .sv-file-label { flex-direction: column; text-align: center; min-height: 88px; }
  .sv-frames:has(#last-frame:not([hidden])) .sv-file-label img { height: 30px; }
}
@media(max-width: 900px) {
  .sv-workspace { grid-template-columns: minmax(0,1fr); }
  .sv-preview-head h2 { font-size: 21px; }
  .sv-player { aspect-ratio: 16 / 9; }
  .sv-frames:has(#last-frame:not([hidden])) .sv-file-label { flex-direction: row; text-align: left; min-height: 67px; }
}
@media(max-width: 500px) {
  .sv-title-icon { width: 32px; height: 32px; border-radius: 9px; }
  .sv-title-icon svg { width: 22px; }
  .sv-panel { padding: 12px; border-radius: 15px; }
  .sv-form { gap: 14px; }
  .sv-modes label { gap: 5px; font-size: 12px; min-height: 38px; }
  .sv-modes svg { width: 16px; }
  .sv-model { padding: 9px; gap: 9px; }
  .sv-model-meta { gap: 2px 5px; }
  .sv-radio-dot { width: 14px; height: 14px; }
  .sv-settings { gap: 16px; }
  .sv-chip { min-height: 44px; padding-inline: 9px; }
  .sv-frames { gap: 8px; }
  .sv-frames:has(#last-frame:not([hidden])) .sv-file-label { flex-direction: column; text-align: center; min-height: 96px; }
  .sv-frames:has(#last-frame:not([hidden])) .sv-upload-copy { max-width: 100%; }
  .sv-preview-head { margin-bottom: 10px; }
  .sv-preview-head h2 { font-size: 18px; }
  .sv-player { border-radius: 11px; }
}
@media(prefers-reduced-motion: reduce) {
  .sv-working { animation: none; }
}

#ratio-options { display:grid; grid-template-columns:repeat(auto-fit,minmax(89px,1fr)); gap:6px; }
#ratio-options .sv-chip { min-height:70px; padding:8px 5px; gap:4px; flex-direction:column; }
#ratio-options .sv-aspect { flex:none; min-height:0; border-radius:3px; }
.sv-ratio-text { display:grid; justify-items:center; gap:1px; }
.sv-ratio-text strong { font-size:14px; }
.sv-ratio-text small { font-size:11px; font-weight:450; color:#c9cee0; }
.sv-frame-size { display:block; margin-top:5px; font-size:12px; line-height:1.4; color:#c7cee4; }
.sv-frame-size:empty { display:none; }
.sv-edit-crop { display:inline-flex; align-items:center; min-height:32px; margin-top:4px; border:1px solid #545b78; border-radius:7px; padding:3px 8px; background:#26293e; color:#d6e4ff; font-size:13px; }
.sv-player { margin-inline:auto; }
#frame-crop { width:min(530px,calc(100% - 24px)); max-height:94dvh; }
.sv-crop-editor { padding:18px; display:grid; gap:10px; }
.sv-crop-editor h2,.sv-crop-editor p { margin:0; }
.sv-crop-editor h2 { font-size:20px; }
.sv-crop-editor p,.sv-crop-editor small { color:#bfc7dd; font-size:13px; }
.sv-crop-stage { display:grid; place-items:center; padding:8px; min-height:100px; background:#0e1019; border:1px solid #424659; border-radius:8px; }
.sv-crop-stage canvas { display:block; max-width:100%; max-height:42dvh; width:auto; height:auto; object-fit:contain; outline:1px solid #dbc794; touch-action:none; cursor:grab; }
.sv-crop-stage canvas:active { cursor:grabbing; }
.sv-crop-stage canvas:focus-visible { outline:2px solid #c4daff; }
.sv-crop-editor label,.sv-crop-actions { display:flex; align-items:center; gap:12px; }
.sv-crop-editor input { min-width:0; flex:1; accent-color:#c5a8f2; }
.sv-crop-editor [role=status]:empty { display:none; }
.sv-crop-actions { justify-content:flex-end; }
