/* Sowveil - design system. Clean system-UI look: flat surfaces, hairline dividers,
   one accent colour, soft spring motion. Light + dark via html.dark. */
:root {
  --surface: #ffffff;
  --grouped: #f4f4f6;
  --elevated: #fafafc;
  --label: #1c1c1e;
  --label-2: #636366;
  --label-3: #aeaeb2;
  --accent: #6d5cff;
  --accent-2: #5a48f0;
  --accent-soft: rgba(109, 92, 255, .14);
  --hairline: #dcdce1;
  --danger: #e5484d;
  --ok: #30a46c;
  --radius: 10px;
  --spring: cubic-bezier(.34, 1.25, .5, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .22);
  /* names the shared template editor uses */
  --primary: var(--accent); --primary-dim: var(--accent-soft); --primary-glow: rgba(109, 92, 255, .45); --glass-border: var(--hairline); --accent-text-color: #fff;
}
html.dark {
  --surface: #1d1d20;
  --grouped: #26262a;
  --elevated: #2c2c31;
  --label: #f4f4f6;
  --label-2: #aeaeb2;
  --label-3: #6b6b70;
  --accent: #8b7dff;
  --accent-2: #a093ff;
  --accent-soft: rgba(139, 125, 255, .18);
  --hairline: #38383d;
}
* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: var(--surface); color: var(--label);
  -webkit-font-smoothing: antialiased; user-select: none;
}
body.sv-hidden *, body.sv-hidden { animation-play-state: paused !important; transition: none !important; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--label); }
#app { display: flex; flex-direction: column; }
::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 12px; border-bottom: 1px solid var(--hairline); background: var(--surface); }
.round-btn { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--hairline); background: var(--grouped); color: var(--label-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .2s var(--ease), color .2s; }
.round-btn:hover { transform: scale(1.06); color: var(--label); }
.round-btn:active { transform: scale(.94); }
.logo-btn { border: 0; color: var(--label); }
.tabs-scroll { flex: 1; min-width: 0; overflow-x: auto; padding-bottom: 2px; cursor: grab; }
.tabs-scroll::-webkit-scrollbar { height: 0; }
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--hairline); background: var(--grouped); }
.seg-pill { position: absolute; top: 3px; bottom: 3px; border-radius: 999px; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); opacity: 0;
  transition: left .32s var(--spring), width .32s var(--spring), opacity .18s; }
.seg-btn { position: relative; z-index: 1; border: 0; background: none; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500; white-space: nowrap;
  color: var(--label-2); cursor: pointer; transition: color .25s; }
.seg-btn:hover, .seg-btn.on { color: var(--label); }

/* sidebar layout: icon rail instead of top pills */
.body-row { flex: 1; min-height: 0; display: flex; }
.rail { display: none; width: 52px; flex: none; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-right: 1px solid var(--hairline); background: var(--grouped); position: relative; }
html.layout-sidebar .rail { display: flex; }
html.layout-sidebar .tabs-scroll { visibility: hidden; }
.rail-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--label-2); cursor: pointer; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; transition: color .2s; }
.rail-btn:hover, .rail-btn.on { color: var(--accent); }
.rail-pill { position: absolute; left: 8px; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); transition: top .32s var(--spring); }
.rail-btn svg, .round-btn svg { width: 16px; height: 16px; }

/* ---------- content: master list + inspector ---------- */
.content { flex: 1; min-width: 0; min-height: 0; display: flex; }
.content.narrow { flex-direction: column; }
.master { flex: none; width: clamp(170px, 34%, 240px); display: flex; flex-direction: column; background: var(--grouped); border-right: 1px solid var(--hairline); min-height: 0; }
.content.narrow .master { width: 100%; max-height: min(42vh, 230px); border-right: 0; border-bottom: 1px solid var(--hairline); }
.master-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--hairline);
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--label-3); }
.master-list { position: relative; flex: 1; overflow-y: auto; padding: 6px; }
.list-pill { position: absolute; left: 6px; right: 6px; border-radius: 12px; background: var(--accent); box-shadow: 0 2px 8px rgba(109, 92, 255, .3); opacity: 0;
  transition: top .32s var(--spring), height .32s var(--spring), opacity .18s; }
.item { position: relative; z-index: 1; width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; border-radius: 12px; background: none;
  text-align: left; cursor: pointer; transition: transform .25s var(--ease), background .2s, color .25s; }
