/* Story Video Generator: everything is scoped under .stvg so it can't clash with your theme. */
.stvg{
  --stvg-primary:#4f46e5; --stvg-primary-dark:#4338ca; --stvg-accent:#7c3aed;
  --stvg-text:#0f172a; --stvg-muted:#64748b; --stvg-border:#e2e8f0; --stvg-soft:#f1f5f9;
  --stvg-bg:#f8fafc; --stvg-card:#fff; --stvg-ok:#16a34a; --stvg-err:#b91c1c;
  --stvg-radius:16px; --stvg-shadow:0 1px 2px rgba(15,23,42,.06),0 10px 30px -14px rgba(15,23,42,.18);
  container-type:inline-size; container-name:stvg;
  max-width:1200px; margin:0 auto; padding:24px; box-sizing:border-box;
  background:var(--stvg-bg); color:var(--stvg-text); border-radius:24px;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:16px; line-height:1.6; text-align:left;
}
.stvg *,.stvg *::before,.stvg *::after{ box-sizing:border-box; }
.stvg [hidden]{ display:none !important; }
.stvg :where(h2,h3,p,ul,ol){ margin:0; padding:0; }  /* zero-specificity reset so the rules below always win */
.stvg code{ background:#eef2ff; color:#3730a3; border-radius:6px; padding:1px 6px; font-size:.86em; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; word-break:break-word; }

/* ---------- Hero ---------- */
.stvg-hero{
  background:linear-gradient(135deg,#4f46e5 0%,#7c3aed 55%,#c026d3 115%);
  color:#fff; border-radius:20px; padding:48px 40px; text-align:center;
  box-shadow:0 20px 40px -20px rgba(79,70,229,.6);
}
.stvg-hero-title{ font-size:clamp(28px,5vw,44px); line-height:1.15; font-weight:800; letter-spacing:-.02em; color:#fff; }
.stvg-hero-sub{ max-width:720px; margin:14px auto 0; font-size:clamp(16px,2.2vw,19px); color:rgba(255,255,255,.92); }
.stvg-badges{ list-style:none; display:flex; flex-wrap:wrap; justify-content:center; gap:10px; margin-top:24px !important; }
.stvg-badges li{ background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.3); padding:6px 14px; border-radius:999px; font-size:14px; font-weight:600; }

/* ---------- How it works ---------- */
.stvg-steps{ list-style:none; display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-top:20px !important; }
.stvg-steps li{ display:flex; gap:14px; background:var(--stvg-card); border:1px solid var(--stvg-border); border-radius:var(--stvg-radius); padding:18px; box-shadow:var(--stvg-shadow); }
.stvg-steps strong{ display:block; font-size:16px; }
.stvg-steps p{ color:var(--stvg-muted); font-size:14.5px; margin-top:4px; }
.stvg-step-n,.stvg-num{
  flex:0 0 auto; width:34px; height:34px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--stvg-primary),var(--stvg-accent)); color:#fff; font-weight:700; font-size:15px;
}

/* ---------- App layout ---------- */
.stvg-app{ display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:24px; margin-top:24px; align-items:start; }
.stvg-panel{ display:flex; flex-direction:column; gap:20px; min-width:0; }
.stvg-card{ background:var(--stvg-card); border:1px solid var(--stvg-border); border-radius:var(--stvg-radius); padding:24px; box-shadow:var(--stvg-shadow); }
.stvg-card-head{ display:flex; gap:14px; align-items:flex-start; margin-bottom:18px; }
.stvg-card-head h3{ font-size:19px; line-height:1.3; font-weight:700; color:var(--stvg-text); }
.stvg-card-head p{ color:var(--stvg-muted); font-size:14px; margin-top:2px; }

