:root {
  --bg-deep: #030612;
  --bg-mid: #080f22;
  --gold-1: #fff1cc;
  --gold-2: #e7c27d;
  --gold-3: #b88a3e;
  --cyan-glow: #7be8ff;
  --emerald-glow: #58e3a4;
  --rose-glow: #ff7a90;
  --glass-bg: rgba(9, 15, 32, 0.56);
  --glass-border: rgba(231, 194, 125, 0.24);
  --glass-border-strong: rgba(231, 194, 125, 0.48);
  --text-main: rgba(250, 246, 238, 0.94);
  --text-muted: rgba(220, 224, 238, 0.68);
  --font-serif: "Noto Serif SC", "Cinzel", Georgia, serif;
  --font-sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #0e1730 0%, #050916 55%, #02040b 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

#canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ==================== 左上角品牌标题与控制区 ==================== */
.top-left-hud {
  position: fixed;
  top: 22px;
  left: 24px;
  z-index: 20;
  max-width: 410px;
  pointer-events: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(231, 194, 125, 0.08);
  border: 1px solid rgba(231, 194, 125, 0.22);
  backdrop-filter: blur(10px);
  margin-bottom: 10px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px var(--gold-2);
}

.brand-tag {
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--gold-2);
}

.main-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 600;
  letter-spacing: 0.1em;
  background: linear-gradient(125deg, #fff9e6 0%, #f1d292 48%, #c99a4d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 28px rgba(231, 194, 125, 0.2);
  line-height: 1.2;
}

.subtitle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.quick-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: auto;
}

.glass-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: all 0.24s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

.glass-btn:hover {
  border-color: var(--glass-border-strong);
  background: rgba(231, 194, 125, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(231, 194, 125, 0.16);
}

.glass-btn.primary-btn {
  border-color: rgba(231, 194, 125, 0.45);
  background: linear-gradient(135deg, rgba(231, 194, 125, 0.22), rgba(145, 102, 39, 0.28));
  color: var(--gold-1);
}

.glass-btn.primary-btn:hover {
  background: linear-gradient(135deg, rgba(231, 194, 125, 0.34), rgba(184, 138, 62, 0.36));
}

.glass-btn.icon-only {
  padding: 7px 11px;
}

.btn-icon {
  font-size: 13px;
  line-height: 1;
}

/* ==================== 右上角：可折叠迷你摄像头预览小窗 ==================== */
.camera-widget {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 30;
  width: 292px;
  border-radius: 16px;
  background: rgba(7, 12, 26, 0.76);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  box-shadow:
    0 12px 38px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 241, 204, 0.1);
  overflow: hidden;
  transition: width 0.24s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.camera-widget.active-tracking {
  border-color: rgba(123, 232, 255, 0.4);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(123, 232, 255, 0.12);
}

.camera-widget.collapsed {
  width: 214px;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(231, 194, 125, 0.14);
  cursor: pointer;
}

.camera-widget.collapsed .camera-header {
  border-bottom-color: transparent;
}

.camera-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.camera-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.camera-led.idle {
  background: var(--gold-2);
  box-shadow: 0 0 8px rgba(231, 194, 125, 0.7);
}

.camera-led.active {
  background: var(--emerald-glow);
  box-shadow: 0 0 10px var(--emerald-glow);
  animation: ledPulse 2s ease-in-out infinite;
}

.camera-led.fallback {
  background: #9aa7c2;
  box-shadow: 0 0 6px rgba(154, 167, 194, 0.5);
}

.camera-led.error {
  background: var(--rose-glow);
  box-shadow: 0 0 8px var(--rose-glow);
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.86); }
}

.camera-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}

.camera-mode-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(231, 194, 125, 0.14);
  color: var(--gold-1);
  white-space: nowrap;
}

.camera-mode-tag.live {
  background: rgba(88, 227, 164, 0.16);
  color: var(--emerald-glow);
}

.camera-mode-tag.fallback {
  background: rgba(154, 167, 194, 0.16);
  color: #cbd5ea;
}

.collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s ease, color 0.2s ease;
}

.collapse-btn:hover {
  background: rgba(231, 194, 125, 0.16);
  color: var(--gold-1);
}

.camera-widget.collapsed .collapse-btn svg {
  transform: rotate(180deg);
}

.camera-body {
  padding: 10px;
  overflow: hidden;
}

.camera-widget.collapsed .camera-body {
  display: none;
}

.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 168px;
  border-radius: 11px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #111c36 0%, #060b18 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#webcam-video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#hand-overlay-canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* 摄像头权限浮层 */
