*{box-sizing:border-box} :root{color-scheme:light;--bg:#eee;--panel:#fafafa;--surface:#f5f5f5;--field:#e8e8e8;--line:#dedede;--ink:#202020;--muted:#747474;--thumb:#252525;--track:#d6d6d6;--button:#1d1d1d;--on-button:#fff;--accent:#6259da;--overlay:rgba(245,245,245,.94)}
:root[data-theme=dark]{color-scheme:dark;--bg:#171719;--panel:#202023;--surface:#252528;--field:#303034;--line:#36363a;--ink:#ececef;--muted:#a0a0a8;--thumb:#eeeeef;--track:#48484d;--button:#e8e8eb;--on-button:#171719;--accent:#b6afff;--overlay:rgba(28,28,31,.95)}
body{margin:0;font-family:Arial,Helvetica,sans-serif;font-size:14px;background:var(--bg);color:var(--ink)}button,input,select,a{font:inherit}button,select{cursor:pointer}button,a,input,select{outline-offset:3px}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--accent)}button:disabled,select:disabled,input:disabled{opacity:.4;cursor:default}button{color:inherit}button,select,input{border-radius:0}button{border:0;background:none}a{color:inherit;text-decoration:none}button:hover:not(:disabled){background:var(--field)}[hidden]{display:none!important}.topbar{height:54px;background:var(--panel);border-bottom:1px solid var(--line);display:flex;align-items:stretch;justify-content:space-between}.brand{display:flex;align-items:center;gap:9px;padding:0 18px}.brand svg{height:25px;width:25px;fill:none;stroke:currentColor;stroke-width:2}.brand strong{font-size:15px}.brand>span{font-size:12px;color:var(--muted);margin-top:2px}.top-actions{display:flex;align-items:stretch}.top-actions>*{border-left:1px solid var(--line);padding:0 18px;min-width:72px;background:transparent}.top-actions #theme{font-size:13px;min-width:90px}.button{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:36px;padding:8px 14px;border:1px solid var(--line);background:var(--surface);font-weight:500}.button.primary{background:var(--button);color:var(--on-button);border-color:var(--button)}.button.primary:hover{filter:brightness(.9);background:var(--button)}.top-actions .button{border-top:0;border-bottom:0;border-right:0;padding:0 24px}.button svg,.controls-heading svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.4}.workspace{display:grid;grid-template-columns:48px minmax(0,1fr) 326px;height:calc(100dvh - 54px);min-height:590px}.toolrail{background:var(--panel);border-right:1px solid var(--line);display:flex;align-items:center;flex-direction:column}.rail-button{height:48px;width:100%;font-size:24px;border-bottom:1px solid var(--line)}.rail-bottom{margin-top:auto;font-size:11px;padding-bottom:18px;color:var(--muted);letter-spacing:1px}.stage{display:flex;min-width:0;flex-direction:column;overflow:hidden}.stage-top{min-height:47px;padding:12px 22px;border-bottom:1px solid var(--line)}.clip-info{display:flex;align-items:center;gap:9px;min-width:0}.clip-info h1{font-size:13px;font-weight:500;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:50%}.file-icon{color:var(--muted);font-size:16px}#clipMeta{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.viewport{display:flex;justify-content:center;align-items:center;flex:1;min-height:260px;position:relative;overflow:auto;padding:35px 28px;background-image:linear-gradient(var(--line),var(--line)),linear-gradient(var(--line),var(--line));background-size:1px 100%,100% 1px;background-position:center;background-repeat:no-repeat}.preview-unit{max-width:100%;flex-shrink:0}.canvas-toolbar{height:36px;display:flex;justify-content:space-between;align-items:center;gap:20px}.tabs{display:flex;gap:12px}.tabs button{font-size:12px;padding:5px 0;color:var(--muted);background:none}.tabs button.active{color:var(--ink);box-shadow:0 1px 0 var(--ink)}.preview-actions{display:flex;gap:8px;align-items:center}.preview-actions select{font-size:12px;background:transparent;border:0;min-width:45px}.icon-button{min-width:28px;min-height:28px;padding:5px;font-size:17px}.canvas-wrap{position:relative;width:100%;background:#000;line-height:0;box-shadow:0 0 0 1px var(--line)}canvas{display:block;width:100%;height:auto;outline-offset:4px}#poster{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}.canvas-caption{font-size:10px;letter-spacing:.6px;color:var(--muted);display:flex;justify-content:space-between;line-height:30px}.point-layer{position:absolute;inset:0;pointer-events:none}.origin-marker{position:absolute;transform:translate(-50%,-50%);width:19px;height:19px;border:1px solid white;border-radius:50%;background:rgba(0,0,0,.45);box-shadow:0 0 0 1px rgba(0,0,0,.5);pointer-events:auto;touch-action:none;color:#fff;font-size:10px;padding:0;line-height:17px}.origin-marker.selected:after{content:'';position:absolute;inset:-5px;border:1px solid rgba(255,255,255,.65);border-radius:50%}.stage-footer{background:var(--surface);border-top:1px solid var(--line);padding:10px 22px 14px}.transport{display:flex;align-items:center;gap:13px;min-height:36px}.transport input{flex:1;min-width:30px}.time{font-size:12px;font-variant-numeric:tabular-nums;color:var(--muted)}.stage-bottom,.stage-tip{display:flex;justify-content:space-between;align-items:center;gap:14px;color:var(--muted);font-size:12px}.stage-bottom{min-height:34px}.stage-tip{margin-top:3px}.stage-tip kbd{font:10px Arial;border:1px solid var(--line);padding:2px 4px;margin-right:4px}.text-button{font-size:12px;color:var(--muted);padding:5px 0;text-decoration:underline;text-underline-offset:3px}.controls{background:var(--panel);border-left:1px solid var(--line);display:flex;flex-direction:column;min-height:0}.controls-heading{height:47px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 15px;flex-shrink:0}.controls-heading h2{font-size:14px;font-weight:500;margin:0;display:flex;align-items:center;gap:8px}.control-scroll{overflow-y:auto;scrollbar-width:thin;flex:1}.control-section{border-bottom:1px solid var(--line)}summary{font-size:14px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:space-between;padding:17px 14px;list-style:none}summary::-webkit-details-marker{display:none}summary:after{content:'⌄';color:var(--muted);font-size:14px;transform:rotate(-90deg)}details[open]>summary:after{transform:none}.section-content{padding:0 14px 17px}.control-row{min-height:33px;display:grid;grid-template-columns:minmax(0,1fr) 136px;align-items:center;column-gap:10px;margin-top:5px}.control-row>label,.control-row>span:first-child{font-size:14px;line-height:1.3}.control-row select,select{color:var(--ink)}.control-row select{width:100%;background:var(--field);border:0;height:26px;font-size:12px;padding:3px 7px}.range-pair{display:flex;align-items:center;gap:10px}.range-pair input[type=range]{width:100%;min-width:0}.range-pair input[type=number]{width:40px;flex-shrink:0;padding:4px 2px;font-size:12px;text-align:center;background:var(--field);border:0;color:var(--ink);-moz-appearance:textfield}.range-pair input::-webkit-inner-spin-button{display:none}input[type=range]{appearance:none;-webkit-appearance:none;height:4px;background:var(--track);accent-color:var(--thumb);cursor:pointer;margin:0}input[type=range]::-webkit-slider-thumb{appearance:none;width:9px;height:13px;background:var(--thumb);border:0;border-radius:0}input[type=range]::-moz-range-thumb{width:9px;height:13px;background:var(--thumb);border:0;border-radius:0}.transport input[type=range]::-webkit-slider-thumb{height:10px;width:7px}.gradient-preview{height:20px;margin:13px 0 10px;border:1px solid var(--line)}.color-editor{display:flex;height:27px;background:var(--field);align-items:center}.color-editor input[type=color]{padding:0;border:0;width:28px;height:27px;background:none;cursor:pointer;flex-shrink:0}.color-editor input[type=color]::-webkit-color-swatch-wrapper{padding:0}.color-editor input[type=color]::-webkit-color-swatch{border:0}.color-editor input[type=text]{width:100%;padding:4px 7px;border:0;background:transparent;color:var(--ink);font-size:12px;text-transform:uppercase;font-family:ui-monospace,monospace;min-width:0}.color-editor input[aria-invalid=true]{outline:1px solid #d35353}.segmented{display:flex;background:var(--field);padding:2px;margin-bottom:11px}.segmented button{flex:1;font-size:12px;padding:7px 4px;color:var(--muted)}.segmented button.active{background:var(--panel);color:var(--ink);box-shadow:0 1px 2px #0001}.point-actions{display:flex;gap:3px;justify-content:flex-end}.small-button{background:var(--field);font-size:17px;width:29px;height:24px}.help{font-size:12px;line-height:1.5;color:var(--muted);margin:9px 0 3px}.panel-footnote{font-size:12px;color:var(--muted);padding:20px 14px}.full{width:100%;font-size:12px;margin-top:10px}.notice{padding:10px;background:var(--field);font-size:13px;line-height:1.4}.download-panel{display:flex;align-items:center;justify-content:space-between;padding:12px 0;gap:10px}.download-panel strong{font-size:14px}.download-panel span{display:block;font-size:12px;color:var(--muted);margin-top:4px}.download-panel .button{font-size:13px}.busy-overlay,.drop-overlay{position:absolute;inset:0;background:var(--overlay);z-index:5;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:16px;text-align:center;padding:30px}.busy-overlay span,.drop-overlay span{font-size:13px;line-height:1.6;color:var(--muted)}progress{width:220px;height:5px;accent-color:var(--ink)}.spinner{width:22px;height:22px;border:2px solid var(--line);border-top-color:var(--ink);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.preview-unit:fullscreen{background:var(--bg);padding:24px;display:flex;flex-direction:column;justify-content:center;max-width:none!important;width:100%!important}.preview-unit:fullscreen .canvas-wrap{max-height:calc(100vh - 100px);display:flex;align-items:center;justify-content:center;box-shadow:none}.preview-unit:fullscreen canvas{max-height:calc(100vh - 100px);width:auto;max-width:100%}
@media(min-width:1500px){.workspace{grid-template-columns:48px minmax(0,1fr) 350px}.control-row{grid-template-columns:minmax(0,1fr) 148px}.viewport{padding:45px}}
@media(max-width:850px){.workspace{grid-template-columns:minmax(0,1fr) 300px}.toolrail{display:none}.brand>span{display:none}.top-actions>*{padding:0 9px;min-width:55px}.top-actions .button{padding:0 12px}.viewport{padding:20px}.control-row{grid-template-columns:minmax(0,1fr) 128px}.stage-tip>span:last-child{display:none}.stage-top,.stage-footer{padding-left:14px;padding-right:14px}.clip-info #clipMeta{display:none}}
@media(max-width:650px), (max-width:1000px) and (pointer:coarse){.topbar{height:50px}.brand{padding:0 10px;gap:5px}.brand strong{font-size:13px}.brand svg{width:20px}.top-actions #theme{min-width:62px;padding:0 4px;font-size:12px}.top-actions .button{padding:0 9px;font-size:12px}.top-actions #exportFormat{min-width:55px;width:59px;padding:0 3px;font-size:12px}.top-actions #export svg{display:none}.top-actions #uploadTop{font-size:0}.top-actions #uploadTop span{font-size:12px}.workspace{display:flex;flex-direction:column;height:auto;min-height:calc(100dvh - 50px)}.stage{min-height:465px}.stage-top{min-height:42px}.viewport{min-height:270px;padding:15px 18px}.stage-footer{padding-top:5px;padding-bottom:9px}.controls{border-top:1px solid var(--line);border-left:0}.control-scroll{overflow:visible}.control-row{grid-template-columns:minmax(0,1fr) minmax(140px,48%)}.controls-heading{height:44px}.section-content{padding:0 16px 17px}.control-section summary{padding:16px}.help{max-width:380px}.transport{gap:10px}.stage-tip{font-size:12px}}

.history-actions{display:flex;align-items:center;gap:2px;padding:0 10px;min-width:72px}.history-actions .icon-button{font-size:22px;width:30px}.top-actions .tip-button{font-size:13px;white-space:nowrap}.top-actions #uploadTop{white-space:nowrap}.top-actions #undo:disabled,.top-actions #redo:disabled{opacity:.3}.tip-button svg{height:19px;width:19px;flex-shrink:0}@media(max-width:1000px){.top-actions .tip-button{padding:0 12px}.tip-button span{display:none}.top-actions .tip-button svg{display:block}.top-actions .history-actions{padding:0 5px;min-width:64px}}@media(max-width:650px), (max-width:1000px) and (pointer:coarse){.brand strong{font-size:12px}.brand{padding:0 7px}.top-actions .history-actions{min-width:56px;padding:0 2px}.history-actions .icon-button{width:26px;min-width:26px;font-size:20px}.top-actions .tip-button{min-width:35px;padding:0 8px}.top-actions .button{padding:0 7px}.top-actions #uploadTop span{font-size:11px}.top-actions #exportFormat{width:52px;min-width:52px}.top-actions #export{font-size:11px}}

/* Keep Safari's video decoder attached; display:none can suppress frame delivery. */
.media-decoder{position:fixed;width:1px;height:1px;left:0;bottom:0;opacity:.01;pointer-events:none}
.tap-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;display:flex;align-items:center;gap:9px;min-height:48px;padding:12px 18px;border:1px solid #ffffff70;border-radius:28px;background:#171719dd;color:white;white-space:nowrap;font-size:14px;line-height:1.2;backdrop-filter:blur(12px)}
.tap-play:hover:not(:disabled){background:#303034}#preview{touch-action:pan-y pinch-zoom}
.expanded-preview{position:fixed!important;inset:0;z-index:20;background:var(--bg);padding:env(safe-area-inset-top) 12px env(safe-area-inset-bottom);width:100%!important;display:flex;flex-direction:column;justify-content:center}
@media(pointer:coarse){button,select,summary{touch-action:manipulation}input,select{font-size:16px!important}.icon-button,.small-button,.segmented button,.tabs button{min-height:44px;min-width:44px}.origin-marker{width:44px;height:44px;border:0;background:transparent;box-shadow:none}.origin-marker:before{content:'';position:absolute;inset:13px;border:1px solid white;border-radius:50%;background:#0006;box-shadow:0 0 0 1px #0005}.origin-marker.selected:after{inset:8px}.origin-marker{font-size:12px;line-height:44px}input[type=range]{height:32px;background:linear-gradient(var(--track),var(--track)) center/100% 4px no-repeat}input[type=range]::-webkit-slider-thumb{width:18px;height:24px;border-radius:3px}.transport input[type=range]::-webkit-slider-thumb{width:16px;height:22px}.control-row{min-height:48px}.control-row select,.range-pair input[type=number],.color-editor,.color-editor input[type=color]{height:40px}.color-editor input[type=color]{width:40px}.button{min-height:44px}}
@media(max-width:650px), (max-width:1000px) and (pointer:coarse){
 .topbar{height:auto;min-height:94px;display:grid;grid-template-columns:1fr;padding-top:env(safe-area-inset-top)}
 .brand{height:42px;padding:0 14px;border-bottom:1px solid var(--line)}.brand strong{font-size:14px}.brand>span{display:block}
 .top-actions{display:grid;grid-template-columns:80px 40px minmax(104px,1fr) 70px 66px;min-height:48px;width:100%}
 .top-actions .history-actions{padding:0;min-width:0;gap:0}.history-actions .icon-button{width:40px;min-width:40px;min-height:48px}
 .top-actions .tip-button{min-width:0;padding:0}.top-actions .button{padding:0 7px;font-size:13px}.top-actions #uploadTop span{font-size:13px}
 .top-actions #exportFormat{width:100%;min-width:0;font-size:16px;padding:0 3px}.top-actions #export{font-size:13px;min-width:0}
 .workspace{min-height:0}.stage{min-height:0}.stage-top{min-height:38px;padding:10px 12px}.clip-info h1{max-width:85%}
 .viewport{flex:none;min-height:0;padding:10px 12px 14px;overflow:hidden}.canvas-toolbar{height:44px;gap:8px}.tabs{gap:12px}.tabs button{min-height:44px}.preview-actions{gap:4px}
 .stage-footer{padding:5px 12px 12px}.transport{gap:6px;min-height:48px}.transport .icon-button{min-width:36px;min-height:44px;padding:3px}.transport .time{font-size:11px}.transport input{min-width:20px}
 .stage-bottom{align-items:flex-start;gap:8px;font-size:11px;padding:6px 0}.stage-bottom #status{line-height:1.5;max-width:70%}.text-button{padding:5px 0;white-space:nowrap}.stage-tip{font-size:11px}
 .controls{padding-bottom:env(safe-area-inset-bottom)}.controls-heading{height:48px}.control-section summary{min-height:52px}.control-row{min-height:46px}.control-row select{height:40px}.color-editor{height:40px}.color-editor input[type=color]{height:40px;width:40px}.range-pair input[type=number]{height:40px;width:46px}input,select{font-size:16px!important}
 .busy-overlay{position:fixed;z-index:30;padding:24px;inset:0}.busy-overlay #busyText{max-width:300px}.busy-overlay .button{min-height:44px}
}
@media(max-width:360px){.top-actions{grid-template-columns:64px 32px minmax(92px,1fr) 60px 55px}.history-actions .icon-button{width:32px;min-width:32px}.top-actions #uploadTop span{font-size:12px}.transport{gap:4px}.transport .icon-button{min-width:32px}.tabs{gap:9px}}

/* One dock keeps the actual canvas and transport mounted while controls scroll. */
.preview-dock{display:flex;flex-direction:column;flex:1;min-height:0;background:var(--bg)}
.preview-dock>.transport{flex-shrink:0;padding:5px 22px;background:var(--surface);border-top:1px solid var(--line)}
@media(max-width:850px){.preview-dock>.transport{padding-inline:14px}}
@media(max-width:650px), (max-width:1000px) and (pointer:coarse){
 html{scroll-padding-top:calc(var(--mobile-nav-height,94px) + var(--mobile-dock-height,320px) + 12px)}
 .topbar{position:sticky;top:0;z-index:12}
 .stage{display:contents}
 .preview-dock{position:sticky;top:var(--mobile-nav-height,94px);z-index:10;flex:none;box-shadow:0 4px 10px #0000000c}
 .preview-dock>.transport{padding:3px 12px;min-height:50px}
 .stage-top,.stage-footer{background:var(--surface)}
 .stage-footer{border-top:0}
 .canvas-wrap{margin-inline:auto}
 .controls{position:relative;z-index:0}
 .preview-dock:has(.expanded-preview){z-index:15}
 .preview-dock:has(#busyOverlay:not([hidden])){z-index:20}
}
@media(max-height:500px) and (max-width:650px), (max-height:500px) and (max-width:1000px) and (pointer:coarse){
 .topbar{min-height:48px}.topbar .brand{display:none}
 .canvas-caption{display:none}.viewport{padding-block:4px}
}

/* Examples is a separate view; the editor retains its media and settings. */
.examples-rail{display:flex;align-items:center;justify-content:center;position:relative}
.examples-rail svg,.examples-mobile svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.5}
.examples-rail[aria-pressed=true]{background:var(--field);color:var(--accent);box-shadow:inset 2px 0 var(--accent)}
.examples-mobile{display:none}
.workspace.examples-open{grid-template-columns:48px minmax(0,1fr)}
.examples-feed{min-width:0;overflow-y:auto;padding:36px clamp(20px,5vw,72px) 64px}
.examples-header,.examples-list{width:100%;max-width:1040px;margin-inline:auto}
.examples-header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:28px}
.examples-header h1{font-size:28px;letter-spacing:-.7px;font-weight:500;margin:0}
.examples-header h1:focus{outline:none}
.examples-header p{font-size:15px;color:var(--muted);margin:8px 0 0;line-height:1.5}
.examples-header .button{min-height:44px;white-space:nowrap}
.examples-list{display:grid;gap:28px}
.example-card{background:var(--panel);border:1px solid var(--line);min-width:0}
.example-video{position:relative;aspect-ratio:16/9;min-height:200px;background:#111}
.example-video iframe{position:absolute;inset:0;width:100%;height:100%;border:0;display:block}
.example-caption{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:21px 24px}
.example-caption h2{font-weight:500;font-size:18px;line-height:1.4;margin:0}
.example-caption p{font-size:14px;color:var(--muted);margin:6px 0 0}
.example-caption .button{font-size:14px;min-height:44px;white-space:nowrap}
@media(max-width:850px){
 .workspace.examples-open{grid-template-columns:minmax(0,1fr)}
 .examples-mobile{display:flex;align-items:center;gap:6px;padding:0 10px;font-size:14px;margin-right:auto;border-left:1px solid var(--line)}
 .examples-mobile[aria-pressed=true]{color:var(--accent);background:var(--field)}
 .topbar .brand{padding-inline:10px}
}
@media(max-width:650px), (max-width:1000px) and (pointer:coarse){
 .toolrail{display:none}
 .topbar{grid-template-columns:minmax(0,1fr) auto}
 .topbar .brand{padding-inline:14px}
 .top-actions{grid-column:1/-1}
 .examples-mobile{display:flex;align-items:center;gap:7px;min-height:42px;padding:0 14px;font-size:14px;border:0;border-bottom:1px solid var(--line);margin:0}
 .examples-mobile[aria-pressed=true]{color:var(--accent);background:var(--field)}
 .examples-feed{overflow:visible;padding:24px 12px 40px}
 .examples-header{gap:12px;margin-bottom:20px;align-items:flex-start}
 .examples-header h1{font-size:25px}
 .examples-header p{font-size:14px;margin-top:5px}
 .examples-header .button{font-size:13px;padding-inline:11px}
 .example-caption{padding:18px 16px;align-items:flex-start;flex-direction:column;gap:16px}
 .example-caption h2{font-size:17px}
 .example-caption .button{width:100%}
 html:has(.examples-open){scroll-padding-top:calc(var(--mobile-nav-height,94px) + 12px)}
}
@media(max-height:500px) and (max-width:650px), (max-height:500px) and (max-width:1000px) and (pointer:coarse){
 .examples-mobile{min-height:40px;grid-column:1/-1;justify-content:center}
 .examples-feed{padding-top:20px}
}
