:root {
  --bg: #f2efe9; --surface: #fbfaf7; --surface-2: #f6f3ee; --ink: #1e1d1b; --muted: #716b62; --faint: #a49d92;
  --line: #e4dfd5; --line-2: #d6cfc2; --accent: #ff6a1a; --accent-soft: #ffe6d6; --accent-ink: #ffffff;
  --ok: #2f8f5b; --warn: #b7791f; --err: #c2412d;
  --stage-1: #f7f5f1; --stage-2: #e3ded4;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 6px 24px rgba(40, 30, 20, .08);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151514; --surface: #1d1d1b; --surface-2: #232320; --ink: #f1eee8; --muted: #a59f95; --faint: #6f6a62;
    --line: #2d2c29; --line-2: #3a3834; --accent-soft: #3a2316;
    --stage-1: #2a2926; --stage-2: #161615;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.bar { height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: relative; z-index: 5; }
.back { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); }
.back:hover { background: var(--surface-2); }
.title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.title h1 { font-size: 19px; font-weight: 800; letter-spacing: .02em; margin: 0; white-space: nowrap; text-transform: uppercase; }
.title span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; overflow: hidden; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.chip b { color: var(--ink); font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- layout ---------- */
#layout { display: grid; grid-template-columns: 340px 1fr 340px; height: calc(100vh - 56px); height: calc(100dvh - 56px); }
#layout.no-manual { grid-template-columns: 0 1fr 340px; }
#layout.no-info { grid-template-columns: 340px 1fr 0; }
#layout.no-manual.no-info { grid-template-columns: 0 1fr 0; }
#layout.no-manual #manual, #layout.no-info #info { display: none; }

/* ---------- manual pane ---------- */
#manual { border-right: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; min-height: 0; }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line);
  background: var(--surface); font-size: 13px; }
.text-btn { color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; }
.text-btn:hover { color: var(--ink); }
#pages { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.page { flex: none; position: relative; background: #fff; border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  transition: outline-color .2s; outline: 2px solid transparent; outline-offset: 2px; }
.page img { display: block; width: 100%; height: auto; }
.page.current { outline-color: var(--line-2); }
.page .pno { position: absolute; left: 8px; bottom: 6px; font: 600 10px var(--mono); color: #8a847a; background: rgba(255,255,255,.85);
  padding: 1px 6px; border-radius: 4px; }
.page .kind { position: absolute; right: 8px; top: 8px; font: 600 10px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: #6f6a62; background: rgba(255,255,255,.9); border: 1px solid #e5e0d6; padding: 2px 7px; border-radius: 999px; }
.hot { position: absolute; border-radius: 6px; border: 2px solid transparent; background: transparent; transition: all .18s; padding: 0; }
.hot:hover { border-color: rgba(255,106,26,.55); background: rgba(255,106,26,.06); }
.hot.on { border-color: var(--accent); background: rgba(255,106,26,.09); box-shadow: 0 0 0 4px rgba(255,106,26,.15); }
.hot .tag { position: absolute; left: -2px; top: -2px; background: var(--accent); color: #fff; font: 700 11px var(--sans);
  padding: 2px 7px; border-radius: 6px 0 6px 0; opacity: 0; transition: opacity .18s; }
.hot.on .tag, .hot:hover .tag { opacity: 1; }

/* ---------- stage ---------- */
#stage-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, var(--stage-1) 0%, var(--stage-2) 100%); }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; touch-action: none; }
#tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag3d { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 10px; border-radius: 9px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow);
  font: 700 12px var(--sans); will-change: transform; transition: opacity .15s; }
.tag3d span { font-size: 10px; font-weight: 500; opacity: .7; }
/* pointer up to the part the label sits under */
.tag3d::before { content: ""; position: absolute; top: -5px; left: var(--px, 50%); width: 10px; height: 10px; margin-left: -5px;
  background: inherit; transform: rotate(45deg); border-radius: 2px; }
.tag3d.inside::before { display: none; }
.tag3d.over::before { top: auto; bottom: -5px; }
.tag3d.hw { background: var(--accent); color: #fff; }
.tag3d.hw span { opacity: .85; }

#caption { position: absolute; left: 18px; top: 16px; right: 120px; display: flex; gap: 14px; align-items: flex-start; pointer-events: none; }
.step-no { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; padding: 6px 10px 8px;
  border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); }
