/*
 * Kepma 配置器 —— 色系取自 kepmaguitar.com：深咖 #221B17 / 奶油 #F5EFE4 / 铜金 #D19B5C · #B87A3A · #E3B784，标题用衬线。
 * 两套主题：白天（奶油底 + 深咖字）与夜晚（深咖底 + 奶油字）；顶栏在两套里都是品牌深咖，与官网导航一致。
 * 视口背景由 3D 场景决定（默认跟随主题，见 config.js 的 THEME_BG）。
 *
 * 视觉规范（2026-11 质感升级，参照 ui-ux-pro-max「Luxury Serif」方向）：
 *   · 间距 4 / 8 网格；圆角 6 / 9 / 14；控件高度统一 30px（紧凑 26px）
 *   · 标题衬线（宋体 / Georgia），正文无衬线；最小字号 11px，仅用于标签
 *   · 阴影分层（贴地细影 + 远处柔影），描边一律发丝线
 *   · 动效 160–240ms，统一缓动；尊重 prefers-reduced-motion
 *   · 不加载任何外部字体（国内网络 / 离线单文件版都要能用）
 */

:root {
  --coffee: #221b17;
  --coffee-2: #2e241e;
  --cream: #f5efe4;
  --copper: #d19b5c;
  --copper-deep: #b87a3a;
  --copper-light: #e3b784;
  --copper-grad: linear-gradient(165deg, #dcaa6c 0%, #c58a49 48%, #a96d33 100%);
  --glow: 0 0 0 1px rgba(209, 155, 92, .18), 0 4px 14px -4px rgba(209, 155, 92, .45);
  --r-l: 14px;
  --r: 9px;
  --r-s: 6px;
  --h: 30px;
  --h-s: 26px;
  --topbar-h: 56px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t: .18s var(--ease);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 白天 */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #e9e1d3;
  --panel: #fbf8f3;
  --panel-2: #f4eee4;
  --field: #ffffff;
  --line: rgba(34, 27, 23, .12);
  --line-2: rgba(34, 27, 23, .07);
  --line-strong: rgba(34, 27, 23, .2);
  --text: #1f1813;
  --text-2: #4a3f36;
  --muted: #7d6e60;
  --accent: #a96d33;
  --accent-bg: rgba(184, 122, 58, .1);
  --accent-line: rgba(184, 122, 58, .45);
  --hover: rgba(34, 27, 23, .045);
  --ok: #3f7a50;
  --warn: #a5651f;
  --bad: #b0473a;
  --overlay: rgba(245, 239, 228, .9);
  --shadow-xs: 0 1px 1px rgba(34, 27, 23, .06);
  --shadow: 0 1px 2px rgba(34, 27, 23, .07), 0 4px 12px -6px rgba(34, 27, 23, .18);
  --shadow-l: 0 2px 6px rgba(34, 27, 23, .08), 0 24px 60px -18px rgba(34, 27, 23, .35);
  --ring: rgba(34, 27, 23, .2);
  --focus: 0 0 0 3px rgba(184, 122, 58, .28);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .7);
}

/* 夜晚 */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15100c;
  --panel: #1d1712;
  --panel-2: #241c16;
  --field: #2a211a;
  --line: rgba(245, 239, 228, .11);
  --line-2: rgba(245, 239, 228, .06);
  --line-strong: rgba(245, 239, 228, .2);
  --text: #f5efe4;
  --text-2: #d4c8b9;
  --muted: #a39789;
  --accent: #e3b784;
  --accent-bg: rgba(209, 155, 92, .13);
  --accent-line: rgba(227, 183, 132, .5);
  --hover: rgba(245, 239, 228, .05);
  --ok: #8fc7a4;
  --warn: #e0a35a;
  --bad: #e88878;
  --overlay: rgba(21, 16, 12, .9);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px -8px rgba(0, 0, 0, .55);
  --shadow-l: 0 2px 6px rgba(0, 0, 0, .4), 0 28px 70px -20px rgba(0, 0, 0, .75);
  --ring: rgba(245, 239, 228, .26);
  --focus: 0 0 0 3px rgba(227, 183, 132, .3);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 13px/1.5 var(--sans); letter-spacing: .005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 0, "kern" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h2, h3, h4 { margin: 0; font-weight: 600; }
