:root{--bg:#070b14;--panel:#101726;--line:#28364f;--text:#f5f7fb;--muted:#8f9bb1;--purple:#7559ff;--blue:#4d88ff;--green:#39d3ad;--yellow:#f1ca61;--danger:#ff7187;--shadow:0 18px 50px rgba(0,0,0,.32)}
*{box-sizing:border-box}html{color-scheme:dark}body{margin:0;background:radial-gradient(circle at 15% 0,rgba(117,89,255,.11),transparent 30rem),var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,textarea{font:inherit}.hidden{display:none!important}.view{display:none}.view.active{display:block}
.topbar{height:70px;padding:0 28px;border-bottom:1px solid rgba(255,255,255,.07);display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:30;background:rgba(7,11,20,.9);backdrop-filter:blur(18px)}.brand{display:flex;align-items:center;gap:12px;background:none;border:0;color:inherit;cursor:pointer;text-align:left}.brandMark{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:linear-gradient(135deg,var(--purple),var(--blue));font-weight:900}.brandText{display:flex;flex-direction:column}.brandText small{font-size:11px;color:var(--muted);margin-top:2px}.topActions{display:flex;align-items:center;gap:10px}.envBadge{font-size:10px;font-weight:900;letter-spacing:.09em;padding:7px 10px;border-radius:999px;background:var(--yellow);color:#151515}
.shell{max-width:1500px;margin:auto;padding:34px 28px 70px}.eyebrow{margin:0 0 8px;color:#9ca8bc;font-weight:900;font-size:10px;letter-spacing:.14em}.hero{display:grid;grid-template-columns:1.3fr .7fr;gap:20px}.heroMain,.heroFlow,.panel,.sidebar,.timelineCard{border:1px solid rgba(255,255,255,.08);background:linear-gradient(180deg,#111827,#0d1422);border-radius:20px;box-shadow:var(--shadow)}.heroMain{padding:55px}.heroMain h1{font-size:clamp(38px,5.4vw,72px);line-height:.98;letter-spacing:-.05em;margin:0;max-width:850px}.heroCopy{font-size:17px;line-height:1.65;color:#aab5c8;max-width:760px;margin:24px 0 0}.actions{display:flex;gap:10px;margin-top:32px;flex-wrap:wrap}.heroFlow{padding:28px;display:flex;flex-direction:column;justify-content:center}.flowItem{display:flex;align-items:center;gap:14px}.flowItem>span{width:35px;height:35px;display:grid;place-items:center;border:1px solid #53617a;border-radius:50%;font-weight:800}.flowItem div{display:flex;flex-direction:column}.flowItem small{color:var(--muted);margin-top:2px}.line{height:24px;border-left:1px dashed #45516a;margin:4px 0 4px 17px}
.btn{border:0;border-radius:11px;padding:11px 15px;font-weight:800;color:white;cursor:pointer;transition:.15s transform,.15s opacity}.btn:hover{transform:translateY(-1px)}.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}.btn.primary{background:linear-gradient(135deg,var(--purple),var(--blue))}.btn.secondary{background:#182238;border:1px solid #2d3b56}.btn.danger{background:#35151d;border:1px solid #7b3141;color:#ff9aaa}.btn.danger:hover{background:#461a25;border-color:#a44256}.btn.ghost{background:transparent;border:1px solid #2b3954}.btn.small{font-size:12px;padding:8px 11px}.btn.full{width:100%}
.sectionHead{display:flex;align-items:end;justify-content:space-between;margin:40px 0 14px}.sectionHead h2{margin:0}.projectGrid{display:grid;grid-template-columns:repeat(3,1fr);gap:13px}.projectCard{border:1px solid rgba(255,255,255,.08);background:var(--panel);border-radius:14px;padding:17px;cursor:pointer}.projectCard:hover{border-color:#53617b}.projectCardTop{display:flex;justify-content:space-between;gap:12px}.projectCard h3{margin:0}.projectCard small{color:var(--muted)}.pill{font-size:10px;padding:5px 8px;border-radius:999px;background:rgba(57,211,173,.12);color:#72e2c7;font-weight:900}.projectMeta{display:flex;align-items:center;gap:12px;margin-top:18px;color:var(--muted);font-size:11px}.projectDeleteBtn{margin-left:auto;border:1px solid #5d2935;background:#241017;color:#ff8fa3;border-radius:8px;padding:5px 8px;font-size:10px;font-weight:800;cursor:pointer}.projectDeleteBtn:hover{background:#35151d;border-color:#8b3c4d}.emptyState{text-align:center;border:1px dashed #34425d;border-radius:18px;padding:50px 20px}.emptyState h3{margin:11px 0 4px}.emptyState p{color:var(--muted)}.emptyIcon{margin:auto;width:54px;height:54px;border-radius:15px;background:#172139;display:grid;place-items:center;font-weight:900;color:#a593ff}
.pageTitle{display:flex;align-items:center;gap:13px;margin-bottom:20px}.pageTitle.compact{margin:0}.pageTitle h1{margin:0;font-size:31px;letter-spacing:-.03em}.backBtn{width:40px;height:40px;border-radius:11px;background:#111827;border:1px solid #2b3954;color:white;cursor:pointer}.notice{padding:12px 14px;border-radius:12px;margin-bottom:15px;background:rgba(241,202,97,.08);border:1px solid rgba(241,202,97,.25);color:#e6d49e;font-size:12px;line-height:1.5}.newGrid{display:grid;grid-template-columns:minmax(350px,.8fr) minmax(0,1.2fr);gap:17px}.panel{padding:20px}.label{display:block;font-size:12px;font-weight:800;margin-bottom:7px}.input{width:100%;border-radius:10px;border:1px solid #2b3852;background:#080e19;color:white;padding:12px 13px}.dropZone{margin-top:16px;min-height:235px;border:1.5px dashed #45536f;border-radius:15px;background:#090f1b;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;cursor:pointer;padding:25px}.dropZone:hover,.dropZone.dragging{border-color:#8874ff;background:rgba(117,89,255,.05)}.dropZone h3{margin:11px 0 3px}.dropZone p,.dropZone small{color:var(--muted);margin:0}.uploadIcon{width:50px;height:50px;border-radius:14px;background:#18243d;display:grid;place-items:center;font-size:23px;color:#b4a6ff}.fileCard{display:flex;align-items:center;gap:11px;margin-top:14px;padding:11px;border:1px solid #293750;border-radius:12px;background:#09101d}.fileIcon{width:37px;height:37px;border-radius:10px;background:#19243c;display:grid;place-items:center}.fileInfo{display:flex;flex-direction:column;min-width:0;flex:1}.fileInfo strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fileInfo small{color:var(--muted)}.iconBtn{background:none;border:0;color:var(--danger);font-size:25px;cursor:pointer}.hint{color:var(--muted);font-size:11px}.summary{border-top:1px solid #26334a;border-bottom:1px solid #26334a;margin:17px 0;padding:13px 0;display:grid;gap:8px}.summary div{display:flex;justify-content:space-between;gap:12px;font-size:11px}.summary span{color:var(--muted)}.previewPanel{display:flex;flex-direction:column}.panelTitle h3{margin:0}.videoWrap{position:relative;background:#020409;border:1px solid #202c42;border-radius:14px;overflow:hidden}.uploadVideoWrap{aspect-ratio:16/9;margin-top:13px}.videoWrap video{width:100%;height:100%;display:block;object-fit:contain;background:#000}.placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;background:linear-gradient(180deg,#090e18,#070a11);color:var(--muted);padding:20px}.placeholder>span{font-size:33px;color:#55617a}.processing{display:flex;align-items:center;gap:13px;margin-top:14px;border:1px solid rgba(117,89,255,.24);background:rgba(117,89,255,.06);border-radius:12px;padding:14px}.processing p{margin:3px 0 0;color:var(--muted);font-size:11px}.spinner{width:29px;height:29px;border-radius:50%;border:3px solid rgba(255,255,255,.14);border-top-color:#9b88ff;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.editorHeader{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:15px}.editorActions{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.saveStatus{color:var(--muted);font-size:11px}.editorGrid{display:grid;grid-template-columns:350px minmax(420px,1fr) 270px;gap:14px}.sidebar{padding:14px;max-height:calc(100vh - 145px);overflow:auto}.tabs{display:grid;grid-template-columns:1fr 1fr;padding:4px;background:#080e19;border-radius:10px;margin-bottom:12px}.tab{border:0;background:transparent;color:var(--muted);border-radius:8px;padding:8px;cursor:pointer;font-weight:800}.tab.active{background:#1a253b;color:white}.tabPane{display:none}.tabPane.active{display:block}.stats{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin:4px 2px 10px}.captionList{display:flex;flex-direction:column;gap:7px}.captionRow{display:grid;grid-template-columns:55px 1fr;gap:8px;padding:9px;border:1px solid #28364e;background:#09101c;border-radius:11px;cursor:pointer}.captionRow.active{border-color:var(--purple);box-shadow:0 0 0 1px rgba(117,89,255,.24)}.captionTime{font-size:10px;color:#8491a8;padding-top:7px}.captionInput{width:100%;min-height:50px;resize:vertical;border:0;background:transparent;color:white;line-height:1.4;outline:none}.templateGrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.template{border:1px solid #293750;background:#09101c;border-radius:11px;padding:8px;color:white;text-align:left;cursor:pointer}.template.selected{border-color:var(--purple)}.template strong{display:block;font-size:11px}.demo{height:55px;border-radius:8px;background:#020409;display:grid;place-items:center;margin-bottom:7px;font-weight:900}.demoBold{font-size:19px}.demoYellow{color:#ffe34b}.demoMinimal{font-weight:500;font-size:12px}.demoLower{align-items:end;padding-bottom:9px;font-size:12px}.control{margin-top:17px}.control input{width:100%}.toggle{display:flex;justify-content:space-between;align-items:center;padding:12px 0;border-top:1px solid #28354c;margin-top:10px}.toggle span{display:flex;flex-direction:column}.toggle small{font-size:9px;color:var(--muted);margin-top:2px}
.canvasColumn{display:flex;flex-direction:column;align-items:center;gap:13px}.phone{width:min(100%,540px);padding:9px;border-radius:21px;background:#080c14;border:1px solid #2b3953;box-shadow:var(--shadow)}.editorVideoWrap{aspect-ratio:9/16}.overlay{position:absolute;left:6%;right:6%;top:72%;transform:translateY(-50%);z-index:5;text-align:center;pointer-events:none;font-size:44px;line-height:1.08;font-weight:900;text-wrap:balance;transition:opacity .12s ease,top .12s ease}.overlay span{display:inline;padding:.04em .11em;border-radius:.13em}.caption-hidden{opacity:0}.template-bold{color:white;text-shadow:0 .08em .06em #000,0 0 .14em #000;-webkit-text-stroke:.022em rgba(0,0,0,.9)}.template-clean{color:white;font-weight:750;text-shadow:0 .08em .16em #000}.template-boxed{color:white}.template-boxed span{display:inline-block;background:rgba(0,0,0,.88);padding:.14em .24em;border-radius:.16em;box-decoration-break:clone;-webkit-box-decoration-break:clone}.template-yellow{color:#111;text-shadow:none;-webkit-text-stroke:0}.template-yellow span{display:inline-block;background:#ffd900;padding:.12em .22em;border-radius:.14em;box-decoration-break:clone;-webkit-box-decoration-break:clone}.template-minimal{color:white;font-size:.78em;font-weight:600;letter-spacing:.01em;text-shadow:0 .08em .18em #000}.template-lower{left:7%;right:auto;width:78%;text-align:left;font-size:.72em;font-weight:750;color:white;text-shadow:none}.template-lower span{display:inline-block;background:rgba(0,0,0,.82);border-left:.12em solid #fff;padding:.16em .28em;border-radius:.08em}.overlay.no-shadow,.overlay.no-shadow span{text-shadow:none!important;-webkit-text-stroke:0!important}.demoYellow{color:#111!important;background:#ffd900!important}.demoLower{justify-items:start!important;text-align:left!important;padding-left:9px!important;border-left:4px solid #fff!important}.timelineCard{width:min(100%,720px);padding:12px}.timelineMeta{display:flex;justify-content:space-between;font-size:10px;color:var(--muted);margin-bottom:8px}.timeline{height:27px;display:flex;overflow:hidden;border-radius:7px;background:#080d16}.timelineSeg{height:100%;min-width:2px;background:#2a3958;border-right:1px solid #0d1421;cursor:pointer}.timelineSeg.active{background:var(--purple)}.right{max-height:none}.details{display:grid;gap:11px}.details div{display:flex;justify-content:space-between;gap:10px;border-bottom:1px solid #28354c;padding-bottom:9px;font-size:11px}.details span{color:var(--muted)}.green{color:#73e0c4}.block{margin-top:22px}.exportButtons{display:grid;gap:7px}.info{margin-top:18px;border:1px solid #28364f;background:#09101c;border-radius:11px;padding:12px}.info p{margin:5px 0 0;color:var(--muted);font-size:10px;line-height:1.5}.toast{position:fixed;z-index:100;left:50%;bottom:24px;transform:translate(-50%,16px);opacity:0;pointer-events:none;background:#182238;border:1px solid #354561;padding:10px 13px;border-radius:11px;box-shadow:var(--shadow);transition:.2s;max-width:min(90vw,620px);font-size:12px}.toast.show{opacity:1;transform:translate(-50%,0)}.toast.error{background:#28131b;border-color:#733546}
@media(max-width:1150px){.editorGrid{grid-template-columns:310px 1fr}.right{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px}.right>.eyebrow{display:none}.info{margin:0}.projectGrid{grid-template-columns:repeat(2,1fr)}}@media(max-width:850px){.shell{padding:24px 15px 60px}.topbar{padding:0 15px}.hero{grid-template-columns:1fr}.heroMain{padding:32px 24px}.newGrid{grid-template-columns:1fr}.editorHeader{align-items:flex-start;flex-direction:column}.editorGrid{grid-template-columns:1fr}.sidebar{max-height:none}.canvasColumn{order:-1}.right{grid-column:auto;display:block}.right>.eyebrow{display:block}.info{margin-top:18px}.phone{width:min(100%,460px)}}@media(max-width:600px){.brandText small,.envBadge,.topActions .btn{display:none}.heroMain h1{font-size:42px}.heroCopy{font-size:14px}.projectGrid{grid-template-columns:1fr}.sectionHead{align-items:flex-start;flex-direction:column;gap:10px}.pageTitle h1{font-size:25px}.editorActions{width:100%}.saveStatus{margin-right:auto}.overlay{font-size:36px}}

/* === Word-synced interactive captions === */
.captionRow{grid-template-columns:1fr;gap:8px}
.captionTimingEdit{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.timeField{display:flex;align-items:center;gap:5px;font-size:9px;color:#8491a8}
.timeInput{width:100%;min-width:0;border:1px solid #27354d;background:#070d17;color:#dbe5f6;border-radius:7px;padding:6px 7px;font-size:10px;font-variant-numeric:tabular-nums;outline:none}
.timeInput:focus{border-color:var(--purple)}
.captionHint{font-size:9px;color:#637089;margin-top:-2px}.template small{display:block;font-size:8px;color:var(--muted);margin-top:2px}.template.selected small{color:#c3b8ff}
.overlay{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.02em .18em;overflow:visible}
.overlayText{display:contents}
.caption-word{display:inline-block;position:relative;color:inherit;transform-origin:center;will-change:transform,color,background;transition:color .1s linear,transform .12s cubic-bezier(.2,.9,.2,1),background .1s linear,text-shadow .1s linear,opacity .1s linear;padding:.02em .02em;border-radius:.12em}
.caption-word.active-word{z-index:2}

/* Kalakar-style: white words, current word mint + slightly larger */
.template-kalakar{color:#fff;font-weight:900;letter-spacing:-.035em;text-shadow:0 .07em .05em rgba(0,0,0,.95),0 0 .16em rgba(0,0,0,.72);-webkit-text-stroke:.018em rgba(0,0,0,.7)}
.template-kalakar .caption-word.active-word{color:#58efb8;transform:scale(1.16);text-shadow:0 .06em .04em rgba(0,0,0,.9),0 0 .18em rgba(88,239,184,.22)}

/* Punch: energetic yellow current word */
.template-punch{color:#fff;font-weight:950;letter-spacing:-.025em;text-shadow:0 .08em .05em #000,0 0 .16em #000}
.template-punch .caption-word.active-word{color:#ffe229;transform:scale(1.23) rotate(-1deg);-webkit-text-stroke:.018em rgba(0,0,0,.75)}

/* Neon */
.template-neon{color:#f6f8ff;font-weight:850;text-shadow:0 .07em .06em rgba(0,0,0,.95)}
.template-neon .caption-word{opacity:.86}
.template-neon .caption-word.active-word{opacity:1;color:#44e9ff;transform:scale(1.14);text-shadow:0 0 .16em rgba(68,233,255,.9),0 .07em .06em #000}

/* Box sync */
.template-boxsync{color:#fff;font-weight:850;text-shadow:0 .07em .06em #000}
.template-boxsync .caption-word{padding:.07em .09em}
.template-boxsync .caption-word.active-word{background:#7a5cff;color:#fff;transform:scale(1.11);box-shadow:0 .08em .22em rgba(0,0,0,.35);text-shadow:none}

/* Big word: strongest size variation */
.template-bigword{color:#fff;font-weight:950;letter-spacing:-.04em;text-shadow:0 .075em .05em #000,0 0 .15em #000}
.template-bigword .caption-word{transform:scale(.92);opacity:.92}
.template-bigword .caption-word.active-word{color:#5af0b9;transform:scale(1.38);opacity:1;margin:0 .06em}

/* Clean word-sync */
.template-cleanword{color:#fff;font-weight:720;letter-spacing:-.01em;text-shadow:0 .08em .17em rgba(0,0,0,.9)}
.template-cleanword .caption-word.active-word{color:#b6a5ff;font-weight:900;transform:scale(1.08)}

.demoKalakar{color:#fff}.demoKalakar i{font-style:normal;font-size:10px}.demoKalakar b{color:#58efb8;font-size:18px}.demoPunch b{color:#ffe229;font-size:18px}.demoNeon{color:#44e9ff;text-shadow:0 0 8px rgba(68,233,255,.65)}.demoBoxSync{background:#7a5cff!important;color:#fff;border-radius:6px;padding:5px}.demoBigWord b{color:#5af0b9;font-size:20px}.demoCleanWord{color:#b6a5ff;font-weight:700}

@keyframes captionPop{0%{transform:scale(.86)}65%{transform:scale(1.24)}100%{transform:scale(1.16)}}
.template-kalakar .caption-word.just-activated{animation:captionPop .18s ease-out}
.template-punch .caption-word.just-activated{animation:captionPop .18s ease-out}
.template-bigword .caption-word.just-activated{animation:captionPop .2s ease-out}

@media(max-width:600px){.captionTimingEdit{grid-template-columns:1fr 1fr}.overlay{gap:.01em .14em}}


/* === 2026-08-14 reliability + preview sizing fixes === */
/* Keep the portrait editor preview on-screen on normal laptop displays. */
.phone{width:min(100%,300px)!important;padding:7px!important;border-radius:18px!important}
.editorVideoWrap{aspect-ratio:9/16!important;max-height:535px;margin:0 auto}
.canvasColumn{align-self:start;position:sticky;top:86px}
.timelineCard{width:min(100%,520px)}

/* The words container must itself be a flex layout. */
#overlayText.overlayWords{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.03em .18em;width:100%}
.overlay{display:block!important;overflow:visible}
.caption-word{display:inline-block!important;transition:color .08s linear,transform .12s cubic-bezier(.2,.9,.2,1),background-color .08s linear,text-shadow .08s linear,opacity .08s linear!important}

/* Make every one-click preset visibly different even while the video is paused. */
.template-kalakar{color:#fff!important;font-weight:900!important;letter-spacing:-.035em!important}
.template-kalakar .caption-word.active-word{color:#58efb8!important;transform:scale(1.18)!important}
.template-punch{color:#fff!important;font-weight:950!important;letter-spacing:-.025em!important}
.template-punch .caption-word.active-word{color:#ffe229!important;transform:scale(1.24) rotate(-1deg)!important}
.template-neon{color:#f7fbff!important;font-weight:850!important;text-shadow:0 0 .16em rgba(68,233,255,.25),0 .07em .06em #000!important}
.template-neon .caption-word{opacity:.72}
.template-neon .caption-word.active-word{opacity:1!important;color:#44e9ff!important;transform:scale(1.15)!important;text-shadow:0 0 .18em rgba(68,233,255,.95),0 .07em .06em #000!important}
.template-boxsync{color:#fff!important;font-weight:850!important}
.template-boxsync .caption-word{padding:.06em .09em!important;border-radius:.16em!important}
.template-boxsync .caption-word.active-word{background:#7a5cff!important;color:#fff!important;transform:scale(1.12)!important;box-shadow:0 .08em .22em rgba(0,0,0,.4)!important;text-shadow:none!important}
.template-bigword{color:#fff!important;font-weight:950!important;letter-spacing:-.04em!important}
.template-bigword .caption-word{transform:scale(.88);opacity:.78}
.template-bigword .caption-word.active-word{color:#5af0b9!important;transform:scale(1.42)!important;opacity:1!important;margin:0 .07em!important}
.template-cleanword{color:#fff!important;font-weight:700!important;letter-spacing:-.01em!important}
.template-cleanword .caption-word{opacity:.82}
.template-cleanword .caption-word.active-word{color:#b6a5ff!important;font-weight:900!important;transform:scale(1.10)!important;opacity:1!important}

/* Strong visual feedback that a template button was actually selected. */
.template.selected{border-color:#8f7bff!important;box-shadow:0 0 0 2px rgba(117,89,255,.28)!important;background:#14162a!important}
.projectDeleteBtn,.btn.danger{position:relative;z-index:2;pointer-events:auto!important}

@media(max-width:1150px){.canvasColumn{position:static}.phone{width:min(100%,290px)!important}}
@media(max-width:600px){.phone{width:min(88vw,285px)!important}.editorVideoWrap{max-height:507px}}


/* === Client-side burned-in reel export === */
.exportProgress{display:grid;gap:7px;padding:10px 0 2px}
.exportProgressTrack{height:7px;background:#0a101c;border:1px solid #293750;border-radius:999px;overflow:hidden}
.exportProgressBar{height:100%;width:0%;background:linear-gradient(90deg,#775cff,#58efb8);transition:width .15s linear}
.exportProgress small{font-size:9px;color:var(--muted);line-height:1.4}
#exportVideoBtn[disabled]{opacity:.65;cursor:wait}


/* === 2026-08-19 per-template customization + global/per-caption sizing === */
.styleSection{margin-top:16px;padding:13px;border:1px solid #28364f;border-radius:13px;background:#080e19}
.styleSection+.styleSection{margin-top:11px}.styleSectionHead{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:4px}.styleSectionHead strong{font-size:12px}.styleSectionHead small{font-size:9px;color:var(--muted)}
.styleSelect{width:100%;border:1px solid #2b3852;background:#070d17;color:#f4f7fb;border-radius:9px;padding:9px 10px;outline:none}.styleSelect:focus{border-color:#806aff}
.colorControl{margin-top:15px}.compactColor{margin-top:10px}.colorControlHead{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;font-size:10px;font-weight:800;color:#dce5f5}.colorControlHead code{font-size:9px;color:#8795ab;background:#0e1727;border:1px solid #26344d;padding:3px 5px;border-radius:5px}
.colorChoices{display:flex;flex-wrap:wrap;align-items:center;gap:7px}.colorSwatch,.customColor{width:28px;height:28px;border-radius:8px;border:2px solid #2c3951;background:var(--swatch,#fff);cursor:pointer;display:grid;place-items:center;position:relative}.colorSwatch.selected{border-color:#fff;box-shadow:0 0 0 2px #7559ff}.colorSwatch:hover,.customColor:hover{transform:translateY(-1px)}
.customColor{background:linear-gradient(135deg,#ff596d,#ffdd57,#50e3c2,#4d88ff,#a76bff);overflow:hidden;color:#fff;font-size:17px;font-weight:900;text-shadow:0 1px 3px #000}.customColor span{pointer-events:none;position:relative;z-index:1}.customColor input{position:absolute;inset:-5px;width:42px!important;height:42px;opacity:0;cursor:pointer}
.disabledStyle{opacity:.42}.disabledStyle input,.disabledStyle button,.disabledStyle label{pointer-events:none}.captionOverrideNote{font-size:9px;line-height:1.45;color:#7f8ca2;margin:7px 0 4px}.selectedCaptionSection{border-color:#3a3268;background:linear-gradient(180deg,#0c1020,#080d18)}
/* Custom variables override hard-coded preset colors but retain each preset's animation/scale personality. */
.overlay{font-family:var(--caption-font,Arial,Helvetica,sans-serif)!important;color:var(--caption-secondary,#fff)!important}
.overlay .caption-word{color:var(--caption-secondary,#fff)!important;font-family:inherit!important}
.overlay .caption-word.active-word{color:var(--caption-highlight,#58efb8)!important}
.overlay:not(.no-shadow) .caption-word{text-shadow:0 var(--caption-shadow-y,.06em) var(--caption-shadow-blur,.12em) var(--caption-shadow,#000)!important}
.overlay.no-shadow .caption-word{box-shadow:none}
.template-neon:not(.no-shadow) .caption-word.active-word{text-shadow:0 0 calc(var(--caption-shadow-blur,.12em)*1.3) var(--caption-highlight,#44e9ff),0 var(--caption-shadow-y,.06em) var(--caption-shadow-blur,.12em) var(--caption-shadow,#000)!important}
.template-boxsync .caption-word.active-word{background:color-mix(in srgb,var(--caption-highlight,#b6a5ff) 30%,transparent)!important}
@supports not (background:color-mix(in srgb,#fff 30%,transparent)){.template-boxsync .caption-word.active-word{background:rgba(117,89,255,.35)!important}}
@media(max-width:600px){.styleSection{padding:11px}.colorSwatch,.customColor{width:30px;height:30px}}


/* === 2026-08-19 caption width + spacing + mobile live-preview dock === */
.mobilePreviewLabel{display:none}
.overlay{max-width:96%;white-space:normal!important;text-wrap:wrap!important;overflow-wrap:normal;word-break:normal}
.overlayText{display:flex!important;flex-wrap:wrap;justify-content:center;align-items:center;column-gap:var(--caption-word-spacing,8px);row-gap:.04em;width:100%}
.overlay .caption-word{letter-spacing:var(--caption-letter-spacing,0px)!important;margin-left:0;margin-right:0}

/* Width and spacing controls use the same compact rhythm as the existing style controls. */
.styleSection .control .label span{font-variant-numeric:tabular-nums}

@media(max-width:850px){
  /* The preview becomes a compact sticky editing dock. The controls and caption list scroll beneath it. */
  #editorView .editorGrid{align-items:start}
  #editorView .canvasColumn{
    order:-1;
    position:sticky!important;
    top:76px!important;
    z-index:24;
    width:100%;
    padding:8px 10px 10px;
    margin:0 0 4px;
    border:1px solid rgba(255,255,255,.10);
    border-radius:16px;
    background:rgba(8,13,23,.92);
    -webkit-backdrop-filter:blur(18px);
    backdrop-filter:blur(18px);
    box-shadow:0 14px 36px rgba(0,0,0,.30);
    gap:7px;
  }
  #editorView .mobilePreviewLabel{display:flex;width:100%;align-items:center;justify-content:space-between;gap:12px;padding:0 2px;color:#eef3ff}
  #editorView .mobilePreviewLabel strong{font-size:10px;letter-spacing:.08em;text-transform:uppercase}
  #editorView .mobilePreviewLabel small{font-size:9px;color:var(--muted)}
  #editorView .phone{width:min(42vw,210px)!important;padding:5px!important;border-radius:15px!important;box-shadow:0 10px 28px rgba(0,0,0,.34)!important}
  #editorView .editorVideoWrap{max-height:none!important}
  #editorView .timelineCard{width:min(100%,440px);padding:6px 9px;border-radius:10px;box-shadow:none}
  #editorView .timelineMeta{margin-bottom:4px}
  #editorView .timeline{height:8px;border-radius:999px}
  #editorView .captionInput,#editorView .timeInput,#editorView .styleSection input,#editorView .styleSelect{scroll-margin-top:370px}
}

@media(max-width:600px){
  #editorView .canvasColumn{top:72px!important;padding:7px 8px 8px;border-radius:14px}
  #editorView .phone{width:min(41vw,160px)!important;padding:4px!important;border-radius:13px!important}
  #editorView .timelineCard{display:none}
  #editorView .mobilePreviewLabel{padding:0 1px}
  #editorView .captionInput,#editorView .timeInput,#editorView .styleSection input,#editorView .styleSelect{scroll-margin-top:330px}
}

@media(max-width:600px) and (max-height:700px){
  #editorView .phone{width:min(34vw,132px)!important}
  #editorView .captionInput,#editorView .timeInput,#editorView .styleSection input,#editorView .styleSelect{scroll-margin-top:280px}
}

/* When the iPhone/phone keyboard opens, shrink the sticky preview instead of hiding it. */
body.mobile-editor-keyboard #editorView .canvasColumn{padding:5px 7px 6px;gap:4px}
body.mobile-editor-keyboard #editorView .phone{width:min(29vw,112px)!important}
body.mobile-editor-keyboard #editorView .mobilePreviewLabel small{display:none}
body.mobile-editor-keyboard #editorView .captionInput,body.mobile-editor-keyboard #editorView .timeInput{scroll-margin-top:235px}


/* === 2026-08-19 reliable caption layout controls; original editor UI preserved === */
#overlay{
  width:var(--caption-width,88%)!important;
  max-width:var(--caption-width,88%)!important;
  left:50%!important;
  right:auto!important;
  white-space:normal!important;
}
#overlayText.overlayWords{
  display:flex!important;
  flex-wrap:wrap!important;
  justify-content:center!important;
  align-items:center!important;
  width:100%!important;
  max-width:100%!important;
  column-gap:0!important;
  row-gap:.05em!important;
}
#overlayText .caption-word{
  flex:0 0 auto!important;
  white-space:nowrap!important;
  letter-spacing:var(--caption-letter-spacing,0px)!important;
}

/* Editable active-word pop. 100% keeps each template's original pop size. */
.template-kalakar .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.18))!important}
.template-punch .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.24)) rotate(-1deg)!important}
.template-neon .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.15))!important}
.template-boxsync .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.12))!important}
.template-bigword .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.42))!important}
.template-cleanword .caption-word.active-word{transform:scale(var(--caption-pop-scale,1.10))!important}
@keyframes captionPopEditable{
  0%{transform:scale(.90)}
  65%{transform:scale(var(--caption-pop-peak,1.24))}
  100%{transform:scale(var(--caption-pop-scale,1.18))}
}
.template-kalakar .caption-word.just-activated,.template-punch .caption-word.just-activated,.template-bigword .caption-word.just-activated{animation:captionPopEditable .18s ease-out}


/* === 2026-08-19 export quality controls === */
.exportSettings{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:2px}
.exportField{display:grid;gap:5px;min-width:0}
.exportField label{font-size:9px;font-weight:800;color:#aeb9cc}
.exportField .styleSelect{padding:8px 7px;font-size:10px}
.exportQualityHint{display:block;color:var(--muted);font-size:9px;line-height:1.4;margin:-1px 1px 2px}
@media(max-width:360px){.exportSettings{grid-template-columns:1fr}}
