/* ==========================================================================
   动作分析 · 样式
   主题：html[data-theme="dark"|"light"]，所有颜色走变量
   媒体面（取景框、回放）在两种主题里都保持深色，避免黑底视频被"漂白"
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  color-scheme: dark;
  --bg: #0a0e13;
  --bg-soft: #0f151c;
  --card: #151d26;
  --card-2: #1b2430;
  --card-grad: linear-gradient(150deg, #17222d, #121922 72%);
  --line: #243040;
  --line-soft: rgba(36, 48, 64, 0.62);
  --text: #e9f0f7;
  --text-2: #c8d8e6;
  --muted: #8b9bab;
  --dim: #67798d;
  --dim-2: #4b5d70;
  --track: #1f2a36;
  --track-2: #2b3a49;
  --track-3: #35485c;
  --green: #23c98a;
  --green-rgb: 35, 201, 138;
  --green-ink: #7fe0b8;
  --orange: #ffb020;
  --orange-rgb: 255, 176, 32;
  --orange-ink: #ffcd76;
  --red: #ff5d5d;
  --red-rgb: 255, 93, 93;
  --blue: #4a9eff;
  --blue-rgb: 74, 158, 255;
  --blue-ink: #a2c7ea;
  --bar-good-a: #14a06a;
  --bar-good-b: #2fe0a0;
  --bar-mid-a: #c9861a;
  --bar-mid-b: #ffc247;
  --bar-poor-a: #b23c3c;
  --bar-poor-b: #ff6b6b;
  --ring-a: #23c98a;
  --ring-b: #4a9eff;
  --ring-c: #ffb020;
  --ring-d: #ff5d5d;
  --btn-primary: linear-gradient(160deg, #2fe0a0, #16b87c);
  --btn-primary-ink: #04140d;
  --btn-shutter: linear-gradient(160deg, #ff6a5e, #e0372b);
  --topbar-bg: rgba(10, 14, 19, 0.94);
  --toast-bg: rgba(24, 34, 44, 0.97);
  --mask-bg: rgba(4, 7, 10, 0.72);
  --sheet-bg: #10171f;
  --media-bg: #05080b;
  --hero-grad: linear-gradient(100deg, #23c98a, #7de3b6 62%, #b9f5d8);
  --shadow-card: none;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f8;
  --bg-soft: #e9eef4;
  --card: #ffffff;
  --card-2: #eef2f7;
  --card-grad: linear-gradient(150deg, #ffffff, #f8fbfd 72%);
  --line: #e1e8f0;
  --line-soft: #e8eef5;
  --text: #101a24;
  --text-2: #2b3d4d;
  --muted: #5b6e80;
  --dim: #7d8ea0;
  --dim-2: #9aaaba;
  --track: #e6ecf3;
  --track-2: #dbe4ee;
  --track-3: #ced9e6;
  --green: #0a8f62;
  --green-rgb: 10, 143, 98;
  --green-ink: #077a54;
  --orange: #b6720a;
  --orange-rgb: 182, 114, 10;
  --orange-ink: #96600a;
  --red: #d13a32;
  --red-rgb: 209, 58, 50;
  --blue: #1f6fc4;
  --blue-rgb: 31, 111, 196;
  --blue-ink: #1a5c9f;
  --bar-good-a: #0f9a66;
  --bar-good-b: #31c98d;
  --bar-mid-a: #d08a12;
  --bar-mid-b: #f0a923;
  --bar-poor-a: #c93a33;
  --bar-poor-b: #ec5b51;
  --ring-a: #0a9d6a;
  --ring-b: #2b7fd4;
  --ring-c: #b6720a;
  --ring-d: #d13a32;
  --btn-primary: linear-gradient(160deg, #12b981, #0a9163);
  --btn-primary-ink: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --toast-bg: rgba(255, 255, 255, 0.99);
  --mask-bg: rgba(16, 26, 36, 0.42);
  --sheet-bg: #ffffff;
  --media-bg: #0b1116;
  --hero-grad: linear-gradient(100deg, #0a8f62, #11b27d 62%, #3bc79a);
  --shadow-card: 0 1px 2px rgba(16, 32, 48, 0.04), 0 10px 26px rgba(16, 32, 48, 0.05);
}

/* ---------- 2. 基础 ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body { overflow: hidden; }

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- 3. 顶栏 ---------- */
#topbar {
  height: calc(54px + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: 0.2px; min-width: 0; }
