:root {
  --ink: #eaf3ff;
  --dim: rgba(234, 243, 255, 0.42);
  --line: rgba(160, 210, 255, 0.16);
  --accent: #7ff0c0;
  --bg: #03050b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #03050b;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 46%, rgba(30, 90, 140, 0.10), transparent 70%),
    radial-gradient(ellipse 92% 82% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.72) 100%);
  mix-blend-mode: screen;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.6'/></svg>");
}

.hud {
  position: fixed;
  pointer-events: none;
  z-index: 5;
}
.hud-tl { top: 30px; left: 36px; }
.hud-tr { top: 30px; right: 36px; display: flex; gap: 8px; align-items: center; }
.hud-bl { left: 36px; bottom: 34px; }

.brand {
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: rgba(240, 248, 255, 0.92);
  text-shadow: 0 0 26px rgba(120, 220, 255, 0.35);
}
.sub {
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.42em;
  color: rgba(160, 200, 235, 0.42);
}

.chip {
  font-size: 11px;
  letter-spacing: 0.18em;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(160, 210, 255, 0.22);
  background: rgba(140, 200, 255, 0.07);
  color: rgba(225, 242, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.5s ease;
  white-space: nowrap;
}
.chip.ghost {
  border-color: rgba(160, 210, 255, 0.10);
  background: rgba(140, 200, 255, 0.03);
  color: rgba(190, 215, 240, 0.55);
}
.chip.live {
  border-color: rgba(127, 240, 192, 0.45);
  color: var(--accent);
  box-shadow: 0 0 22px rgba(127, 240, 192, 0.18);
}

.tips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.tips li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: rgba(180, 205, 230, 0.30);
  transition: color 0.45s ease, transform 0.45s ease;
}
.tips li b {
  font-weight: 500;
  color: rgba(200, 220, 240, 0.42);
  transition: color 0.45s ease;
}
.tips li span {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(170, 195, 220, 0.24);
  transition: color 0.45s ease;
}
.tips li.active { transform: translateX(4px); }
.tips li.active b { color: var(--accent); }
.tips li.active span { color: rgba(180, 230, 210, 0.55); }

.preview-wrap {
  position: fixed;
  right: 32px;
  bottom: 30px;
  z-index: 6;
  width: 180px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(160, 210, 255, 0.14);
  background: rgba(6, 12, 22, 0.6);
  opacity: 0.55;
  transition: opacity 0.5s ease, box-shadow 0.5s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.preview-wrap:hover { opacity: 0.9; }
.preview-wrap.active { opacity: 0.78; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(127, 240, 192, 0.18); }
#preview {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.75) contrast(1.05) brightness(0.9);
}
.preview-label {
  padding: 6px 10px;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: rgba(180, 210, 235, 0.6);
  background: rgba(4, 8, 16, 0.85);
  border-top: 1px solid rgba(160, 210, 255, 0.08);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 14px);
  z-index: 20;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(230, 245, 255, 0.92);
  background: rgba(10, 20, 34, 0.86);
  border: 1px solid rgba(160, 210, 255, 0.18);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 45%, rgba(20, 60, 100, 0.55), transparent 70%),
    rgba(2, 4, 9, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.8s ease, visibility 0.8s;
}
.overlay.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.panel {
  max-width: 460px;
  text-align: center;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-mark {
  font-size: 22px;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(127, 240, 192, 0.7);
  margin-bottom: 16px;
}
.panel h1 {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #f2f9ff;
  text-shadow: 0 0 40px rgba(120, 200, 255, 0.35);
}
.lede {
  margin: 0 auto 30px;
  max-width: 340px;
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: rgba(190, 215, 240, 0.62);
}
.panel-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.btn {
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  padding: 13px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s ease;
  border: 1px solid transparent;
}
.btn.primary {
  background: rgba(127, 240, 192, 0.94);
  color: #04140f;
  font-weight: 600;
  box-shadow: 0 0 34px rgba(127, 240, 192, 0.35);
}
.btn.primary:hover { background: #9ffbd4; transform: translateY(-1px); }
.btn.ghost {
  background: transparent;
  border-color: rgba(160, 210, 255, 0.22);
  color: rgba(200, 225, 245, 0.72);
}
.btn.ghost:hover { border-color: rgba(160, 210, 255, 0.5); color: #e6f4ff; }
.hint {
  margin: 0;
  font-size: 10.5px;
  line-height: 2;
  letter-spacing: 0.08em;
  color: rgba(160, 195, 225, 0.34);
}

#cam {
  position: fixed;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
  top: 0;
  left: 0;
}

/* ---- 摄像头诊断面板 ---- */
.cam-panel {
  max-width: 380px;
  margin: 0 auto 24px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 140, 120, 0.22);
  background: rgba(60, 20, 16, 0.35);
  text-align: left;
  animation: rise 0.5s ease both;
}
.cam-err {
  font-size: 11.5px;
  line-height: 1.85;
  letter-spacing: 0.04em;
  color: rgba(255, 205, 195, 0.9);
}
.cam-err b {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: #ffb0a0;
}
.cam-err code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 225, 215, 0.8);
}
.cam-err .hl {
  color: #8ff0c4;
  font-weight: 500;
}
/* file:// 场景下的引导文案：改用绿色调，和报错用的粉红区分开 */
.cam-err.file-hint {
  color: rgba(206, 238, 226, 0.88);
}
.cam-err.file-hint b {
  color: #8ff0c4;
}
.cam-err.file-hint code {
  background: rgba(120, 235, 175, 0.12);
  color: rgba(190, 248, 220, 0.92);
}
.cam-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: rgba(200, 225, 245, 0.5);
}
/* display:flex 会盖掉 [hidden] 的默认 display:none，必须显式补一条，
   否则只有一个摄像头时那个空的设备下拉框也会一直露出来 */
.cam-row[hidden] {
  display: none;
}
.cam-row select {
  flex: 1;
  font-family: inherit;
  font-size: 11px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(160, 210, 255, 0.2);
  background: rgba(10, 18, 30, 0.9);
  color: rgba(225, 240, 255, 0.85);
  outline: none;
}
.panel-actions.compact {
  justify-content: flex-start;
  gap: 10px;
  margin: 16px 0 0;
}
.panel-actions.compact .btn {
  padding: 9px 18px;
  font-size: 11px;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

body.mouse-mode { cursor: crosshair; }

@media (max-width: 720px) {
  .hud-tl, .hud-bl { left: 20px; }
  .hud-tr { right: 20px; }
  .hud-bl { bottom: 20px; }
  .tips { gap: 8px; }
  .tips li { font-size: 10px; }
  .preview-wrap { width: 116px; right: 16px; bottom: 16px; }
  .brand { font-size: 15px; }
  .panel h1 { font-size: 23px; }
}
