:root {
  color-scheme: dark;
  --chrome: #17181c;
  --panel: #1e2025;
  --field: #272a30;
  --field-hover: #2e3138;
  --well: #121316;
  --line: #2d3036;
  --line-strong: #3b3f47;
  --text: #ecedef;
  --muted: #9a9fa9;
  --faint: #6c717b;
  --brass: #e3a63c;
  --brass-soft: rgba(227, 166, 60, .16);
  --brass-ink: #241703;
  --teal: #4cc2b0;
  --teal-soft: rgba(76, 194, 176, .14);
  --guide: #ff4fa3;
  --danger: #ea6870;
  --danger-soft: rgba(234, 104, 112, .14);
  --ok: #7fcf8f;
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 12px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--chrome);
  color: var(--text);
  font: 13px/1.4 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
[hidden] { display: none !important; }
.ico { flex: none; display: block; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px; border-radius: 4px;
  background: var(--field); border: 1px solid var(--line-strong); border-bottom-width: 2px;
  font: 600 11px/1.5 var(--font); text-align: center; color: var(--text);
}
code { font-size: 12px; padding: 1px 4px; border-radius: 4px; background: var(--field); }
a { color: var(--brass); }

/* ---------------------------------------------------------------- top bar */
.bar {
  height: 52px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--chrome);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-right { justify-content: flex-end; }
.mark {
  flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--brass);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M21 11.5a7 7 0 1 0 1.6 6H16' fill='none' stroke='%23241703' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: cover;
}
.project { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.project-name {
  min-width: 60px; max-width: 260px; width: 14em; padding: 5px 7px; margin-left: -1px;
  border: 1px solid transparent; border-radius: var(--r-sm); background: none;
  font-weight: 600; font-size: 14px; text-overflow: ellipsis;
}
.project-name:hover { border-color: var(--line-strong); }
.project-name:focus { outline: none; border-color: var(--brass); background: var(--field); }
.save-state { color: var(--faint); font-size: 12px; white-space: nowrap; }
.save-state[data-state="error"] { color: var(--danger); }
.bar-group { display: flex; gap: 2px; padding-left: 6px; border-left: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; background: var(--field); color: var(--text);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--field-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--brass); color: var(--brass-ink); }
.btn-primary:hover { background: #efb553; }
.btn-ghost { background: none; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--field); }
.btn-danger { background: var(--danger); color: #2a0a0d; }
.btn-danger:hover { background: #f27b82; }
.btn-play { background: none; border-color: var(--line-strong); }
.btn-play .ico { color: var(--teal); }
.btn-play.is-on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r-sm);
  border: 0; background: none; color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--field); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.is-on { color: var(--brass); }

.segmented { display: inline-flex; padding: 2px; border-radius: var(--r); background: var(--field); gap: 2px; }
.segmented button {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font-weight: 600; font-size: 12px;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"], .segmented button.is-on { background: var(--line-strong); color: var(--text); }
.segmented .hint { color: var(--faint); font-weight: 500; }
.layout-switch button { height: 30px; padding: 0 14px; }

/* ---------------------------------------------------------------- layout */
.work { height: calc(100vh - 52px); display: grid; grid-template-columns: 252px minmax(0, 1fr) 296px; }
.side { min-height: 0; display: flex; flex-direction: column; background: var(--panel); }
.side-left { border-right: 1px solid var(--line); }
.side-right { border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.work.is-playing .side { opacity: .5; pointer-events: none; }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: 8px 10px 10px; border: 0; background: none; color: var(--muted); font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brass); }

