:root {
  /* 框架（左侧导航栏 / 顶部工具栏）保持深色，中间 3D 内容区为浅灰 —— 见 #viewport */
  --bg: #0e1116;
  --panel: #151922;
  --panel-2: #1b2130;
  --line: #262d3b;
  --text: #e6ebf2;
  --muted: #8b97a8;
  --accent: #1667ff;
  --accent-2: #4a8bff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
}

/* ---------- 整体骨架：主站页头在上，工具区（面板+画布）占余下高度 ---------- */
body { display: flex; flex-direction: column; overflow: hidden; }

.app { flex: 1; display: flex; min-height: 0; }

/* ---------- 主站同款页头（来源 index.html .topbar）+ 返回首页 ---------- */
.topbar {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  padding: 0 22px;
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
  width: 100%;
  height: 56px;
  position: relative; z-index: 50;
  box-shadow: 0 2px 10px rgba(29, 78, 216, .25);
}
.back-home {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  color: #fff; text-decoration: none; font-size: 13px;
  background: rgba(255,255,255,.16); border-radius: 9px; padding: 7px 13px;
  transition: background .15s;
}
.back-home:hover { background: rgba(255,255,255,.3); }
.topbar-brand {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0; flex-shrink: 1;
  padding-right: 18px;
  height: 100%;
}
.topbar-brand > div { min-width: 0; }
.topbar-brand h1 { font-size: 17px; font-weight: 300; font-family: "PingFang SC", "Microsoft YaHei Light", "Microsoft YaHei", "Source Han Sans SC Light", sans-serif; letter-spacing: 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.topbar-brand p { font-size: 12px; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.topbar-right {
  flex: 1; display: flex; align-items: center; justify-content: flex-end;
  min-width: 0;
}
.live-badge {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: #6ee7a0; font-weight: 400;
  background: rgba(255,255,255,.15); border-radius: 20px; padding: 4px 12px;
}
.live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #6ee7a0; box-shadow: 0 0 6px rgba(110,231,160,.9); animation: lbPulse 1.6s ease-in-out infinite; }
@keyframes lbPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.live-badge .lb-txt { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.live-badge .lb-en { font-size: 9px; font-weight: 400; color: #6ee7a0; letter-spacing: .4px; }
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand h1 { font-size: 15px; letter-spacing: 1px; }
  .topbar-brand p { font-size: 10px; }
  .live-badge { display: none; }
  .back-home { padding: 6px 9px; font-size: 12px; }
}

/* ---------- 左侧面板 ---------- */
#panel {
  width: 300px;
  flex: 0 0 300px;
  height: auto;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px 14px 20px;
}

section { margin-bottom: 18px; }
section h2 {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase;
  margin: 0 0 9px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.row label { flex: 0 0 62px; color: var(--muted); font-size: 12px; }
.row input[type="number"], .row input[type="text"], .row select {
  flex: 1; min-width: 0;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 8px; font-size: 13px; font-family: inherit;
  outline: none;
}
.row input[type="number"]:focus, .row input[type="text"]:focus, .row select:focus { border-color: var(--accent); }

.row input[type="color"] {
  flex: 1; min-width: 0; height: 30px; padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 7px;
  cursor: pointer;
}
.row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer; }

.row .unit { flex: 0 0 26px; color: var(--muted); font-size: 11px; }
#ledBrightnessVal { flex: 0 0 34px; text-align: right; }

.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text);
  padding: 4px 0; cursor: pointer; user-select: none;
}
.check input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

#dimOpts.disabled { opacity: .4; pointer-events: none; }
#dimOpts { display: flex; align-items: center; gap: 14px; }   /* 三个标注开关一行排 */
#dimOpts .check { padding: 3px 0; white-space: nowrap; }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 7px;
  padding: 7px 4px; font-size: 12px; cursor: pointer;
  font-family: inherit;
  text-align: center; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 画质三键（第436轮续7）：540P / 720P / 1080P ---------- */
