/* =========================================================
   Babylon 3D 工作台 — studio UI
   ========================================================= */
:root {
  --bg-0: #06060a;
  --bg-1: #0b0b12;
  --ink-0: #f6f4f7;
  --ink-1: rgba(246, 244, 247, 0.72);
  --ink-2: rgba(246, 244, 247, 0.44);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* 主题色 · 粉色（默认）。其余主题在下方覆盖同名变量 */
  --accent: #ff8bbf;
  --accent-rgb: 255, 139, 191;
  --accent-light: #ffb5d6;
  --accent-light-rgb: 255, 181, 214;
  --accent-deep: #ef4f96;
  --accent-deep-rgb: 239, 79, 150;
  --accent-dark: #d62f7d;
  --accent-2: #ffc4e0;
  --accent-2-rgb: 255, 196, 224;
  --accent-tint: #ffe2ef;
  --accent-soft: rgba(var(--accent-rgb), 0.14);

  --teal: #6ee7d8;
  --panel-w: 318px;
  /* 顶栏控件高度：主题色圆点直径与渲染器分段按钮高度共用 */
  --control-h: 30px;
  /* 顶栏控件内文字大小：分段按钮文字与各文字标签共用 */
  --control-text: 13.5px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

/* ---------------- UI 主题色 ---------------- */
:root[data-theme="sky"] {
  --accent: #6cc8ff;
  --accent-rgb: 108, 200, 255;
  --accent-light: #a3e0ff;
  --accent-light-rgb: 163, 224, 255;
  --accent-deep: #2f92ea;
  --accent-deep-rgb: 47, 146, 234;
  --accent-dark: #1a6fc2;
  --accent-2: #7feae8;
  --accent-2-rgb: 127, 234, 232;
  --accent-tint: #d9f2ff;
}
:root[data-theme="mint"] {
  --accent: #6fe6ac;
  --accent-rgb: 111, 230, 172;
  --accent-light: #a6f3cb;
  --accent-light-rgb: 166, 243, 203;
  --accent-deep: #1fae74;
  --accent-deep-rgb: 31, 174, 116;
  --accent-dark: #12895a;
  --accent-2: #8ff2cf;
  --accent-2-rgb: 143, 242, 207;
  --accent-tint: #daffea;
}
:root[data-theme="violet"] {
  --accent: #b28aff;
  --accent-rgb: 178, 138, 255;
  --accent-light: #cfaeff;
  --accent-light-rgb: 207, 174, 255;
  --accent-deep: #8b57f0;
  --accent-deep-rgb: 139, 87, 240;
  --accent-dark: #6f37d4;
  --accent-2: #d3bcff;
  --accent-2-rgb: 211, 188, 255;
  --accent-tint: #eadcff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input, select, output { font-family: inherit; }
.no-script { padding: 24px; color: var(--ink-0); }

#app { position: relative; width: 100vw; height: 100vh; overflow: hidden; }

.render-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  background: #06060a;
}
.stage-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(46% 42% at 50% 46%, rgba(var(--accent-rgb), 0.13), transparent 70%),
    radial-gradient(34% 30% at 62% 62%, rgba(110, 231, 216, 0.06), transparent 72%);
  mix-blend-mode: screen;
}
.stage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(120% 96% at 50% 44%, transparent 38%, rgba(0, 0, 0, 0.32) 82%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.3));
}

/* ---------------- top bar ---------------- */
.topbar {
  position: absolute;
  z-index: 6;
  top: 0; left: 0; right: 0;
  height: 74px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(8, 8, 12, 0.86), rgba(8, 8, 12, 0.4));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 236px; }
.brand-mark {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-light-rgb), 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 22px rgba(var(--accent-deep-rgb), 0.16);
  /* 图标可点击：清掉按钮默认样式，作为“Q 弹”触发区 */
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 100%;
  will-change: transform;
}
.brand-mark:focus-visible {
  outline: 2px solid rgba(var(--accent-light-rgb), 0.72);
  outline-offset: 3px;
}
/* 点击后触发一次挤压 → 拉伸 → 衰减回弹的 Q 弹动画 */
.brand-mark.is-qpop {
  animation: brand-qpop 0.72s cubic-bezier(0.28, 0.84, 0.32, 1) both;
}
@keyframes brand-qpop {
  0%   { transform: scale(1, 1); }
  18%  { transform: scale(1.1, 0.82); }
  40%  { transform: scale(0.9, 1.18); }
  56%  { transform: scale(1.05, 0.94); }
  70%  { transform: scale(0.97, 1.05); }
  84%  { transform: scale(1.01, 0.99); }
  100% { transform: scale(1, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark.is-qpop { animation: none; }
}
.brand-mark .brand-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}
.brand-copy h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: 0.02em; }
.brand-copy p { margin: 3px 0 0; font-size: 11.5px; letter-spacing: 0.2em; color: var(--ink-2); }

