:root { color-scheme: light; box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
img { max-width: 100%; }

:root {
  --canvas: #F5F5F5;
  --panel: #FFFFFF;
  --line: #E6E6E6;
  --fg: #1E1E1E;
  --fg2: #757575;
  --fg3: #B3B3B3;
  --hover: #F0F0F0;
  --accent: #0D99FF;
  --accent-fg: #FFFFFF;
  --accent-weak: #E5F4FF;
  --dial: #FFFFFF;
  --track: #E3E3E3;
  --handle: #FFFFFF;
  --toast: #1E1E1E;
  --toast-fg: #FFFFFF;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 0 0 .5px rgba(0,0,0,.14);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.14);
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --violet: #9747FF; --green: #14AE5C; --orange: #F57C00; --pink: #E5489C;
  --warm: #F08A2C; --space: #F3F4F6; --sky-mode: light; --star: 120,126,138; --chart: rgba(30,34,44,.07);
  --dial-lit: #FFFFFF; --dial-shade: #DADDE2; --orbit: #D3D6DB; --orbit2: #BFC3CA;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #1E1E1E; --panel: #2C2C2C; --line: #444444; --fg: #FFFFFF; --fg2: #B3B3B3; --fg3: #6E6E6E;
    --hover: #383838; --accent: #0C8CE9; --accent-fg: #FFFFFF; --accent-weak: #263848; --dial: #2C2C2C;
    --track: #484848; --handle: #FFFFFF; --toast: #FFFFFF; --toast-fg: #1E1E1E;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 0 .5px rgba(255,255,255,.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.1);
    --violet: #A866FF; --green: #1BC47D; --orange: #FF9A2E; --pink: #F06BB3;
    --warm: #FFB070; --space: #090B10; --sky-mode: dark; --star: 220,228,255; --chart: transparent;
    --dial-lit: #464B56; --dial-shade: #121419; --orbit: #2A2E37; --orbit2: #3A3F4A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #1E1E1E; --panel: #2C2C2C; --line: #444444; --fg: #FFFFFF; --fg2: #B3B3B3; --fg3: #6E6E6E;
  --hover: #383838; --accent: #0C8CE9; --accent-fg: #FFFFFF; --accent-weak: #263848; --dial: #2C2C2C;
  --track: #484848; --handle: #FFFFFF; --toast: #FFFFFF; --toast-fg: #1E1E1E;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 0 .5px rgba(255,255,255,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.1);
  --violet: #A866FF; --green: #1BC47D; --orange: #FF9A2E; --pink: #F06BB3;
  --warm: #FFB070; --space: #090B10; --sky-mode: dark; --star: 220,228,255; --chart: transparent;
  --dial-lit: #464B56; --dial-shade: #121419; --orbit: #2A2E37; --orbit2: #3A3F4A;
  color-scheme: dark;
}

html, body { height: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--canvas); color: var(--fg);
  font: 400 11px/16px var(--ui); letter-spacing: .005em;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.app { display: grid; grid-template-columns: 240px minmax(0, 1fr) 248px; height: 100%; }
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }

.file { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.file-mark { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--fg); flex: none; }
.file-mark:hover { background: var(--hover); }
.file-name { font-weight: 600; font-size: 13px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { color: var(--fg2); }
.tabs { display: flex; gap: 2px; padding: 8px 8px 6px; }
.tab { background: none; border: 0; border-radius: 5px; padding: 4px 8px; color: var(--fg2); font-weight: 500; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); background: var(--hover); }
.scroll { overflow: auto; flex: 1; min-height: 0; padding-bottom: 12px; }

.layer { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 calc(8px + var(--depth, 0) * 16px); border-radius: 0; cursor: default; }
.layer:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.layer[aria-selected="true"] { background: var(--accent-weak); }
.layer .ico { width: 16px; height: 16px; flex: none; color: var(--fg2); display: grid; place-items: center; }
.layer .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .vl { color: var(--fg2); font-variant-numeric: tabular-nums; }
.layer.group .nm { font-weight: 600; }
.layer.child-sel { background: color-mix(in srgb, var(--accent-weak) 45%, transparent); }