.brand b { font-weight: 650; white-space: nowrap; }
.brand .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--green);
  box-shadow: 0 0 12px rgba(var(--green-rgb), 0.85);
}
.brand .tag {
  font-size: 10.5px; color: var(--green);
  border: 1px solid rgba(var(--green-rgb), 0.38);
  padding: 1px 6px; border-radius: 6px; letter-spacing: 0.1px;
  white-space: nowrap; flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 15px; line-height: 1; display: grid; place-items: center;
  padding: 0; transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.icon-btn:active { background: var(--card-2); }
.icon-btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}
/* 图标表示「点一下切到哪个模式」：黑夜里显示太阳，白天里显示月亮 */
.icon-btn .i-sun { display: none; }
html[data-theme="light"] .icon-btn .i-sun { display: none; }
html[data-theme="light"] .icon-btn .i-moon { display: block; }
html[data-theme="dark"] .icon-btn .i-sun { display: block; }
html[data-theme="dark"] .icon-btn .i-moon { display: none; }

/* ---------- 4. 屏幕容器 ---------- */
.screen {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: block; }
#screen-loading.active { display: flex; flex-direction: column; overflow: hidden; }

/* ---------- 5. 首页 ---------- */
#screen-home { padding: 6px 18px calc(30px + var(--safe-b)); }
.hero { padding: 20px 0 4px; }
.hero h1 {
  font-size: clamp(26px, 7.6vw, 31px); line-height: 1.26; margin: 0 0 12px; font-weight: 700;
  letter-spacing: -0.6px;
}
.hero h1 em {
  font-style: normal;
  background: var(--hero-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.72; max-width: 34em; }

.section-title {
  margin: 24px 0 12px; font-size: 11.5px; color: var(--dim);
  letter-spacing: 1.6px;
}

/* 运动项目分组 */
.sport-group { margin-bottom: 20px; }
.sport-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 0 0 10px; padding-left: 10px; position: relative;
}
.sport-head::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px;
  border-radius: 2px; background: rgba(var(--green-rgb), 0.6);
}
.sport-head b { font-size: 14.5px; font-weight: 650; letter-spacing: 0.4px; }
.sport-head i {
  font-style: normal; font-size: 11.5px; color: var(--dim);
  margin-left: auto; white-space: nowrap;
}

.action-card {
  width: 100%; min-height: 68px;
  display: flex; align-items: center; gap: 13px;
  padding: 14px 15px; margin-bottom: 10px;
  background: var(--card-grad);
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.2s;
}
.action-card:active { transform: scale(0.985); border-color: rgba(var(--green-rgb), 0.55); }
.action-card .ac-icon {
  font-size: 25px; width: 46px; height: 46px; flex: 0 0 46px;
  display: grid; place-items: center; border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  line-height: 1;
}
.action-card .ac-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.action-card .ac-body b { font-size: 15.5px; font-weight: 650; }
.action-card .ac-body i {
  font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.action-card .ac-go {
  font-size: 12.5px; color: var(--green); flex: 0 0 auto; white-space: nowrap;
}
.action-card.disabled { opacity: 0.45; box-shadow: none; }
.action-card.disabled .ac-go { color: var(--dim); }

.ghost-btn {
  width: 100%; min-height: 48px; margin-top: 12px; padding: 13px;
  background: transparent; border: 1px dashed var(--line); border-radius: 14px;
  color: var(--muted); font-size: 13.5px;
}
.ghost-btn:active { background: var(--card-2); }

.demo-link {
  width: 100%; min-height: 56px; margin: 18px 0 0; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: rgba(var(--green-rgb), 0.07);
  border: 1px solid rgba(var(--green-rgb), 0.22); border-radius: 14px;
}
.demo-link:active { background: rgba(var(--green-rgb), 0.12); }
.demo-link .dl-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.demo-link .dl-text b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.demo-link .dl-text i { font-style: normal; font-size: 11.5px; color: var(--green-ink); }
.demo-link .dl-go { font-size: 20px; color: var(--green); line-height: 1; }

.foot-note { margin-top: 22px; font-size: 11.5px; color: var(--dim); line-height: 1.7; text-align: center; }

/* ---------- 6. 拍摄 ---------- */
#screen-capture.active { display: flex; flex-direction: column; overflow: hidden; }

.capture-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; min-height: 54px; flex: 0 0 auto;
  background: var(--bg);
}
.back-btn {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  display: grid; place-items: center; padding: 0;
}
.back-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:active { background: var(--card-2); }
.cap-title {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 14px; font-weight: 550; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cap-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#btnTorch svg { fill: currentColor; stroke: none; }
#btnTorch svg .ray { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn.torch.on {
  color: var(--green);
  border-color: rgba(var(--green-rgb), 0.5);
  background: rgba(var(--green-rgb), 0.14);
  box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.1);
}