.theme { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.theme-label { font-size: var(--control-text); color: var(--ink-2); letter-spacing: 0.1em; white-space: nowrap; }
.theme-list {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.theme-dot {
  position: relative;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease;
}
.theme-dot i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dot-hi), var(--dot-mid) 58%, var(--dot-lo));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.theme-dot:hover { transform: translateY(-1px); }
.theme-dot:hover i { transform: scale(1.06); }
.theme-dot:active i { transform: scale(0.94); }
.theme-dot:focus-visible { outline: none; }
.theme-dot:focus-visible i { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(0, 0, 0, 0.5); }
.theme-dot.is-active i {
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.68), 0 0 12px var(--dot-glow);
}
.theme-dot[data-theme="sky"] { --dot-hi: #abdfff; --dot-mid: #55bdf7; --dot-lo: #1f7ed0; --dot-glow: rgba(85, 189, 247, 0.55); }
.theme-dot[data-theme="pink"] { --dot-hi: #ffd0e6; --dot-mid: #ff8bbf; --dot-lo: #d63c86; --dot-glow: rgba(255, 139, 191, 0.55); }
.theme-dot[data-theme="mint"] { --dot-hi: #caffdf; --dot-mid: #6fe6ac; --dot-lo: #159166; --dot-glow: rgba(111, 230, 172, 0.55); }
.theme-dot[data-theme="violet"] { --dot-hi: #ddccff; --dot-mid: #b28aff; --dot-lo: #7439d8; --dot-glow: rgba(178, 138, 255, 0.55); }

.renderer { display: flex; align-items: center; gap: 12px; }
.renderer-label { font-size: var(--control-text); color: var(--ink-2); letter-spacing: 0.1em; white-space: nowrap; }
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-1);
  font-size: var(--control-text);
  font-weight: 550;
  letter-spacing: 0.02em;
  height: var(--control-h);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.22s ease, box-shadow 0.22s ease;
  white-space: nowrap;
}
.segmented button:hover { color: var(--ink-0); background: rgba(255, 255, 255, 0.05); }
.segmented button.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(var(--accent-light-rgb), 0.26), rgba(var(--accent-deep-rgb), 0.16));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-light-rgb), 0.42), 0 4px 16px rgba(var(--accent-deep-rgb), 0.2);
}
.segmented button:disabled { opacity: 0.32; cursor: not-allowed; }
.engine-state {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--control-text); line-height: 1;
  color: var(--ink-2); letter-spacing: 0.04em;
  padding-left: 4px;
  white-space: nowrap;
}
.engine-state i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(110, 231, 216, 0.4);
  animation: pulse 2.4s infinite;
}
.engine-state.is-warn i { background: #ffb02e; }
.engine-state.is-err i { background: #ff4d5e; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 231, 216, 0.36); }
  65% { box-shadow: 0 0 0 8px rgba(110, 231, 216, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 216, 0); }
}

.top-actions { display: flex; align-items: center; gap: 14px; }
.fps { display: flex; align-items: baseline; gap: 6px; padding-right: 6px; white-space: nowrap; }
.fps strong { font-family: var(--mono); font-size: var(--control-text); line-height: 1; font-weight: 600; color: var(--ink-0); }
.fps span { font-size: calc(var(--control-text) * 0.78); letter-spacing: 0.12em; color: var(--ink-2); }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-0);
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.ghost {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-0);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.085); border-color: rgba(255, 255, 255, 0.24); }
.btn.primary {
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-deep) 55%, var(--accent-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 30px rgba(var(--accent-deep-rgb), 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn.primary:hover { box-shadow: 0 14px 36px rgba(var(--accent-deep-rgb), 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.btn.subtle {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-1);
}
.btn.subtle:hover { color: var(--ink-0); background: rgba(255, 255, 255, 0.07); }
.btn.subtle svg { opacity: 0.6; }
.btn.tiny {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 7px;
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-1);
}
.btn.tiny:hover { color: var(--ink-0); background: rgba(255, 255, 255, 0.08); }
.btn.wide { width: 100%; }

/* ---------------- panels ---------------- */
.panel {
  position: absolute;
  z-index: 5;
  top: 90px;
  bottom: 22px;
  width: var(--panel-w);
  padding: 4px 18px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(22, 21, 30, 0.72), rgba(10, 10, 16, 0.62));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 26px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(26px) saturate(1.15);
  -webkit-backdrop-filter: blur(26px) saturate(1.15);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
.panel-left { left: 22px; }
.panel-right { right: 22px; }

.panel-section { padding: 14px 0 3px; }
.panel-section + .panel-section { border-top: 1px solid var(--line); margin-top: 4px; }
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
}
.section-head p {
  margin: 4px 0 0;
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-2);
}
.panel-index {
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.32);
  padding-top: 2px;
  letter-spacing: 0.08em;
}