code { font: 11px var(--mono); color: var(--muted); }
.muted { color: var(--muted); }
::selection { background: rgba(209, 155, 92, .32); }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* —— 顶栏（两套主题都用品牌深咖） —— */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 20px; padding: 0 16px 0 20px;
  background:
    radial-gradient(600px 120px at 12% -40%, rgba(209, 155, 92, .16), transparent 70%),
    linear-gradient(180deg, #241b15 0%, #17110d 100%);
  color: var(--cream); position: relative; z-index: 10;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35), 0 8px 24px -16px rgba(0, 0, 0, .6);
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(227, 183, 132, .55) 20%, rgba(227, 183, 132, .55) 80%, transparent);
  opacity: .55;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Kepma 标志（皇冠 + 字样）：轮廓取自 A1 琴头 logo 的实物网格（src/render/logoA1.js） */
.brand__logo { height: 26px; width: auto; flex: none; display: block; fill: #e3b784; filter: drop-shadow(0 2px 6px rgba(209, 155, 92, .35)); }
.brand__name {
  font-family: var(--serif); font-size: 16.5px; font-weight: 600; letter-spacing: .06em; white-space: nowrap;
  background: linear-gradient(180deg, #fbf4e8 30%, #e3c79f); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand__sub { color: rgba(245, 239, 228, .55); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar__sep { width: 1px; height: 18px; background: rgba(245, 239, 228, .14); margin: 0 6px; }
.topbar .btn {
  height: 32px; padding: 0 13px; color: rgba(245, 239, 228, .82);
  border-color: rgba(245, 239, 228, .14); background: rgba(245, 239, 228, .03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.topbar .btn:hover:not(:disabled) { color: #fff; border-color: rgba(227, 183, 132, .45); background: rgba(245, 239, 228, .08); }
.topbar .btn:active:not(:disabled) { background: rgba(245, 239, 228, .12); }
.topbar .btn--icon { width: 32px; padding: 0; }
.topbar .btn--primary { color: #fff; }
.topbar .btn--theme { color: rgba(245, 239, 228, .72); }

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 12px;
  border: 1px solid var(--line); background: var(--field); color: var(--text-2);
  border-radius: var(--r-s); cursor: pointer; white-space: nowrap; text-decoration: none;
  font-size: 12.5px; font-weight: 500; letter-spacing: .02em;
  box-shadow: var(--shadow-xs), var(--hi);
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform .12s var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--accent-line); color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:focus-visible { box-shadow: var(--focus); }
.btn:disabled { opacity: .35; cursor: default; }
.btn--primary, .topbar .btn--primary {
  background: var(--copper-grad); border-color: rgba(0, 0, 0, .18); color: #fff; font-weight: 600;
  text-shadow: 0 1px 0 rgba(80, 45, 15, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px -8px rgba(209, 155, 92, .7);
}
.btn--primary:hover:not(:disabled), .topbar .btn--primary:hover:not(:disabled) {
  color: #fff; border-color: rgba(0, 0, 0, .18); filter: brightness(1.06);
  background: var(--copper-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 2px 4px rgba(0, 0, 0, .25), 0 10px 26px -8px rgba(209, 155, 92, .85);
}
.btn--ghost { background: transparent; box-shadow: none; }
.btn--wide { width: 100%; height: auto; min-height: 34px; white-space: normal; line-height: 1.35; padding: 8px 10px; margin-bottom: 10px; }
.btn--sm { height: var(--h-s); padding: 0 9px; font-size: 12px; }
.btn--icon { width: var(--h); padding: 0; font-size: 16px; line-height: 1; }

/* —— 三列布局 —— */
.stage { height: calc(100% - var(--topbar-h)); display: grid; grid-template-columns: 304px minmax(0, 1fr) 356px; background: var(--bg); }
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow: hidden; position: relative; z-index: 1; }
.stage > .panel:first-child { border-right: 1px solid var(--line); box-shadow: 8px 0 24px -20px rgba(0, 0, 0, .35); }
.stage > .panel:last-child { border-left: 1px solid var(--line); box-shadow: -8px 0 24px -20px rgba(0, 0, 0, .35); }
.panel__head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); flex: none; display: flex; align-items: baseline; gap: 10px; }
.panel__head h2 { font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .14em; }
.panel__head h2::after { content: 'SPECIFICATION'; margin-left: 10px; font: 500 9.5px/1 var(--sans); letter-spacing: .22em; color: var(--muted); opacity: .8; }
.panel__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 16px; scrollbar-gutter: stable; }

/* —— 折叠组 —— */
.grp { border-bottom: 1px solid var(--line-2); }
.grp:last-child { border-bottom: 0; }
.grp__head {
  display: flex; align-items: center; gap: 8px; padding: 13px 8px 9px; cursor: pointer; user-select: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: .12em; color: var(--muted); border-radius: var(--r-s);
  transition: color var(--t);
}
.grp__head:hover { color: var(--text); }
.grp__head:focus-visible { outline: none; box-shadow: var(--focus); }
.grp__caret { display: inline-flex; width: 10px; height: 10px; flex: none; }
.grp__caret::before {
  content: ''; width: 10px; height: 10px; background: currentColor;
  -webkit-mask: var(--chev) center / 10px no-repeat; mask: var(--chev) center / 10px no-repeat;
  transition: transform .22s var(--ease);
}
.grp.is-collapsed .grp__caret::before { transform: rotate(-90deg); }
.grp__head em { font-style: normal; font-weight: 500; letter-spacing: 0; font-size: 10.5px; min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px; background: var(--hover); display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.grp__head > i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.grp__body { padding: 0 4px 12px; }
.grp.is-collapsed > .grp__body { display: none; }
.grp--sec .grp__body { padding: 2px 10px 14px; }

/* —— 规格列 —— */
.spec-note { padding: 8px 8px 10px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.spec-row {
  display: grid; grid-template-columns: 20px 88px minmax(0, 1fr); gap: 8px; align-items: center;
  padding: 5px 8px; min-height: 40px; border-radius: var(--r-s); position: relative;
  transition: background var(--t);
}
.spec-row:hover { background: var(--hover); }
.spec-row.is-pick { cursor: pointer; }
.spec-row.is-linked { background: var(--accent-bg); }
.spec-row.is-linked::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--copper-grad); box-shadow: 0 0 8px rgba(209, 155, 92, .5); }
.spec-row.is-flash { animation: flash 1s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(209, 155, 92, .55); } 35% { box-shadow: 0 0 0 3px rgba(209, 155, 92, .3); } 100% { box-shadow: 0 0 0 3px transparent; } }
.spec-row__l { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.spec-row__name { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-row__f { display: flex; align-items: center; gap: 8px; min-width: 0; }
.spec-row__sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--ring); flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), var(--shadow-xs); }
.spec-row__sw.is-none { border-style: dashed; opacity: .5; box-shadow: none; }
.spec-row__sw.is-tex { width: 18px; height: 18px; border-radius: 5px; background-size: cover; }
.spec-row select.is-log { color: var(--muted); }
.spec-ro { font: 11.5px var(--mono); color: var(--muted); letter-spacing: .02em; padding-left: 2px; }
.spec-notebox { grid-column: 1 / -1; cursor: default; padding: 10px 10px 10px 12px; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); box-shadow: var(--shadow-xs); position: relative; overflow: hidden; }
.spec-notebox::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--copper-grad); }
.spec-notebox.is-todo::before { background: var(--bad); }
.spec-notebox__h { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.spec-notebox.is-todo .spec-notebox__h::after { content: ' · 还没填'; color: var(--bad); font-weight: 600; }
.spec-note__t, .odlg textarea, .odlg input[type="text"] {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 12.5px; line-height: 1.55; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-s); padding: 7px 9px; resize: vertical;
  transition: border-color var(--t), box-shadow var(--t);
}
.spec-note__t:focus, .odlg textarea:focus, .odlg input[type="text"]:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--focus); }
.spec-notebox__r { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spec-notebox__img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--ring); box-shadow: var(--shadow-xs); }