.stage-wrap {
  flex: 1 1 auto; min-height: 120px; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); overflow: hidden;
  padding: 6px 12px; margin-block: auto;
}
.stage {
  position: relative; background: #000;
  overflow: hidden; flex: 0 0 auto;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  width: 100%; height: 100%;
}
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage-ui { position: absolute; inset: 0; pointer-events: none; }

.countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 92px; font-weight: 700; color: #fff;
  background: rgba(5, 8, 11, 0.28);
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  z-index: 5;
}
.countdown.pop { animation: cdPop 0.85s ease-out; }
@keyframes cdPop {
  0% { transform: scale(1.5); opacity: 0; }
  25% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.55; }
}

.pill {
  position: absolute; left: 10px; top: 10px;
  padding: 4px 9px; border-radius: 20px;
  background: rgba(8, 12, 16, 0.62); backdrop-filter: blur(6px);
  font-size: 11px; color: #b9c9d6; letter-spacing: 0.2px;
}
.pill.warn { color: var(--orange); }
.pill.ok { color: var(--green); }

.rec-badge {
  position: absolute; right: 10px; top: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(200, 40, 40, 0.88); font-size: 11.5px; color: #fff;
  font-variant-numeric: tabular-nums;
}
.rdot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.15; } }

.ball-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(255, 176, 32, 0.94); color: #221600;
  font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 20px;
  white-space: nowrap;
}

.guide-frame {
  position: absolute; inset: 5% 7%;
  border: 1px dashed rgba(255, 255, 255, 0.2); border-radius: 10px;
}
.guide-frame::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: rgba(255, 255, 255, 0.07);
}

.stage-tip {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  max-width: 88%;
  font-size: 11.5px; color: rgba(235, 244, 250, 0.92); text-align: center;
  background: rgba(8, 12, 16, 0.6); padding: 5px 12px; border-radius: 14px;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s;
}

/* 取景提示：人物大小 / 是否切边（只在不对的时候出现） */
.frame-hint {
  position: absolute; left: 50%; top: 42px; transform: translateX(-50%);
  max-width: 90%;
  font-size: 11.5px; line-height: 1.35; font-weight: 600; text-align: center;
  padding: 5px 11px; border-radius: 12px; white-space: nowrap;
  backdrop-filter: blur(6px);
  transition: opacity 0.25s;
}
.frame-hint.warn { color: #2a1a00; background: rgba(255, 186, 60, 0.95); }
.frame-hint.ok { color: #04140d; background: rgba(60, 214, 155, 0.95); }

/* 拍摄要点：紧凑三行，录制时让位给取景框 */
.cap-guide {
  flex: 0 0 auto; padding: 10px 16px 2px;
  display: grid; gap: 5px;
  background: var(--bg);
}
.cg-title { font-size: 10.5px; letter-spacing: 1.3px; color: var(--dim-2); }
.cg-item {
  display: flex; gap: 7px; align-items: baseline;
  font-size: 11.5px; line-height: 1.45; color: var(--muted);
}
.cg-item::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(var(--green-rgb), 0.75);
  flex: 0 0 auto; transform: translateY(-2px);
}
.cg-item b { color: var(--text-2); font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.cg-item span { color: var(--muted); min-width: 0; }

/* 录制 / 倒计时时只留最关键的一条要点，避免整块消失让画面突然跳一下 */
#screen-capture.live .cap-guide { padding-top: 8px; gap: 0; }
#screen-capture.live .cap-guide .cg-title { display: none; }
#screen-capture.live .cap-guide .cg-item:nth-child(n + 3) { display: none; }

.capture-panel {
  padding: 12px 16px calc(14px + var(--safe-b));
  flex: 0 0 auto; background: var(--bg);
}

.cam-row { display: flex; gap: 8px; margin-bottom: 14px; }
.cam-row.single { justify-content: center; }
.cam-row.single .chip { flex: 0 0 auto; min-width: 148px; }
.chip {
  flex: 1 1 0; min-width: 0; min-height: 40px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 8px; border-radius: 12px; font-size: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:active { background: var(--card-2); }
.chip.on { border-color: rgba(var(--green-rgb), 0.6); color: var(--green); background: rgba(var(--green-rgb), 0.09); }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); flex: 0 0 auto; }
.chip.on .chip-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }

.shutter-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 10px;
}
.shutter {
  width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--line);
  background: transparent; display: grid; place-items: center; padding: 0; flex: 0 0 auto;
  transition: transform 0.12s, border-color 0.2s;
}
.shutter span {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--btn-shutter);
  box-shadow: 0 6px 20px rgba(224, 55, 43, 0.36);
  transition: all 0.18s;
}
.shutter:active { transform: scale(0.94); }
.shutter.rec { border-color: rgba(255, 255, 255, 0.34); }
.shutter.rec span { width: 26px; height: 26px; border-radius: 7px; background: #fff; }
.shutter-side {
  font-size: 11.5px; color: var(--muted); line-height: 1.42; text-align: center;
  overflow-wrap: break-word;
}
.shutter-side i { display: block; font-style: normal; color: var(--dim-2); font-size: 10.5px; margin-top: 1px; }

/* ---------- 7. 分析中 ---------- */
#screen-loading { align-items: center; justify-content: center; }
.loader { text-align: center; padding: 40px; }
.ring {
  width: 64px; height: 64px; margin: 0 auto 22px;
  border-radius: 50%; border: 2px solid rgba(var(--green-rgb), 0.16);
  border-top-color: var(--green); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; font-weight: 550; margin-bottom: 6px; }
.loading-sub { font-size: 11.5px; color: var(--dim); }

/* ---------- 8. 结果 ---------- */
#screen-result { padding: 0 16px calc(30px + var(--safe-b)); }

.res-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 14px 2px 14px;
}
.res-title { font-size: 12.5px; color: var(--muted); min-width: 0; }
.res-title b {
  display: block; font-size: 20px; color: var(--text); margin-top: 3px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.res-meta {
  font-size: 11px; color: var(--dim); text-align: right; line-height: 1.7;
  flex: 0 0 auto; padding-top: 2px;
}

.score-card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card-grad);
  border: 1px solid var(--line); border-radius: 20px; padding: 16px 16px;
  box-shadow: var(--shadow-card);
}
.score-ring { position: relative; width: 104px; height: 104px; flex: 0 0 104px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .ring-bg { stroke: var(--track); }
.score-ring .ring-arc { stroke-linecap: round; }
.score-ring .ring-a { stroke: var(--ring-a); }
.score-ring .ring-b { stroke: var(--ring-b); }
.score-ring .ring-c { stroke: var(--ring-c); }
.score-ring .ring-d { stroke: var(--ring-d); }
.score-ring .num {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-ring .num b { font-size: 33px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-ring .num i { font-style: normal; font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.score-side { flex: 1 1 auto; min-width: 0; }
.grade-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.grade-badge {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 7px;
  background: rgba(var(--green-rgb), 0.14); color: var(--green);
}
.grade-badge.b { background: rgba(var(--blue-rgb), 0.14); color: var(--blue); }
.grade-badge.c { background: rgba(var(--orange-rgb), 0.14); color: var(--orange); }
.grade-badge.d { background: rgba(var(--red-rgb), 0.14); color: var(--red); }
.grade-label { font-size: 15px; font-weight: 650; }
.score-desc { font-size: 12px; color: var(--muted); line-height: 1.62; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 15px; margin-top: 12px;
  box-shadow: var(--shadow-card);
}

/* 比分卡：本次 vs 上次 */
.cmp-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmp-delta { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-delta.up { color: var(--green); }
.cmp-delta.down { color: var(--red); }
.cmp-delta.flat { color: var(--muted); }
.cmp-when { font-size: 11.5px; color: var(--dim); font-weight: 400; margin-left: auto; text-align: right; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.cmp-chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 9px;
  background: var(--track); color: var(--text-2); white-space: nowrap;
}
.cmp-chip b { font-weight: 650; font-variant-numeric: tabular-nums; }
.cmp-chip.up b { color: var(--green); }
.cmp-chip.down b { color: var(--red); }
.cmp-more {
  margin-top: 12px; width: 100%; background: none; border: 0; padding: 4px 0;
  font-size: 12.5px; font-weight: 600; color: var(--green); text-align: left;
}
.dlt { font-weight: 650; font-variant-numeric: tabular-nums; }
.dlt.ok { color: var(--green); }
.dlt.bad { color: var(--red); }

/* 趋势图 */
.trend-wrap { margin: 4px 0 2px; }
.trend-wrap svg { display: block; width: 100%; height: auto; }
.trend-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim-2); margin-top: 2px; }
.trend-sum {
  font-size: 12px; line-height: 1.65; color: var(--text-2);
  background: var(--track); border-radius: 12px; padding: 10px 12px; margin-top: 12px;
}
.trend-sum b { color: var(--text); }
.trend-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 4px; }
.trend-chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px;
  padding: 5px 11px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card); color: var(--text-2);
  font-size: 12px; font-weight: 600;
}
.trend-chip .tc-n { font-variant-numeric: tabular-nums; color: var(--dim); font-weight: 400; }
.trend-chip .tc-d { font-variant-numeric: tabular-nums; }
.trend-chip .tc-d.up { color: var(--green); }
.trend-chip .tc-d.down { color: var(--red); }
.trend-chip .tc-d.flat { color: var(--dim); }
.card-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 13.5px; font-weight: 650; margin-bottom: 13px;
}
.card-title small { font-weight: 400; color: var(--dim); font-size: 11px; text-align: right; }