/* import entry at the top of the left panel */
.panel-import { padding: 8px 0 16px; }
.import-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(var(--accent-light-rgb), 0.34);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(var(--accent-rgb), 0.22), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  color: var(--ink-0);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.22s ease, background 0.22s ease, opacity 0.2s ease;
}
.import-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-light-rgb), 0.55);
  box-shadow: 0 12px 30px rgba(var(--accent-deep-rgb), 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.import-btn:active { transform: translateY(0); }
.import-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.import-icon {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-deep));
  box-shadow: 0 6px 18px rgba(var(--accent-deep-rgb), 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.import-icon svg, .import-arrow svg { width: 17px; height: 17px; }
.import-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.import-copy strong { font-size: 13px; font-weight: 650; letter-spacing: 0.04em; }
.import-copy small {
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-arrow {
  flex: none;
  margin-left: auto;
  display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.2s ease, color 0.2s ease;
}
.import-btn:hover .import-arrow { color: var(--ink-0); transform: translateX(3px); }

/* per-section reset button, sits under the controls */
.reset-btn { margin-top: 14px; height: 34px; font-size: 11.5px; }

/* light color input + popover */
.color-field { position: relative; }
.color-trigger {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-0);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.color-trigger:hover { border-color: rgba(255, 255, 255, 0.26); background: rgba(255, 255, 255, 0.065); }
.color-trigger[aria-expanded="true"] {
  border-color: rgba(var(--accent-light-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.08);
}
.color-swatch {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.color-hex {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ink-0);
}
.color-caret {
  margin-left: auto;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  transition: transform 0.2s ease, color 0.2s ease;
}
.color-caret svg { width: 14px; height: 14px; }
.color-trigger[aria-expanded="true"] .color-caret { transform: rotate(180deg); color: var(--ink-0); }

.color-popover {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  top: calc(100% + 8px);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #17161f, #0e0d14);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.cp-board {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.cp-sv {
  position: relative;
  flex: 1 1 auto;
  height: 96px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  background-color: #f00;
  background-image:
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0)),
    linear-gradient(to top, #000, rgba(0, 0, 0, 0));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.cp-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.6), 0 1px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.cp-hue {
  position: relative;
  flex: none;
  width: 14px;
  height: 96px;
  border-radius: 7px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.cp-hue-handle {
  position: absolute;
  left: -3px;
  right: -3px;
  height: 4px;
  margin-top: -2px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.color-modes {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.color-mode {
  flex: 1 1 0;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.16s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.color-mode:hover { color: var(--ink-0); background: rgba(255, 255, 255, 0.05); }
.color-mode.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(var(--accent-light-rgb), 0.26), rgba(var(--accent-deep-rgb), 0.16));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-light-rgb), 0.4);
}
.color-pane { margin-top: 9px; }
.color-inputs { display: flex; gap: 6px; }
.color-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}
.color-cell input {
  width: 100%;
  height: 27px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-0);
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
}
.color-cell input:focus {
  border-color: rgba(var(--accent-light-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.09);
}
.color-cell input::-webkit-inner-spin-button,
.color-cell input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.color-cell-inline { flex-direction: row; align-items: center; gap: 8px; }
.color-hex-field {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 27px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.color-hex-field i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.color-hex-field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-0);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  outline: none;
}
.color-hex-field:focus-within {
  border-color: rgba(var(--accent-light-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.09);
}

.controls { display: flex; flex-direction: column; gap: 14px; }
.control-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.control-top label, .control-top .control-label { font-size: 12.5px; color: var(--ink-1); letter-spacing: 0.02em; }
.control-top output {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-0);
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

input[type="range"] {
  --fill: 50%;
  appearance: none;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  display: block;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) var(--fill), rgba(255, 255, 255, 0.12) var(--fill), rgba(255, 255, 255, 0.12) 100%);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.18);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, var(--accent-tint) 40%, var(--accent) 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14), 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}
