#root:has(> .cw-main) {height:100vh;height:100dvh;min-height:340px;display:flex;flex-direction:column}
#root:has(> .cw-main) > .pc-bar, #root:has(> .cw-main) > .pc-notice {flex:none}
#root:has(> .cw-main) > .pc-bar {padding:4px clamp(10px,1.6vw,28px);gap:6px}
#root:has(> .cw-main) > .pc-bar b {font-size:14px}
#root:has(> .cw-main) > .pc-bar span, #root:has(> .cw-main) > .pc-bar button {font-size:12px}
#root:has(> .cw-main) > .pc-bar button {padding:4px 9px}
main.story-main.cw-main {width:100%;max-width:none;min-width:0;min-height:0;flex:1;margin:0;display:flex;flex-direction:column;gap:8px;padding:8px clamp(8px,1.6vw,28px) 10px}
.cw-toolbar {flex:none;display:flex;align-items:center;gap:clamp(8px,1.3vw,22px);min-width:0}
.cw-toolbar h1 {flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:clamp(15px,1.35vw,18px);line-height:1.25;letter-spacing:-.025em;margin:0;font-weight:700}
.cw-toolbar .cw-tabs {margin:0;flex:0 0 auto}
.cw-toolbar .cw-tabs button {padding:5px 10px;font-size:13px}
.cw-model-toggle {display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;margin-left:auto;padding:6px 10px;border:1px solid var(--line);background:#21242c;border-radius:6px;color:#dedfe6;font-size:13px}
.cw-model-toggle::after {content:"";width:6px;height:6px;border:solid currentColor;border-width:0 1px 1px 0;transform:translateY(-2px) rotate(45deg)}
.cw-model-toggle[aria-expanded=true]::after {transform:translateY(2px) rotate(225deg)}
.cw-tabs {display:flex;flex-wrap:wrap}
.cw-tabs .cw-tab-icon {font-size:16px;line-height:1}
.cw-panel,.cw-settings {background:#1b1d25;color:#ebedf4;border:1px solid #353842;border-radius:12px}
.cw-panel {min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}
#cw-writer-settings {flex:0 0 auto;max-height:32dvh;overflow-y:auto}
#cw-writer-settings .cw-settings {display:flex;align-items:center;flex-wrap:wrap;gap:5px 16px;padding:7px 14px;margin:0;border:0;border-bottom:1px solid var(--line);border-radius:0}
#cw-writer-settings .cw-field {display:flex;align-items:center;gap:6px;min-width:0}
#cw-writer-settings .cw-field span {white-space:nowrap}
#cw-writer-settings select {min-width:0;padding:4px 6px;font-size:12px}
#cw-writer-settings .cw-settings-grid {gap:5px 14px;min-width:0;max-width:100%}
#cw-writer-settings .cw-settings-note {margin:0;font-size:12px}
#cw-writer-settings .cw-text-button {font-size:inherit}
.cw-settings {padding:14px 18px;margin-bottom:14px}
.cw-settings-grid {display:flex;gap:12px;flex-wrap:wrap}
.cw-field {display:grid;gap:5px;min-width:115px;font-size:12px;color:#c7c9d4}
.cw-field select {max-width:100%;padding:7px 26px 7px 9px;border-radius:6px;background:#14161c;color:#fafafa;border:1px solid #454956;font-size:13px}
.cw-settings-note,.cw-answer>small {font-size:12px;color:#bdc0cd}
.cw-settings-note {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:9px}
.cw-settings-note .cw-text-button {border:0;background:none;color:#ffa07e;text-decoration:underline;padding:2px}
.cw-transcript {position:relative;min-height:0;overflow:auto;flex:1;padding:14px clamp(10px,1.3vw,22px);scrollbar-gutter:stable;overscroll-behavior:contain}
.cw-empty {display:grid;place-items:center;text-align:center;margin:28px 0}.cw-pen {color:#ff8660;font-size:26px}
.cw-empty h2 {font-size:clamp(20px,2.4vw,29px);margin:12px 0 5px}.cw-empty p {color:#bfc2d0;margin:5px}
.cw-presets,.cw-actions {display:flex;gap:8px;flex-wrap:wrap}.cw-presets {justify-content:center;margin-top:17px}
.cw-presets button,.cw-actions button,.cw-form button {padding:7px 12px;border:1px solid #414654;border-radius:7px;color:#eee;background:#262933;font:inherit;font-size:13px;cursor:pointer}
.cw-form button.cw-send {background:#ff8057;color:#191411;border-color:#ff8057;font-weight:700}
.cw-form button:disabled,.cw-field select:disabled {opacity:.55;cursor:default}
.cw-user {background:#49332b;max-width:78%;width:fit-content;margin:3px 0 16px auto;border-radius:12px 12px 3px 12px;padding:12px 15px;white-space:pre-wrap;overflow-wrap:anywhere}
.cw-answer {width:100%;min-width:0;margin:0 0 16px}.cw-idea {background:#22252f;border:1px solid #353946;border-radius:10px;padding:15px 18px;margin:7px 0}
.cw-idea h3 {margin:0 0 7px;font-size:clamp(19px,1.5vw,22px)}
.cw-idea p {white-space:pre-wrap;overflow-wrap:anywhere;color:#f2f3f7;font-size:clamp(17px,1.4vw,20px);line-height:1.65;margin:3px 0 14px}
.cw-error {color:#ffbe9c;background:#362922;padding:8px 14px;margin:0}
.cw-form {flex:none;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:8px;padding:9px clamp(10px,1.3vw,22px);border-top:1px solid #373a46}
.cw-form textarea {
  display:block;resize:vertical;width:100%;box-sizing:border-box;height:clamp(134px,22dvh,224px);min-height:84px;max-height:40dvh;
  background:#14161c;color:#fff;border:1px solid #515563;border-radius:8px;padding:10px 12px;font:inherit;font-size:clamp(16px,1.25vw,18px);line-height:1.5;
}
.cw-form textarea:focus-visible {outline:2px solid #ff936d;outline-offset:-2px}
.cw-form button {min-height:36px;white-space:nowrap}

@media(max-width:760px) {
 .cw-toolbar {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 10px}
 .cw-toolbar .cw-tabs {grid-row:2;grid-column:1/-1;max-width:100%}
 .cw-model-toggle {grid-column:2;grid-row:1}
 .cw-field {flex:1 1 110px;min-width:0}
 .cw-user {max-width:90%}
 #root:has(> .cw-main) .pc-bar {padding:5px 8px;gap:5px}
 #root:has(> .cw-main) .pc-bar > div {gap:4px;flex-wrap:wrap}
 #root:has(> .cw-main) .pc-bar button {font-size:12px;padding:4px 6px}
}
@media(max-width:440px) {
 .cw-tabs .cw-tab-icon {display:none}
 .cw-toolbar .cw-tabs button {font-size:13px;padding:6px 8px;gap:4px}
 .cw-idea {padding:10px 12px}
 .cw-form {gap:6px;padding:7px}
 .cw-form textarea {height:clamp(104px,19dvh,150px)}
 .cw-form button {padding-inline:8px}
 #cw-writer-settings .cw-field {flex:0 1 auto;max-width:100%}
}
@media(max-height:520px) {
 .cw-form textarea {height:clamp(72px,19dvh,96px);min-height:64px;max-height:30dvh}
 #cw-writer-settings {max-height:20dvh}
}

.picture-bar {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 10px;padding:3px 12px 10px}
.picture-bar .scene-finish {padding:0;margin:0;flex-wrap:wrap}
.picture-actions,.series-foot {display:flex;flex-wrap:wrap;gap:6px}
.picture-actions button,.series-open,.series-dialog button {border:1px solid #454955;border-radius:6px;color:#e5e6ec;background:#292c35;padding:6px 10px;font:inherit;font-size:13px;cursor:pointer}
.picture-actions .picture-remove {color:#ffb4a2}
.series-open {align-self:stretch;margin:0 8px 8px}
.series-dialog {width:min(390px,calc(100vw - 32px));max-height:88dvh;padding:0;border:1px solid #474951;border-radius:12px;background:#202229;color:#f3f3f5}
.series-dialog::backdrop {background:rgba(0,0,0,.66)}
.series-body {padding:20px}.series-body h2 {font-size:19px;margin:0 0 6px}.series-title {color:#bebfca;font-size:13px;overflow-wrap:anywhere}
.series-body p {line-height:1.6;margin:6px 0 12px}.series-options {display:grid;gap:8px}
.series-options button {text-align:left;padding:10px 12px}.series-foot {justify-content:flex-end;margin-top:17px}
.series-foot .series-confirm {background:#af4e37;color:#fff;border-color:#be6048}
.picture-actions button:disabled,.series-dialog button:disabled,.series-open:disabled {opacity:.45;cursor:default}

.story-rail .insert-scene {
  display:flex;align-items:center;justify-content:center;gap:5px;flex:none;width:100%;min-height:30px;
  padding:4px 6px;border:1px dashed #9c634b;border-radius:7px;background:#322722;color:#ffbc96;
  font:inherit;font-size:12px;font-weight:650;line-height:1.3;cursor:pointer;
}
.story-rail .insert-scene svg {flex:none}
.story-rail .insert-scene:hover,.story-rail .insert-scene:focus-visible {background:#493126;border-color:#ff9e72;color:#ffe2cf}
.story-rail .insert-scene:focus-visible {outline:2px solid #ffad83;outline-offset:-2px}
.story-rail .insert-scene:active {background:#543728}