/* 导出前的订单确认：客户信息 + 本单的定制说明与手动改动 */
.odlg {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-l);
}
.odlg[open] { animation: dlg-in .24s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.odlg::backdrop { background: rgba(18, 12, 8, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.odlg form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.odlg__head { padding: 20px 24px 14px; border-bottom: 1px solid var(--line-2); }
.odlg__head h3 { margin: 0; font: 600 17px var(--serif); letter-spacing: .06em; }
.odlg__head p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.odlg__body { padding: 16px 24px; overflow: auto; }
.odlg__f { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: start; margin-bottom: 10px; font-size: 12.5px; }
.odlg__f > span { padding-top: 7px; font-weight: 600; color: var(--text-2); }
.odlg__f em { color: var(--bad); font-style: normal; }
.odlg__f .is-bad { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(176, 71, 58, .15); }
.odlg__sum { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel-2); font-size: 12px; line-height: 1.65; }
.odlg__sum h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.odlg__sum ul { margin: 0 0 10px; padding-left: 16px; }
.odlg__sum ul:last-child { margin-bottom: 0; }
.odlg__sum .is-warn { color: var(--bad); }
.odlg__foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 24px 18px; border-top: 1px solid var(--line-2); background: var(--panel-2); border-radius: 0 0 var(--r-l) var(--r-l); }
.odlg__foot .odlg__msg { margin-right: auto; font-size: 12px; color: var(--bad); }
.tag { font-style: normal; font-size: 10.5px; letter-spacing: .04em; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.tag--live { color: var(--ok); }
.tag--live::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 18%, transparent); }
.tag--log { opacity: .85; }