input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.18), 0 2px 10px rgba(0, 0, 0, 0.5); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]:disabled { opacity: 0.35; cursor: not-allowed; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.toggle-row label { font-size: 12.5px; color: var(--ink-1); }
.toggle {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.toggle i {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s cubic-bezier(0.34, 1.3, 0.5, 1), background 0.22s ease;
}
.toggle.is-on {
  background: linear-gradient(135deg, rgba(var(--accent-light-rgb), 0.55), rgba(var(--accent-deep-rgb), 0.4));
  border-color: rgba(var(--accent-light-rgb), 0.5);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.toggle.is-on i { transform: translateX(20px); background: #fff; }
.toggle.is-on::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

#spinSpeedControl.is-off { opacity: 0.4; }
#spinSpeedControl.is-off .control-top label { color: var(--ink-2); }

/* ---------------- right panel fields ---------------- */
.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 11px; letter-spacing: 0.08em; color: var(--ink-2); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px; top: 50%;
  width: 7px; height: 7px;
  margin-top: -5px;
  border-right: 1.4px solid var(--ink-2);
  border-bottom: 1.4px solid var(--ink-2);
  transform: rotate(45deg);
  pointer-events: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 36px;
  padding: 0 30px 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-0);
  font-size: 12px;
  letter-spacing: 0.01em;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
select:hover { background: rgba(255, 255, 255, 0.075); }
select:focus { border-color: rgba(var(--accent-light-rgb), 0.5); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1); }
select option { background: #14141c; color: #f6f4f7; }
.field-hint { margin: 0; font-size: 10px; color: var(--ink-2); line-height: 1.5; }
.field-hint.is-warn { color: #ffc46b; }

.export-summary {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.export-summary > div { display: flex; flex-direction: column; gap: 3px; }
.export-summary > div:last-child { align-items: flex-end; }
.export-summary span { font-size: 9.5px; letter-spacing: 0.1em; color: var(--ink-2); }
.export-summary strong { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink-0); }
#exportBtn { margin-top: 16px; }

.export-notes {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.note-row { display: flex; gap: 10px; }
.note-num { font-family: var(--mono); font-size: 9px; color: rgba(255, 255, 255, 0.3); padding-top: 2px; }
.note-row strong { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; color: var(--ink-1); }
.note-row p { margin: 3px 0 0; font-size: 10px; line-height: 1.55; color: var(--ink-2); }

.export-result {
  margin-top: 16px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(110, 231, 216, 0.22);
  background: rgba(110, 231, 216, 0.055);
  display: flex;
  align-items: center;
  gap: 10px;
}
.export-result[hidden] { display: none; }
.result-top { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.result-tag { font-size: 8.5px; letter-spacing: 0.18em; color: var(--teal); }
.result-top strong {
  font-size: 11px; font-weight: 550; color: var(--ink-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-top span:last-child { font-family: var(--mono); font-size: 10px; color: var(--ink-2); }

/* ---------------- model dock ---------------- */
.model-dock {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 760px));
  padding: 9px 12px 9px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 12, 18, 0.66);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.dock-pulse {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12), 0 0 16px rgba(var(--accent-rgb), 0.5);
}
.dock-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dock-copy strong {
  font-size: 12px; font-weight: 600;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dock-copy span { font-size: 9.5px; color: var(--ink-2); letter-spacing: 0.04em; }
.model-dock .btn { flex: none; }

.stage-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------------- overlays ---------------- */
.overlay {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(60% 60% at 50% 50%, rgba(8, 8, 13, 0.72), rgba(4, 4, 7, 0.9));
  backdrop-filter: blur(14px) saturate(0.9);
  -webkit-backdrop-filter: blur(14px) saturate(0.9);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}
.overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.overlay-card {
  width: min(430px, 92vw);
  padding: 30px 30px 26px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(28, 26, 36, 0.86), rgba(12, 12, 18, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 30px 90px rgba(0, 0, 0, 0.6);
}
.overlay-card .eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--accent);
  margin-bottom: 10px;
}
.overlay-card h3 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: 0.02em; }
.overlay-card > p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
  min-height: 20px;
  word-break: break-all;
}
.overlay-card .file-line {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-1);
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  margin-top: 12px;
  max-height: 58px;
  overflow: hidden;
}

.boot-visual {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}
.boot-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(var(--accent-rgb), 0), rgba(var(--accent-rgb), 0.85), rgba(var(--accent-2-rgb), 0.1), rgba(var(--accent-rgb), 0));
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
  animation: spin 1.6s linear infinite;
}
.boot-core {
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 25px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 26px rgba(var(--accent-deep-rgb), 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe {
  0%, 100% { transform: scale(0.86); opacity: 0.75; }
  50% { transform: scale(1.04); opacity: 1; }
}

.progress-track {
  position: relative;
  height: 7px;
  margin-top: 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.075);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 55%, var(--accent-light));
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.45);
  transition: width 0.28s cubic-bezier(0.3, 0.8, 0.4, 1);
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: translateX(-100%);
  animation: sheen 1.7s ease-in-out infinite;
}
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--ink-2);
}
.progress-meta strong { font-family: var(--mono); font-size: 12px; color: var(--ink-0); font-weight: 600; }
.overlay-actions { margin-top: 20px; display: flex; justify-content: flex-end; }