/* ---------------------------------------------------------------- layers */
.layer-list { flex: 1; overflow-y: auto; padding: 6px; }
.lrow {
  display: grid; grid-template-columns: 18px 1fr auto auto; align-items: center; gap: 6px;
  height: 32px; padding: 0 4px 0 8px; border-radius: var(--r-sm); color: var(--text); cursor: default;
  border: 1px solid transparent;
}
.lrow:hover { background: var(--field); }
.lrow.is-sel { background: var(--brass-soft); }
.lrow.is-sel .lrow-icon { color: var(--brass); }
.lrow.is-off .lrow-name, .lrow.is-off .lrow-icon { opacity: .42; }
.lrow.drop-before { box-shadow: inset 0 2px 0 var(--brass); }
.lrow.drop-after { box-shadow: inset 0 -2px 0 var(--brass); }
.lrow-icon { color: var(--muted); }
.lrow-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-name input { width: 100%; padding: 3px 5px; margin-left: -6px; border: 1px solid var(--brass); border-radius: 4px; background: var(--field); outline: none; }
.lrow .icon-btn { width: 24px; height: 24px; opacity: 0; }
.lrow:hover .icon-btn, .lrow .icon-btn.is-on, .lrow .icon-btn.keep { opacity: 1; }
.lrow .icon-btn.is-on { color: var(--muted); }
.lrow-anim { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); margin-right: 2px; }
.side-foot { padding: 10px 12px 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.side-foot p { margin: 0; }

/* ---------------------------------------------------------------- assets */
.asset-tools { display: flex; gap: 6px; padding: 10px 10px 6px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: var(--r-sm); background: var(--field); color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; }
.search:focus-within { box-shadow: 0 0 0 1px var(--brass); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 10px 8px; }
.chip {
  height: 24px; padding: 0 9px; border-radius: 12px; border: 1px solid var(--line-strong); background: none;
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--text); border-color: var(--text); color: var(--chrome); }
.asset-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 2px 10px 12px; align-content: start; }
.acard {
  position: relative; display: flex; flex-direction: column; min-width: 0; padding: 0; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--field); overflow: hidden;
}
.acard:hover { border-color: var(--line-strong); }
.acard:active { cursor: grabbing; }
.athumb {
  aspect-ratio: 1.2; display: grid; place-items: center; overflow: hidden;
  background: conic-gradient(#25272c 25%, #2b2d33 0 50%, #25272c 0 75%, #2b2d33 0) 0 0/14px 14px;
}
.athumb img { width: 100%; height: 100%; object-fit: contain; padding: 6px; pointer-events: none; }
.athumb .broken { color: var(--faint); font-size: 11px; padding: 6px; text-align: center; }
.ameta { padding: 6px 8px 7px; min-width: 0; }
.aname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.acat { display: block; color: var(--faint); font-size: 11px; }
.acard .adel {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 5px; border: 0; background: rgba(18,19,22,.85); color: var(--muted); opacity: 0;
}
.acard:hover .adel { opacity: 1; }
.acard .adel:hover { color: var(--danger); }
.acard .asrc { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(18,19,22,.85); color: var(--muted); font-size: 10px; font-weight: 600; }
.empty { grid-column: 1 / -1; padding: 22px 10px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 13px; }
.empty p { margin: 0 0 12px; font-size: 12px; }
.empty .btn { margin: 3px; }
.prismic-line { display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot[data-state="ok"] { background: var(--ok); }
.dot[data-state="busy"] { background: var(--brass); }
.dot[data-state="error"] { background: var(--danger); }
.prismic-line .pl-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- canvas */
.canvas-area { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--well); }
.insert-bar {
  display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 10px;
  border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; scrollbar-width: none;
}
.insert-bar .sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line-strong); flex: none; }
.ins {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border-radius: var(--r-sm);
  border: 0; background: none; color: var(--muted); font-weight: 500; font-size: 12px;
}
.ins:hover { background: var(--field); color: var(--text); }
.ins.is-present { color: var(--faint); }
.ins.is-present .ico { opacity: .6; }
.ins-label { color: var(--faint); font-size: 12px; margin-right: 4px; flex: none; }
.play-bar { gap: 10px; }
.play-bar .grow { flex: 1; }
.play-bar .play-note { color: var(--muted); font-size: 12px; }
.viewport {
  position: relative; flex: 1; min-height: 0; overflow: auto; display: flex; padding: 40px;
  background-color: var(--well);
  background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1.2px);
  background-size: 18px 18px;
  outline: none;
}
.viewport.is-panning { cursor: grabbing; }
.canvas-wrap { position: relative; margin: auto; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 20px 60px rgba(0,0,0,.5); }
.scene-host { position: absolute; inset: 0; overflow: hidden; }
.scene-host .gx-stage { position: absolute; left: 0; top: 0; }
.scene-host .gx-layer[data-locked] { pointer-events: none; }
.scene-host .gx-mode-edit .gx-btn, .scene-host .gx-mode-edit .gx-step { cursor: default; pointer-events: none; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.sel, .hov { position: absolute; transform-origin: 50% 50%; }
.hov { box-shadow: 0 0 0 1px rgba(227,166,60,.7); }
.sel { box-shadow: 0 0 0 1.5px var(--brass); }
.sel.is-locked { box-shadow: 0 0 0 1.5px var(--faint); }
.h {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 1.5px var(--brass); pointer-events: auto;
}
.h[data-h="nw"], .h[data-h="se"] { cursor: nwse-resize; }
.h[data-h="ne"], .h[data-h="sw"] { cursor: nesw-resize; }
.h[data-h="n"], .h[data-h="s"] { cursor: ns-resize; }
.h[data-h="e"], .h[data-h="w"] { cursor: ew-resize; }
.rot {
  position: absolute; left: 50%; top: -30px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--brass); box-shadow: 0 0 0 2px var(--well); pointer-events: auto; cursor: grab;
}
.rot::after { content: ""; position: absolute; left: 5px; top: 12px; width: 1.5px; height: 18px; background: var(--brass); }
.size-tag {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); padding: 2px 6px; border-radius: 4px;
  background: var(--brass); color: var(--brass-ink); font-size: 11px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.guide { position: absolute; background: var(--guide); }