/* 分项条：名称 + 分数 / 进度条 / 实测值 */
.dim { margin-bottom: 15px; }
.dim:last-child { margin-bottom: 0; }
.dim-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 6px;
}
.dim-name { font-size: 13px; color: var(--text-2); min-width: 0; }
.dim-name em {
  font-style: normal; color: var(--dim-2); font-size: 10.5px; margin-left: 6px;
  font-variant-numeric: tabular-nums;
}
.dim-score {
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); flex: 0 0 auto;
}
.dim-score.good { color: var(--green); }
.dim-score.mid { color: var(--orange); }
.dim-score.poor { color: var(--red); }
.dim-score.skip { color: var(--dim-2); font-weight: 500; }
.dim-meta {
  margin-top: 5px; font-size: 11.5px; color: var(--dim); line-height: 1.5;
}
.bar { height: 6px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar i {
  display: block; height: 100%; border-radius: 4px; width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar.good i { background: linear-gradient(90deg, var(--bar-good-a), var(--bar-good-b)); }
.bar.mid i { background: linear-gradient(90deg, var(--bar-mid-a), var(--bar-mid-b)); }
.bar.poor i { background: linear-gradient(90deg, var(--bar-poor-a), var(--bar-poor-b)); }
.bar.skip i { background: var(--track-3); width: 100% !important; }
.dim.skip { opacity: 0.65; }

/* 时间轴（阶段条） */
.tl-bar { display: flex; height: 12px; gap: 2px; margin: 4px 0 8px; }
.tl-bar i {
  display: block; border-radius: 3px; background: var(--track-2); min-width: 4px;
  transition: flex-grow 0.4s ease;
}
.tl-bar i:nth-child(2) { background: var(--track-3); }
.tl-bar i:last-child { background: var(--track-2); }
.tl-bar i.hot { background: var(--green); box-shadow: 0 0 8px rgba(var(--green-rgb), 0.5); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--muted); }
.tl-legend span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-legend span.hot { color: var(--green); }

/* 关键帧 */
.frames { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.frame { position: relative; border-radius: 10px; overflow: hidden; background: #0d1218; border: 1px solid var(--line); }
.frame img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.frame b {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 10.5px; font-weight: 500; text-align: center; padding: 14px 3px 5px;
  background: linear-gradient(180deg, transparent, rgba(6, 9, 12, 0.92));
  color: #dbe8f3;
}
.frame.hot { border-color: rgba(var(--green-rgb), 0.55); }
.frame.hot b { color: #5fe3b0; }
.frames .frame:last-child:nth-child(odd) { grid-column: span 2; }

/* 回放 */
.replay-wrap { position: relative; border-radius: 14px; overflow: hidden; background: var(--media-bg); }
#replayCanvas { width: 100%; display: block; aspect-ratio: 16 / 9; }
.replay-bar { display: flex; align-items: center; gap: 10px; padding: 10px 2px 0; }
.play-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; flex: 0 0 auto;
  background: var(--green); color: var(--btn-primary-ink); font-size: 12px;
  display: grid; place-items: center;
}
.speed-chip {
  font-size: 11.5px; min-width: 58px; padding: 8px 9px; border-radius: 9px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text-2); flex: 0 0 auto;
}
.scrub { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--track); position: relative; }
.scrub i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); border-radius: 3px; }