#qualityBtns { display: flex; flex: 1; min-width: 0; gap: 6px; }
#qualityBtns button {
  flex: 1; min-width: 0; padding: 6px 0; font-size: 12px; font-family: inherit;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); cursor: pointer; text-align: center;
}
#qualityBtns button:hover { border-color: var(--accent); }
#qualityBtns button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 报价表 ---------- */
#quote { width: 100%; border-collapse: collapse; font-size: 12px; }
#quote th {
  text-align: left; color: var(--muted); font-weight: 500;
  padding: 5px 4px; border-bottom: 1px solid var(--line); font-size: 11px;
}
#quote td { padding: 5px 4px; border-bottom: 1px dashed rgba(255,255,255,.05); }
#quote td.num, #quote th.num { text-align: right; }
#quote tr.sum td { color: var(--muted); }
#quote tr.total td {
  font-weight: 600; color: var(--accent-2);
  border-top: 1px solid var(--line); border-bottom: none; padding-top: 8px;
}
#quote tr.unit td { color: var(--muted); font-size: 11px; border-bottom: none; }

#priceBox { margin-top: 10px; padding: 10px; background: var(--panel-2); border-radius: 8px; }
#priceBox .row label { flex: 0 0 96px; }
.hidden { display: none !important; }

button {
  font-family: inherit; font-size: 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 10px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-2); }
button.ghost { width: 100%; margin-top: 10px; }
button.wide { width: 100%; }
button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { border-color: var(--line); }

.tip { margin: 8px 0 0; font-size: 11px; line-height: 1.7; color: var(--muted); }
.tip b { color: var(--accent-2); font-weight: 500; }

.foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 4px; }
.foot button { width: 100%; }
.foot button.span2 { grid-column: 1 / -1; }

/* ---------- 视频导出结果弹窗 ---------- */
#videoResult {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,11,16,.72);
  padding: 20px;
}
.vr-card {
  width: min(760px, 100%); max-height: 100%;
  overflow: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.vr-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text); }
.vr-card video {
  width: 100%; display: block; border-radius: 10px;
  background: #0b0e13; border: 1px solid var(--line);
}
.vr-card img {
  width: 100%; display: block; border-radius: 10px;
  background: #fff; border: 1px solid var(--line);
}
.vr-meta { margin: 10px 0 0; font-size: 11px; color: var(--muted); }
.vr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.vr-actions button { flex: 1 1 auto; min-width: 130px; width: auto; margin-top: 0; }

/* ---------- 右侧 3D ---------- */
#stage { flex: 1; display: flex; flex-direction: column; height: auto; min-height: 0; min-width: 0; }

#toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#status { margin-left: auto; color: var(--muted); font-size: 11px; }

#viewport {
  position: relative; flex: 1; overflow: hidden;
  /* CAD 风格：中性灰径向渐变，光源处（上中）浅、四周渐暗，形成纵深空间感
     基准色 #484848，改这里的同时请同步改 src/main.js 里的 paintBackground()，否则导出的图片底色会不一致 */
  background: radial-gradient(115% 85% at 50% 42%,
    #6d6d6d 0%,
    #5c5c5c 35%,
    #484848 65%,
    #323232 100%);
  touch-action: none;
}
#viewport.has-photo { background: #484848; }
#viewport canvas { position: absolute; inset: 0; z-index: 2; }

/* 导出取景框：视口按导出比例裁成一块画框，框外压暗，屏幕上看到的就是导出文件 */
#viewport.exporting { background: #0d1015; }
#viewport.exporting canvas {
  /* 画布透明（渲染器 alpha），底色用 CSS 补齐 —— 这里必须和 paintBackground() 的渐变一致 */
  background: radial-gradient(115% 85% at 50% 42%,
    #6d6d6d 0%, #5c5c5c 35%, #484848 65%, #323232 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 16px 44px rgba(0,0,0,.55);
}

