/* ===========================================================
   手势圣诞树 — 界面样式
   =========================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background:
    radial-gradient(120% 88% at 50% 6%, #0e1832 0%, #080d1a 40%, #04060d 72%, #020308 100%);
  color: #e9f2ff;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(72% 58% at 50% 52%, rgba(0, 0, 0, 0) 34%, rgba(2, 4, 10, 0.55) 80%, rgba(1, 2, 6, 0.92) 100%);
}

/* ---------- 顶部 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  pointer-events: none;
  z-index: 6;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: rgba(233, 242, 255, 0.62);
  text-transform: uppercase;
}

.brand .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ffd88a;
  box-shadow: 0 0 12px 2px rgba(255, 216, 138, 0.75);
  animation: pulse 2.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(233, 242, 255, 0.66);
  background: rgba(10, 16, 30, 0.5);
  border: 1px solid rgba(255, 216, 138, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
}
.status i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(143, 220, 255, 0.9);
  box-shadow: 0 0 8px rgba(143, 220, 255, 0.8);
}
.status.live i { background: #4ee6a4; box-shadow: 0 0 10px rgba(78, 230, 164, 0.9); }
.status.live { color: rgba(220, 255, 240, 0.9); border-color: rgba(78, 230, 164, 0.28); }

/* ---------- 标题 ---------- */
.hero {
  position: fixed;
  top: clamp(54px, 9vh, 92px);
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-weight: 400;
  font-size: clamp(15px, 1.65vw, 24px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  background: linear-gradient(180deg, #fffaf0 0%, #ffe6b0 48%, #d8a25c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 190, 110, 0.28));
}

.hero .rule {
  display: block;
  width: 44px;
  height: 1px;
  margin: 14px auto 12px;
  background: linear-gradient(90deg, transparent, rgba(255, 216, 138, 0.85), transparent);
}

.hero p {
  margin: 0;
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 0.22em;
  color: rgba(233, 242, 255, 0.42);
  text-indent: 0.22em;
}

/* ---------- 手势提示 ---------- */
.hints {
  position: fixed;
  left: clamp(16px, 4vw, 40px);
  bottom: clamp(88px, 12vh, 110px);
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.hints.dim { opacity: 0.32; }

.hint {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 12px;
  line-height: 1;
}
.hint b {
  font-weight: 500;
  color: rgba(255, 224, 172, 0.92);
  letter-spacing: 0.06em;
  position: relative;
  padding-left: 13px;
}
.hint b::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 4px; height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: rgba(255, 216, 138, 0.75);
}
.hint span { color: rgba(233, 242, 255, 0.34); }

/* ---------- 摄像头预览 ---------- */
.cam-card {
  position: fixed;
  right: clamp(16px, 3vw, 34px);
  bottom: clamp(88px, 12vh, 110px);
  width: clamp(150px, 15vw, 208px);
  border-radius: 14px;
  overflow: hidden;
  background: #06090f;
  border: 1px solid rgba(255, 216, 138, 0.18);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  z-index: 5;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.cam-card.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }

.cam-card video,
.cam-card canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
}
.cam-card video { transform: scaleX(-1); opacity: 0.62; filter: saturate(0.7) contrast(1.05); }
.cam-card canvas { mix-blend-mode: screen; }

.cam-tag {
  position: absolute;
  left: 8px; bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(255, 240, 214, 0.9);
  background: rgba(6, 10, 18, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* ---------- 底部按钮 ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: clamp(22px, 4vh, 38px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(9, 14, 26, 0.52);
  border: 1px solid rgba(255, 216, 138, 0.14);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  z-index: 8;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 216, 138, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(233, 242, 255, 0.78);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}
.btn:hover {
  background: rgba(255, 216, 138, 0.1);
  border-color: rgba(255, 216, 138, 0.38);
  color: #fff5e2;
}
.btn:active { transform: scale(0.97); }
.btn.on { color: #ffe9bd; border-color: rgba(255, 216, 138, 0.5); background: rgba(255, 216, 138, 0.12); }

.btn.primary {
  background: linear-gradient(180deg, #ffe6b6, #efbd76);
  border-color: rgba(255, 232, 190, 0.9);
  color: #241503;
  font-weight: 600;
  box-shadow: 0 6px 22px rgba(239, 189, 118, 0.28);
}
.btn.primary:hover { background: linear-gradient(180deg, #fff1cd, #f5c885); color: #1b0f02; }

.ico-cam {
  width: 15px; height: 11px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  position: relative;
  opacity: 0.9;
}
.ico-cam::after {
  content: "";
  position: absolute;
  right: -6px; top: 50%;
  width: 4px; height: 6px;
  margin-top: -3px;
  border-radius: 1px;
  background: currentColor;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

/* ---------- 加载 / 提示 ---------- */
.loading {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(255, 240, 214, 0.9);
  background: rgba(8, 13, 24, 0.78);
  border: 1px solid rgba(255, 216, 138, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 20;
  transition: opacity 0.3s ease;
}
.loading.hidden { opacity: 0; pointer-events: none; }

.spin {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 216, 138, 0.22);
  border-top-color: #ffd88a;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(80px, 12vh, 108px);
  transform: translate(-50%, 12px);
  max-width: min(84vw, 520px);
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  color: rgba(255, 245, 230, 0.94);
  background: rgba(12, 18, 32, 0.9);
  border: 1px solid rgba(255, 216, 138, 0.22);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 13px;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
  }
  .hero p { font-size: 10.5px; letter-spacing: 0.16em; text-indent: 0.16em; }
}

@media (max-width: 860px) {
  .hints { display: none; }
  .cam-card {
    width: 118px;
    right: 14px;
    bottom: 92px;
    border-radius: 12px;
  }
  .cam-tag { font-size: 9px; padding: 2px 7px; left: 6px; bottom: 6px; }
  .status { display: none; }
  .btn { height: 38px; padding: 0 14px; font-size: 12px; }
}

@media (max-height: 620px) {
  .hints { display: none; }
  .hero { top: 46px; }
  .hero .rule, .hero p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .brand .dot, .spin { animation: none; }
}