/* ---------- Form controls ---------- */
.stvg-label{ display:block; font-weight:600; font-size:14px; margin:0 0 6px; color:var(--stvg-text); }
.stvg-opt{ font-weight:500; font-size:12px; color:var(--stvg-muted); background:var(--stvg-soft); border-radius:999px; padding:1px 8px; margin-left:4px; }
.stvg-muted{ color:var(--stvg-muted); font-weight:400; }
.stvg-hint{ color:var(--stvg-muted); font-size:13px; margin-top:6px; }
.stvg-actions + .stvg-hint{ margin-top:14px; }
.stvg-field{ margin-top:18px; }
.stvg-card-head + .stvg-field,.stvg-card .stvg-row:first-of-type .stvg-field{ margin-top:0; }
.stvg-row{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:18px; }
.stvg-row > .stvg-field{ margin-top:0; }
.stvg input[type=text],.stvg input[type=password],.stvg select,.stvg textarea{
  display:block; width:100%; max-width:100%; padding:11px 13px; font:inherit; font-size:15px; color:var(--stvg-text);
  background:#fff; border:1px solid #cbd5e1; border-radius:10px; box-shadow:none; height:auto; min-height:44px;
}
.stvg textarea{ min-height:220px; resize:vertical; line-height:1.5; margin-top:0; }
.stvg input[type=file]{ display:block; width:100%; font-size:14px; padding:10px; background:var(--stvg-bg); border:1px dashed #cbd5e1; border-radius:10px; }
.stvg input:focus,.stvg select:focus,.stvg textarea:focus,.stvg button:focus-visible,.stvg summary:focus-visible,.stvg a:focus-visible{
  outline:none; border-color:var(--stvg-primary); box-shadow:0 0 0 3px rgba(79,70,229,.25);
}
.stvg-check{ display:flex; align-items:flex-start; gap:8px; margin-top:10px; font-size:14px; cursor:pointer; }
.stvg-check input{ margin-top:5px; accent-color:var(--stvg-primary); }

/* ---------- Buttons ---------- */
.stvg-actions{ display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.stvg-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px; cursor:pointer; text-decoration:none;
  padding:10px 18px; border-radius:10px; border:1px solid #cbd5e1; background:#fff; color:var(--stvg-text);
  font:inherit; font-size:14.5px; font-weight:600; line-height:1.3; min-height:42px; transition:background .15s,box-shadow .15s,transform .05s;
}
.stvg-btn:hover{ background:var(--stvg-soft); }
.stvg-btn:active{ transform:translateY(1px); }
.stvg-btn[disabled]{ opacity:.55; cursor:not-allowed; }
.stvg-btn-primary,a.stvg-btn-primary{ background:linear-gradient(135deg,var(--stvg-primary),var(--stvg-accent)); border-color:transparent; color:#fff; box-shadow:0 8px 18px -8px rgba(79,70,229,.7); }
.stvg-btn-primary:hover,a.stvg-btn-primary:hover{ background:linear-gradient(135deg,var(--stvg-primary-dark),#6d28d9); color:#fff; }
.stvg-btn-text{ border-color:transparent; background:transparent; color:var(--stvg-err); }
.stvg-btn-text:hover{ background:#fef2f2; }
.stvg-btn-lg{ width:100%; padding:15px 20px; font-size:17px; border-radius:14px; min-height:54px; }

/* ---------- Connected key ---------- */
.stvg-connected{ display:flex; flex-wrap:wrap; align-items:center; gap:12px 16px; background:#f0fdf4; border:1px solid #bbf7d0; border-radius:12px; padding:14px 16px; }
.stvg-connected .stvg-actions{ margin:0 0 0 auto; }
.stvg-dot{ width:10px; height:10px; border-radius:50%; background:var(--stvg-ok); box-shadow:0 0 0 4px rgba(22,163,74,.2); }
.stvg-connected-text{ display:flex; flex-direction:column; gap:2px; }
.stvg-connected-text strong{ color:#166534; }
.stvg-connected-text code{ background:transparent; color:var(--stvg-muted); padding:0; }

/* ---------- Status text, notices ---------- */
.stvg-status{ min-height:20px; margin-top:10px; font-size:14px; color:var(--stvg-muted); }
.stvg-status.is-error{ color:var(--stvg-err); font-weight:600; }
.stvg-status.is-ok{ color:#166534; }
.stvg-notice{ background:#fffbeb; border:1px solid #fde68a; color:#92400e; border-radius:12px; padding:12px 16px; font-size:14px; }

/* ---------- Script helpers ---------- */
.stvg-example{ background:#0f172a; color:#e2e8f0; border-radius:12px; padding:14px 16px; font-size:13px; line-height:1.6; white-space:pre-wrap; overflow-x:auto; margin:0 0 12px; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.stvg-details{ margin:0 0 14px; }
.stvg-details summary{ cursor:pointer; font-size:14px; font-weight:600; color:var(--stvg-primary); }
.stvg-taglist{ margin:10px 0 0 !important; padding-left:20px !important; font-size:13.5px; color:#334155; }
.stvg-taglist li{ margin-bottom:8px; }
.stvg .sit-vt-imgtags{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.stvg .sit-vt-imgtag{ background:var(--stvg-soft); border:1px solid var(--stvg-border); border-radius:999px; padding:3px 10px; font-size:12px; }

/* ---------- Preview ---------- */
.stvg-preview{
  position:sticky; top:24px; background:linear-gradient(180deg,#111827,#0b1020); border-radius:20px; padding:20px;
  display:flex; flex-direction:column; align-items:center; gap:14px; box-shadow:0 24px 50px -24px rgba(15,23,42,.8);
}
.stvg-preview-title{ color:#e2e8f0; font-size:13px; letter-spacing:.12em; text-transform:uppercase; font-weight:700; align-self:flex-start; }
.stvg #sitVtCanvas{ width:100%; max-width:270px; aspect-ratio:9/16; height:auto; object-fit:contain; border-radius:18px; background:#000; box-shadow:0 20px 50px -15px #000; }
.stvg-preview-note{ color:#94a3b8; font-size:12.5px; text-align:center; }
.stvg #sitVtResult{ width:100%; flex-direction:column; gap:12px; align-items:center; }
.stvg #sitVtResultVideo{ width:100%; max-width:300px; border-radius:14px; }

/* ---------- Content sections ---------- */
.stvg-section{ margin-top:40px; }
.stvg-h2{ font-size:clamp(22px,3vw,28px); font-weight:800; letter-spacing:-.01em; margin-bottom:18px !important; color:var(--stvg-text); }
.stvg-features{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.stvg-feature{ background:var(--stvg-card); border:1px solid var(--stvg-border); border-radius:var(--stvg-radius); padding:20px; box-shadow:var(--stvg-shadow); }
.stvg-feature h3{ font-size:17px; font-weight:700; margin-bottom:6px; color:var(--stvg-text); }
.stvg-feature p{ font-size:14.5px; color:#475569; }
.stvg-tips{ list-style:none; display:grid; gap:10px; }
.stvg-tips li{ background:var(--stvg-card); border:1px solid var(--stvg-border); border-left:4px solid var(--stvg-primary); border-radius:12px; padding:14px 16px; font-size:15px; color:#334155; }
.stvg-faq{ display:grid; gap:10px; }
.stvg-faq-item{ background:var(--stvg-card); border:1px solid var(--stvg-border); border-radius:12px; padding:0 18px; }
.stvg-faq-item summary{ cursor:pointer; list-style:none; padding:16px 28px 16px 0; font-weight:600; position:relative; color:var(--stvg-text); }
.stvg-faq-item summary::-webkit-details-marker{ display:none; }
.stvg-faq-item summary::after{ content:"+"; position:absolute; right:0; top:50%; transform:translateY(-50%); font-size:22px; color:var(--stvg-primary); font-weight:500; }
.stvg-faq-item[open] summary::after{ content:"–"; }
.stvg-faq-item p{ padding:0 0 16px; color:#475569; font-size:15px; }
.stvg-privacy{ background:var(--stvg-card); border:1px solid var(--stvg-border); border-radius:var(--stvg-radius); padding:24px; }
.stvg-privacy p{ color:#475569; font-size:15px; }
.stvg-privacy p + p{ margin-top:10px; }
.stvg-disclaimer{ font-size:13px !important; color:var(--stvg-muted) !important; }

/* ---------- Responsive ---------- */
@container stvg (max-width:900px){
  .stvg-app{ grid-template-columns:1fr; }
  .stvg-preview{ position:static; }
  .stvg-steps,.stvg-features{ grid-template-columns:1fr; }
}
@container stvg (max-width:560px){
  .stvg-row{ grid-template-columns:1fr; }
  .stvg-hero{ padding:36px 22px; }
  .stvg-card{ padding:18px; }
  .stvg-connected .stvg-actions{ margin-left:0; }
}
/* fallback for browsers without container queries */
@media (max-width:900px){
  .stvg-app{ grid-template-columns:1fr; }
  .stvg-preview{ position:static; }
  .stvg-steps,.stvg-features{ grid-template-columns:1fr; }
}
@media (max-width:560px){
  .stvg{ padding:14px; border-radius:16px; }
  .stvg-row{ grid-template-columns:1fr; }
}

/* ---------- v2.3: clips, images, tone, size, campaign checklist ---------- */
.stvg-subhead{ font-size:15px; font-weight:700; margin:26px 0 10px !important; color:var(--stvg-text); }
.stvg-readout{ float:right; font-weight:600; font-size:13px; color:var(--stvg-primary); }
.stvg input[type=range]{ width:100%; accent-color:var(--stvg-primary); min-height:28px; margin:0; }
.stvg input[type=color]{ width:46px; height:40px; padding:2px; border:1px solid #cbd5e1; border-radius:10px; background:#fff; cursor:pointer; flex:0 0 auto; }
.stvg-inline{ display:flex; align-items:center; gap:10px; }
.stvg-tagbox{ display:flex; align-items:center; gap:8px; }
.stvg-tagbox code{ flex:0 0 auto; padding:10px 12px; font-size:14px; font-weight:600; }
.stvg-tagbox input{ flex:1 1 auto; min-width:0; }

.stvg-medialist{ display:grid; gap:10px; margin-top:12px; }
.stvg-medialist:empty{ display:none; }
.stvg-media{ display:grid; grid-template-columns:72px minmax(0,1fr); gap:6px 14px; align-items:start; background:var(--stvg-bg); border:1px solid var(--stvg-border); border-radius:12px; padding:12px; }
.stvg-media-thumb{ width:72px; height:72px; border-radius:10px; background:#0f172a; object-fit:cover; display:block; }
.stvg-media-top{ display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; }
.stvg-media-tag{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12.5px; font-weight:700; background:#eef2ff; color:#3730a3; border-radius:999px; padding:2px 10px; }
.stvg-media-name{ font-size:13px; color:var(--stvg-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; flex:1 1 120px; min-width:0; }
.stvg-media-ctl{ grid-column:1 / -1; display:grid; gap:12px; margin-top:6px; }
.stvg-media-line{ display:grid; grid-template-columns:96px minmax(0,1fr); gap:10px; align-items:center; font-size:13px; }
.stvg-media-line > label{ font-weight:600; color:var(--stvg-text); }
.stvg-speed{ display:flex; align-items:center; gap:8px; }
.stvg-speed .stvg-btn{ min-height:34px; padding:4px 12px; font-size:16px; line-height:1; }
.stvg-speed output{ min-width:46px; text-align:center; font-weight:700; font-size:14px; color:var(--stvg-primary); }
.stvg-media select, .stvg-media input[type=text]{ min-height:36px !important; padding:6px 10px !important; font-size:14px !important; }
.stvg-trim{ display:flex; align-items:center; gap:8px; }
.stvg-trim input{ max-width:92px; }
.stvg-media-btns{ display:flex; flex-wrap:wrap; gap:8px; }
.stvg-media-btns .stvg-btn{ min-height:34px; padding:4px 12px; font-size:13px; }
.stvg-media-warn{ font-size:12.5px; color:#92400e; background:#fffbeb; border:1px solid #fde68a; border-radius:8px; padding:6px 10px; }

.stvg-checklist{ list-style:none; display:grid; gap:8px; margin:0 0 14px !important; }
.stvg-checklist li{ display:grid; grid-template-columns:22px minmax(0,1fr); gap:10px; font-size:14px; line-height:1.45; padding:10px 12px; border-radius:10px; border:1px solid var(--stvg-border); background:var(--stvg-bg); }
.stvg-checklist .ico{ font-weight:800; text-align:center; }
.stvg-checklist li small{ display:block; color:var(--stvg-muted); font-size:12.5px; margin-top:2px; }
.stvg-checklist li.is-ok{ background:#f0fdf4; border-color:#bbf7d0; } .stvg-checklist li.is-ok .ico{ color:#16a34a; }
.stvg-checklist li.is-warn{ background:#fffbeb; border-color:#fde68a; } .stvg-checklist li.is-warn .ico{ color:#b45309; }
.stvg-checklist li.is-bad{ background:#fef2f2; border-color:#fecaca; } .stvg-checklist li.is-bad .ico{ color:#b91c1c; }

@container stvg (max-width:560px){
  .stvg-media-line{ grid-template-columns:1fr; gap:4px; }
}
@media (max-width:560px){
  .stvg-media-line{ grid-template-columns:1fr; gap:4px; }
}
@media (prefers-reduced-motion:reduce){ .stvg *{ transition:none !important; } }

.stvg-speedbar{ display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:8px; margin:10px 0 2px; }
.stvg-speedbar-label{ font-size:13px; font-weight:600; color:var(--stvg-muted); width:100%; text-align:center; }
.stvg-speedbar .stvg-btn{ min-height:36px; padding:4px 14px; font-size:16px; line-height:1; }
.stvg-speedpresets{ margin:0; gap:4px; }
.stvg-speedpresets .stvg-btn{ min-height:32px; padding:2px 10px; font-size:13px; }
.stvg-speedpresets .stvg-btn.is-active{ background:var(--stvg-primary); color:#fff; }
.stvg-speedcustom{ margin:2px 0; font-size:13px; color:var(--stvg-muted); }
.stvg-speedcustom input{ width:84px; min-height:34px; padding:2px 8px; text-align:center; }
.stvg-speedbar.is-busy{ opacity:.55; pointer-events:none; }
.stvg-speedbar output{ min-width:54px; text-align:center; font-weight:700; font-size:15px; color:var(--stvg-primary); }

.stvg-tones{ display:grid; gap:10px; margin:12px 0; }
.stvg-tone{ display:grid; gap:8px; background:var(--stvg-bg); border:1px solid var(--stvg-border); border-radius:12px; padding:12px; }
.stvg-tone-name{ font-weight:700; font-size:14px; }
.stvg-tone-nums{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.stvg-tone-f{ display:grid; gap:4px; font-size:12px; font-weight:600; color:var(--stvg-muted); }
.stvg-tone input{ min-height:36px !important; padding:6px 10px !important; font-size:14px !important; }

.stvg-cliplen{ display:grid; gap:2px; }
.stvg-cliplen-main{ font-size:14px; font-weight:700; color:var(--stvg-text); }
.stvg-cliplen-note{ font-size:12.5px; color:var(--stvg-muted); line-height:1.4; }

/* background video list */
.stvg-bglist{ display:grid; gap:6px; margin-top:10px; }
.stvg-bglist-row{ display:flex; align-items:center; gap:6px; padding:6px 10px; border:1px solid var(--stvg-border); border-radius:12px; background:var(--stvg-card); }
.stvg-bglist-name{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
.stvg-bglist-btn{ padding:4px 10px; min-width:0; }

.stvg-media .stvg-btn-text.is-active{ background:var(--stvg-primary); color:#fff; border-radius:8px; }
.stvg-speed.is-auto input[type=range]{ opacity:.55; }

/* ---------- v3.0: phones and touch screens ---------- */
.stvg-stopbtn{ width:100%; margin-top:10px; background:#fff; color:#b91c1c; border:1px solid #fecaca; }
.stvg-stopbtn[hidden]{ display:none; }
.stvg button, .stvg select, .stvg input{ touch-action:manipulation; }
@media (pointer:coarse){
  .stvg-btn{ min-height:44px; }
  .stvg-speed .stvg-btn, .stvg-media-btns .stvg-btn, .stvg-speedpresets .stvg-btn{ min-height:44px; min-width:44px; }
  .stvg input[type=range]{ min-height:44px; }
}
@media (max-width:700px){
  .stvg input, .stvg select, .stvg textarea{ font-size:16px !important; }   /* stops iPhones zooming in when a field is tapped */
  .stvg{ padding-left:max(14px, env(safe-area-inset-left)); padding-right:max(14px, env(safe-area-inset-right)); padding-bottom:max(14px, env(safe-area-inset-bottom)); }
  .stvg-preview canvas, .stvg-preview video{ max-width:min(100%, 320px); height:auto; }
  .stvg-speedbar{ flex-wrap:wrap; justify-content:center; }
  .stvg-btn-lg{ width:100%; }
  .stvg-trim{ flex-wrap:wrap; }
  .stvg-trim input{ max-width:none; flex:1 1 90px; }
}

/* result panel: small text buttons are light, not red */
.stvg-speedbar .stvg-btn-text, #sitVtShareActions .stvg-btn-text, #sitVtShareActions a.stvg-btn{ color:#c7d2fe; text-decoration:none; }
.stvg-speedpresets .stvg-btn.is-active{ color:#fff; }
#sitVtShareLink, #sitVtShareDirect{ width:100%; }
