@font-face { font-family: 'Hind Siliguri'; font-weight: 400; font-display: swap;
  src: local('Hind Siliguri'), local('HindSiliguri-Regular'), url('../fonts/HindSiliguri-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Hind Siliguri'; font-weight: 600 700; font-display: swap;
  src: local('Hind Siliguri SemiBold'), local('HindSiliguri-SemiBold'), url('../fonts/HindSiliguri-SemiBold.ttf') format('truetype'); }

:root {
  --font: 'Hind Siliguri', 'Noto Sans Bengali', 'Lohit Bengali', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 10px; --r-s: 8px; --r-xs: 6px;
  --nav-w: 224px; --top-h: 54px;
  --accent: #0f7a58; --accent-ink: #fff; --accent-2: #2b8fb3;
  --ok: #3fb37f; --warn: #d99a2b; --err: #e5484d;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 10px 32px -8px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.2);
}
[data-theme="dark"] {
  --bg: #141414; --bg-2: #101011; --panel: #1b1b1c; --panel-2: #212122; --line: #2b2b2d; --line-2: #3a3a3d;
  --text: #ececea; --muted: #a6a6a2; --faint: #85858a; --hover: #252527;
  --accent-text: #5cc9a0; --accent-soft: rgba(47,163,123,.15); --accent-line: rgba(92,201,160,.45);
  --input: #111112; --mask-bg: #0a0a0a;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f5f3; --bg-2: #ecece9; --panel: #ffffff; --panel-2: #f8f8f6; --line: #e3e3df; --line-2: #d2d2cd;
  --text: #1a1a19; --muted: #585854; --faint: #6f6f6a; --hover: #ededea;
  --accent-text: #0b6a4c; --accent-soft: rgba(15,122,88,.10); --accent-line: rgba(15,122,88,.4);
  --input: #fff; --mask-bg: #d8d8d5; --shadow: 0 12px 32px -10px rgba(20,20,15,.18), 0 2px 6px rgba(20,20,15,.06);
  color-scheme: light;
}
::selection { background: var(--accent); color: #fff; }
html { accent-color: var(--accent); caret-color: var(--accent-text); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-underline-offset: 3px; }
h1 { font-size: 1.4rem; margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 1.05rem; margin: 18px 0 10px; }
h3 { margin: 0 0 8px; font-size: 1.1rem; }
h1, h2, h3, h4 { text-wrap: balance; }
select { background-color: var(--input); color: var(--text); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; margin: 16px 0; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; gap: 10px; color: var(--muted); }

/* icons */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ico svg { width: 100%; height: 100%; }
.ico.big { width: 30px; height: 30px; } .ico.huge { width: 54px; height: 54px; opacity: .35; }

/* ---------- shell */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg-2); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand b { display: block; font-size: 1.05rem; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 1.15rem;
  background: var(--accent); flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.top-mem { flex: 1; display: flex; justify-content: center; min-width: 0; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.body { flex: 1; display: flex; min-height: 0; }
.main { flex: 1; overflow: auto; padding: 22px 26px 60px; min-width: 0; }
.offline { background: var(--warn); color: #1a1300; text-align: center; padding: 6px; font-size: .9rem; }

.nav { width: var(--nav-w); flex: none; border-right: 1px solid var(--line); overflow: auto; padding: 12px 10px; background: var(--bg-2); }
.nav-group + .nav-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-title { font-size: .78rem; color: var(--faint); padding: 0 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--r-s); color: var(--muted);
  text-decoration: none; position: relative; transition: background .15s var(--ease), color .15s var(--ease); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-item.on .ico { color: var(--accent-text); }
.nav-item .ico { width: 20px; height: 20px; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 7px; min-width: 20px; text-align: center; }

/* ---------- generic UI */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-s);
  border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; text-decoration: none; color: var(--text);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease); white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: .86rem; border-radius: var(--r-xs); }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.btn.primary:hover { background: #128a64; }
.btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.btn.accent { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.btn.danger { color: var(--err); }
.btn.big { padding: 13px 26px; font-size: 1.08rem; border-radius: 12px; }
.btn.on { background: var(--accent); color: #fff; border-color: transparent; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.kv .link { margin-left: 8px; }
.link { background: none; border: none; color: var(--accent-text); cursor: pointer; padding: 0; font: inherit; }
.badge { display: inline-block; font-size: .74rem; padding: 1px 8px; border-radius: 99px; background: var(--hover); color: var(--muted); font-weight: 500; vertical-align: 1px; }
.badge.req { background: var(--accent-soft); color: var(--accent-text); }
.badge.warn { background: rgba(240,164,43,.16); color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input[type=text], input[type=number], select, textarea {
  background: var(--input); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: 7px 10px; outline: none; min-width: 0; }
input[type=number] { width: 110px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { width: 100%; resize: vertical; }
input[type=range] { accent-color: var(--accent); flex: 1; min-width: 90px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--input); cursor: pointer; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.kbd { font-size: .74rem; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; }

.seg { display: inline-flex; background: var(--input); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--muted); display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.seg button small { font-size: .72rem; opacity: .8; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch > span:first-of-type { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch > span:first-of-type::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch.small > span:first-of-type { width: 30px; height: 18px; }
.switch.small > span:first-of-type::after { width: 12px; height: 12px; }
.switch.small input:checked + span::after { transform: translateX(12px); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: .88rem; }
.chip:hover { border-color: var(--accent-line); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); }
.chip small { color: var(--muted); }
.stars { display: inline-flex; gap: 1px; margin-left: 6px; vertical-align: -2px; }
.stars .st { width: 12px; height: 12px; color: var(--line-2); display: inline-flex; }
.stars .st.on { color: #f5b82e; }
.stars svg { width: 100%; height: 100%; }

/* ---------- task page */
.task-head, .page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .seg { margin-left: auto; }
.task-head p { margin: 2px 0 0; }
.task-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.task-icon .ico { width: 26px; height: 26px; }
.task-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 20px; align-items: start; }
.task-form { display: flex; flex-direction: column; gap: 18px; }
.task-results { position: sticky; top: 0; max-height: calc(100vh - var(--top-h) - 44px); overflow: auto; }
.task-results h2 { margin-top: 0; }
.big-label { font-weight: 600; font-size: 1.02rem; display: block; margin-bottom: 8px; }
.prompt-wrap { position: relative; }
textarea.prompt { font-size: 1.06rem; padding: 14px 14px 52px; min-height: 120px; border-radius: 12px; line-height: 1.6; }
.prompt-actions { position: absolute; right: 10px; bottom: 12px; display: flex; gap: 6px; }
.suggest-btn { background: var(--accent-soft); border-color: transparent; font-weight: 600; }
.suggest-btn .ico { color: var(--accent-text); }
.suggest-btn.loading .ico { animation: spin 1s linear infinite; }
.suggest-box { display: flex; flex-direction: column; gap: 10px; }
.sug-reason, .sug-bangla { display: flex; gap: 10px; background: var(--accent-soft); border-radius: var(--r-s); padding: 10px 12px; }
.sug-reason .ico, .sug-bangla .ico { color: var(--accent-text); margin-top: 3px; }
.sug-bangla { background: rgba(43,143,179,.12); }
.sug-bangla .ico { color: var(--accent-2); }
.bn-text { font-family: 'Noto Sans Bengali', var(--font); }
.enh-wrap { border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 8px 10px; }
.enh-wrap.off textarea { opacity: .45; }
.enh-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
textarea.enh { font-size: .9rem; background: transparent; border-color: transparent; padding: 0; }

.media-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.drop-label { margin-bottom: 6px; font-size: .92rem; }
.drop { position: relative; border: 2px dashed var(--line-2); border-radius: var(--r); min-height: 150px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.drop.big { min-height: 300px; }
.drop.filled { border-style: solid; cursor: default; padding: 8px; background: var(--panel-2); }
.drop-preview { position: relative; width: 100%; display: flex; justify-content: center; background: var(--mask-bg); border-radius: var(--r-s); overflow: hidden; }
.drop-preview img, .drop-preview video { max-width: 100%; max-height: 300px; display: block; object-fit: contain; }
.drop-preview .mask-overlay { position: absolute; inset: 0; margin: auto; opacity: .5; pointer-events: none; max-height: 300px; }
.drop-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.drop .dim { font-size: .78rem; }
.drop-busy { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--panel) 80%, transparent); border-radius: var(--r); gap: 8px; }
.file-chip { padding: 20px; display: flex; gap: 8px; align-items: center; }

.controls { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.ctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctl-label { font-size: .86rem; color: var(--muted); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.ctl.changed .ctl-label { color: var(--accent-text); }
.ctl.changed .ctl-label::after { content: '•'; }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--hover); font-size: .7rem; cursor: help; }
.aspects { display: flex; gap: 6px; flex-wrap: wrap; }
.asp { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 52px; height: 58px; padding: 6px 6px 4px;
  border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--input); cursor: pointer; font-size: .76rem; color: var(--muted); }
.asp .ar { border: 2px solid currentColor; border-radius: 3px; display: block; }
.asp:hover { color: var(--text); border-color: var(--faint); }
.asp.on { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--input); overflow: hidden; }
.stepper button { border: none; background: transparent; width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.stepper button:hover { background: var(--hover); }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; }
.range-row { display: flex; gap: 8px; align-items: center; }
.range-row input[type=number] { width: 84px; }

.model-picker summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel-2); }
.model-picker summary::-webkit-details-marker { display: none; }
.model-picker summary .link { margin-left: auto; color: var(--accent-text); font-size: .88rem; }
.recipe-list { display: grid; gap: 8px; margin-top: 8px; }
.recipe { text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-s); padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.recipe:hover { border-color: var(--faint); }
.recipe.on { border-color: var(--accent-line); background: var(--accent-soft); }
.recipe.disabled { opacity: .55; cursor: not-allowed; }
.recipe-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.recipe-top .badge { margin-left: auto; }
.recipe-notes { font-size: .88rem; }
.recipe-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.recipe-meta .ico { width: 14px; height: 14px; margin-right: 3px; }
.recipe-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: .72rem; padding: 0 7px; border-radius: 99px; }
.tag.good { background: rgba(34,195,138,.13); color: var(--ok); }
.tag.weak { background: rgba(240,82,107,.12); color: var(--err); }
.recipe-missing { font-size: .76rem; color: var(--warn); word-break: break-all; }
.warn-box { background: rgba(240,164,43,.12); color: var(--warn); padding: 10px 12px; border-radius: var(--r-s); }

.adv { border: 1px solid var(--line); border-radius: var(--r-s); }
.adv summary { cursor: pointer; padding: 10px 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.adv summary .badge { background: var(--accent); color: #fff; }
.adv[open] summary { border-bottom: 1px solid var(--line); }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 14px 12px; }
.adv > .btn { margin: 0 12px 12px; }
.tips { display: flex; flex-direction: column; gap: 6px; }
.tip { display: flex; gap: 8px; font-size: .88rem; color: var(--muted); }
.tip .ico { color: #f5b82e; margin-top: 2px; width: 16px; height: 16px; }
.gen-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: sticky; bottom: -60px; padding: 12px 0 0; background: var(--panel); border-top: 1px solid var(--line); }
.gen-meta { display: flex; gap: 14px; font-size: .86rem; align-items: center; flex-wrap: wrap; }
.gen-meta .ico { width: 15px; height: 15px; margin-right: 3px; }

/* ---------- jobs */
.results-list, .job-list { display: flex; flex-direction: column; gap: 10px; }
.job { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-title { font-size: .95rem; }
.job-status { font-size: .8rem; color: var(--muted); }
.job-top .btn { margin-left: auto; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.st-running .status-dot, .st-starting .status-dot, .st-starting_services .status-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.st-done .status-dot { background: var(--ok); } .st-error .status-dot { background: var(--err); }
.st-queued .status-dot { background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }
.job-prompt { font-size: .84rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: var(--accent-text); border-radius: 99px; transition: width .5s var(--ease); }
.bar.indet i { width: 35% !important; position: absolute; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { left: -35%; } 100% { left: 100%; } }
.job-step { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; margin-top: 4px; }
.job-error { color: var(--err); font-size: .85rem; background: rgba(240,82,107,.1); padding: 6px 8px; border-radius: 6px; word-break: break-word; }
.job-warn { color: var(--warn); font-size: .85rem; }
.job-foot { display: flex; gap: 12px; font-size: .76rem; flex-wrap: wrap; }
.job-outs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.thumb { border: none; padding: 0; background: var(--mask-bg); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; display: block; width: 100%; position: relative; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.vthumb, .mthumb { width: 100%; height: 100%; position: relative; display: grid; place-items: center; color: var(--muted); background: var(--panel-2); }
.vthumb .play { position: absolute; width: 30px; height: 30px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.mthumb { flex-direction: column; gap: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty.small { padding: 14px; }

/* ---------- gallery */
.page { max-width: 1400px; }
.page.narrow { max-width: 720px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gallery-grid.small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.gallery-grid.loading { opacity: .6; }
.g-item { display: flex; flex-direction: column; gap: 4px; }
.g-cap { display: flex; justify-content: space-between; gap: 6px; font-size: .78rem; overflow: hidden; }
.g-cap span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-cap span:last-child { white-space: nowrap; }
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
.viewer-media { background: var(--mask-bg); border-radius: var(--r-s); display: grid; place-items: center; min-height: 300px;
  background-image: linear-gradient(45deg, rgba(128,128,128,.15) 25%, transparent 25%, transparent 75%, rgba(128,128,128,.15) 75%), linear-gradient(45deg, rgba(128,128,128,.15) 25%, transparent 25%, transparent 75%, rgba(128,128,128,.15) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 74vh; display: block; }
.viewer-media.k-mesh { background-image: none; background: var(--panel-2); }
.mesh-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px; text-align: center; }
.mesh-card .ico.huge { opacity: .7; color: var(--accent-text); }
.viewer-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.kv.col { flex-direction: column; gap: 4px; }
.prompt-view { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: .86rem; max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.send { display: flex; flex-direction: column; gap: 6px; }
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.send-grid .btn { justify-content: flex-start; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(8,8,8,.62); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: min(1200px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 16px 18px; overflow: auto; }

/* ---------- mask painter */
.mask-wrap { display: flex; flex-direction: column; gap: 12px; }
.mask-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mask-tools .seg .btn { border: none; }
.ctl-inline { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.ctl-inline input[type=number] { width: 80px; }
.ctl-inline.dis { opacity: .5; }
.mask-stage { position: relative; align-self: center; max-width: 100%; line-height: 0; background: var(--mask-bg); touch-action: none; user-select: none; }
.mask-stage img { max-width: 100%; max-height: 66vh; display: block; }
.mask-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; cursor: none; touch-action: none; }
.brush-cursor { position: absolute; border: 2px solid #fff; outline: 1px solid #000; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); display: none; }
.brush-cursor.erase { border-style: dashed; }
.mask-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- bangla text */
.bt-stage-wrap { display: flex; justify-content: center; }
.bt-stage { position: relative; line-height: 0; max-width: 100%; user-select: none; touch-action: none; background: var(--mask-bg); border-radius: 8px; }
.bt-img { max-width: 100%; max-height: 62vh; display: block; border-radius: 8px; }
.bt-box { position: absolute; border: 2px dashed var(--accent-text); background: rgba(47,163,123,.08); cursor: move; touch-action: none; border-radius: 3px; }
.bt-stage.previewing .bt-box { background: transparent; border-color: var(--accent-line); }
.bt-box-text { position: absolute; inset: 4px; display: flex; align-items: center; justify-content: center; color: #fff; text-shadow: 0 1px 3px #000;
  font: 600 clamp(12px, 2.4vw, 26px)/1.3 'Noto Sans Bengali', var(--font); overflow: hidden; white-space: pre-wrap; opacity: 0; pointer-events: none; }
.bt-stage.dragging .bt-box-text, .bt-stage:not(.previewing) .bt-box-text { opacity: .85; }
.handle { position: absolute; width: 16px; height: 16px; background: var(--accent); border: 2px solid #fff; border-radius: 50%; }
.handle.nw { left: -9px; top: -9px; cursor: nwse-resize; } .handle.ne { right: -9px; top: -9px; cursor: nesw-resize; }
.handle.sw { left: -9px; bottom: -9px; cursor: nesw-resize; } .handle.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.bt-spin { position: absolute; right: 8px; top: 8px; background: rgba(0,0,0,.55); color: #fff; padding: 6px; border-radius: 8px; line-height: 0; opacity: 0; transition: opacity .2s; }
.bt-spin.on { opacity: 1; }
.bt-imgbar { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.bt-imgbar span { margin-right: auto; }
.bt-controls { display: flex; flex-direction: column; gap: 12px; }
.bt-controls textarea.prompt { padding-bottom: 14px; min-height: 90px; font-size: 1.2rem; }
.bt-style-ctl .ctl-label { flex-wrap: wrap; }
.bt-style-ctl .grow { flex: 1; }
.bt-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.bt-style { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--panel-2); color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; line-height: 1.25; text-align: center; }
.bt-style img { width: 100%; aspect-ratio: 240 / 128; object-fit: cover; border-radius: 6px; background: var(--input); display: block; }
.bt-style:hover { border-color: var(--faint); color: var(--text); }
.bt-style.on { border-color: var(--accent-line); box-shadow: 0 0 0 2px var(--accent-soft); color: var(--text); font-weight: 600; }
.bt-style:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.bt-pals { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bt-pal { width: 36px; height: 28px; border-radius: 7px; border: 4px solid; cursor: pointer; padding: 0; }
.bt-pal.on { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.bt-pal-custom { display: inline-flex; gap: 4px; padding: 2px; border-radius: 9px; }
.bt-pal-custom.on { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.bt-pal-custom input[type=color] { width: 34px; height: 28px; }
.bt-suggest { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--r-s); background: var(--accent-soft); color: var(--text); }
.bt-alts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bt-ai .row { align-items: center; }
.btn.busy { opacity: .6; pointer-events: none; }

/* ---------- services */
.mem-mini { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .82rem; color: var(--muted); width: min(320px, 100%); }
.mem-mini .mem-bar { flex: 1; height: 8px; }
.mem-mini span { white-space: nowrap; }
.mem-bar { height: 18px; border-radius: 99px; background: var(--line); display: flex; overflow: hidden; }
.mem-bar i { display: block; height: 100%; transition: width .6s; }
.mem-bar i.comfy { background: var(--accent); }
.mem-bar i.other { background: var(--accent-2); }
.mem-bar.warn i.other { background: var(--warn); } .mem-bar.crit i.other, .mem-bar.crit i.comfy { background: var(--err); }
.mem-legend, .mem-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: .88rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.sw.comfy { background: var(--accent); } .sw.other { background: var(--accent-2); } .sw.free { background: var(--line); }
.svc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 16px; }
.svc { display: flex; flex-direction: column; gap: 8px; }
.svc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.svc-top .muted { margin-left: auto; }
.svc p { margin: 0; }
.svc-actions { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.svc.st-running .status-dot { background: var(--ok); animation: none; }
.svc.st-starting .status-dot, .svc.st-stopping .status-dot { background: var(--warn); animation: pulse 1s infinite; }

/* ---------- settings */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-row input[type=text] { width: min(100%, 320px); }
.set-actions { padding-top: 16px; display: flex; justify-content: flex-end; }

/* ---------- toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: var(--r-s); box-shadow: var(--shadow); animation: toast-in .22s var(--ease); transition: opacity .3s var(--ease), transform .3s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line-2)); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line-2)); background: color-mix(in srgb, var(--warn) 9%, var(--panel)); }
.toast.error { border-color: color-mix(in srgb, var(--err) 50%, var(--line-2)); background: color-mix(in srgb, var(--err) 9%, var(--panel)); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- responsive */
@media (max-width: 1180px) {
  .task-grid { grid-template-columns: 1fr; }
  .task-results { position: static; max-height: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100%; }
  .body { flex-direction: column; }
  .nav { width: 100%; display: flex; gap: 4px; padding: 6px 8px; border-right: none; border-bottom: 1px solid var(--line);
    overflow-x: auto; position: sticky; top: 0; z-index: 10; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { display: flex; gap: 4px; }
  .nav-group + .nav-group { margin: 0; padding: 0 0 0 6px; border-top: none; border-left: 1px solid var(--line); }
  .nav-title { display: none; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: .74rem; min-width: 66px; text-align: center; white-space: nowrap; }
  .nav-badge { position: absolute; top: 2px; right: 4px; }
  .main { overflow: visible; padding: 16px 16px 40px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
  .top-mem { justify-content: flex-end; }
  .mem-mini span { display: none; }
  .mem-mini { width: 70px; }
  #langBtn { padding: 5px 8px; }
  .viewer { grid-template-columns: 1fr; }
  .gen-bar { bottom: 0; padding-bottom: 10px; }
}
@media (max-width: 560px) {
  .bt-styles { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 240px; }
  h1 { font-size: 1.2rem; }
  .card { padding: 14px; border-radius: 12px; }
  .task-icon { width: 38px; height: 38px; }
  .gen-bar .btn.big { width: 100%; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .svc-list { grid-template-columns: 1fr; }
  .seg button { padding: 6px 10px; }
  .modal-back { padding: 0; }
  .modal { max-height: 100vh; border-radius: 0; height: 100%; }
  .send-grid { grid-template-columns: 1fr; }
  .page-head .seg { margin-left: 0; }
}
.bt-stage-wrap > .drop { width: 100%; }

/* ---------- chat */
.main.flush { padding: 0; overflow: hidden; display: flex; }
.chat-page { flex: 1; display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 0; height: 100%; }
.chat-side { border-right: 1px solid var(--line); background: var(--bg-2); padding: 14px 10px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chat-new { justify-content: flex-start; width: 100%; }
.chat-side-title { font-size: .78rem; color: var(--faint); padding: 6px 8px 0; }
.chat-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 0; }
.chat-none { padding: 4px 8px; margin: 0; }
.chat-li { display: flex; align-items: center; border-radius: var(--r-s); transition: background .15s var(--ease); }
.chat-li:hover { background: var(--hover); }
.chat-li.on { background: var(--accent-soft); }
.chat-li-main { flex: 1; min-width: 0; text-align: left; background: none; border: none; color: var(--muted); padding: 7px 8px; cursor: pointer; font-size: .9rem; }
.chat-li.on .chat-li-main { color: var(--text); }
.chat-li-main span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-li-del { opacity: 0; transition: opacity .15s var(--ease); }
.chat-li:hover .chat-li-del, .chat-li.on .chat-li-del, .chat-li-del:focus-visible { opacity: 1; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.sm .ico { width: 15px; height: 15px; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.chat-pane.over::after { content: ''; position: absolute; inset: 10px; border: 2px dashed var(--accent-line); border-radius: var(--r); background: var(--accent-soft); pointer-events: none; }
.chat-scroll { flex: 1; overflow: auto; min-height: 0; }
.chat-thread { max-width: 780px; margin: 0 auto; padding: 28px 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.chat-empty { padding: 9vh 0 0; display: flex; flex-direction: column; gap: 6px; }
.chat-empty h2 { font-size: 1.6rem; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.chat-empty p { margin: 0 0 18px; max-width: 56ch; }
.chat-starters { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.starter { text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: var(--r-s); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease); max-width: 100%; }
.starter:hover { border-color: var(--accent-line); background: var(--panel-2); }

.msg { display: flex; flex-direction: column; gap: 8px; min-width: 0; animation: msg-in .22s var(--ease); }
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } }
.msg.user { align-self: flex-end; align-items: flex-end; max-width: 82%; }
.msg.user .msg-body { background: var(--panel-2); border: 1px solid var(--line); padding: 9px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; word-break: break-word; }
.msg-imgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.msg-imgs img { max-width: 220px; max-height: 180px; border-radius: var(--r-s); border: 1px solid var(--line); display: block; object-fit: cover; }
.msg.bot { align-self: stretch; }
.msg-meta { font-size: .76rem; color: var(--faint); }
.msg-status { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1.1s var(--ease) infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.msg-think { font-size: .86rem; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg-2); }
.msg-think summary { cursor: pointer; padding: 6px 10px; display: flex; gap: 6px; align-items: center; list-style: none; }
.msg-think summary::-webkit-details-marker { display: none; }
.msg-think > div { padding: 0 12px 10px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.msg.streaming .msg-think summary { color: var(--accent-text); }

.md { line-height: 1.7; word-break: break-word; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; max-width: 72ch; }
.md h4 { margin: 1.1em 0 .4em; font-size: 1.02rem; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-size: .9em; }
.code { border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg-2); margin: 0 0 .9em; overflow: hidden; }
.code.is-prompt { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 6%, var(--bg-2)); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 3px 4px 3px 12px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.code.is-prompt .code-head { color: var(--accent-text); border-bottom-color: var(--accent-line); }
.code pre { margin: 0; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font: .9rem/1.6 ui-monospace, 'JetBrains Mono', Menlo, monospace; }
.code.is-prompt pre { font-family: var(--font); font-size: .95rem; }
.code-foot { padding: 0 12px 10px; }

.chat-composer { max-width: 780px; width: 100%; margin: 0 auto; padding: 8px 22px 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-box { display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.chat-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.chat-input { flex: 1; border: none; background: transparent; resize: none; padding: 8px 4px; max-height: 220px; line-height: 1.55; box-shadow: none !important; font-size: 1rem; }
.chat-send { width: 40px; height: 40px; padding: 0; border-radius: 10px; flex: none; }
.chat-send.stop { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); box-shadow: none; }
.chat-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 0 4px; }
.chat-model { font-size: .84rem; padding: 4px 8px; background: var(--panel); border-color: var(--line); color: var(--muted); max-width: 100%; }
.chat-attach { display: flex; gap: 8px; flex-wrap: wrap; }
.att { position: relative; width: 64px; height: 64px; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--line-2); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.loading img { opacity: .45; }
.att-x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.att-x .ico { width: 12px; height: 12px; }

@media (max-width: 900px) {
  .main.flush { height: calc(100dvh - var(--top-h) - 62px); }
  .chat-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .chat-side { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; }
  .chat-side-title { display: none; }
  .chat-new { width: auto; flex: none; }
  .chat-list { flex-direction: row; overflow: visible; }
  .chat-li { flex: none; max-width: 180px; }
  .chat-thread, .chat-composer { padding-left: 16px; padding-right: 16px; }
  .msg.user { max-width: 92%; }
}

/* ---------- 3D sketch */
.sk-page { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; height: 100%; }
.sk-left { border-right: 1px solid var(--line); background: var(--bg-2); padding: 18px 16px 40px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.sk-left > * { flex-shrink: 0; }
.sk-left .task-head { margin-bottom: 4px; flex-wrap: nowrap; align-items: flex-start; }
.sk-left .task-head h1 { font-size: 1.2rem; }
.sk-left .task-head p { font-size: .86rem; }
.sk-left .big-label { margin: 6px 0 -4px; font-size: .92rem; }
.sk-drop { position: relative; border: 2px dashed var(--line-2); border-radius: var(--r); min-height: 150px; background: var(--input); cursor: pointer; padding: 6px;
  display: grid; place-items: center; color: var(--muted); transition: border-color .15s var(--ease), background .15s var(--ease); }
.sk-drop:hover, .sk-drop.over { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.sk-drop img { max-width: 100%; max-height: 220px; border-radius: var(--r-s); display: block; }
.sk-drop-hint { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .9rem; }
.sk-text { font-size: .95rem; }
.sk-passes { justify-content: space-between; }
.sk-passes select { padding: 4px 8px; }
.sk-go { width: 100%; }
.sk-status { font-size: .88rem; color: var(--muted); min-height: 1.4em; display: flex; align-items: center; gap: 6px; }
.sk-status[data-kind="error"] { color: var(--err); }
.sk-status[data-kind="ok"] { color: var(--accent-text); }
.sk-edit { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.sk-edit .row input { flex: 1; }
.sk-versions, .sk-history { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 8px; }
.sk-ver, .sk-hist-main { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel);
  color: var(--muted); cursor: pointer; font: inherit; font-size: .76rem; text-align: left; min-width: 0; width: 100%; }
.sk-ver img, .sk-hist-main img, .sk-ver-ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; background: var(--input); display: grid; place-items: center; }
.sk-ver span:last-child, .sk-hist-main span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-ver:hover, .sk-hist-main:hover { border-color: var(--faint); color: var(--text); }
.sk-ver.on, .sk-hist.on .sk-hist-main { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.sk-hist { position: relative; }
.sk-hist .icon-btn { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .15s var(--ease); }
.sk-hist:hover .icon-btn, .sk-hist .icon-btn:focus-visible { opacity: 1; }
.sk-logbox summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
.sk-log { max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: .78rem/1.5 ui-monospace, Menlo, monospace; background: var(--input);
  border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px; margin: 8px 0 0; color: var(--muted); }
.sk-right { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sk-toolbar { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sk-toolbar .row { gap: 4px; }
.sk-toolbar .btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.sk-stage { flex: 1; position: relative; min-height: 0; background: #1a1a1b; }
.sk-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.sk-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #8c8c88; pointer-events: none; text-align: center; padding: 20px; }
.sk-empty .ico { width: 48px; height: 48px; opacity: .5; }
.sk-foot { padding: 6px 12px; border-top: 1px solid var(--line); min-height: 32px; }
.sk-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.sk-dialog::backdrop { background: rgba(8,8,8,.62); }
.sk-code { margin: 0; white-space: pre-wrap; font: .82rem/1.55 ui-monospace, Menlo, monospace; max-height: 70vh; overflow: auto; }
@media (max-width: 900px) {
  .sk-page { grid-template-columns: 1fr; grid-template-rows: auto minmax(360px, 60vh); height: auto; }
  .sk-left { order: 2; border-right: none; border-top: 1px solid var(--line); }
  .sk-right { order: 1; min-height: 360px; }
  .main.flush:has(.sk-page) { height: auto; overflow: visible; display: block; }
}

/* ---------- 3D builder */
.bd-page { flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.bd-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bd-top .row { gap: 6px; }
.bd-title { background: transparent; border-color: transparent !important; font-weight: 600; font-size: 1rem; width: min(320px, 40vw); }
.bd-title:hover { border-color: var(--line-2) !important; }
.bd-main { flex: 1; display: grid; grid-template-columns: 64px 248px minmax(0, 1fr) 272px; min-height: 0; }
.bd-rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; border-right: 1px solid var(--line); background: var(--bg-2); overflow: auto; }
.bd-rail-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: none; border-radius: var(--r-s); background: none; color: var(--muted); cursor: pointer; font-size: .7rem; line-height: 1.2; text-align: center; }
.bd-rail-btn:hover { background: var(--hover); color: var(--text); }
.bd-rail-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.bd-panel { border-right: 1px solid var(--line); background: var(--bg-2); padding: 12px 10px 24px; overflow: auto; min-height: 0; }
.bd-panel-h h3 { margin: 0; font-size: 1rem; } .bd-panel-h p { margin: 2px 0 8px; }
.bd-sub { font-size: .78rem; color: var(--faint); margin: 14px 2px 6px; }
.bd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bd-card { display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel); color: var(--muted);
  cursor: pointer; font: inherit; font-size: .78rem; text-align: center; min-width: 0; transition: border-color .15s var(--ease), color .15s var(--ease); }
.bd-card:hover { border-color: var(--accent-line); color: var(--text); }
.bd-card span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-card-img { aspect-ratio: 1; border-radius: 5px; background: #151516; display: grid; place-items: center; overflow: hidden; color: #cfcfca; }
.bd-card-img.wide { aspect-ratio: 16 / 9; }
.bd-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-card-img .ico { width: 26px; height: 26px; opacity: .7; }
.bd-figure, .bd-move-svg { display: block; width: 70%; height: 70%; color: #d9d9d6; }
.bd-figure svg, .bd-move-svg svg { width: 100%; height: 100%; display: block; }
.bd-search { width: 100%; margin-top: 6px; }
.bd-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.bd-obj { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: none; border-radius: var(--r-s); background: none; color: var(--muted); cursor: pointer; font: inherit; text-align: left; }
.bd-obj:hover { background: var(--hover); color: var(--text); } .bd-obj.on { background: var(--accent-soft); color: var(--text); }
.bd-view { position: relative; min-width: 0; min-height: 0; background: #0d0d0d; }
.bd-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.bd-tools { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 99px;
  background: rgba(24,24,25,.92); border: 1px solid #333; }
.bd-tools .icon-btn { color: #bdbdb8; border-radius: 99px; width: 34px; height: 34px; font-weight: 600; }
.bd-tools .icon-btn:hover { background: #2c2c2e; color: #fff; }
.bd-tools .icon-btn.on { background: #e9e9e6; color: #111; }
.bd-ai-wrap { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(640px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 4px; }
.bd-ai { display: flex; gap: 6px; align-items: center; padding: 5px; border-radius: 12px; background: rgba(24,24,25,.94); border: 1px solid #383838; }
.bd-ai .icon-btn { color: #bdbdb8; } .bd-ai .icon-btn.on { color: var(--accent-text); }
.bd-ai-in { flex: 1; background: transparent !important; border-color: transparent !important; color: #ececea; box-shadow: none !important; }
.bd-ai-status { font-size: .82rem; color: #bdbdb8; text-align: center; min-height: 1.2em; text-shadow: 0 1px 2px #000; }
.bd-ai-status .err { color: #ff8a8d; }
.bd-hint { position: absolute; left: 10px; top: 8px; color: #8c8c88; font-size: .74rem; pointer-events: none; }
.bd-right { border-left: 1px solid var(--line); background: var(--bg-2); overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.bd-sec { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.bd-sec-t { font-size: .82rem; font-weight: 600; color: var(--muted); }
.bd-prev { width: 100%; background: #000; border-radius: var(--r-s); overflow: hidden; border: 1px solid var(--line); }
.bd-prev-canvas { width: 100%; display: block; }
.bd-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.bd-field input[type=number] { width: 78px; } .bd-field input[type=text] { width: 140px; } .bd-field input[type=range] { max-width: 130px; }
.bd-xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.bd-xyz .bd-field { flex-direction: column; align-items: stretch; gap: 2px; } .bd-xyz input[type=number] { width: 100%; }
.bd-motlist { display: flex; flex-direction: column; gap: 4px; }
.bd-mot { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 2px 4px 2px 8px; }
.bd-timeline { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }
.bd-tc { font-size: .8rem; color: var(--muted); min-width: 110px; }
.bd-scrub-wrap { flex: 1; position: relative; min-width: 200px; display: flex; align-items: center; }
.bd-scrub { width: 100%; }
.bd-marks { position: absolute; left: 0; right: 0; top: -2px; height: 6px; pointer-events: none; }
.bd-marks .mk { position: absolute; width: 7px; height: 7px; transform: translateX(-50%) rotate(45deg); border-radius: 1px; }
.bd-marks .mk.cam { background: #4aa3df; } .bd-marks .mk.mot { background: var(--accent-text); top: 9px; }
.bd-dur { width: 64px; padding: 3px 6px; }
.bd-scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.bd-scene-item { position: relative; } .bd-scene-item .icon-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; }
@media (max-width: 1200px) { .bd-main { grid-template-columns: 58px 210px minmax(0, 1fr); } .bd-right { display: none; } }
@media (max-width: 900px) {
  .main.flush:has(.bd-page) { height: auto; overflow: visible; display: block; }
  .bd-page { height: auto; }
  .bd-main { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; }
  .bd-rail { flex-direction: row; border-right: none; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .bd-rail-btn { min-width: 64px; }
  .bd-panel { order: 3; border-right: none; max-height: 50vh; }
  .bd-view { order: 2; min-height: 60vh; }
}
.bd-ref { background: #111; border-radius: var(--r-s); overflow: hidden; border: 1px dashed var(--line-2); min-height: 40px; }
.bd-ref img { width: 100%; display: block; }
.bd-gen { display: flex; flex-direction: column; gap: 6px; padding: 8px; margin-top: 10px; border: 1px solid var(--accent-line); border-radius: var(--r-s); background: var(--accent-soft); }
.bd-gen-in { font-size: .86rem; }
.bd-gen .err, .bd-ai .err { color: var(--err); }

/* ---- Motion page */
.mo-segs { display: flex; flex-direction: column; gap: 8px; }
.mo-seg { display: grid; grid-template-columns: 22px 1fr; gap: 4px 8px; align-items: start; }
.mo-seg .row { grid-column: 2; gap: 6px; }
.mo-seg input[type=number] { width: 72px; }
.mo-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: .75rem; margin-top: 6px; }
.mo-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.mo-ex .chip { font-size: .78rem; }
.sk-left .row select { flex: 1; min-width: 0; }
.sk-left .row input[type=number] { width: 72px; }
.mo-lib { display: flex; flex-direction: column; gap: 4px; }
.mo-item { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: var(--r-s); cursor: pointer; border: 1px solid transparent; }
.mo-item:hover { background: var(--hover); }
.mo-item.on { border-color: var(--accent-line); background: var(--accent-soft); }
.mo-item-t { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-view { flex: 1; min-height: 0; position: relative; }
.mo-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mo-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.mo-scrub { flex: 1; }
.mo-info { min-width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.mo-dl { padding: 8px 14px 14px; gap: 8px; flex-wrap: wrap; align-items: center; }
.mo-title { flex: 1; min-width: 160px; font-size: .9rem; }
@media (max-width: 900px) { .mo-view { flex: none; height: 360px; } }

.dev-card { border-color: var(--accent-line); }
.dev-card h2 { display: flex; align-items: center; gap: 8px; }
.dev-info { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: .86rem; }
.dev-info code { user-select: all; }

/* ---- guided pointing (assistant / Doel) */
.tour-ring { position: fixed; z-index: 9998; pointer-events: none; border: 3px solid var(--accent); border-radius: 12px;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / .28), 0 0 18px var(--accent); opacity: 0; transition: opacity .25s, left .3s, top .3s, width .3s, height .3s; }
.tour-ring.on { opacity: 1; animation: tourPulse 1.4s ease-in-out infinite; }
@keyframes tourPulse { 50% { box-shadow: 0 0 0 9999px rgb(0 0 0 / .28), 0 0 30px var(--accent); } }
.tour-cap { position: fixed; z-index: 9999; max-width: 290px; padding: 8px 12px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--accent-line); box-shadow: 0 8px 24px rgb(0 0 0 / .25); font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; }
.tour-cap.on { opacity: 1; }
.act-chip { margin: 6px 0; }
@media (prefers-reduced-motion: reduce) { .tour-ring.on { animation: none; } }

/* ---- Doel mascot */
.doel { position: fixed; right: 18px; bottom: 18px; z-index: 9990; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; --fx: 0px; --fy: 0px; }
.doel[hidden] { display: none; }
.doel-bird { width: 84px; height: 84px; padding: 8px 6px 4px; border: 1px solid var(--line); border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fdf6e3, #e9dcc0); cursor: pointer; filter: drop-shadow(0 6px 10px rgb(0 0 0 / .25));
  transform: translate(var(--fx), var(--fy)); transition: transform .7s cubic-bezier(.3, 1.2, .5, 1); }
.doel-bird:focus-visible { outline: 3px solid var(--accent); border-radius: 50%; }
.doel-svg { width: 100%; height: 100%; overflow: visible; }
.doel-svg .d-body, .doel-svg .d-head { transform-box: fill-box; animation: doelBob 3.2s ease-in-out infinite; }
.doel-svg .d-head { transform-origin: 30% 90%; }
.doel-svg .d-tail { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .25s; }
.doel-svg .d-wing { transform-box: fill-box; transform-origin: 20% 40%; }
.doel-svg .d-eye { transform-box: fill-box; transform-origin: center; }
.doel-svg .d-beak-lo { transform-box: fill-box; transform-origin: 0 0; }
.doel.blink .d-eye { animation: doelBlink .25s 2; }
.doel.flick .d-tail { transform: rotate(-22deg); }
.doel.hop .doel-bird { animation: doelHop .5s ease-out; }
.doel.talking .d-beak-lo { animation: doelTalk .22s ease-in-out infinite alternate; }
.doel.flying .d-wing { animation: doelFlap .14s ease-in-out infinite alternate; }
.doel-bird:hover .d-head { transform: rotate(-8deg); }
@keyframes doelBob { 50% { transform: translateY(-2px); } }
@keyframes doelBlink { 50% { transform: scaleY(.1); } }
@keyframes doelHop { 40% { transform: translate(var(--fx), calc(var(--fy) - 12px)); } }
@keyframes doelTalk { to { transform: rotate(14deg); } }
@keyframes doelFlap { to { transform: rotate(-35deg) scaleY(.8); } }
.doel-bubble { max-width: 260px; padding: 10px 12px; border-radius: 14px 14px 4px 14px; background: var(--panel); border: 1px solid var(--accent-line);
  box-shadow: 0 8px 24px rgb(0 0 0 / .2); font-size: .9rem; animation: doelIn .25s ease-out; }
.doel-panel { width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 140px)); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px rgb(0 0 0 / .3); overflow: hidden; animation: doelIn .2s ease-out; }
.doel-panel[hidden] { display: none; }
.doel-head { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.doel-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.doel-msg { white-space: pre-wrap; font-size: .9rem; line-height: 1.5; padding: 8px 11px; border-radius: 12px; max-width: 92%; }
.doel-msg.bot { background: var(--bg-2); align-self: flex-start; }
.doel-msg.me { background: var(--accent-soft); color: var(--accent-text); align-self: flex-end; }
.doel-msg .err { color: var(--err); }
.doel-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.doel-quick .chip { font-size: .78rem; }
.doel-send { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.doel-in { flex: 1; resize: none; font-size: .9rem; }
.doel-peek { position: fixed; right: 12px; bottom: 12px; z-index: 9990; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 1.1rem; }
@keyframes doelIn { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 600px) { .doel { right: 10px; bottom: 10px; } .doel-bird { width: 64px; height: 64px; } }
@media (prefers-reduced-motion: reduce) { .doel-svg *, .doel-bird, .doel-bubble, .doel-panel { animation: none !important; transition: none !important; } }