.camera-overlay-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  gap: 5px;
  background: rgba(5, 10, 22, 0.86);
  backdrop-filter: blur(8px);
  transition: opacity 0.25s ease;
}

.camera-overlay-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}

.prompt-icon {
  font-size: 20px;
  line-height: 1;
}

.prompt-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gold-1);
}

.prompt-desc {
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.prompt-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
}

.mini-gold-btn,
.mini-ghost-btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-gold-btn {
  border: 1px solid rgba(231, 194, 125, 0.6);
  background: linear-gradient(135deg, rgba(231, 194, 125, 0.3), rgba(176, 128, 49, 0.42));
  color: var(--gold-1);
}

.mini-gold-btn:hover {
  background: linear-gradient(135deg, rgba(231, 194, 125, 0.44), rgba(196, 146, 62, 0.56));
  box-shadow: 0 0 14px rgba(231, 194, 125, 0.26);
}

.mini-ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.mini-ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-main);
}

/* 加载遮罩 */
.camera-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgba(5, 10, 22, 0.86);
  font-size: 11px;
  color: var(--gold-1);
}

.camera-loading.hidden {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(231, 194, 125, 0.22);
  border-top-color: var(--gold-2);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.camera-gesture-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--gold-1);
  background: rgba(4, 9, 20, 0.76);
  border: 1px solid rgba(231, 194, 125, 0.3);
  backdrop-filter: blur(6px);
}

.camera-gesture-badge.hidden {
  display: none;
}

/* 预览窗底部提示与实时指标 */
.camera-footer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.gesture-hints {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.hint-chip {
  text-align: center;
  padding: 4px 4px;
  border-radius: 8px;
  font-size: 10px;
  white-space: nowrap;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: all 0.22s ease;
}

.hint-chip.active {
  color: var(--gold-1);
  background: rgba(231, 194, 125, 0.2);
  border-color: rgba(231, 194, 125, 0.55);
  box-shadow: 0 0 12px rgba(231, 194, 125, 0.2);
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: rgba(166, 207, 232, 0.72);
  padding: 0 2px;
}

/* ==================== 照片放大展示信息浮层 ==================== */
.photo-focus-hud {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  z-index: 25;
  pointer-events: auto;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.photo-focus-hud.hidden {
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
}

.photo-focus-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(7, 12, 26, 0.74);
  border: 1px solid rgba(231, 194, 125, 0.38);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
}

.photo-focus-date {
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold-2);
}

.photo-focus-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--gold-1);
  letter-spacing: 0.08em;
}

.photo-focus-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ==================== 屏幕下方：实时手势状态提示栏 ==================== */
.bottom-status-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(6, 11, 24, 0.72);
  border: 1px solid rgba(231, 194, 125, 0.34);
  backdrop-filter: blur(16px);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(231, 194, 125, 0.1);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.status-pill.state-galaxy {
  border-color: rgba(123, 232, 255, 0.48);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(123, 232, 255, 0.16);
}

.status-pill.state-pinch {
  border-color: rgba(255, 224, 150, 0.72);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(231, 194, 125, 0.26);
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px var(--gold-2);
  flex-shrink: 0;
  animation: statusBreath 2.2s ease-in-out infinite;
}

.status-pill.state-galaxy .status-pulse {
  background: var(--cyan-glow);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.status-pill.state-pinch .status-pulse {
  background: #ffe99d;
  box-shadow: 0 0 12px #ffe99d;
}

@keyframes statusBreath {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.32); opacity: 0.65; }
}

.status-text {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--gold-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 82vw;
}

.mouse-tip {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: rgba(210, 218, 236, 0.56);
  text-align: center;
}

/* ==================== 首次进入轻提示权限条 ==================== */
.welcome-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 16px;
  border-radius: 999px;
  background: rgba(11, 18, 38, 0.84);
  border: 1px solid rgba(231, 194, 125, 0.42);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.welcome-toast.hidden {
  opacity: 0;
  transform: translate(-50%, -18px);
  pointer-events: none;
}

.welcome-toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-main);
  white-space: nowrap;
}

.welcome-spark {
  font-size: 14px;
}

.welcome-toast-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==================== 移动端 / 小屏适配 ==================== */
@media (max-width: 900px) {
  .welcome-toast {
    display: none;
  }

  .top-left-hud {
    top: 14px;
    left: 14px;
    max-width: calc(100vw - 280px);
  }

  .subtitle {
    display: none;
  }

  .camera-widget {
    top: 14px;
    right: 14px;
    width: 256px;
  }

  .camera-widget.collapsed {
    width: 214px;
  }

  .status-text {
    font-size: 11.5px;
  }

  .mouse-tip {
    display: none;
  }
}
