/* ============================================================
   无人机试飞场 · 共享 UI 样式
   布局原则：左右两列 flex 纵向堆叠，卡片之间绝不互相遮挡
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; overflow: hidden; background: #0b0e14;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#app { position: fixed; inset: 0; }
#app canvas { display: block; }

/* ---------- 左列：返回按钮 + 标题 +（测试页）科目列表 ---------- */
#leftCol {
  position: fixed; top: 18px; left: 20px; bottom: 24px; z-index: 10;
  display: flex; flex-direction: column; gap: 12px; width: 252px;
  pointer-events: none;
}
#leftCol > * { pointer-events: auto; }
#backBtn {
  display: inline-flex; align-items: center; gap: 7px; width: max-content;
  padding: 7px 15px; border-radius: 999px; font-size: 13px;
  background: rgba(16,20,28,.6); border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(8px); color: #dfe7f0; text-decoration: none;
  transition: background .2s, border-color .2s, color .2s;
}
#backBtn:hover { background: rgba(31,111,235,.8); border-color: rgba(120,180,255,.7); color: #fff; }
#title { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.45); pointer-events: none; }
#title h1 { font-size: 20px; font-weight: 600; letter-spacing: 1px; }
#title p { font-size: 12px; opacity: .8; margin-top: 4px; }

/* ---------- 右列：HUD +（测试页）科目面板 + 设备信息卡 ---------- */
#rightCol {
  position: fixed; top: 18px; right: 20px; z-index: 10;
  display: flex; flex-direction: column; gap: 12px;
  width: 292px; max-height: calc(100vh - 36px);
}
#rightCol > * { flex: 0 1 auto; min-height: 0; }
.hidden { display: none !important; }

/* ---------- HUD 状态面板 ---------- */
#hud {
  background: rgba(16,20,28,.55); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  padding: 12px 16px; color: #e8eef6;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
#hud .row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0; font-size: 13px; }
#hud .label { opacity: .65; }
#hud .val { font-weight: 600; font-variant-numeric: tabular-nums; }
#statusVal { color: #ffd23f; }
#modeBtn {
  margin-top: 10px; width: 100%; cursor: pointer;
  background: rgba(31,111,235,.85); color: #fff; border: none;
  border-radius: 8px; padding: 9px 10px; font-size: 13px; font-weight: 600;
  transition: background .2s;
}
#modeBtn:hover { background: rgba(31,111,235,1); }
#modeBtn.manual { background: rgba(255,140,40,.92); }
#modeBtn.manual:hover { background: rgba(255,140,40,1); }
#modeBtn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 左侧科目列表（测试页） ---------- */
#sidebar {
  flex: 1 1 auto; min-height: 0;
  background: rgba(16,20,28,.62); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 14px 12px; display: flex; flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
#sidebar .sb-head { font-size: 15px; font-weight: 700; color: #fff; }
#sidebar .sb-sub { font-size: 11px; color: #9fb3c8; margin: 3px 0 8px; }
#sbList { overflow-y: auto; flex: 1; min-height: 0; padding-right: 4px; }
#sbList::-webkit-scrollbar { width: 6px; }
#sbList::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.sb-cat { font-size: 11px; color: #7f93a8; margin: 11px 2px 4px; letter-spacing: 1px; }
.sb-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; margin: 3px 0;
  border-radius: 9px; cursor: pointer; color: #dfe7f0; font-size: 13px;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.sb-item:hover { background: rgba(255,255,255,.08); }
