/* ==========================================================================
   Editor frame (0.2): top bar · project tree | page · status bar (with popovers for jobs and requests),
   and Tess's chat as a window (floating, docked right, or closed to a launcher). Laid out by shell.js.
   Loaded after styles.css, so these rules win where both style the same thing.
   ========================================================================== */
:root { --topbar-h: 44px; --status-h: 26px; --ui: 13px; }
body { display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--status-h); height: 100vh; overflow: hidden; }
body.resizing { user-select: none; }
body.resizing-h, body.resizing-h * { cursor: col-resize !important; }
body.resizing-v, body.resizing-v * { cursor: row-resize !important; }

.icon-btn.ghosted { background: transparent; border-color: transparent; color: var(--faint); width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.ghosted:hover:not(:disabled) { background: rgba(255, 255, 255, .05); color: var(--text); }
.icon-btn.ghosted:disabled { opacity: .35; cursor: default; }
.icon-btn.ghosted.on { color: var(--brand-hi); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 15px; height: 15px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; border-bottom: 1px solid var(--line); background: #0a0a0d; min-width: 0; position: relative; z-index: 6; }
.topbar .app-brand { padding: 4px; border-radius: 8px; flex: none; }
.topbar .app-brand:hover { background: rgba(255, 255, 255, .05); }
.topbar .app-mark { width: 24px; filter: drop-shadow(0 2px 8px rgba(157, 92, 255, .35)); }
.topbar .project-picker { align-items: center; gap: 2px; flex: none; }
.topbar .project-btn { border: 0; background: transparent; padding: 5px 6px 5px 8px; font-size: var(--ui); max-width: 200px; }
.topbar .project-btn:hover { background: rgba(255, 255, 255, .05); }
.topbar .project-btn svg { stroke: var(--faint); width: 14px; height: 14px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; flex: none; }
.topbar .back-btn { padding: 0; gap: 0; border-color: transparent; }
.topbar .crumbs { flex: 1; font-size: var(--ui); gap: 6px; }
.topbar .crumbs strong { font-weight: 500; }
.topbar .head-actions { align-items: center; gap: 2px; flex: none; }
.topbar .palette-btn { height: 28px; min-width: 210px; margin-right: 4px; font-size: 13px; background: rgba(255, 255, 255, .03); }
.topbar .palette-btn span { flex: 1; text-align: left; }
.topbar .palette-btn kbd { font-size: 11px; padding: 1px 5px; }
@media (max-width: 1180px) { .topbar .palette-btn { min-width: 0; } .topbar .palette-btn span { display: none; } }

/* ---------- workbench: the editor, and the docked chat to its right ---------- */
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; position: relative; }
.shell#studio {
  --tree-w: 248px;
  display: grid; gap: 0; padding: 0; height: auto; min-height: 0; min-width: 0;
  grid-template-columns: var(--tree-w) 1px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
/* The tree and its splitter are display:none here, so the page is the only grid item: one full-width column. */
.shell#studio.no-tree { grid-template-columns: minmax(0, 1fr); }
.shell#studio.no-tree > .sections, .shell#studio.no-tree > [data-resizer="tree"] { display: none; }
.shell#studio > .sections { border-right: 0; background: #0b0b0e; padding: 12px 8px; min-height: 0; }
.shell#studio > .content { background: var(--panel); min-height: 0; }

.split { position: relative; background: var(--line); z-index: 3; }
.split::after { content: ""; position: absolute; inset: 0 -3px; transition: background .15s; }
.split-v { cursor: col-resize; }
.split:hover::after, .split:active::after { background: var(--brand-line); }

/* project tree: denser, like an engine's */
.shell#studio .proj-card { padding: 4px 8px 14px; gap: 10px; }
.shell#studio .proj-badge { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }
.shell#studio .proj-card strong { font-size: 13px; }
.shell#studio .proj-card small { font-size: 12px; -webkit-line-clamp: 1; }
.shell#studio .sec { padding: 6px 8px; font-size: var(--ui); border-radius: 8px; gap: 8px; align-items: center; }
.shell#studio .sec.active { background: var(--brand-soft); border-color: transparent; }
.shell#studio .sec-label { padding: 12px 8px 6px; font-size: 11px; }
.shell#studio .sub-item { font-size: 13px; }
.shell#studio .sec .sec-count { margin-left: auto; font: 11px var(--mono); color: var(--faint); }
.shell#studio .sec .sec-miss { font: 600 10px var(--mono); color: #fda4af; background: rgba(244, 63, 94, .1); border-radius: 4px; padding: 0 4px; }

/* type badges */
.tbadge { display: inline-flex; align-items: center; height: 17px; padding: 0 5px; border-radius: 4px; font: 600 10px var(--mono); letter-spacing: .06em; color: var(--muted); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .06); }
.tbadge.t-3d { color: #5eead4; background: rgba(45, 212, 191, .1); border-color: rgba(45, 212, 191, .2); }
.tbadge.t-rig, .tbadge.t-anim { color: #c4b5fd; background: rgba(157, 92, 255, .12); border-color: rgba(157, 92, 255, .25); }
.tbadge.t-sfx { color: #7dd3fc; background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .2); }
.tbadge.t-2d { color: #fcd34d; background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .2); }
.tbadge.t-missing { color: #fda4af; background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .22); }

.job-list, .req-list { list-style: none; margin: 0; padding: 4px 0; }
.job-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: center; padding: 6px 12px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.job-list li .what { min-width: 0; display: flex; flex-direction: column; }
.job-list li .what button { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); background: none; border: 0; padding: 0; }
.job-list li .what button:hover { color: var(--brand-hi); }
.job-list li small, .req-list li small { color: var(--faint); font: 11px var(--mono); }
.job-list li .err { color: #fda4af; font-size: 12px; white-space: normal; }
.job-list .state { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); justify-self: center; }
.job-list .state.running { background: none; border: 2px solid rgba(157, 92, 255, .3); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.job-list .state.queued { background: none; border: 1.5px dashed var(--faint); }
.job-list .state.done { background: var(--ok); }
.job-list .state.failed { background: var(--bad); }
.req-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 12px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.req-list li .box { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid var(--faint); }
.req-list li.done { color: var(--faint); }
.req-list li.done .txt { text-decoration: line-through; }
.req-list li.done .box { background: var(--ok); border-color: var(--ok); }

/* ---------- status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 2px; padding: 0 6px; border-top: 1px solid var(--line); background: #08080a; font: 12px var(--sans); color: var(--faint); min-width: 0; overflow: hidden; z-index: 6; }
.statusbar .sb { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; border: 0; background: none; color: inherit; white-space: nowrap; font: inherit; }
.statusbar button.sb:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.statusbar .sb svg { width: 13px; height: 13px; }
.statusbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.statusbar .dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(52, 211, 153, .5); }
.statusbar .dot.busy { background: var(--brand); box-shadow: 0 0 8px rgba(157, 92, 255, .7); animation: pulse-dot 1.2s ease-in-out infinite; }
.statusbar .dot.warn { background: #f59e0b; }
.statusbar .grow { flex: 1; }
.statusbar .num { font-family: var(--mono); color: var(--muted); }
.statusbar .miss .num { color: #fda4af; }
@keyframes pulse-dot { 50% { opacity: .35; } }

/* ---------- Tess's chat window ---------- */
.panel.chat#chatWin { border-radius: 0; border: 0; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; overflow: hidden; }
.panel.chat#chatWin[hidden] { display: none; }
#chatWin.docked { position: relative; width: var(--dock-w, 400px); grid-column: 2; grid-row: 1; overflow: visible; }
#chatWin.docked > :not(.rz) { min-width: 0; }
#chatWin.floating { position: fixed; z-index: 15; border: 1px solid var(--line-strong); border-radius: 14px; overflow: visible; box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(157, 92, 255, .08); animation: chat-pop .18s ease; }
#chatWin.floating > .chat-head { border-radius: 14px 14px 0 0; }
#chatWin.floating.dragging { opacity: .97; box-shadow: 0 40px 100px rgba(0, 0, 0, .7), 0 0 0 1px rgba(157, 92, 255, .25); }
#chatWin.sheet { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 15; border: 0; border-top: 1px solid var(--line); animation: sheet-up .2s ease; }
@keyframes chat-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
#chatWin .chat-head { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .015); justify-content: flex-start; }
#chatWin.floating .chat-head { cursor: grab; user-select: none; }
#chatWin.floating.dragging .chat-head { cursor: grabbing; }
.chat-face { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(157, 92, 255, .5), 0 0 14px rgba(157, 92, 255, .25); }
body.tess-busy .chat-face { animation: tess-pulse 1.6s ease-in-out infinite; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chat-title strong { font-size: 13px; }
.chat-title small { font-size: 11px; color: var(--faint); }
body.tess-busy .chat-title small::before { content: "Working · "; color: var(--brand-hi); }
#chatWin .rz { position: absolute; z-index: 4; display: none; }
#chatWin.floating .rz { display: block; }
#chatWin.docked .rz-w { display: block; }
.rz-n, .rz-s { left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.rz-n { top: -3px; } .rz-s { bottom: -3px; }
.rz-e, .rz-w { top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.rz-e { right: -3px; } .rz-w { left: -3px; }
#chatWin.docked .rz-w { top: 0; bottom: 0; }
#chatWin.docked .rz-w:hover { background: var(--brand-line); }
.rz-nw, .rz-ne, .rz-sw, .rz-se { width: 12px; height: 12px; }
.rz-nw { top: -3px; left: -3px; cursor: nwse-resize; } .rz-se { bottom: -3px; right: -3px; cursor: nwse-resize; }
.rz-ne { top: -3px; right: -3px; cursor: nesw-resize; } .rz-sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
body.chat-off #chatWin, body.chat-off #chatLauncher { display: none !important; }
/* The model list opens downward when the window sits near the top of the screen. */
#chatWin .model-pop.down { bottom: auto; top: calc(100% + 8px); }

/* the launcher pill */
.chat-launcher { position: fixed; right: 18px; bottom: calc(var(--status-h) + 14px); z-index: 14; display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px 0 5px; border-radius: 999px; border: 1px solid rgba(157, 92, 255, .35); background: #120f19; color: var(--text); font-size: 13px; font-weight: 600; box-shadow: 0 12px 36px rgba(0, 0, 0, .5), 0 0 24px rgba(157, 92, 255, .12); transition: transform .15s, border-color .15s; animation: chat-pop .2s ease; }
.chat-launcher[hidden] { display: none; }
.chat-launcher:hover { transform: translateY(-2px); border-color: rgba(157, 92, 255, .6); }
.chat-launcher img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.chat-launcher kbd { font-size: 11px; padding: 1px 6px; color: var(--faint); border-color: var(--line); background: none; }
.chat-launcher .count:empty { display: none; }
.chat-launcher .count { position: absolute; top: -4px; left: 26px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font: 700 11px/18px var(--mono); text-align: center; box-shadow: 0 0 0 2px #08080a; }
.chat-launcher.busy img { animation: tess-pulse 1.6s ease-in-out infinite; }
.chat-launcher.busy::after { content: ""; position: absolute; top: 3px; left: 29px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px #08080a, 0 0 10px var(--brand); }
/* leave room under the last row so the pill never covers its buttons */
body:has(#chatLauncher:not([hidden])) .content { padding-bottom: 96px; }

/* the old floating job dock is replaced by the status bar's Jobs popover */
.job-dock { display: none !important; }

/* ---------- gallery mode: only the art ---------- */
body.gallery-mode .shell#studio { grid-template-columns: minmax(0, 1fr); }
body.gallery-mode .shell#studio > :is(.sections, .split) { display: none; }
body.gallery-mode .asset-rail { display: none; }
body.gallery-mode #chatWin, body.gallery-mode #chatLauncher { display: none !important; }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 900px) {
  .shell#studio, .shell#studio.no-tree { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .shell#studio > .split { display: none !important; }
  .shell#studio > .sections { display: flex !important; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .topbar .region-btn, .topbar .tb-sep, .topbar #galleryBtn, .topbar .crumbs { display: none; }
  .topbar .head-actions { margin-left: auto; }
  .statusbar .sb.wide { display: none; }
  .statusbar { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .statusbar::-webkit-scrollbar { display: none; }
  .statusbar .sb { flex: none; }
  .shell#studio > .sections { overflow-x: auto; scrollbar-width: none; }
  .shell#studio > .sections::-webkit-scrollbar { display: none; }
  .chat-launcher span:not(.count), .chat-launcher kbd { display: none; }
  .chat-launcher { padding: 0 5px; }
  #chatDockBtn { display: none; }
}
@media (prefers-reduced-motion: reduce) { #chatWin.floating, #chatWin.sheet, .chat-launcher { animation: none; } }

/* keyboard focus on a tile */
.asset-tile:focus-visible { outline: none; }
.asset-tile:focus-visible .asset-img { outline: 2px solid var(--brand-hi); outline-offset: 2px; }

/* ---------- asset rail: a filmstrip of the asset's folder, across the top of its page ---------- */
.asset-rail {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  margin: -4px 0 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px;
  background: #0f0f13;
}
.rail-track { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px; }
.rail-track::-webkit-scrollbar { display: none; }
.rail-item {
  position: relative; flex: none; width: 40px; height: 40px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2); opacity: .55;
  transition: opacity .12s, border-color .12s;
}
.rail-item:hover { opacity: 1; }
.rail-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.rail-item.current { opacity: 1; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 0 14px rgba(157, 92, 255, .35); }
.rail-item.missing::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn, #f59e0b); box-shadow: 0 0 0 1.5px var(--panel); }
.rail-none { display: grid; place-items: center; width: 100%; height: 100%; color: var(--faint); font: 600 11px var(--mono); text-transform: uppercase; }
.rail-none svg { width: 14px; height: 14px; }
.rail-step { flex: none; display: grid; place-items: center; width: 28px; height: 40px; border-radius: 8px; border: 0; background: none; color: var(--muted); }
.rail-step:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.rail-step:disabled { opacity: .25; }
.rail-step svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail-pos { flex: none; display: flex; flex-direction: column; align-items: flex-end; padding: 0 6px 0 4px; font: 11px var(--mono); color: var(--faint); line-height: 1.35; }
.rail-pos b { color: var(--text); font-weight: 600; }
.rail-folder { font: 11px var(--sans, inherit); color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .rail-pos { display: none; } .rail-item { width: 34px; height: 34px; } .rail-step { height: 34px; } }

/* ---------- status bar popovers ---------- */
.sb-pop {
  position: fixed; bottom: calc(var(--status-h) + 8px); z-index: 60; width: min(380px, calc(100vw - 16px)); max-height: min(60vh, 480px);
  overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #131318; box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  animation: pop-in .16s cubic-bezier(.2, .8, .2, 1);
}
.sb-pop[hidden] { display: none; }
.pop-head { position: sticky; top: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px 8px; font-weight: 600; font-size: 13px; background: inherit; border-bottom: 1px solid var(--line-soft, var(--line)); }
.pop-head small { color: var(--faint); font: 11px var(--mono); font-weight: 400; }
.pop-empty { margin: 0; padding: 14px 12px 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sb-pop .job-list li:last-child, .sb-pop .req-list li:last-child { border-bottom: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- page transitions: the page cross-fades, the clicked picture flies into the hero ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(asset-hero) { animation-duration: .26s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); z-index: 50; }
::view-transition-old(asset-hero), ::view-transition-new(asset-hero) { height: 100%; object-fit: contain; overflow: clip; }
@media (prefers-reduced-motion: reduce) { .sb-pop { animation: none; } ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ---------- folder grid: filter chips, sort, thumbnail size ---------- */
.asset-grid[data-grid] { grid-template-columns: repeat(auto-fill, minmax(var(--tile, 150px), 1fr)); }
.asset-tile.filtered-out { display: none; }
.grid-none { grid-column: 1 / -1; order: 100000; margin: 6px 0; color: var(--muted); font-size: 13px; }
.grid-none .link-btn { color: var(--brand-hi); }
.grid-bar { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; min-height: 30px; flex-wrap: wrap; }
.grid-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.gchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 12px; transition: color .15s, background .15s, border-color .15s; }
.gchip span { font: 11px var(--mono); color: var(--faint); }
.gchip:hover { color: var(--text); border-color: var(--line-strong); }
.gchip.on { color: var(--text); background: var(--brand-soft); border-color: var(--brand-line); }
.gchip.on span { color: var(--brand-hi); }
.grid-bar .grow { flex: 1; }
.grid-sort, .grid-size { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.grid-sort svg, .grid-size svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.grid-sort select { height: 26px; padding: 0 6px; font-size: 12px; background: none; border-color: transparent; color: var(--muted); }
.grid-sort select:hover, .grid-sort select:focus { border-color: var(--line); color: var(--text); }
.grid-size input { width: 96px; accent-color: var(--brand); }
.nowin-dot { display: inline-block; width: 6px; height: 6px; margin: 0 6px 2px 0; border-radius: 50%; background: var(--warn, #f59e0b); vertical-align: middle; }
@media (max-width: 900px) { .grid-size { display: none; } .asset-grid[data-grid] { grid-template-columns: repeat(auto-fill, minmax(min(var(--tile, 150px), 140px), 1fr)); } }

/* ---------- quick look ---------- */
.quick-look { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 32px; background: rgba(4, 4, 6, .86); animation: ql-fade .14s ease; }
.quick-look[hidden] { display: none; }
.ql-card { display: flex; flex-direction: column; width: min(880px, 100%); max-height: 100%; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); box-shadow: 0 40px 100px rgba(0, 0, 0, .6); animation: ql-pop .2s cubic-bezier(.2, .8, .2, 1); }
.ql-stage { position: relative; display: grid; place-items: center; min-height: 0; flex: 1; background: radial-gradient(ellipse at 50% 40%, #1a1a22, #0b0b0e 70%); }
.ql-stage img { max-width: 100%; max-height: calc(100vh - 160px); object-fit: contain; display: block; }
.ql-none { padding: 80px; color: var(--faint); }
.ql-nav { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(14, 14, 18, .8); color: var(--text); }
.ql-nav.prev { left: 12px; } .ql-nav.next { right: 12px; }
.ql-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ql-nav:hover { border-color: var(--brand-line); }
.ql-foot { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); }
.ql-name { display: flex; flex-direction: column; min-width: 0; }
.ql-name strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-name small { color: var(--faint); font: 11px var(--mono); }
.ql-foot audio { height: 32px; max-width: 260px; }
.ql-keys { color: var(--faint); font-size: 12px; white-space: nowrap; }
.ql-keys kbd, .ql-foot .primary kbd { font: 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); margin-right: 2px; }
.ql-foot .primary kbd { border-color: rgba(255, 255, 255, .25); margin: 0 0 0 4px; }
@keyframes ql-fade { from { opacity: 0; } }
@keyframes ql-pop { from { opacity: 0; transform: scale(.97); } }
@media (max-width: 900px) { .quick-look { padding: 12px; } .ql-keys { display: none; } }
@media (prefers-reduced-motion: reduce) { .quick-look, .ql-card { animation: none; } }

/* ---------- tile menu, move dialog, drag targets ---------- */
.tile-menu { position: fixed; z-index: 80; min-width: 230px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #15151b; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); animation: pop-in .1s ease; }
.tile-menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 13px; text-align: left; }
.tile-menu button:hover, .tile-menu button:focus-visible { background: var(--brand-soft); outline: none; }
.tile-menu button.danger { color: #fda4af; }
.tile-menu button.danger:hover { background: rgba(244, 63, 94, .12); }
.tile-menu kbd { font: 11px var(--mono); color: var(--faint); border: 0; background: none; }
.tile-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.move-dlg .move-list { max-height: 50vh; overflow: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; }
.move-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; color: var(--text); font-size: 13px; text-align: left; }
.move-row:hover { background: var(--brand-soft); }
.move-row svg { width: 14px; height: 14px; flex: none; color: var(--faint); }
.move-row small { margin-left: auto; color: var(--faint); font: 11px var(--mono); }
.move-row[hidden] { display: none; }
body.dragging-asset #sections [data-folder] { outline: 1px dashed transparent; }
.drop-target { background: var(--brand-soft) !important; outline: 1px solid var(--brand) !important; border-radius: 8px; }

/* ---------- 3D viewer: toolbar over the stage, timeline under it ---------- */
.viewer-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vbar { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.vbar > * { pointer-events: auto; }
.vgrow { flex: 1; }
.vseg { display: inline-flex; padding: 2px; border-radius: 8px; background: rgba(12, 12, 16, .85); border: 1px solid var(--line); }
.vseg button { height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12px; }
.vseg button:hover { color: var(--text); }
.vseg button.on { background: var(--brand-soft); color: var(--text); }
.vtog { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); background: rgba(12, 12, 16, .85); color: var(--muted); font: 600 12px var(--mono); }
.vtog:hover { color: var(--text); }
.vtog.on { color: var(--text); border-color: var(--brand-line); background: var(--brand-soft); }
.vtog svg, .vt-play svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vt { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-size: 12px; }
.vt[hidden] { display: none; }
.vt-play { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; flex: none; }
.vt-step { width: 24px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted); font-size: 15px; line-height: 1; flex: none; }
.vt-step:hover { color: var(--text); }
.vt-scrub { flex: 1; min-width: 80px; accent-color: var(--brand); }
.vt-time { font: 11px var(--mono); color: var(--faint); white-space: nowrap; }
.vt-time b { color: var(--text); font-weight: 500; }
.vt select { height: 26px; padding: 0 4px; font-size: 12px; }
.vt-inplace { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.viewer-warn { border: 1px solid rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .08); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: #fcd34d; }
.viewer-warn p { margin: 2px 0; }
.bone-tree summary { cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.bone-tree summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bone-tree ul { list-style: none; margin: 6px 0 0; padding: 4px 0; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; font: 12px var(--mono); }
.bone-tree li { padding: 3px 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.bone-tree li:hover { background: rgba(251, 191, 36, .1); color: #fde68a; }
@media (max-width: 820px) { .vt-inplace, .vt-speed { display: none; } .vseg[data-vseg="cam"] { display: none; } }

/* ---------- Pixel Studio ---------- */
.sprite-block { margin-top: 28px; }
.sprite-sets { display: flex; gap: 12px; flex-wrap: wrap; }
.sprite-card { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); text-align: left; }
.sprite-card:hover { border-color: var(--brand-line); }
.sprite-card canvas { width: 72px; height: 72px; image-rendering: pixelated; border-radius: 8px; background: repeating-conic-gradient(#1c1c22 0 25%, #17171c 0 50%) 0 0 / 12px 12px; }
.sprite-card span { display: flex; flex-direction: column; gap: 2px; }
.sprite-card small { color: var(--faint); font: 11px var(--mono); }
.sprite-card.add { border-style: dashed; background: none; }
.sprite-card.add svg { width: 28px; height: 28px; margin: 0 8px; fill: none; stroke: var(--faint); stroke-width: 1.6; }
.sprite-src { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.sprite-src label, .sprite-src button { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); aspect-ratio: 1; cursor: pointer; }
.sprite-src img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sprite-src input { position: absolute; opacity: 0; }
.sprite-src label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.sprite-src button:hover { border-color: var(--brand-line); }
.sprite-new .sprite-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.sprite-new .sprite-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.sprite-new .sprite-form label.check { flex-direction: row; align-items: center; gap: 6px; }
dialog:has(.pixel-dlg) { width: min(1240px, calc(100vw - 24px)); }
.pixel-dlg { padding: 16px; }
.px-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr) 230px; gap: 14px; }
.px-side, .px-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-height: 72vh; overflow: auto; }
.px-list { display: flex; flex-direction: column; gap: 2px; }
.px-list button { display: flex; justify-content: space-between; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; text-align: left; }
.px-list button.on, .px-list button:hover { background: var(--brand-soft); color: var(--text); }
.px-list small { font: 11px var(--mono); color: var(--faint); }
.px-dirs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 120px; }
.px-dirs button { height: 26px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--faint); font: 600 11px var(--mono); }
.px-dirs button.has { color: var(--text); }
.px-dirs button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.px-animset { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.px-animset input[type=number] { width: 52px; }
.danger-link { color: #fda4af !important; font-size: 12px; }
.px-pal { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.px-pal button { aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .08); border-radius: 4px; padding: 0; }
.px-pal button.on { outline: 2px solid #fff; outline-offset: 1px; }
.px-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.px-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.px-tools .primary { height: 30px; padding: 0 14px; }
.px-stage { display: grid; place-items: center; min-height: 300px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #0b0b0e; overflow: auto; }
.px-stage canvas { image-rendering: pixelated; cursor: crosshair; touch-action: none; max-width: 100%; }
.px-strip { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding-bottom: 2px; }
.px-frame { position: relative; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #111115; }
.px-frame.on { border-color: var(--brand); }
.px-frame canvas { display: block; width: 48px; height: 48px; image-rendering: pixelated; }
.px-frame small { position: absolute; right: 4px; bottom: 2px; font: 10px var(--mono); color: var(--faint); }
.px-frame-ops { display: flex; gap: 4px; flex: none; margin-left: 6px; }
.px-preview { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: repeating-conic-gradient(#1c1c22 0 25%, #17171c 0 50%) 0 0 / 16px 16px; }
.px-preview canvas { width: 70%; height: 70%; image-rendering: pixelated; }
#pxPrevCtl { display: flex; align-items: center; gap: 8px; color: var(--faint); font: 11px var(--mono); }
.px-gen { display: flex; flex-direction: column; gap: 6px; }
.px-gen label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.px-gen select { max-width: 120px; }
.px-pick .sprite-src { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .px-layout { grid-template-columns: 1fr; } .px-side, .px-right { max-height: none; } }

/* ---------- Pixel Studio page ---------- */
.px-home, .px-page { --tone: #8f80ff; --tone-rgb: 143, 128, 255; }
.new-pill { margin-left: auto; padding: 1px 6px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font: 700 10px var(--mono); letter-spacing: .06em; }
.px-home { display: flex; flex-direction: column; gap: 28px; max-width: 1240px; margin: 0 auto; }
.px-hero { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; align-items: center; padding: 26px 28px; border: 1px solid var(--line); border-radius: 18px; background: radial-gradient(120% 140% at 0% 0%, rgba(var(--tone-rgb), .16), transparent 55%), var(--panel-2); }
.px-hero-art { display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px; background: repeating-conic-gradient(#1c1c22 0 25%, #17171c 0 50%) 0 0 / 18px 18px; border: 1px solid var(--line); }
.px-hero-art canvas { width: 82%; height: 82%; image-rendering: pixelated; }
.px-hero-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 70%; }
.px-hero-grid i { aspect-ratio: 1; border-radius: 2px; background: rgba(var(--tone-rgb), .2); }
.px-hero-grid i:nth-child(3n) { background: rgba(var(--tone-rgb), .55); }
.px-hero-grid i:nth-child(7n) { background: #ffd36e; }
.px-hero-copy .eyebrow { display: inline-flex; gap: 6px; align-items: center; color: var(--brand); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.px-hero-copy .eyebrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.px-hero-copy h1 { margin: 8px 0 8px; font-size: 28px; letter-spacing: -.02em; }
.px-hero-copy p { margin: 0; max-width: 62ch; color: var(--muted); line-height: 1.55; }
.px-steps { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.px-steps li { display: flex; align-items: center; gap: 8px; }
.px-steps b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(var(--tone-rgb), .18); color: var(--text); font: 700 11px var(--mono); }
.px-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 16px; }
.px-new-pick, .px-new-opts { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); min-width: 0; }
.px-new-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.px-new-head h2 { margin: 0; font-size: 16px; white-space: nowrap; }
.px-new-head input { width: 100%; max-width: 220px; }
.px-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; max-height: 520px; overflow: auto; padding: 2px; }
.px-pic { display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #111115; color: var(--muted); text-align: left; }
.px-pic[hidden] { display: none; }
.px-pic img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: #0d0d10; }
.px-pic span { padding: 6px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-pic:hover { border-color: var(--brand-line); color: var(--text); }
.px-pic.on { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone); color: var(--text); }
.px-new-opts { display: flex; flex-direction: column; gap: 10px; align-self: start; position: sticky; top: 12px; }
.px-live { display: grid; grid-template-columns: 1fr 28px 1fr; align-items: center; gap: 6px; margin-bottom: 4px; }
.px-live-src, .px-live-out { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: repeating-conic-gradient(#1c1c22 0 25%, #17171c 0 50%) 0 0 / 14px 14px; overflow: hidden; }
.px-live-src img { width: 92%; height: 92%; object-fit: contain; }
.px-live-out img { width: 88%; height: 88%; object-fit: contain; image-rendering: pixelated; transition: opacity .15s; }
.px-live-out.busy img { opacity: .45; }
.px-live-out { border-color: rgba(var(--tone-rgb), .5); }
.px-live-size { position: absolute; right: 6px; bottom: 5px; padding: 1px 5px; border-radius: 6px; background: rgba(0, 0, 0, .6); font: 10px var(--mono); color: var(--muted); }
.px-live-arrow svg { width: 22px; height: 22px; fill: none; stroke: var(--faint); stroke-width: 2; }
.px-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.px-chips .gchip span { opacity: .55; margin-left: 1px; }
.px-pals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.px-palcard { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--text); text-align: left; }
.px-palcard:hover { border-color: var(--brand-line); }
.px-palcard.on { border-color: var(--tone); background: rgba(var(--tone-rgb), .08); }
.px-palcard strong { font-size: 12px; font-weight: 600; }
.px-palcard small { font: 10px var(--mono); color: var(--faint); align-self: center; }
.px-strip-col { grid-column: 1 / -1; display: flex; height: 10px; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.px-strip-col i { flex: 1; }
.px-strip-col i.auto { background: linear-gradient(90deg, #ff6b6b, #ffd36e, #6ee7a8, #6ec6ff, #8f80ff, #ff7ad9); }
.px-make { justify-content: center; margin-top: 6px; padding: 12px 18px; font-size: 14px; }
.px-make[disabled] { opacity: .45; filter: grayscale(.6); }
.px-library .sprite-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
/* editor page */
.px-page { display: flex; flex-direction: column; gap: 14px; }
.px-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.px-back { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--muted); font-size: 13px; flex: none; }
.px-back:hover { color: var(--text); border-color: var(--brand-line); }
.px-back svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.px-libstrip { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; padding: 2px; }
.px-libitem { flex: none; width: 44px; height: 44px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #111115; color: var(--faint); font-size: 18px; }
.px-libitem canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.px-libitem.on { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone); }
.px-libitem.add { border-style: dashed; background: none; }
.px-title { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.px-title strong { font-size: 15px; }
.px-title small { font: 11px var(--mono); color: var(--faint); }
.px-page .px-layout { grid-template-columns: 200px minmax(0, 1fr) 270px; gap: 16px; }
.px-page .px-side, .px-page .px-right { max-height: none; }
.px-page .px-stage { min-height: calc(100vh - 330px); }
.px-page .px-dirs { width: 132px; }
.px-dir-me { display: grid; place-items: center; }
.px-dir-me svg { width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 1.6; }
.px-hint { font-size: 11px; color: var(--faint); }
.px-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); margin-top: 6px; }
.px-card-head { display: flex; align-items: center; gap: 6px; }
.px-card-head svg { width: 15px; height: 15px; fill: none; stroke: var(--brand); stroke-width: 2; }
.px-card-head small { margin-left: auto; font-size: 11px; color: var(--faint); }
.px-gen .run-btn.small { padding: 8px 12px; font-size: 13px; justify-content: center; }
.px-gen .ghost { justify-content: center; }
#pxPrevCtl { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--faint); }

@media (max-width: 640px) { .px-hero { grid-template-columns: 1fr; padding: 18px; } .px-hero-art { width: 120px; } .px-title { display: none; } .px-new-head input { width: 140px; } }
/* Pixel Studio adapts to the content width (the chat may be docked), not the window */
.px-page, .px-home { container-type: inline-size; }
@container (max-width: 1000px) {
  .px-page .px-layout { grid-template-columns: 168px minmax(0, 1fr); }
  .px-page .px-right { grid-column: 1 / -1; display: grid; grid-template-columns: 160px repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .px-page .px-right .px-preview { grid-row: span 2; }
  .px-page #pxPrevCtl { grid-column: 1; }
  .px-page .px-hint { display: none; }
  .px-page .px-stage { min-height: 360px; }
  .px-new { grid-template-columns: 1fr; }
  .px-new-opts { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .px-new-opts .px-live { grid-row: span 6; align-self: start; }
  .px-hero { grid-template-columns: 120px minmax(0, 1fr); padding: 20px; }
}
@container (max-width: 640px) {
  .px-page .px-layout, .px-page .px-right, .px-new-opts { grid-template-columns: 1fr; }
  .px-new-opts .px-live { grid-row: auto; }
  .px-title { display: none; }
}

/* ---------- Make dock (asset page) ---------- */
.make-dock { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.dock-tile { --tone: var(--brand); --tone-rgb: 124, 108, 255; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 80px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(160deg, rgba(var(--tone-rgb), .12), transparent 60%), var(--panel-2); color: var(--text); text-align: left; transition: border-color .12s, transform .12s; }
.dock-tile.tone-amber { --tone: #f59e0b; --tone-rgb: 245, 158, 11; }
.dock-tile.tone-violet { --tone: #2dd4bf; --tone-rgb: 45, 212, 191; }
.dock-tile.tone-sky { --tone: #38bdf8; --tone-rgb: 56, 189, 248; }
.dock-tile.tone-pixel { --tone: #ff7ad9; --tone-rgb: 255, 122, 217; }
.dock-tile svg { width: 22px; height: 22px; margin-bottom: auto; fill: none; stroke: var(--tone); stroke-width: 1.8; }
.dock-tile b { font-size: 13px; margin-top: 10px; }
.dock-tile small { font-size: 11px; line-height: 1.3; color: var(--faint); }
.dock-tile:hover:not(:disabled) { border-color: rgba(var(--tone-rgb), .6); transform: translateY(-1px); }
.dock-tile:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Generate composer ---------- */
dialog:has(.sheet.composer) { width: min(1120px, calc(100vw - 32px)); }
.sheet.tone-pixel { --tone: #ff7ad9; --tone-rgb: 255, 122, 217; }
.composer .cmp-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(var(--tone-rgb), .14), transparent 60%); }
.cmp-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); overflow-x: auto; }
.cmp-tab { --c: var(--brand); display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cmp-tab.tone-amber { --c: #f59e0b; } .cmp-tab.tone-violet { --c: #2dd4bf; } .cmp-tab.tone-sky { --c: #38bdf8; } .cmp-tab.tone-pixel { --c: #ff7ad9; }
.cmp-tab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.cmp-tab:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .04); }
.cmp-tab.on { color: #09090b; background: var(--c); }
.cmp-tab:disabled { opacity: .35; }
.cmp-title { display: flex; align-items: center; gap: 10px; }
.cmp-title .sheet-icon { width: 34px; height: 34px; border-radius: 10px; }
.cmp-title .sheet-icon svg { width: 18px; height: 18px; }
.cmp-title h2 { margin: 0; font-size: 17px; }
.cmp-asset { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30%; }
.cmp-x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--faint); font-size: 22px; line-height: 1; flex: none; }
.cmp-x:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); min-height: 0; overflow: hidden; flex: 1; }
.cmp-stage { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-right: 1px solid var(--line); background: #0d0d11; overflow-y: auto; }
.cmp-stage-art { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 240px; padding: 16px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, rgba(var(--tone-rgb), .12), transparent 70%), repeating-conic-gradient(#15151a 0 25%, #121216 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); }
.cmp-src { position: relative; flex: 0 0 38%; }
.cmp-src img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #0a0a0d; display: block; }
.cmp-src span, .cmp-out span { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, .65); font: 10px var(--mono); color: var(--muted); }
.cmp-arrow svg { width: 22px; height: 22px; fill: none; stroke: var(--tone); stroke-width: 2.2; }
.cmp-outs { display: grid; gap: 8px; flex: 1; max-width: 100%; }
.has-src .cmp-outs { flex: 0 0 44%; }
.cmp-outs.n2, .cmp-outs.n3, .cmp-outs.n4 { grid-template-columns: 1fr 1fr; }
.cmp-out { position: relative; display: grid; place-items: center; width: 100%; border: 1.5px dashed rgba(var(--tone-rgb), .55); border-radius: 10px; background: rgba(var(--tone-rgb), .06); transition: aspect-ratio .2s; }
.cmp-outs { margin: 0 auto; } .cmp-outs.n1 { max-width: 210px; } .cmp-outs.n2 { max-width: 290px; } .cmp-outs.n3, .cmp-outs.n4 { max-width: 230px; } .has-src .cmp-outs { max-width: none; }
.cmp-out svg { width: 26px; height: 26px; fill: none; stroke: rgba(var(--tone-rgb), .8); stroke-width: 1.7; }
.cmp-stage-note { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.cmp-refs .refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.cmp-controls { display: flex; flex-direction: column; gap: 16px; padding: 18px 20px; overflow-y: auto; min-width: 0; }
.cmp-model { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.cmp-model .model-pick { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.cmp-model select { width: 100%; text-transform: none; letter-spacing: 0; }
.cmp-row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; }
.cmp-field { display: flex; flex-direction: column; gap: 6px; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; min-width: 34px; justify-content: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--muted); font: 12px var(--mono); }
.cmp-chip i { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.cmp-chip:hover { color: var(--text); border-color: var(--brand-line); }
.cmp-chip.on { color: var(--text); border-color: var(--tone); background: rgba(var(--tone-rgb), .14); }
.cmp-row .sheet-bg { align-self: flex-end; }
.cmp-instruction { padding: 0; }
.cmp-prompt { display: flex; flex-direction: column; gap: 8px; }
.cmp-prompt .final-prompt { min-height: 96px; transition: min-height .15s; }
.cmp-prompt .final-prompt:focus { min-height: 220px; }
.composer .mesh-opts { padding: 0; }
.cmp-foot { gap: 10px; }
.cmp-run { padding: 11px 18px; font-size: 14px; }
.cmp-run em { font-style: normal; font: 12px var(--mono); opacity: .7; padding-left: 8px; border-left: 1px solid rgba(0, 0, 0, .25); }
.cmp-run kbd { font: 10px var(--mono); padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .18); color: rgba(0, 0, 0, .7); border: 0; }
@media (max-width: 860px) {
  .cmp-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .cmp-stage { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .cmp-stage-art { min-height: 160px; }
  .cmp-controls { overflow: visible; }
  .cmp-asset { display: none; }
  .cmp-run kbd { display: none; }
}

/* ---------- Pixel Studio: prompt-first create ---------- */
.px-create { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--panel-2); }
.px-create-main { display: flex; flex-direction: column; gap: 14px; padding: 24px 26px; background: radial-gradient(90% 120% at 0% 0%, rgba(var(--tone-rgb), .14), transparent 60%); min-width: 0; }
.px-create-main .eyebrow { display: inline-flex; gap: 6px; align-items: center; color: var(--brand); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.px-create-main .eyebrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.px-create-main h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.px-prompt-wrap { position: relative; border: 1px solid rgba(var(--tone-rgb), .45); border-radius: 14px; background: #0d0d11; transition: border-color .12s, box-shadow .12s; }
.px-prompt-wrap:focus-within { border-color: var(--tone); box-shadow: 0 0 0 3px rgba(var(--tone-rgb), .18); }
#pxPrompt { width: 100%; min-height: 84px; padding: 14px 16px; border: 0; background: none; color: var(--text); font-size: 16px; line-height: 1.45; resize: vertical; outline: none; box-shadow: none; }
.px-refchip { display: flex; align-items: center; gap: 8px; margin: 0 10px 10px; padding: 4px 4px 4px 4px; width: fit-content; border-radius: 10px; background: rgba(var(--tone-rgb), .12); font-size: 12px; color: var(--muted); }
.px-refchip img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.px-refchip button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--faint); }
.px-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.px-ideas button { padding: 4px 10px; border: 1px dashed var(--line); border-radius: 99px; background: none; color: var(--faint); font-size: 12px; }
.px-ideas button:hover { color: var(--text); border-color: var(--brand-line); }
.px-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 20px; }
.px-create-main .field-label em { font-style: normal; color: var(--faint); text-transform: none; letter-spacing: 0; margin-left: 6px; font-weight: 400; }
.px-create .px-pals { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.px-create-side { display: flex; flex-direction: column; gap: 16px; padding: 22px; border-left: 1px solid var(--line); background: #0f0f13; }
.px-how { padding: 12px 14px; border-radius: 12px; background: rgba(var(--tone-rgb), .07); border: 1px solid rgba(var(--tone-rgb), .2); font-size: 12px; color: var(--muted); }
.px-how b { color: var(--text); font-size: 13px; }
.px-how ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; line-height: 1.4; }
.px-model { display: flex; flex-direction: column; gap: 6px; }
.px-model select { width: 100%; }
.px-rec { align-self: flex-start; padding: 2px 8px; border-radius: 99px; background: rgba(110, 231, 168, .12); color: #6ee7a8; font: 600 11px var(--mono); }
.px-create .px-make { margin-top: auto; }
.px-make em, .px-gen .run-btn em { font-style: normal; font: 12px var(--mono); opacity: .7; padding-left: 8px; border-left: 1px solid rgba(0, 0, 0, .25); }
.px-make kbd { font: 10px var(--mono); padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, .18); color: rgba(0, 0, 0, .7); border: 0; }
/* drafts: pick the best */
.px-drafts { display: flex; flex-direction: column; gap: 12px; }
.px-draft { border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); overflow: hidden; }
.px-draft header { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); }
.px-draft header div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.px-draft header small { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-draft-meta { font: 11px var(--mono); color: var(--faint); white-space: nowrap; }
.px-cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
.px-cand { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(#1c1c22 0 25%, #17171c 0 50%) 0 0 / 16px 16px; }
.px-cand > img { width: 86%; height: 86%; object-fit: contain; }
.px-cand > img.crisp { image-rendering: pixelated; }
.px-cand-raw { position: absolute; left: 6px; top: 6px; width: 36px; height: 36px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); opacity: 0; transition: opacity .12s; }
.px-cand-raw img { width: 100%; height: 100%; object-fit: cover; }
.px-cand b { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 4px 10px; border-radius: 99px; background: var(--tone); color: #09090b; font-size: 12px; opacity: 0; transition: opacity .12s; }
.px-cand:hover { border-color: var(--tone); }
.px-cand:hover b, .px-cand:hover .px-cand-raw { opacity: 1; }
.px-cand.wait { border-style: dashed; border-color: rgba(var(--tone-rgb), .45); color: var(--faint); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.px-turn { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.px-turn .ghost { justify-content: center; display: inline-flex; align-items: center; gap: 6px; }
.px-turn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.px-gen input[type=text] { width: 100%; }
.px-gen .px-model .field-label { margin: 0; }
@container (max-width: 900px) {
  .px-create { grid-template-columns: 1fr; }
  .px-create-side { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Tess as a bar: one prompt line at the bottom of the window; the conversation opens upward as a sheet ---------- */
.panel.chat#chatWin.bar { position: fixed; z-index: 15; left: 50%; bottom: calc(var(--status-h) + 14px); width: min(680px, calc(100vw - 32px)); max-height: min(74vh, 780px); transform: translateX(-50%); display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 20px; background: #111017; box-shadow: 0 24px 70px rgba(0, 0, 0, .65), 0 0 0 1px rgba(157, 92, 255, .14), 0 0 60px rgba(157, 92, 255, .1); overflow: visible; transition: box-shadow .2s, border-color .2s; }
.panel.chat#chatWin.bar:focus-within { border-color: rgba(157, 92, 255, .55); box-shadow: 0 30px 90px rgba(0, 0, 0, .7), 0 0 0 4px rgba(157, 92, 255, .12), 0 0 80px rgba(157, 92, 255, .18); }
#chatWin.bar:not(.open) > .chat-head, #chatWin.bar:not(.open) > .tabs, #chatWin.bar:not(.open) > .messages { display: none; }
/* focused with nothing said yet: the suggestions (or what is stopping Tess) show above the line */
#chatWin.bar:not(.open):focus-within > .messages:has(.chat-empty, .banner) { display: flex; flex: none; padding: 12px 12px 0; overflow: visible; }
#chatWin.bar.open { height: min(74vh, 780px); animation: bar-open .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes bar-open { from { opacity: .5; transform: translateX(-50%) translateY(16px) scale(.985); } }
#chatWin.bar > .chat-head { border-radius: 20px 20px 0 0; }
#chatWin.bar .composer { padding: 8px; border-top: 0; }
#chatWin.bar.open .composer { border-top: 1px solid var(--line); }
#chatWin.bar .composer-card { box-shadow: none; background: none; border-color: transparent; padding: 6px 6px 6px 10px; }
#chatWin.bar .composer-hint { display: none; }
/* collapsed and idle: a single line with her face on it */
#chatWin.bar:not(.open):not(:focus-within) .composer-card { flex-direction: row; align-items: center; gap: 12px; }
#chatWin.bar:not(.open):not(:focus-within) .composer-card::before { content: ""; flex: none; width: 32px; height: 32px; border-radius: 50%; background: url(tess-avatar.png) center / cover; box-shadow: 0 0 0 1px rgba(157, 92, 255, .55), 0 0 16px rgba(157, 92, 255, .3); }
body.tess-busy #chatWin.bar:not(.open):not(:focus-within) .composer-card::before { animation: tess-pulse 1.6s ease-in-out infinite; }
#chatWin.bar:not(.open):not(:focus-within) .composer-row > :not(.send-btn) { display: none; }
#chatWin.bar:not(.open):not(:focus-within) textarea { flex: 1; }
#chatWin.bar .chat-empty { margin: 0; padding: 0; align-items: stretch; text-align: left; gap: 8px; width: 100%; }
#chatWin.bar .chat-empty h2 { display: none; }
#chatWin.bar .chat-empty .tess-art { display: none; }  /* the bar keeps to the suggestions; Tess waves in the full chat */
#chatWin.bar .suggestions { flex-direction: row; flex-wrap: wrap; margin: 0; gap: 6px; }
#chatWin.bar .suggestion { padding: 7px 12px; border-radius: 999px; font-size: 13px; }
#chatWin.bar .suggestion:hover { transform: none; }
.bar-status { display: flex; align-items: center; gap: 10px; margin: 8px 8px 0; padding: 8px 12px; border: 1px solid rgba(157, 92, 255, .3); border-radius: 12px; background: rgba(157, 92, 255, .08); color: var(--text); font: 500 13px var(--sans); text-align: left; }
.bar-status[hidden] { display: none; }
.bar-status i { width: 8px; height: 8px; border-radius: 2px; background: var(--ok); flex: none; }
.bar-status.busy i { background: var(--brand); animation: pulse-dot 1.2s ease-in-out infinite; }
.bar-status span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-status em { font-style: normal; color: var(--brand-hi); font-size: 12px; }
/* the page keeps clear of the bar */
body[data-chat="bar"] .content { padding-bottom: 120px; }
@media (prefers-reduced-motion: reduce) { #chatWin.bar.open { animation: none; } }

/* ---------- a quieter frame ---------- */
/* The chat's empty state is one question and three suggestions; her face is already in the header. */
.chat-empty h2 { font-size: 18px; margin: 0 0 4px; }
/* The tree: one style for the fixed entries, labels for the groups, counts instead of numbers. */
.sections { padding-top: 14px; }
.sections .sec { padding: 8px 10px; }
.sections .sec-label { padding-top: 16px; }
.statusbar .ver { color: var(--faint); opacity: .7; }
.pl-head-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- the accent: one colour for every project, used for selection, progress and the stage ---------- */
:root { --proj: 240, 106, 157; } /* one accent for every project (Pocket Kaiju's pink) */
.sections .sec.active { box-shadow: inset 2px 0 0 rgb(var(--proj)); }
.sections .sec.active svg, .sections .sec.active small { color: rgb(var(--proj)); }

/* ---------- the overview: one row per section, how far along it is and a few of its pictures ---------- */

.wall-wrap { container-type: inline-size; margin: 0 0 30px; }
.wall-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.wall-head .grow { flex: 1; }
.wall-head svg { width: 15px; height: 15px; vertical-align: -3px; }
.wall-made { display: flex; align-items: baseline; gap: 8px; }
.wall-made b { font: 700 34px/1 var(--display); letter-spacing: .02em; }
.wall-made span { color: var(--muted); font-size: 13px; }
.wall-meter { align-self: center; width: 120px; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.wall-meter i { display: block; height: 100%; border-radius: 4px; background: rgb(var(--proj)); }
.sec-sum-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.sec-sum { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 190px 14px; align-items: center; gap: 18px; padding: 14px 18px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); text-align: left; transition: background .15s; }
.sec-sum:first-child { border-top: 0; }
.sec-sum:hover { background: var(--panel-2); }
.sec-sum:hover .chev { color: var(--text); transform: translateX(2px); }
.sec-sum-num { font: 600 13px var(--mono); color: var(--faint); }
.sec-sum:hover .sec-sum-num { color: rgb(var(--proj)); }
.sec-sum-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sec-sum-text strong { font: 700 22px/1.05 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.sec-sum-text small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-sum-thumbs { display: flex; gap: 4px; }
.sec-sum-thumbs img, .sum-snd { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #0c0c10; border: 1px solid var(--line); }
.sum-snd { display: grid; place-items: center; color: rgb(var(--proj)); }
.sum-snd svg { width: 18px; height: 18px; }
.sec-sum-prog { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.sec-sum-prog b { color: var(--text); font-weight: 600; }
.sec-sum-prog .wall-meter { grid-column: 1 / -1; width: 100%; grid-row: 2; }
.sec-sum-prog em { font-style: normal; color: #f59e0b; font-size: 11px; }
.sec-sum-prog em.ok { color: #34d399; }
.sec-sum-prog .none { color: var(--faint); grid-column: 1 / -1; }
.sec-sum .chev { color: var(--faint); font-size: 20px; transition: transform .15s, color .15s; }
.sec-sum-loose { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.loose-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); font-size: 13px; }
.loose-chip:hover { color: var(--text); border-color: var(--line-strong); }
.loose-chip img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
@container (max-width: 820px) {
  .sec-sum { grid-template-columns: 28px minmax(0, 1fr) 120px 14px; }
  .sec-sum-thumbs { display: none; }
}
body.gallery-mode .wall-head { display: none; }

/* ---------- the reveal: a new picture resolves in squares, once ---------- */
.sq-reveal { position: absolute; inset: 0; display: grid; grid-template: repeat(6, 1fr) / repeat(6, 1fr); pointer-events: none; }
.sq-reveal i { background: #0c0c10; box-shadow: inset 0 0 0 .5px rgba(var(--proj), .4); animation: sq-out .38s ease forwards; animation-delay: var(--d); }
@keyframes sq-out { to { opacity: 0; transform: scale(.55); } }
@media (prefers-reduced-motion: reduce) { .sq-reveal { display: none; } }

/* ---------- the brief: the written pitch, folded under the wall ---------- */
details.brief { margin: 0 0 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
details.brief > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
details.brief > summary::-webkit-details-marker { display: none; }
details.brief > summary::before { content: ""; width: 7px; height: 7px; margin: 0 4px 2px 2px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; }
details.brief[open] > summary::before { transform: rotate(45deg); }
details.brief > summary small { flex: 1; color: var(--faint); font: 12px var(--mono); font-weight: 400; }
details.brief > .md { padding: 4px 22px 20px; }

/* ---------- the stage: the asset stands large on a lit floor; under it, the track of its stages ---------- */
.asset-top { grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: 34px; align-items: start; margin-top: 8px; }
.stage-col { position: sticky; top: 4px; min-width: 0; }
.stage-col .winner-box { position: relative; aspect-ratio: auto; height: min(60vh, 620px); border: 0; border-radius: 18px; background: radial-gradient(circle at 50% 38%, #18171f, #0a0a0e 78%); }
.stage-col .winner-box.hero-3d { background: radial-gradient(circle at 50% 38%, #18171f, #0a0a0e 78%); }
/* art on a black ground (the usual one for characters and props) loses its square and stands on the floor */
.stage-col .winner-box > img:not([hidden]) { padding: 2%; mix-blend-mode: lighten; }
.stage-col .winner-box .no-thumb.big { background: none; }
.stage-track { display: flex; align-items: center; margin-top: 14px; padding: 0 4px; }
.st-step { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 0; border: 0; background: none; color: var(--faint); font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: color .12s; }
.st-step:last-child { flex: none; }
.st-step::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 4px; background: rgba(255, 255, 255, .14); transition: background .2s, box-shadow .2s; }
.st-step::after { content: ""; flex: 1; height: 2px; margin-right: 8px; border-radius: 1px; background: rgba(255, 255, 255, .08); }
.st-step:last-child::after { display: none; }
.st-step span { white-space: nowrap; }
.st-step.done { color: var(--muted); }
.st-step.done::before { background: rgb(var(--proj)); }
.st-step.thru::after { background: rgba(var(--proj), .55); }
.st-step.on { color: var(--text); }
.st-step.on::before { background: #fff; box-shadow: 0 0 0 4px rgba(var(--proj), .38); }
.st-step:not(:disabled):hover { color: var(--text); }
.st-step:disabled { cursor: default; }

/* the one next step */
.next-step { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(var(--proj), .5); background: linear-gradient(120deg, rgba(var(--proj), .17), rgba(var(--proj), .04)); color: var(--text); text-align: left; cursor: pointer; transition: transform .12s, border-color .12s; }
button.next-step:hover { transform: translateY(-1px); border-color: rgb(var(--proj)); }
button.next-step:active { transform: scale(.99); }
.ns-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgb(var(--proj)); color: #0b0a10; }
.ns-ico svg { width: 21px; height: 21px; stroke-width: 2; }
.ns-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ns-text small { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: rgb(var(--proj)); }
.ns-text b { font-size: 16px; letter-spacing: -.01em; }
.ns-text em { font-style: normal; color: var(--muted); font-size: 13px; }
.ns-go svg { width: 18px; height: 18px; color: var(--muted); }
.next-step.ready { border-color: rgba(52, 211, 153, .4); background: linear-gradient(120deg, rgba(52, 211, 153, .12), rgba(52, 211, 153, .03)); }
.next-step.ready .ns-ico { background: var(--ok); }
.next-step.ready .ns-text small { color: var(--ok); }
.next-step.busy { cursor: progress; }
.next-step.busy .ns-ico { background: rgba(var(--proj), .2); }

/* the other things you can make: a quiet row, not five coloured cards */
.asset-side .make-dock { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.asset-side .dock-tile { flex-direction: row; align-items: center; gap: 7px; min-height: 0; padding: 7px 11px; border-radius: 10px; background: var(--control); }
.asset-side .dock-tile svg { width: 15px; height: 15px; margin: 0; stroke: var(--muted); }
.asset-side .dock-tile b { margin: 0; font-size: 13px; font-weight: 500; }
.asset-side .dock-tile small { display: none; }
.asset-side .dock-tile:hover:not(:disabled) { border-color: var(--line-strong); background: var(--elevated); transform: none; }
.asset-side .tool-row .field-label { display: none; }

/* style and pillars: one line until you open it */
details.applied { margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; display: block; }
details.applied > summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; }
details.applied > summary::-webkit-details-marker { display: none; }
details.applied > summary::before { content: ""; width: 6px; height: 6px; margin: 0 2px 2px; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; }
details.applied[open] > summary::before { transform: rotate(45deg); }
details.applied > summary small { flex: 1; min-width: 0; color: var(--faint); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.applied-in { display: flex; flex-direction: column; gap: 10px; padding: 2px 14px 14px; }
@container (max-width: 820px) { .asset-top { grid-template-columns: 1fr; } .stage-col { position: static; } .stage-col .winner-box { height: min(52vh, 480px); } }

/* ---------- motion: three durations and one curve; nothing depends on an animation to be readable ---------- */
:root { --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms; --ease: cubic-bezier(.2, .8, .2, 1); }
/* a page arrives with a short rise; it starts readable, so a stalled animation hides nothing */
#content.page-in { animation: page-in var(--dur-2) var(--ease); }
@keyframes page-in { from { opacity: .45; transform: translateY(7px); } }
/* buttons answer a press */
button.primary:active, button.ghost:active, .tool:active, .dock-tile:active:not(:disabled), .mini:active { transform: scale(.97); }
button.primary, button.ghost, .tool, .mini { transition: transform var(--dur-1) var(--ease), background var(--dur-1), border-color var(--dur-1), color var(--dur-1); }
/* panels that used to blur what is behind them are solid now */
.mo-back, #moName, .mo-tools, .mo-sel { background: rgba(14, 14, 18, .96); }
.palette { background: rgba(5, 5, 7, .8); }
.lightbox { background: rgba(5, 5, 7, .96); }
/* overlays show at once: only the card moves */
.palette, .lightbox { animation: none; }
.palette-card { animation: card-in var(--dur-2) var(--ease); }
@keyframes card-in { from { transform: translateY(-8px) scale(.985); } }
#studio :focus-visible, .motion :focus-visible { outline: 2px solid rgba(var(--proj), .8); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  #content.page-in, .palette-card { animation: none; }
  button.primary:active, button.ghost:active, .tool:active, .dock-tile:active, .mini:active { transform: none; }
}

/* Tess has no agent to run on: a quiet, persistent way to Settings → Tess. */
.statusbar .sb.tess-off { color: var(--brand-hi); }
.statusbar .sb.tess-off:hover { background: var(--brand-soft); }

/* ---------- a section is one page: subsections under headings, sounds as rows you can play ---------- */

.sec-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 26px; }
.sec-tools .grow { flex: 1; }
.sec-tools .grid-bar { margin: 0; flex: 0 1 auto; }
.sec-tool { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: none; color: var(--muted); font-size: 13px; transition: color .12s, border-color .12s, background .12s; }
.sec-tool svg { width: 14px; height: 14px; }
.sec-tool b { font: 500 11px var(--mono); color: var(--faint); }
.sec-tool:hover, .sec-tool.on { color: var(--text); border-color: var(--line-strong); }
.sec-tool.on { background: var(--panel-2); }
.sec-about { margin: 0 0 34px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); animation: about-in .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes about-in { from { opacity: 0; transform: translateY(-6px); } }

.subsec { scroll-margin-top: 12px; }
.subsec.depth-1 { margin: 0 0 44px; }
.subsec.sec-own { margin-bottom: 40px; }
.subsec.depth-2 { margin: 26px 0 0; }
.subsec-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.subsec-head h2 { margin: 0; font: 700 26px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.subsec-head h3 { margin: 0; font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.subsec-count { font: 500 12px var(--mono); color: var(--faint); }
.subsec-rule { flex: 1; height: 2px; border-radius: 1px; background: linear-gradient(90deg, rgba(var(--proj), .55), rgba(var(--proj), 0) 70%); }
.depth-2 > .subsec-head .subsec-rule { height: 1px; background: var(--line); }
.subsec-head .menu-btn { width: 30px; height: 30px; padding: 0; opacity: .5; transition: opacity .12s; }
.subsec:hover > .subsec-head .menu-btn, .subsec-head .menu-btn[aria-expanded="true"] { opacity: 1; }
.subsec-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--faint); font: 500 11px var(--mono); }
.subsec-chip svg { width: 12px; height: 12px; }
.subsec-chip:hover { color: var(--text); border-color: var(--line-strong); }
.subsec-lede { margin: -6px 0 16px; color: var(--muted); font-size: 14px; max-width: 720px; }
.subsec-empty { color: var(--faint); font-size: 13px; margin: 0; }
.subsec-files { margin-top: 12px; }
.subsec-files summary { cursor: pointer; color: var(--faint); font-size: 12px; }
.asset-grid.all-filtered { display: none; }

.tile-meta { display: block; margin-top: -5px; padding: 0 2px; font: 11px/1.35 var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-tile.nowin .tile-meta { color: #b07a1c; }

.sound-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; margin-bottom: 8px; }
.asset-grid + .sound-list { margin-top: 16px; }
.sound-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 14px 9px 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); transition: border-color .12s, background .12s; }
.sound-row:hover { border-color: var(--line-strong); background: var(--panel-2); }
.sound-row[data-select-tile] { cursor: pointer; }
.sound-row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sound-play { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(var(--proj), .16); color: rgb(var(--proj)); transition: transform .12s, background .12s; }
.sound-play:hover:not(:disabled) { background: rgba(var(--proj), .28); transform: scale(1.06); }
.sound-play:disabled { opacity: .35; }
.sound-play svg { width: 16px; height: 16px; margin-left: 2px; }
.sound-bars { display: none; gap: 3px; align-items: flex-end; height: 14px; }
.sound-bars i { width: 3px; border-radius: 1px; background: currentColor; animation: snd-bar .7s ease-in-out infinite alternate; }
.sound-bars i:nth-child(2) { animation-delay: -.25s; }
.sound-bars i:nth-child(3) { animation-delay: -.5s; }
@keyframes snd-bar { from { height: 3px; } to { height: 14px; } }
.sound-play.playing { background: rgb(var(--proj)); color: #0b0b0e; }
.sound-play.playing svg { display: none; }
.sound-play.playing .sound-bars { display: flex; }
.sound-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); text-align: left; }
.sound-main strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound-main small { font: 11px var(--mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound-dur { font: 500 12px var(--mono); color: var(--faint); }
#dialog:has(.pillars-sheet) { width: min(760px, calc(100vw - 32px)); }
.pillars-sheet { padding: 18px; }
.pillars-sheet .pillars { margin: 0 0 14px; }
@media (prefers-reduced-motion: reduce) { .sound-bars i, .sec-about { animation: none; } }
