/* ============================================================
 * 极客少年 · 微型风洞实验室 — 专业工程软件风格界面
 * 布局：标题栏 / 左流程面板 / 中央视口 / 右参数面板 / 状态栏
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; min-height: 0; }
body {
  font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 14px;
  background: #0b0f14; color: #d5e1ed;
  display: flex; flex-direction: column;
}
button { font-family: inherit; }

/* ═══ 标题栏 ═══ */
#titlebar {
  height: 54px; flex: 0 0 54px; display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: linear-gradient(#161e28, #0d1219);
  border-bottom: 1px solid #2b3644;
  -webkit-user-select: none; user-select: none;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { color: #22d3ee; font-size: 24px; }
.brand-txt .l1 { display: flex; align-items: baseline; gap: 9px; }
.brand-txt .l1 b {
  font-size: 20px; color: #f0f6fc; letter-spacing: 2px;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
.brand-txt .l1 .cn { font-size: 16px; font-weight: 700; color: #f0f6fc; letter-spacing: 2px; }
.brand-txt small {
  display: block; color: #5d7186; font-size: 9.5px;
  letter-spacing: 2.1px; margin-top: 2px; font-family: Consolas, monospace;
  white-space: nowrap;
}
.tb-center { display: flex; align-items: center; gap: 12px; margin-left: 20px; }
.phase-name { font-size: 16px; font-weight: 700; color: #9fe8ff; letter-spacing: 2px; min-width: 100px; }
/* 状态文字右侧的运行徽标：与待机行成组 */
.tb-center #pausedBadge { margin-left: 4px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.tc { font-family: Consolas, monospace; color: #9ed2f5; font-size: 15px; }
.clock {
  font-family: Consolas, monospace; color: #cfe8fa; font-size: 14px;
  background: #101a28; border: 1px solid #24425c; border-radius: 3px;
  padding: 4px 10px; letter-spacing: 0.5px;
}
.tc b { color: #6b8096; font-weight: 400; font-size: 11px; margin-right: 4px; }
#pausedBadge {
  position: absolute; z-index: 9; left: 12px; top: 12px; display: none;
  background: rgba(64,48,8,.72); border: 1px solid #a08030; color: #ffd85e;
  font-weight: 700; font-size: 12px; letter-spacing: 1.5px;
  padding: 4px 13px; border-radius: 999px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
#guideBtn, #fsBtn {
  background: #182231; border: 1px solid #33445c; color: #b6cadf;
  padding: 6px 13px; border-radius: 3px; cursor: pointer; font-size: 13.5px;
  white-space: nowrap;
}
#guideBtn:hover, #fsBtn:hover { border-color: #22d3ee; color: #aef2ff; }
/* 管理后台入口：右下角低调放置，演示时不显眼 */
#adminLink {
  position: fixed; right: 8px; bottom: 8px; z-index: 60;
  font-size: 10px; color: #33455e; text-decoration: none; letter-spacing: 1px;
  opacity: .6; pointer-events: auto;
}
#adminLink:hover { color: #7fd7f5; opacity: 1; }

/* 状态灯 */
.beacon {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  background: #37424f; border: 1px solid #46525f; vertical-align: middle;
}
.beacon-idle { background: #37424f; }
.beacon-warn { background: #ffd85e; border-color: #8a7420; box-shadow: 0 0 12px #ffd85e; animation: lamp 1s steps(2) infinite; }
.beacon-run  { background: #ff5252; border-color: #a03030; box-shadow: 0 0 14px #ff5252; animation: lamp .6s steps(2) infinite; }
.beacon-done { background: #52ff9a; border-color: #2f8a4f; box-shadow: 0 0 14px #52ff9a; }
@keyframes lamp { 0%,100%{opacity:1} 50%{opacity:.3} }
.phase-name { min-width: 100px; text-align: center; }

/* ═══ 工作台骨架 ═══ */
#workbench { flex: 1; display: flex; min-height: 0; }
.dock-h {
  font-size: 13px; color: #8ca0b5; letter-spacing: 2.5px;
  border-left: 3px solid #22d3ee; padding-left: 10px; margin: 14px 0 9px;
  font-weight: 700;
}
#leftdock, #rightdock {
  background: #10161e; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: #2e3d51 transparent;
}
#leftdock { width: 232px; flex: 0 0 232px; border-right: 1px solid #232d3a; padding: 12px; }
#rightdock { width: 318px; flex: 0 0 318px; border-left: 1px solid #232d3a; padding: 12px 14px; }
#rightdock::-webkit-scrollbar, #leftdock::-webkit-scrollbar { width: 8px; }
#rightdock::-webkit-scrollbar-thumb, #leftdock::-webkit-scrollbar-thumb { background: #2e3d51; border-radius: 4px; }

/* ═══ 左侧：流程步骤器 ═══ */
#stepList { list-style: none; position: relative; padding-left: 6px; }
#stepList::before {
  content: ''; position: absolute; left: 21px; top: 18px; bottom: 18px;
  width: 2px; background: #2a3646;
}
#stepList li {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 4px; position: relative;
}
#stepList li i {
  font-style: normal; width: 30px; height: 30px; border-radius: 50%;
  background: #1a2330; border: 2px solid #33414f; color: #6d8098;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; z-index: 1; flex: 0 0 30px;
}
#stepList li div b { display: block; font-size: 14.5px; color: #93a7bd; font-weight: 600; }
#stepList li div em { font-style: normal; font-size: 11px; color: #55677c; }
#stepList li.active i { background: #0e3a4a; border-color: #22d3ee; color: #7fe7ff;
  box-shadow: 0 0 12px rgba(34,211,238,.5); }
#stepList li.active div b { color: #aef2ff; }
#stepList li.active::after {
  content: '▶'; position: absolute; right: 6px; color: #22d3ee; font-size: 11px;
  animation: blink 1.2s infinite;
}
#stepList li.done i { background: #12351f; border-color: #2f8a4f; color: #52ff9a; }
#stepList li.done div b { color: #7fcf9f; text-decoration: line-through; text-decoration-color: #3f6d52; }

.dock-readout { background: #131b26; border: 1px solid #232d3a; border-radius: 4px; padding: 10px 12px; }
.ro-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.ro-row span { color: #6d8098; }
.ro-row b { font-family: Consolas, monospace; color: #a9c6e2; font-weight: 600; }
.ro-row b.c-idle { color: #8fa0b3; }
.ro-row b.c-warn { color: #ffd85e; }
.ro-row b.c-run  { color: #ff8a8a; }
.ro-row b.c-done { color: #52ff9a; }

/* ═══ 中央视口 ═══ */
#viewport { flex: 1; position: relative; min-width: 0; min-height: 0; background: #06090f; overflow: hidden; }
.cam-wrap { position: absolute; inset: 0; overflow: hidden; background: #06090f; }
.cam-wrap.main { inset: 0; }
/* 三层画布叠放：基础场 → WebGL烟层 → 覆盖层（烟耙/车/暗角） */
.cam-wrap canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.cam-wrap.pip {
  inset: auto; top: 58px; right: 12px; width: 252px; height: 142px; z-index: 6;
  border: 1px solid #2f6f92; border-radius: 3px; box-shadow: 0 4px 16px rgba(0,0,0,.65);
  cursor: pointer;
}
.cam-wrap.pip canvas { object-fit: contain; }
.cam-tag {
  position: absolute; left: 8px; bottom: 6px; z-index: 6;
  font-size: 13px; color: #bfeaff; background: rgba(8,16,26,.8);
  border: 1px solid #2f6f92; padding: 2px 9px; border-radius: 2px; pointer-events: none;
  font-family: Consolas, monospace;
}
.cam-wrap.pip .cam-tag { font-size: 11px; padding: 1px 6px; }

#viewTabs {
  position: absolute; z-index: 8; left: 12px; top: 48px; display: flex; gap: 1px;
  border: 1px solid #33455e; border-radius: 3px; overflow: hidden;
  pointer-events: auto;   /* 覆盖 .hud 的 none：机位按钮必须可点击 */
}
#viewTabs button {
  background: #121b27; color: #93a7bd; border: none; padding: 7px 18px;
  cursor: pointer; font-size: 14px; font-family: Consolas, monospace;
}
#viewTabs button.active { background: #0e3a4a; color: #aef2ff; }

#recTag {
  position: absolute; z-index: 8; right: 12px; top: 14px;
  background: rgba(40,8,8,.88); border: 1px solid #a03030; color: #ff8a8a;
  font-size: 14px; font-family: Consolas, monospace; padding: 5px 14px; border-radius: 2px;
}
#bigText {
  position: absolute; z-index: 12; left: 50%; top: 38%; transform: translate(-50%,-50%);
  font-size: 56px; font-weight: 900; color: #eaf3fb; letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(34,211,238,.6), 0 2px 8px rgba(0,0,0,.8);
  pointer-events: none; opacity: 0; transition: opacity .3s;
  white-space: nowrap; text-align: center;
}
#bigText.show { opacity: 1; }
.hud { position: absolute; z-index: 8; pointer-events: none; }
#phaseBanner {
  z-index: 9; top: 56px; left: 50%; transform: translateX(-50%);
  background: rgba(10,17,27,.88); border: 1px solid #24425c; border-radius: 3px;
  padding: 7px 30px; font-size: 22px; font-weight: 700; color: #eaf3fb; white-space: nowrap;
}
#phaseBanner .count { font-family: Consolas, monospace; font-size: 42px; color: #22d3ee; }
#phaseBanner .rec-dot { color: #ff5252; animation: blink 1s infinite; font-size: 15px; }
#phaseSub {
  z-index: 9; top: 128px; left: 50%; transform: translateX(-50%);
  font-size: 14px; color: #9fb4c8; background: rgba(10,17,27,.75);
  padding: 3px 16px; border-radius: 2px; white-space: nowrap;
}
#hudSpeed {
  left: 14px; bottom: 78px;
  background: rgba(8,13,20,.62); border-radius: 3px; padding: 7px 14px 8px;
}
#hudSpeed .num {
  font-family: Consolas, monospace; font-size: 44px; font-weight: 700; color: #f2faff;
  text-shadow: 0 0 16px rgba(34,211,238,.45); line-height: 1;
}
#hudSpeed .unit { font-size: 13px; color: #9cc3e4; margin-left: 6px; }
#hudYaw {
  left: 14px; bottom: 44px; font-size: 14px; color: #ffd08a; font-family: Consolas, monospace;
  background: rgba(8,13,20,.62); border-radius: 3px; padding: 4px 12px;
}
#hudCd { right: 18px; bottom: 46px; text-align: right; }
#hudCd .num {
  font-family: Consolas, monospace; font-size: 46px; font-weight: 700; color: #aef2d9;
  text-shadow: 0 0 14px rgba(82,255,154,.35); line-height: 1;
}
#hudCd .lbl { font-size: 12px; color: #6b8096; }
#checklist {
  position: absolute; z-index: 8; left: 12px; top: 88px; width: 238px;
  background: rgba(13,20,30,.9); border: 1px solid #2a4a3a; border-radius: 3px;
  padding: 11px 14px; display: none; pointer-events: none;
}
#checklist.show { display: block; }
#checklist .cl-title { font-size: 13px; color: #7fe7a0; letter-spacing: 1px; margin-bottom: 5px; }
#checklist ul { list-style: none; }
#checklist li { font-size: 14px; color: #6d8098; line-height: 2; }
#checklist li::before { content: '□ '; color: #4a5b70; }
#checklist li.done { color: #9fe8b8; }
#checklist li.done::before { content: '✓ '; color: #52ff9a; font-weight: 700; }
#announceBar {
  position: absolute; z-index: 7; left: 50%; transform: translateX(-50%);
  top: 212px; bottom: auto; max-width: 46%; pointer-events: none;   /* 上方安全区：阶段副标之下、画中画与小车之上方，绝不压车 */
  background: rgba(30,26,12,.88); border: 1px solid #4a3f1c; border-radius: 2px;
  padding: 6px 16px; font-size: 13.5px; color: #ffd85e;
  transition: opacity .3s;
}
/* 安全检查阶段：清单在上左方展示时，播报条自动让位（两者内容本就相同） */
#viewport #checklist.show ~ #announceBar { opacity: 0; }

