/* Web Motion Studio — FrameGlitch cinematic-glass language */
.web-motion-studio{
  --wm-a:#00dcff;--wm-b:#7a5cff;--wm-c:#ff2eaa;
  display:flex;flex-direction:column;gap:10px;padding:4px 2px 8px;color:#e8edf6;min-width:0;min-height:0;flex:1;overflow:hidden;
}
.web-motion-studio *{box-sizing:border-box}
.living-storyboard[data-mode="webmotion"]{padding:8px 0;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.canvas-viewport-mode .living-storyboard[data-mode="webmotion"]>.web-motion-studio{flex:1;min-height:0;height:auto}

.wm-head{
  flex:none;position:relative;isolation:isolate;overflow:hidden;
  display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:12px;
  min-height:52px;padding:8px 12px 8px 16px;border-radius:14px;border:1px solid rgba(0,220,255,.35);
  background:#05060d;box-shadow:0 14px 36px rgba(2,4,14,.45);
}
.wm-head::before{
  content:'';position:absolute;inset:0;z-index:-2;
  background:var(--wm-hero) right center/cover no-repeat;
  filter:saturate(1.15) brightness(1.05);transform:scale(1.03);
}
.wm-head::after{
  content:'';position:absolute;inset:0;z-index:-1;
  background:linear-gradient(90deg,rgba(5,6,13,.94) 0%,rgba(5,6,13,.78) 36%,rgba(5,6,13,.28) 70%,rgba(5,6,13,.55) 100%);
}
.wm-head-title{position:relative;z-index:1;min-width:0;flex:1 1 auto;display:flex;align-items:center;gap:10px}
.wm-head h2{
  margin:0;font-size:17px;line-height:1.2;color:#fff;letter-spacing:.01em;font-weight:750;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  text-shadow:0 0 22px rgba(0,220,255,.35),0 1px 2px #000a;
}
.wm-chip{
  flex:none;display:inline-flex;align-items:center;height:22px;padding:0 9px;border-radius:999px;
  border:1px solid rgba(0,220,255,.4);background:rgba(0,220,255,.1);color:#9df0ff;font-size:11px;font-weight:650;
}
.wm-chip.is-ready{border-color:rgba(110,220,160,.5);background:rgba(60,160,110,.18);color:#b8f5d0}
.wm-chip.is-busy{border-color:rgba(255,180,80,.45);background:rgba(160,100,30,.2);color:#ffd9a0}
.wm-chip.is-error{border-color:rgba(255,100,120,.5);background:rgba(120,30,50,.25);color:#ffc0cb}
.wm-head-actions{position:relative;z-index:1;display:flex;flex-wrap:nowrap;gap:6px;flex:none;align-items:center}
.wm-head-btn,.living-storyboard .wm-head-btn{
  min-height:28px!important;height:28px!important;padding:0 10px!important;margin:0!important;
  font-size:11px!important;line-height:1!important;border-radius:7px!important;white-space:nowrap;
  background:rgba(8,12,22,.72)!important;border:1px solid rgba(255,255,255,.18)!important;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:none!important;
}
.wm-head-btn:hover,.living-storyboard .wm-head-btn:hover{border-color:rgba(157,240,255,.55)!important;color:#fff!important}
.wm-head-btn.is-primary,.living-storyboard .wm-head-btn.is-primary{
  background:linear-gradient(135deg,rgba(0,220,255,.28),rgba(122,92,255,.35))!important;
  border-color:rgba(0,220,255,.5)!important;color:#fff!important;
}
.wm-head-btn:disabled,.living-storyboard .wm-head-btn:disabled{opacity:.45;cursor:not-allowed}

.wm-layout{
  flex:1;display:grid;grid-template-columns:minmax(280px,320px) minmax(0,1fr) minmax(260px,300px);
  gap:12px;align-items:stretch;min-height:0;overflow:hidden;
}
.wm-pane{
  min-width:0;min-height:0;height:100%;display:flex;flex-direction:column;gap:0;
  padding:12px;border-radius:16px;border:1px solid transparent;overflow:hidden;
  background:rgba(13,18,40,.55) padding-box,linear-gradient(135deg,rgba(168,186,255,.4),rgba(76,204,240,.3)) border-box;
  -webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);
}
.wm-pane-head{flex:none;display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin:0 0 10px}
.wm-pane-head h3{margin:0;font-size:13px;letter-spacing:.06em;color:#9bb0cc;font-weight:700}
.wm-pane-head span{font-size:11px;color:#7f8aa3}
.wm-muted{margin:0 0 10px;font-size:12px;line-height:1.55;color:#8f9bb5;flex:none}
.wm-hint{margin:8px 0 0;font-size:11px;line-height:1.5;color:#7f8aa3;flex:none}

/* Assets */
.wm-job-list{
  display:flex;flex-direction:column;gap:10px;flex:1;min-height:0;
  overflow:auto;padding:2px 10px 6px 1px;
  scrollbar-width:thin;scrollbar-color:#5a6f8c transparent;
}
.wm-job-list::-webkit-scrollbar{width:9px}
.wm-job-list::-webkit-scrollbar-track{background:rgba(255,255,255,.04);border-radius:999px;margin:4px 0}
.wm-job-list::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,#6a82a4,#445870);border-radius:999px;
  border:2px solid transparent;background-clip:padding-box;min-height:32px;
}
.wm-job-list::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,#86a0c4,#587090);background-clip:padding-box}
.wm-job-list::-webkit-scrollbar-button{display:none;width:0;height:0}
.wm-job,.living-storyboard .wm-job{
  display:grid!important;grid-template-columns:112px minmax(0,1fr);gap:12px;align-items:center;
  width:100%!important;flex:0 0 auto!important;height:auto!important;min-height:84px!important;
  text-align:left!important;padding:10px!important;margin:0!important;box-sizing:border-box!important;
  border-radius:12px!important;border:1px solid rgba(255,255,255,.12)!important;
  background:rgba(5,6,13,.45)!important;color:#e8edf6!important;cursor:pointer;
  box-shadow:none!important;overflow:hidden!important;line-height:1.3!important;
}
.wm-job>*,.living-storyboard .wm-job>*{min-width:0}
.wm-job:hover,.living-storyboard .wm-job:hover{border-color:rgba(0,220,255,.35)!important;background:rgba(20,30,50,.55)!important}
.wm-job.selected,.living-storyboard .wm-job.selected{
  border-color:#9df0ff!important;box-shadow:0 0 0 1px rgba(157,240,255,.3)!important;background:rgba(20,40,70,.55)!important;
}
.wm-job img{width:112px;height:70px;object-fit:cover;border-radius:9px;background:#0a1018;display:block;flex:none}
.wm-job-copy{min-width:0;display:flex;flex-direction:column;gap:4px}
.wm-job-copy strong{display:block;font-size:15px;font-weight:700;color:#eef4ff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wm-job-copy small{display:block;font-size:12px;color:#8fa0b8;font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wm-empty{
  display:grid;place-items:center;gap:8px;flex:1;min-height:140px;padding:18px;text-align:center;
  border-radius:12px;border:1.5px dashed rgba(0,220,255,.35);background:rgba(5,6,13,.35);color:#aab6cf;
}
.wm-empty strong{font-size:14px;color:#fff}

/* Preview */
.wm-center{padding:12px;gap:0}
.wm-preview-toolbar{flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 10px}
.wm-seg{
  display:inline-flex;gap:0;padding:2px;border-radius:9px;border:1px solid rgba(255,255,255,.14);background:rgba(5,6,13,.45);
}
.wm-seg>button,.living-storyboard .wm-seg>button{
  min-height:28px!important;height:28px!important;padding:0 12px!important;margin:0!important;
  border:0!important;border-radius:7px!important;background:transparent!important;color:#b6c2d4!important;
  font-size:11px!important;box-shadow:none!important;
}
.wm-seg>button.selected,.living-storyboard .wm-seg>button.selected{
  background:linear-gradient(135deg,rgba(0,220,255,.28),rgba(122,92,255,.3))!important;color:#fff!important;
}
.wm-preview-stage{
  position:relative;flex:1;min-height:220px;overflow:auto;border-radius:12px;
  border:1px solid rgba(255,255,255,.1);background:#05060d;
  scrollbar-width:thin;scrollbar-color:#445870 transparent;
}
.wm-preview-stage::-webkit-scrollbar{width:9px}
.wm-preview-stage::-webkit-scrollbar-thumb{background:#445870;border-radius:999px;border:2px solid transparent;background-clip:padding-box}
.wm-preview-stage::-webkit-scrollbar-button{display:none}
.wm-preview-stage.is-mobile{width:min(100%,340px);margin:0 auto;border-radius:22px;border-width:2px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}
.wm-preview-stage .wm-scroll{position:relative;height:calc(var(--wm-scroll-vh,300)*1vh);min-height:200vh}
.wm-preview-stage .wm-sticky{
  position:sticky;top:0;height:min(52vh,calc(100dvh - 290px),560px);min-height:220px;
  display:grid;place-items:center;overflow:hidden;
}
.wm-preview-stage.is-mobile .wm-sticky{height:min(58vh,520px);min-height:280px}
.wm-preview-stage canvas{width:100%;height:100%;display:block;background:#05060d}
.wm-meta{
  position:absolute;left:12px;bottom:12px;z-index:2;display:flex;flex-direction:column;gap:6px;
  padding:8px 10px;border-radius:10px;border:1px solid rgba(255,255,255,.12);
  background:rgba(5,6,13,.72);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  font:11px/1.2 ui-monospace,Consolas,monospace;color:#c5d3e8;pointer-events:none;
}
.wm-meta i{display:block;width:120px;height:3px;border-radius:99px;background:rgba(255,255,255,.16);position:relative;overflow:hidden}
.wm-meta i::after{content:'';position:absolute;inset:0 auto 0 0;width:var(--p,0%);background:linear-gradient(90deg,var(--wm-a),var(--wm-b));border-radius:inherit}
.wm-preview-foot{flex:none;display:flex;flex-direction:column;gap:8px;margin-top:10px}
.wm-scrub{width:100%;accent-color:var(--wm-a)}
.wm-scrub-row{display:flex;align-items:center;gap:10px}
.wm-scrub-row label{flex:none;font-size:11px;color:#9bb0cc;letter-spacing:.04em;font-weight:650}
.wm-scrub-row output{flex:none;min-width:3.5em;text-align:right;font-size:11px;color:#9df0ff;font-variant-numeric:tabular-nums}

/* Settings — compact density */
.wm-form{display:flex;flex-direction:column;gap:6px;flex:0 1 auto;min-height:0;overflow:auto;padding-right:2px;scrollbar-width:thin}
.wm-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(72px,1fr));gap:6px}
.wm-field{display:grid;gap:3px;margin:0;min-width:0}
.wm-field>span{font-size:10px;letter-spacing:.04em;color:#8fa0b8;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wm-field input[type=number]{
  width:100%;min-width:0;border-radius:8px;border:1px solid rgba(255,255,255,.14);background:rgba(5,6,13,.55);
  color:#e8edf6;padding:6px 8px;font:inherit;font-size:12px;line-height:1.2;height:32px;font-variant-numeric:tabular-nums;
}
.wm-pick{position:relative;min-width:0}
.wm-pick-trigger,.living-storyboard .wm-pick-trigger{
  display:flex!important;align-items:center;justify-content:space-between;gap:8px;width:100%!important;
  min-height:32px!important;height:32px!important;margin:0!important;padding:0 28px 0 8px!important;
  border-radius:8px!important;border:1px solid rgba(255,255,255,.14)!important;
  background:rgba(5,6,13,.72)!important;color:#e8edf6!important;font-size:12px!important;line-height:1.2!important;
  text-align:left!important;box-shadow:none!important;cursor:pointer;position:relative;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.wm-pick-trigger::after{
  content:'';position:absolute;right:10px;top:50%;width:6px;height:6px;
  border-right:1.5px solid #9bb0cc;border-bottom:1.5px solid #9bb0cc;
  transform:translateY(-70%) rotate(45deg);pointer-events:none;
}
.wm-pick.is-open .wm-pick-trigger,.living-storyboard .wm-pick.is-open .wm-pick-trigger{
  border-color:rgba(0,220,255,.5)!important;box-shadow:0 0 0 1px rgba(0,220,255,.2)!important;
}
.wm-pick.is-open .wm-pick-trigger::after{transform:translateY(-20%) rotate(225deg)}
.wm-pick-menu{
  display:none;position:absolute;z-index:40;left:0;right:0;top:calc(100% + 4px);
  flex-direction:column;gap:2px;max-height:220px;overflow:auto;padding:6px;
  border-radius:10px;border:1px solid rgba(126,203,255,.28);
  background:rgba(8,12,22,.96);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
  box-shadow:0 16px 36px rgba(0,0,0,.55);
  scrollbar-width:thin;scrollbar-color:#445870 transparent;
}
.wm-pick.is-open .wm-pick-menu{display:flex}
.wm-pick-option,.living-storyboard .wm-pick-option{
  display:block!important;width:100%!important;min-height:30px!important;height:auto!important;
  margin:0!important;padding:7px 9px!important;border:0!important;border-radius:7px!important;
  background:transparent!important;color:#d7e2f3!important;font-size:12px!important;
  text-align:left!important;box-shadow:none!important;cursor:pointer;line-height:1.3!important;
}
.wm-pick-option:hover,.living-storyboard .wm-pick-option:hover,
.wm-pick-option:focus-visible,.living-storyboard .wm-pick-option:focus-visible{
  background:rgba(0,220,255,.14)!important;color:#fff!important;
}
.wm-pick-option.selected,.living-storyboard .wm-pick-option.selected{
  background:linear-gradient(120deg,rgba(0,220,255,.28),rgba(122,92,255,.32))!important;
  color:#fff!important;font-weight:700;
}
.wm-checks{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 4px}
.wm-check{
  display:inline-flex;align-items:center;gap:6px;margin:0;padding:5px 8px;border-radius:8px;
  border:1px solid rgba(255,255,255,.14);background:rgba(5,6,13,.4);font-size:11px;color:#d7e2f3;cursor:pointer;
}
.wm-check input{width:13px;height:13px;margin:0;accent-color:#7ecbff}
.wm-section-label{margin:4px 0 0;font-size:10px;letter-spacing:.08em;color:#7f8aa3;font-weight:700;text-transform:uppercase}
.wm-status-inline{font-size:11px;color:#9df0ff;font-variant-numeric:tabular-nums}
.wm-details{margin:2px 0;border-radius:8px;border:1px solid rgba(255,255,255,.1);background:rgba(5,6,13,.28);padding:0 8px}
.wm-details>summary{
  cursor:pointer;list-style:none;font-size:11px;font-weight:650;color:#c5d3e8;padding:7px 0;user-select:none;
}
.wm-details>summary::-webkit-details-marker{display:none}
.wm-details>summary::before{content:'▸ ';color:#7f8aa3}
.wm-details[open]>summary::before{content:'▾ '}
.wm-details .wm-muted{margin:0 0 8px;font-size:11px;line-height:1.45}
.wm-keys{display:flex;flex-direction:column;gap:5px;margin:0 0 6px}
.wm-key-row{display:grid;grid-template-columns:56px minmax(0,1fr) 26px;gap:5px;align-items:center}
.wm-key-row input{
  width:100%;border-radius:7px;border:1px solid rgba(255,255,255,.14);background:rgba(5,6,13,.55);
  color:#e8edf6;padding:5px 7px;font:inherit;font-size:11px;height:28px;
}
.wm-key-rm,.living-storyboard .wm-key-rm{
  min-height:28px!important;height:28px!important;padding:0!important;margin:0!important;
  border-radius:7px!important;font-size:11px!important;
}
.wm-key-add,.living-storyboard .wm-key-add{
  width:100%!important;min-height:28px!important;margin:0 0 8px!important;border-radius:7px!important;font-size:11px!important;
}
.wm-embed{flex:none}
.wm-hint-row{display:flex;align-items:center;gap:8px;margin:0 0 4px;flex-wrap:wrap}
.wm-hint-row .wm-hint{margin:0;flex:1 1 auto}
.wm-mini,.living-storyboard .wm-mini{
  flex:none!important;min-height:28px!important;height:28px!important;margin:0!important;padding:0 10px!important;
  border-radius:7px!important;font-size:11px!important;white-space:nowrap;
}
.wm-crop{flex:none;margin:0 0 10px}
.wm-crop-stage{
  position:relative;width:100%;aspect-ratio:16/9;max-height:220px;border-radius:12px;overflow:hidden;
  border:1px solid rgba(255,255,255,.12);background:#05060d;touch-action:none;
}
.wm-crop-img{display:block;width:100%;height:100%;object-fit:contain;background:#05060d;pointer-events:none}
.wm-crop-frame{
  position:absolute;border:1.5px solid rgba(0,220,255,.75);box-shadow:0 0 0 999px rgba(0,0,0,.35);
  border-radius:4px;cursor:ew-resize;pointer-events:auto;
}
.wm-crop-frame.is-mobile{border-color:rgba(255,100,200,.85);box-shadow:0 0 0 999px rgba(0,0,0,.2)}
.wm-crop-frame.is-active{outline:2px solid rgba(255,255,255,.55);outline-offset:1px;z-index:2}
.wm-crop .wm-hint{margin:6px 0 0}
.wm-preview-stage .wm-phase{
  position:absolute;left:12px;top:12px;z-index:2;padding:7px 10px;border-radius:10px;
  border:1px solid rgba(255,255,255,.12);background:rgba(5,6,13,.72);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  font:11px/1.3 system-ui,sans-serif;color:#c5d3e8;pointer-events:none;
}
.wm-status{
  flex:none;margin:0 0 10px;padding:9px 11px;border-radius:10px;
  border:1px solid rgba(255,255,255,.1);background:rgba(5,6,13,.4);
  font-size:12px;line-height:1.5;color:#c5d3e8;
}
.wm-actions{flex:none;display:grid;grid-template-columns:1fr 1.2fr;gap:6px;margin-top:8px;padding-top:0;position:sticky;bottom:0;background:linear-gradient(180deg,transparent,rgba(13,18,40,.92) 28%);padding-bottom:2px}
.wm-actions>button,.living-storyboard .wm-actions>button{
  width:100%!important;min-height:32px!important;justify-content:center;border-radius:8px!important;margin:0!important;font-size:12px!important;
}
.wm-actions>button:last-child{grid-column:1/-1}
.wm-actions>button.is-primary,.living-storyboard .wm-actions>button.is-primary{
  background:linear-gradient(135deg,rgba(0,220,255,.35),rgba(122,92,255,.4))!important;
  border:1px solid rgba(0,220,255,.45)!important;color:#fff!important;
}

@media(max-width:1100px){
  .wm-layout{grid-template-columns:1fr;overflow:auto}
  .wm-pane{height:auto;max-height:none;overflow:visible}
  .wm-job-list{max-height:220px}
  .wm-preview-stage{min-height:280px;height:46vh}
  .wm-form{overflow:visible}
}
