/* ============ 主动悬架 3D 仿真 · 样式 ============ */
:root {
  --bg: #0d1014;
  --bg2: #12161c;
  --panel: #151a21;
  --panel2: #1a2029;
  --line: #232b36;
  --txt: #dde5ef;
  --dim: #8895a6;
  --p: #ff8a3d;
  /* 被动 */
  --a: #3ddcff;
  /* 主动 */
  --good: #46d97f;
  --bad: #ff5a52;
  --warn: #ffc247;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--txt);
  font: 13px/1.5 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
#top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 16px;
  background: linear-gradient(180deg, #171d25, #12161c);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px;
  background:
    radial-gradient(circle at 30% 30%, #3ddcff 0 28%, transparent 29%),
    radial-gradient(circle at 70% 72%, #ff8a3d 0 28%, transparent 29%),
    linear-gradient(135deg, #1d2530, #2a3542);
  box-shadow: 0 0 0 1px #2c3644, 0 4px 14px rgba(0, 0, 0, .5);
}

#top h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .2px; }
#top p { margin: 1px 0 0; font-size: 11.5px; color: var(--dim); }
#top p b, #top h1 b { color: var(--txt); }

.status {
  display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: flex-end;
  font: 11.5px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--dim);
  max-width: 62%;
}
.status b { color: var(--txt); font-weight: 600; }
.status .warn { color: var(--warn); font-style: normal; }
.status .ev { color: var(--a); }
.status .ev b { color: var(--a); }

/* ---------- 主区 ---------- */
main { flex: 1 1 auto; display: flex; min-height: 0; }

.panel {
  flex: 0 0 292px; overflow-y: auto; overflow-x: hidden;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 10px 10px 40px;
}
#right { border-right: none; border-left: 1px solid var(--line); flex-basis: 398px; }

.panel::-webkit-scrollbar { width: 9px; }
.panel::-webkit-scrollbar-thumb { background: #2a3340; border-radius: 5px; }
.panel::-webkit-scrollbar-track { background: transparent; }

#stage { flex: 1 1 auto; position: relative; min-width: 0; background: #0a0d11; }
#gl { display: block; width: 100%; height: 100%; }

.split {
  position: absolute; left: 0; right: 0; top: 50%; height: 0;
  border-top: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 -1px 12px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.vlabel {
  position: absolute; left: 12px; display: flex; align-items: center; gap: 9px;
  pointer-events: none; text-shadow: 0 1px 6px rgba(0, 0, 0, .85);
}
.vlabel.top { top: 10px; }
.vlabel.bottom { top: calc(50% + 10px); }

.vlabel .tag {
  font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(10, 13, 17, .74); border: 1px solid;
}
.vlabel .tag.p { color: var(--p); border-color: rgba(255, 138, 61, .55); }
.vlabel .tag.a { color: var(--a); border-color: rgba(61, 220, 255, .55); }
.vlabel .desc { font-size: 11px; color: #b9c6d6; }
.vlabel .desc b { color: #fff; }

.hintbar {
  position: absolute; right: 12px; bottom: 8px; font-size: 10.5px; color: #7d8b9c;
  background: rgba(10, 13, 17, .6); padding: 3px 9px; border-radius: 12px; pointer-events: none;
}

/* ---------- 控件组 ---------- */
.group { margin-bottom: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.gtitle {
  padding: 7px 11px; font-size: 11.5px; font-weight: 650; letter-spacing: .4px;
  color: #aab8c9; background: #1e2530; border-bottom: 1px solid var(--line);
}
.gbody { padding: 9px 11px 11px; }

.row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.row > label { flex: 0 0 74px; font-size: 11.5px; color: var(--dim); }
.row.slider > label { flex: 0 0 92px; }
.row .val {
  flex: 0 0 62px; text-align: right;
  font: 11.5px ui-monospace, Menlo, Consolas, monospace; color: var(--txt);
}

.sel {
  flex: 1 1 auto; min-width: 0; background: #10151b; color: var(--txt);
  border: 1px solid #2b3544; border-radius: 6px; padding: 5px 7px; font-size: 12px;
}
.sel:focus { outline: none; border-color: var(--a); }

input[type=range] {
  flex: 1 1 auto; min-width: 0; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 3px; background: #2b3544; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--a); border: 2px solid #0d1014; cursor: pointer;
  box-shadow: 0 0 0 1px #3ddcff55;
}

.btnrow { display: flex; gap: 6px; margin-top: 3px; }
.btnrow.wrap { flex-wrap: wrap; }

.btn {
  flex: 1 1 auto; padding: 6px 8px; font-size: 11.5px; cursor: pointer;
  background: #10151b; color: #b9c6d6; border: 1px solid #2b3544; border-radius: 6px;
  transition: .13s;
}
.btn:hover { background: #18202a; color: #fff; border-color: #3c4a5c; }
.btn.sm { flex: 0 0 auto; padding: 4px 9px; font-size: 11px; }
.btn.on { background: #123240; color: var(--a); border-color: #2a6d84; }

.hint { font-size: 11px; line-height: 1.65; color: #8895a6; margin-top: 6px; }
.hint b { color: #b9c6d6; }
.hint.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; line-height: 1.7; }
.hint.mono b { color: var(--txt); }
.hint .dim { color: #5f6c7c; }

.kincanvas { width: 100%; display: block; margin-top: 8px; border-radius: 6px; background: #10151b; }

/* ---------- 图例 / 曲线 ---------- */
.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  font-size: 11px; color: var(--dim); margin-bottom: 8px;
}
.legend em { font-style: normal; color: #6f7d8e; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.dot.p { background: var(--p); }
.dot.a { background: var(--a); }
.dot.r { background: rgba(255, 255, 255, .35); }

.charts { display: flex; flex-direction: column; gap: 9px; }
.chart { background: #10151b; border: 1px solid #212936; border-radius: 7px; padding: 5px 6px 2px; }
.chart canvas { display: block; width: 100%; }

.chart-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 0 2px 3px; font-size: 11px;
}
.chart-head .ct { color: #b9c6d6; font-weight: 600; }
.chart-head .ct em { font-style: normal; color: #6f7d8e; font-weight: 400; }
.chart-head .cv { font: 11px ui-monospace, Menlo, Consolas, monospace; color: var(--dim); white-space: nowrap; }
.chart-head .cv b { font-weight: 700; margin-left: 4px; }

.good { color: var(--good) !important; }
.bad { color: var(--bad) !important; }
.flat { color: #6f7d8e !important; }
.ok { color: #9fd8b4 !important; }
.warn { color: var(--warn) !important; }

/* ---------- 指标表 ---------- */
.metrics { font-size: 11.5px; }
.mh, .mr {
  display: grid; grid-template-columns: 1fr 62px 62px 62px;
  gap: 4px; padding: 4px 2px; align-items: baseline;
}
.mh { color: #6f7d8e; font-size: 10.5px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.mh span:not(:first-child), .mr span:not(:first-child) { text-align: right; font-family: ui-monospace, Menlo, Consolas, monospace; }
.mr { border-bottom: 1px solid #1b222c; }
.mr:hover { background: #171e27; }
.mr > span:first-child { color: #b9c6d6; }
.mr em { font-style: normal; color: #5f6c7c; font-size: 10px; margin-left: 4px; }
.mr .p { color: var(--p); }
.mr .a { color: var(--a); }
.mr.big { margin-top: 5px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; }
.mr.big span:not(:first-child) { font-family: inherit; font-weight: 650; }

/* ---------- 结论卡 ---------- */
.headline {
  margin-bottom: 12px; padding: 10px 12px 11px; border-radius: 9px;
  background: linear-gradient(160deg, #16303a 0%, #1a2029 62%);
  border: 1px solid #2a5c6d;
}
.hl-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; font-weight: 650; color: #cfe6ef; margin-bottom: 9px;
}
.hl-title .hl-t { font-size: 10px; font-weight: 400; color: #7d99a6; }
.hl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hl-cell { text-align: center; padding: 5px 2px 4px; background: rgba(0, 0, 0, .26); border-radius: 6px; }
.hl-cell b { display: block; font-size: 20px; font-weight: 700; line-height: 1.12; letter-spacing: -.5px; }
.hl-cell span { display: block; font-size: 9.5px; line-height: 1.35; color: #8fa6b3; margin-top: 2px; }
.hl-foot { margin-top: 9px; font-size: 11px; color: #8fa6b3; }
.hl-foot i { font-style: normal; font-weight: 650; }
.hl-foot b { margin-left: 4px; }

/* ---------- 启动遮罩 ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 42%, #182030, #0a0d11 72%);
  transition: opacity .5s;
}
#boot.gone { opacity: 0; pointer-events: none; }
.bootbox { text-align: center; }
.bootbox h1 { margin: 18px 0 6px; font-size: 19px; font-weight: 650; }
.bootbox p { margin: 0; font-size: 12.5px; color: var(--dim); max-width: 460px; }
#boot.err p { color: var(--bad); }

.spinner {
  width: 46px; height: 46px; margin: 0 auto; border-radius: 50%;
  border: 3px solid #263140; border-top-color: var(--a); border-right-color: var(--p);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 窄屏 ---------- */
@media (max-width: 1280px) {
  .panel { flex-basis: 250px; }
  #right { flex-basis: 330px; }
  .status { max-width: 48%; }
}