select, input[type=text], input[type=search], input[type=url], input[type=number] {
  min-width: 0; height: var(--h); border: 1px solid var(--line); background-color: var(--field); color: var(--text);
  border-radius: var(--r-s); padding: 0 9px; font-size: 12.5px; outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
}
select {
  flex: 1; text-overflow: ellipsis; cursor: pointer; padding-right: 26px;
  -webkit-appearance: none; appearance: none;
  background-position: right 8px center; background-size: 12px; background-repeat: no-repeat;
}
/* 自绘下拉箭头（两套主题各一色） */
[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23d4c8b9' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root:not([data-theme="dark"]) select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%237d6e60' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select:hover, input[type=text]:hover, input[type=search]:hover, input[type=url]:hover, input[type=number]:hover { border-color: var(--line-strong); }
select:focus, input:focus { border-color: var(--accent-line); box-shadow: var(--focus); }
input[type=checkbox] { accent-color: var(--copper-deep); }

/* —— 变体条 —— */
.variants { padding: 12px 14px 12px; border-bottom: 1px solid var(--line-2); background: var(--panel-2); flex: none; }
.vhead { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .18em; margin-bottom: 9px; }
.vrow { display: flex; gap: 8px; margin-bottom: 6px; }
.vrow__lbl { flex: none; width: 54px; padding-top: 5px; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow__opts { display: flex; flex-wrap: wrap; gap: 5px; }
.vopt {
  font-size: 12px; height: 28px; padding: 0 11px; cursor: pointer; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--field); color: var(--text-2); box-shadow: var(--shadow-xs);
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
}
.vopt:hover { border-color: var(--accent-line); color: var(--text); }
.vopt.is-on { background: var(--copper-grad); color: #fff; border-color: rgba(0, 0, 0, .15); font-weight: 600; text-shadow: 0 1px 0 rgba(80, 45, 15, .3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), var(--glow); }
.vopt--none { color: var(--muted); }
.vopt:disabled { opacity: .5; cursor: progress; }
.mopts { display: flex; flex-wrap: wrap; gap: 6px; }
.mopts .vopt { padding: 0 12px; }
.variants .note, .variants > div:last-child:not(.vrow):not(.mopts) { font-size: 11.5px; }

/* —— 视口 —— */
.viewport { position: relative; background: var(--bg); overflow: hidden; }
.viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.viewport canvas:active { cursor: grabbing; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(130% 95% at 50% 40%, transparent 55%, rgba(0, 0, 0, .16) 100%); }
.hovertag {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4;
  background: rgba(29, 21, 16, .88); color: var(--cream); font-size: 12px; font-weight: 500; letter-spacing: .03em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(227, 183, 132, .25);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .45); white-space: nowrap;
}
.viewbar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 3;
  display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(29, 21, 16, .66); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(245, 239, 228, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 12px 32px -12px rgba(0, 0, 0, .55);
}
.viewbar button {
  border: 0; background: transparent; height: 30px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  color: rgba(245, 239, 228, .74); font-size: 12.5px; letter-spacing: .06em; white-space: nowrap;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.viewbar button:hover { background: rgba(245, 239, 228, .1); color: #fff; }
.viewbar button:focus-visible { box-shadow: 0 0 0 2px rgba(227, 183, 132, .6); }
.viewbar button.is-on { background: var(--copper-grad); color: #fff; font-weight: 600; text-shadow: 0 1px 0 rgba(80, 45, 15, .35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 12px -4px rgba(209, 155, 92, .7); }

.overlay { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--text); transition: opacity .45s var(--ease); }
.overlay.is-off { opacity: 0; pointer-events: none; }
.overlay__box { width: 320px; text-align: center; }
.spinner { width: 30px; height: 30px; margin: 0 auto 18px; border: 2px solid var(--line); border-top-color: var(--copper); border-right-color: var(--copper-light); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay__title { font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .12em; margin-bottom: 12px; }
.overlay__bar { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.overlay__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--copper-deep), var(--copper-light)); box-shadow: 0 0 10px rgba(209, 155, 92, .6); transition: width .25s var(--ease); }
.overlay__note { margin-top: 12px; font-size: 12px; line-height: 1.7; color: var(--muted); min-height: 1.5em; }

.toast {
  position: absolute; left: 50%; top: 20px; transform: translate(-50%, -10px); z-index: 7; max-width: 78%;
  background: rgba(29, 21, 16, .9); color: var(--cream); padding: 9px 16px; border-radius: 999px; font-size: 12.5px; letter-spacing: .02em;
  border: 1px solid rgba(227, 183, 132, .22);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .55);
  opacity: 0; pointer-events: none; transition: opacity .24s var(--ease), transform .24s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* —— 右栏 —— */
.tabs { display: flex; gap: 4px; padding: 12px 14px 0; border-bottom: 1px solid var(--line-2); flex: none; }
.tabs button {
  border: 0; background: transparent; padding: 6px 4px 11px; margin: 0 10px -1px 0; cursor: pointer; color: var(--muted);
  font-family: var(--serif); font-size: 14px; letter-spacing: .12em; border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.tabs button:hover { color: var(--text); }
.tabs button.is-on { color: var(--text); border-bottom-color: var(--copper); font-weight: 600; }
.tabs button:focus-visible { border-radius: 4px; }

/* 材质与光照同列：各自一个吸顶小标题，滚到光照时标题接替 */
.panel__body--stack { padding-top: 0; }
.insp + .insp { margin-top: 6px; border-top: 1px solid var(--line); }
.insp__h {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; gap: 10px;
  margin: 0 -10px; padding: 14px 18px 10px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
  font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .14em;
}
.insp__h span { font: 500 9.5px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--muted); opacity: .8; }
.insp__h::before { content: ''; align-self: center; width: 3px; height: 13px; border-radius: 2px; background: var(--copper-grad); margin-right: -2px; }
.insp > div { padding-top: 6px; }

.empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 22px 20px 16px; line-height: 1.8; }
.partgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 4px 14px; }
.partbtn {
  border: 1px solid var(--line); background: var(--field); border-radius: var(--r-s); min-height: 34px; padding: 6px 4px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2); position: relative; box-shadow: var(--shadow-xs), var(--hi);
  transition: border-color var(--t), color var(--t), background var(--t), box-shadow var(--t), transform .12s var(--ease);
}
.partbtn:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-bg); }
.partbtn:active { transform: translateY(.5px); }
.partbtn.is-mod::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 6px rgba(209, 155, 92, .8); }

