:root{color-scheme:dark;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;background:#050505;color:#f3f4f5}
*{box-sizing:border-box}
body{margin:0;min-width:320px}
button,input,select{font:inherit}
button{cursor:pointer}
button:disabled{opacity:.35;cursor:default}
[hidden]{display:none!important}
button:focus-visible,input:focus-visible,select:focus-visible,label:focus-visible{outline:2px solid #b2d4ff;outline-offset:2px}
.app{display:flex;flex-direction:column;height:100dvh;max-width:1500px;margin:0 auto;overflow:hidden}
.top{height:52px;min-height:52px;background:#080808;display:flex;align-items:center;justify-content:space-between;padding:0 13px;border-bottom:1px solid #252525;z-index:12}
.brand{display:flex;align-items:baseline;gap:8px;min-width:0}
.brand h1{font-size:1.04rem;font-weight:690;margin:0;letter-spacing:-.03em}
.brand span{font-size:.69rem;color:#848d99;white-space:nowrap;font-variant-numeric:tabular-nums}
.header-actions{display:flex;gap:7px}
.top-action{height:36px;padding:0 10px;background:#1a1a1a;border:1px solid #323232;border-radius:8px;color:#d8d8d8;font-size:.73rem;display:inline-flex;align-items:center;cursor:pointer}
.drop-zone{flex:1;min-height:250px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:15px;margin:16px;border:1px dashed #444;border-radius:14px;color:#b4b4b4;text-align:center;padding:24px;cursor:pointer}
.drop-zone.dragover{background:#102339;border-color:#86baff}
.drop-zone strong{font-size:1.5rem;color:white}
.drop-zone>span:last-child{max-width:280px;font-size:.85rem;line-height:1.5}
.upload-icon{display:grid;place-items:center;font-size:2.1rem;border:1px solid #555;border-radius:50%;width:70px;height:70px;color:#eee}
#editor{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.workspace{flex:1;min-height:0;display:flex;flex-direction:column}
.viewer{flex:none;background:#090909;border-bottom:1px solid #2c2c2c;padding:8px 10px 6px}
.video-wrap{position:relative;height:clamp(108px,18dvh,192px);background:#000;display:flex;justify-content:center;align-items:center;border-radius:5px;overflow:hidden}
.video-wrap video{width:100%;height:100%;object-fit:contain}
.video-overlay{position:absolute;inset:0;display:grid;place-items:center;background:#000c;color:#ddd;font-size:.81rem}
.transport{display:flex;align-items:center;gap:8px;margin:7px 0 0;min-height:43px}
.play{width:42px;height:42px;flex:none;border:none;background:#e9edf2;color:#050505;border-radius:50%;font-size:.95rem}
.seek-area{flex:1;min-width:0}
input[type=range]{accent-color:#94c6ff}
.seek-area input{width:100%;height:22px;display:block;margin:0;touch-action:pan-y}
.seek-labels{display:flex;justify-content:space-between;color:#a0a3a7;font-size:.67rem;font-variant-numeric:tabular-nums}
.speed-now{font-size:.85rem;color:#a6ceff;min-width:43px;text-align:right;font-variant-numeric:tabular-nums;font-weight:740}
.sound-toggle{height:39px;width:39px;flex:none;border:1px solid #444;border-radius:9px;color:#dfefff;background:#1a2632;font-size:1.1rem}
.sound-toggle.muted{text-decoration:line-through;color:#999;background:#151515}
.file-meta,#previewHint{display:none!important}
.app[data-preview="collapsed"] .video-wrap{display:none}
.app[data-preview="collapsed"] .viewer{padding-top:3px}
.speed-panel{display:flex;flex-direction:column;flex:1;min-height:0;background:#050505}
.graph-heading{flex:none;min-height:45px;padding:4px 10px 4px 14px;display:flex;align-items:center;justify-content:space-between;gap:8px}
.graph-title{display:flex;flex-direction:column;gap:1px}
.graph-title strong{font-size:.9rem}
.graph-title span{font-size:.65rem;color:#969696}
.graph-actions{display:flex;gap:7px}
.subtle-button,.add-button{height:35px;border-radius:8px;padding:0 12px;font-size:.76rem;font-weight:650}
.subtle-button{color:#b9b9b9;border:1px solid #303030;background:#141414}
.add-button{color:#fff;background:#244263;border:1px solid #39638e}
.curve-container{position:relative;flex:1;min-height:140px;border-top:1px solid #292929;border-bottom:1px solid #292929;background:#090b0d;overflow:hidden;touch-action:none}
.curve-container svg{display:block;width:100%;height:100%;touch-action:none;user-select:none}
.curve-container .gridline{stroke:#292e32;stroke-width:1;vector-effect:non-scaling-stroke}
.curve-container .gridline.major{stroke:#4c555c}
.curve-path{fill:none;stroke:#9acaef;stroke-width:3;vector-effect:non-scaling-stroke;stroke-linejoin:round;pointer-events:none}
.graph-head{stroke:#fffc;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none}
.key-hit{fill:transparent;cursor:grab}
.key-dot{fill:#1c3445;stroke:#c1dfff;stroke-width:3;vector-effect:non-scaling-stroke;cursor:grab}
.key-dot.selected{fill:#fff;stroke:#81c2ff;stroke-width:4}
.graph-y{position:absolute;top:0;bottom:0;left:4px;width:48px;font-size:.62rem;color:#a9b2b8;pointer-events:none;font-variant-numeric:tabular-nums;text-shadow:0 1px 3px #000}
.graph-y span{position:absolute;left:0;transform:translateY(-50%)}
.time-axis{height:17px;flex:none;position:relative;color:#8c9299;font-size:.62rem;overflow:hidden;font-variant-numeric:tabular-nums}
.time-axis span{position:absolute;white-space:nowrap;transform:translateX(-50%)}
.zoom-toolbar{display:flex;align-items:center;justify-content:space-between;gap:3px;flex:none;height:41px;padding:0 7px;border-top:1px solid #242424;border-bottom:1px solid #303030}
.zoom-set{display:flex;align-items:center;gap:3px}
.zoom-set b{font-size:.69rem;color:#94aabd;font-weight:780;width:11px;text-align:center}
.zoom-set output{min-width:28px;text-align:center;font-size:.69rem;color:#c9d9e8;font-variant-numeric:tabular-nums}
.zoom-toolbar button{height:32px;min-width:32px;padding:0 4px;border:1px solid #343434;border-radius:7px;background:#171717;color:#ececec;font-size:1.1rem;font-weight:600}
.zoom-toolbar .fit-button{font-size:.69rem;padding:0 6px;min-width:31px}
.axis-pan{flex:none;display:flex;flex-direction:column;padding:0 9px}
.pan-slider{width:100%;height:19px;margin:1px 0}
.graph-footer{display:none}
.inspector{flex:none;min-height:185px;background:#111214;border-top:1px solid #373b3f;padding:8px 11px 10px}
.inspector-top{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px}
.selected-key{display:flex;align-items:baseline;gap:7px;min-width:0}
.selected-key strong{font-size:.82rem;white-space:nowrap}
.selected-key span{font-size:.73rem;color:#9ba4ae;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
.delete-key{background:transparent;border:none;color:#df8d8d;font-size:.75rem;padding:4px 7px}
.inspector-tabs{display:flex;gap:3px;margin:7px 0 8px;padding:3px;background:#090a0b;border:1px solid #282828;border-radius:9px}
.inspector-tabs button{flex:1;min-height:34px;border:0;border-radius:6px;background:transparent;color:#aaa;font-size:.78rem;font-weight:600}
.inspector-tabs button.active{background:#303840;color:#f3f6fa}
.inspector-content{min-height:84px}
.property-row{display:flex;align-items:center;gap:9px}
.property-row label{font-size:.76rem;color:#c4c8cd;min-width:60px}
.unit{color:#7e858c}
.property-row input{height:39px;min-width:0;width:110px;background:#090a0b;color:#f7f8fa;border:1px solid #414b55;border-radius:7px;padding:0 8px;font-weight:750;font-variant-numeric:tabular-nums;font-size:.91rem}
.property-row output{margin-left:auto;color:#9eb5c9;font-variant-numeric:tabular-nums;font-size:.76rem}
.main-slider{display:block;width:100%;height:23px;margin:4px 0 2px}
.speed-tools{display:flex;align-items:center;gap:6px;min-width:0}
.presets{display:flex;gap:5px;flex:1;overflow-x:auto;scrollbar-width:none;min-width:0;padding-bottom:2px}
.presets::-webkit-scrollbar{display:none}
.presets button{flex:none;min-width:47px;min-height:35px;padding:0 7px;background:#202326;border:1px solid #3a3e42;color:#cbd1d5;border-radius:7px;font-size:.7rem;font-weight:650}
.presets button.active{background:#233c55;border-color:#5f9ed4;color:#fff}
.fine-controls{display:flex;align-items:center;gap:3px}
.fine-controls button{height:35px;width:31px;background:#282a2d;border:1px solid #444;color:#fff;border-radius:7px;font-size:1.12rem}
.fine-controls select{height:35px;max-width:75px;background:#1a1a1a;border:1px solid #444;color:#ddd;border-radius:6px;padding:0 1px;font-size:.69rem}
.property-hint{font-size:.72rem;color:#858c94;margin:7px 0 0;line-height:1.4}
.curve-label{display:block;color:#a2abb5;font-size:.77rem;margin:0 0 8px}
#curveType{width:100%;height:45px;background:#1c232a;border:1px solid #4b5560;color:#eee;border-radius:8px;padding:0 12px}
.bottom-nav{display:flex;align-items:stretch;height:calc(57px + env(safe-area-inset-bottom));min-height:calc(57px + env(safe-area-inset-bottom));padding:3px 8px calc(3px + env(safe-area-inset-bottom));border-top:1px solid #303030;background:#101113}
.bottom-nav button{flex:1;min-height:48px;border:none;border-radius:9px;color:#a4abb2;background:transparent;font-weight:700;font-size:.85rem}
.bottom-nav button.active{color:#eff7ff;background:#263b4f}
.bottom-nav button span{font-size:.72rem;font-variant-numeric:tabular-nums;font-weight:450;margin-left:5px;color:#91adc8}
.output{display:none;flex:1;overflow-y:auto;padding:20px 16px 30px;background:#080808}
.app[data-screen="export"] .output{display:block}
.app[data-screen="export"] .speed-panel{display:none}
.output-title{display:flex;align-items:flex-start;gap:10px;position:relative;padding-bottom:17px;border-bottom:1px solid #2b2b2b}
.output-title h2{font-size:1.15rem;margin:0}
.output-title p{margin:5px 0;color:#a1a1a1;font-size:.77rem}
.estimate{margin-left:auto;text-align:right}
.estimate small{display:block;color:#919191;font-size:.72rem}
.estimate strong{display:block;font-variant-numeric:tabular-nums;font-size:1.14rem;margin-top:5px}
.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 10px;margin-top:20px}
.settings-grid label{font-size:.75rem;color:#abb5be;min-width:0}
.settings-grid select{display:block;width:100%;min-width:0;margin-top:8px;height:49px;background:#1b1c1f;border:1px solid #35393e;border-radius:9px;color:#f7f7f7;padding:0 8px;font-size:.81rem}
.audio-option{display:flex;align-items:center;justify-content:space-between;gap:13px;border-top:1px solid #292929;margin-top:20px;padding:18px 0;cursor:pointer}
.audio-option strong{display:block;font-size:.85rem}
.audio-option small{display:block;margin-top:5px;color:#8e959d;font-size:.73rem;line-height:1.45}
.audio-option input{height:22px;width:22px;flex:none;accent-color:#8ec1f7}
.hint{font-size:.75rem;color:#969ba1;line-height:1.45}
.export-button{display:block;height:53px;width:100%;border-radius:9px;border:0;background:#bcdcfb;color:#10151b;font-weight:750;font-size:1rem;margin-top:20px}
.export-button:disabled{opacity:.4}
.cancel-button{display:block;height:43px;width:100%;margin-top:10px;border-radius:9px;border:1px solid #474747;background:#222;color:#eee}
.progress-area{display:flex;align-items:center;gap:10px;margin-top:14px}
.progress-area progress{flex:1;min-width:0;height:11px;accent-color:#94c2ef}
.progress-area span{font-size:.74rem;color:#d4d4d4}
.status{font-size:.77rem;margin:12px 0;white-space:pre-line;color:#aeb8c1}
.status.error{color:#ff9999}
.download{display:flex;align-items:center;justify-content:center;min-height:45px;border-radius:9px;background:#182b3d;border:1px solid #4f7395;color:#dcefff;text-decoration:none;font-size:.85rem}
.app[data-preview="collapsed"] .top-action[aria-pressed="true"]{background:#24394a}
@media(max-height:730px) and (max-width:850px){
  .video-wrap{height:clamp(88px,15dvh,125px)}
  .inspector{padding-top:5px;padding-bottom:6px;min-height:171px}
  .graph-heading{min-height:39px}
  .zoom-toolbar{height:36px}
  .zoom-toolbar button{height:30px}
  .inspector-tabs{margin:3px 0 6px}
}
@media(max-width:375px){
  .fine-controls select{max-width:62px}
  .fine-controls button{width:28px}
  .presets button{min-width:44px}
  .zoom-toolbar{padding:0 4px;gap:2px}
  .zoom-set{gap:2px}
  .zoom-set output{min-width:25px}
  .zoom-toolbar button{min-width:28px}
  .brand span{font-size:.65rem}
  .top-action{padding:0 7px}
}
@media(min-width:851px){
  .app{height:100dvh}
  .top{height:60px;min-height:60px;padding:0 20px}
  .brand h1{font-size:1.2rem}
  .workspace{display:grid;grid-template-columns:minmax(300px,0.85fr) minmax(460px,1.2fr);gap:12px;padding:12px;min-height:0}
  .viewer{border:1px solid #2d2d2d;border-radius:12px;padding:12px;align-self:start}
  .video-wrap{height:auto;aspect-ratio:16/9}
  .speed-panel{border:1px solid #313131;border-radius:12px;overflow:hidden;min-height:0}
  .curve-container{min-height:240px}
  .inspector{min-height:185px}
  .graph-heading{min-height:49px}
  .output{max-width:660px;width:100%;margin:auto}
  .bottom-nav{height:59px;min-height:59px;justify-content:center;gap:8px}
  .bottom-nav button{flex:0 0 220px}
  .app[data-screen="export"] .viewer{max-width:500px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

/* An editor focus mode, without extra panels or a tall scrolling form. */
.app[data-focus="true"] .viewer,
.app[data-focus="true"] .inspector{display:none}
.app[data-focus="true"] #focusButton{background:#263d56;border-color:#6093c2;color:#fff}
@media(max-width:850px) and (max-height:730px){
  .app[data-preview="open"]:not([data-focus="true"]) .speed-panel{overflow-y:auto;overscroll-behavior:contain}
  .app[data-preview="open"]:not([data-focus="true"]) .curve-container{flex:none;height:165px}
  .app[data-preview="open"]:not([data-focus="true"]) .inspector{flex:none}
}

.brand h1{white-space:nowrap;flex:none}
.app[data-focus="true"] #previewToggle{display:none!important}
@media(max-width:430px){.brand span{display:none}.top-action{min-width:57px;text-align:center;justify-content:center}}

/* Compact phones: scroll only the graph/editor region, never behind the bottom nav. */
@media(max-width:850px) and (max-height:620px){
  .speed-panel{overflow-y:auto;overscroll-behavior:contain}
  .speed-panel .curve-container{flex:none;height:190px;min-height:190px}
  .speed-panel .inspector{flex:none}
}

@media(max-width:850px) and (max-height:620px){
  .app[data-focus="true"] .speed-panel{overflow:hidden}
  .app[data-focus="true"] .speed-panel .curve-container{flex:1;min-height:140px;height:auto}
}

/* Preview sizing. All controls stay visible in fullscreen, including on phones. */
.preview-tools{position:absolute;right:8px;top:8px;z-index:4;display:flex;gap:6px}
.preview-tools button{height:40px;width:40px;border:1px solid #ffffff55;color:white;background:#000b;border-radius:9px;font-size:1.45rem;display:grid;place-items:center;backdrop-filter:blur(5px)}
.preview-tools button:active{background:#263e58}
.app[data-preview-size="large"] .viewer .video-wrap{height:clamp(235px,43dvh,560px)}
.viewer:fullscreen,.viewer.fullscreen-fallback{display:flex;flex-direction:column;justify-content:center;align-items:stretch;background:#000;padding:max(8px,env(safe-area-inset-top)) 10px max(8px,env(safe-area-inset-bottom));width:100%;height:100%;max-height:none;overflow:hidden}
.viewer:fullscreen .video-wrap,.viewer.fullscreen-fallback .video-wrap{height:auto;flex:1;max-height:calc(100% - 76px);min-height:0;border-radius:0}
.viewer:fullscreen .transport,.viewer.fullscreen-fallback .transport{width:100%;max-width:1100px;margin:12px auto 0;flex:none}
.viewer:fullscreen .file-meta,.viewer.fullscreen-fallback .file-meta{display:none!important}
.viewer.fullscreen-fallback{position:fixed;inset:0;z-index:1000;height:100dvh}
.viewer:fullscreen .preview-tools,.viewer.fullscreen-fallback .preview-tools{top:12px;right:12px}
.viewer:fullscreen .preview-tools button,.viewer.fullscreen-fallback .preview-tools button{width:48px;height:48px}
@media(max-width:850px) and (max-height:730px){
  .app[data-preview-size="large"][data-preview="open"]:not([data-focus="true"]) .video-wrap{height:clamp(235px,43dvh,520px)}
}

/* Compact visual easing picker. Its own scroll area never pushes the timeline off-screen. */
.curve-picker-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none}
.curve-picker-heading .curve-label{margin:0;max-width:48%;font-size:.74rem}
.curve-picker-heading #curveType{width:52%;height:36px;padding:0 7px;font-size:.74rem}
.app[data-inspector="curve"] .inspector{display:flex;flex-direction:column;height:min(37dvh,300px);min-height:220px;max-height:320px}
.app[data-inspector="curve"] .inspector-content[data-property-panel="curve"]{display:flex;flex-direction:column;min-height:0;flex:1;gap:6px}
.curve-gallery{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;overflow-x:hidden;overflow-y:auto;flex:1;min-height:0;overscroll-behavior:contain;scrollbar-width:thin;padding:2px 1px}
.curve-gallery .curve-group-name{grid-column:1/-1;color:#8d9dad;font-size:.7rem;font-weight:700;padding:5px 2px 2px;position:sticky;top:0;background:#111214;z-index:1}
.curve-preset{min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px;justify-content:center;border:1px solid #363b42;border-radius:7px;background:#1b1e23;color:#b9c4ce;padding:4px 3px;min-height:71px;overflow:hidden}
.curve-preset svg{display:block;width:100%;height:43px}
.curve-preset span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:100%;font-size:.65rem}
.curve-preset.active{background:#183149;color:white;border-color:#90c9ff}
.curve-preset:disabled{opacity:.4}
.curve-preview-line{fill:none;stroke:#98cbff;stroke-width:2.7;stroke-linecap:round;stroke-linejoin:round}
.curve-strength{display:flex;align-items:center;gap:9px;flex:none;min-height:34px;border-top:1px solid #30363e;font-size:.74rem;color:#bdcbd6}
.curve-strength label{white-space:nowrap}
.curve-strength input{flex:1;min-width:0;height:27px}
.curve-strength output{min-width:34px;text-align:right;font-variant-numeric:tabular-nums}
.progress-area{display:flex;flex-direction:column;align-items:stretch;gap:7px;margin-top:16px}
.progress-area progress{height:13px;width:100%;display:block;accent-color:#8bc1fc}
.progress-head,.progress-timing{display:flex;align-items:center;justify-content:space-between;gap:12px}
.progress-head strong{font-weight:620;font-size:.82rem;color:#e3edfa}
.progress-head output{font-size:.95rem;font-variant-numeric:tabular-nums;font-weight:750}
.progress-timing{font-size:.76rem;color:#aeb6c1}
.progress-timing strong{font-variant-numeric:tabular-nums;color:#f2f6fa;margin-left:5px}
.progress-frames{font-size:.7rem;color:#8d99a4;font-variant-numeric:tabular-nums}
@media(max-width:850px) and (max-height:720px){
 .app[data-inspector="curve"] .speed-panel{overflow-y:auto}
 .app[data-inspector="curve"] .curve-container{flex:none;height:165px}
 .app[data-inspector="curve"] .inspector{flex:none;height:245px;max-height:245px}
}
@media(min-width:851px){
 .curve-gallery{grid-template-columns:repeat(4,minmax(0,1fr))}
 .app[data-inspector="curve"] .inspector{height:290px;max-height:290px}
}

@media(max-width:850px) and (min-height:721px){
  .app[data-inspector="curve"] .inspector{height:min(30dvh,255px);min-height:210px;max-height:255px}
}

/* Curve selection is a dedicated, scrollable workspace, not a 110px strip
   inside the keyframe inspector. The graph retains its existing editor size. */
.app[data-inspector="curve"] .inspector{
  height:230px;max-height:230px;min-height:210px;
}
.app[data-inspector="curve"] .inspector-content[data-property-panel="curve"]{
  flex:1;display:flex;flex-direction:column;gap:7px;min-height:0;
}
.app[data-inspector="curve"] .inspector-content .curve-label{
  margin:0;color:#b6c2ce;
}
.app[data-inspector="curve"] #curveType{
  min-height:42px;height:42px;flex:none;width:100%;font-size:.81rem;
}
.open-curve-picker{
  display:flex;align-items:center;text-align:left;gap:10px;width:100%;
  min-height:64px;padding:6px 10px;border:1px solid #3e5c75;
  border-radius:10px;background:#182a3b;color:#eef6ff;
}
.open-curve-picker svg{width:94px;height:51px;flex:none}
.chosen-curve{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px}
.chosen-curve strong{font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chosen-curve small{font-size:.69rem;color:#a8bed2}
.picker-chevron{font-size:1.55rem;color:#bbd5ed;padding:0 4px}
.open-curve-picker:disabled{opacity:.4}
.curve-picker:not([open]){display:none}
.curve-picker[open]{
  position:fixed;inset:0;display:flex;flex-direction:column;gap:0;
  overflow:hidden;width:min(800px,calc(100vw - 24px));max-width:none;
  height:min(90dvh,900px);max-height:none;margin:auto;padding:0;
  border:1px solid #40505f;border-radius:17px;
  background:#10151a;color:#eaf2fa;box-shadow:0 18px 70px #000b;
}
.curve-picker::backdrop{background:#000c}
.curve-picker-header{
  flex:none;display:flex;align-items:center;justify-content:space-between;
  gap:12px;padding:14px 16px;border-bottom:1px solid #33404d;background:#151d25;
}
.picker-heading{min-width:0}
.picker-eyebrow{color:#83a6c3;font-weight:700;font-size:.65rem;letter-spacing:.08em}
.picker-heading h2{margin:4px 0;font-size:1.13rem;font-weight:750}
.picker-heading p{margin:0;color:#9ab0c3;font-size:.75rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.picker-done{
  min-width:68px;min-height:43px;border:none;border-radius:9px;
  color:#09111a;background:#bfdeff;font-weight:760;font-size:.87rem;
}
.curve-picker .curve-gallery{
  flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
  display:grid;align-content:start;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;padding:12px 13px 20px;
  scrollbar-width:thin;overscroll-behavior:contain;
}
.curve-picker .curve-group-name{
  grid-column:1/-1;padding:12px 2px 5px;
  font-size:.8rem;color:#a9bccb;font-weight:700;
  background:#10151a;top:0;position:sticky;z-index:2;
}
.curve-picker .curve-preset{
  min-height:125px;padding:9px;gap:6px;border-radius:12px;
  border:1px solid #394b5c;background:#18212a;
}
.curve-picker .curve-preset svg{width:100%;height:82px;max-width:200px}
.curve-picker .curve-preset span{font-size:.81rem;font-weight:650}
.curve-picker .curve-preset.active{
  background:#1b3b58;border:2px solid #96ccff;color:#fff;
}
.curve-picker .curve-preview-line{stroke-width:3;stroke:#a0d2ff}
.curve-picker-footer{
  flex:none;padding:12px 16px max(13px,env(safe-area-inset-bottom));
  border-top:1px solid #3b4c5c;background:#171f28;
}
.curve-picker-footer .curve-strength{
  min-height:44px;border:none;gap:12px;
  font-size:.81rem;font-weight:650;
}
.curve-picker-footer .curve-strength input{height:35px}
.curve-picker-footer .curve-strength output{min-width:42px;font-size:.84rem}
@media(max-width:850px){
  .curve-picker[open]{
    width:100vw;height:100dvh;max-height:100dvh;
    margin:0;border:0;border-radius:0;
  }
  .curve-picker-header{
    padding:calc(12px + env(safe-area-inset-top)) 15px 12px;
  }
  .app[data-inspector="curve"] .inspector{
    height:220px;max-height:220px;min-height:205px;
  }
}
@media(min-width:600px){
  .curve-picker .curve-gallery{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;padding:15px 18px 22px;
  }
  .curve-picker .curve-preset{min-height:148px}
  .curve-picker .curve-preset svg{height:94px}
}
@media(max-width:850px) and (max-height:720px){
  .app[data-inspector="curve"] .inspector{
    height:210px;min-height:210px;max-height:210px;
  }
}

/* Live editing: keep the REAL timeline uncovered while the curve picker
   occupies a resizable bottom sheet. No modal backdrop or inert graph. */
#app[data-curve-picker="open"] .viewer,
#app[data-curve-picker="open"] .inspector,
#app[data-curve-picker="open"] .bottom-nav,
#app[data-curve-picker="open"] .zoom-toolbar,
#app[data-curve-picker="open"] .axis-pan,
#app[data-curve-picker="open"] .graph-actions{display:none!important}
#app[data-curve-picker="open"] .workspace{
  display:flex!important;flex-direction:column;gap:0!important;
  padding:0 0 var(--curve-sheet-height,54dvh)!important;
  min-height:0;flex:1;
}
#app[data-curve-picker="open"] .speed-panel{
  display:flex!important;flex-direction:column;flex:1;width:100%;
  min-height:0;overflow:hidden!important;border:0;border-radius:0;
}
#app[data-curve-picker="open"] .graph-heading{min-height:44px;flex:none}
#app[data-curve-picker="open"] .curve-container{
  display:block;flex:1!important;height:auto!important;
  min-height:95px!important;overflow:hidden;
}
#app[data-curve-picker="open"] .time-axis{flex:none}
#app .selected-segment{
  fill:none;stroke:#ffd28b;stroke-width:4;stroke-linecap:round;
  stroke-linejoin:round;vector-effect:non-scaling-stroke;
  pointer-events:none;display:none;
}
#app[data-curve-picker="open"] .selected-segment{display:block}
#app .curve-picker[open]{
  position:fixed!important;inset:auto 0 0!important;
  z-index:60;display:flex;flex-direction:column;
  width:min(800px,100vw)!important;
  height:var(--curve-sheet-height,54dvh)!important;
  max-height:none!important;max-width:none;
  margin:0 auto!important;
  padding:0;border:1px solid #445b70;
  border-bottom:0;border-radius:18px 18px 0 0;
  box-shadow:0 -8px 36px #000b;
  background:#10151a;
}
#app .curve-picker-handle{
  display:flex;flex:none;align-items:center;justify-content:center;
  height:23px;min-height:23px;cursor:ns-resize;touch-action:none;
}
#app .curve-picker-handle span{
  width:48px;height:5px;border-radius:999px;background:#748b9d;
}
#app .curve-picker-header{
  padding:3px 14px 11px;
}
#app .curve-picker .curve-gallery{
  grid-template-columns:repeat(2,minmax(0,1fr));
  padding:8px 12px 18px;gap:8px;min-height:0;
}
#app .curve-picker .curve-preset{
  min-height:95px;padding:6px;gap:2px;
}
#app .curve-picker .curve-preset svg{height:62px}
#app .curve-picker .curve-preset span{font-size:.74rem}
#app .curve-picker-footer{
  padding:8px 14px max(10px,env(safe-area-inset-bottom));
}
@media(min-width:600px){
  #app .curve-picker .curve-gallery{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}
@media(max-width:850px){
  #app .curve-picker[open]{
    width:100vw!important;border-left:0;border-right:0;
  }
}

/* Always-visible export progress: native <progress> is unreliable on some
   Android browsers, so render the actual encoded percentage explicitly. */
.progress-area .encoding-progress{
  position:relative;display:block;width:100%;height:22px;min-height:22px;
  border:1px solid #66788b;border-radius:8px;background:#1d2630;
  overflow:hidden;flex:none;isolation:isolate;
}
.encoding-progress-fill{
  position:absolute;inset:0 auto 0 0;width:0%;background:#83bdff;
  border-radius:6px 0 0 6px;transition:width 180ms linear;
}
.encoding-progress-activity{display:none}
.encoding-progress.is-unknown .encoding-progress-activity{
  display:block;position:absolute;inset:0;
  background:linear-gradient(110deg,transparent 0%,transparent 30%,#8fbaff75 50%,
    transparent 70%,transparent 100%);
  background-size:180% 100%;animation:encoding-activity 1.7s linear infinite;
}
@keyframes encoding-activity{
  from{background-position:180% 0}
  to{background-position:-180% 0}
}
.encoding-progress.is-done .encoding-progress-fill{background:#add7ff}
@media(prefers-reduced-motion:reduce){
  .encoding-progress-activity{animation:none!important;background:#6ea9e94d!important}
  .encoding-progress-fill{transition:none}
}

/* Give an actionable recovery path when heavy interpolation stops producing
   output for an extended period. No claim that the worker is definitively hung. */
.fast-export-button{
  width:100%;display:block;min-height:48px;margin-top:12px;
  padding:10px 14px;border-radius:10px;border:1px solid #88b7e2;
  background:#1d3b57;color:#e6f4ff;font-weight:700;font-size:.83rem;
  text-align:center;line-height:1.4;
}
.fast-export-button:active{background:#28547e}
#renderInfo{color:#aab8c6}

/* Whole-video speed is the primary editor. Detailed timeline tools are opt-in. */
.mode-switch{display:flex;align-items:center;gap:3px;padding:3px;background:#14181c;border:1px solid #333a42;border-radius:9px;margin-left:auto}
.mode-switch button{border:0;border-radius:6px;background:transparent;color:#aab6c1;padding:0 10px;min-height:35px;font-size:.76rem;font-weight:650;white-space:nowrap}
.mode-switch button.active{background:#314a62;color:#fff}
.app[data-mode="keys"] .graph-heading{flex-wrap:wrap}
.app[data-mode="keys"] .graph-heading .graph-actions{width:100%;justify-content:flex-end;padding-bottom:2px}
.app[data-mode="simple"] .graph-heading{min-height:57px}
.app[data-mode="simple"] .graph-title span,
.app[data-mode="simple"] .graph-actions,
.app[data-mode="simple"] .curve-container,
.app[data-mode="simple"] .time-axis,
.app[data-mode="simple"] .zoom-toolbar,
.app[data-mode="simple"] .axis-pan,
.app[data-mode="simple"] .graph-footer,
.app[data-mode="simple"] .inspector-top,
.app[data-mode="simple"] .inspector-tabs{display:none!important}
.app[data-mode="simple"] .speed-panel{overflow-y:auto;overscroll-behavior:contain;justify-content:flex-start}
.app[data-mode="simple"] .inspector{flex:none;min-height:0;border-top:1px solid #2c3034;padding:16px 14px 18px;background:#0e1012}
.app[data-mode="simple"] .property-row{margin-bottom:12px}
.app[data-mode="simple"] .property-row label{font-size:.86rem}
.app[data-mode="simple"] #keySpeed{height:47px;width:135px;font-size:1.17rem}
.app[data-mode="simple"] #speedSlider{height:34px;margin:10px 0 15px}
.app[data-mode="simple"] .speed-tools{flex-wrap:wrap;gap:12px}
.app[data-mode="simple"] .presets{order:2;flex:1 1 100%;flex-wrap:wrap;overflow:visible}
.app[data-mode="simple"] .presets button{min-height:42px;flex:1 1 60px;font-size:.77rem}
.app[data-mode="simple"] .fine-controls{order:2;margin-left:auto}
.graph-y{width:53px}
.graph-y span{white-space:nowrap}
.graph-y .speed-axis-unity{color:#f2f4f7;font-weight:760}
.zoom-toolbar{justify-content:space-between;gap:8px}
.zoom-set{flex:0 1 auto;gap:3px}
.zoom-toolbar .fit-button{margin-left:4px}
.top-action[aria-expanded="true"]{background:#253949;border-color:#466580;color:#e5f3ff}
#previewChevron{font-size:1rem;margin-right:4px}
@media(max-width:400px){
  .mode-switch button{padding:0 7px;font-size:.72rem}
  .zoom-toolbar{gap:3px;padding:0 4px}
  .zoom-set output{min-width:24px}
  .zoom-toolbar .fit-button{margin-left:1px;min-width:26px}
}

/* Precision step controls belong to detailed keyframe editing; direct numeric entry
   remains available for exact whole-video speeds. */
.app[data-mode="simple"] .fine-controls{display:none}

/* Slider scales share the thumb's usable track width (about 10px inset on
   either side). Tick labels remain legible without forcing additional forms. */
.scaled-slider{width:100%;min-width:0}
.scaled-slider .main-slider{height:28px;margin:5px 0 0}
.slider-scale{position:relative;height:30px;margin:0 10px 7px;pointer-events:none;user-select:none}
.scale-tick{position:absolute;top:0;height:8px;width:0;border-left:1px solid #607080}
.scale-tick>span{position:absolute;top:11px;left:0;transform:translateX(-50%);white-space:nowrap;
  font-size:.66rem;line-height:1.1;color:#9cabb8;font-variant-numeric:tabular-nums}
.scale-tick:first-child>span{transform:translateX(0)}
.scale-tick:last-child>span{transform:translateX(-100%)}
.scale-slow{border-color:#508abb}
.scale-slow>span{color:#83bfff}
.scale-fast{border-color:#b68a69}
.scale-fast>span{color:#f4b78a}
.scale-unity{height:11px;border-color:#d8e4f3}
.scale-unity>span{color:#f2f5f8;font-weight:750}
.app[data-mode="simple"] .scaled-slider .main-slider{margin:9px 0 0;height:30px}
.app[data-mode="simple"] .slider-scale{margin-bottom:14px}
@media(max-width:370px){.scale-tick>span{font-size:.61rem}}

/* Extra slider scales must remain reachable on short/mobile viewports. The
   editor scrolls locally, keeping the transport and export tabs fixed. */
@media(max-width:850px){
  .app[data-mode="keys"]:not([data-focus="true"]) .speed-panel{
    overflow-y:auto;overscroll-behavior:contain
  }
}

/* Eight speed presets always occupy a single row, including on narrow phones.
   Keep exact input and the logarithmic slider with its labeled scale above. */
.speed-tools{flex-wrap:wrap;gap:6px}
.presets,.app[data-mode="simple"] .presets{
  display:grid;grid-template-columns:repeat(8,minmax(0,1fr));
  flex:1 1 100%;order:1;gap:3px;min-width:0;overflow:visible;
}
.presets button,.app[data-mode="simple"] .presets button{
  min-width:0;width:100%;min-height:42px;flex:none;
  padding:0 1px;font-size:clamp(.61rem,2.65vw,.74rem);
  letter-spacing:-.035em;white-space:nowrap;
}
.fine-controls{order:1;margin-left:auto}
.app[data-mode="simple"] .speed-tools{gap:6px;flex-wrap:wrap}
@media(max-width:360px){
  .presets,.app[data-mode="simple"] .presets{gap:2px}
  .presets button,.app[data-mode="simple"] .presets button{
    font-size:.61rem;border-radius:6px;padding:0
  }
}

/* One compact line: property, exact numeric value, decrease / step / increase. */
.value-edit-row{
  display:grid;
  grid-template-columns:auto minmax(70px,110px) auto;
  justify-content:space-between;
  align-items:center;
  column-gap:6px;
  width:100%;min-width:0;
}
.value-edit-row label{min-width:0;white-space:nowrap;font-size:.75rem}
.value-edit-row input,
.app[data-mode="simple"] .value-edit-row #keySpeed{
  width:100%;min-width:0;height:40px;font-size:.91rem;padding:0 5px;
}
.value-edit-row .fine-controls{
  display:flex;order:initial;align-items:center;gap:3px;
  margin-left:0;min-width:0;flex:none;
}
.value-edit-row .fine-controls button{
  flex:none;width:34px;min-width:34px;height:40px;font-size:1.12rem;
}
.value-edit-row .fine-controls select{
  flex:none;width:72px;max-width:72px;height:40px;
  font-size:.7rem;padding:0 2px;
}
.app[data-mode="simple"] .value-edit-row .fine-controls{display:none}
@media(max-width:380px){
  .value-edit-row{grid-template-columns:auto minmax(66px,92px) auto;column-gap:5px}
  .value-edit-row label{font-size:.71rem}
  .value-edit-row .fine-controls{gap:2px}
  .value-edit-row .fine-controls button{width:32px;min-width:32px}
  .value-edit-row .fine-controls select{width:66px;max-width:66px;font-size:.65rem}
}
@media(max-width:340px){
  .value-edit-row{grid-template-columns:auto minmax(65px,1fr) auto;column-gap:4px}
  .value-edit-row .fine-controls button{width:30px;min-width:30px}
  .value-edit-row .fine-controls select{width:62px;max-width:62px;font-size:.62rem}
}

/* Explicitly sized thumb gives both ends of the scale the same positions
   as the range input's real usable track across Blink, WebKit and Firefox. */
.scaled-slider{--slider-thumb:20px}
.scaled-slider .main-slider,
.app[data-mode="simple"] .scaled-slider .main-slider{
  appearance:none;-webkit-appearance:none;display:block;width:100%;
  height:30px;min-height:30px;margin:4px 0 0;padding:0;
  background:transparent;border:0;cursor:pointer;touch-action:pan-y;
}
.scaled-slider .main-slider::-webkit-slider-runnable-track{
  height:7px;border:1px solid #696d74;border-radius:99px;
  background:linear-gradient(to right,#8cbeef 0%,#8cbeef var(--fill,50%),#424448 var(--fill,50%),#424448 100%);
}
.scaled-slider .main-slider::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:var(--slider-thumb);height:var(--slider-thumb);
  margin-top:-7.5px;border:2px solid #b8d9f8;border-radius:50%;background:#86beff;
}
.scaled-slider .main-slider::-moz-range-track{
  height:7px;border:1px solid #696d74;border-radius:99px;
  background:linear-gradient(to right,#8cbeef 0%,#8cbeef var(--fill,50%),#424448 var(--fill,50%),#424448 100%);
}
.scaled-slider .main-slider::-moz-range-thumb{
  width:16px;height:16px;border:2px solid #b8d9f8;border-radius:50%;background:#86beff;
}
.scaled-slider .main-slider:disabled{cursor:default;opacity:.4}
.scaled-slider .slider-scale{
  margin:0 calc(var(--slider-thumb) / 2) 8px;
}
.slider-scale .scale-tick:first-child{left:0!important}
.slider-scale .scale-tick:last-child{left:100%!important}

/* Whole-video mode omits fine controls; keep its numeric field compact. */
.app[data-mode="simple"] .value-edit-row{
  display:flex;justify-content:flex-start;gap:9px;
}
.app[data-mode="simple"] .value-edit-row #keySpeed{
  flex:0 0 110px;width:110px;max-width:110px;
}

/* Compact graph controls: all five actions on one row, including 320px. */
.app[data-mode="keys"] .graph-heading{
  display:flex;flex-direction:column;align-items:stretch;
  justify-content:center;gap:3px;min-height:0;
  padding:5px 8px;
}
.app[data-mode="keys"] .graph-title{flex-direction:row;align-items:baseline;gap:7px}
.graph-controls{display:flex;align-items:center;justify-content:space-between;gap:4px;min-width:0}
.graph-controls .mode-switch{margin:0;min-width:0;flex:none;padding:2px;gap:1px}
.graph-controls .mode-switch button{min-height:35px;padding:0 5px;font-size:.69rem}
.app[data-mode="keys"] .graph-heading .graph-actions{
  display:flex;width:auto;flex:1 1 auto;gap:3px;
  padding:0;justify-content:flex-end;min-width:0;
}
.graph-controls .graph-actions button{
  min-width:0;min-height:39px;height:39px;padding:0 7px;font-size:.69rem;
  white-space:nowrap;border-radius:7px;
}
.app[data-mode="simple"] .graph-heading{display:flex;flex-direction:row;align-items:center;gap:7px}
.app[data-mode="simple"] .graph-controls{width:auto;margin-left:auto}
@media(max-width:370px){
  .graph-controls{gap:3px}
  .graph-controls .mode-switch button{font-size:.63rem;padding:0 4px}
  .graph-controls .graph-actions button{font-size:.64rem;padding:0 4px;min-height:35px;height:35px}
}

/* Y axis is fixed in the viewport while graph coordinates pan.
   Its opaque background and exact matching SVG margin prevent overlap. */
.curve-container .graph-y{
  position:absolute;z-index:3;left:0;top:0;bottom:0;
  width:60px;background:#090b0d;border-right:1px solid #46515b;
  pointer-events:none;font-variant-numeric:tabular-nums;
}
.curve-container .graph-y span{
  left:0;right:0;text-align:right;padding-right:9px;
  white-space:nowrap;line-height:1.1;
}
.curve-container .graph-y span::after{
  content:"";position:absolute;right:0;top:50%;width:6px;
  border-top:1px solid currentColor;
}
.curve-container .key-dot{fill:#8cc5fc;stroke:#def1ff;stroke-width:1.5;vector-effect:non-scaling-stroke}
.curve-container .key-dot.selected{fill:#ffd342;stroke:#fff2b0;stroke-width:2.5;vector-effect:non-scaling-stroke}
.curve-container .key-hit{fill:transparent}

/* Tick marks are engraved into the slider track; captions stay underneath. */
.scaled-slider{position:relative;padding-bottom:25px}
.scaled-slider .main-slider,.app[data-mode="simple"] .scaled-slider .main-slider{margin:4px 0 0}
.scaled-slider .slider-scale,.app[data-mode="simple"] .slider-scale{
  position:absolute;top:0;left:calc(var(--slider-thumb) / 2);right:calc(var(--slider-thumb) / 2);
  width:auto;height:30px;margin:0;padding:0;pointer-events:none;
}
.scaled-slider .slider-scale .scale-tick{
  top:14px;height:10px;width:0;border-left:1px solid #d0d8e3;
  transform:none;
}
.scaled-slider .slider-scale .scale-tick.scale-minor{
  height:5px;top:16.5px;opacity:.65;
}
.scaled-slider .slider-scale .scale-tick.scale-unity{height:12px;top:13px;border-left-width:2px}
.scaled-slider .slider-scale .scale-tick>span{
  top:14px;font-size:.65rem;line-height:1.1;
}
@media(max-width:370px){
  .scaled-slider .slider-scale .scale-tick>span{font-size:.6rem}
}

/* Denser curve thumbnails: three columns on phones and five on desktops. */
#app .curve-picker .curve-gallery{
  grid-template-columns:repeat(3,minmax(0,1fr));
  align-content:start;gap:4px;padding:4px 7px 9px;
}
#app .curve-picker .curve-group-name{
  padding:4px 2px 2px;font-size:.66rem;line-height:1.2;
}
#app .curve-picker .curve-preset{
  min-height:58px;height:58px;border-radius:7px;
  padding:3px 2px;gap:0;border-width:1px;
}
#app .curve-picker .curve-preset svg{
  height:32px;width:100%;max-width:none;flex:none;
}
#app .curve-picker .curve-preset span{
  font-size:.62rem;line-height:1.1;font-weight:650;
}
#app .curve-picker .curve-preset.active{border-width:1px}
#app .curve-picker-header{justify-content:flex-end;min-height:42px;padding:2px 10px 5px}
#app .curve-picker-handle{height:18px;min-height:18px}
#app .curve-picker .picker-done{min-height:34px;height:34px;min-width:65px}
#app .curve-picker-footer{padding:5px 11px max(7px,env(safe-area-inset-bottom))}
#app .curve-picker-footer .curve-strength{min-height:32px}
@media(min-width:600px){
  #app .curve-picker .curve-gallery{grid-template-columns:repeat(5,minmax(0,1fr))}
}

/* Copyable, inspectable external FFmpeg command. */
.ffmpeg-command-section{margin-top:18px;min-width:0}
.ffmpeg-command-heading{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.ffmpeg-command-heading strong{font-size:.82rem;margin-right:auto}
.ffmpeg-command-heading select,.ffmpeg-command-heading button{
  height:37px;border:1px solid #485360;border-radius:7px;
  background:#1c252e;color:#e8f0f8;padding:0 9px;font-size:.76rem;
}
.ffmpeg-command-heading button{min-width:65px;background:#294460}
.ffmpeg-command-section textarea{
  display:block;width:100%;min-height:112px;max-height:240px;
  resize:vertical;border:1px solid #394653;border-radius:8px;
  background:#0c1116;color:#cbd8e5;padding:11px;
  font:12px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;
  white-space:pre;overflow:auto;tab-size:2;
}

/* Keep every graph action fully visible on the smallest supported phones. */
@media(max-width:370px){
  .graph-controls{gap:1px}
  .graph-controls .mode-switch{padding:1px;gap:0}
  .graph-controls .mode-switch button{
    font-size:.6rem;letter-spacing:-.06em;padding:0 2px;font-weight:600;
  }
  .graph-controls .graph-actions{gap:1px!important}
  .graph-controls .graph-actions button{
    font-size:.6rem;letter-spacing:-.05em;padding:0 2px;font-weight:600;
  }
}

/* Export takes the remaining viewport immediately below the player.
   The flex-grown editor workspace previously created a blank black block. */
.app[data-screen="export"] .workspace{
  display:block;flex:0 0 auto;min-height:0;padding:0;
}
.app[data-screen="export"] .output{
  flex:1 1 auto;min-height:0;overflow-y:auto;
  margin:0 auto;padding-top:12px;
}
@media(min-width:851px){
  .app[data-screen="export"] .workspace{padding:8px 12px 0}
  .app[data-screen="export"] .viewer{width:min(100%,500px);margin:0 auto}
  .app[data-screen="export"] .output{max-width:760px}
}

/* The label strip takes precisely the width computed from visible labels.
   No static 60px column and no chart overlay over the sticky labels. */
.curve-container .graph-y{width:auto}
.curve-container .key-dot{fill:#8cc5fc}
.curve-container .key-dot.selected{fill:#ffd342}

/* Exact speed/position values fit on one row; center numbers in the field. */
.value-edit-row{
  grid-template-columns:auto minmax(65px,84px) auto;
  justify-content:space-between;column-gap:6px;
}
.value-edit-row input[type="number"]{
  width:100%;max-width:84px;min-width:0;
  text-align:center;padding:0 3px;font-variant-numeric:tabular-nums;
  appearance:textfield;-moz-appearance:textfield;
}
.value-edit-row input[type="number"]::-webkit-inner-spin-button,
.value-edit-row input[type="number"]::-webkit-outer-spin-button{
  -webkit-appearance:none;margin:0;
}
.app[data-mode="simple"] .value-edit-row #keySpeed{
  flex:0 0 84px;width:84px;max-width:84px;text-align:center;
}
@media(max-width:355px){
  .value-edit-row{grid-template-columns:auto minmax(62px,76px) auto;column-gap:4px}
  .value-edit-row input[type="number"]{max-width:76px}
}

/* Short tick marks live INSIDE the 7px rail, with labels underneath.
   Minor ticks never extend down from the slider like ruler lines. */
.scaled-slider .slider-scale .scale-tick,
.scaled-slider .slider-scale .scale-tick.scale-unity{
  top:16px;height:6px;border-left-width:1px;
  border-color:#a5bacf;opacity:.9;
}
.scaled-slider .slider-scale .scale-tick.scale-minor{
  top:17px;height:4px;opacity:.58;
}
.scaled-slider .slider-scale .scale-tick.scale-unity{
  border-left-width:2px;opacity:1;
}
.scaled-slider .slider-scale .scale-tick>span{top:13px;opacity:1}
.scaled-slider{padding-bottom:20px}

/* No category dividers, four thumbnails per row on narrow phones and more
   with available width. Each icon needs only enough height for its curve/name. */
#app .curve-picker .curve-gallery{
  grid-template-columns:repeat(auto-fit,minmax(62px,1fr));
  gap:3px;padding:4px 6px 8px;
}
#app .curve-picker .curve-preset{
  height:50px;min-height:50px;padding:2px 1px;
  border-radius:6px;gap:0;
}
#app .curve-picker .curve-preset svg{
  height:26px;max-height:26px;
}
#app .curve-picker .curve-preset span{
  font-size:.6rem;line-height:1.05;
}

/* Stable mode-switch position; no horizontal or vertical jump on mode changes.
   Reserve the action toolbar's width in Whole video mode, without showing it. */
#app.app[data-mode="simple"] .graph-heading{
  display:flex;flex-direction:column;align-items:stretch;
  justify-content:center;gap:3px;min-height:0;padding:5px 8px;
}
#app.app[data-mode="simple"] .graph-title{
  flex-direction:row;align-items:baseline;gap:7px;
}
#app.app[data-mode="simple"] .graph-controls{
  display:flex;width:100%;margin:0;justify-content:space-between;
}
#app.app[data-mode="simple"] .graph-controls .graph-actions{
  display:flex!important;visibility:hidden;pointer-events:none;
  width:auto;flex:1 1 auto;gap:3px;justify-content:flex-end;padding:0;
}
/* 1× is always on the graph and marked with a subtle reference rule. */
.curve-container .gridline.unity{
  stroke:#92a4b2;stroke-opacity:.28;stroke-width:1;
}
.curve-container .graph-y .speed-axis-unity{
  color:#dce5ec;font-weight:730;
}

/* Keep the full renamed title and both header actions inside narrow phones. */
@media(max-width:340px){
  .top{gap:5px}
  .brand{flex:1 1 auto;min-width:0}
  .brand h1{
    font-size:.82rem;flex:1 1 auto;min-width:0;max-width:100%;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }
  .header-actions{flex:0 0 auto;gap:3px}
  .top-action{min-width:0;padding:0 4px;font-size:.64rem;white-space:nowrap}
}

/* Keyframe navigation and editing stay next to the mode switch, in one row. */
.graph-actions .key-nav-button{
 border:1px solid #384653;background:#161e26;color:#dbe5ef;
 border-radius:7px;font-weight:760
}
.graph-actions .delete-key{
 background:#25191b;border:1px solid #613638;color:#ec9b9b;
 border-radius:7px;font-weight:740
}
.graph-actions button:disabled{opacity:.38;cursor:default}
.graph-actions .short-action{display:inline}
.graph-actions .full-action{display:none}
#app .graph-controls .graph-actions{
 display:flex;width:auto;align-items:center;flex:1 1 auto;gap:2px;
 justify-content:flex-end;min-width:0
}
#app .graph-controls .graph-actions button{
 flex:0 1 auto;min-width:0;height:35px;min-height:35px;
 padding:0 3px;font-size:.67rem
}
#app .graph-controls .graph-actions #previousKey,
#app .graph-controls .graph-actions #nextKey{
 flex:0 0 24px;width:24px;font-size:1.15rem;padding:0
}
#app .graph-controls .graph-actions #addKey,
#app .graph-controls .graph-actions #removeKey{
 flex:0 0 25px;width:25px;font-size:1.1rem;padding:0
}
@media(max-width:370px){
 #app .graph-controls .mode-switch button{padding:0 2px;font-size:.60rem}
 #app .graph-controls .graph-actions button{font-size:.60rem;padding:0 1px}
 #app .graph-controls .graph-actions #previousKey,
 #app .graph-controls .graph-actions #nextKey{width:23px;flex-basis:23px}
 #app .graph-controls .graph-actions #addKey,
 #app .graph-controls .graph-actions #removeKey{width:23px;flex-basis:23px}
}
@media(min-width:650px){
 .graph-actions .short-action{display:none}
 .graph-actions .full-action{display:inline}
 #app .graph-controls .graph-actions #addKey,
 #app .graph-controls .graph-actions #removeKey{
   width:auto;flex-basis:auto;padding:0 9px;font-size:.72rem
 }
}
/* Multiplier is part of the speed value, never the field label. */
.value-edit-row .speed-value{
 display:flex;align-items:center;justify-content:center;
 width:87px;min-width:0;max-width:87px;height:40px;
 border-radius:7px;border:1px solid #414b55;background:#090a0b
}
.value-edit-row .speed-value #keySpeed,
#app.app[data-mode="simple"] .value-edit-row .speed-value #keySpeed{
 border:0!important;box-shadow:none!important;background:transparent;
 width:calc(100% - 17px)!important;max-width:none!important;
 min-width:0!important;flex:1 1 auto!important;
 text-align:right!important;padding:0 2px 0 1px!important;
 font-size:.92rem!important;height:38px!important;
 font-variant-numeric:tabular-nums
}
.speed-value .speed-unit{flex:0 0 17px;font-size:.83rem;color:#a4b4c1;text-align:left}
.value-edit-row #keySpeed:focus-visible{outline:0}
.value-edit-row .speed-value:focus-within{border-color:#85bff7}
/* Marks share the exact normalized coordinate used by each range thumb.
   On the position slider those coordinates are whole-video seconds. */
.scaled-slider .slider-scale .scale-tick:first-child{left:0!important}
.scaled-slider .slider-scale .scale-tick:last-child{left:100%!important}
.scaled-slider .slider-scale .scale-tick{
 top:16px!important;height:6px!important;border-color:#a8bdcf!important
}
.scaled-slider .slider-scale .scale-tick.scale-minor{
 top:17px!important;height:4px!important;opacity:.5!important
}
.scaled-slider .slider-scale .scale-tick.scale-major{opacity:.95}
.scaled-slider .slider-scale .scale-tick>span{top:13px!important}
/* Use an HTML overlay for un-stretched readout alongside the selected point. */
.selected-point-value{
 position:absolute;z-index:5;min-width:47px;
 transform:translate(-50%,calc(-100% - 10px));
 background:#252016;color:#ffe18c;border:1px solid #8b7038;
 padding:3px 5px;border-radius:5px;font-size:.68rem;
 font-weight:760;line-height:1.15;text-align:center;
 font-variant-numeric:tabular-nums;pointer-events:none;white-space:nowrap
}
.selected-point-value.below{transform:translate(-50%,10px)}
.selected-point-value[hidden]{display:none!important}

/* Time 0 labels the Y-axis crossing. Keep its text centered at that crossing. */
.time-axis .axis-origin-time { transform:translateX(-50%); }
/* Selected point readout is plain text, with no box or floating card. */
.curve-container .selected-point-value {
  display:block;
  min-width:0;
  max-width:max-content;
  transform:none!important;
  background:transparent;
  border:0;
  padding:0;
  border-radius:0;
  color:#ffda62;
  font-size:.75rem;
  font-weight:800;
  line-height:1.2;
  text-shadow:0 1px 2px #000,0 0 4px #000,0 0 7px #000;
}
/* Use the entire remaining row for the five actions after removing Reset.
   Width scales naturally with viewport, rather than 23px fixed buttons. */
#app .graph-controls .graph-actions {
  display:grid;
  grid-template-columns:minmax(36px,1.2fr) repeat(4,minmax(28px,1fr));
  align-items:stretch;
  justify-content:stretch;
  flex:1 1 auto;
  gap:3px;
  min-width:0;
}
#app .graph-controls .graph-actions button,
#app .graph-controls .graph-actions #previousKey,
#app .graph-controls .graph-actions #nextKey,
#app .graph-controls .graph-actions #addKey,
#app .graph-controls .graph-actions #removeKey {
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-width:0;
  max-width:none;
  flex:none;
  height:37px;
  min-height:37px;
  padding:0 3px;
}
#app .graph-controls .graph-actions #focusButton { font-size:.7rem; }
#app .graph-controls .graph-actions #previousKey,
#app .graph-controls .graph-actions #nextKey,
#app .graph-controls .graph-actions #addKey,
#app .graph-controls .graph-actions #removeKey { font-size:1.25rem; }
@media(min-width:650px) {
  #app .graph-controls .graph-actions {
    grid-template-columns:minmax(60px,1fr) repeat(2,minmax(50px,.8fr)) repeat(2,minmax(92px,1.4fr));
  }
  #app .graph-controls .graph-actions #addKey,
  #app .graph-controls .graph-actions #removeKey { font-size:.78rem; }
}
