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

html, body {
  height: 100%;
  overflow: hidden;
  background: #040612;
  color: #e8e6f5;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* 视频只作为姿态识别输入源，不直接展示 */
#camera {
  position: fixed;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

#beat-debug-flash {
  position: fixed;
  inset: 0;
  border: 10px solid rgba(255, 255, 255, 0.95);
  pointer-events: none;
  opacity: 0;
  z-index: 15;
}

#beat-debug-flash.active { animation: beat-debug-flash 180ms ease-out; }

@keyframes beat-debug-flash {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}

#beat-debug-chart {
  position: fixed;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 20px));
  height: 124px;
  border: 1px solid rgba(157, 214, 255, 0.22);
  border-radius: 12px;
  background: rgba(4, 6, 18, 0.8);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  z-index: 20;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(ellipse at center, rgba(20, 16, 60, 0.55), rgba(4, 6, 18, 0.92));
  transition: opacity 0.6s ease;
  z-index: 10;
}

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

#overlay h1 {
  font-size: clamp(48px, 12vw, 96px);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, #7de2ff, #b388ff 45%, #ff7ab8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline { font-size: 18px; opacity: 0.85; }

#start-btn {
  margin-top: 8px;
  padding: 14px 46px;
  font-size: 20px;
  font-weight: 600;
  color: #040612;
  background: linear-gradient(120deg, #7de2ff, #b388ff);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 32px rgba(125, 226, 255, 0.35);
}

#start-btn:active { transform: scale(0.96); }
#start-btn:disabled { opacity: 0.5; cursor: wait; }

.hint { font-size: 13px; line-height: 1.7; opacity: 0.55; }

#status { font-size: 14px; min-height: 1.5em; color: #9ad0ff; }

#hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  display: flex;
  gap: 14px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.5;
  z-index: 5;
  pointer-events: none;
}

#mode-button {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  padding: 7px 12px;
  border: 1px solid rgba(157, 214, 255, 0.25);
  border-radius: 999px;
  color: #e8f6ff;
  background: rgba(4, 6, 18, 0.62);
  backdrop-filter: blur(10px);
  font: 12px -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  z-index: 18;
}

#mode-toast {
  position: fixed;
  top: 48%;
  left: 50%;
  padding: 10px 20px;
  border-radius: 999px;
  color: #f2fbff;
  background: rgba(4, 6, 18, 0.68);
  box-shadow: 0 0 26px rgba(125, 226, 255, 0.2);
  font-size: 18px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 19;
}

#mode-toast.show { animation: mode-toast 1s ease-out; }

@keyframes mode-toast {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  18%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
}

#stats-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 46px));
  right: 10px;
  width: min(300px, calc(100vw - 20px));
  padding: 12px;
  border: 1px solid rgba(157, 214, 255, 0.2);
  border-radius: 14px;
  background: rgba(4, 6, 18, 0.8);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  font-size: 12px;
  line-height: 1.45;
  z-index: 20;
}

.stats-head, .stats-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stats-head strong { font-size: 13px; }

.stats-head button, .stats-filters button {
  border: 1px solid rgba(157, 214, 255, 0.25);
  border-radius: 999px;
  padding: 4px 8px;
  color: #d9edff;
  background: rgba(125, 226, 255, 0.1);
  font: inherit;
}

.stats-filters {
  justify-content: flex-start;
  margin: 10px 0;
}

.stats-filters button.active { background: rgba(125, 226, 255, 0.32); }

.stats-days, .stats-metrics {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.stats-days span {
  min-width: 0;
  padding: 5px 2px;
  border-radius: 5px;
  color: rgba(232, 230, 245, 0.8);
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.stats-days b { display: block; color: #8fe5ff; font-size: 11px; }

.stats-metrics {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 8px;
}

.stats-metrics span { color: rgba(232, 230, 245, 0.68); }
.stats-metrics b { display: block; color: #eef8ff; font-size: 13px; }
.stats-empty { color: rgba(232, 230, 245, 0.58); }