/* ═══ 右侧参数面板 ═══ */
.row { display: flex; align-items: center; gap: 9px; margin: 8px 0; }
.row label { font-size: 13.5px; color: #9fb4c8; min-width: 72px; }
.row input[type=number], .row input[type=text], .row select {
  flex: 1; min-width: 0; background: #0e1520; border: 1px solid #2b3a4d;
  color: #e2ecf5; padding: 6px 9px; border-radius: 2px; font-size: 13.5px;
}
.row input[type=range] { flex: 1; accent-color: #22d3ee; min-width: 0; }
.row .val { font-family: Consolas, monospace; color: #8fc7ee; min-width: 42px; text-align: right; font-size: 14px; }
input[type=checkbox] { accent-color: #22d3ee; width: 16px; height: 16px; }
.chk-row { display: flex; align-items: center; gap: 15px; margin: 8px 0; flex-wrap: wrap; }
.chk-row label { font-size: 13.5px; color: #a9bdd2; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.mini-note { font-size: 11px; color: #5d7186; }

.file-btn { position: relative; overflow: hidden; display: block; margin-top: 8px; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn span {
  display: block; text-align: center; padding: 8px 4px; font-size: 12.5px;
  background: #121b27; border: 1px dashed #33455e; color: #a9bdd2; border-radius: 2px;
}
.file-btn span:hover { border-color: #22d3ee; color: #aef2ff; }
.file-duo { display: flex; gap: 7px; }
.file-duo .file-btn { flex: 1; margin-top: 7px; }
#cutPreview {
  width: 100%; height: 116px; background: #0d1420; border: 1px solid #1f2a38;
  border-radius: 2px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  margin-top: 7px; touch-action: none;
}
#cutPreview canvas { width: 100%; display: block; }
.pv-empty { font-size: 12px; color: #4a5b70; padding: 0 14px; text-align: center; }
#frontInfo { font-size: 11px; color: #6d8098; margin-top: 4px; }

.big-btn {
  width: 100%; padding: 12px; font-size: 16px; font-weight: 700; margin: 4px 0 10px;
  background: linear-gradient(#14532d, #0c3a1f); color: #b8ffce;
  border: 1px solid #2f8a4f; border-radius: 3px; cursor: pointer; letter-spacing: 3px;
}
.big-btn:hover { filter: brightness(1.25); }
.big-btn.accent {
  background: linear-gradient(#155e75, #0c3e50); color: #cff6ff;
  border-color: #2292b8; letter-spacing: 1px;
}
.big-btn.accent:hover { filter: brightness(1.25); }
.big-btn.attn { animation: attn 1.2s infinite; }
@keyframes attn {
  0%,100% { box-shadow: 0 0 0 rgba(82,255,154,0); }
  50% { box-shadow: 0 0 22px rgba(82,255,154,.55); }
}
.ghost-btn {
  width: 100%; margin: 0 0 10px; padding: 8px; font-size: 13.5px;
  background: transparent; border: 1px solid #2b3a4d; color: #a9bdd2;
  border-radius: 3px; cursor: pointer;
}
.ghost-btn:hover { border-color: #22d3ee; color: #aef2ff; }
.hint { font-size: 11.5px; color: #55677c; margin-top: 9px; line-height: 1.6; }

/* ═══ 状态栏 ═══ */
#statusbar {
  height: 34px; flex: 0 0 34px; display: flex; align-items: center;
  background: #10161e; border-top: 1px solid #232d3a;
  padding: 0 16px; font-size: 14px; color: #9fb4c8; overflow: hidden;
}
.sb-item { padding: 0 16px; border-right: 1px solid #232d3a; font-family: Consolas, monospace; }
.sb-item b { color: #8fc7ee; font-weight: 600; }
#sbState { color: #52ff9a; }
.sb-tip { flex: 1; text-align: center; color: #8fa3b8; padding: 0 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-right { color: #5d7186; font-size: 12px; }

/* ═══ 车辆卡片库 ═══ */
#carCards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.car-card {
  background: #121b27; border: 1px solid #2b3a4d; border-radius: 3px;
  padding: 7px 7px 5px; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.car-card:hover { border-color: #22d3ee; }
.car-card.sel { border-color: #22d3ee; background: #0e2a35; }
.car-card.sel::after { content: '✓ 已选'; display: block; font-size: 11px; color: #22d3ee; }
.car-card canvas { width: 100%; display: block; }
.car-card .cc-name { font-size: 12.5px; color: #a9bdd2; margin-top: 2px; }
.car-card.empty-card { border-style: dashed; display: flex; align-items: center; justify-content: center; min-height: 58px; }
.car-card.empty-card .cc-name { margin: 0; }

/* ═══ 弹窗 ═══ */
.modal {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(2,5,10,.74); align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal .box {
  background: #0f1620; border: 1px solid #2b3a4d; border-radius: 4px;
  max-width: 820px; width: 92%; max-height: 88vh; overflow-y: auto; padding: 28px 32px;
}
.modal h2 { color: #f0f6fc; font-size: 22px; margin-bottom: 12px; }
.modal h3 { color: #7fd7f5; font-size: 15px; margin: 16px 0 6px; }
.modal p { font-size: 14px; color: #a9bdd2; line-height: 1.75; margin: 6px 0; }
.modal .steps { margin: 10px 0; padding-left: 20px; }
.modal .steps li { font-size: 14px; color: #b8c9da; line-height: 2; }
.btn {
  display: inline-block; padding: 10px 26px; border-radius: 3px; cursor: pointer;
  background: #0e3a4a; color: #aef2ff; border: 1px solid #2292b8; font-size: 15px;
}
.btn.ghost { background: transparent; color: #9fb4c8; border-color: #2b3a4d; }

/* ═══ 报告单 ═══ */
#reportBody { color: #b8c9da; }
.rp-head { border-bottom: 2px solid #2292b8; padding-bottom: 10px; margin-bottom: 6px; }
.rp-head h2 { color: #f0f6fc; }
.rp-meta { font-size: 14px; color: #9fb4c8; margin-top: 6px; }
.rp-badge {
  display: inline-block; margin-top: 8px; font-size: 12px; color: #ffd08a;
  background: #2a2410; border: 1px solid #4a3f1c; padding: 3px 11px; border-radius: 3px;
}
.rp-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rp-table th, .rp-table td { border: 1px solid #2b3a4d; padding: 7px 9px; font-size: 14px; text-align: center; }
.rp-table th { background: #101a28; color: #8fc7ee; }
.rp-table td.hl { color: #aef2d9; font-weight: 700; font-size: 18px; }
.rp-note { font-size: 13px; color: #8d9fb2; }
#rpChart { width: 100%; max-width: 640px; background: #0a111c; border: 1px solid #1f2a38; border-radius: 3px; }
.cmp { margin: 8px 0; }
.cmp-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.cmp-row .cmp-name { width: 126px; font-size: 14px; text-align: right; color: #a9bdd2; }
.cmp-row .cmp-bar { flex: 1; background: #101a28; border-radius: 2px; height: 17px; overflow: hidden; }
.cmp-row .cmp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #155e75, #22d3ee); }
.cmp-row .cmp-cd { width: 50px; font-family: Consolas, monospace; font-size: 14px; color: #aef2d9; }
.cmp-row.self .cmp-bar i { background: linear-gradient(90deg, #7e5f1d, #ffd85e); }
.cmp-row.self .cmp-name { color: #ffd85e; font-weight: 700; }
.rp-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ═══ 打印 ═══ */
@media print {  body > #app, #guideModal { display: none !important; }
  body { overflow: visible; background: #fff; }
  #reportModal { display: block !important; position: static; background: #fff; }
  #reportModal .box { max-width: none; max-height: none; border: none; background: #fff; }
  #reportBody, #reportBody * { color: #111 !important; }
  #reportBody canvas { border: 1px solid #999; }
  .rp-actions, #reportClose, #reportPrint { display: none !important; }
}

/* ═══ 窄屏 ═══ */
@media (max-width: 1280px) {
  #leftdock { width: 200px; flex-basis: 200px; }
  #rightdock { width: 300px; flex-basis: 300px; }
}
@media (max-width: 1080px) {
  #leftdock { display: none; }               /* 窄横屏收起流程面板 */
  #rightdock { width: 280px; flex-basis: 280px; }
  .cam-wrap.pip { width: 180px; height: 101px; }
  #hudSpeed .num { font-size: 44px; }
  #hudCd .num { font-size: 34px; }
  #phaseBanner { font-size: 18px; }
}

/* ═══ 竖屏版式：主视口在上，流程+状态+操作在下 ═══ */
