/* ============================================================
   MoveNet Lightning 手机端人体姿态识别 Demo —— 样式
   深色全屏，居中画布，顶部 HUD + 底部图例
   ============================================================ */

:root {
  --bg: #0b0e14;
  --fg: #e8eef5;
  --pill-bg: rgba(10, 14, 20, 0.72);
  --pill-border: rgba(255, 255, 255, 0.14);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 20%, #101826 0%, var(--bg) 70%);
}

/* video 仅作视频源，不可见 */
#video {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* 画布：JS 动态设置 CSS 尺寸，保持视频比例居中 */
#overlay {
  position: absolute;
  display: block;
  border-radius: 10px;
  box-shadow: 0 0 44px rgba(0, 0, 0, 0.65);
  background: #000;
}

/* ---------- 顶部 HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
  pointer-events: none;
}

.pill {
  display: inline-block;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.3;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pill.ok   { color: #7dffb0; border-color: rgba(125, 255, 176, 0.35); }
.pill.warn { color: #ffcf5c; border-color: rgba(255, 207, 92, 0.35); }
.pill.bad  { color: #ff7a7a; border-color: rgba(255, 122, 122, 0.35); }

/* ---------- 状态横幅 ---------- */
.banner {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(8, 14, 22, 0.85);
  border: 1px solid var(--pill-border);
  font-size: 14px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner.ok  { color: #7dffb0; }
.banner.warn{ color: #ffcf5c; }
.banner.err { color: #ff7a7a; border-color: rgba(255, 122, 122, 0.4); }

/* ---------- 底部图例 ---------- */
#legend {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 12px;
  font-size: 12px;
  pointer-events: none;
}

.lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 999px;
}

.lg i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.lg-l i { background: #00e5ff; box-shadow: 0 0 6px rgba(0, 229, 255, 0.8); }
.lg-r i { background: #ffb300; box-shadow: 0 0 6px rgba(255, 179, 0, 0.8); }
.lg-c i { background: #ff2d55; box-shadow: 0 0 6px rgba(255, 45, 85, 0.8); }

/* ---------- 错误提示 ---------- */
#error {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  max-width: calc(100vw - 48px);
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(120, 20, 24, 0.92);
  border: 1px solid rgba(255, 122, 122, 0.5);
  color: #ffe3e3;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}