.target {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin: 6px 2px 10px; box-shadow: var(--shadow-xs), var(--hi); position: relative; overflow: hidden;
}
.target::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--copper-grad); }
.target__t1 { font-family: var(--serif); font-weight: 600; font-size: 16px; letter-spacing: .06em; }
.target__t2 { font: 11px var(--mono); color: var(--muted); grid-row: 2; letter-spacing: .02em; }
.target .btn { grid-row: 1 / 3; grid-column: 2; }
.linked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 4px 12px; font-size: 12px; color: var(--muted); }

.qrow { margin-bottom: 16px; }
.qrow__l { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--field);
  border-radius: 999px; min-height: 28px; padding: 3px 11px 3px 5px; cursor: pointer; font-size: 12.5px; color: var(--text-2);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t), color var(--t), background var(--t), box-shadow var(--t);
}
.opt:hover { border-color: var(--accent-line); color: var(--text); }
.opt.is-on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; box-shadow: var(--glow); }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--ring); flex: none; box-shadow: inset 0 1px 1px rgba(255, 255, 255, .25), inset 0 -1px 1px rgba(0, 0, 0, .12); }
.dot--none { background: repeating-linear-gradient(135deg, transparent 0 3px, var(--line) 3px 4px); box-shadow: none; }
/* 贴图选项：方形木纹缩略图，比色点大，一眼看出木纹差别 */
.dot--tex { width: 26px; height: 26px; border-radius: 6px; margin: -1px 0; }
.opt:has(.dot--tex) { border-radius: var(--r); padding-left: 3px; }
.opt:not(:has(.dot)) { padding-left: 11px; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.sw {
  aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--ring); cursor: pointer; padding: 0; position: relative;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .22), inset 0 -1px 1px rgba(0, 0, 0, .12), var(--shadow-xs);
  transition: transform .16s var(--ease), box-shadow var(--t);
}
.sw:hover { transform: translateY(-1px) scale(1.06); box-shadow: inset 0 1px 1px rgba(255, 255, 255, .22), 0 6px 14px -6px rgba(0, 0, 0, .45); }
.sw.is-on { outline: none; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--accent), 0 6px 14px -6px rgba(0, 0, 0, .4); }
.sw:focus-visible { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent-line); }
.sw--custom { background: conic-gradient(from 200deg, #d19b5c, #7d1f1c, #1f2f4a, #2f4a35, #e6d2a8, #d19b5c); overflow: hidden; }
.sw--custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.sw--clear { background: var(--field); color: var(--muted); font-size: 11px; }
.keep { display: inline-flex; align-items: center; gap: 5px; font-weight: 400; font-size: 12px; letter-spacing: 0; color: var(--muted); cursor: pointer; }
.keep input { accent-color: var(--copper-deep); margin: 0; }
.qrow .row { margin: 12px 0 0; }

.row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 28px; }
.row__l { flex: none; width: 64px; font-size: 12.5px; color: var(--text-2); }
.row__v { flex: none; width: 52px; text-align: right; font: 11.5px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }

/* 滑杆：细轨 + 铜色已填充段 + 立体拇指 */
.row input[type=range] {
  flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; accent-color: var(--copper);
}
.row input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: var(--line-strong); }
.row input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line-strong); }
.row input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--copper); }
.row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, #f1e6d6); border: 1px solid rgba(120, 80, 40, .35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 3px rgba(209, 155, 92, 0);
  transition: box-shadow var(--t), transform .12s var(--ease);
}
.row input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #fff, #f1e6d6);
  border: 1px solid rgba(120, 80, 40, .35); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.row input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 4px rgba(209, 155, 92, .18); }