.item:hover { transform: translateX(2px); }
.item:not(.on):hover { background: var(--elevated); }
.item .bul { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--accent); opacity: .6; transition: background .25s, opacity .25s; }
.item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .t1 { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-size: 11px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .25s; }
.item.on { color: #fff; }
.item.on .bul { background: #fff; opacity: 1; }
.item.on .t2 { color: rgba(255, 255, 255, .75); }
.star { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--label-3); opacity: 0; transition: opacity .2s, transform .2s; font-size: 13px; line-height: 1; }
.item:hover .star, .star.fav { opacity: 1; }
.star.fav { color: #f5b301; }
.item.on .star { color: rgba(255, 255, 255, .8); }
.item.on .star.fav { color: #ffd84d; }
.star:active { transform: scale(.8); }
.fav-sep { height: 1px; margin: 6px 8px; background: var(--hairline); }

.inspector { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; background: var(--surface); }
.full { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; background: var(--surface); }
.section { padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.section:last-child { border-bottom: 0; }
.sec-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--label-3); margin-bottom: 8px; display: flex; justify-content: space-between; }
.preview { position: relative; height: 170px; border-radius: 12px; overflow: hidden; background: var(--grouped); border: 1px solid var(--hairline); display: flex; align-items: center; justify-content: center; }
.preview-replay { position: absolute; right: 8px; bottom: 8px; z-index: 3; border: 0; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 600; cursor: pointer;
  background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(6px); }

/* ---------- controls ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0; }
.row > label { font-size: 12px; color: var(--label-2); flex: none; }
.num { width: 58px; text-align: right; padding: 3px 6px; border-radius: 7px; border: 1px solid var(--hairline); background: var(--grouped); font-variant-numeric: tabular-nums; font-size: 12px; }
.num:focus, .txt-in:focus, .sel:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.range { width: 100%; -webkit-appearance: none; height: 4px; border-radius: 4px; margin: 2px 0 10px;
  background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--hairline) var(--p, 50%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: grab; transition: transform .15s; }
.range:active::-webkit-slider-thumb { transform: scale(1.15); cursor: grabbing; }
.sel, .txt-in { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--grouped); font-size: 12px; min-width: 0; }
.txt-in { width: 100%; }
.segctl { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--grouped); border: 1px solid var(--hairline); }
.segctl button { border: 0; background: none; padding: 3px 9px; border-radius: 6px; font-size: 11px; color: var(--label-2); cursor: pointer; }
.segctl button.on { background: var(--surface); color: var(--label); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.swatch { width: 26px; height: 22px; border-radius: 6px; border: 1px solid var(--hairline); padding: 0; cursor: pointer; overflow: hidden; }
.swatch input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.toggle { position: relative; width: 34px; height: 20px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 20px; background: var(--hairline); cursor: pointer; transition: background .2s; }
.toggle span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--spring); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(14px); }

.btn { position: relative; overflow: hidden; border: 0; border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(109, 92, 255, .3); transition: transform .2s var(--ease), background .2s, opacity .2s; }
.btn:hover { background: var(--accent-2); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--grouped); color: var(--label); border: 1px solid var(--hairline); box-shadow: none; }
.btn.ghost:hover { background: var(--elevated); }
.btn.small { padding: 5px 10px; font-size: 11px; border-radius: 8px; }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn .pulse { position: absolute; inset: 0; border-radius: inherit; background: rgba(255, 255, 255, .35); animation: sv-pulse .5s ease-out forwards; pointer-events: none; }
@keyframes sv-pulse { from { opacity: 1; transform: scale(.9); } to { opacity: 0; transform: scale(1.15); } }
.hint { font-size: 11px; color: var(--label-2); margin-top: 6px; line-height: 1.45; }
.empty { padding: 30px 16px; text-align: center; color: var(--label-2); font-size: 12px; }

/* ---------- status bar, banners, remove bar ---------- */
.statusbar { display: flex; justify-content: space-between; align-items: center; padding: 5px 12px; border-top: 1px solid var(--hairline); background: var(--grouped); font-size: 11px; color: var(--label-2); }
.sb-left { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); flex: none; }
.statusbar .dot.on { background: var(--ok); }
.sep { color: var(--label-3); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; font-size: 11px; font-weight: 500; animation: sv-in .25s var(--ease); }
.bar.remove { background: rgba(229, 72, 77, .1); border-bottom: 1px solid rgba(229, 72, 77, .25); color: var(--danger); }
.bar.update { background: var(--accent-soft); border-bottom: 1px solid var(--hairline); color: var(--accent); }
.bar button { border-radius: 999px; padding: 3px 11px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid currentColor; background: transparent; color: inherit; transition: all .2s; }
.bar.remove button:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
@keyframes sv-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 10px); opacity: 0; pointer-events: none; z-index: 50; max-width: calc(100% - 24px);
  padding: 8px 14px; border-radius: 10px; background: var(--label); color: var(--surface); font-size: 12px; font-weight: 500; box-shadow: var(--shadow-pop); transition: opacity .2s, transform .25s var(--spring); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- modal (settings) + license gate ---------- */
.modal-wrap, .lic-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .35); backdrop-filter: blur(4px); animation: sv-fade .2s; }
.modal-wrap[hidden], .lic-wrap[hidden] { display: none; }
@keyframes sv-fade { from { opacity: 0; } }
.modal { width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-pop); animation: sv-pop .3s var(--spring); }
@keyframes sv-pop { from { opacity: 0; transform: scale(.94); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--hairline); font-weight: 600; }
.modal-body { padding: 4px 16px 16px; }
.group { padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.group:last-child { border-bottom: 0; }
.kv { display: flex; justify-content: space-between; font-size: 12px; color: var(--label-2); margin: 3px 0; }
.kv b { color: var(--label); font-weight: 500; }
.lic-card { width: min(320px, calc(100% - 24px)); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-pop); padding: 22px 20px; text-align: center; animation: sv-pop .3s var(--spring); }
.lic-card h2 { margin: 10px 0 4px; font-size: 17px; }
.lic-card p { margin: 0 0 14px; font-size: 12px; color: var(--label-2); }
.lic-err { color: var(--danger); font-size: 11px; min-height: 16px; margin: 6px 0; white-space: pre-line; }

/* ---------- logo mark ---------- */
.mark { width: 15px; height: 15px; }
.lic-card .mark { width: 40px; height: 40px; color: var(--accent); }

/* ---------- grid cards (library, backgrounds gallery) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.search { flex: 1 1 150px; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; background: var(--grouped); border: 1px solid var(--hairline); }
.search svg { width: 14px; height: 14px; flex: none; color: var(--label-3); }
.search input { flex: 1; border: 0; background: none; outline: 0; font-size: 12px; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 12px 14px; }
.card { position: relative; border-radius: 12px; border: 1px solid var(--hairline); background: var(--grouped); overflow: hidden; cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s, border-color .2s; animation: sv-in .3s var(--ease) both; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .15); border-color: var(--accent); }
.card .thumb { aspect-ratio: 16 / 9; background: var(--elevated) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--label-3); font-size: 10px; letter-spacing: .08em; }
.card .cap { padding: 7px 9px; }
.card .c1 { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c2 { font-size: 10px; color: var(--label-2); }
.card .badge { position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 999px; font-size: 9px; font-weight: 600; background: rgba(0, 0, 0, .55); color: #fff; }
.card .del { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px;
  cursor: pointer; opacity: 0; transition: opacity .2s; }
.card:hover .del { opacity: 1; }
.card .del:hover { background: var(--danger); }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- progress ---------- */
.progress { height: 6px; border-radius: 6px; background: var(--grouped); overflow: hidden; border: 1px solid var(--hairline); }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .3s var(--ease); }
.log { font: 11px/1.4 "SF Mono", Menlo, Consolas, monospace; color: var(--label-2); background: var(--grouped); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 8px; max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin-top: 8px; }

/* ---------- text-animation preview spans ---------- */
.sb-right { white-space: nowrap; }
@media (max-width: 360px) { .sb-right { display: none; } }
.toolbar .btn { white-space: nowrap; }