#photoLayer {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  transform-origin: center center;
  display: none;
  pointer-events: none;
}
#photoLayer.show { display: block; }
#viewport.adjusting #photoLayer { outline: 1px dashed var(--accent); outline-offset: -4px; }

#hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 3; pointer-events: none;
  background: rgba(255,255,255,.82); border: 1px solid rgba(120,132,150,.35);
  border-radius: 999px; padding: 6px 14px;
  color: #5c6675; font-size: 11px; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(60,70,90,.10);
}
#hint b { color: var(--accent); font-weight: 500; }

/* ---------- 右下角立体调整轴（第436轮）：三色圆环精细调展示角度 ---------- */
/* 红 = 俯仰(绕X·纵向翻转)  绿 = 横转(绕Y·左右转向)  蓝 = 倾斜(绕Z·屏面内旋转) */
#rotGizmo {
  position: absolute; right: 16px; bottom: 52px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  user-select: none; -webkit-user-select: none;
}
/* 第一排：横向 / 纵向 / 侧向 三个选择按键 */
.rg-tabs {
  display: flex; gap: 5px;
  background: rgba(14,17,22,.66); border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px; padding: 4px;
  backdrop-filter: blur(4px);
}
.rg-tab {
  font-size: 11px; line-height: 1; padding: 6px 13px; border-radius: 6px;
  background: transparent; color: #b9c3d3; border: none; cursor: pointer;
  font-family: inherit; transition: background .12s, color .12s;
  white-space: nowrap;
}
.rg-tab:hover { color: #fff; }
.rg-tab.on { background: var(--accent); color: #fff; box-shadow: 0 1px 5px rgba(22,103,255,.45); }
/* 第二排：角度滑杆（蓝轨白点，拖动 0~360° 范围内左右调整） */
.rg-slider {
  background: rgba(14,17,22,.66); border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px; padding: 9px 12px;
  backdrop-filter: blur(4px);
}
#rotSlider {
  -webkit-appearance: none; appearance: none;
  width: 196px; height: 6px; border-radius: 3px; outline: none;
  background: linear-gradient(90deg, var(--accent) 50%, rgba(255,255,255,.22) 50%);
  cursor: pointer; display: block;
}
#rotSlider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; border: 3.5px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  cursor: grab;
}
#rotSlider::-webkit-slider-thumb:active { cursor: grabbing; }
#rotSlider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3.5px solid var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
  cursor: grab;
}
.rg-info {
  font-size: 10px; color: #eef2f8; white-space: nowrap;
  background: rgba(14,17,22,.66); border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px; padding: 2px 8px;
}
#rotReset {
  font-size: 10px; padding: 3px 10px; border-radius: 6px;
  background: rgba(14,17,22,.66); color: #cdd6e4;
  border: 1px solid rgba(255,255,255,.18);
}
#rotReset:hover { border-color: var(--accent); color: #fff; }
/* 实景照片模式：转轴照常可用（转的是屏体模型，不是照片背景） */

/* ---------- 打印 ---------- */
#printArea { display: none; }
@media print {
  .topbar, #brandBar, #panel, #stage { display: none !important; }
  html, body { background: #fff; color: #000; display: block; height: auto; }
  #printArea { display: block !important; padding: 24px; color: #000; font-size: 13px; }
  #printArea h1 { font-size: 20px; margin: 0 0 4px; }
  #printArea .meta { color: #555; font-size: 12px; margin-bottom: 16px; }
  #printArea table { width: 100%; border-collapse: collapse; margin-top: 12px; }
  #printArea th, #printArea td { border: 1px solid #999; padding: 6px 8px; font-size: 12px; }
  #printArea th { background: #f0f0f0; text-align: left; }
  #printArea td.num, #printArea th.num { text-align: right; }
  #printArea .total { font-weight: 700; margin-top: 14px; font-size: 15px; }
}