.step-no small { font-size: 9px; letter-spacing: .14em; font-weight: 700; opacity: .7; }
.step-no b { font-size: 30px; line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.step-no #cap-of { letter-spacing: .02em; font-weight: 500; }
.cap-body { padding-top: 4px; min-width: 0; }
#cap-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 1px 0 var(--stage-1); }
#cap-uses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; pointer-events: auto; }
.use { display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; }
.use img { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fdfcf9, #d8d2c6); }
.use b { font-weight: 700; }
.use .tool { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }

#camtools { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 3px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); }
#camtools button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-align: left; min-width: 64px; }
#camtools button:hover { background: var(--surface-2); color: var(--ink); }
#camtools button.active { color: var(--ink); background: var(--surface-2); }
#camtools button.toggle.on { color: var(--accent-ink); background: var(--accent); }
#camtools #zoom-in, #camtools #zoom-out { font-size: 16px; line-height: 1; text-align: center; }
#camtools hr { border: 0; border-top: 1px solid var(--line); margin: 3px 2px; }
#cam-more { display: none; }

#explode-box { position: absolute; right: 14px; bottom: 96px; display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line);
  border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--muted); box-shadow: var(--shadow); }
#explode { width: 110px; accent-color: var(--accent); }

#start-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; border: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 34px; border-radius: 22px;
  background: var(--accent); color: #fff; font-size: 20px; font-weight: 800; box-shadow: 0 12px 40px rgba(255,106,26,.35); }
#start-btn span { font-size: 34px; line-height: 1; }
#start-btn small { font-size: 12px; font-weight: 600; opacity: .9; }
#transport { position: absolute; left: 18px; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 16px;
  padding: 10px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
#transport .buttons { display: flex; align-items: center; gap: 4px; }
#transport button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
#transport button:hover { background: var(--surface-2); }
#transport .play { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; }
#transport .play:hover { background: #f05d0e; }
#transport .play svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
#transport .i-pause { display: none; }
#transport.playing .i-pause { display: block; }
#transport.playing .i-play { display: none; }
#transport .right { display: flex; align-items: center; gap: 6px; }
#transport .right button { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); height: 30px; }
#transport .right button.on { color: var(--accent-ink); background: var(--accent); }
#clock { font: 500 12px var(--mono); color: var(--muted); min-width: 92px; text-align: right; }

#scrub { position: relative; flex: 1; height: 34px; cursor: pointer; touch-action: none; }
#ticks { position: absolute; left: 0; right: 0; top: 13px; height: 8px; display: flex; gap: 2px; }
#ticks i { display: block; height: 100%; background: var(--line-2); border-radius: 3px; flex: none; transition: background .2s; }
#ticks i.done { background: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
#ticks i.now { background: var(--accent); }
#fill { display: none; }
#knob { position: absolute; top: 8px; width: 4px; height: 18px; margin-left: -2px; background: var(--ink); border-radius: 3px;
  box-shadow: 0 0 0 3px var(--surface); pointer-events: none; }
#tip { position: absolute; bottom: 36px; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: var(--surface);
  font-size: 12px; padding: 5px 9px; border-radius: 8px; pointer-events: none; opacity: 0; transition: opacity .12s; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; }
#tip.on { opacity: 1; }

#loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted);
  background: var(--bg); z-index: 4; font-weight: 500; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- info pane ---------- */
#info { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 9px 10px 10px; font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { overflow-y: auto; padding: 16px; flex: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.stat { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.stat b { display: block; font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat.wide { grid-column: span 2; display: flex; align-items: baseline; gap: 10px; }
.stat.wide b { font-size: 18px; }
h3 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; font-weight: 700; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.row:hover { background: var(--surface-2); }
.row .thumb { width: 48px; height: 48px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #fdfcf9, #dcd6cb); cursor: zoom-in; border: 1px solid var(--line); flex: none; }
.row .swatch { width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(0,0,0,.12); flex: none; background-size: cover; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 12px; color: var(--muted); }
.row .count { font-weight: 800; font-size: 16px; }
.row .count small { font-weight: 600; color: var(--muted); font-size: 11px; }
.badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--warn); }
.row.cur { background: var(--accent-soft); }
.row .sn { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: grid;
  place-items: center; font-weight: 800; flex: none; }