.row input[type=range]:active::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 5px rgba(209, 155, 92, .25); }
.row input[type=range]:focus { box-shadow: none; }
.row input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 1px 3px rgba(0, 0, 0, .3), var(--focus); }

.reset {
  flex: none; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: transparent; border-radius: 5px; padding: 0; cursor: pointer; opacity: .3;
  transition: opacity var(--t), color var(--t), border-color var(--t), background var(--t);
}
.reset.is-on { opacity: 1; color: var(--accent); border-color: var(--accent-line); }
.reset.is-on:hover { background: var(--accent-bg); }
.note { font-size: 12px; color: var(--muted); line-height: 1.65; margin: 8px 0; }
.note--das { margin: 8px 0 0; }
.note--das a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; transition: color var(--t), text-decoration-color var(--t); }
.note--das a:hover { color: var(--copper); text-decoration-color: currentColor; }
.btnrow { display: flex; gap: 8px; }
.btnrow .btn { flex: 1; }

.seg { display: flex; flex: 1; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 2px; margin-bottom: 10px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06); }
.row .seg { margin-bottom: 0; }
.seg button {
  flex: 1; border: 0; background: transparent; height: 24px; padding: 0 8px; border-radius: 4px; cursor: pointer; color: var(--muted);
  font-size: 12px; white-space: nowrap; transition: background var(--t), color var(--t), box-shadow var(--t);
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--field); color: var(--text); font-weight: 600; box-shadow: var(--shadow), var(--hi); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--field); border-radius: 999px; height: 28px; padding: 0 12px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2); box-shadow: var(--shadow-xs);
  transition: border-color var(--t), color var(--t), background var(--t), box-shadow var(--t);
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.is-on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 600; box-shadow: var(--glow); }
.chip--accent { border-color: var(--accent-line); color: var(--accent); }