.sb-item.active { background: rgba(31,111,235,.35); border-color: rgba(120,180,255,.6); color: #fff; }
.sb-item .no { font-size: 10px; background: rgba(255,255,255,.14); border-radius: 5px; padding: 1px 5px; color: #cfe0f5; min-width: 18px; text-align: center; }
.sb-item.free .no { background: rgba(46,204,113,.32); color: #d6ffe6; }
.sb-item .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item .cl { margin-left: auto; font-size: 10px; color: #8aa0b8; }

/* ---------- 右侧科目详情面板（测试页） ---------- */
#subjPanel {
  background: rgba(16,20,28,.66); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 14px 14px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  color: #e8eef6; overflow-y: auto;
}
#subjPanel::-webkit-scrollbar { width: 6px; }
#subjPanel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
#subjPanel .sp-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
#spName { font-size: 16px; font-weight: 700; }
#spClause { font-size: 11px; color: #cfe0f5; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 6px; }
#spDesc { font-size: 12px; line-height: 1.75; color: #bcccdb; margin: 8px 0 10px; }
.sp-mt { font-size: 11px; color: #7f93a8; border-top: 1px solid rgba(255,255,255,.1); padding-top: 8px; margin-bottom: 6px; letter-spacing: 1px; }
#subjMetrics { font-size: 12.5px; line-height: 1.95; color: #dfe7f0; }
#subjMetrics b { color: #fff; }
.verdict { margin: 10px 0 4px; padding: 7px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; text-align: center; }
.verdict.run { background: rgba(120,180,255,.2); color: #bcd8ff; }
.verdict.pass { background: rgba(46,204,113,.25); color: #7dffb0; }
.verdict.warn { background: rgba(255,210,63,.22); color: #ffe08a; }
.verdict.fail { background: rgba(255,59,48,.25); color: #ff9b94; }
#subjPanel button { width: 100%; margin-top: 8px; cursor: pointer; border: none; border-radius: 8px; padding: 8px; font-size: 13px; font-weight: 600; color: #fff; }
#reTestBtn { background: rgba(31,111,235,.85); }
#reTestBtn:hover { background: rgba(31,111,235,1); }
#exitTestBtn { background: rgba(90,100,112,.85); }
#exitTestBtn:hover { background: rgba(90,100,112,1); }

/* ---------- 设备信息卡（两页共用） ---------- */
#equipCard {
  background: rgba(16,20,28,.72); backdrop-filter: blur(10px);
  border: 1px solid rgba(120,180,255,.28); border-radius: 14px;
  padding: 14px 14px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  color: #e8eef6; overflow-y: auto;
}
#equipCard::-webkit-scrollbar { width: 6px; }
#equipCard::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.eq-head { display: flex; align-items: center; gap: 8px; }
#eqTag {
  font-size: 11px; font-weight: 700; color: #9fd0ff;
  background: rgba(31,111,235,.3); border: 1px solid rgba(120,180,255,.4);
  padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
#eqName { font-size: 16px; font-weight: 700; flex: 1; }
#eqClose {
  cursor: pointer; border: none; background: rgba(255,255,255,.1);
  color: #cfd8e3; width: 24px; height: 24px; border-radius: 7px;
  font-size: 12px; line-height: 1; transition: background .15s;
}
#eqClose:hover { background: rgba(255,59,48,.55); color: #fff; }
.eq-status { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 12px; color: #7dffb0; }
.eq-status i {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71;
  box-shadow: 0 0 8px rgba(46,204,113,.9); animation: eqPulse 1.6s infinite;
}
@keyframes eqPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.eq-rows { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 6px; }
.eq-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; line-height: 2.0; }
.eq-row .k { color: #9fb3c8; white-space: nowrap; }
.eq-row .v { color: #e8eef6; font-weight: 600; text-align: right; }
.eq-desc { margin-top: 9px; font-size: 12px; line-height: 1.75; color: #bcccdb; border-top: 1px solid rgba(255,255,255,.1); padding-top: 9px; }

/* ---------- 操作提示 ---------- */
#tip {
  position: fixed; z-index: 10;
  color: #cfd8e3; font-size: 12px; text-align: center; line-height: 1.7;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); opacity: .9; pointer-events: none;
}
/* 飞行页：提示置于两摇杆之间 */
body.page-flight #tip { left: 170px; right: 170px; bottom: 58px; }
/* 测试页：提示置于左右两列之间 */
body.page-tests #tip { left: 296px; right: 336px; bottom: 26px; }

/* ---------- 虚拟手柄（飞行页） ---------- */
.joy {
  position: fixed; bottom: 24px; width: 122px; height: 122px; border-radius: 50%;
  background: rgba(16,20,28,.5); border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px); z-index: 12; touch-action: none;
}
.joy.active { border-color: rgba(120,180,255,.95); box-shadow: 0 0 14px rgba(120,180,255,.4); }
#joyL { left: 26px; }
#joyR { right: 26px; }
.joy .knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(120,180,255,.85);
  box-shadow: 0 3px 10px rgba(0,0,0,.45); pointer-events: none;
}
.joy .cap {
  position: absolute; bottom: -22px; width: 100%; text-align: center;
  color: #aab8c8; font-size: 11px; pointer-events: none;
}

/* ---------- 加载遮罩 ---------- */
#loading {
  position: fixed; inset: 0; z-index: 20; display: flex;
  align-items: center; justify-content: center; background: #0b0e14;
  color: #9fb3c8; font-size: 14px; letter-spacing: 2px;
  transition: opacity .6s ease;
}