/* ---------- expressions ---------- */
.ex-head { padding-top: 14px; }
.ex-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.ex-sig { display: inline-block; margin: 8px 0 6px; padding: 3px 8px; border-radius: 7px; border: 1px solid var(--hairline); background: var(--grouped); font: 11px/1.4 "SF Mono", Menlo, Consolas, monospace; color: var(--label-2); }
.ex-desc { font-size: 12px; color: var(--label-2); line-height: 1.5; }
.ex-stage { height: 190px; background-color: var(--grouped);
  background-image: linear-gradient(var(--hairline) 1px, transparent 1px), linear-gradient(90deg, var(--hairline) 1px, transparent 1px); background-size: 24px 24px; background-position: center; }
.ex-obj { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(160deg, var(--accent-2), var(--accent)); box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset, 0 8px 26px rgba(109,92,255,.55); will-change: transform, opacity; }
.ex-chip { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; background: rgba(0,0,0,.35); color: #fff; backdrop-filter: blur(6px); }
.ex-codewrap { position: relative; }
.ex-code { margin: 0; padding: 12px 14px; padding-right: 70px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--grouped); font: 12px/1.55 "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; user-select: text; }
.ex-copy { position: absolute; top: 8px; right: 8px; }
.sx-c { color: var(--label-3); } .sx-s { color: #e5484d; } .sx-k { color: #b14fd8; } .sx-n { color: #3b6ff5; } .sx-f { color: #1f8fc8; }
html.dark .sx-s { color: #ff7a6b; } html.dark .sx-k { color: #fc5fa3; } html.dark .sx-n { color: #d0a8fe; } html.dark .sx-f { color: #67d9fd; }

/* ---------- animated gradient backgrounds ---------- */
.bg-opts { padding-top: 8px; }
.bg-art { position: relative; overflow: hidden; }
.bg-blob { position: absolute; width: 90%; height: 110%; margin: -55% 0 0 -45%; border-radius: 50%; animation: sv-orbit linear infinite; will-change: transform; }
@keyframes sv-orbit {
  0% { transform: translate(var(--rx), 0); } 25% { transform: translate(0, var(--ry)); }
  50% { transform: translate(calc(var(--rx) * -1), 0); } 75% { transform: translate(0, calc(var(--ry) * -1)); } 100% { transform: translate(var(--rx), 0); }
}
.bg-dots { display: flex; gap: 3px; margin-top: 4px; }
.bg-dots span { width: 10px; height: 10px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); }
.bg-new { cursor: default; }
.bg-new .thumb { display: flex; align-items: center; justify-content: center; background: var(--grouped); }
.bg-pick { display: flex; gap: 6px; }

/* ---------- UI animations previews ---------- */
.mo-stage { overflow: hidden; }
.mo-card { position: absolute; border-radius: 9px; background: var(--surface); border: 1px solid var(--hairline); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.mo-card::before { content: ""; position: absolute; left: 12%; right: 30%; top: 18%; height: 12%; border-radius: 4px; background: var(--accent-soft); }
.mo-card::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: 18%; height: 22%; border-radius: 6px; background: var(--accent); opacity: .85; }
.mo-cursor { position: absolute; width: 0; height: 0; border-left: 9px solid transparent; border-right: 0; border-top: 0; z-index: 3;
  border-bottom: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.mo-cursor::before { content: ""; position: absolute; left: -2px; top: -2px; width: 0; height: 0; border-left: 7px solid #fff; border-top: 7px solid #fff; border-right: 7px solid transparent; border-bottom: 7px solid transparent; transform: skew(-8deg); }
.mo-cursor.dot::before { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 0 0 3px rgba(109,92,255,.5); }
.mo-dots { position: absolute; inset: 0; }
.mo-prompt { width: 78%; padding: 9px 12px; border-radius: 999px; border: 1.5px solid; background: var(--surface); font-size: 12px; color: var(--label); display: flex; align-items: center; gap: 2px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.mo-caret { width: 1.5px; height: 14px; animation: sv-blink 1s steps(1) infinite; }
@keyframes sv-blink { 50% { opacity: 0; } }
.mo-rain { position: absolute; inset: 8px; font: 11px/1.15 "SF Mono", Menlo, Consolas, monospace; word-break: break-all; opacity: .6; overflow: hidden; }
.mo-glyph-head { position: relative; font-size: 18px; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.6); }

/* ---------- captions ---------- */
.cap-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.cap-row { display: flex; align-items: center; gap: 6px; }
.cap-t { flex: none; width: 38px; font: 10px "SF Mono", Menlo, Consolas, monospace; color: var(--label-3); }
.cap-pv { height: 130px; background: linear-gradient(135deg, #2b2b3a, #14141c); }
.cap-line { position: absolute; left: 50%; transform: translate(-50%, -50%); font-weight: 800; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.cap-line span { transition: color .15s, transform .15s; }

/* ---------- glass previews ---------- */
.gl-stage { height: 190px; }
.gl-bg { position: absolute; inset: 0; background: #12121c; overflow: hidden; }
.gl-bg i { position: absolute; width: 55%; height: 75%; border-radius: 50%; filter: blur(2px); animation: sv-float 7s ease-in-out infinite alternate; }
.gl-b1 { left: -8%; top: -10%; background: radial-gradient(circle, #ff5ca8, transparent 70%); }
.gl-b2 { right: -10%; top: 5%; background: radial-gradient(circle, #6d5cff, transparent 70%); animation-delay: -2s !important; }
.gl-b3 { left: 25%; bottom: -30%; background: radial-gradient(circle, #00c2ff, transparent 70%); animation-delay: -4s !important; }
@keyframes sv-float { to { transform: translate(18%, 12%) scale(1.1); } }
.gl-card { position: relative; width: 58%; height: 52%; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(14px) brightness(1.1); -webkit-backdrop-filter: blur(14px) brightness(1.1); box-shadow: 0 14px 32px rgba(0,0,0,.35); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.gl-liquid { background: rgba(255,255,255,.06); backdrop-filter: blur(4px) saturate(1.8) contrast(1.1); -webkit-backdrop-filter: blur(4px) saturate(1.8) contrast(1.1);
  box-shadow: inset 0 2px 12px rgba(255,255,255,.45), inset 0 -6px 16px rgba(0,0,0,.25), 0 14px 32px rgba(0,0,0,.35); }
.gl-line { height: 8px; border-radius: 4px; background: rgba(255,255,255,.7); }
.gl-line.w60 { width: 60%; } .gl-line.w40 { width: 40%; opacity: .6; }
.gl-pill { margin-top: auto; width: 34%; height: 18px; border-radius: 999px; background: rgba(255,255,255,.85); }
.gl-word { position: relative; font-size: 46px; font-weight: 900; letter-spacing: .04em; color: rgba(255,255,255,.18); -webkit-text-stroke: 1px rgba(255,255,255,.6); text-shadow: 0 8px 24px rgba(0,0,0,.4); }
.gl-gone { opacity: .35; align-items: center; justify-content: center; color: #fff; font-size: 11px; border-style: dashed; }

/* ---------- templates ---------- */
.tp-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.tp-chip { border: 1px solid var(--hairline); background: var(--grouped); color: var(--label-2); border-radius: 999px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.tp-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-thumb { background: #0b0b0d !important; }
.tp-cv { width: 100%; height: 100%; display: block; }

/* Text Animation: category picker in the list header */
.master-grp { appearance: none; -webkit-appearance: none; max-width: 75%; border: 1px solid var(--hairline); border-radius: 8px; padding: 3px 22px 3px 8px; cursor: pointer;
  background: var(--grouped) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--label); font: 600 11px/1.3 inherit; letter-spacing: .02em; text-transform: none; }
.master-grp option { color: #111; background: #fff; }

/* 3D Carousel: Akira's builder, scaled up to Sowveil's type size */
.car3d-wrap { display: flex; flex-direction: column; min-height: 100%; padding: 12px 14px; }


/* Text Animation: Akira's canvas live preview */
.tx-stage { height: 190px; padding: 0; overflow: hidden; background: #0b0b0e; }
.tx-cv { display: block; width: 100%; height: 100%; }

/* SaaS Effects: live canvas preview */
.sx-stage { height: 180px; padding: 0; overflow: hidden; background: #0b0b0e; }
.sx-cv { display: block; width: 100%; height: 100%; }

/* Templates: live previews */
.tp-thumb { aspect-ratio: 16 / 9; height: auto; padding: 0; overflow: hidden; background: #000; }
.tp-thumb .tp-cv { display: block; width: 100%; height: 100%; }
.tp-title { font-size: 15px; font-weight: 700; margin-left: 6px; }
.tp-stage { position: relative; margin: 0 auto; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--hairline); }
.tp-big { display: block; width: 100%; height: 100%; }
.tp-scrub { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tp-scrub .range { flex: 1; }
.tp-clock { font: 11px/1 "SF Mono", Menlo, Consolas, monospace; color: var(--label-2); min-width: 86px; text-align: right; }
.toolbar .btn svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

/* ---------- Packs: rendered video previews ---------- */
.pk-thumb, .pk-stage { position: relative; overflow: hidden; background: #0b0b0d; }
.pk-thumb { aspect-ratio: 16 / 9; }
.pk-stage { aspect-ratio: 16 / 9; border-radius: 12px; border: 1px solid var(--hairline); cursor: pointer; }
/* the comp's frame: fitted whole, or (pk-zoom) scaled and offset so the content box fills the card */
.pk-frame { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: center / contain no-repeat; }
.pk-frame.pk-zoom { background-size: 100% 100%; }
.pk-frame .pk-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }
.pk-frame.pk-zoom .pk-vid { object-fit: fill; }
.pk-thumb .pk-vid { opacity: 0; transition: opacity .15s; }
.card:hover .pk-thumb .pk-vid { opacity: 1; }
.pk-blocks { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--label-2); white-space: nowrap; cursor: pointer; }
.pk-pt { display: flex; gap: 6px; }
.pk-pt .num { width: 64px; }
.pk-text { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.pk-locked label { color: var(--label-3); }
.pk-div { margin: 10px 0 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--label-2); }
.pk-filters { display: flex; flex-direction: column; gap: 8px; padding: 8px 14px; }
.pk-pick { max-width: 320px; }
/* pack template inspector: rendered video + the edited version as frames */
.pk-stage { cursor: default; }
.pk-frame .pk-flip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.pk-frame.pk-zoom .pk-flip { object-fit: fill; }
.pk-badge { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; background: var(--accent); color: #fff; }
.pk-badge:empty { display: none; }
.pk-modes { margin-top: 8px; }
.pk-modes .row { justify-content: flex-start; }

/* tab strip on two lines: the pills wrap instead of scrolling sideways */
.tabs-scroll { overflow: visible; cursor: default; padding: 6px 0; }
.seg { display: flex; flex-wrap: wrap; row-gap: 2px; border-radius: 16px; }
.seg-pill { top: 0; bottom: auto; transition: left .32s var(--spring), top .32s var(--spring), width .32s var(--spring), height .32s var(--spring), opacity .18s; }
/* group picker: full width, sectioned */

/* ---------- studio look: deep indigo panel, centred wordmark, icon tabs, chips, template tiles, lime accents ---------- */
:root { --lime: #7fae00; --lime-ink: #fff; --grad: linear-gradient(135deg, #7b66ff, #5b45f0); --glow: rgba(106, 85, 255, .4);
  --tint: rgba(108, 87, 255, .35); --tint-line: rgba(150, 135, 255, .42); --tile-on: linear-gradient(160deg, rgba(123, 102, 255, .55), rgba(91, 69, 240, .3));
  --wm: linear-gradient(90deg, #8b7dff, #5b45f0); --deep: #07061a; --bg-glow: rgba(108, 87, 255, .16); --bg-1: #f6f4ff; --bg-2: #ece9ff; }
html.dark {
  --surface: #0f0c24;
  --grouped: #17133a;
  --elevated: #211b4c;
  --label: #efecff;
  --label-2: #a8a2d6;
  --label-3: #6e68a3;
  --accent: #6c57ff;
  --accent-2: #8f7dff;
  --accent-soft: rgba(108, 87, 255, .22);
  --hairline: rgba(150, 135, 255, .16);
  --lime: #d4ff3a; --lime-ink: #16123a;
}
html.dark { --wm: linear-gradient(90deg, #c3b8ff, #7b66ff); --bg-glow: rgba(108, 87, 255, .38); --bg-1: #130f2e; --bg-2: #0b091d; }
body { background: radial-gradient(120% 60% at 50% -10%, var(--bg-glow), transparent 60%), linear-gradient(180deg, var(--bg-1), var(--bg-2)); }
html.dark ::-webkit-scrollbar-thumb { background: var(--hairline); }

/* header: settings button, wordmark, theme button; then one row of icon tabs */
.topbar { flex-direction: column; align-items: stretch; gap: 8px; min-height: 0; padding: 10px 12px 8px; background: transparent; border-bottom: 1px solid var(--hairline); }
.hdr { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; }
.wordmark { justify-self: center; display: flex; align-items: center; gap: 7px; font-weight: 800; letter-spacing: .14em; line-height: 1; }
.wm-name { font-size: 15px; background: var(--wm); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wm-tag { font-size: 8.5px; letter-spacing: .1em; color: var(--lime); border: 1px solid var(--lime); border-radius: 4px; padding: 2px 4px 1px; }
.round-btn { background: rgba(255, 255, 255, .06); border-color: var(--hairline); }
.tabs-scroll { overflow-x: auto; overflow-y: hidden; padding: 0; }
.seg { display: flex; flex-wrap: nowrap; gap: 2px; width: max-content; min-width: 100%; justify-content: space-between; padding: 4px; border-radius: 14px; background: var(--grouped); border: 1px solid var(--hairline); }
.seg-pill { display: none; }
.seg-btn { display: flex; align-items: center; gap: 0; height: 32px; padding: 0 9px; border-radius: 10px; color: var(--label-2);
  transition: background .25s, color .2s, padding .3s var(--ease), box-shadow .25s; }
.seg-btn .ic { display: flex; }
.seg-btn .ic svg { width: 16px; height: 16px; }
.seg-btn .lbl { max-width: 0; overflow: hidden; opacity: 0; white-space: nowrap; font-size: 12px; font-weight: 600; transition: max-width .35s var(--ease), opacity .2s, margin .3s; }
.seg-btn:hover:not(.on) { background: rgba(255, 255, 255, .06); color: var(--label); }
.seg-btn.on { background: var(--grad); color: #fff; padding: 0 13px; box-shadow: 0 4px 14px var(--glow); }
.seg-btn.on .lbl { max-width: 160px; opacity: 1; margin-left: 7px; }

/* left: category chips + template tiles */
.master { width: clamp(230px, 44%, 440px); background: rgba(0, 0, 0, .14); border-right: 1px solid var(--hairline); }
.content.narrow .master { max-height: 46vh; }
.master-head.has-chips { display: block; padding: 10px; text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 118px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 4px 6px 4px 9px; border-radius: 8px; border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .04); color: var(--label-2); font-size: 11px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.chip:hover { color: var(--label); border-color: var(--tint-line); }
.chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.chip-n { flex: none; font-size: 9.5px; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); color: var(--label-3); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 3px 10px var(--glow); }
.chip.on .chip-n { background: rgba(255, 255, 255, .22); color: #fff; }
.master-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; padding: 10px; align-content: start; }
.list-pill { display: none; }
.fav-sep { grid-column: 1 / -1; margin: 0 2px; }
.tile { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 6px; border-radius: 12px; border: 1px solid var(--hairline);
  background: var(--grouped); color: var(--label); text-align: left; cursor: pointer; transition: transform .22s var(--ease), border-color .2s, background .2s, box-shadow .2s; }
.tile:hover { transform: translateY(-2px); border-color: var(--tint-line); }
.tile-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--deep) center / cover no-repeat; }
.tile-thumb.no-img { display: flex; align-items: center; justify-content: center; color: var(--accent-2);
  background: radial-gradient(circle at 50% 40%, var(--tint), transparent 70%), var(--deep); }
.tile-thumb.no-img svg { width: 22px; height: 22px; }
.tile-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-name { margin-top: 6px; padding: 0 2px; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .star { position: absolute; top: 9px; left: 9px; z-index: 2; color: rgba(255, 255, 255, .75); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.tile:hover .star, .tile .star.fav { opacity: 1; }
.tile .star.fav { color: var(--lime); }
.tile.on { background: var(--tile-on); border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2), 0 6px 18px var(--glow); }
html:not(.dark) .tile-thumb.no-img { background: radial-gradient(circle at 50% 40%, var(--tint), transparent 70%), #ece9ff; }
html:not(.dark) .tile.on { color: #fff; }

/* right: the inspector as a stack of cards */
.inspector, .full { background: transparent; }
.section { margin: 10px 12px 0; padding: 12px; border: 1px solid var(--hairline); border-radius: 14px; background: var(--grouped); }
.section:last-child { margin-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.ex-head { background: transparent; border-color: transparent; padding: 8px 2px 0; }
.ex-title { font-size: 20px; }
.range { background: linear-gradient(90deg, var(--accent-2) var(--p, 50%), var(--hairline) var(--p, 50%)); }
.range::-webkit-slider-thumb { background: var(--lime); border: 0; box-shadow: 0 0 0 3px rgba(212, 255, 58, .18), 0 1px 4px rgba(0, 0, 0, .4); }
.toggle input:checked + span { background: var(--lime); }
.toggle input:checked + span::after { background: var(--lime-ink); }
.segctl { padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .05); border-color: var(--hairline); }
.segctl button { padding: 4px 11px; border-radius: 8px; font-weight: 600; }
.segctl button.on { background: var(--grad); color: #fff; box-shadow: 0 3px 10px var(--glow); }
.btn { border-radius: 12px; background: var(--grad); box-shadow: 0 4px 14px var(--glow); }
.btn.ghost { background: rgba(255, 255, 255, .05); box-shadow: none; }
.num, .sel, .txt-in { background: rgba(0, 0, 0, .25); border-color: var(--hairline); }
html:not(.dark) .num, html:not(.dark) .sel, html:not(.dark) .txt-in { background: #fff; }
.pk-stage { border-radius: 14px; border-color: var(--hairline); background: var(--deep); }
.statusbar { background: rgba(0, 0, 0, .18); border-top-color: var(--hairline); }
.tile-thumb.no-img { aspect-ratio: 16 / 7; }
.content.narrow .master { max-height: 44vh; border-bottom: 1px solid var(--hairline); }
.content.narrow .master-list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.content.narrow .chips { max-height: 64px; }

/* ---------- colour themes (html[data-theme]); Violet is the default dark look above, Light is html:not(.dark) ---------- */
html[data-theme="midnight"] { --surface: #0a1022; --grouped: #111a35; --elevated: #18244a; --label-2: #9fb0d8; --label-3: #63719a;
  --accent: #3b82f6; --accent-2: #60a5fa; --accent-soft: rgba(59, 130, 246, .22); --hairline: rgba(120, 160, 255, .16);
  --grad: linear-gradient(135deg, #4f8dff, #2f5fe0); --glow: rgba(59, 130, 246, .4); --tint: rgba(59, 130, 246, .35); --tint-line: rgba(120, 170, 255, .45);
  --tile-on: linear-gradient(160deg, rgba(79, 141, 255, .55), rgba(47, 95, 224, .3)); --wm: linear-gradient(90deg, #bcd4ff, #4f8dff);
  --deep: #050a18; --bg-glow: rgba(59, 130, 246, .34); --bg-1: #0d1630; --bg-2: #070c1c; --lime: #5eead4; }
html[data-theme="emerald"] { --surface: #08140f; --grouped: #0f2119; --elevated: #163126; --label-2: #98c8b3; --label-3: #5e8a77;
  --accent: #10b981; --accent-2: #34d399; --accent-soft: rgba(16, 185, 129, .2); --hairline: rgba(80, 220, 160, .15);
  --grad: linear-gradient(135deg, #22c58b, #0e9f6e); --glow: rgba(16, 185, 129, .38); --tint: rgba(16, 185, 129, .32); --tint-line: rgba(80, 220, 160, .45);
  --tile-on: linear-gradient(160deg, rgba(34, 197, 139, .5), rgba(14, 159, 110, .28)); --wm: linear-gradient(90deg, #b8f5dc, #22c58b);
  --deep: #04100b; --bg-glow: rgba(16, 185, 129, .3); --bg-1: #0b1d15; --bg-2: #050e0a; --lime: #e6ff4d; }
html[data-theme="sunset"] { --surface: #170d0a; --grouped: #24140f; --elevated: #321c14; --label-2: #d6ab98; --label-3: #8f6a5a;
  --accent: #f97316; --accent-2: #fb923c; --accent-soft: rgba(249, 115, 22, .2); --hairline: rgba(255, 160, 100, .16);
  --grad: linear-gradient(135deg, #ff8a3d, #e8590c); --glow: rgba(249, 115, 22, .4); --tint: rgba(249, 115, 22, .32); --tint-line: rgba(255, 170, 110, .45);
  --tile-on: linear-gradient(160deg, rgba(255, 138, 61, .5), rgba(232, 89, 12, .28)); --wm: linear-gradient(90deg, #ffd3b0, #ff8a3d);
  --deep: #100806; --bg-glow: rgba(249, 115, 22, .32); --bg-1: #22120c; --bg-2: #0e0705; --lime: #ffd43b; }
html[data-theme="rose"] { --surface: #170a12; --grouped: #26111d; --elevated: #351829; --label-2: #d5a3bf; --label-3: #8f637d;
  --accent: #ec4899; --accent-2: #f472b6; --accent-soft: rgba(236, 72, 153, .2); --hairline: rgba(255, 130, 190, .16);
  --grad: linear-gradient(135deg, #f05aa8, #d0287c); --glow: rgba(236, 72, 153, .4); --tint: rgba(236, 72, 153, .32); --tint-line: rgba(255, 140, 200, .45);
  --tile-on: linear-gradient(160deg, rgba(240, 90, 168, .5), rgba(208, 40, 124, .28)); --wm: linear-gradient(90deg, #ffc6e3, #f05aa8);
  --deep: #10060c; --bg-glow: rgba(236, 72, 153, .32); --bg-1: #220e1a; --bg-2: #0e050a; --lime: #a5f3fc; }
html[data-theme="graphite"] { --surface: #111113; --grouped: #1a1a1d; --elevated: #232327; --label-2: #b4b4bb; --label-3: #6f6f78;
  --accent: #71717a; --accent-2: #d4d4d8; --accent-soft: rgba(255, 255, 255, .1); --hairline: rgba(255, 255, 255, .1);
  --grad: linear-gradient(135deg, #5b5b63, #3a3a40); --glow: rgba(0, 0, 0, .45); --tint: rgba(255, 255, 255, .12); --tint-line: rgba(255, 255, 255, .3);
  --tile-on: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); --wm: linear-gradient(90deg, #ffffff, #9a9aa3);
  --deep: #09090b; --bg-glow: rgba(255, 255, 255, .07); --bg-1: #151517; --bg-2: #0b0b0d; --lime: #f4f4f5; --lime-ink: #111113; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.theme-sw { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--grouped); cursor: pointer; font-size: 11px; font-weight: 600; color: var(--label); text-align: left; }
.theme-sw i { display: block; height: 30px; border-radius: 8px; }
.theme-sw.on { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }


/* license activation screen */
.lic-gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(120% 60% at 50% -10%, var(--bg-glow), transparent 60%), linear-gradient(180deg, var(--bg-1), var(--bg-2)); }
.lic-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 22px 18px; border-radius: 18px; border: 1px solid var(--hairline);
  background: var(--grouped); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.lic-wm { justify-content: center; margin-bottom: 4px; }
.lic-title { text-align: center; font-size: 14px; font-weight: 600; color: var(--label); }
.lic-in { font: 600 12px/1.4 ui-monospace, Consolas, monospace; padding: 9px 10px; text-align: center; user-select: text; }
.lic-err { min-height: 15px; font-size: 11.5px; color: var(--danger); text-align: center; }
.lic-test { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--label-3); cursor: pointer; }
.lic-lang { align-self: center; margin-top: 2px; }
.fav-empty { grid-column: 1 / -1; padding: 18px 8px; text-align: center; font-size: 12px; color: var(--label-3); }
.chip-star { color: var(--lime); font-size: 11px; }

/* compact header: a thin title row, then the tabs on two lines */
.topbar { gap: 5px; padding: 5px 10px 7px; }
.hdr { grid-template-columns: 22px 1fr 22px; }
.hdr .round-btn { width: 22px; height: 22px; }
.hdr .round-btn svg { width: 12px; height: 12px; }
.wordmark { gap: 5px; letter-spacing: .18em; }
.wm-name { font-size: 10px; }
.wm-tag { font-size: 6.5px; padding: 1px 3px 0; border-radius: 3px; }
.tabs-scroll { overflow: visible; }
.seg { flex-wrap: wrap; width: auto; min-width: 0; justify-content: flex-start; gap: 3px; padding: 4px; }
.seg-btn { height: 28px; padding: 0 8px; border-radius: 9px; }
.seg-btn .ic svg { width: 15px; height: 15px; }
.seg-btn.on { padding: 0 11px; }

/* easing: curve editor, moving dot */
.tile-thumb.fit { background-size: contain; background-color: var(--deep); }
.ez-box { border-radius: 12px; background: var(--deep); border: 1px solid var(--hairline); }
.ez-svg { display: block; width: 100%; max-width: 360px; margin: 0 auto; touch-action: none; }
.ez-grid line { stroke: var(--hairline); stroke-width: 1; }
.ez-fill { fill: var(--tint); opacity: .55; }
.ez-curve { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.ez-arm { stroke: var(--label-3); stroke-width: 1.5; }
.ez-end { fill: var(--label-2); }
.ez-h { fill: var(--lime); stroke: rgba(0, 0, 0, .35); stroke-width: 2; cursor: grab; }
.ez-h:active { cursor: grabbing; }
.ez-track { position: relative; height: 14px; margin: 12px 7px 4px; border-radius: 7px; background: rgba(255, 255, 255, .05); }
.ez-dot { position: absolute; top: 1px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px var(--glow); }
.ez-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--label-2); }
.ez-code { font-size: 11px; color: var(--label); }
.ez-nums span { margin-left: 10px; } .ez-nums b { color: var(--label); }

/* sfx: waveform with play button */
.sfx-wave { position: relative; height: 96px; border-radius: 12px; border: 1px solid var(--hairline); background: var(--deep) center / 92% 80% no-repeat; margin-bottom: 8px; }
.sfx-play { position: absolute; left: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px var(--glow); }
.sfx-play svg { width: 14px; height: 14px; fill: currentColor; }
.sfx-play.on { background: var(--lime); color: var(--lime-ink); }
.sfx-path { word-break: break-all; margin-bottom: 6px; }
.tile-thumb.fit[style*="SFX"] { background-size: 92% 78%; }


/* ---------- fixes 2026-10-23 ---------- */
.ins-fav { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hairline); background: var(--grouped); color: var(--label-2);
  border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; transition: border-color .2s, color .2s; }
.ins-fav:hover { border-color: var(--accent); color: var(--label); }
.ins-fav.on { color: var(--label); border-color: var(--accent); background: var(--accent-soft); }
.ins-fav .ins-fav-star { font-size: 13px; line-height: 1; }
.ins-fav.on .ins-fav-star { color: var(--lime, #d4ff3a); }
.ex-head.has-fav { position: relative; }
.ex-head.has-fav .ins-fav { position: absolute; top: 12px; right: 12px; }
.ex-head.has-fav .ex-title { padding-right: 140px; }
.ins-favbar { display: flex; justify-content: flex-end; padding-bottom: 0; }
.section.ins-favbar { background: none; border: 0; box-shadow: none; padding: 8px 12px 0; margin: 0; }

/* tabs: two fixed rows; the open tab shows its name again and only nudges its own row */
.seg { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 3px; }
.seg-row { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg-row::-webkit-scrollbar { display: none; }
.seg-btn { flex: none; }
.seg-btn.on { padding: 0 12px; }
.seg-btn.on .lbl { max-width: 160px; opacity: 1; margin-left: 7px; }
/* tiles: favourites get a small badge; starring is done from the inspector */
.tile .fav-badge { position: absolute; top: 10px; right: 10px; z-index: 2; font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 6px;
  background: rgba(0, 0, 0, .55); color: var(--lime, #d4ff3a); pointer-events: none; }

/* SaaS Kit tab: Figma bridge status and steps */
.kit-fig { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--label-2); }
.mk-fig-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); flex: none; }
.mk-fig-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.kit-steps { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.55; color: var(--label-2); }
.kit-steps li + li { margin-top: 6px; }

/* SaaS Effects: rendered previews */
.fx-stage { height: auto; aspect-ratio: 16 / 9; padding: 0; background: var(--deep, #07061a); }
.fx-vid { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Paste Image tab */
.pz-stage { position: relative; height: 230px; border-radius: 12px; border: 1.5px dashed var(--hairline); display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: repeating-conic-gradient(rgba(127,127,127,.12) 0 25%, transparent 0 50%) 0 0 / 18px 18px; transition: border-color .2s, background-color .2s; }
.pz-stage.drag { border-color: var(--accent); background-color: var(--accent-soft); }
.pz-stage .pz-img { display: none; max-width: 100%; max-height: 100%; object-fit: contain; }
.pz-stage.has .pz-img { display: block; }
.pz-stage.has .pz-empty { display: none; }
.pz-empty { text-align: center; color: var(--label-2); font-size: 13px; }
.pz-empty .pz-ic svg { width: 34px; height: 34px; opacity: .55; margin-bottom: 6px; }
.pz-sub { font-size: 11px; color: var(--label-3); margin-top: 4px; }
.pz-meta { font: 11px/1.4 ui-monospace, Consolas, monospace; color: var(--label-3); margin-top: 6px; min-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pz-bad { color: var(--danger) !important; }
.pz-hist { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.pz-thumb { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--hairline); cursor: pointer; padding: 0;
  background: center / cover no-repeat, repeating-conic-gradient(rgba(127,127,127,.15) 0 25%, transparent 0 50%) 0 0 / 10px 10px; }
.pz-thumb.on, .pz-thumb:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---------- 2.7.0: sections + one row of tabs, arrange panels, resizable list ---------- */
.hdr { grid-template-columns: 50px 1fr 50px; }
.hdr-r { justify-self: end; display: flex; gap: 4px; }
.seg.sections { flex-direction: row; flex-wrap: nowrap; justify-content: space-between; gap: 3px; width: auto; min-width: 0; }
.seg.sections .seg-btn { flex: 1 1 0; justify-content: center; min-width: 0; padding: 0 6px; }
.seg.sections .seg-btn .lbl { max-width: 120px; opacity: 1; margin-left: 6px; overflow: hidden; text-overflow: ellipsis; }
.seg.sections .seg-btn.on { padding: 0 6px; }
@media (max-width: 430px) { .seg.sections .seg-btn .lbl { display: none; } .seg.sections .seg-btn.on .lbl { display: inline; } }
html.layout-sidebar .tabs-scroll { display: none; }
.subtabs { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 1px 0 2px; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.sub-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .04); color: var(--label-2); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.sub-btn .ic { display: flex; } .sub-btn .ic svg, .sub-btn svg { width: 13px; height: 13px; }
.sub-btn:hover { color: var(--label); border-color: var(--tint-line, var(--accent)); }
.sub-btn.on { background: var(--grad, var(--accent)); color: #fff; border-color: transparent; box-shadow: 0 3px 10px var(--glow, transparent); }
.sub-arrange { margin-left: auto; padding: 0 8px; color: var(--label-3); }
html:not(.dark) .sub-btn { background: #fff; }
.master-list { grid-template-columns: repeat(auto-fill, minmax(var(--tile-min, 108px), 1fr)); }
.content.narrow .master-list { grid-template-columns: repeat(auto-fill, minmax(calc(var(--tile-min, 108px) * .9), 1fr)); }
.splitter { flex: none; width: 6px; margin: 0 -3px; z-index: 5; cursor: col-resize; position: relative; }
.splitter::after { content: ''; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px; border-radius: 2px; background: transparent; transition: background .2s; }
.splitter:hover::after, .splitter.on::after { background: var(--accent); }
.content.narrow .splitter { display: none; }
.arr-modal { width: min(560px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.arr-body { overflow-y: auto; }
.arr-sec { border: 1px solid var(--hairline); border-radius: 12px; padding: 8px; margin: 8px 0; background: rgba(255, 255, 255, .02); }
.arr-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.arr-head .ic svg { width: 15px; height: 15px; }
.arr-name { flex: 1; min-width: 0; height: 28px; font-weight: 700; }
.arr-mv { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--hairline); background: none; color: var(--label-2); cursor: pointer; }
.arr-mv:hover { color: var(--label); border-color: var(--accent); }
.arr-list { display: flex; flex-wrap: wrap; gap: 5px; min-height: 34px; padding: 3px; border-radius: 9px; border: 1px dashed transparent; transition: border-color .15s, background .15s; }
.arr-list.drop { border-color: var(--accent); background: var(--accent-soft); }
.arr-tab { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-radius: 8px; border: 1px solid var(--hairline); background: var(--grouped); font-size: 11.5px; font-weight: 600; cursor: grab; user-select: none; }
.arr-tab .ic svg { width: 13px; height: 13px; }
.arr-tab.off { opacity: .45; }
.arr-tab.over { border-color: var(--accent); box-shadow: -3px 0 0 var(--accent); }
.arr-tab.dragging { opacity: .3; }
.arr-grip { color: var(--label-3); font-size: 10px; letter-spacing: -2px; }
.arr-eye { border: 0; background: none; color: var(--accent-2, var(--accent)); cursor: pointer; font-size: 11px; padding: 0 2px; }
.arr-eye.off { color: var(--label-3); }
.arr-empty { font-size: 11px; color: var(--label-3); padding: 6px; }

/* narrow panels: the sections keep their names (icon over a small label) */
@media (max-width: 560px) {
  .seg.sections .seg-btn { flex-direction: column; justify-content: center; height: auto; min-height: 40px; padding: 4px 2px; gap: 2px; }
  .seg.sections .seg-btn .lbl, .seg.sections .seg-btn.on .lbl { display: block; max-width: 100%; margin: 0; font-size: 10px; opacity: 1; }
  .seg.sections .seg-btn.on { padding: 4px 2px; }
  .sub-btn { height: 24px; padding: 0 8px; font-size: 11px; }
}
/* side by side down to small panels: names on the left, preview and settings on the right */
@media (max-width: 640px) { .master { width: 40%; min-width: 128px; } .master-list { grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-min, 108px), 100%), 1fr)); padding: 6px; gap: 6px; } .master-head.has-chips { padding: 6px; } }

/* 2.7.2: the tab row stays one line; arrows (and the wheel) scroll it, tabs can be dragged */
.subtabs-wrap { position: relative; min-width: 0; }
.subtabs-wrap .subtabs { flex-wrap: nowrap; overflow-x: auto; scroll-behavior: auto; }
.sub-arr { position: absolute; top: 0; bottom: 2px; width: 30px; display: none; align-items: center; border: 0; padding: 0; cursor: pointer; z-index: 2; color: var(--label); }
.sub-arr svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sub-arr-l { left: 0; justify-content: flex-start; padding-left: 2px; background: linear-gradient(90deg, var(--bg, #0d0b1f) 55%, transparent); }
.sub-arr-r { right: 0; justify-content: flex-end; padding-right: 2px; background: linear-gradient(270deg, var(--bg, #0d0b1f) 55%, transparent); }
.subtabs-wrap.more-l .sub-arr-l, .subtabs-wrap.more-r .sub-arr-r { display: flex; }
.sub-arr:hover { color: var(--accent-2, var(--accent)); }
.sub-btn.dragging { opacity: .35; }
.sub-btn.over-l { box-shadow: -3px 0 0 var(--accent); }
.sub-btn.over-r { box-shadow: 3px 0 0 var(--accent); }
.tab-dragging .seg-btn:not(.on), .tab-dragging .rail-btn:not(.on) { outline: 1px dashed var(--accent); outline-offset: -2px; }
.seg-btn.drop, .rail-btn.drop { background: var(--accent-soft) !important; outline: 2px solid var(--accent) !important; }
@media (max-width: 560px) { .seg.sections .seg-btn .lbl, .seg.sections .seg-btn.on .lbl { white-space: normal; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } }
/* 2.7.3: AE's Chromium 99 shrinks the picture box inside a column tile to 0 wide; keep it full width */
.tile-thumb { width: 100%; align-self: stretch; flex: none; }