.colorline { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.colorline input[type=color] { width: 36px; height: var(--h); padding: 2px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--field); cursor: pointer; box-shadow: var(--shadow-xs); }
.colorline input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.colorline input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.colorline input[type=text] { flex: 1; font-family: var(--mono); letter-spacing: .04em; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); flex: none; }

/* 细滚动条：平时低调，悬停面板时显形 */
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.panel:hover *, .odlg__body { scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.panel:hover ::-webkit-scrollbar-thumb, .odlg__body::-webkit-scrollbar-thumb { background-color: var(--line-strong); }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted) !important; }

@media (max-width: 1180px) {
  .stage { grid-template-columns: 280px minmax(0, 1fr) 320px; }
  .panel__head h2::after { display: none; }
}
@media (max-width: 980px) {
  html, body { overflow: auto; }
  .stage { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; }
  .stage > .panel:first-child, .stage > .panel:last-child { border: 0; border-top: 1px solid var(--line); box-shadow: none; }
  /* 窄屏：3D 画面吸顶，往下翻选项 / 材质时琴一直看得见（顶栏随页面滚走，多留空间给选项） */
  .viewport { order: -1; height: 46vh; height: 46dvh; min-height: 240px; position: sticky; top: 0; z-index: 5; box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .7); }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar__actions { min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 0; }
  .topbar__actions::-webkit-scrollbar { display: none; }
  .topbar__actions .btn { flex: none; white-space: nowrap; }
  .brand { flex: none; }
  .viewbar { max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; bottom: 12px; }
  .viewbar button { flex: none; white-space: nowrap; padding: 0 11px; }
  .panel__body { scrollbar-gutter: auto; }
}
@media (max-width: 640px) {
  .brand__name { display: none; }
  .topbar__sep { display: none; }
  .topbar .btn { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .spinner { animation: spin 1.6s linear infinite !important; }
}
.spec-row__addnote { white-space: nowrap; flex-shrink: 0; margin-left: 6px; padding: 0 6px; font-size: 11px; line-height: 18px; color: var(--muted); background: none; border: 1px dashed var(--line); border-radius: var(--r-s); cursor: pointer; }
.spec-row__addnote:hover { color: var(--accent, inherit); border-style: solid; }
.spec-notebox__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spec-colorhint { padding: 8px 10px; margin: 4px 0 2px; font-size: 12px; color: var(--muted); line-height: 1.9; }
.spec-colorhint .chip { margin: 0 2px; }

/* ── 部件 / 规格图标（src/ui/icons.js）── */
.ico { --ico-bg: var(--panel); width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; overflow: visible; }
.ico .c { fill: none; stroke: currentColor; stroke-width: 1.2; opacity: .5; stroke-linecap: round; stroke-linejoin: round; }
.ico .c--dash { stroke-dasharray: 1.6 1.8; opacity: .45; }
.ico .cf { fill: currentColor; opacity: .1; stroke: none; }
.ico .a { fill: var(--accent); stroke: none; }
.ico .ah { fill: var(--accent); opacity: .32; stroke: none; }
.ico .as { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico .as--w { stroke-width: 2; }
.ico .k { fill: none; stroke: var(--ico-bg); stroke-width: 1; stroke-linecap: round; }
.ico .k--w { stroke-width: 2.6; }
.ico .k-fill { fill: var(--ico-bg); stroke: none; }
.spec-row__ico { width: 20px; height: 20px; margin-right: -3px; color: var(--text-2, var(--muted)); justify-self: center; }
.spec-row.is-linked .spec-row__ico, .spec-row:hover .spec-row__ico { color: var(--text); }
.partbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px; }
.partbtn .ico { --ico-bg: var(--field); width: 24px; height: 24px; color: var(--muted); }
.partbtn:hover .ico { color: var(--accent); }
.target__t1 { display: flex; align-items: center; gap: 8px; }
.target__ico { --ico-bg: var(--panel); width: 26px; height: 26px; color: var(--muted); }
.chip--ico { display: inline-flex; align-items: center; gap: 4px; }
.chip--ico .ico { --ico-bg: var(--field); width: 15px; height: 15px; }
.qrow__l--ico > span { display: inline-flex; align-items: center; gap: 6px; }
.qrow__l--ico .ico { width: 16px; height: 16px; color: var(--muted); }

/* 指板镶嵌图案：选项卡片 = 横向指板预览（透明 PNG 铺在乌木上，左端 = 上枕） */
.inlay-strip { display: block; width: 100%; height: auto; border-radius: 4px; background: #231a16; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.inlay-opts { display: grid; gap: 6px; margin-bottom: 8px; }
.inlay-opt {
  display: grid; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); cursor: pointer;
  text-align: left; font-size: 12px; color: var(--text-2); box-shadow: var(--shadow-xs);
  transition: border-color var(--t), color var(--t), background var(--t), box-shadow var(--t);
}
.inlay-opt:hover { border-color: var(--accent-line); color: var(--text); }
.inlay-opt.is-on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 600; box-shadow: var(--glow); }
.inlay-opt.is-empty .inlay-strip { opacity: .55; }
.inlay-opt.is-muted:not(:hover) .inlay-strip { opacity: .5; }
/* 选项之外的定制一律写备注：规格列顶部的提示、部件面板里的「＋定制备注」 */
.spec-custom-tip { margin: 0 8px 10px; padding: 8px 10px; font-size: 12px; line-height: 1.6; color: var(--text);
  background: var(--accent-bg); border: 1px solid var(--accent-line); border-radius: 8px; }
