:root {
  --acc: #6c8cff;
  --ok: #3ddc84;
  --warn: #ffb020;
  --err: #ff5c5c;
  --panel: rgba(16, 16, 24, .9);
  --line: rgba(255, 255, 255, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.tiny { font-size: 11px; }

/* ---------- 摄像头画面 ---------- */
#cam {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}

/* ---------- 虚拟物体层 ---------- */
#gl {
  position: fixed;
  pointer-events: none;
  z-index: 2;
}

/* ---------- 启动遮罩 ---------- */
.boot {
  position: fixed; inset: 0;
  z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, #171728 0%, #08080d 75%);
  padding: 24px;
}
.boot.hide { display: none; }
.boot-inner { max-width: 380px; text-align: center; }
.boot h1 { font-size: 24px; margin: 0 0 12px; letter-spacing: 1px; }
.boot p { color: #9a9ab0; font-size: 13.5px; margin: 0 0 22px; line-height: 1.6; }
.boot .tiny { color: #5a5a70; margin: 14px 0 0; }

.btn-big {
  width: 100%;
  background: var(--acc); color: #fff;
  border: 0; border-radius: 13px;
  font: inherit; font-size: 17px; font-weight: 600;
  padding: 17px;
  cursor: pointer;
}
.btn-big:disabled { opacity: .45; cursor: default; }

.bar {
  height: 5px; border-radius: 3px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  margin: 0 0 20px;
}
.bar i { display: block; height: 100%; width: 0%; background: var(--acc); transition: width .2s; }

/* 启动日志：让每一步都留在屏幕上，而不是一闪而过 */
.boot-log {
  text-align: left;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 18px;
  max-height: 34vh;
  overflow-y: auto;
}
.boot-log .line {
  font: 11.5px/1.75 ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: #9a9ab0;
  word-break: break-word;
}
.boot-log .line.ok { color: #3ddc84; }
.boot-log .line.warn { color: #ffb020; }
.boot-log .line.err { color: #ff5c5c; }
.boot-log .line.run { color: #6c8cff; }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  left: 12px; top: calc(12px + env(safe-area-inset-top));
  z-index: 10;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 186px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.hud-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.tag {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(61, 220, 132, .18); color: var(--ok);
}
.tag.lost { background: rgba(255, 92, 92, .18); color: var(--err); }
.tag.warn { background: rgba(255, 176, 32, .18); color: var(--warn); }

.hud-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 5px 12px; margin-bottom: 7px;
}
.hud-grid div { display: flex; align-items: baseline; gap: 5px; }
.hud-grid b { font-size: 15px; font-weight: 600; font-family: ui-monospace, Consolas, monospace; }
.hud-grid span { font-size: 10.5px; color: #8a8aa0; }
.hud .tiny { color: #8a8aa0; line-height: 1.6; }

/* ---------- 控制条 ---------- */
#ctrl {
  position: fixed;
  right: 12px; top: calc(12px + env(safe-area-inset-top));
  z-index: 10;
  display: flex; flex-direction: column; gap: 8px;
}
.btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: #fff; font: inherit; font-size: 12.5px;
  padding: 9px 13px; border-radius: 10px;
  backdrop-filter: blur(8px);
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { background: rgba(108, 140, 255, .3); }

/* ---------- 参数面板 ---------- */
.panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 76vh;
  overflow-y: auto;
  backdrop-filter: blur(14px);
}
.panel-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-weight: 600;
}
.btn-x {
  background: none; border: 0; color: #9a9ab0;
  font-size: 17px; cursor: pointer; padding: 0 6px;
}

.fld { display: block; margin-bottom: 18px; }
.fld > span { display: block; font-size: 13px; margin-bottom: 7px; }
.fld > span i { color: var(--acc); font-style: normal; font-family: ui-monospace, Consolas, monospace; }
.fld small { display: block; color: #7a7a90; font-size: 11px; margin-top: 6px; line-height: 1.5; }

.fld select {
  width: 100%;
  background: #1c1c28; color: #fff;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 11px; font: inherit; font-size: 13.5px;
}

.fld input[type=range] {
  width: 100%; accent-color: var(--acc); height: 26px;
}

.fld.chk {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.fld.chk input { width: 19px; height: 19px; accent-color: var(--acc); }
.fld.chk span { margin: 0; font-size: 13.5px; }

.btn-wide {
  width: 100%;
  background: #26263a; color: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 13.5px;
  padding: 13px; cursor: pointer;
}