.row.cur .sn { background: var(--accent); color: #fff; border-color: var(--accent); }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }
details.notes { margin-top: 18px; font-size: 12px; color: var(--muted); }
details.notes summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.notes li { margin: 4px 0; }
.hint { margin-top: 18px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; }
.hint p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.hint textarea { width: 100%; min-height: 64px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 8px;
  font: 13px var(--sans); background: var(--surface); color: var(--ink); }
.btn { border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 600; background: var(--ink); color: var(--surface); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- small screens: stage on top, manual + details below as tabs ---------- */
@media (max-width: 900px) {
  #layout, #layout.no-manual, #layout.no-info { display: flex; flex-direction: column; height: auto; }
  /* phone: the 3D build first, then a strip of manual pages, then the details */
  #stage-wrap { order: 1; height: 64vh; height: 64dvh; flex: none; }
  #manual { order: 2; border-right: 0; border-top: 1px solid var(--line); max-height: none; }
  #info { order: 3; }
  #pages { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 10px; gap: 10px; scroll-snap-type: x proximity; }
  .page { flex: none; width: 38vw; scroll-snap-align: start; }
  .bar { height: 50px; }
  .title h1 { font-size: 16px; }
  .title span { display: none; }
  #info { border-left: 0; }
  .chips, #btn-info, #btn-manual { display: none; }
  #tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag3d { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity .15s; }
.tag3d b, .tag3d span { display: inline-block; }
.tag3d > * { position: relative; }
.tag3d { --lift: 34px; }
.tag3d::before { content: ""; position: absolute; left: -1px; top: calc(-1 * var(--lift)); width: 2px; height: var(--lift);
  background: currentColor; opacity: .55; }
.tag3d::after { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 2px var(--surface); }
.tag3d b { position: absolute; bottom: var(--lift); left: 0; transform: translateX(-50%); white-space: nowrap;
  font: 700 12px var(--sans); padding: 5px 9px; border-radius: 9px; background: var(--ink); color: var(--surface);
  box-shadow: var(--shadow); }
.tag3d span { position: absolute; bottom: calc(var(--lift) + 30px); left: 0; transform: translateX(-50%); white-space: nowrap;
  font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.tag3d.part { color: var(--ink); }
.tag3d.hw { color: var(--accent); --lift: 26px; }
.tag3d.hw b { background: var(--accent); color: #fff; }

#caption { right: 14px; top: 10px; left: 10px; }
  .step-no { min-width: 52px; }
  .step-no b { font-size: 24px; }
  #cap-title { font-size: 14px; }
  /* phone: keep the 3D view clear — a few camera buttons, the rest behind ⋯ */
  #camtools { top: auto; bottom: 74px; right: 8px; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 16px);
    padding: 3px; gap: 2px; }
  #camtools button { min-width: 0; padding: 5px 8px; }
  #camtools:not(.open) button:not(#follow):not(#labels):not(#fit):not(#cam-more) { display: none; }
  #cam-more { display: block; }
  #cap-uses .use:not(:first-child) { display: none; }
  .tag3d { font-size: 10.5px; padding: 3px 7px; border-radius: 7px; gap: 4px; }
  .tag3d span { display: none; }
  #caption .cap-body #cap-uses { margin-top: 4px; }
  #camtools hr { display: none; }
  #explode-box { display: none; }
  #transport { left: 8px; right: 8px; bottom: 8px; gap: 8px; padding: 8px; }
  #transport .right #stepmode, #clock { display: none; }
}

/* ---------- library ---------- */
.lib { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.lib-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 40px; height: 40px; }
.brand h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.brand p { margin: 0; color: var(--muted); }
.drop { border: 2px dashed var(--line-2); border-radius: 18px; padding: 26px; display: flex; align-items: center; gap: 18px;
  background: var(--surface); transition: all .15s; margin-bottom: 26px; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.drop .big svg { width: 26px; height: 26px; }
.drop b { font-size: 16px; }
.drop p { margin: 2px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; position: relative; }
.card:hover { transform: translateY(-2px); }
.card .cover { aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.card .cover img { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 12px 14px 14px; }
.card .t { font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.card .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { display: flex; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .meta b { color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; margin-top: 8px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status.err { color: var(--err); }
.status.err .dot { background: var(--err); animation: none; }
@keyframes pulse { 50% { opacity: .3; } }
.card .menu { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.card:hover .menu, .card:focus-within .menu { opacity: 1; }
.card .menu button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }
.err-text { font-size: 12px; color: var(--err); margin-top: 4px; word-break: break-word; }

/* ---------- hardware inspector ---------- */
.insp { position: fixed; inset: 0; background: rgba(20, 18, 15, .45); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 50; }
.insp.on { display: grid; }
.insp-card { position: relative; background: var(--surface); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex;
  gap: 22px; padding: 22px; max-width: calc(100vw - 30px); flex-wrap: wrap; justify-content: center; }
.insp-view { border-radius: 16px; background: radial-gradient(circle at 50% 38%, #ffffff, #d9d3c8); overflow: hidden; cursor: grab; }
.insp-view canvas { display: block; }
.insp-meta { width: 240px; padding-top: 8px; }
.insp-meta .name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.insp-x { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); }

/* ---------- admin + invite gate ---------- */
.admin .lib-head { align-items: center; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel-card input { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); }
.panel-card #name { flex: 1; min-width: 180px; }
.panel-card #max { width: 64px; margin-left: 6px; }
.fresh { display: block; border-color: var(--accent); }
.fresh .link { margin: 8px 0; padding: 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; font-size: 13px; }
.invite { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.invite.revoked, .dev.revoked { opacity: .55; }
.inv-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.devs { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.dev { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.text-btn { border: 0; background: none; color: var(--err); font-weight: 600; cursor: pointer; }
.gate .gate-card { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; max-width: 520px;
  box-shadow: var(--shadow); }
.gate h2 { margin-top: 0; }
.lib-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.who { font-size: 13px; color: var(--muted); }

/* ---------- find a manual ---------- */
.find { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 12px; margin: -12px 0 22px; }
.find-btn { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); cursor: pointer; box-shadow: var(--shadow); }
.find-btn span { font-size: 22px; }
.find-btn small { color: var(--muted); }
.find-type { display: flex; gap: 8px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.find-type input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); }
.find-result { background: var(--surface); border: 1px solid var(--accent); border-radius: 18px; padding: 16px; margin-bottom: 22px;
  position: relative; box-shadow: var(--shadow); }
.find-result .close { position: absolute; top: 12px; right: 14px; color: var(--muted); }
.found-head { display: flex; gap: 14px; align-items: center; }
.found-head img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.found-head .t { font-size: 18px; font-weight: 800; }
.found-head .chips { margin: 6px 0; flex-wrap: wrap; overflow: visible; }
.text-link { color: var(--muted); font-size: 13px; }
.cand { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cand > div { flex: 1; min-width: 0; }
.cand b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .find { grid-template-columns: 1fr; } }

/* ---------- costs ---------- */
.stats.wide4 { grid-template-columns: repeat(4, 1fr); }
.cost-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin-bottom: 8px; }
.cost-card summary { list-style: none; cursor: pointer; }
.cost-card summary::-webkit-details-marker { display: none; }
.cost-row { display: grid; grid-template-columns: 1fr auto 90px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.cost-card summary .cost-row { border-top: 0; }
.cost-row .amt { text-align: right; font-weight: 800; }
.small { font-size: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.days { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.day { flex: 0 0 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.day i { width: 100%; background: var(--accent); border-radius: 6px 6px 2px 2px; display: block; }
.day span { font: 10px var(--mono); color: var(--muted); }
@media (max-width: 760px) { .stats.wide4, .two { grid-template-columns: 1fr 1fr; } .two { grid-template-columns: 1fr; } .cost-row { grid-template-columns: 1fr 70px; } .cost-row > .muted { display: none; } }

/* ---------- fix mode ---------- */
#fixbar { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 4; display: flex; gap: 10px; align-items: center;
  max-width: calc(100% - 260px); padding: 8px 10px 8px 14px; border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: 13px; }
#fixbar b { color: var(--accent); }
#fixbar .btn.ghost { color: var(--surface); border-color: rgba(255,255,255,.3); }
@media (max-width: 900px) { #fixbar { top: auto; bottom: 120px; max-width: calc(100% - 16px); flex-wrap: wrap; } }

#camstyle { position: absolute; left: 18px; bottom: 96px; display: flex; align-items: center; gap: 2px; padding: 5px 6px 5px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); font-size: 12px; font-weight: 600; color: var(--muted); }
#camstyle span:first-child { margin-right: 6px; }
#camstyle button { border: 0; background: transparent; padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
#camstyle button.on { background: var(--ink); color: var(--surface); }
#camstyle .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
@media (max-width: 900px) { #camstyle { left: 8px; bottom: 120px; padding: 3px 4px 3px 8px; } #camstyle span:first-child { display: none; } #camstyle button { padding: 4px 6px; } }

/* render mode: only the 3D picture (used by the automatic placement check) */
body.render .bar, body.render #manual, body.render #info, body.render #transport, body.render #camtools, body.render #caption,
body.render #explode-box, body.render #camstyle, body.render #tags, body.render #start-btn, body.render #fixbar { display: none !important; }
body.render #layout { display: block; height: 100vh; }
body.render #stage-wrap { width: 100vw; height: 100vh; }
