*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,a.primary,select{min-height:44px}button,a.primary{background:var(--panel);border:1px solid var(--line);color:inherit;border-radius:3px;padding:8px 14px;cursor:pointer;display:inline-grid;place-items:center;text-decoration:none;font-weight:650}button:disabled{opacity:.46;cursor:default}button:not(:disabled):hover{border-color:#8996a3}.primary{background:var(--accent)!important;border-color:var(--accent)!important;color:var(--ink)!important}input,select{background:var(--panel);color:inherit;border:1px solid var(--line);border-radius:3px;padding:8px;width:100%;min-width:0;min-height:44px}select{width:auto}input[type=range]{accent-color:var(--accent);padding:0}button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--focus);outline-offset:3px}[hidden]{display:none!important}.top{padding:12px clamp(14px,4vw,52px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--panel)}.brand{display:flex;align-items:center;gap:10px}.brand strong{font-size:20px;letter-spacing:-.04em}.brand small{display:block;color:var(--muted);font-size:12px}.mark{display:grid;place-items:center;background:var(--accent);color:var(--ink);width:40px;height:40px;border-radius:3px;font-size:23px}main{max-width:1540px;margin:auto;padding:0 clamp(12px,2.8vw,36px) 20px}#saved,footer,#total,.ratio,#hint{color:var(--muted);font-size:13px}.panel{min-width:0;background:var(--panel);border:1px solid var(--line);border-radius:3px;overflow:hidden}.panelhead{min-height:56px;display:flex;align-items:center;justify-content:space-between;padding:8px 14px;gap:8px;border-bottom:1px solid var(--line)}h1,h2{font-size:16px;margin:0}.ratio{display:flex;align-items:center;gap:8px}.screen{margin:12px;border-radius:3px;background:#dfe3e8;display:grid;place-items:center;min-height:clamp(200px,42vw,375px);overflow:hidden}.screen canvas{display:block;max-width:100%;max-height:min(50vh,435px);object-fit:contain;width:auto;height:auto}.screen #empty{text-align:center;padding:25px 10px}.film{color:var(--accent);font-size:33px;margin-bottom:8px}p{margin:8px 0 16px;color:var(--muted)}.transport{display:flex;align-items:center;gap:10px;padding:0 12px 12px}.transport button{width:44px;flex-shrink:0}.transport output{white-space:nowrap;font:12px Consolas,monospace;color:var(--muted)}.inspector #hint,.inspector fieldset{margin:14px}.inspector fieldset{padding:0;border:0;min-width:0}.inspector strong{display:block;overflow-wrap:anywhere;margin-bottom:12px}.inspector label{display:block;margin-bottom:10px;font-size:13px;color:#414d59}.inspector label input{margin-top:4px}.pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}.clip-actions,.dialog-actions{display:flex;gap:8px}.danger{margin-left:auto;color:#a12628}.timeline .panelhead>div{display:flex;align-items:baseline;gap:10px}.placeholder{color:var(--muted);font-size:13px;margin:auto}#feedback:not(:empty){padding:10px 2px;color:#785416;overflow-wrap:anywhere}footer{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px;padding:12px 2px}dialog{border:1px solid var(--line);background:var(--panel);color:inherit;border-radius:3px;width:min(440px,calc(100% - 24px));padding:18px}dialog::backdrop{background:#2f37434d}progress{width:100%;accent-color:var(--accent);margin:0 0 12px}.dialog-actions{justify-content:flex-end}@media(max-width:740px){.top{position:sticky;top:0;z-index:2}}

.timeline{--track-bg:#f1f3f5;--cursor:#34495b}
.timeline-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;background:var(--surface-soft);border-bottom:1px solid var(--line)}
.timeline-tools button{font-size:13px;min-width:38px;padding:5px 10px;touch-action:manipulation}
.timeline-tools #split{display:flex;align-items:center;gap:5px;white-space:nowrap}
#timelineTime{font:600 13px Consolas,monospace;color:#394755;white-space:nowrap}
.timeline-zoom{display:flex;gap:4px}
#timelineScroll{overflow-x:auto;overflow-y:hidden;background:var(--track-bg);scrollbar-color:#9aa5b0 #e6eaee;scrollbar-width:thin;overscroll-behavior-x:contain}
#timelineScroll:focus-visible{outline:2px solid var(--focus);outline-offset:-2px}
#timelineContent{position:relative;min-width:100%}
#ruler{position:relative;height:32px;border-bottom:1px solid var(--line);background:#e7ebef;cursor:ew-resize;touch-action:none;user-select:none;overflow:hidden}
.ruler-tick{position:absolute;bottom:0;width:1px;height:5px;background:#a6b0bb;color:#495663;pointer-events:none}
.ruler-major{height:9px;background:#718191}
.ruler-major::after{content:attr(data-label);position:absolute;bottom:12px;left:4px;color:#495663;font:11px Consolas,monospace;white-space:nowrap}
#track{display:flex;align-items:stretch;position:relative;height:76px;box-sizing:border-box;padding:8px 14px 9px;background:#f2f4f6}
#track .placeholder{position:sticky;left:14px;margin:auto;color:var(--muted);font-size:13px}
.timeline-clip{position:relative;flex:none;min-width:0;border-radius:3px}
.timeline-clip-body{position:absolute;display:block;inset:0;border:1px solid #9caab8;background:#cfd8e1;color:#20323f;border-radius:3px;padding:0;overflow:hidden;width:100%;min-width:0;min-height:0;white-space:nowrap;text-align:left}
.timeline-clip-body:not(:disabled):hover{border-color:#8096ab}
.timeline-clip-body:focus-visible,.trim-handle:focus-visible{outline-offset:-2px;outline-color:var(--focus)}
.timeline-clip-label{position:absolute;inset:0 0 auto;overflow:hidden;text-overflow:ellipsis;min-height:20px;padding:1px 8px;background:#f1f4f7;font-size:11px;line-height:18px}
.filmstrip{display:flex;position:absolute;inset:20px 0 0;background:repeating-linear-gradient(90deg,#d1dae3 0,#d1dae3 62px,#b9c5d2 62px,#b9c5d2 64px)}
.filmstrip span{flex:1 1 0;background-size:auto 100%;background-position:center;background-repeat:repeat-x;min-width:0}
.timeline-selected{z-index:2}
.timeline-selected .timeline-clip-body{border:2px solid var(--accent)}
.timeline-selected .timeline-clip-label{padding-inline:15px;background:#d9e2eb}
.trim-handle{display:none;position:absolute;top:1px;bottom:1px;width:min(48%,18px);min-height:0;padding:0;border:0;border-radius:0;background:transparent;cursor:ew-resize;touch-action:none;z-index:1}
.trim-handle::after{content:"";position:absolute;top:0;bottom:0;width:7px;background:var(--accent);border-radius:2px}
.trim-handle::before{content:"";position:absolute;top:39%;height:22%;width:2px;background:#f5f7fa;z-index:1}
.timeline-selected .trim-handle{display:block}
.trim-start{left:0}.trim-start::after{left:1px}.trim-start::before{left:4px}
.trim-end{right:0}.trim-end::after{right:1px}.trim-end::before{right:4px}
.trim-handle:not(:disabled):hover{background:#62748824}
.timeline-trimming .timeline-clip-body{border-style:dashed}
#playhead{pointer-events:none;position:absolute;top:25px;bottom:0;left:0;width:2px;background:var(--cursor);box-shadow:0 0 1px #fff;z-index:3}
#playhead::before{content:"";position:absolute;top:-1px;left:-4px;width:10px;height:9px;background:var(--cursor);clip-path:polygon(0 0,100% 0,100% 50%,50% 100%,0 50%)}
@media(max-width:740px){.timeline-tools{gap:4px;padding:5px 7px}.timeline-tools button{padding:5px 7px;min-width:32px}.trim-handle{width:min(48%,23px)}#timelineTime{font-size:12px}}

.keyframe-panel{border-top:1px solid var(--line);margin-top:12px;padding-top:10px}
.keyframe-panel h3{margin:0 0 8px;font-size:14px}
.keyframe-actions{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:8px}
.keyframe-actions button{padding:5px 7px;font-size:12px}
.timeline-tools #addKey{font-size:22px;line-height:1;color:#725319}
.timeline-tools #addKey[aria-pressed=true]{background:#f5e8cc;color:#b47a16;border-color:#b78228}
.keyframe-marker{position:absolute;bottom:0;left:clamp(8px,var(--key-position),calc(100% - 8px));transform:translateX(-50%);width:17px;height:20px;min-height:0;border:0;border-radius:0;background:transparent;padding:0;z-index:2;touch-action:manipulation}
.keyframe-marker::after{content:"";width:8px;height:8px;transform:rotate(45deg);background:#b47a16;box-shadow:0 0 0 1px #6c4d22}
.keyframe-marker:not(:disabled):hover::after,.keyframe-marker:focus-visible::after{background:white}
@media(max-width:370px){.timeline-tools{flex-wrap:wrap}.timeline-zoom{margin-left:auto}}

#audioTrack{padding:0 0 6px}
.audio-row{height:37px;position:relative;border-top:1px solid #dde2e8}
.audio-clip{position:absolute;display:block;top:3px;height:30px;min-height:0;min-width:0;padding:3px 7px;border:1px solid #9cabb9;border-radius:3px;background:#dce4ec;color:#263846;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;touch-action:manipulation}
.audio-clip[aria-pressed=true]{border-color:#687f96;background:#c8d6e3}
.audio-tools{display:flex;align-items:center;flex-wrap:wrap;gap:7px;padding:9px 12px;border-top:1px solid var(--line)}
.audio-tools button{font-size:13px}
.audio-tools #recordAudio{color:#a12628}
.audio-tools #recordAudio.recording{background:#f8e9ea;border-color:#c38488}
#recordStatus{font-size:13px;color:#a12628}
.audio-fields{display:grid;grid-template-columns:minmax(110px,1.5fr) minmax(85px,.65fr) minmax(110px,1fr) auto;align-items:end;gap:8px;margin:0 12px 12px;padding:8px 10px 10px;border:1px solid var(--line);border-radius:3px;min-width:0}
.audio-fields legend,.audio-fields label{font-size:12px;color:#414d59}
.audio-fields label{display:grid;gap:4px;min-width:0}
.audio-fields select{width:100%}
.audio-fields .danger{margin-left:0}
@media(max-width:620px){.audio-fields{grid-template-columns:1fr 1fr}.audio-fields .danger{justify-self:end}}

.keyframe-interval{margin:0 0 8px;padding:6px 8px;border-radius:3px;background:#fbf4e6;color:#5e4a22;font-size:12px;overflow-wrap:anywhere}

.screen canvas{cursor:grab;touch-action:none}
.screen canvas.preview-dragging{cursor:grabbing}
.keyframe-marker[aria-current=true]::after{background:#fff;box-shadow:0 0 0 1px #7b622d,0 0 0 3px #b78228}
#timelineContent[data-active-object=audio] .timeline-selected .timeline-clip-body{border-color:#a1afbd}
#timelineContent[data-active-object=audio] .timeline-selected .trim-handle{display:none}
#timelineContent:not([data-active-object=audio]) .audio-clip[aria-pressed=true]{border-color:#9cabb9;background:#dce4ec}

.preview-controls{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:6px}
.preview-controls #resetZoom{font-size:12px;padding:5px 8px;white-space:nowrap}

.editor{
  display:grid;
  grid-template-columns:minmax(0,1.18fr) minmax(0,1fr);
  grid-template-areas:"timeline preview" "inspector inspector";
  gap:14px;
}
.editor>.timeline{grid-area:timeline;display:flex;flex-direction:column}
.editor>.monitor{grid-area:preview;display:flex;flex-direction:column}
.editor>.inspector{grid-area:inspector}
.editor .panel{background:var(--panel)}
.editor .panelhead{min-height:57px;padding-inline:14px}
.monitor .screen{
  height:clamp(220px,28vw,420px);
  min-height:0;
  margin:10px 12px;
}
.monitor .screen canvas{max-height:100%;max-width:100%;min-width:0}
.monitor .transport{margin-top:auto}
.editor #timelineScroll{flex:1 1 auto;min-height:126px}
.editor #timelineContent{min-height:100%;background:#f2f4f6}
.editor #track{height:84px;padding-bottom:10px}
.editor .audio-tools{background:var(--surface-soft)}
.editor .timeline-tools{justify-content:flex-start}
.editor .timeline-tools #timelineTime{margin-left:auto}
.editor .timeline-zoom{margin-left:auto}
.inspector #fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;margin:12px 14px 15px}
.inspector .clip-settings,.inspector .keyframe-panel{min-width:0}
.inspector .keyframe-panel{border-top:0;border-left:1px solid var(--line);margin:0;padding:0 0 0 18px}
.inspector .keyframe-panel h3{line-height:1.5}
.inspector .clip-settings .clip-actions{margin-top:12px}
.editor .audio-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.editor .audio-fields .danger{justify-self:end}

@media(max-width:920px){
  .editor{grid-template-columns:minmax(0,1fr);grid-template-areas:"preview" "timeline" "inspector";gap:11px}
  .monitor .screen{height:auto;min-height:166px}
  .monitor .screen canvas{max-height:min(38svh,300px)}
  .editor #timelineScroll{min-height:0}
}
@media(max-width:590px){
  
  .editor .panelhead{min-height:52px;padding-inline:10px}
  .monitor .screen{margin:8px}
  .monitor .transport{padding:0 8px 8px}
  .editor #track{height:74px}
  .inspector #fields{grid-template-columns:minmax(0,1fr);gap:14px;margin:10px}
  .inspector .keyframe-panel{border-left:0;border-top:1px solid var(--line);padding:12px 0 0}
}

@font-face{
  font-family:Anuphan;
  src:url("fonts/anuphan-thai-wght-normal.woff2") format("woff2");
  font-style:normal;
  font-weight:100 700;
  font-display:swap;
  unicode-range:U+0E00-0E7F;
}
@font-face{
  font-family:Anuphan;
  src:url("fonts/anuphan-latin-wght-normal.woff2") format("woff2");
  font-style:normal;
  font-weight:100 700;
  font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root{
  color-scheme:light;
  font-family:Anuphan,"Segoe UI",Tahoma,sans-serif;
  color:#242b32;
  background:#f0f2f4;
  --panel:#fff;
  --surface-soft:#f6f7f9;
  --line:#cdd3da;
  --muted:#535f6a;
  --accent:#303a45;
  --ink:#fff;
  --focus:#365d83;
}

.top{background:var(--panel)}
.brand strong{letter-spacing:-.025em;font-weight:700}
.brand small{font-weight:500}
.editor .panelhead{min-height:52px}
.editor .timeline{align-self:start}
.editor .monitor{align-self:start}
.editor .timeline-tools,.editor .audio-tools{background:var(--surface-soft)}
button,a.primary{border-radius:3px}
.editor button:not(.primary):not(.keyframe-marker):not(.trim-handle){font-weight:600}
#timelineTime,.transport output,.ruler-major::after{font-family:Anuphan,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums}
#timelineTime{font-weight:700;letter-spacing:.035em}
.ruler-major::after{font-size:11px}
.timeline-lanes{
  --visual-row:80px;
  --audio-row:40px;
  display:grid;
  grid-template-columns:66px minmax(0,1fr);
  min-width:0;
  background:#f2f4f6;
  border-bottom:1px solid var(--line);
}
.timeline-gutter{
  display:grid;
  grid-template-rows:32px var(--visual-row) minmax(var(--audio-row),1fr);
  border-right:1px solid var(--line);
  background:#edf0f3;
}
.lane-ruler{background:#e8ecf0;border-bottom:1px solid var(--line)}
.lane-icon{display:grid;place-items:start center;padding-top:9px;border-bottom:1px solid #d6dce3;color:#526170}
.lane-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.lane-icon.visual-icon{color:#394958;align-items:center;padding-top:0}
.lane-icon.audio-icon{color:#526476;border-bottom:0}
.editor #timelineScroll{min-height:0}
.editor #timelineContent{min-height:0;background:#f2f4f6}
#ruler{background:#e8ecf0}
.editor #track{
  display:flex;
  align-items:stretch;
  height:var(--visual-row);
  padding:7px 0 8px 10px;
  background:#f6f8fa;
}
#track #addVisual{
  flex:0 0 42px;
  width:42px;
  min-height:42px;
  align-self:center;
  margin-left:6px;
  padding:0;
  font-size:22px;
  line-height:1;
  color:var(--accent);
  background:#e8edf1;
  border:1px dashed #8394a5;
}
#track #addVisual:not(:disabled):hover{background:#dce5ed;border-color:var(--accent)}
.timeline-clip-body{border-color:#a0aebc;background:#d7e0e8}
.timeline-selected .timeline-clip-label{background:#dce5ee}
.trim-handle::before{background:#f9fbfc}
#audioTrack{
  position:relative;
  min-height:var(--audio-row);
  box-sizing:border-box;
  background:#f1f4f6;
  border-top:1px solid #d6dce3;
}
#audioTrack{padding-bottom:0;background:#edf1f4}
#audioTrack .audio-row{height:var(--audio-row);border-top:1px solid #d4dce5}
#audioTrack .audio-row:first-child{border-top:0}
#audioTrack.empty-audio-lane::after{
  content:"";
  display:block;
  margin:18px 10px 0;
  height:0;
  border-top:1px dashed #adb9c5;
}
.audio-clip{top:4px;background:#dde5ec;border-color:#9daebf}
.audio-clip[aria-pressed=true]{border-color:#687f96;background:#c8d6e3}
@media(max-width:590px){
  .timeline-lanes{--visual-row:70px;grid-template-columns:36px minmax(0,1fr)}
  .lane-icon svg{width:17px;height:17px}
  #track #addVisual{flex-basis:37px;width:37px;min-height:38px}
}

.lane-icon.visual-icon{display:flex;justify-content:center;align-items:center;gap:3px}
.track-switch,.clip-switch,.inspector-switch{display:inline-flex;align-items:center;justify-content:center;gap:5px;touch-action:manipulation}
.track-switch{min-height:31px;width:28px;padding:2px;border-radius:3px;color:var(--accent)}
.track-switch svg,.clip-switch svg,.inspector-switch svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.track-switch .icon-off,.clip-switch .icon-off,.inspector-switch .icon-off{display:none}
[data-off=true] .icon-on{display:none}
[data-off=true] .icon-off{display:initial}
.editor button[data-off=true]{color:#9e3032;background:#f8e9eb;border-color:#ccaaad}
.timeline-clip{container-type:inline-size}
.clip-switches{position:absolute;top:1px;right:2px;display:flex;gap:2px;z-index:3}
.timeline-selected .clip-switches{right:12px}
.clip-switch{min-height:20px;width:21px;padding:1px;border-radius:4px;color:#304251;background:#e5ecf2}
.clip-switch svg{height:14px;width:14px}
.timeline-clip:not(.timeline-selected) .timeline-clip-label{padding-right:28px}
.timeline-clip.clip-with-source:not(.timeline-selected) .timeline-clip-label{padding-right:48px}
.timeline-selected .timeline-clip-label{padding-right:38px}
.timeline-selected.clip-with-source .timeline-clip-label{padding-right:58px}
.native-waveform{position:absolute;bottom:2px;left:2px;width:calc(100% - 4px);height:22px;pointer-events:none;background:#f1f5ff;border-top:1px solid #d0ddea}
.timeline-clip[data-source-muted=true] .native-waveform{opacity:.48;filter:grayscale(.8)}
.timeline-clip.has-native-waveform .filmstrip{bottom:23px}
.timeline-clip.has-native-waveform .keyframe-marker{bottom:22px}
.timeline-clip[data-picture-hidden=true] .filmstrip{opacity:.25}
.clip-visibility-settings{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.inspector-switch{font-size:12px;padding:5px 9px}
@container(max-width:64px){
  .timeline-clip .clip-switches{display:none}
  .timeline-clip .timeline-clip-label{padding-right:5px}
}
@media(max-width:590px){
  .lane-icon.visual-icon{flex-direction:column;gap:2px}
  .track-switch{min-height:28px;width:28px}
}

.lane-icon.audio-icon{padding-top:4px}
.lane-icon.audio-icon .track-switch{color:#526476}
.lane-icon.audio-icon .track-switch[data-off=true]{color:#9e3032}
.audio-block{
  position:absolute;
  display:flex;
  min-width:28px;
  height:31px;
  top:4px;
  overflow:hidden;
  border:1px solid #9daebf;
  border-radius:3px;
  background:#dde5ec;
  color:#263846;
}
.audio-block .audio-clip{
  position:static;
  flex:1;
  height:100%;
  min-width:0;
  min-height:0;
  overflow:hidden;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  cursor:grab;
  text-align:left;
  touch-action:pan-y;
}
.audio-block .audio-clip[aria-pressed=true]{background:transparent}
#timelineContent[data-active-object=audio] .audio-block:has(.audio-clip[aria-pressed=true]){border-color:#738ca4;background:#cad9e6}
.audio-block.audio-dragging{z-index:2;outline:1px dashed #67849e;opacity:.85}
.audio-block.audio-dragging .audio-clip{cursor:grabbing}
.audio-clip-settings{
  display:grid;
  place-items:center;
  flex:0 0 25px;
  width:25px;
  min-height:0;
  padding:0;
  border:0;
  border-left:1px solid #a7b7c6;
  border-radius:0;
  background:#e8eef4;
  color:#35495b;
  touch-action:manipulation;
}
.audio-clip-settings svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.audio-clip-settings .icon-off{display:none}
.audio-clip-settings[aria-expanded=true]{background:#d0dce8;color:#263a4d}
.editor .audio-fields{grid-template-columns:minmax(85px,1fr) minmax(105px,1.25fr) auto auto;align-items:end}
.audio-fields legend{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.audio-fields #closeAudioSettings{font-size:18px;min-width:33px;padding:5px}
@media(max-width:590px){
  .editor .audio-fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .audio-fields #closeAudioSettings{justify-self:end}
}

.timeline-zoom button{white-space:nowrap}
.timeline-zoom button[aria-pressed=true]{background:#e5ebf1;color:#435668;border-color:#9eafbf;opacity:1}
.added-audio-muted .audio-block{opacity:.58}
.audio-muted-status{font-size:12px;color:#852d36;padding:4px 7px;background:#f8e9eb;border:1px solid #ccaaad}
@media(max-width:440px){
  .editor .timeline-tools{flex-wrap:wrap}
  .editor .timeline-zoom{gap:3px}
  .editor .timeline-zoom button{padding-inline:5px}
}

.audio-trim{
  display:none;
  position:absolute;
  bottom:0;
  width:12px;
  height:14px;
  min-height:0;
  padding:0;
  border:0;
  border-radius:0;
  background:#435b72;
  cursor:ew-resize;
  touch-action:none;
  z-index:2;
}
.audio-trim::after{content:"";width:2px;height:8px;background:#fff}
.audio-trim-start{left:0}
.audio-trim-end{right:0}
#timelineContent[data-active-object=audio] .audio-block:has(.audio-clip[aria-pressed=true]) .audio-trim{display:grid}
#timelineContent[data-active-object=audio] .audio-block:has(.audio-clip[aria-pressed=true]) .audio-clip-settings{align-self:start;height:16px}
@media(pointer:coarse){
  .audio-trim{width:15px;height:15px}
}

.workspace-resize{display:none}
@media(min-width:921px){
  .editor{
    grid-template-columns:minmax(0,var(--timeline-share,50fr)) 18px minmax(0,var(--preview-share,50fr));
    grid-template-rows:minmax(var(--workspace-height,clamp(350px,37vw,575px)),auto) 14px auto;
    grid-template-areas:"timeline width preview" "height height height" "inspector inspector inspector";
    gap:0;
  }
  .editor>.timeline,.editor>.monitor{align-self:stretch;min-height:0}
  .editor>.timeline{overflow:visible}
  .editor>.timeline #timelineScroll{flex:0 0 auto}
  .editor>.monitor .panelhead{flex-wrap:wrap}
  .editor>.monitor .preview-controls{margin-left:auto}
  .editor>.monitor .screen{flex:1 1 0;height:auto;min-height:0;display:flex;align-items:center;justify-content:center}
  .editor>.monitor .screen canvas{max-height:100%;max-width:100%;height:auto;width:auto}
  .editor>.monitor .transport{flex-shrink:0}
  .workspace-resize{
    display:grid;
    place-items:center;
    touch-action:none;
    outline-offset:-2px;
  }
  .workspace-resize-width{grid-area:width;cursor:col-resize}
  .workspace-resize-height{grid-area:height;cursor:row-resize}
  .workspace-resize::before{content:"";background:#aab6c2;border-radius:2px}
  .workspace-resize-width::before{width:3px;height:42px}
  .workspace-resize-height::before{width:44px;height:3px}
  .workspace-resize:focus-visible{outline:2px solid var(--focus)}
  .workspace-resize:hover::before,.workspace-resize:focus-visible::before,
  .editor.resizing-width .workspace-resize-width::before,.editor.resizing-height .workspace-resize-height::before{background:#526b80}
  .editor.resizing-width,.editor.resizing-height{user-select:none}
}

.ui-icon{
  width:16px;
  height:16px;
  flex:none;
  fill:none;
  stroke:currentColor;
  stroke-width:1.65;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.brand .mark{width:27px;height:30px;background:transparent;color:#344a5e;border-radius:0}
.brand .mark .ui-icon{width:24px;height:24px;stroke-width:1.8}
#play{border:0;background:transparent}
#play .icon-play{fill:currentColor;stroke:none}
#play .icon-pause,#play[data-playing=true] .icon-play{display:none}
#play[data-playing=true] .icon-pause{display:block}
.timeline-tools button,.audio-tools button,.preview-controls #resetZoom{
  border:0;background:transparent;
}
.timeline-tools #addKey,.timeline-tools #addKey[aria-pressed=true]{border:0;background:transparent}
.timeline-tools #addKey[aria-pressed=true] .ui-icon{fill:currentColor;stroke-width:1}
.timeline-tools #split,#addAudio,#recordAudio{display:inline-flex;align-items:center;justify-content:center;gap:6px}
#recordAudio .record-dot,#recordAudio .record-stop{fill:currentColor;stroke:none}
#recordAudio .record-stop,#recordAudio.recording .record-dot{display:none}
#recordAudio.recording .record-stop{display:block}
.timeline-tools button:not(:disabled):hover,.audio-tools button:not(:disabled):hover,
.preview-controls #resetZoom:not(:disabled):hover,#play:not(:disabled):hover{background:#e6edf2}
.timeline-zoom button[aria-pressed=true]{border:0;background:#e5ebf1}
.editor .track-switch,.editor .track-switch[data-off=true],
.editor .clip-switch,.editor .clip-switch[data-off=true]{
  border:0;
  background:transparent;
}
.editor .track-switch:not(:disabled):hover,.editor .clip-switch:not(:disabled):hover{background:#dbe5ed}
.track-switch svg,.clip-switch svg{width:14px;height:14px;stroke-width:1.6}
#track #addVisual,#track #addVisual:not(:disabled):hover{
  border:0;
  background:transparent;
}
#track #addVisual .ui-icon{width:19px;height:19px}
#track #addVisual:not(:disabled):hover{background:#e6edf2}
.audio-block .audio-clip{
  position:relative;
  z-index:1;
  display:block;
  line-height:14px;
  padding:2px 7px 13px;
  background:transparent;
}
#timelineContent:not([data-active-object=audio]) .audio-block .audio-clip[aria-pressed=true]{background:transparent}
.audio-waveform{
  position:absolute;
  bottom:1px;
  height:12px;
  pointer-events:none;
  opacity:.85;
}
.audio-clip-settings{
  position:relative;
  z-index:2;
  background:transparent;
  border:0;
  color:#35495b;
}
.audio-clip-settings[aria-expanded=true],.audio-clip-settings:not(:disabled):hover{background:#c7d6e2}

.editor .timeline-tools{padding-block:4px}
.timeline-tools button{
  min-height:30px;
  min-width:30px;
  padding:3px 7px;
  font-size:12px;
}
.timeline-tools .timeline-zoom{gap:2px;align-items:center}
.timeline-tools .timeline-zoom button{min-width:auto}
.timeline-tools .timeline-zoom button[aria-pressed=true]{
  background:transparent;
  color:#314f67;
  text-decoration:underline;
  text-underline-offset:4px;
}
.timeline-tools .timeline-zoom button:not(:disabled):hover{background:#e6edf2}
.timeline-tools #zoomIn,.timeline-tools #zoomOut{width:28px;padding-inline:5px}
.editor>.monitor .panelhead{min-height:46px;padding-block:5px}
.preview-controls{gap:5px}
.preview-controls .ratio{gap:4px;font-size:12px}
.preview-controls #ratio{
  min-height:28px;
  padding:2px 3px;
  font-size:12px;
  font-weight:650;
  border:0;
  background:transparent;
  color:#314f67;
}
.preview-controls #ratio:not(:disabled):hover{background:#e6edf2}
.preview-controls #resetZoom{min-height:28px;padding:3px 6px}

.inspector input:not([type=range]){
  min-height:32px;
  padding:4px 6px;
  border:0;
  border-bottom:1px solid #aebecb;
  border-radius:0;
  background:#f8fafb;
}
.inspector input[type=range]{min-height:30px}
.inspector label{margin-bottom:7px}
.inspector label input{margin-top:3px}
.inspector .pair{gap:6px 9px}
.inspector .clip-actions,.inspector .keyframe-actions,.inspector .clip-visibility-settings{gap:4px}
.inspector button{
  min-height:30px;
  padding:3px 7px;
  font-size:12px;
  border:0;
  background:transparent;
}
.inspector button:not(:disabled):hover{background:#e6edf2}
.inspector button[data-off=true]{background:#f8e9eb}
.inspector #applyKeys:not(:disabled){background:#e8edf2}
.editor .timeline-gutter .track-switch{width:30px;min-height:30px}
.editor .timeline-gutter .track-switch svg{width:18px;height:18px;stroke-width:1.7}

@media(pointer:coarse){
  .timeline-tools button,.preview-controls #ratio,.preview-controls #resetZoom,
  .inspector button{min-height:36px}
  .inspector input:not([type=range]){min-height:36px;font-size:16px}
}

:root{
  --focus:#326ab2;
  --control-blue:#285a97;
  --control-hover:#eaf2fb;
  --control-selected:#deecfb;
}
.top .brand .mark,.editor .ui-icon,.editor .clip-switch svg,.editor .audio-clip-settings svg{color:var(--control-blue)}
.top #export{background:var(--control-blue)!important;border-color:var(--control-blue)!important}
.top #export:not(:disabled):hover{background:#204b80!important}
.editor button:not(:disabled):focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.editor .timeline-tools button:not(:disabled):hover,.editor .audio-tools button:not(:disabled):hover,
.editor .preview-controls #ratio:not(:disabled):hover,.editor .preview-controls #resetZoom:not(:disabled):hover,
.editor .inspector button:not(:disabled):hover{background:var(--control-hover)}
.editor .timeline-tools .timeline-zoom button[aria-pressed=true]{
  color:var(--control-blue);background:var(--control-selected);text-decoration:none;
}
.editor .track-switch[role=switch]{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:31px;
  padding:2px;
  color:#586d84;
}
.editor .track-switch[role=switch][aria-checked=true]{color:var(--control-blue)}
.editor .track-switch[role=switch]:not(:disabled):hover{background:var(--control-hover)}
.editor .track-switch[role=switch] svg{width:22px;height:22px;stroke-width:1.7}
.editor .track-switch[role=switch][data-off=true]{color:#a43f43}
.editor .clip-switch[data-off=true] svg{color:#a43f43}
.editor #recordAudio svg{color:currentColor}
.editor #addKey[aria-pressed=true] .ui-icon{color:#a36c12}
@media(max-width:590px){.editor .track-switch[role=switch]{min-height:30px}}

.editor .timeline-gutter .visual-icon{flex-direction:column;gap:2px}
.editor #audioLaneSwitches{display:flex;flex-direction:column;padding:0;align-items:stretch}
.audio-lane-slot{
  box-sizing:border-box;
  flex:0 0 var(--audio-row);
  display:grid;
  place-items:center;
  border-bottom:1px solid #d4dce5;
}
.audio-lane-slot:last-child{border-bottom:0}
.audio-block[data-muted=true]{opacity:.58}

.top-actions{display:flex;align-items:center;gap:3px}
.ffmpeg-host-link{display:inline-flex;align-items:center;min-height:38px;padding:6px 9px;color:#405774;font-size:13px;font-weight:600;line-height:1.2;text-decoration:none}
.ffmpeg-host-link:hover,.ffmpeg-host-link:focus-visible{color:#254b83;text-decoration:underline}
.top-actions>button:not(.primary){min-height:38px;border:0;background:transparent;color:#405774;border-radius:999px;padding:6px 11px;font-weight:600;white-space:nowrap}
.top-actions>button:not(.primary):enabled:hover,.top-actions #effectsToggle[aria-expanded=true]{background:#eef3f9;color:#254b83}
.top-actions #export{border-radius:999px;min-height:38px;white-space:nowrap}
.top-actions #effectsToggle,.effects-panel #effectsClose{border:0;background:transparent;color:var(--control-blue)}
.top-actions #effectsToggle[aria-expanded=true],.top-actions #effectsToggle:hover{background:var(--control-selected)}
.effects-panel{margin-bottom:12px;border-radius:12px}
.effects-inner{display:grid;grid-template-columns:minmax(0,1fr) minmax(250px,320px);gap:12px;padding:12px}
.effect-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(88px,1fr));gap:5px}
.effect-choice{padding:4px 5px;min-height:52px;border:0;border-radius:8px;color:#405774;background:transparent;cursor:grab;font-size:12px}
.effect-choice:enabled:hover{background:#f0f4fa}
.effect-choice:active{cursor:grabbing}
.effect-choice[aria-pressed=true]{background:#e5eefb;color:#204b87}
.effect-choice::before{content:"◨";font-size:16px;color:#477eab;line-height:1}
.effect-choice[data-effect^=slide]::before{content:"⇆"}
.effect-choice[data-effect^=wipe]::before{content:"▰"}
.effect-choice[data-effect^=zoom]::before{content:"⧉"}
.effect-choice[data-effect=iris]::before{content:"◉"}
.effect-choice[data-effect=black]::before{content:"◼"}
.effect-choice[data-effect=white]::before{content:"◻"}
.effects-inner p{margin:5px 0 0;font-size:12px}
.effect-settings{border-left:1px solid var(--line);padding-left:12px}
.effect-settings #effectTarget{font-weight:650;margin-bottom:6px}
.effect-settings label{font-size:12px}
.effect-settings input{min-height:34px}
.effect-buttons{display:flex;flex-wrap:wrap;gap:4px;margin-top:7px}
.effect-buttons button{padding:4px 7px;min-height:32px;font-size:12px}
.editor #track .timeline-clip{position:absolute;top:7px;bottom:8px}
#track #addVisual{position:absolute;top:50%;transform:translateY(-50%);margin-left:0}
.transition-join{
  position:absolute;top:50%;transform:translate(-50%,-50%);z-index:4;
  min-width:19px;width:19px;min-height:23px;height:23px;padding:0;
  border:1px solid #a7bed1;background:#f3f8fc;color:#37638a;font-size:12px;
}
.transition-join[data-applied=true],.transition-join[aria-pressed=true]{background:#daeaf9;border-color:#6e9bc2;color:#254c73}
.transition-join.effect-drop{outline:3px solid #9cc4e5}
@media(max-width:680px){
  .effects-inner{grid-template-columns:minmax(0,1fr)}
  .effect-settings{border-left:0;border-top:1px solid var(--line);padding:8px 0 0}
  .top-actions #effectsToggle,.top-actions #export{padding-inline:7px;font-size:12px}
}

.top{position:relative;z-index:6;justify-content:flex-start}
.top-actions{flex:none;margin-left:auto}
.top .brand{flex:none}
main{padding-top:12px}
.project-menu{position:relative;min-width:0;max-width:min(320px,35vw)}
.project-menu summary{
  display:flex;align-items:center;gap:5px;min-height:34px;padding:4px 7px;
  cursor:pointer;color:#43576a;list-style:none;
}
.project-menu summary::-webkit-details-marker{display:none}
.project-menu summary span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
.project-menu summary:hover,.project-menu[open] summary{background:#eef3f9;border-radius:999px}
.project-menu summary:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.project-menu .ui-icon{color:var(--control-blue)}
.project-popover{
  display:grid;gap:7px;position:absolute;top:calc(100% + 7px);left:0;
  width:270px;padding:12px;background:#fff;border:1px solid #e2e9f1;border-radius:12px;
  box-shadow:0 8px 22px #2f455b18;
}
.project-popover label,.project-popover #saved{font-size:12px;color:var(--muted)}
.project-popover input{min-height:34px;padding:4px 6px;border:0;border-bottom:1px solid #dce5ef;border-radius:0;background:transparent}
@media(max-width:740px){
  .top{position:sticky;top:0}
  .project-menu{position:static}
  .project-popover{top:100%;left:12px;width:min(270px,calc(100vw - 24px))}
}
@media(max-width:460px){
  .top{gap:4px}
  .top .brand{gap:4px}
  .top .brand strong{font-size:17px}
  .top .brand small{display:none}
  .project-menu summary{padding-inline:4px}
  .project-popover input{font-size:16px}
}

.effect-selection{display:flex;align-items:center;gap:8px;margin-bottom:7px}
.effect-selection button{min-height:30px;padding:4px 7px;font-size:12px}
.effect-selection button[aria-pressed=true]{background:var(--control-selected);color:var(--control-blue)}
#effectSelectionCount{font-size:12px;color:var(--muted)}
.effect-edges{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
.effect-edge{display:grid;justify-items:start;align-content:center;gap:2px;background:#f7fafc;border-style:dashed;padding:6px 10px}
.effect-edge strong{font-size:13px;color:#2d536f}
.effect-edge span{font-size:12px;color:var(--muted);text-align:left}
.effect-edge[aria-pressed=true]{border-style:solid;border-color:#93b5d0;background:#eaf3fa}
.effect-edge.effect-drop{outline:2px solid var(--focus)}
.editor #track .transition-join{
  top:3px;bottom:3px;transform:translateX(-50%);width:23px;height:auto;min-height:0;
  display:grid;place-items:start center;align-content:start;gap:0;
  border:0;background:transparent;padding:0;
}
.transition-join svg{
  width:18px;height:18px;color:#335c80;fill:none;stroke:currentColor;
  stroke-width:2;stroke-linecap:round;stroke-linejoin:round;
}
.transition-join::after{
  content:"";position:absolute;top:18px;bottom:0;left:calc(50% - 1px);border-left:2px dashed #466c8e;
}
.transition-join[data-applied=true]::after{border-left-style:solid}
.editor #track .transition-join:hover,.editor #track .transition-join.effect-drop{
  background:#e2f0fba8;outline:1px solid #a3c4df;
}
@media(max-width:440px){
  .effect-edges{gap:5px}
  .effect-edge{padding-inline:6px}
}

.timeline-clip-body:not(:disabled){cursor:grab;touch-action:pan-y}
.timeline-clip.clip-dragging{opacity:.5}
.timeline-clip.clip-dragging .timeline-clip-body{cursor:grabbing}
.clip-drop-line{
  position:absolute;top:3px;bottom:3px;width:3px;transform:translateX(-50%);
  background:#326ab2;z-index:6;pointer-events:none;
}
.clip-drop-line::before{
  content:"";position:absolute;top:0;left:-3px;width:9px;height:4px;background:inherit;
}
.clip-drag-label{
  position:absolute;bottom:8px;z-index:7;pointer-events:none;
  max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  padding:3px 6px;background:#285a97;color:#fff;font-size:11px;
}

.preview-controls .fill-images{display:inline-flex;align-items:center;gap:4px;white-space:nowrap;font-size:12px;color:#314f67;cursor:pointer}
.preview-controls #fillImages{width:14px;min-height:14px;height:14px;padding:0;margin:0;accent-color:var(--control-blue)}

.timeline-lanes{--layer-row:37px}
.timeline-gutter{grid-template-rows:32px var(--layer-row) var(--visual-row) var(--layer-row) minmax(var(--audio-row),1fr)}
.layer-lane-icon{padding-top:8px;font-size:17px;font-weight:700;color:#285a97}
.layer-track{height:var(--layer-row);position:relative;background:#eef3f7;border-bottom:1px solid #d2dce5}
#backgroundTrack{border-top:1px solid #d2dce5;background:#edf2f0}
.layer-track:empty::after{content:"";position:absolute;top:50%;left:10px;right:10px;border-top:1px dashed #becad5;pointer-events:none}
.layer-block{
  position:absolute;top:4px;display:block;height:28px;min-height:0;min-width:23px;
  padding:3px 6px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:grab;touch-action:pan-y;
  background:#dbe9f7;color:#28496a;border-color:#a2bdd7;font-size:12px;
}
#backgroundTrack .layer-block{background:#dfece6;color:#315449;border-color:#aac6b9}
.layer-block[aria-pressed=true],#backgroundTrack .layer-block[aria-pressed=true]{outline:1px solid #326ab2;outline-offset:-1px}
.layer-tools{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:5px 10px;border-bottom:1px solid var(--line);background:var(--surface-soft)}
.layer-tools button,.layer-fields button{min-height:32px;padding:3px 7px;border:0;background:transparent;color:#285a97;font-size:12px}
.layer-tools button:hover,.layer-fields button:hover{background:var(--control-hover)}
.layer-fields{min-width:0;margin:6px 10px 9px;padding:7px;border:1px solid var(--line)}
.layer-fields legend,.layer-fields label{font-size:12px;color:var(--muted)}
.layer-fields label{display:grid;gap:3px}
.layer-fields input,.layer-fields select{width:100%;min-height:32px;padding:3px 5px}
.layer-fields #removeLayer{color:#a12628}
.layer-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px 7px;margin-top:4px}

#aiCutDialog{max-height:calc(100dvh - 24px);overflow:auto}
#aiCutFields{border:0;padding:0;margin:12px 0;min-width:0;display:grid;gap:8px}
#aiCutFields label{display:grid;gap:3px;font-size:13px}
#aiCutDialog p{font-size:13px}
#aiCutStatus:empty{display:none}
#exportClip{margin-top:8px;width:100%}
#exportStory{margin-top:8px;width:100%}
#scriptReview{--ai-accent:#3157c7;--ai-text:#172840;--ai-muted:#52647a;inset:0;width:100%;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:#edf2f8;color:var(--ai-text);overflow:hidden}
#scriptReview[open]{display:flex;flex-direction:column}
body:has(#scriptReview[open]){overflow:hidden}
.script-header{flex:none;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;padding:12px clamp(12px,3vw,48px);background:#fff;color:var(--ai-text)}
.script-header button:first-child{justify-self:start}
.script-header button:last-child{justify-self:end}
.script-header>div:last-child{justify-self:end;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:4px}
#aiSettingsDialog{max-height:calc(100dvh - 24px);overflow:auto}
#aiSettingsForm fieldset{display:grid;gap:8px;margin:12px 0;padding:10px;border:1px solid var(--line)}
#aiSettingsForm legend{font-weight:700}
#aiSettingsForm label{font-size:13px}
#aiSettingsForm input[type=checkbox]{width:16px;min-height:16px;vertical-align:middle}
#aiSettingsForm fieldset button{justify-self:start;min-height:34px}
#aiSettingsForm p{margin:0;font-size:13px}
#aiSettingsForm #geminiKeyStatus{margin:10px 0}
.script-header button{min-height:38px;border:0;background:transparent;color:#405774;border-radius:999px}
.script-header button:enabled:hover{background:#eef3f9;color:#254b83}
.script-header h2{font-size:20px;font-weight:750}
.script-nav{display:flex;justify-content:center;gap:4px;flex:none;overflow-x:auto;padding:6px 10px;background:#fff;border-bottom:1px solid #d0dbea}
.script-nav button{flex:none;min-height:36px;white-space:nowrap;border:0;border-bottom:2px solid transparent;border-radius:0;background:none;color:var(--ai-muted);padding:5px clamp(6px,2vw,18px)}
.script-nav button[aria-current=step]{border-bottom-color:#4268ca;color:#2448a9}
.script-workspace{flex:1;min-height:0;overflow:auto;overscroll-behavior-y:contain;width:100%;display:grid;grid-template-columns:minmax(0,1fr);gap:18px;max-width:1280px;margin:0 auto;padding:22px clamp(12px,3vw,40px) 42px;align-content:start;scroll-padding-top:20px}
.script-step{min-width:0;background:#fff;border:1px solid #d3dcea;border-radius:14px;padding:clamp(15px,2.2vw,28px);box-shadow:0 4px 12px #1b33530a}
#scriptReview .primary{--ink:#fff;--accent:var(--ai-accent);border-radius:8px}
#scriptReview .primary:enabled:hover{--accent:#2546ae}
#scriptMediaFields{max-width:740px}
.script-step h3{margin:0 0 14px;font-size:19px}
.script-step h4{font-size:14px;margin:10px 0 6px}
.script-step fieldset{display:grid;gap:10px;min-width:0;margin:0;padding:0;border:0}
.script-step fieldset>button{justify-self:start}
.script-step label{display:grid;gap:4px;font-size:13px;font-weight:600}
.script-story-settings,.script-story-checks,.script-story-checks>div,.script-story-footer{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px}
.script-story-settings{align-items:end}
.script-source-picker{display:flex;flex-wrap:wrap;gap:8px}
.script-source-picker button{border-radius:8px}
.script-story-settings>label{flex:0 1 210px;min-width:0;max-width:100%}
.script-story-settings select{min-height:38px}
.script-story-checks .script-check{margin:2px 0}
.script-story-footer{justify-content:space-between}
.script-story-footer p{margin:0}
@media(max-width:540px){.script-story-settings>label{flex:1 1 145px}}
.script-progress{display:flex;align-items:center;gap:10px;margin:6px 0 12px;color:#294b75;font-size:13px}
.script-progress progress{flex:1;min-width:0;margin:0;accent-color:#3156cc}
.script-progress output{white-space:nowrap;font-variant-numeric:tabular-nums}
#scriptProgressDialog{max-width:calc(100% - 32px);width:460px;padding:22px;border:1px solid #ced9ed;border-radius:16px;color:#1d3454;background:#fff;box-shadow:0 14px 44px #182c5260}
#scriptProgressDialog::backdrop{background:#12264f70}
#scriptProgressHeading{font-size:18px}
#scriptProgressDetail{margin:10px 0;color:#365474;overflow-wrap:anywhere}
#scriptProgressDialog .dialog-actions{margin-top:18px}
#scriptPopupCancel{display:inline-flex;align-items:center;padding:8px 15px;border:1px solid #cddbf0;border-radius:10px;background:#eef4ff;color:#284579;font-size:14px;font-weight:650;transition:background-color .15s,border-color .15s}
#scriptPopupCancel:enabled:hover{border-color:#aabfe2;background:#e1ebfc}
#scriptPopupCancel:focus-visible{outline:2px solid #3157c7;outline-offset:3px}
.script-step-state{display:block;margin-top:3px;color:#486180;font-size:11px;font-weight:550}
.script-nav [data-working=true] .script-step-state{color:#244ebd;font-weight:700}
.script-live-step{flex:none;display:flex;align-items:center;gap:9px;min-height:42px;margin:0;padding:8px clamp(12px,4vw,40px);border-bottom:1px solid #d5e1f4;background:#e7efff;color:#1d3c69;font-size:14px;font-weight:650;overflow-wrap:anywhere}
.script-live-step::before{content:"";flex:none;width:11px;height:11px;border-radius:50%;background:currentColor}
.script-live-step[data-state=working]::before{background:transparent;border:2px solid #9bb2e3;border-top-color:#254eb4;animation:script-status-spin .8s linear infinite}
.script-live-step[data-state=done]{background:#e6f5ed;color:#215e42}
.script-live-step[data-state=error],.script-live-step[data-state=cancelled]{background:#fff3e5;color:#794319}
@keyframes script-status-spin{to{transform:rotate(1turn)}}
@media(prefers-reduced-motion:reduce){.script-live-step[data-state=working]::before{animation:none}}
.script-dictation-field{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 8px}
.script-dictation-field :is(input,textarea){grid-column:1/-1}
.script-dictation-field button{min-height:32px;padding:4px 10px;font-size:13px}
.script-dictation-field button[aria-pressed=true]{color:#fff;background:#245692}
.script-step input,.script-step textarea,.script-step select{width:100%;min-width:0}
.script-step input:not([type=checkbox]):not([type=range]),.script-step textarea,.script-step select{border:1px solid #cad6e6;border-radius:8px;color:var(--ai-text);background:#fbfdff}
.script-step textarea{resize:vertical;min-height:52px;padding:8px 10px;font:inherit}
#scriptFiles{min-height:54px;padding:8px;border-style:dashed!important;background:#f4f7ff}
#scriptFiles::file-selector-button{margin-inline-end:10px;padding:7px 12px;border:0;border-radius:6px;background:#e4ebfd;color:#284ba7;font:inherit;cursor:pointer}
#scriptFileOptions{display:flex;flex-wrap:wrap;gap:4px 10px}
#scriptFileOptions .script-check{margin:0;padding:4px 8px;border-radius:6px;background:#edf2f8;overflow-wrap:anywhere}
.script-step .script-check{display:flex;align-items:center;gap:7px;margin:6px 0}
#geminiKeyReady{color:#21613b;font-size:13px;font-weight:650}
.script-step [role=status]:has(>#geminiKeyReady[hidden]){display:none}
.script-step input[type=checkbox]{width:18px;min-height:18px;margin:0;accent-color:var(--control-blue)}
.script-length{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.script-step p{font-size:13px;margin:8px 0;color:var(--ai-muted)}
#scriptPlanStatus:not(:empty),#scriptMediaStatus:not(:empty),#scriptReviewStatus:not(:empty){padding:7px 10px;background:#edf4ff;border-radius:7px;color:#24446f}
.script-step [role=status]:empty{display:none}
#scriptPreview{width:100%;max-height:180px;background:#121920;margin:4px 0;scroll-margin-top:80px}
#scriptTranscripts{border-bottom:1px solid var(--line)}
#scriptTranscripts section{padding:8px 10px 10px;margin-bottom:8px;border:1px solid #d4deeb;border-radius:9px;background:#f8fbff}
#scriptTranscripts section>div{display:grid;grid-template-columns:1fr auto;gap:6px;align-items:center;margin-bottom:7px}
#scriptTranscripts button{padding-inline:7px;font-size:12px}
#scriptStories article{border:1px solid #d6e1ef;border-radius:12px;background:#f8faff;padding:clamp(12px,2vw,20px);margin:12px 0}
#scriptStories h3{font-size:16px;margin:0 0 10px}
#scriptStories ol{padding-inline-start:26px;margin:0}
#scriptStories li{margin:0;font-size:13px;padding:16px 0 16px 5px;border-bottom:1px solid #dce7f3}
#scriptStories li:last-child{border-bottom:0}
#scriptStories li::marker{color:#3157a0;font-weight:750;font-variant-numeric:tabular-nums}
.story-result{display:grid;justify-items:start;gap:8px;margin-top:10px}
.story-phone{position:relative;display:grid;place-items:center;width:100%;max-width:240px;aspect-ratio:9/16;background:#eef2f7;border-radius:12px;overflow:hidden}
.script-gallery{grid-column:1/-1}
#scriptGalleryCards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,205px),1fr));gap:14px}
#scriptGalleryCards .story-result{align-content:start;align-self:start;margin-top:0;min-width:0;padding:9px;border-radius:16px;background:#fff;border:1px solid #dbe4f0;box-shadow:0 3px 12px #20385c0b}
#scriptGalleryCards .story-phone{max-width:none;background:#e4edf8}
.story-result-meta{font-size:12px;color:var(--ai-muted);font-variant-numeric:tabular-nums}
.story-phone canvas,.story-phone video,.story-phone img{display:block;width:100%;height:100%;min-height:0;object-fit:contain;position:absolute;inset:0}
.story-phone-title{position:absolute;top:16%;left:6%;right:6%;text-align:center;padding:5px;background:#171c24e8;color:white;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.story-result-actions{display:flex;flex-wrap:wrap;gap:6px}
.story-result-actions button{min-height:36px;font-size:13px}
#scriptGalleryCards .story-result-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
#scriptGalleryCards .story-result-actions>button{padding:6px 8px;border-radius:9px;min-width:0}
.story-result-settings{border-top:1px solid #e7edf5}
.story-result-settings summary{padding:9px 2px;color:#385273;font-size:12px;font-weight:650;cursor:pointer}
.story-result-settings-body,.story-result-secondary{display:grid;gap:7px}
.story-result-settings-body select{min-height:36px;font-size:12px}
.story-result-secondary button{display:block;min-height:34px;padding:5px 8px;border:0;border-radius:7px;background:#f2f6fc;color:#29486b;text-align:left;font-size:12px}
.story-result-secondary button:hover{background:#e7effb}
.script-trim-editor{margin-top:18px;padding:16px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;border:1px solid #cad9ed;border-radius:12px;background:#f4f8fd;scroll-margin:12px}
.script-trim-controls{display:grid;gap:8px;align-content:center;min-width:0}
.script-trim-header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.script-trim-header{grid-column:1/-1}
.script-trim-header button{min-height:34px}
#scriptTrimPreview{width:100%;max-height:240px;object-fit:contain;background:#e4eaf2;border-radius:6px}
.script-range{position:relative;height:42px;margin-inline:8px;--trim-start:0%;--trim-end:100%}
.script-range-track{position:absolute;left:8px;right:8px;top:18px;height:6px;border-radius:8px;background:linear-gradient(to right,#cbd5e1 0 var(--trim-start),#2461a7 var(--trim-start) var(--trim-end),#cbd5e1 var(--trim-end) 100%)}
.script-range input[type=range]{position:absolute;inset:0;margin:0;height:42px;min-height:0;border:0;background:transparent;appearance:none;pointer-events:none}
.script-range input[type=range]::-webkit-slider-thumb{appearance:none;width:16px;height:28px;border:2px solid white;border-radius:4px;background:#245d9d;box-shadow:0 0 0 1px #245d9d;pointer-events:auto;cursor:ew-resize}
.script-range input[type=range]::-moz-range-thumb{width:14px;height:26px;border:2px solid white;border-radius:4px;background:#245d9d;pointer-events:auto;cursor:ew-resize}
#scriptTrimEnd::-webkit-slider-thumb{background:#16767b}
#scriptTrimEnd::-moz-range-thumb{background:#16767b}
#scriptTrimTimes{font-size:13px;font-variant-numeric:tabular-nums}
.script-trim{display:grid;grid-template-columns:repeat(2,minmax(0,100px));align-items:end;gap:5px}
.script-shot-layout{display:grid;grid-template-columns:minmax(0,1fr) clamp(180px,28%,280px);grid-template-areas:"info preview";gap:12px 22px;align-items:start}
.script-shot-info{grid-area:info;min-width:0;display:grid;gap:10px}
.script-shot-hint:empty{display:none}
.script-shot-hint{display:grid;gap:3px;padding:7px 9px;border-left:3px solid #3157c7;border-radius:4px;background:#edf3ff;color:#254775;font-size:13px;overflow-wrap:anywhere}
.script-shot-copy p{margin:4px 0 0;color:#223951;line-height:1.55;overflow-wrap:anywhere}
.script-shot-source{font-size:12px;font-weight:700;color:#456485}
.script-shot-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px}
.script-shot-actions button{min-height:32px;padding:3px 7px;border:0;border-radius:6px;background:transparent;color:#3157a0;font-size:12px;white-space:nowrap}
.script-shot-actions button:enabled:hover{background:#e8effa}
.script-shot-actions select{flex:1 1 180px;width:auto;min-height:36px;padding:4px 7px;font-size:12px;text-overflow:ellipsis}
.script-shot-preview{position:relative;aspect-ratio:16/9;background:#e2eaf4;border-radius:8px;overflow:hidden}
.script-shot-preview{grid-area:preview}
.script-shot-preview canvas,.script-shot-preview video{display:block;width:100%;height:100%;object-fit:contain;position:absolute;inset:0}
.script-shot-preview button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:36px;min-height:36px;padding:0;border:0;border-radius:50%;background:#172840d9;color:white}
.script-shot-preview .script-shot-expand{top:7px;left:auto;right:7px;transform:none;width:auto;min-height:30px;padding:4px 8px;border-radius:7px;font-size:12px}
#scriptStories .script-shot-strip{display:flex;gap:12px;min-width:0;overflow-x:auto;scroll-snap-type:x proximity;padding:6px 4px 12px;list-style:none;counter-reset:script-shot}
#scriptStories .script-shot-strip>li{position:relative;flex:0 0 clamp(175px,24%,235px);min-width:0;padding:8px;border:1px solid #d6e1ef;border-radius:10px;background:#fff;scroll-snap-align:start;counter-increment:script-shot}
#scriptStories .script-shot-strip>li::before{content:counter(script-shot);position:absolute;top:14px;left:14px;z-index:1;min-width:22px;padding:3px 5px;border-radius:5px;background:#172840e8;color:white;text-align:center;font-size:11px;pointer-events:none}
.script-shot-strip .script-shot-layout{grid-template-columns:minmax(0,1fr);grid-template-areas:"preview" "info";gap:8px}
#scriptShotZoom{width:min(860px,calc(100% - 32px));max-height:calc(100dvh - 32px);border-radius:14px}
#scriptShotZoomVideo{display:block;width:100%;max-height:calc(100dvh - 145px);margin:12px 0;object-fit:contain;background:#152237;border-radius:8px}
#scriptShotZoomStatus:empty{display:none}
@media(max-width:620px){.script-shot-layout{grid-template-columns:minmax(0,1fr);grid-template-areas:"preview" "info";gap:9px}.script-shot-actions select{flex-basis:100%}}
.script-trim input,.script-trim button{min-height:32px;font-size:12px;padding:3px 6px}
.script-trim label{font-size:12px}
@media(max-width:760px){
  .script-header button{font-size:12px;padding-inline:6px}
  .script-header h2{font-size:16px}
  .script-nav button{font-size:12px}
  .script-trim-editor{grid-template-columns:1fr}
}
.project-actions{display:grid;gap:1px}
.project-actions button,#projectList button{display:block;width:100%;min-height:34px;padding:5px 8px;font-size:13px;text-align:left;border:0;border-radius:6px;background:transparent;font-weight:550}
.project-actions button:enabled:hover,#projectList button:enabled:hover{background:#eef3f9;color:#254b83}
#saveProject{color:var(--control-blue)}
#projectLibrary{border-top:1px solid #e5ebf3;padding-top:8px}
#projectLibrary h2{font-size:12px;color:var(--muted);padding-inline:8px}
#projectList{display:grid;gap:1px;list-style:none;margin:4px 0 0;padding:0;max-height:38vh;overflow:auto}
#projectList button{overflow-wrap:anywhere}
#projectList button[aria-current=true]:disabled{opacity:1;background:transparent;color:#24539a;font-weight:700}
@media(max-width:560px){
  .top:has(#aiCut){flex-wrap:wrap}
  .top-actions #aiCut,.top-actions #aiSettings{padding-inline:7px;font-size:12px}
}
