/* AutoRig Studio – dark "developer studio" theme: navy glass panels, blue accent */
:root {
  --bg: #0b0f16; --panel: #101622; --panel2: #141b29; --card: #172033; --line: #233047; --line2: #2c3a55;
  --text: #e8edf6; --mute: #8592a8; --accent: #2f8cff; --accent2: #5aa8ff; --accent-ink: #ffffff; --warn: #f6ad55;
  --ok: #3ddc97; --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: grid; grid-template-columns: var(--lw, 330px) 1fr var(--rw, 270px); overflow: hidden; transition: grid-template-columns .22s ease; }
body.left-collapsed { --lw: 0px; } body.right-collapsed { --rw: 0px; }
body.left-collapsed #panel, body.right-collapsed .inspector { visibility: hidden; padding: 0; border: none; min-width: 0; }
#panel, .inspector { min-width: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #26324a; border-radius: 8px; }

/* ---- side panels ---- */
#panel, .inspector { background: linear-gradient(180deg, var(--panel2), var(--panel)); overflow-y: auto; }
#panel { border-right: 1px solid var(--line); padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.inspector { border-left: 1px solid var(--line); padding: 10px 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.brand { display: flex; flex-direction: column; gap: 6px; }
.brand .dots { display: flex; gap: 7px; } .brand .dots i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.brand .dots i:nth-child(2) { background: #febc2e; } .brand .dots i:nth-child(3) { background: #28c840; }
h1 { margin: 2px 0 0; font-size: 18px; letter-spacing: -0.01em; font-weight: 650; }
h1 span { color: var(--mute); font-weight: 500; }
.page { display: flex; flex-direction: column; gap: 12px; }
.page[hidden] { display: none; }
.card, .step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.card.sub { background: #131b2b; }
.step { display: flex; flex-direction: column; gap: 10px; opacity: .45; pointer-events: none; transition: opacity .2s; }
.step.active { opacity: 1; pointer-events: auto; }
h2 { font-size: 13px; margin: 0 0 8px; font-weight: 650; }
.hint { color: var(--mute); font-size: 11.5px; margin: 6px 0; line-height: 1.4; }
.hint a { color: var(--accent2); }
details > summary { cursor: pointer; list-style: none; font-weight: 650; font-size: 13px; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--mute); font-size: 11px; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary small { color: var(--mute); font-weight: 400; margin-left: auto; }
.settings[open] > summary, .card.sub[open] > summary { margin-bottom: 8px; }
.settings .group { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.settings h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--mute); margin: 0 0 6px; }
.settings .group.editing { background: #14233a; border-radius: 10px; padding: 10px; margin: 8px -4px 0; }

/* ---- controls ---- */
button { font: inherit; font-size: 12.5px; color: var(--text); background: #1c2639; border: 1px solid var(--line2); border-radius: 9px;
  padding: 7px 11px; cursor: pointer; transition: border-color .15s, background .15s; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { width: 100%; background: linear-gradient(180deg, #3b95ff, #1f74e6); color: #fff; border: none; font-weight: 650; padding: 10px;
  box-shadow: 0 4px 14px rgba(47, 140, 255, .28); }
button.primary.big { font-size: 14px; padding: 12px; }
button.accent, .btn-like.accent { background: linear-gradient(180deg, #3b95ff, #1f74e6); color: #fff; border: none; }
button.ghost { width: 100%; margin-top: 6px; background: transparent; }
button.icon { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 15px; border-radius: 10px;
  background: rgba(20, 28, 44, .85); }
input[type=search], input[type=text], input[type=number], select {
  background: #0f1624; color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12px; }
input[type=range] { accent-color: var(--accent); }
.toggle, .range, .select { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b8c3d6; margin: 4px 0; }
.range input { flex: 1; } .range output { width: 44px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.select select { flex: 1; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { flex: none; width: 34px; height: 19px; border-radius: 99px; background: #2a3650; position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(15px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent2); }
.drop { display: block; border: 1.5px dashed var(--line2); border-radius: 11px; padding: 16px; text-align: center; cursor: pointer; background: #111a2a; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { display: none; }
.drop small { display: block; color: var(--mute); margin-top: 4px; }
.drop.small { padding: 10px; }
.bvh-drop { display: flex; align-items: center; gap: 10px; text-align: left; border-style: solid; background: #131c2d; }
.bvh-drop .plus { width: 34px; height: 34px; border-radius: 9px; background: #1c2639; display: grid; place-items: center; font-size: 20px; font-weight: 400; }
.bvh-drop small { margin-top: 1px; }
.btn-like { display: flex; align-items: center; justify-content: center; border-radius: 10px; border: none; }
.small-file { display: block; font-size: 12px; color: var(--mute); margin-top: 8px; }
.small-file input { font-size: 11px; width: 100%; margin-top: 4px; }
.orient { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--mute); }
.orient span { margin-right: auto; }
#marker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.marker { display: flex; align-items: center; gap: 7px; text-align: left; }
.marker i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.marker.active { border-color: var(--accent); background: #16294a; }
.marker.placed::after { content: "✓"; margin-left: auto; color: var(--accent2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border-radius: 9px; }
.chips button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips button.bvh-chip { border-style: dashed; }
.chips button .x { margin-left: 6px; opacity: .6; } .chips button .x:hover { opacity: 1; color: var(--warn); }
.chips .dl { margin-left: 6px; opacity: .7; text-decoration: none; color: inherit; } .chips .dl:hover { opacity: 1; }
.detect-row, .export-row, .play-row, .row2 { display: flex; gap: 6px; margin: 6px 0; align-items: center; }
.detect-row select { flex: 1; }
.export-row button { flex: 1; margin: 0; }
.play-row .primary { flex: 1.2; margin: 0; } .play-row #btn-add-tl { flex: 1; }
.row2 button { flex: 1; } .row2 .toggle { flex: 1; justify-content: flex-end; }
.caps { display: flex; gap: 6px; flex-wrap: wrap; }
.cap { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mute); }
.cap.ok { border-color: #2a6b52; color: var(--ok); } .cap.off { border-color: var(--warn); color: var(--warn); }
.detect-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #16294a; color: var(--accent2); margin-bottom: 6px; }
.rig-detail { font-size: 11px; color: var(--mute); margin-top: 6px; }
.opts { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 4px; }
#status { font-size: 11.5px; color: var(--mute); min-height: 18px; margin-top: auto; }
#status.error { color: var(--warn); }
.busy { position: relative; }
.busy::after { content: ""; position: absolute; right: 12px; top: 14px; width: 12px; height: 12px; border: 2px solid var(--accent);
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-why { font-size: 11px; color: var(--warn); line-height: 1.35; }
.ai-why button.tiny { width: auto; padding: 2px 8px; margin: 4px 0 0; font-size: 11px; }

/* ---- viewport ---- */
#view { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #1a2232, #070a10 75%); }
#view canvas { display: block; }
#overlay { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); background: #000a; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; pointer-events: none; display: none; z-index: 6; }
.topbar { position: absolute; top: 10px; left: 56px; right: 56px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; z-index: 7; pointer-events: none; }
.topbar::before { content: ''; flex: 1 1 0; min-width: 0; }
.topbar > * { pointer-events: auto; }
.modes { order: 0; display: flex; gap: 4px; padding: 4px; background: rgba(13, 19, 31, .82); border: 1px solid var(--line2); border-radius: 14px;
  backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.modes button { border: none; background: transparent; padding: 7px 22px; border-radius: 10px; color: #c7d0df; font-weight: 550; font-size: 13px; }
.modes button.active { background: linear-gradient(180deg, #3b95ff, #1f74e6); color: #fff; box-shadow: 0 2px 10px rgba(47,140,255,.4); }
.top-tools { flex: 1 1 0; justify-content: flex-end; display: flex; gap: 8px; align-items: center; background: rgba(13, 19, 31, .7);
  border: 1px solid var(--line2); border-radius: 12px; padding: 4px 8px; backdrop-filter: blur(8px); }
.top-tools button.icon { width: 28px; height: 28px; font-size: 14px; background: transparent; border-color: transparent; }
.vb-follow { display: inline-flex; gap: 5px; align-items: center; color: #c7d0df; font-size: 12.5px; white-space: nowrap; }
.vb-follow input { accent-color: var(--accent); }
.viewbar { position: absolute; right: 12px; top: 64px; display: flex; flex-direction: column; gap: 8px; z-index: 6; }
.viewbar[hidden] { display: none; }
.viewbar button.icon.on { border-color: var(--accent); color: var(--accent2); }
.vb-pop { position: relative; }
.vb-menu { position: absolute; right: 42px; top: 0; display: none; flex-direction: column; gap: 6px; padding: 8px; background: rgba(13,19,31,.95);
  border: 1px solid var(--line2); border-radius: 12px; }
.vb-pop:hover .vb-menu, .vb-pop.open .vb-menu { display: flex; }
.vb-group { display: flex; gap: 2px; }
.vb-group button { padding: 4px 10px; font-size: 12px; border-radius: 7px; background: transparent; border: 1px solid transparent; color: #aab6c9; white-space: nowrap; }
.vb-group button:hover { color: var(--text); }
.vb-group button.active { background: var(--accent); color: #fff; }

/* ---- timeline ---- */
.timeline { position: absolute; left: 0; right: 0; bottom: 0; height: 72px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
  align-items: center; padding: 8px 14px; background: rgba(10, 14, 22, .92); border-top: 1px solid var(--line); z-index: 6; backdrop-filter: blur(8px); }
.timeline[hidden] { display: none; }
.tl-transport { display: flex; gap: 4px; align-items: center; }
.tl-transport button.icon { width: 28px; height: 28px; font-size: 12px; background: transparent; border-color: transparent; }
.tl-transport button.play { background: #1c2639; border-color: var(--line2); }
.tl-frame { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12.5px; background: #0f1624;
  border: 1px solid var(--line2); border-radius: 7px; padding: 4px 6px; margin-left: 6px; }
.tl-track { position: relative; height: 54px; cursor: ew-resize; user-select: none; }
.tl-ruler { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; border-bottom: 1px solid var(--line2); }
.tl-ruler i { position: absolute; bottom: 0; width: 1px; background: #3a4864; height: 6px; }
.tl-ruler i.major { height: 12px; background: #5a6a88; }
.tl-ruler b { position: absolute; top: 0; font-size: 10px; color: var(--mute); font-weight: 500; transform: translateX(-50%); }
.tl-range { position: absolute; bottom: 0; height: 3px; background: var(--accent); opacity: .6; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent2); pointer-events: none; }
.tl-head b { position: absolute; top: -2px; left: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 8px var(--accent); }
.tl-seq { position: absolute; left: 0; right: 0; top: 0; height: 20px; display: flex; gap: 2px; }
.tl-seq span { background: #1f3a66; border: 1px solid #2f5ea8; border-radius: 5px; font-size: 10px; padding: 1px 6px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; cursor: pointer; }
.tl-seq span.on { background: var(--accent); border-color: var(--accent2); }
.tl-seq span em { font-style: normal; opacity: .7; margin-left: 4px; }
.tl-io { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--mute); }
.tl-io input { width: 56px; text-align: center; }
.tl-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c7d0df; }

/* ---- inspector ---- */
.ins { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ins[open] > summary { margin-bottom: 8px; }
.tree { max-height: 300px; overflow: auto; font-size: 12px; }
.tree ul { list-style: none; margin: 0; padding-left: 12px; }
.tree > ul { padding-left: 0; }
.tree li > div { display: flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.tree li > div:hover { background: #1c2639; }
.tree li > div.sel { background: #1e3f70; color: #fff; }
.tree li > div i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.tree li > div.edited i { background: var(--warn); }
.tree .tw { width: 12px; color: var(--mute); font-size: 9px; text-align: center; }
.tree li.closed > ul { display: none; }
.tr-grid { display: grid; grid-template-columns: 58px 1fr 1fr 1fr; gap: 4px; align-items: center; font-size: 11.5px; color: var(--mute); }
.tr-grid input { width: 100%; padding: 4px 5px; text-align: right; font-variant-numeric: tabular-nums; }
.tr-grid input:disabled { opacity: .45; }
.picker { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 1px; margin-top: 6px; font-size: 12px; }
.picker label { display: flex; gap: 7px; align-items: center; padding: 2px 4px; border-radius: 6px; cursor: pointer; }
.picker label:hover { background: #1c2639; }
.picker input { accent-color: var(--accent); }
.inspector input[type=search] { width: 100%; }

@media (max-width: 1100px) { body:not(.right-collapsed) { --rw: 240px; } }
@media (max-width: 760px) { body { grid-template-columns: 1fr; grid-template-rows: auto 60vh; overflow: auto; } }

/* motion capture from video / camera */
#cam-panel { position: absolute; inset: 0; background: rgba(8, 10, 14, .92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; z-index: 20; }
#cam-panel[hidden] { display: none; }
#cam-video { max-width: 90%; max-height: 72%; border-radius: 10px; transform: scaleX(-1); background: #000; }
#cam-count { position: absolute; font-size: 120px; font-weight: 700; color: #fff; text-shadow: 0 4px 30px #000; pointer-events: none; }
.cam-bar { display: flex; gap: 10px; align-items: center; }
.cam-bar span { color: var(--muted, #9aa); min-width: 220px; text-align: right; font-variant-numeric: tabular-nums; }
#cam-stop { background: #c0392b; color: #fff; }

#pick-panel { position: absolute; inset: 0; background: rgba(8, 10, 14, .94); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; z-index: 21; padding: 16px; }
#pick-panel[hidden] { display: none; }
.pick-title { color: #dde; }
#pick-stage { position: relative; max-width: 92%; max-height: 72%; user-select: none; cursor: crosshair; }
#pick-img { display: block; max-width: 100%; max-height: 68vh; border-radius: 8px; }
#pick-boxes, #pick-draw { position: absolute; inset: 0; }
#pick-boxes { pointer-events: none; }
.pbox { position: absolute; border: 2px solid rgba(110, 220, 200, .9); border-radius: 6px; background: rgba(110, 220, 200, .08);
  cursor: pointer; pointer-events: auto; }
.pbox:hover { background: rgba(110, 220, 200, .2); }
.pbox.sel { border-color: #ffd34d; background: rgba(255, 211, 77, .18); box-shadow: 0 0 0 3px rgba(255, 211, 77, .35); }
.pbox span { position: absolute; top: -22px; left: 0; font-size: 12px; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 4px; }
#pick-draw { border: 2px dashed #ffd34d; inset: auto; pointer-events: none; }

.pick-shot { color: var(--mute); font-size: 12px; }
.pick-opt { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--mute); }
.pick-opt input[type=number] { width: 52px; }


/* ---- library ---- */
.library { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #131b2b; }
.library input[type=search] { width: 100%; margin: 8px 0 4px; }
.lib-strip { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 4px; }
.lib-strip button { flex: none; width: 62px; height: 70px; padding: 2px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 9.5px; color: var(--mute); background: #0f1624; border-radius: 9px; overflow: hidden; }
.lib-strip button img { width: 54px; height: 54px; object-fit: contain; }
.lib-strip button span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.lib-cat h4 { margin: 8px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); }
.lib-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.lib-tabs button { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: transparent; color: var(--mute); }
.lib-tabs button b { font-weight: 500; opacity: .6; margin-left: 3px; }
.lib-tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lib-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.lib-tools .toggle { margin: 0; font-size: 11px; flex: 1; }
.lib-tools select { font-size: 11px; padding: 2px 4px; }
.lib-item { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 1px 8px; width: 100%; text-align: left;
  padding: 4px 8px 4px 4px; font-size: 12px; background: #162034; }
.lib-item img { grid-row: span 2; width: 40px; height: 40px; object-fit: contain; background: #0d1422; border-radius: 7px; }
.lib-item .nm { overflow-wrap: anywhere; line-height: 1.25; }
.lib-item .meta { display: flex; gap: 5px; align-items: center; color: var(--mute); font-size: 10.5px; }
.lib-item .q { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.lib-item .q.hi { background: var(--ok); } .lib-item .q.mid { background: #ecc94b; } .lib-item .q.lo { background: #e07a5f; }
.lib-item .src { border: 1px solid var(--line2); border-radius: 4px; padding: 0 3px; font-size: 9.5px; letter-spacing: .03em; }
.lib-item .cat { grid-column: 2 / -1; color: var(--mute); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-item.added { border-color: var(--accent); }
.lib-item.added .nm::before { content: "✓ "; color: var(--accent2); }
.lib-item.previewing { background: #1d2a44; }
.lib-preview { position: relative; margin: 8px 0 2px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #1e2840, #0b1019); }
.lib-preview canvas { display: block; width: 100%; height: 150px; }
.lib-pinfo { position: absolute; left: 8px; bottom: 6px; right: 8px; pointer-events: none; display: flex; flex-direction: column; }
.lib-pinfo strong { font-size: 12px; } .lib-pinfo small { color: var(--mute); font-size: 10.5px; }

/* ---- gait editor ---- */
.gait { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #131b2b; }
.gait-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gait-presets button { font-size: 12px; padding: 3px 9px; }
.gait-presets button.active { border-color: var(--accent); color: var(--accent2); }
.gait-row { display: grid; grid-template-columns: 92px 1fr 48px; align-items: center; gap: 8px; font-size: 12px; margin: 3px 0; }
.gait-row output { text-align: right; color: var(--mute); font-variant-numeric: tabular-nums; }
.gait-row.changed span, .gait-row.changed output { color: var(--accent2); }
.gait-actions { display: flex; gap: 6px; margin-top: 8px; }
.gait-actions input { flex: 1; min-width: 0; }
.gait-actions button.primary { width: auto; margin: 0; padding: 7px 10px; }
.engine-row button { flex: 1; }
.mocap-btns { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6px; }
.mocap-btns .drop.small { padding: 9px 6px; }
.mocap-btns #btn-cam { white-space: nowrap; }

#axes { position: absolute; left: 10px; top: 54px; width: 84px; height: 84px; pointer-events: none; z-index: 5; }
.select { flex-wrap: wrap; } .select select { min-width: 0; max-width: 100%; }
.tl-transport button.play { font-size: 10px; letter-spacing: -2px; }

/* collapsible side panels + centred load button */
.side-toggle { position: absolute; top: 12px; z-index: 8; width: 36px; height: 36px; padding: 0; border-radius: 11px; font-size: 16px;
  background: rgba(13, 19, 31, .78); border: 1px solid var(--line2); backdrop-filter: blur(8px); color: #c7d0df; }
.side-toggle.left { left: 12px; } .side-toggle.right { right: 12px; }
.side-toggle.on { border-color: var(--accent); color: var(--accent2); }
body:not(.left-collapsed) #axes { left: 10px; }
.side-toggle.left ~ #axes { top: 56px; }
.viewbar { right: 12px; top: 64px; }
.hero-row { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; display: flex; gap: 14px; }
.hero-row[hidden] { display: none; }
.hero { position: relative; width: 300px; z-index: 6; display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 26px 40px; border-radius: 20px; color: var(--text);
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35); transition: background .15s, border-color .15s, transform .15s; }
.hero:hover, .hero.over { background: rgba(47, 140, 255, 0.10); border-color: rgba(90, 168, 255, .6); transform: scale(1.02); }
.hero.off { opacity: .55; }
.hero .hero-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: rgba(47, 140, 255, .18); border: 1px solid rgba(90, 168, 255, .45); }
.hero strong { font-size: 17px; font-weight: 650; }
.hero small { color: var(--mute); font-size: 11.5px; }
.toast { position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 10px); max-width: 70%; padding: 8px 14px; border-radius: 12px;
  background: rgba(13, 19, 31, .9); border: 1px solid var(--line2); font-size: 12.5px; color: #c7d0df; z-index: 9; opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--warn); color: var(--warn); }
.top-tools { background: none; border: none; backdrop-filter: none; padding: 0; }
.top-tools > * { background: rgba(13, 19, 31, .7); border: 1px solid var(--line2); border-radius: 10px; padding: 4px 8px; backdrop-filter: blur(8px); }
.top-tools button.icon { padding: 0; border: 1px solid var(--line2); background: rgba(13, 19, 31, .7); }
@media (max-width: 1500px) { body:not(.left-collapsed):not(.right-collapsed) .modes button { padding: 7px 14px; } }

/* Model workspace: the tools panel floats over the view (prebuilt avatars at hand) */
body.tab-model { --lw: 0px; }
body.tab-model #panel { position: fixed; left: 12px; top: 58px; bottom: 12px; width: 330px; z-index: 20; border: 1px solid var(--line2);
  border-radius: 18px; box-shadow: 0 18px 60px rgba(0, 0, 0, .55); background: rgba(14, 20, 32, .9); backdrop-filter: blur(14px); }
body.tab-model.left-collapsed #panel { visibility: hidden; }
body.tab-model .side-toggle.left { z-index: 21; }
.avatars h2 small { color: var(--mute); font-weight: 400; }
.av-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.av-card { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; border-radius: 12px; background: #0f1624;
  text-align: center; font-size: 11.5px; }
.av-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; border-radius: 9px;
  background: radial-gradient(ellipse at 50% 35%, #223049, #0d1320); }
.av-card b { font-weight: 600; } .av-card small { color: var(--mute); font-size: 10px; }
.av-card.loading { border-color: var(--accent); } .av-card.loading img { opacity: .5; }
/* modeling overlay */
.modeling { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #0b0f16; }
.modeling[hidden] { display: none; }
.modeling header { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.modeling header strong span { color: var(--mute); font-weight: 500; }
.modeling .mod-msg { flex: 1; color: var(--mute); font-size: 12px; }
.modeling .mod-msg.error { color: var(--warn); }
.modeling header button.accent { padding: 8px 14px; font-weight: 650; }
.modeling iframe { flex: 1; width: 100%; border: 0; background: #0b0f16; }
/* fixed grid slots: the floating panel (Model workspace) leaves the flow without shifting the view */
#panel { grid-column: 1; grid-row: 1; } #view { grid-column: 2; grid-row: 1; } .inspector { grid-column: 3; grid-row: 1; }
body { grid-template-rows: 100vh; }
.modeling iframe[hidden] { display: none; }

/* ---------- Cinematic mode ---------- */
.cine h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cine h2 .cine-on { margin: 0; font-weight: 500; text-transform: none; letter-spacing: 0; }
.cine .row2 .select { flex: 1; min-width: 0; }
.cine .hint { margin: 6px 0 0; }
.cine-prog { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 11.5px; color: #b8c3d6; flex-wrap: wrap; }
.cine-prog[hidden] { display: none; }
.cine-prog .bar { flex: 1 1 100%; height: 5px; border-radius: 3px; background: #1a2438; overflow: hidden; }
.cine-prog .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .15s; }
.cine-prog span { flex: 1; }
.cine-prog button.tiny { width: auto; margin: 0; padding: 3px 10px; }
#cine-msg:empty { display: none; }

/* ---------- Cinematic: sets ---------- */
#cine-set textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 58px; font: inherit; font-size: 12px; color: var(--text);
  background: #0f1624; border: 1px solid var(--line2); border-radius: 9px; padding: 8px; }
#cine-set textarea:focus { outline: none; border-color: var(--accent); }
.set-now { margin: 0 0 6px; font-size: 11.5px; color: var(--mute); } .set-now b { color: var(--text); font-weight: 600; }
.set-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.set-chips button { padding: 3px 8px; font-size: 11px; border-radius: 999px; background: #172133; }
#cine-set h2 button.tiny { width: auto; margin: 0; padding: 2px 8px; font-size: 11px; }
#set-msg.err { color: var(--warn); }
#set-place.on { border-color: var(--accent); color: var(--accent2); }
#set-ai-state { display: block; margin: 0 0 4px; }
/* the Scene Studio page stays loaded off-screen while it builds a set from text */
.modeling.offscreen { visibility: hidden; pointer-events: none; left: -200vw; right: auto; width: 100vw; }

/* ---------- Virtuax Studio brand + account ---------- */
.vx-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.vx-brand img { width: 28px; height: 28px; object-fit: contain; }
.vx-brand h1 { margin: 0; font-family: Sora, Inter, sans-serif; font-weight: 650; letter-spacing: -.01em; }
.vx-acct { position: relative; display: flex; align-items: center; margin-left: 4px; }
.vx-signin { padding: 5px 12px; border-radius: 9px; background: #f2f3f5; color: #0b0c0e; border: 0; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.vx-me { width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 1px solid var(--line2); background: #1b2436; color: #fff; cursor: pointer; }
.vx-me i { font-style: normal; font-weight: 650; font-size: 12.5px; }
.vx-menu { position: absolute; right: 0; top: 36px; min-width: 210px; display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: #0f1624; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.45); z-index: 20; }
.vx-menu[hidden] { display: none; }
.vx-menu b { font-size: 12px; font-weight: 500; color: var(--mute); word-break: break-all; }
.vx-menu button { width: 100%; }