/* 诊断卡 */
.issue {
  border-radius: 14px; padding: 13px 14px; margin-bottom: 10px;
  background: rgba(var(--orange-rgb), 0.07);
  border: 1px solid rgba(var(--orange-rgb), 0.22);
}
.issue.sev-1 { background: rgba(var(--red-rgb), 0.07); border-color: rgba(var(--red-rgb), 0.24); }
.issue-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.issue-h b { font-size: 13.5px; font-weight: 650; }
.issue-h span { font-size: 10.5px; color: var(--orange); white-space: nowrap; flex: 0 0 auto; }
.issue.sev-1 .issue-h span { color: var(--red); }
.issue p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.68; }
.drill {
  margin-top: 9px; padding: 9px 11px; border-radius: 10px;
  background: rgba(var(--blue-rgb), 0.07); border-left: 2px solid rgba(var(--blue-rgb), 0.5);
  font-size: 12px; color: var(--blue-ink); line-height: 1.62;
}
.drill b { color: var(--blue); font-weight: 600; }

.good-list { display: flex; flex-wrap: wrap; gap: 6px; }
.good-list span {
  font-size: 11.5px; padding: 5px 10px; border-radius: 8px;
  background: rgba(var(--green-rgb), 0.1); color: var(--green-ink);
  border: 1px solid rgba(var(--green-rgb), 0.2);
}