/* ---------------- toasts ---------------- */
.toast-stack {
  position: absolute;
  z-index: 14;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(18, 18, 26, 0.92);
  color: var(--ink-0);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.24s ease, transform 0.24s ease;
  max-width: 70vw;
  text-align: center;
  backdrop-filter: blur(12px);
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-ok { border-color: rgba(110, 231, 216, 0.32); color: #c8fff6; }
.toast-warn { border-color: rgba(255, 196, 107, 0.34); color: #ffe3b5; }
.toast-err { border-color: rgba(255, 77, 94, 0.4); color: #ffd3d7; }

/* ---------------- drop zone ---------------- */
.dropzone {
  position: absolute;
  z-index: 11;
  inset: 18px;
  border-radius: 20px;
  border: 1.5px dashed rgba(var(--accent-light-rgb), 0.55);
  background: rgba(12, 8, 14, 0.6);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}
.dropzone.is-open { opacity: 1; visibility: visible; }
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 28px;
}
.drop-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 16px;
  font-size: 24px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid rgba(var(--accent-light-rgb), 0.28);
}
.dropzone-inner strong { font-size: 17px; letter-spacing: 0.03em; }
.dropzone-inner span:last-child { font-size: 10px; letter-spacing: 0.16em; color: var(--ink-2); }

/* ---------------- 移动端：横屏提示 / 全屏适配 ---------------- */
.rotate-hint { display: none; }
html.is-mobile.need-rotate .rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(80% 70% at 50% 40%, rgba(var(--accent-rgb), 0.14), transparent 70%),
    rgba(6, 6, 10, 0.92);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  pointer-events: none;
}
.rotate-hint-inner {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0 32px;
  color: var(--ink-0);
}
.rotate-hint-icon {
  width: 62px;
  height: 62px;
  color: var(--accent);
  animation: rotate-tip 2.6s ease-in-out infinite;
}
.rotate-hint strong { font-size: 17px; font-weight: 650; letter-spacing: 0.06em; }
.rotate-hint span { font-size: 12px; color: var(--ink-2); letter-spacing: 0.08em; }
@keyframes rotate-tip {
  0%, 18% { transform: rotate(0deg); }
  55%, 100% { transform: rotate(-90deg); }
}
html.is-mobile .topbar {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ---------------- responsive ---------------- */
@media (max-width: 1480px) {
  :root { --panel-w: 292px; }
  .brand { min-width: 205px; }
  .brand-copy p { display: none; }
  .model-dock { max-width: calc(100vw - 700px); }
}
@media (max-width: 1260px) {
  :root { --panel-w: 268px; --control-h: 26px; --control-text: 12px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .renderer-label, .engine-state, .theme-label { display: none; }
  .brand-copy h1 { font-size: 16.5px; }
  .segmented button { padding: 0 10px; }
  .theme-list { padding: 3px 7px; gap: 6px; }
  .panel { padding-left: 14px; padding-right: 14px; }
  .model-dock { max-width: calc(100vw - 620px); }
  .dock-copy span { display: none; }
}
@media (max-width: 1040px) {
  :root { --panel-w: 244px; }
  .fps { display: none; }
  .model-dock { max-width: calc(100vw - 540px); }
  .stage-hint { display: none; }
}
@media (max-height: 780px) {
  .panel { top: 84px; bottom: 14px; }
  .panel-section { padding-top: 14px; }
  .panel-import { padding-top: 6px; }
  .import-btn { padding: 10px 12px; }
  .controls { gap: 14px; }
  .section-head { margin-bottom: 13px; }
  .fields { gap: 11px; }
  .model-dock { bottom: 18px; }
  .stage-hint { bottom: 64px; }
}
