/* ==================== 悦馨产后瑜伽 · AI私教 ==================== */
:root {
  --bg: #f6f5fb;
  --card: #ffffff;
  --ink: #2b2a35;
  --muted: #8a8898;
  --brand: #7c6ce8;
  --brand-soft: #eeecfc;
  --coral: #f2857d;
  --coral-soft: #fdefed;
  --ok: #3fae7a;
  --warn: #e5484d;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(80, 70, 140, 0.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
h1 { font-size: 24px; margin: 10px 0 6px; }
h2 { font-size: 20px; margin: 6px 0; }
h3 { font-size: 17px; margin: 0 0 8px; }
p { margin: 6px 0; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.disclaim { color: #b0aec0; font-size: 12px; margin: 18px 4px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { display: none; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.screen.active { display: block; }
.wrap { padding: 20px 16px 8px; }
.wrap.center { text-align: center; padding-top: 8vh; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.row-gap { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.q { font-weight: 600; display: block; margin-bottom: 10px; }
.q.no-m { margin-bottom: 0; }

input[type="number"], input[type="text"] {
  border: 1.5px solid #e6e4f2;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 16px;
  width: 100%;
  min-width: 0;
  background: #fbfaff;
  color: var(--ink);
}
input:focus { outline: none; border-color: var(--brand); }
.unit { color: var(--muted); font-size: 14px; flex: none; }

.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opts label { flex: 1 1 30%; }
.opts input { display: none; }
.opts span {
  display: block; text-align: center; padding: 10px 6px;
  border: 1.5px solid #e6e4f2; border-radius: 12px;
  font-size: 14px; color: var(--muted); background: #fbfaff;
}
.opts input:checked + span {
  border-color: var(--brand); color: var(--brand);
  background: var(--brand-soft); font-weight: 600;
}
.details { margin-top: 10px; font-size: 13px; color: var(--muted); }
.details summary { cursor: pointer; font-weight: 500; }
.details p { background: #f7f6fd; border-radius: 10px; padding: 10px; }

.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: none; }
.switch input { display: none; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: #ddd9ec; transition: background 0.2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(22px); }

.btn {
  border: none; border-radius: 14px; padding: 12px 20px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.08s, opacity 0.15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(124,108,232,0.35); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.big { width: 100%; padding: 15px; font-size: 17px; margin-top: 8px; }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 9px; background: rgba(255,255,255,0.25); color: #fff; }
.btn.danger-text { color: var(--warn); background: #fdecec; }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.sec-title { font-size: 16px; margin: 20px 4px 2px; }

/* ---------- 问卷 ---------- */
.ob-head { text-align: center; padding: 18px 0 4px; }
.ob-emoji { font-size: 44px; }

/* ---------- 首页 ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; }
.hero h1 { margin: 0; }
.hero-emoji { font-size: 42px; }

.gate { background: #fff4f4; border: 1.5px solid #f6c9c9; }
.gate h3 { color: var(--warn); }
.gate ul { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: #8c5a5a; }
.gate li { margin: 4px 0; }

.stats-row { display: flex; gap: 10px; margin: 12px 0; }
.stat {
  flex: 1; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: center; padding: 12px 4px;
}
.stat b { display: block; font-size: 22px; color: var(--brand); }
.stat span { font-size: 12px; color: var(--muted); }

.rec { background: linear-gradient(135deg, #8677ec, #b48bea); color: #fff; }
.rec .rec-tag { font-size: 12px; opacity: 0.9; margin: 0; }
.rec h2 { font-size: 22px; margin: 4px 0; }
.rec .sub { color: rgba(255,255,255,0.85); }
.rec .btn.primary { background: #fff; color: var(--brand); box-shadow: none; }
.rec .btn.ghost { background: rgba(255,255,255,0.2); color: #fff; }

.course-card { display: block; width: 100%; text-align: left; border: none; font-family: inherit; cursor: pointer;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 16px; margin: 10px 0;
}
.course-card:active { transform: scale(0.98); }
.course-card h4 { margin: 0; font-size: 16.5px; display: flex; justify-content: space-between; align-items: center; }
.course-card .cc-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); margin-right: 6px; }
.cc-arrow { color: var(--muted); font-size: 18px; }

/* ---------- 课程详情 ---------- */
.ex-item { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin: 10px 0; }
.ex-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.ex-body h4 { margin: 0 0 4px; font-size: 15.5px; }
.ex-body p { font-size: 13px; color: var(--muted); margin: 2px 0; }
.pos-chip { display: inline-block; font-size: 11.5px; background: var(--coral-soft); color: #c96a62;
  padding: 2px 9px; border-radius: 999px; margin: 4px 0; }
.safety h3 { color: var(--brand); }
.safety ul { margin: 6px 0; padding-left: 18px; font-size: 13.5px; color: #6b6879; }
.safety li { margin: 5px 0; }

/* ---------- 训练页 ---------- */
.screen.workout { padding-bottom: 0; display: none; }
.screen.workout.active { display: flex; flex-direction: column; height: 100dvh; }
.cam-area { position: relative; flex: 1; overflow: hidden; background: #16141f; }
#cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); /* 前置镜像 */ }
#cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%;
  transform: scaleX(-1); }

.follow-visual { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #3b3358, #16141f 75%); }
.breath-ball { width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b7a9ff, #7c6ce8);
  box-shadow: 0 0 60px rgba(124,108,232,0.55); transform: scale(0.8);
  transition: transform 4s ease-in-out; }

.cam-status { position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.55); color: #fff; font-size: 13px; padding: 7px 14px;
  border-radius: 999px; max-width: 88%; text-align: center; z-index: 5; }
.cam-status:empty { display: none; }

.warn-banner { position: absolute; left: 12px; right: 12px; top: 54px; z-index: 6;
  background: rgba(229,72,77,0.94); color: #fff; font-weight: 600; font-size: 14.5px;
  border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 4;
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hud-left { flex: 1; margin-right: 12px; }
.hud-name { color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.hud-prog { height: 5px; border-radius: 999px; background: rgba(255,255,255,0.25); margin-top: 7px; overflow: hidden; }
#hud-prog-fill { height: 100%; width: 0%; border-radius: 999px; background: #cfc4ff; transition: width 0.3s; }
.hud-count { color: #fff; font-size: 26px; font-weight: 800; text-shadow: 0 1px 6px rgba(0,0,0,0.5); flex: none; }

.hud-bottom { position: absolute; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 9px; pointer-events: none; }
.phase-chip { background: rgba(255,255,255,0.95); color: var(--brand); font-weight: 800;
  font-size: 19px; padding: 10px 24px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.feedback { color: #fff; font-size: 17px; font-weight: 600; text-align: center;
  text-shadow: 0 1px 5px rgba(0,0,0,0.75), 0 0 12px rgba(0,0,0,0.5); max-width: 94%; line-height: 1.4; }

.follow-banner { position: absolute; left: 12px; right: 12px; bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 5; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(0,0,0,0.5); color: rgba(255,255,255,0.9); font-size: 12.5px;
  border-radius: 12px; padding: 8px 10px; }

.workout-controls { display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: 0 -6px 20px rgba(80,70,140,0.1); }
.wbtn { flex: 1; border: none; background: var(--brand-soft); color: var(--brand);
  border-radius: 13px; padding: 8px 2px; font-size: 18px; line-height: 1.15;
  display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; font-family: inherit; }
.wbtn:active { transform: scale(0.94); }
.wbtn i { font-style: normal; font-size: 11px; }
.wbtn.hi { background: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(124,108,232,0.4); }
.wbtn.danger { background: #fdecec; color: var(--warn); }

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(22,20,31,0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(3px); }
.overlay.hidden, .hidden { display: none !important; }
.ov-card { background: #fff; border-radius: 22px; padding: 24px 22px; max-width: 420px; width: 100%;
  text-align: center; animation: pop 0.25s; max-height: 88dvh; overflow-y: auto; }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ov-tag { color: var(--brand); font-weight: 700; font-size: 13px; margin: 0; }
.ov-card h2 { margin: 6px 0; }
.ov-card p { font-size: 15.5px; color: #4c4a58; }
.ov-card ul { text-align: left; color: var(--muted); font-size: 13px; margin: 8px 0; padding-left: 20px; }
.ov-card li { margin: 3px 0; }
.ov-count { font-size: 46px; font-weight: 800; color: var(--brand); margin: 6px 0 4px; }

/* 示范动画 v3（精细卡通插画） */
.demo-box { display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, #f8f6ff, #efeafc);
  border-radius: 16px; padding: 12px 10px 10px; margin: 10px 0 6px; }
.demo-box svg { width: 100%; max-width: 300px; height: auto; }
.demo-box.empty-demo { display: none; }
.demo-box .dm-video { width: 100%; max-width: 300px; border-radius: 12px; }

.demo-box .dm-bg { fill: #ffffff; opacity: 0.55; transform-box: fill-box;
  transform-origin: center; animation: dmBreath 6s ease-in-out infinite; }
@keyframes dmBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.demo-box .dm-spark { fill: #f2a154; opacity: 0.35; animation: dmTwinkle 2.4s ease-in-out infinite; }
.demo-box .dm-spark.s2 { animation-delay: 1.2s; }
@keyframes dmTwinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.9; } }
.demo-box .dm-shadow { fill: var(--brand); opacity: 0.10; }
.demo-box .dm-mat { fill: #c9c0f4; }
.demo-box .dm-matend { fill: #b3a7ee; }
.demo-box .dm-arrow { stroke: #f2a154; stroke-width: 4.5; stroke-linecap: round;
  stroke-linejoin: round; fill: #f2a154; animation: dmPulse 1.6s ease-in-out infinite; }
@keyframes dmPulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.demo-box .dm-fig line, .demo-box .dm-fig polyline { stroke-linecap: round; stroke-linejoin: round; }
.demo-box .dm-torsoP { fill: var(--coral); stroke: #e06f66; stroke-width: 1.5; }
.demo-box .dm-shorts { fill: #4a3db0; }
.demo-box .dm-thighO { stroke: #3f3399; stroke-width: 16; }
.demo-box .dm-thighM { stroke: #6c5ce7; stroke-width: 12; }
.demo-box .dm-shinO { stroke: #3f3399; stroke-width: 14; }
.demo-box .dm-shinM { stroke: #6c5ce7; stroke-width: 10; }
.demo-box .dm-footO { stroke: #d19a6f; stroke-width: 10; }
.demo-box .dm-footM { stroke: #f4c39a; stroke-width: 7; }
.demo-box .dm-armUO { stroke: #e06f66; stroke-width: 12.5; }
.demo-box .dm-armUM { stroke: var(--coral); stroke-width: 9.5; }
.demo-box .dm-armLO { stroke: #d19a6f; stroke-width: 10.5; }
.demo-box .dm-armLM { stroke: #f4c39a; stroke-width: 7.5; }
.demo-box .dm-hand { fill: #f4c39a; }
.demo-box .dm-hairC { fill: #6b4a3a; }
.demo-box .dm-faceC { fill: #f4c39a; }
.demo-box .dm-blush { fill: #f0a08c; opacity: 0.75; }
.demo-box .dm-bun { fill: #5d3f31; }
.demo-box .dm-bunH { fill: #8a5f45; }
.demo-box .dm-farArm, .demo-box .dm-farLeg { stroke: #b9aef2; stroke-width: 9;
  stroke-linecap: round; stroke-linejoin: round; fill: none; opacity: 0.5; }

.dm-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.dm-dots i { width: 8px; height: 8px; border-radius: 999px; background: #d9d4f2; transition: all .25s; }
.dm-dots i.on { background: var(--brand); width: 20px; }
.dm-caption { font-size: 15px; font-weight: 700; color: #4c4a58; margin-top: 5px;
  text-align: center; min-height: 22px; line-height: 1.35; }

/* 编号步骤 */
.steps { list-style: none; margin: 8px 0 12px; padding: 0; text-align: left; }
.steps li { display: flex; gap: 10px; align-items: flex-start; margin: 9px 0; }
.steps .n { flex: none; width: 23px; height: 23px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand); font-weight: 800; font-size: 13px; display: flex; align-items: center;
  justify-content: center; margin-top: 2px; }
.steps li span:last-child { font-size: 15.5px; color: #3c3a48; line-height: 1.45; }

/* ---------- 结算 ---------- */
.sum-emoji { font-size: 62px; }
#sum-stats { margin-top: 18px; }
#sum-note { max-width: 320px; margin: 14px auto 6px; }
.center-gap { justify-content: center; }

/* ---------- 记录 ---------- */
.hist-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px; margin: 10px 0; display: flex; justify-content: space-between; align-items: center; }
.hist-item h4 { margin: 0; font-size: 15px; }
.hist-item .hi-date { font-size: 12px; color: var(--muted); }
.hist-item .hi-nums { font-size: 12.5px; color: var(--brand); font-weight: 600; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 设置 ---------- */
.profile-line { font-size: 14px; color: #4c4a58; }
.about p { font-size: 13.5px; }

/* ---------- 底部导航 ---------- */
#tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; display: flex; z-index: 10;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(8px);
  border-top: 1px solid #eceaf6; padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; border: none; background: none; padding: 8px 0 7px; font-size: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 0; color: var(--muted); cursor: pointer; }
.tab i { font-style: normal; font-size: 11px; }
.tab.active { color: var(--brand); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%);
  background: rgba(30,28,40,0.92); color: #fff; font-size: 14px; padding: 11px 18px;
  border-radius: 999px; z-index: 50; max-width: 86%; text-align: center;
  animation: toastIn 0.25s; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