/* 信息网格 */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 10px; }
.kv span { display: block; font-size: 11px; color: var(--dim); margin-bottom: 3px; }
.kv b { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.notice {
  font-size: 12px; color: var(--orange-ink); line-height: 1.65;
  background: rgba(var(--orange-rgb), 0.07); border: 1px solid rgba(var(--orange-rgb), 0.2);
  border-radius: 12px; padding: 10px 12px; margin-top: 12px;
}
.notice-conf { color: var(--text-2); }
.notice-conf.low {
  color: var(--red);
  background: rgba(var(--red-rgb), 0.07);
  border-color: rgba(var(--red-rgb), 0.22);
}

/* 可信度徽章：贴在等级旁边，只说明这一次的样本够不够用 */
.conf {
  font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: 7px;
  border: 1px solid transparent; white-space: nowrap;
}
.conf.high { color: var(--green); background: rgba(var(--green-rgb), 0.1); border-color: rgba(var(--green-rgb), 0.22); }
.conf.mid { color: var(--orange); background: rgba(var(--orange-rgb), 0.1); border-color: rgba(var(--orange-rgb), 0.24); }
.conf.low { color: var(--red); background: rgba(var(--red-rgb), 0.1); border-color: rgba(var(--red-rgb), 0.26); }

/* 下一次的目标 */
.goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.goal-count {
  font-size: 15px; font-weight: 700; color: var(--orange); font-variant-numeric: tabular-nums;
}
.goal-count.ok { color: var(--green); }
.goal-total { font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.goal-list { display: flex; flex-direction: column; gap: 9px; }
.goal-row {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
}
.goal-row .goal-name { flex: 1 1 auto; min-width: 0; }
.goal-row .goal-arrow { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal-row .goal-arrow b { color: var(--text); font-weight: 700; }
.goal-row .goal-mark { color: var(--dim-2); width: 12px; flex: 0 0 auto; font-weight: 700; }
.goal-row.ok .goal-mark { color: var(--green); }
.goal-row.ok .goal-arrow { color: var(--green); }
.goal-row .goal-tgt {
  font-size: 10.5px; color: var(--dim-2); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 7px; padding: 1px 6px;
}
.goal-note { margin: 11px 0 0; font-size: 11.5px; color: var(--dim); line-height: 1.6; }
.goal-btn { width: 100%; margin-top: 12px; }
.goal-inline {
  font-size: 11.5px; color: var(--muted); line-height: 1.6;
  border-left: 2px solid var(--orange); padding: 2px 0 2px 9px; margin-top: 11px;
}
.goal-inline b { color: var(--text-2); }

/* 趋势图面积：暗色下要能看见 */
.trend-area { fill: var(--green); opacity: 0.18; }
html[data-theme="dark"] .trend-area { opacity: 0.26; }

/* 失败兜底页 */
.fail-why {
  background: rgba(var(--red-rgb), 0.07); border: 1px solid rgba(var(--red-rgb), 0.2);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 12px;
}
.fail-why b { font-size: 11px; letter-spacing: 0.6px; color: var(--red); }
.fail-why p { margin: 5px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.fail-stat { margin-bottom: 14px; }

/* 骨架叠影 */
.pose-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 11.5px; color: var(--muted); margin-bottom: 8px;
}
.pl { display: inline-flex; align-items: center; gap: 5px; }
.pl i { display: block; width: 14px; height: 3px; border-radius: 2px; }
.pl-a i { background: var(--green); }
.pl-b i { background: #9eafbe; }
.pl-d { margin-left: auto; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.posegrid { display: flex; flex-direction: column; gap: 11px; }
.posecell { background: var(--track); border-radius: 13px; padding: 7px; }
.pose-cv {
  display: block; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 9px; background: #0b1116;
}
.posecell-cap {
  display: flex; align-items: baseline; gap: 8px; justify-content: space-between;
  padding: 6px 4px 1px; font-size: 11.5px; color: var(--dim);
}
.posecell-cap b { font-size: 12px; font-weight: 650; color: var(--text-2); }
.pose-open { width: 100%; margin-top: 6px; margin-bottom: 10px; }

.empty-line { margin: 0 0 4px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }

/* 结果按钮 */
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.primary-btn {
  flex: 1 1 auto; min-height: 50px; padding: 14px; border-radius: 14px; border: none;
  font-size: 14.5px; font-weight: 650; color: var(--btn-primary-ink);
  background: var(--btn-primary);
}
.primary-btn:active { filter: brightness(0.95); }
.ghost-btn-2 {
  flex: 0 0 auto; min-height: 50px; padding: 14px 18px; border-radius: 14px;
  font-size: 14px; background: transparent; border: 1px solid var(--line); color: var(--text-2);
}
.ghost-btn-2:active { background: var(--card-2); }

/* 历史备份：导出 / 导入并排 */
/* 历史记录按项目筛选（记录跨项目时才出现） */
.hist-filter {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 0 12px; padding: 2px 0;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.hist-filter::-webkit-scrollbar { display: none; }
.hf-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  height: 34px; padding: 0 13px; border-radius: 17px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text-2); font-size: 12.5px; font-weight: 600;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.hf-chip em {
  font-style: normal; font-weight: 400; font-size: 11px;
  color: var(--dim); font-variant-numeric: tabular-nums;
}
.hf-chip.on {
  background: rgba(var(--green-rgb), 0.14);
  border-color: rgba(var(--green-rgb), 0.55);
  color: var(--green);
}
.hf-chip.on em { color: var(--green); opacity: 0.78; }

.hist-tools { display: flex; gap: 10px; margin-top: 14px; }
.hist-tools .ghost-btn-2 { flex: 1 1 0; min-height: 46px; padding: 12px 10px; font-size: 13px; }

.result-foot {
  text-align: center; font-size: 11px; color: var(--dim-2);
  margin-top: 14px; line-height: 1.6;
}

/* ---------- 9. 历史 ---------- */
.hist-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 14px; margin-bottom: 9px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  text-align: left;
}
.hist-item:active { background: var(--card-2); }
.hist-score {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px;
  display: grid; place-items: center; font-size: 16px; font-weight: 700;
  background: rgba(var(--green-rgb), 0.12); color: var(--green);
  font-variant-numeric: tabular-nums;
}
.hist-score.hs-b { background: rgba(var(--blue-rgb), 0.14); color: var(--blue); }
.hist-score.hs-c { background: rgba(var(--orange-rgb), 0.16); color: var(--orange); }
.hist-score.hs-d { background: rgba(var(--red-rgb), 0.14); color: var(--red); }
.hist-item .ac-go { color: var(--muted); font-size: 17px; line-height: 1; flex: 0 0 auto; }
.hist-body { flex: 1 1 auto; min-width: 0; }
.hist-body b {
  display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-body i { font-style: normal; font-size: 11px; color: var(--dim); }
.hist-sport {
  display: inline-block; font-style: normal; font-size: 10px; font-weight: 500;
  padding: 1px 5px; margin-right: 5px; border-radius: 5px;
  color: var(--green); background: rgba(var(--green-rgb), 0.14);
  vertical-align: 1px;
}
.hist-empty { text-align: center; color: var(--dim); font-size: 13px; padding: 50px 20px; line-height: 1.8; }

/* ---------- 10. Toast / 浮层 / 错误 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  background: var(--toast-bg); border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px; padding: 10px 16px; border-radius: 12px;
  max-width: 84vw; text-align: center; z-index: 90;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: toastIn 0.22s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

#fatal {
  position: fixed; left: 0; right: 0; top: 0; z-index: 999;
  background: #7a1b1b; color: #fff; font-size: 12px; line-height: 1.5;
  padding: 10px 14px; display: none; word-break: break-all;
}

.sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.sheet-mask { position: absolute; inset: 0; background: var(--mask-bg); backdrop-filter: blur(2px); }
.sheet-body {
  position: relative; width: 100%; max-height: 86dvh; overflow-y: auto;
  background: var(--sheet-bg); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(24px + var(--safe-b));
  border-top: 1px solid var(--line);
  animation: sheetUp 0.26s cubic-bezier(0.2, 0.9, 0.2, 1);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.4; } }
.sheet-bar { width: 38px; height: 4px; border-radius: 2px; background: var(--track-2); margin: 4px auto 16px; }
.sheet-body h3 { font-size: 15.5px; margin: 22px 0 10px; font-weight: 650; }
.sheet-body > h3:first-child { font-size: 17.5px; margin: 6px 0 6px; }
.sheet-body h3 + h3 { margin-top: 22px; }
.sheet-body h3 small { font-weight: 400; font-size: 12px; color: var(--dim); }
.howto { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.85; }
.howto b { color: var(--text-2); font-weight: 600; }
.howto li { margin-bottom: 6px; }
.howto-p { color: var(--muted); font-size: 12.5px; line-height: 1.78; margin: 0 0 4px; }
.sheet-body > .howto-p:first-of-type { margin-bottom: 2px; }
.sheet-body .primary-btn { margin-top: 20px; width: 100%; flex: none; }

/* 历史详情里的删除：两步确认，平时只是一行小字 */
.detail-del {
  display: block; width: 100%; margin-top: 9px; padding: 11px 10px;
  border: 0; border-radius: 12px; background: none;
  color: rgba(var(--red-rgb), 1); font-size: 12.5px; font-weight: 600;
  transition: background 0.18s, color 0.18s;
}
.detail-del.armed { background: rgba(var(--red-rgb), 0.13); }
.detail-del:disabled { opacity: 0.6; }

.detail-sub { font-size: 11.5px; color: var(--dim); margin: -6px 0 14px; line-height: 1.6; }
.detail-thumb { width: 100%; border-radius: 12px; margin-bottom: 14px; display: block; }
.detail-issues { margin-top: 14px; }

/* ---------- 11. 适配 ---------- */
@media (min-width: 560px) {
  #app { max-width: 520px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* 矮屏（小手机）：压缩拍摄要点与面板，保证取景框不被挤没 */
@media (max-height: 700px) {
  .cg-item { font-size: 11px; line-height: 1.35; }
  .cap-guide { gap: 3px; padding-top: 8px; }
  .cap-guide .cg-item:nth-child(4) { display: none; }
  .shutter { width: 66px; height: 66px; }
  .shutter span { width: 52px; height: 52px; }
  .shutter.rec span { width: 24px; height: 24px; }
  .cam-row { margin-bottom: 10px; }
}

/* 横屏拍摄：取景框占左边，控制在右边一列 */
@media (orientation: landscape) and (max-height: 560px) {
  #app { max-width: none; border-left: 0; border-right: 0; }
  #screen-capture.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .capture-head { grid-column: 1 / -1; min-height: 46px; }
  .stage-wrap { grid-column: 1; grid-row: 2; padding: 8px 10px; }
  .cap-guide { display: none; }
  .capture-panel {
    grid-column: 2; grid-row: 2;
    display: flex; flex-direction: column; justify-content: center; gap: 18px;
    padding: 8px 16px calc(10px + var(--safe-b));
  }
  .cam-row { flex-direction: column; margin-bottom: 0; }
  .cam-row .chip { min-height: 42px; font-size: 12.5px; }
  .cam-row.single .chip { min-width: 0; }
  .shutter-row { grid-template-columns: 1fr; gap: 10px; justify-items: center; }
  .shutter-side { display: block; width: 100%; font-size: 11px; }
  .shutter { width: 66px; height: 66px; }
  .shutter span { width: 52px; height: 52px; }
  .shutter.rec span { width: 22px; height: 22px; }
}

/* ---------- PWA：装到桌面提示 / 新版本提示 ---------- */
.install-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
}

.install-hint .ih-ico {
  font-size: 16px;
  line-height: 1.3;
  flex: none;
  opacity: 0.9;
}

.install-hint .ih-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.install-hint .ih-body b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.install-hint .ih-body i {
  font-size: 11.5px;
  font-style: normal;
  color: var(--dim);
  line-height: 1.6;
}

.install-hint .ih-x {
  flex: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--dim-2);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}

.sw-toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  animation: swIn 0.22s ease-out;
}

@keyframes swIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sw-toast .sw-txt {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}

.sw-toast #swGo {
  flex: none;
  border: 0;
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: #04231a;
  background: var(--btn-primary);
  cursor: pointer;
}

.sw-toast .sw-x {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 17px;
  line-height: 1;
  padding: 2px 2px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .sw-toast { animation: none; }
}