.preset { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; padding: 8px 12px; border: 0; background: none; text-align: left; width: 100%; }
.preset:hover { background: var(--hover); }
.preset-thumb { width: 36px; height: 36px; border-radius: 6px; background: var(--canvas); display: grid; place-items: center; color: var(--accent); }
.preset b { display: block; font-weight: 500; }
.preset span { color: var(--fg2); }

.stage { position: relative; overflow: hidden; min-width: 0; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--space); }
.stage > .sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.frame-label { position: absolute; left: 16px; top: 12px; color: var(--fg2); pointer-events: none; display: flex; gap: 6px; align-items: center; }
.frame-label b { color: var(--fg); font-weight: 500; }
#logo { position: absolute; perspective: 900px; pointer-events: none; }
#logoInner { width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform, filter; }
#logoInner > svg, #logoInner > .img-part { width: 100%; height: 100%; display: block; overflow: visible; }
#logoInner .part { transform-box: fill-box; transform-origin: center; }
.img-part img { width: 100%; height: 100%; object-fit: contain; display: block; }
#glass { position: absolute; pointer-events: none; }
#rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.ring-hit { fill: none; stroke: transparent; cursor: grab; pointer-events: stroke; }
.ring-hit:hover + .ring-line, .ring.spinning .ring-line { stroke: var(--accent); }
.ring.spinning .ring-hit { cursor: grabbing; }
.ring-line { fill: none; stroke: var(--orbit); stroke-width: 1; pointer-events: none; }
.ring.spec .ring-line { stroke: #4A505C; stroke-dasharray: 1 5; stroke-linecap: round; }
:root[data-theme="light"] .ring.spec .ring-line { stroke: #B9BEC6; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .ring.spec .ring-line { stroke: #B9BEC6; } }
.ring-name { font: 600 9px var(--ui); letter-spacing: .16em; text-transform: uppercase; fill: var(--fg2); pointer-events: none; }
.dial-label { font: 500 10px var(--ui); fill: var(--fg2); paint-order: stroke; stroke: var(--space); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.dial-label.movable { pointer-events: auto; cursor: grab; }
.dial-label.on { fill: var(--accent); }
.dial-label.crowded:not(.on) { opacity: 0; }
.compact .dial-label:not(.on) { display: none; }
.dial { cursor: ns-resize; outline: none; }
.dial .face { stroke: var(--line); stroke-width: 1; }
.face-0 { stop-color: var(--dial-lit); }
.face-1 { stop-color: var(--dial-shade); }
.dial.moving { cursor: grabbing; }
.dial .halo { fill: var(--accent); pointer-events: none; }
.dial .halo.neg { fill: var(--warm); }
.dial .halo-ring { fill: none; stroke: var(--accent); stroke-width: 2; pointer-events: none; }
.dial .halo-ring.neg { stroke: var(--warm); }
.echo-0 { stop-color: var(--logo, #7B61FF); stop-opacity: .7; }
.echo-1 { stop-color: var(--logo, #7B61FF); stop-opacity: 0; }
.echo-glow { pointer-events: none; }
.marker { stroke: var(--fg); stroke-width: 1.25; stroke-linecap: round; opacity: .55; pointer-events: none; }
.curve path { fill: none; pointer-events: none; }
.curve .pos { stroke: var(--accent); }
.curve .neg { stroke: var(--warm); }
.stag line { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; pointer-events: none; }
.live-btn[aria-pressed="false"] .wave { opacity: 0; }
.live-btn[aria-pressed="true"] { color: var(--accent); }
.held-rails path, .held-rails line { fill: none; stroke: var(--fg); stroke-width: 1; opacity: .5; pointer-events: none; }
.limb-label { font: 500 9px var(--ui); fill: var(--fg2); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; pointer-events: none; }
.playhead-line { fill: none; stroke: var(--fg3); stroke-dasharray: 2 4; pointer-events: none; }
.playhead-tick { stroke: var(--fg3); pointer-events: none; }
.playhead-arc { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: .55; pointer-events: none; }
.playhead-dot { fill: var(--handle); stroke: var(--accent); stroke-width: 1.5; pointer-events: none; }
.playhead-hit { fill: none; stroke: transparent; cursor: ew-resize; pointer-events: stroke; }
.dial .face-shadow { fill: rgba(0,0,0,.1); }
.dial:hover .face { stroke: var(--fg3); }
.dial .arc-track { fill: none; stroke: var(--track); stroke-linecap: round; }
.dial .arc-val { fill: none; stroke: var(--accent); stroke-linecap: round; }
.dial .knob { fill: var(--accent); }
.dial .arc-track, .dial .arc-val, .dial .knob { cursor: grab; }
.dial .stop { fill: var(--fg3); }
.dial .val { font: 500 10px var(--ui); fill: var(--fg); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; pointer-events: none; }
.dial .val.zero { fill: var(--fg3); }
.dial .sel, .dial .hdl { display: none; }
.dial.selected .sel { display: block; fill: none; stroke: var(--accent); stroke-width: 1; }
.dial.selected .hdl { display: block; fill: var(--handle); stroke: var(--accent); stroke-width: 1; }
.dial:focus-visible .face { stroke: var(--accent); stroke-width: 2; }

.tbtn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; color: var(--fg); }
.tbtn:hover { background: var(--hover); }
.tbtn.primary { background: var(--accent); color: var(--accent-fg); }
.tbtn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.tsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.time { color: var(--fg2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.time b { color: var(--fg); font-weight: 500; }

.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 12px; display: grid; place-items: center; color: var(--accent); font-weight: 600; font-size: 13px; background: color-mix(in srgb, var(--accent-weak) 60%, transparent); pointer-events: none; }

.section { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.section:last-child { border-bottom: 0; }
.sec-title { font-weight: 600; display: flex; align-items: center; justify-content: space-between; min-height: 16px; }
.chip { font-weight: 500; color: var(--fg2); background: var(--hover); border-radius: 4px; padding: 0 6px; }
.dial-title { font-size: 13px; font-weight: 600; }
.muted { color: var(--fg2); }
.row { display: flex; gap: 8px; align-items: center; }
.field { display: flex; align-items: center; height: 24px; border-radius: 5px; background: var(--hover); border: 1px solid transparent; flex: 1; min-width: 0; }
.field:hover { border-color: var(--line); }
.field:focus-within { border-color: var(--accent); background: var(--panel); }
.field .scrub { width: 24px; height: 22px; display: grid; place-items: center; color: var(--fg2); cursor: ew-resize; flex: none; }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: none; height: 22px; padding: 0 4px; outline: none; font-variant-numeric: tabular-nums; }
.field select { padding-left: 8px; }
.field .unit { color: var(--fg2); padding-right: 8px; }
.ibtn { height: 24px; border-radius: 5px; border: 0; background: none; padding: 0 8px; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; }
.ibtn:hover { background: var(--hover); }
.btn { height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: var(--hover); }
.btn.blue { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.blue:hover { filter: brightness(1.08); }
.meter { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.hint { color: var(--fg2); }
kbd { font: 500 10px var(--ui); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--fg); background: var(--panel); }

.logos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.logo-opt { aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line); background: var(--canvas); display: grid; place-items: center; padding: 6px; max-width: 100%; }
.logo-opt svg { width: 100%; height: 100%; }
.logo-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.logo-opt.upload { color: var(--fg2); border-style: dashed; }
.logo-opt:hover { border-color: var(--fg3); }
.color-field input[type="color"] { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 3px; margin-left: 4px; background: none; flex: none; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.code { font: 400 10px/15px ui-monospace, "SF Mono", Menlo, monospace; background: var(--canvas); border-radius: 6px; padding: 8px; max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: var(--fg2); }

.toast { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); background: var(--toast); color: var(--toast-fg); padding: 8px 12px; border-radius: 6px; box-shadow: var(--shadow-lg); font-weight: 500; z-index: 10; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); z-index: 20; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-lg); width: min(560px, 100%); padding: 16px; display: grid; gap: 10px; }
.modal-card textarea { width: 100%; height: 260px; box-sizing: border-box; font: 400 10px/15px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); color: var(--fg); padding: 8px; resize: vertical; }

@media (max-width: 860px) {
  body { overflow: auto; height: auto; }
  html { height: auto; }
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .stage { order: 1; height: min(108vw, 76vh); min-height: 400px; }
  .right { order: 2; border-left: 0; border-top: 1px solid var(--line); }
  .left { order: 3; border-right: 0; border-top: 1px solid var(--line); }
  .left .file { display: none; }
  .scroll { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--c, var(--fg)); color: var(--accent-fg); font: 700 9px/1 var(--ui); letter-spacing: 0; display: inline-grid; place-items: center; flex: none; box-sizing: border-box; }
.avatar.s30 { width: 30px; height: 30px; }
.avatar.s20 { width: 20px; height: 20px; }
.avatar.s18 { width: 18px; height: 18px; }
.avatar.s16 { width: 16px; height: 16px; }
.avatar.you { background: var(--fg); color: var(--panel); font-size: 8px; }
.avatar.s16.you, .avatar.badge-m { font-size: 7px; }
.avatar.badge-m { background: var(--accent); color: var(--panel); }
.tx { display: grid; min-width: 0; flex: 1; }
.tx > b { font-weight: 500; }
.eyebrow { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px 4px; white-space: nowrap; }
.eyebrow b, .eyebrow-t { font: 600 9px/12px var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--fg2); }
.eyebrow span { color: var(--fg3); }
.divider { height: 1px; background: var(--line); }
.divider.gap { margin-top: 24px; }

.roster-row { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: default; outline-offset: -2px; }
.roster-row:hover { background: var(--hover); }
.roster-row[aria-selected="true"] { background: var(--accent-weak); }
.roster-row .tx > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { display: flex; gap: 4px; align-items: center; }
.st i { width: 6px; height: 6px; border-radius: 50%; background: var(--fg3); flex: none; }
.st.on i { background: var(--c); }
.more { border: 0; background: none; color: var(--fg2); width: 24px; height: 24px; border-radius: 5px; opacity: 0; flex: none; }
.roster-row:hover .more, .more:focus-visible { opacity: 1; }
.more:hover { background: var(--line); color: var(--fg); }
.add-agent { margin: 6px 12px 10px; width: calc(100% - 24px); height: 30px; border: 1px dashed var(--line); border-radius: 6px; background: none; display: flex; gap: 6px; align-items: center; justify-content: center; font-weight: 500; }
.add-agent b { font-weight: 600; }
.add-agent:hover { background: var(--hover); border-color: var(--fg3); }
.feed { display: grid; gap: 12px; padding: 6px 12px 12px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; }

.card { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.card.last { border-bottom: 0; }
.card-head { display: flex; gap: 8px; align-items: center; }
.card-head b { flex: 1; min-width: 0; font-weight: 600; }
.card-head b.title { font-size: 13px; letter-spacing: 0; }
.tagchip { background: var(--c); color: var(--accent-fg); border-radius: 4px; padding: 0 6px; font-weight: 500; white-space: nowrap; }
.diff { display: flex; gap: 6px; height: 24px; align-items: center; white-space: nowrap; }
.diff b { flex: 1; font-weight: 500; }
.diff .from { color: var(--fg3); }
.diff .arr { color: var(--fg2); }
.diff .to { background: var(--c); color: var(--accent-fg); border-radius: 4px; padding: 0 6px; font-weight: 600; }
.fitrow { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.fitrow b { font-weight: 500; font-variant-numeric: tabular-nums; }
.fitrow .meter { flex: 1; display: flex; }
.meter i.was { background: var(--fg3); }
.meter i.gain { background: var(--c); }
.meter.thin { height: 3px; }
.actions { display: flex; gap: 6px; }
.btn.grow { flex: 1; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.h30 { height: 30px; padding: 0 12px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.step { display: flex; gap: 8px; align-items: flex-start; }
.step svg { flex: none; color: var(--c); margin-top: 1px; }
.segmented { display: flex; gap: 2px; padding: 2px; border-radius: 6px; background: var(--hover); }
.segmented button { flex: 1; border: 0; background: none; border-radius: 5px; padding: 3px 0; font-weight: 500; color: var(--fg2); line-height: 16px; }
.segmented button[aria-checked="true"] { background: var(--panel); color: var(--fg); box-shadow: var(--shadow); }
.score { display: grid; gap: 4px; }
.score-row { display: flex; justify-content: space-between; }
.score-row b { font-weight: 500; }
.score .by { color: var(--fg3); }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.bubble { flex: 1; min-width: 0; background: var(--hover); border-radius: 8px; padding: 6px 8px; }
.bubble.agent { background: var(--accent-weak); }
.field.ask { height: 28px; margin: 0; }
.field.ask input { padding: 0 8px; }

.stage { container-type: inline-size; }
.stage.exploring #logo, .stage.exploring #glass, .stage.exploring #rings, .stage.exploring #cursors, .stage.exploring #notes, .stage.exploring .frame-label, .stage.exploring .presence { display: none; }
.stage-top-r { position: absolute; right: 16px; top: 10px; display: flex; gap: 8px; align-items: center; z-index: 2; }
#modeSwitch { background: var(--panel); box-shadow: var(--shadow); }
#modeSwitch button { flex: none; padding: 3px 10px; }
#modeSwitch button[aria-checked="true"] { background: var(--hover); box-shadow: none; }
.presence { height: 28px; display: flex; gap: 8px; align-items: center; padding: 4px 10px 4px 6px; border: 0; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-lg); font-weight: 500; white-space: nowrap; z-index: 2; }
.presence .stack { display: flex; }
.presence .avatar { border: 2px solid var(--panel); margin-right: -6px; }
.presence .avatar:last-child { margin-right: 0; }
@container (max-width: 520px) { .presence > span:last-child { display: none; } }
#cursors, #notes { position: absolute; inset: 0; pointer-events: none; }
.cursor { position: absolute; left: 0; top: 0; color: var(--c); transition: transform .5s cubic-bezier(.2, .7, .2, 1); z-index: 3; will-change: transform; }
.cursor svg { display: block; }
.cursor .tag { margin-left: 12px; display: flex; gap: 6px; width: max-content; background: var(--c); color: var(--accent-fg); padding: 3px 8px 3px 6px; border-radius: 2px 6px 6px 6px; white-space: nowrap; }
.cursor .tag b { font-weight: 600; }
.cursor .tag span { opacity: .85; }
.cursor .tag span:empty { display: none; }
.cursor.flip .tag { margin-left: 4px; transform: translateX(-100%); border-radius: 6px 2px 6px 6px; }
.note { position: absolute; left: 0; top: 0; width: 216px; box-sizing: border-box; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px; display: grid; gap: 6px; pointer-events: auto; z-index: 4; }
.note-head { display: flex; gap: 6px; align-items: center; }
.note-head b { font-weight: 600; }
.note-head .muted { flex: 1; }
.note-head .x { padding: 0 2px; opacity: 0; }
.note:hover .x, .note .x:focus-visible { opacity: 1; }
.note-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.note-actions button { border: 0; border-radius: 5px; padding: 3px 8px; font-weight: 500; background: var(--hover); line-height: 16px; }
.note-actions button.primary { background: var(--c); color: var(--accent-fg); }
.ghost-arc { pointer-events: none; }
.ghost-arc path { fill: none; stroke: var(--c); stroke-width: 2.5; }
.ghost-arc circle { fill: var(--handle); stroke: var(--c); stroke-width: 2; }
.ghost-arc rect { fill: var(--c); }
.ghost-arc text { fill: #fff; font: 600 11px var(--ui); }
.ring.agent-on .ring-line { stroke: var(--c); stroke-width: 1.5; }
.ring.agent-on .ring-name { fill: var(--c); }

.composer { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(640px, calc(100% - 24px)); box-sizing: border-box; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; z-index: 5; }
.input-row { display: flex; gap: 8px; align-items: center; margin: 0; }
.picker { position: relative; display: flex; gap: 6px; align-items: center; background: var(--hover); border-radius: 8px; padding: 4px 8px 4px 4px; min-height: 20px; flex: none; white-space: nowrap; font-weight: 500; }
.picker .muted { font-weight: 400; }
.picker span:empty { display: none; }
.picker select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.picker:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.input-row input { flex: 1; min-width: 0; height: 32px; border: 0; background: none; outline: none; }
.send { width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none; }
.send:hover { filter: brightness(1.08); }
.chips-row { display: flex; gap: 6px; align-items: center; }
.chips { display: flex; gap: 6px; flex: 1; min-width: 0; overflow: hidden; padding: 1px; margin: -1px; }
.qchip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 4px 10px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.qchip:hover { background: var(--hover); }
.play { width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; display: grid; place-items: center; color: var(--fg); flex: none; }
.play:hover { background: var(--hover); }
@container (max-width: 520px) { .picker .muted, .chips-row .time { display: none; } }

#explore { position: absolute; inset: 0; overflow: auto; padding: 12px 24px 116px; box-sizing: border-box; }
.ex-label { display: flex; gap: 6px; margin: 0 0 16px -8px; color: var(--fg2); white-space: nowrap; }
.ex-label b { color: var(--fg); font-weight: 500; }
.ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 896px; }
@container (max-width: 760px) { .ex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 480px) { .ex-grid { grid-template-columns: minmax(0, 1fr); } }
.ex-empty { max-width: 320px; margin: 18vh auto 0; display: grid; gap: 8px; justify-items: center; text-align: center; color: var(--fg2); }
.ex-empty b { color: var(--fg); font-size: 13px; font-weight: 600; }
.var { display: block; padding: 0; text-align: left; background: var(--panel); border: 2px solid transparent; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.var[aria-pressed="true"] { border-color: var(--accent); }
.var-prev { display: block; position: relative; height: 196px; background: var(--canvas); overflow: hidden; color: var(--c); }
.var-prev .rings { position: absolute; left: 50%; top: 12px; width: 172px; height: 172px; margin-left: -86px; }
.onion { position: absolute; left: 50%; top: 98px; width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.onion img { position: absolute; inset: 0; width: 100%; height: 100%; }
.onion .shot { inset: -50%; width: 200%; height: 200%; max-width: none; }
.var-prev .curve { position: absolute; left: 10px; top: 160px; }
.idc, .fitc { position: absolute; top: 10px; background: var(--panel); color: var(--fg); border-radius: 4px; padding: 1px 6px; }
.idc { left: 10px; font-weight: 600; }
.fitc { right: 10px; color: var(--fg2); display: flex; gap: 4px; }
.fitc b { color: var(--fg); font-weight: 600; }
.fitc b.good { color: var(--green); }
.var-body { display: grid; gap: 6px; padding: 10px 12px 12px; }
.var-body > b { font-weight: 600; }
.var-body .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vchips { display: flex; gap: 4px; flex-wrap: wrap; }
.vchip { background: var(--hover); border-radius: 4px; padding: 1px 6px; font-weight: 500; }
.author { display: flex; gap: 6px; align-items: center; color: var(--fg2); }

.tree { padding: 0 8px; }
.tnode { display: flex; gap: 8px; align-items: center; height: 28px; width: 100%; box-sizing: border-box; padding: 0 8px 0 6px; border: 0; border-radius: 6px; background: none; text-align: left; }
button.tnode:hover { background: var(--hover); }
.tnode .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tnode .vl { color: var(--fg2); }
.tnode[aria-selected="true"] { background: var(--accent-weak); }
.tnode[aria-selected="true"] .nm { font-weight: 600; }
.tkids { position: relative; padding-left: 18px; }
.tkids::before { content: ""; position: absolute; left: 13px; top: 0; bottom: 14px; width: 1px; background: var(--line); }
.running { display: grid; gap: 8px; padding: 6px 12px 12px; }
.running > div { display: grid; gap: 6px; }
.run-row { display: flex; gap: 8px; align-items: center; }

.sheet { width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.sheet-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.sheet-head > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.sheet-head h2 { margin: 0; font: 600 13px/16px var(--ui); letter-spacing: 0; }
.x { border: 0; background: none; color: var(--fg2); font-weight: 500; border-radius: 4px; }
.x:hover { color: var(--fg); }
.sheet-body { display: flex; min-height: 0; overflow: auto; }
.sources { width: 232px; flex: none; box-sizing: border-box; background: var(--canvas); border-right: 1px solid var(--line); padding: 16px 12px; display: grid; gap: 6px; align-content: start; }
.source { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1.5px solid transparent; border-radius: 8px; background: none; text-align: left; }
.source:hover { background: var(--hover); }
.source[aria-checked="true"] { background: var(--panel); border-color: var(--accent); }
.source .tx { gap: 2px; }
.radio { width: 14px; height: 14px; box-sizing: border-box; border: 1.5px solid var(--fg3); border-radius: 50%; background: var(--panel); flex: none; margin-top: 1px; }
.source[aria-checked="true"] .radio { border: 4px solid var(--accent); background: #fff; }
.config { flex: 1; min-width: 0; padding: 16px 20px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.config .group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.group-h { display: flex; justify-content: space-between; }
.group-h b { font-weight: 600; }
.f30 { display: flex; gap: 8px; align-items: center; height: 30px; box-sizing: border-box; background: var(--hover); border: 1px solid transparent; border-radius: 6px; padding: 0 6px 0 8px; min-width: 0; }
.f30.grow { flex: 1; }
.f30:focus-within { border-color: var(--accent); background: var(--panel); }
.f30.bad { border-color: #F24822; }
.f30 input, .f30 select { flex: 1; min-width: 0; height: 28px; border: 0; background: none; outline: none; padding: 0; }
.f30 .mono { font-size: 10px; letter-spacing: 0; }
.conn { background: var(--fg3); color: var(--accent-fg); border-radius: 4px; padding: 2px 6px; font-weight: 500; white-space: nowrap; }
.toolchips { display: flex; flex-wrap: wrap; gap: 6px; }
.toolchip { border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-size: 10px; line-height: 15px; letter-spacing: 0; }
.idrow { display: flex; gap: 10px; align-items: center; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--c); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--fg); }
.perm-row { display: flex; gap: 12px; align-items: center; padding: 4px 0; }
.level { flex: none; }
.level button { flex: none; width: 62px; height: 22px; }
.limits { display: flex; gap: 12px; }
.limits > * { flex: 1; min-width: 0; }
.sheet-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px 12px 20px; border-top: 1px solid var(--line); }
.sheet-foot p { flex: 1; min-width: 0; margin: 0; color: var(--fg2); }
@media (max-width: 680px) {
  .sheet-body { flex-direction: column; }
  .sources { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .level button { width: 50px; }
}
@media (prefers-reduced-motion: reduce) { .cursor { transition: none; } }

.app.manual #tabRoster, .app.manual #tabBranches, .app.manual #tabAgent, .app.manual .presence, .app.manual #cursors, .app.manual #notes, .app.manual .input-row, .app.manual .chips { display: none; }
.app.manual .composer { width: max-content; max-width: calc(100% - 24px); border-radius: 13px; padding: 4px 12px 4px 4px; }
.app.manual .play { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-fg); }

.lock { cursor: pointer; opacity: 0; transition: opacity .12s; }
.lock .hit { fill: transparent; }
.lock .bg { fill: var(--panel); stroke: var(--line); }
.lock .body { fill: var(--fg); }
.lock .shackle { fill: none; stroke: var(--fg); stroke-width: 1.1; stroke-linecap: round; }
.lock .shut, .dial.locked .lock .open, .ring.held > .lock .open { display: none; }
.dial.locked .lock .shut, .ring.held > .lock .shut { display: block; }
.dial:hover > .lock, .dial:focus-visible > .lock, .ring:hover > .lock { opacity: .55; }
.lock:hover { opacity: 1 !important; }
.ring.part-held > .lock { opacity: .6; }
.dial.locked > .lock, .ring.held > .lock { opacity: 1; }
.ring-line2 { display: none; fill: none; pointer-events: none; }
.ring.held .ring-line { stroke-dasharray: none; stroke: var(--fg2); stroke-width: 7; opacity: .55; }
.ring.held .ring-line2 { display: block; stroke: var(--space); stroke-width: 4.5; }
.ring.held .ring-name { fill: var(--fg); }
.lock-all .shut, .lock-all[aria-pressed="true"] .open { display: none; }
.lock-all[aria-pressed="true"] .shut { display: block; }
.lock-all[aria-pressed="true"] { background: var(--hover); }
.lock-all[aria-pressed="true"] .body { fill: currentColor; }
.dial.locked, .dial.locked .arc-track, .dial.locked .arc-val, .dial.locked .knob { cursor: not-allowed; }
.dial.locked .arc-val { stroke: var(--fg3); }
.dial.locked .knob { fill: var(--fg3); }
.dial.locked .val { fill: var(--fg2); }
.lk { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 0; border-radius: 4px; background: none; color: var(--fg2); opacity: 0; margin-right: -4px; }
.layer:hover .lk, .lk:focus-visible, .lk.on, .lk.some { opacity: 1; }
.lk:hover { background: var(--line); color: var(--fg); }
.lk.on { color: var(--fg); }
.lk.some { color: var(--fg3); }
.ibtn:disabled, .field input:disabled, .field select:disabled { opacity: .45; }
.ibtn[aria-pressed="true"] { background: var(--hover); }

#logoFrame { position: absolute; z-index: 2; box-sizing: border-box; border: 1px solid transparent; outline: none; touch-action: none; }
#logoFrame:hover, #logoFrame:focus-visible, #logoFrame.dragging { border-color: var(--accent); }
#logoFrame .h { display: none; position: absolute; width: 7px; height: 7px; box-sizing: border-box; background: var(--handle); border: 1px solid var(--accent); }
#logoFrame:hover .h, #logoFrame:focus-visible .h, #logoFrame.dragging .h { display: block; }
#logoFrame .tl { left: -4px; top: -4px; cursor: nwse-resize; }
#logoFrame .br { right: -4px; bottom: -4px; cursor: nwse-resize; }
#logoFrame .tr { right: -4px; top: -4px; cursor: nesw-resize; }
#logoFrame .bl { left: -4px; bottom: -4px; cursor: nesw-resize; }
.size-chip { display: none; position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); background: var(--accent); color: var(--accent-fg); border-radius: 3px; padding: 0 5px; font-weight: 500; font-variant-numeric: tabular-nums; }
#logoFrame:focus-visible .size-chip, #logoFrame.dragging .size-chip { display: block; }
.stage.exploring #logoFrame { display: none; }

.parts-tools { display: flex; gap: 2px; padding: 2px 8px 4px 36px; flex-wrap: wrap; }
.parts-tools .ibtn { padding: 0 6px; height: 22px; }
.part-row { cursor: default; }
.part-row .ico img { width: 16px; height: 16px; display: block; }
.part-row[aria-selected="true"] { background: var(--accent-weak); }
.parts-hint { padding: 6px 12px 0 40px; }

#lookSeg button { padding: 3px 0; }
input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); height: 16px; margin: 0; }
.check { gap: 6px; color: var(--fg2); }
.check input { accent-color: var(--accent); margin: 0; }
.loop-tools { display: flex; gap: 2px; flex: none; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.app.manual .loop-tools { order: 3; border-right: 0; border-left: 1px solid var(--line); padding: 0 0 0 8px; margin: 0 0 0 4px; }
.app.manual .loop-tools .play { height: 28px; min-width: 28px; background: none; color: var(--fg); }
.app.manual .loop-tools .play:hover { background: var(--hover); }
.app.manual .chips-row .time { order: 2; }
@container (max-width: 520px) { .app:not(.manual) .loop-tools { display: none; } .app.manual .loop-tools { border-left: 0; padding-left: 0; margin-left: 0; } }
.loop-tools { align-items: center; }
.loop-tools .tsep { height: 16px; margin: 0 3px; }
.play.text { width: auto; padding: 0 6px; font-weight: 500; }
.app.manual .play.text { width: auto; }
.play:disabled { opacity: .35; }
.play:disabled:hover { background: none; }
.app:not(.manual) #restartBtn, .app:not(.manual) #resetAllBtn + .tsep { display: none; }
.app:not(.manual) .chips { overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 20px; }
.chips::-webkit-scrollbar { display: none; }

.hlist { display: grid; gap: 2px; margin: 0 -8px; }
.hrow { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: default; outline-offset: -2px; }
.hrow:hover { background: var(--hover); }
.hrow .tx > b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .tx > .muted { white-space: nowrap; }
.hrow.now { background: var(--accent-weak); }
.hrow.future { opacity: .45; }
.hrow .keep { opacity: 0; flex: none; }
.hrow:hover .keep, .hrow .keep:focus-visible { opacity: 1; }
.hrow .chip { flex: none; }
.hrow.pin { margin: 0 -8px; }
.pin-mark { background: var(--hover); color: var(--fg); font-size: 10px; }
.pin-name { border: 1px solid transparent; background: none; border-radius: 4px; padding: 0 2px; margin-left: -3px; font-weight: 500; min-width: 0; }
.pin-name:hover { border-color: var(--line); }
.pin-name:focus { border-color: var(--accent); outline: none; background: var(--panel); }
.section.last { border-bottom: 0; }
.perf { position: fixed; left: 12px; bottom: 12px; z-index: 50; white-space: pre; font: 500 11px/16px ui-monospace, Menlo, monospace; color: #fff; background: rgba(0,0,0,.78); padding: 8px 10px; border-radius: 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