.guide.v { width: 1px; top: 0; bottom: 0; }
.guide.h2 { height: 1px; left: 0; right: 0; }
.canvas-foot {
  height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 0 14px;
  border-top: 1px solid var(--line); background: var(--panel); color: var(--faint); font-size: 12px;
}
.foot-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-hint kbd { font-size: 10px; min-width: 18px; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom-label { min-width: 52px; height: 26px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
.zoom-label:hover { background: var(--field); color: var(--text); }

/* ---------------------------------------------------------------- inspector */
.insp-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; }
.insp-head .kind-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r); background: var(--field); color: var(--brass); flex: none; }
.insp-head .title-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; font-weight: 600; font-size: 14px; }
.insp-head .title-input:hover { border-color: var(--line-strong); }
.insp-head .title-input:focus { outline: none; border-color: var(--brass); background: var(--field); }
.insp-head h2 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; }
.insp-head p { margin: 2px 0 0; color: var(--faint); font-size: 12px; }
.insp-tabs { display: flex; padding: 0 12px; gap: 4px; border-bottom: 1px solid var(--line); }
.insp-tabs .tab { padding: 6px 8px 9px; }
.insp-tabs .tab[aria-selected="true"]::after { left: 8px; right: 8px; }
.insp-tabs .tab[data-insp-tab="animate"][aria-selected="true"]::after { background: var(--teal); }
.sec { padding: 12px; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; min-height: 22px; }
.sec-head h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text); }
.sec-head .sec-act { display: flex; gap: 2px; }
.sec-note { margin: -2px 0 10px; color: var(--faint); font-size: 12px; line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.stack { display: grid; gap: 8px; }
.f { display: flex; align-items: center; height: 30px; border-radius: var(--r-sm); background: var(--field); border: 1px solid transparent; min-width: 0; }
.f:hover { border-color: var(--line-strong); }
.f:focus-within { border-color: var(--brass); }
.f-lab { flex: none; min-width: 24px; padding: 0 2px 0 8px; color: var(--faint); font-size: 12px; user-select: none; }
.f-lab[data-scrub] { cursor: ew-resize; }
.f input, .f select { flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0 8px 0 4px; border: 0; outline: none; background: none; font-variant-numeric: tabular-nums; }
.f select { padding-left: 6px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9fa9' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; padding-right: 22px; }
.f select option { background: var(--panel); }
.f .unit { padding-right: 8px; color: var(--faint); font-size: 12px; }
.f input[type=number]::-webkit-inner-spin-button { display: none; }
.f input[type=number] { -moz-appearance: textfield; }
.lf { display: grid; gap: 5px; min-width: 0; }
.lf > span { color: var(--muted); font-size: 12px; }
.lf textarea { width: 100%; min-height: 64px; resize: vertical; padding: 7px 8px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--field); outline: none; line-height: 1.4; }
.lf textarea:focus { border-color: var(--brass); }
.color-f .f-lab { padding-left: 8px; }
.color-f input[type=text] { text-align: right; }
.color-f input[type=text]::placeholder { color: var(--faint); }
.btn-del { color: var(--danger); }
.btn-del:hover { background: var(--danger-soft); }
.color-f .swatch { position: relative; flex: none; width: 20px; height: 20px; margin-left: 5px; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); background: conic-gradient(#999 25%, #666 0 50%, #999 0 75%, #666 0) 0 0/8px 8px; }
.color-f .swatch i { position: absolute; inset: 0; }
.color-f .swatch input { position: absolute; inset: -6px; width: 34px; height: 34px; opacity: 0; cursor: pointer; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.row > span { color: var(--muted); }
.switch { position: relative; flex: none; width: 30px; height: 18px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 9px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--brass); }
.switch input:checked + i::after { transform: translateX(12px); }
.switch input:focus-visible + i { outline: 2px solid var(--brass); outline-offset: 2px; }
.range-f { display: grid; grid-template-columns: 1fr 78px; gap: 8px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--brass); }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; justify-content: center; padding: 0 4px; }
.align-row { display: flex; justify-content: space-between; padding: 2px; border-radius: var(--r); background: var(--field); margin-bottom: 8px; }
.align-row .icon-btn { width: 100%; height: 28px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.preset {
  height: 30px; padding: 0 4px; border-radius: var(--r-sm); border: 1px solid var(--line); background: none;
  color: var(--muted); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preset:hover { color: var(--text); border-color: var(--line-strong); }
.preset.is-on { color: var(--text); border-color: var(--teal); background: var(--teal-soft); }
.presets.brass .preset.is-on { border-color: var(--brass); background: var(--brass-soft); }
.anim-sec .sec-head h3::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--line-strong); vertical-align: 1px; }
.anim-sec.is-active .sec-head h3::before { background: var(--teal); }
.anim-params { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.btn-preview { color: var(--teal); }
.btn-preview:hover { color: var(--teal); background: var(--teal-soft); }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-row .btn { flex: 1; }
.status-text { margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.status-text[data-state="ok"] { color: var(--ok); }
.status-text[data-state="error"] { color: #f19aa0; }
.engine-card { margin-top: 8px; padding: 10px; border-radius: var(--r); background: var(--field); font-size: 12px; color: var(--muted); }
.engine-card b { color: var(--text); font-weight: 600; }
.engine-card .btn { margin-top: 8px; }
.sym-list { display: grid; gap: 4px; }
.sym {
  display: grid; grid-template-columns: 34px 64px 1fr 24px; gap: 6px; align-items: center;
}
.sym-thumb {
  width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); overflow: hidden;
  background: conic-gradient(#25272c 25%, #2b2d33 0 50%, #25272c 0 75%, #2b2d33 0) 0 0/10px 10px; color: var(--faint);
  display: grid; place-items: center;
}
.sym-thumb.has { border-style: solid; border-color: var(--line); }
.sym-thumb:hover { border-color: var(--brass); color: var(--brass); }
.sym-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.sym .f { height: 30px; }
.sym .f input { padding-left: 8px; }
.asset-pick {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 44px; padding: 4px 8px 4px 4px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: var(--field); text-align: left;
}
.asset-pick:hover { border-color: var(--line-strong); }
.asset-pick .pthumb { width: 36px; height: 36px; flex: none; border-radius: 4px; overflow: hidden; display: grid; place-items: center; color: var(--faint); background: conic-gradient(#25272c 25%, #2b2d33 0 50%, #25272c 0 75%, #2b2d33 0) 0 0/10px 10px; }
.asset-pick .pthumb img { width: 100%; height: 100%; object-fit: contain; }
.asset-pick .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-pick .pname small { display: block; color: var(--faint); font-size: 11px; }
.insp-empty-note { padding: 12px; color: var(--faint); font-size: 12px; }

/* ---------------------------------------------------------------- menus */
.menu, .popover {
  position: fixed; z-index: 1000; min-width: 220px; padding: 5px; border-radius: var(--r-lg);
  border: 1px solid var(--line-strong); background: #23252b; box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; color: var(--text);
}
.menu button:hover, .menu button:focus-visible { background: var(--field-hover); outline: none; }
.menu button .ico { color: var(--muted); }
.menu button.danger { color: var(--danger); }
.menu button.danger .ico { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.popover { width: 300px; padding: 10px; }
.popover .pop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 300px; overflow-y: auto; margin-top: 8px; }
.popover .pop-item { aspect-ratio: 1; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--line); overflow: hidden; background: conic-gradient(#25272c 25%, #2b2d33 0 50%, #25272c 0 75%, #2b2d33 0) 0 0/12px 12px; }
.popover .pop-item:hover { border-color: var(--brass); }
.popover .pop-item.is-on { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }
.popover .pop-item img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.popover .pop-foot { display: flex; gap: 6px; margin-top: 10px; }
.popover .pop-foot .btn { flex: 1; }
.popover .pop-empty { grid-column: 1/-1; padding: 16px 6px; color: var(--muted); font-size: 12px; text-align: center; }

.tip {
  position: fixed; z-index: 2000; padding: 4px 8px; border-radius: 5px; background: #000; color: #fff;
  font-size: 12px; pointer-events: none; white-space: nowrap;
}

.toasts { position: fixed; left: 50%; bottom: 52px; z-index: 3000; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: min(560px, 90vw); padding: 9px 12px 9px 14px; border-radius: var(--r-lg);
  background: #f1f2f4; color: #17181c; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.4); pointer-events: auto;
  animation: toast-in .22s cubic-bezier(.16,1,.3,1);
}
.toast.error { background: #3a1d21; color: #ffd6d9; box-shadow: 0 0 0 1px #6b2c33, 0 10px 30px rgba(0,0,0,.4); }
.toast button { border: 0; background: none; font-weight: 700; color: inherit; text-decoration: underline; padding: 2px 4px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- dialogs */
.dialog {
  width: min(480px, calc(100vw - 32px)); padding: 22px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.dialog-wide { width: min(780px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(8,9,11,.6); }
.dialog h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.dialog h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; }
.dialog-lead { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.dfield { display: grid; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.dfield input, .dfield select { height: 36px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--field); color: var(--text); font-size: 13px; outline: none; }
.dfield input:focus, .dfield select:focus { border-color: var(--brass); }
.dfield-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.asset-preview { height: 140px; margin-bottom: 12px; border-radius: var(--r); display: grid; place-items: center; overflow: hidden; background: conic-gradient(#25272c 25%, #2b2d33 0 50%, #25272c 0 75%, #2b2d33 0) 0 0/16px 16px; }
.asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-preview span { color: var(--muted); font-size: 12px; }
.dialog-error { min-height: 1em; margin: 0 0 6px; color: #f19aa0; font-size: 12px; }
.dialog-error:empty { display: none; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spacer { flex: 1; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.help-wide { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; align-items: baseline; }
.keys dt { white-space: nowrap; color: var(--muted); }
.keys dd { margin: 0; color: var(--muted); line-height: 1.45; }
.steps { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.55; display: grid; gap: 6px; }
.steps b { color: var(--text); font-weight: 600; }

.drop-hint { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; background: rgba(18,19,22,.7); pointer-events: none; }
.drop-hint div { padding: 22px 30px; border: 2px dashed var(--brass); border-radius: 16px; background: var(--panel); font-size: 15px; font-weight: 600; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 1400px) {
  .ins .ins-c { display: none; }
  .ins { padding: 0 8px; }
}
@media (max-width: 1180px) {
  .work { grid-template-columns: 220px minmax(0, 1fr) 272px; }
  .save-state { display: none; }
  .layout-switch .hint { display: none; }
}
@media (max-width: 920px) {
  .bar { grid-template-columns: auto 1fr auto; }
  .project-name { width: 9em; }
  .bar-group { display: none; }
  .work { grid-template-columns: 0 minmax(0, 1fr) 260px; }
  .side-left { display: none; }
  .btn-play span, #fileBtn { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}