.spec-custom-tip b { color: var(--accent); }
.qnote { display: inline-block; margin-top: 6px; padding: 2px 8px; font-size: 11.5px; line-height: 18px; color: var(--accent);
  background: none; border: 1px dashed var(--accent-line); border-radius: 999px; cursor: pointer; }
.qnote:hover { border-style: solid; background: var(--accent-bg); }
.qnote.is-set { border-style: solid; }
.spec-row__addnote { color: var(--accent); border-color: var(--accent-line); }
.inlay-opt__l { padding: 0 2px; }
.spec-row__inlay { grid-column: 1 / -1; margin: 2px 0 4px; }
/* 琴头图案层：竖着预览，三张一排；垫琴头贴面的乌木色 */
.inlay-opts--head { grid-template-columns: repeat(3, 1fr); }
.inlay-opts--head .inlay-opt { text-align: center; }
.inlay-strip--up { border-radius: 6px 6px 3px 3px; }
.spec-row__inlay:has(.inlay-strip--up) { width: 64px; }

/* 材质面板的部件列表：按类别分组 + 搜索 */
.partsearch { display: block; width: calc(100% - 8px); margin: 0 4px 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--field); color: var(--text); font: inherit; font-size: 12.5px; }
.partsearch:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--glow); }
.partcat__h { display: flex; align-items: baseline; gap: 6px; padding: 2px 6px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; color: var(--muted); }
.partcat__h em { font-style: normal; font-weight: 500; letter-spacing: 0; opacity: .7; }
.partcat .partgrid { padding-bottom: 12px; }
.partcat__none { padding: 8px 6px 14px; text-align: center; font-size: 12px; }
.inlay-strip--round { border-radius: 8px; }
.decal-place { margin: 6px 0 2px; }
