/* style.css — 白模 · 全局空间人体动作重建平台 */

:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --border: #e4eaf2;
  --text: #1b2534;
  --text2: #5c6b80;
  --text3: #8b99ad;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
}

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

html, body {
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-rows: 54px 1fr 62px;
  grid-template-columns: 292px 1fr;
  grid-template-areas:
    "header header"
    "sidebar viewport"
    "timeline timeline";
  height: 100vh;
}

/* ---------------- 顶栏 ---------------- */

.header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.logo .cube {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.logo .sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-left: 2px;
}

.header .spacer { flex: 1; }

.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.header a {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
}

.header a:hover { background: var(--accent-soft); }

/* ---------------- 侧栏 ---------------- */

.sidebar {
  grid-area: sidebar;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.section h3 {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 9px;
  padding: 9px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  user-select: none;
}

.chip:hover { border-color: #c7d0fe; color: var(--accent); }

.chip.active {
  background: var(--accent-soft);
  border-color: #b9c0fb;
  color: var(--accent);
}

.btn-row { display: flex; flex-direction: column; gap: 8px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn:hover { border-color: #c7d0fe; color: var(--accent); background: var(--accent-soft); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover { background: #4338ca; color: #fff; }

.btn.rec {
  background: #fee2e2;
  border-color: #fca5a5;
  color: var(--danger);
}

.hint { font-size: 11px; color: var(--text3); line-height: 1.6; margin-top: 8px; }

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text2);
}

.opt-row label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; }

.opt-row select, .opt-row input[type="number"] {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 7px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  width: 86px;
}

input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

.cam-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.camBtn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 7px 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.camBtn:hover { color: var(--accent); border-color: #c7d0fe; }
.camBtn.active { background: var(--accent-soft); border-color: #b9c0fb; color: var(--accent); }

.about-text { font-size: 11.5px; color: var(--text2); line-height: 1.75; }
.about-text b { color: var(--text); }
.about-text a { color: var(--accent); text-decoration: none; }

/* ---------------- 视口 ---------------- */

.viewport {
  grid-area: viewport;
  position: relative;
  overflow: hidden;
  background: #eef2f7;
}

.viewport canvas { display: block; }

.dropHint {
  position: absolute;
  inset: 14px;
  border: 2px dashed #a5b4fc;
  border-radius: 16px;
  background: rgba(238, 242, 247, 0.82);
  display: none;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
  z-index: 10;
}

.dropHint.show { display: grid; }

/* 视频预览浮窗 */
.videoBox {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 218px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 6;
}

.videoBox.show { display: block; }

.videoBox video {
  width: 100%;
  border-radius: 8px;
  background: #0b1020;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.videoBox .cap {
  font-size: 11px;
  color: var(--text2);
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------- 时间轴 ---------------- */

.timeline {
  grid-area: timeline;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.playBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s, background 0.15s;
  flex-shrink: 0;
}

.playBtn:hover { background: #4338ca; transform: scale(1.06); }

.timeLabel {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline input[type="range"] {
  flex: 1;
  height: 5px;
  accent-color: var(--accent);
  cursor: pointer;
}

.timeline .tl-right { display: flex; align-items: center; gap: 10px; }

.timeline select {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.tl-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
}

/* ---------------- AI 进度弹窗 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  place-items: center;
  z-index: 50;
  backdrop-filter: blur(3px);
}

.modal.show { display: grid; }

.modal .card {
  width: 340px;
  background: var(--panel);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25);
  text-align: center;
}

.modal h4 { font-size: 15px; margin-bottom: 6px; }

.modal .aiStatus {
  font-size: 12px;
  color: var(--text2);
  min-height: 18px;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.barWrap {
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.barWrap .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 999px;
  transition: width 0.2s;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: #f9fafb;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s;
  max-width: 70vw;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #7f1d1d; }

/* 状态条 */
.statusBar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--text2);
  box-shadow: var(--shadow);
  z-index: 5;
  max-width: 46%;
}

.statusBar b { color: var(--text); font-size: 12.5px; display: block; margin-bottom: 2px; }

/* 滚动条 */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #d3dce8; border-radius: 999px; }

/* ============================ 多人 · 人物列表 ============================ */
#personSection .badge {
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: 1px;
  margin-left: 4px;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.person-row:hover { background: #f0f4fa; }

.person-row.focus {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.person-row .pdot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 1px 3px rgba(16, 24, 40, 0.2);
}

.person-row .pname {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.person-row .pvis {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* ============================ 轨迹统计 ============================ */
.statGrid { display: flex; flex-direction: column; gap: 6px; }

.statCard {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  background: #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--text2);
}

.statCard b {
  font-size: 12px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.statCard .pdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
