:root, [data-theme=milk] {          /* warm whites, charcoal ink, yellow point */
  --paper: #FBF8F3;
  --panel: rgba(255, 253, 249, .94);
  --solid: #FFFDF9;
  --ink: #232323;
  --mute: #8E857B;
  --line: rgba(35, 35, 35, .11);
  --hover: rgba(104, 93, 84, .08);
  --on: #232323;
  --on-ink: #FBF8F3;
  --point: #FFC21A;
  --point-grad: linear-gradient(115deg, #FFD84A 0%, #FFC21A 42%, #FF9F6E 78%, #F4B6C8 100%);
  --point-ink: #232323;
  --red: #C8452F;
  --shadow: 0 1px 2px rgba(60, 45, 30, .05), 0 8px 28px rgba(60, 45, 30, .09);
  --sans: "Pretendard Variable", Pretendard, -apple-system, "SF Pro Text", "Apple SD Gothic Neo", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

[data-theme=slate] {                  /* cool mist, graphite ink */
  --paper: #F4F6F8;
  --panel: rgba(252, 253, 254, .94);
  --solid: #FCFDFE;
  --ink: #23262C;
  --mute: #7D8590;
  --line: rgba(35, 38, 44, .11);
  --hover: rgba(62, 83, 100, .08);
  --on: #23262C;
  --on-ink: #F4F6F8;
  --point: #FFD21F;
  --point-grad: linear-gradient(115deg, #FFD84A 0%, #FFC21A 42%, #FF9F6E 78%, #F4B6C8 100%);
  --point-ink: #23262C;
  --shadow: 0 1px 2px rgba(20, 30, 45, .05), 0 8px 28px rgba(20, 30, 45, .1);
}

[data-theme=graphite] {               /* dark graphite, paper-white ink */
  --paper: #23262C;
  --panel: rgba(44, 47, 54, .94);
  --solid: #2C2F36;
  --ink: #F2F0EB;
  --mute: #8F939B;
  --line: rgba(242, 240, 235, .12);
  --hover: rgba(242, 240, 235, .07);
  --on: #F2F0EB;
  --on-ink: #23262C;
  --point: #FFD21F;
  --point-grad: linear-gradient(115deg, #FFD84A 0%, #FFC21A 42%, #FF9F6E 78%, #F4B6C8 100%);
  --point-ink: #23262C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font: 13px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
kbd { font: 500 10.5px var(--sans); padding: 1px 6px; border-radius: 5px; background: var(--hover); margin-right: 5px; }

/* ---------- stage ---------- */
.stage-wrap { position: fixed; inset: 0; background: var(--paper); }
.stage { position: absolute; inset: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.underlay { position: absolute; inset: 0; background: no-repeat center / contain; opacity: .45; pointer-events: none; display: none; }
.underlay.on { display: block; }
.tip { position: absolute; pointer-events: none; font: 500 11.5px var(--sans); background: var(--on); color: var(--on-ink); padding: 4px 9px; border-radius: 7px; white-space: nowrap; transform: translate(14px, 16px); z-index: 3; }
.tip small { opacity: .6; margin-left: 6px; font-size: 10.5px; }
/* click a part: two bubbles stretch out of the product outline like cheese (js/quickpop.js) */
.qpop { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.qpop svg { position: absolute; inset: 0; display: block; overflow: visible; }
.qpop .qp-lead path { fill: none; stroke: var(--ink); stroke-width: 1; }
.qpop .qp-lead circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
/* Color · Setting: set exactly like the model title, ink only */
.qp-words { position: absolute; display: flex; flex-direction: column; gap: 2px; transform: var(--qp-t); }
.qp-word { appearance: none; border: 0; background: none; padding: 0; color: var(--ink); font: inherit; font-size: 24px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; text-align: inherit; cursor: pointer; white-space: nowrap;
  opacity: 0; transform: translate(calc(var(--qp-dx) * -1), calc(var(--qp-dy) * -1)); transition: opacity .45s ease, transform .9s cubic-bezier(.16, 1, .3, 1), color .3s ease; }
.qpop.in .qp-word { opacity: 1; transform: none; pointer-events: auto; }
.qpop.in .qp-word + .qp-word { transition-delay: .07s, .07s, 0s; }
.qp-words:hover .qp-word:not(:hover), .qp-word.gone { color: var(--mute); }
.qp-word.gone { opacity: 0 !important; transition-delay: 0s !important; }
.qp-word:focus-visible { outline: none; color: var(--ink); }

/* empty state */
.empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.empty-card { pointer-events: auto; text-align: center; padding: 40px 48px 30px; border: 1.5px dashed var(--line); border-radius: 22px; min-width: 360px; transition: border-color .15s, background .15s; }
.empty-card svg { color: var(--ink); }
.empty-title { font-size: 17px; font-weight: 600; margin: 14px 0 4px; letter-spacing: -.01em; }
.empty-sub { margin: 0 0 18px; color: var(--mute); font-size: 11.5px; letter-spacing: .02em; }
.empty-samples { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; max-width: 420px; }
.empty-samples button { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 5px 11px; font-size: 12px; color: var(--mute); }
.empty-samples button:hover { color: var(--ink); background: var(--hover); }

/* drag a file over the window */
.dropzone { position: absolute; inset: 14px; border: 2px dashed var(--ink); border-radius: 24px; display: grid; place-items: center; pointer-events: none; opacity: 0; transform: scale(1.015); transition: opacity .15s, transform .25s cubic-bezier(.3, 1.6, .5, 1); background: color-mix(in srgb, var(--paper) 70%, transparent); z-index: 20; }
.dropzone div { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--on); color: var(--on-ink); padding: 14px 22px; border-radius: 16px; }
.dropzone b { font-size: 15px; font-weight: 600; }
.dropzone span { font-size: 12px; opacity: .7; }
body.dragging .dropzone { opacity: 1; transform: none; }

/* ---------- floating HUD ---------- */
.hud { position: fixed; z-index: 10; display: flex; gap: 8px; align-items: flex-start; }
.hud.tr { top: 14px; right: 16px; }
.brand { position: fixed; top: 14px; left: 18px; z-index: 10; display: inline-flex; align-items: center; gap: 9px; height: 30px; color: var(--ink); text-decoration: none; font: 700 11px var(--sans); letter-spacing: .16em; }
.brand svg { display: block; transition: transform .6s cubic-bezier(.16, 1, .3, 1); }
.brand:hover svg { transform: translateY(-1px) rotate(-4deg); }

/* title callout */
.leader { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; overflow: visible; }
.leader path { fill: none; stroke: var(--ink); stroke-width: 1; }
.leader circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.callout { position: fixed; left: 0; top: 0; z-index: 9; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; will-change: transform; }
.callout-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 9px; margin-bottom: 5px; }
.title { display: inline-flex; align-items: baseline; gap: 7px; border: 0; background: none; padding: 0; font-size: 24px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; text-align: left; max-width: 38vw; }
.title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title i { font-style: normal; font-size: 10px; color: var(--mute); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); transform: translateY(-3px); }
.title:hover i, .title.open i { color: var(--ink); }
.title.open i { transform: translateY(-3px) rotate(180deg); }
.meta { font: 500 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.ctx { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.note { color: var(--mute); font-size: 11.5px; max-width: 260px; line-height: 1.45; margin-top: 2px; }
.ctx:empty, .note:empty { display: none; }

.group, .dock, .chip, .pop { background: var(--panel); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); }
.group { display: flex; border-radius: 11px; padding: 3px; gap: 2px; }
.group button, .dock button { border: 0; background: none; height: 30px; padding: 0 11px; border-radius: 8px; font: 600 11px var(--sans); letter-spacing: .04em; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.group button:hover, .dock button:hover { background: var(--hover); }
button.icon { width: 30px; padding: 0 !important; }
button.icon svg circle:not([fill]) { fill: currentColor; }
.rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.rec.on { background: var(--red) !important; color: #fff; }
.rec.on i { background: #fff; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* bottom dock */
.dock { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 13px; }
.dock .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.dock .label { font-weight: 500; letter-spacing: 0; font-size: 12px; }
#btnPlay .i-pause, #btnPlay.on .i-play { display: none; }
#btnPlay.on .i-pause { display: block; }
#btnPlay span, #btnExplode span { min-width: 2.2em; text-align: left; }
.dock .tog.on, .dock .label.open { background: var(--point-grad); color: var(--point-ink); }
.seg { display: flex; gap: 2px; }
.dock .seg button { font-size: 10.5px; letter-spacing: .06em; padding: 0 10px; color: var(--mute); }
.dock .seg button:hover { color: var(--ink); }
.dock .seg button.on { background: var(--point-grad); color: var(--point-ink); }

/* chips + hint + toasts */
.chips { position: fixed; left: 16px; bottom: 50px; z-index: 10; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(50vw - 230px); }
.chip { border-radius: 99px; display: inline-flex; align-items: center; gap: 7px; padding: 0 5px 0 12px; height: 30px; font-size: 12px; }
.chip button { border: 0; background: var(--hover); border-radius: 99px; height: 22px; padding: 0 9px; font-size: 11.5px; font-weight: 500; }
.chip button:hover { background: var(--on); color: var(--on-ink); }
.chip .dots { display: inline-flex; }
.chip .dots i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--ink); margin-left: -3px; }
.chip .dots i:first-child { margin-left: 0; }
.hint { position: fixed; left: 18px; bottom: 22px; z-index: 9; display: flex; gap: 12px; font-size: 11.5px; color: var(--mute); pointer-events: none; transition: opacity .3s; }
.toasts { position: fixed; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 15; display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--on); color: var(--on-ink); border-radius: 10px; padding: 7px 13px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 60vw; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--red); color: #fff; }
.toast.busy::before { content: ""; display: inline-block; width: 9px; height: 9px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; margin-right: 8px; vertical-align: -1px; animation: spin .8s linear infinite; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- popovers ---------- */
.pop { position: fixed; z-index: 30; border-radius: 14px; padding: 6px; transform-origin: var(--ox, 0) var(--oy, 0); }
.menu { min-width: 210px; }
.menu button { display: flex; width: 100%; align-items: baseline; gap: 8px; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 13px; }
.menu button small { color: var(--mute); font-size: 11px; margin-left: auto; }
.menu button:hover { background: var(--hover); }
.menu button.cur { font-weight: 600; }
.menu button.cur::after { content: "●"; font-size: 7px; margin-left: auto; align-self: center; }
.menu .tog::after { content: ""; margin-left: auto; align-self: center; width: 26px; height: 15px; border-radius: 99px; background: var(--line); box-shadow: inset 0 0 0 1px var(--line); transition: background .15s; }
.menu .tog { position: relative; }
.menu .tog::before { content: ""; position: absolute; right: 21px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--solid); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: right .18s cubic-bezier(.3, 1.6, .5, 1); }
.menu .tog.on::after { background: var(--point-grad); }
.menu .tog.on::before { right: 12px; background: var(--point-ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu-h { font-size: 10.5px; color: var(--mute); padding: 4px 10px 2px; letter-spacing: .04em; }

.panel { width: 268px; padding: 12px 14px 14px; }
.f + .f { margin-top: 12px; }
.f > label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--mute); margin-bottom: 6px; }
.f > label span { color: var(--ink); font-variant-numeric: tabular-nums; }
.pop .seg { background: var(--hover); border-radius: 9px; padding: 2px; }
.pop .seg button { flex: 1; border: 0; background: none; border-radius: 7px; padding: 5px 4px; font-size: 12px; white-space: nowrap; color: var(--mute); }
.pop .seg button:hover { color: var(--ink); }
.pop .seg button.on { background: var(--solid); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.swatches { display: flex; gap: 7px; }
.swatches button { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); padding: 0; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.swatches button:hover { transform: scale(1.15); }
.swatches button.on { box-shadow: 0 0 0 2px var(--solid), 0 0 0 3.5px var(--ink); }
input[type=range] { width: 100%; accent-color: var(--ink); margin: 0; }

/* part card (triple-click a part) */
.partcard { width: 292px; padding: 10px 12px 12px; }
.pc-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.pc-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--ink); padding: 0; flex: none; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.pc-dot:hover { transform: scale(1.15); }
.pc-name { flex: 1; min-width: 0; border: 0; background: none; font-size: 14px; font-weight: 600; padding: 3px 4px; border-radius: 6px; outline: none; }
.pc-name:hover, .pc-name:focus { background: var(--hover); }
.pc-row { display: flex; gap: 6px; margin-top: 10px; }
.pc-row button { flex: 1; border: 1px solid var(--line); background: none; border-radius: 8px; padding: 6px 4px; font-size: 12px; }
.pc-row button:hover { background: var(--hover); }
.pc-row button.on { background: var(--point-grad); color: var(--point-ink); border-color: transparent; }
.partcard .f.off { opacity: .35; pointer-events: none; }
.pc-ask { position: relative; margin: 0; }
.pc-ask textarea { display: block; width: 100%; box-sizing: border-box; resize: none; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: 13px/1.45 var(--sans); padding: 8px 36px 8px 10px; outline: none; transition: border-color .15s, box-shadow .15s; }
.pc-ask textarea::placeholder { color: var(--mute); }
.pc-ask textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hover); }
.pc-ask button { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 7px; border: 0; padding: 0; background: var(--on); color: var(--on-ink); font-size: 13px; line-height: 24px; }
.pc-ask button:hover { opacity: .85; }
.pc-said { display: flex; align-items: center; gap: 8px; margin: 7px 2px 2px; font-size: 11.5px; color: var(--mute); min-height: 20px; }
.pc-said span { flex: 1; min-width: 0; line-height: 1.4; }
.pc-said button { flex: none; border: 1px solid var(--line); background: none; border-radius: 999px; padding: 2px 8px; font-size: 11px; color: var(--ink); }
.pc-said button:hover { background: var(--hover); }
.pc-said.busy span { animation: pc-pulse 1s ease-in-out infinite; }
.pc-said.busy button { visibility: hidden; }
@keyframes pc-pulse { 50% { opacity: .35; } }
.pc-more { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.pc-more summary { cursor: pointer; list-style: none; font-size: 11.5px; color: var(--mute); padding: 4px 2px; user-select: none; }
.pc-more summary::-webkit-details-marker { display: none; }
.pc-more summary::after { content: ' ▾'; }
.pc-more[open] summary::after { content: ' ▴'; }
.pc-more summary:hover { color: var(--ink); }

/* colour pop (double-click a part) */
.cpop { position: absolute; width: 0; height: 0; z-index: 5; }
.cpop button { position: absolute; left: 0; top: 0; padding: 0; border: 1px solid var(--ink); border-radius: 50%; will-change: transform; }
.cpop .cpop-cur { width: 46px; height: 46px; box-shadow: 0 0 0 4px var(--solid), 0 0 0 5px var(--line), var(--shadow); z-index: 1; }
.cpop .cpop-sw { width: 26px; height: 26px; transition: width .12s, height .12s; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.cpop .cpop-sw:hover { width: 34px; height: 34px; z-index: 2; }
.cpop .cpop-sw.on { box-shadow: 0 0 0 2px var(--solid), 0 0 0 3px var(--ink); }
.cpop .cpop-plus { background: var(--solid) !important; color: var(--ink); font: 15px/1 var(--sans); }
.cpop-native { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line); background: var(--solid); color: var(--ink); border-radius: 16px; padding: 18px; width: min(760px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .3); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 10px; font-size: 14px; }
dialog h3 small { color: var(--mute); font-weight: 400; margin-left: 8px; font-size: 11.5px; }
dialog textarea { width: 100%; height: 60vh; font: 11.5px/1.5 var(--mono); white-space: pre; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--paper); outline: none; resize: vertical; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.btn { border: 1px solid var(--line); background: none; border-radius: 10px; padding: 7px 14px; font-size: 12.5px; font-weight: 500; }
.btn:hover { background: var(--hover); }
.btn.solid { background: var(--on); color: var(--on-ink); border-color: var(--on); }
.btn.solid:hover { opacity: .85; }
.ctx select { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M.5.5 4 4 7.5.5' fill='none' stroke='%23151515' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center; border-radius: 9px; padding: 5px 26px 5px 10px; font-size: 12px; box-shadow: var(--shadow); cursor: pointer; }
.ctx .chip { box-shadow: var(--shadow); }

/* ---------- view cube (bottom right) ---------- */
.vcube { position: fixed; right: 44px; bottom: 44px; width: 56px; height: 56px; z-index: 10; --h: 28px; cursor: grab; touch-action: none; user-select: none; }
.vcube.drag { cursor: grabbing; }
.vc-cube { position: absolute; inset: 0; transform-style: preserve-3d; }
.vc-face { position: absolute; inset: 0; display: grid; place-items: center; background: var(--solid); border: 1px solid var(--ink); backface-visibility: hidden; font: 600 13px var(--sans); color: var(--ink); transition: background .12s, color .12s; }
.vc-face span { pointer-events: none; }
.vc-face:hover { background: var(--on); color: var(--on-ink); }
.vc-face[data-face=top] { background: color-mix(in srgb, var(--solid) 88%, var(--ink)); }
.vc-face[data-face=top]:hover { background: var(--on); }
.vc-corner { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px; border-radius: 50%; }
.vc-corner::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--ink); opacity: 0; transition: opacity .12s, transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.vc-corner:hover::after { opacity: 1; transform: scale(1.3); }
.vcube.drag .vc-face:hover { background: var(--solid); color: var(--ink); }

/* ---------- export ---------- */
.frame-btn span { min-width: 2.4em; text-align: left; }
.frame { position: fixed; inset: 0; pointer-events: none; z-index: 7; }
.frame i { position: absolute; background: color-mix(in srgb, var(--paper) 72%, transparent); }
.frame b { position: absolute; border: 1px solid var(--ink); }
.frame span { position: absolute; font: 600 10px var(--mono); letter-spacing: .08em; color: var(--mute); }
.menu.flat { padding: 0; margin: 10px -6px -4px; min-width: 0; }
#btnRec.on span { font-variant-numeric: tabular-nums; }

/* ---------- sun handle ---------- */
.sun { position: fixed; left: -12px; top: -12px; width: 24px; height: 24px; z-index: 6; cursor: grab; color: var(--ink); opacity: .45; transition: opacity .15s; touch-action: none; }
.sun svg { display: block; overflow: visible; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.sun svg circle { fill: var(--solid); stroke: currentColor; stroke-width: 1.3; }
.sun svg line { stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.sun:hover, body.sun-drag .sun { opacity: 1; }
.sun:hover svg, body.sun-drag .sun svg { transform: scale(1.25) rotate(22deg); }
body.sun-drag, body.sun-drag * { cursor: grabbing !important; }
.sun-ring { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .2s; }
.sun-ring path, .sun-ring line { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 4; }
body.sun-drag .sun-ring, .sun:hover ~ .sun-ring { opacity: .6; }
.sun.idle { opacity: 0; pointer-events: none; transition: opacity .6s; }

/* ---------- rigging on the model ---------- */
.pc-links { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.pc-links:empty { display: none; }
.pc-link { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 4px 4px 8px; border-radius: 8px; background: var(--hover); }
.pc-link b { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-link em { font-style: normal; color: var(--mute); font-size: 11px; }
.pc-link button { border: 0; background: none; border-radius: 6px; padding: 2px 6px; font-size: 11.5px; color: var(--mute); }
.pc-link button:hover { background: var(--on); color: var(--on-ink); }
.pc-row.tight { margin-top: 0; }
.pc-row.tight button { font-size: 11.5px; padding: 6px 2px; }
.links { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; overflow: visible; }
.links line { stroke: var(--red); stroke-width: 1.2; }
.links line.dash { stroke-dasharray: 4 4; }
.links circle { fill: var(--red); stroke: var(--paper); stroke-width: 2; }
.links text { font: 600 10.5px var(--sans); fill: var(--red); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
body.picking .stage canvas { cursor: crosshair !important; }
.dock button:disabled { opacity: .3; cursor: default; background: none !important; }

/* ---------- long press: visibility ---------- */
.vispop { display: flex; gap: 3px; padding: 5px; border-radius: 15px; }
.vispop button { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 66px; padding: 9px 4px 7px; border: 0; background: none; border-radius: 11px; font-size: 11.5px; font-weight: 500; color: var(--ink); transition: background .12s, transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.vispop button:hover, .vispop button.hover { background: var(--hover); transform: translateY(-2px); }
.vispop button.on { background: var(--point-grad); color: var(--point-ink); }
.vispop button.on svg path[stroke="var(--panel)"] { stroke: var(--point); }
.press-ring { position: fixed; left: 0; top: 0; width: 44px; height: 44px; pointer-events: none; z-index: 40; opacity: 0; }
.press-ring circle { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 107; stroke-dashoffset: 107; transform: rotate(-90deg); transform-origin: 22px 22px; stroke-linecap: round; }
.press-ring.run { opacity: 1; transition: opacity .1s .12s; }
.press-ring.run circle { stroke-dashoffset: 0; transition: stroke-dashoffset .4s linear .12s; }
.chip .dots.ghost i { opacity: .35; }
.f > label .muted { color: var(--mute); opacity: .7; font-size: 10.5px; }

/* ---------- off / ghost parts list ---------- */
.chip-open { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.chip-open .caret { font-style: normal; font-size: 9px; color: var(--mute); }
.chip-open:hover span:last-of-type { text-decoration: underline; text-underline-offset: 3px; }
.partslist { width: 300px; max-height: 60vh; overflow-y: auto; padding: 8px; }
.partslist .menu-h { padding: 2px 6px 6px; }
.pl-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px 5px 8px; border-radius: 9px; }
.pl-row:hover { background: var(--hover); }
.pl-row b { flex: 1; min-width: 0; font-weight: 500; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--ink); flex: none; }
.pl-seg { display: flex; gap: 2px; background: var(--hover); border-radius: 8px; padding: 2px; }
.pl-seg button { border: 0; background: none; border-radius: 6px; width: 28px; height: 24px; display: grid; place-items: center; color: var(--mute); }
.pl-seg button:hover { color: var(--ink); }
.pl-seg button.on { background: var(--solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* ---------- capture switches on the title ---------- */
.callout-head { position: relative; }
.cap-btn { position: absolute; left: -34px; top: 1px; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); display: grid; place-items: center; padding: 0; opacity: 0; transform: scale(.8); transition: opacity .15s, transform .25s cubic-bezier(.3, 1.6, .5, 1); box-shadow: var(--shadow); }
.callout:hover .cap-btn, .cap-btn.partial, #capPop:not([hidden]) ~ * .cap-btn { opacity: 1; transform: none; }
.cap-btn.partial::after { content: ""; position: absolute; right: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--point-grad); border: 1.5px solid var(--paper); }
.cap-btn.none { color: var(--mute); }
.callout.no-title .title, .callout.no-meta .meta { opacity: .28; }
.callout.no-title .title span { text-decoration: line-through; text-decoration-thickness: 1px; }
.leader.no-leader path, .leader.no-leader circle { opacity: .25; stroke-dasharray: 3 4; }
.menu-h small { color: var(--mute); opacity: .8; margin-left: 6px; }
.cap-note { font-size: 11px; color: var(--mute); padding: 6px 10px 4px; max-width: 220px; line-height: 1.45; }

/* the title can be dragged elsewhere */
.callout { cursor: grab; }
.callout.dragging { cursor: grabbing; user-select: none; }
.callout.dragging * { cursor: grabbing !important; }
#capAuto:disabled { opacity: .4; }

/* title menu: how the whole model works */
#sampleMenu { width: 320px; }
.how { margin: 2px 4px 6px; }
.how textarea { display: block; width: 100%; box-sizing: border-box; resize: vertical; min-height: 78px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: 13px/1.5 var(--sans); padding: 8px 10px; outline: none; transition: border-color .15s, box-shadow .15s; }
.how textarea::placeholder { color: var(--mute); }
.how textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hover); }
.how-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.how-row span { flex: 1; min-width: 0; font-size: 11.5px; color: var(--mute); line-height: 1.4; }
.how.busy .how-row span { animation: pc-pulse 1s ease-in-out infinite; }
.menu .how-row button { width: auto; flex: none; background: var(--on); color: var(--on-ink); border-radius: 8px; padding: 5px 11px; font-size: 12px; font-weight: 500; }
.menu .how-row button:hover { opacity: .85; background: var(--on); }
.how.busy .how-row button { opacity: .4; pointer-events: none; }

/* title + the ▾ that opens the samples */
.title-row { display: inline-flex; align-items: center; gap: 4px; }
.title-more { border: 0; background: none; padding: 4px 6px; border-radius: 7px; color: var(--mute); line-height: 1; }
.title-more i { display: inline-block; font-style: normal; font-size: 11px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.title-more:hover { background: var(--hover); color: var(--ink); }
.title-more.open { color: var(--ink); }
.title-more.open i { transform: rotate(180deg); }
#samplesPop { width: 220px; }
.sample-scroll { max-height: 236px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin-right: -4px; padding-right: 4px; }

/* embedded in the portfolio: only the drawing (and the play / explode dock) */
body.embed .brand, body.embed .hud, body.embed .hint, body.embed .toasts, body.embed .callout, body.embed .leader,
body.embed .vcube, body.embed .empty { display: none !important; }
body.embed .dock > :not(#btnPlay):not(#btnExplode):not(#btnHome):not(#btnReset) { display: none; }
body.embed .dock > #btnReset + .sep { display: block; }
body.embed .chips { display: none !important; }
body.embed .dock .label span { display: none; }
body.embed .dock .label { padding: 0 10px; }

/* ---------- hand gestures (js/gesture.js) ---------- */
.gest { position: fixed; left: 16px; bottom: 16px; z-index: 11; width: 176px; border-radius: 12px; overflow: hidden; background: var(--solid); box-shadow: var(--shadow); }
.gest video { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; } /* read only, never shown */
.gest canvas { display: block; width: 100%; aspect-ratio: 4 / 3; }
.gest span { display: block; padding: 6px 9px 7px; font-size: 10.5px; line-height: 1.35; color: var(--mute); }
.gest.hit { animation: gest-hit .6s ease-out; }
@keyframes gest-hit { 0% { box-shadow: 0 0 0 3px var(--point), var(--shadow); } 100% { box-shadow: 0 0 0 0 var(--point), var(--shadow); } }

/* embedded (portfolio): keep only the sample's own controls (e.g. KIMA's layouts), top right */
body.embed .callout { display: flex !important; left: auto !important; right: 20px; top: 20px !important; transform: none !important; cursor: auto; }
body.embed .callout-head, body.embed .callout .note { display: none !important; }
/* a sample may keep its how-to in the opened portfolio view (Fanning, 2026-12-05): under its version picker */
body.embed.embed-note .callout { flex-direction: column; align-items: flex-end; }
body.embed.embed-note .callout .note { display: block !important; max-width: 260px !important; text-align: right; }
@media (max-width: 520px) { body.embed .callout { display: none !important; } }
/* embedded and small (the portfolio's preview): the model only, nothing to press */
body.mini .dock, body.mini .sun, body.mini .sun-ring, body.mini .callout, body.mini .frame { display: none !important; }

/* static host (no serve.py): no Claude button, no capture-folder button */
body.hosted [data-act=ask-ai],body.hosted #exOpen{display:none!important}
[data-theme=graphite] .ctx select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M.5.5 4 4 7.5.5' fill='none' stroke='%23FFFDF9' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* phone (2026-12-03): top bar clear of the brand, dock scrolls sideways instead of running off, cube above the dock */
@media (max-width: 600px) {
  /* (2026-12-03) phone: the mark stays (symbol only), the dock drops its words so it fits, the title gets room */
  .brand { top: 14px; left: 12px; }
  .brand span { display: none; }
  .hud.tr { top: 10px; right: 10px; left: 52px; justify-content: flex-end; gap: 6px; }
  .dock .label span { display: none; }
  .leader { display: none; }   /* no room for the leader on a phone: it would cross the note */
  .dock .label { padding: 0 10px; }
  .title { max-width: 78vw; font-size: 21px; }
  .hud.tr .group { flex-wrap: nowrap; }
  .hud.tr .group button { padding-left: 8px; padding-right: 8px; }
  .dock { bottom: max(10px, env(safe-area-inset-bottom)); max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .dock::-webkit-scrollbar { display: none; }
  .dock > * { flex: none; }
  .vcube { right: 18px; bottom: 86px; transform: scale(.8); transform-origin: 100% 100%; }
  .hint { display: none; }
}
