/* ===========================================================
   国民体质测试数据系统 · 设计系统
   浙江好时文化传媒
   苹果风极简美学 + 好时品牌调性
   =========================================================== */

:root {
  /* 品牌色（取自好时 logo） */
  --brand:        #B01F24;
  --brand-deep:   #8E171B;
  --brand-light:  #F0C48A;   /* logo 米金 */
  --brand-tint:   #FBEDEE;

  /* 中性（Apple 灰阶） */
  --bg:           #F5F5F7;
  --surface:      #FFFFFF;
  --surface-2:    #FAFAFC;
  --text:         #1D1D1F;
  --text-2:       #6E6E73;
  --text-3:       #A1A1A6;
  --line:         #E5E5EA;
  --line-soft:    #F0F0F3;

  /* 语义色 */
  --ok:           #34C759;
  --warn:         #FF9F0A;
  --danger:       #FF3B30;
  --info:         #0071E3;

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* 阴影（克制、柔和） */
  --sh-1: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --sh-2: 0 2px 6px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.07);
  --sh-3: 0 8px 24px rgba(176,31,36,.10), 0 24px 60px rgba(0,0,0,.10);

  /* 尺寸 */
  --pad: 22px;
  --maxw: 560px;
  --nav-h: 60px;

  /* 动效 */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --t-fast: .18s;
  --t: .28s;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
          "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Pro Display", "SF Pro Text", -apple-system, "Inter", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: .01em;
}

body { min-height: 100dvh; }

/* ---------- 导航（毛玻璃） ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: .5px solid rgba(0,0,0,.07);
}
.nav .logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.nav .brand-name { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.nav .brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }
.nav .spacer { flex: 1; }
.nav .back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--brand); font-size: 15px; font-weight: 500;
  text-decoration: none; padding: 6px 2px;
}
.nav .back:active { opacity: .5; }

/* ---------- 布局 ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 120px; }
.wrap-wide { max-width: 1100px; }

.hero { text-align: center; padding: 44px 0 26px; animation: rise .6s var(--ease-out) both; }
.hero .emblem { width: 78px; height: 78px; border-radius: 20px; box-shadow: var(--sh-2); margin-bottom: 20px; }
.hero h1 { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; line-height: 1.25; }
.hero .sub { font-size: 15px; color: var(--text-2); margin: 0; }
.hero .badge {
  display: inline-block; margin-top: 14px; padding: 5px 13px;
  font-size: 12.5px; font-weight: 500; color: var(--brand);
  background: var(--brand-tint); border-radius: var(--r-pill);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); padding: var(--pad);
  margin-bottom: 16px;
  animation: rise .5s var(--ease-out) both;
}
.card-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }
.card-desc { font-size: 13.5px; color: var(--text-2); margin: 0 0 18px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 17px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: 13.5px; font-weight: 550; color: var(--text-2); margin-bottom: 8px; letter-spacing: .01em; }
.field .req { color: var(--brand); margin-left: 3px; }
.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--line-soft);
  border-radius: var(--r-md); padding: 14px 16px; outline: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  background: var(--surface); border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(176,31,36,.09);
}
.input[readonly] { color: var(--text-2); background: #F2F2F5; }
.input.err { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255,59,48,.08); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.hint.err { color: var(--danger); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23A1A1A6' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 42px;
}

/* 性别分段控件 */
.seg { display: flex; gap: 10px; }
.seg input { display: none; }
.seg label {
  flex: 1; text-align: center; padding: 13px 0; font-size: 15px; font-weight: 500;
  border-radius: var(--r-md); border: 1.5px solid var(--line-soft);
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.seg input:checked + label {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(176,31,36,.22);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px 22px; font-family: inherit; font-size: 16.5px; font-weight: 600;
  letter-spacing: .02em; border: none; border-radius: var(--r-md); cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background var(--t-fast) var(--ease), opacity var(--t-fast);
  text-decoration: none;
}
.btn-primary { background: linear-gradient(180deg, #C0242A, var(--brand)); color: #fff; box-shadow: 0 8px 22px rgba(176,31,36,.26); }
.btn-primary:active { transform: scale(.975); box-shadow: 0 4px 12px rgba(176,31,36,.22); }
.btn-primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--line); }
.btn-ghost:active { transform: scale(.975); background: var(--line-soft); }
.btn-soft { background: var(--brand-tint); color: var(--brand); }
.btn-soft:active { transform: scale(.975); }
.btn-sm { width: auto; padding: 10px 16px; font-size: 14px; border-radius: var(--r-sm); }
.btn-row { display: flex; gap: 12px; }

/* ---------- 项目卡 ---------- */
.item-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 0; border-bottom: .5px solid var(--line-soft);
  animation: rise .45s var(--ease-out) both;
}
.item-row:last-child { border-bottom: none; }
.item-row .ic {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-size: 17px;
  background: var(--brand-tint); color: var(--brand);
}
.item-row .nm { flex: 1; min-width: 0; }
.item-row .nm b { display: block; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.item-row .nm span { font-size: 12.5px; color: var(--text-3); }
.item-row .val { text-align: right; }
.item-row .val .num { font-family: var(--font-num); font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.item-row .val .un { font-size: 12px; color: var(--text-3); margin-left: 3px; }
.item-row .input { width: 128px; text-align: right; padding: 11px 14px; font-family: var(--font-num); }

/* 状态点 */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.todo { background: var(--line); }

/* ---------- 进度环 ---------- */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring .bg { stroke: var(--line-soft); }
.ring .fg { stroke: var(--brand); transition: stroke-dashoffset .8s var(--ease-out); }

/* ---------- 提示条 ---------- */
.alert {
  display: flex; gap: 11px; padding: 14px 16px; border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.55; margin-bottom: 16px;
  animation: rise .4s var(--ease-out) both;
}
.alert .ai { flex: none; font-size: 16px; line-height: 1.3; }
.alert-info { background: #EEF5FF; color: #0A4A8F; }
.alert-warn { background: #FFF6E5; color: #8A5200; }
.alert-danger { background: #FFEEED; color: #A31A12; }
.alert-ok { background: #EBFAF0; color: #1B7A39; }
.alert-brand { background: var(--brand-tint); color: var(--brand-deep); }

/* ---------- 页面标题 ---------- */
.page-head { margin: 6px 0 20px; animation: rise .5s var(--ease-out) both; }
.page-head h2 { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 5px; }
.page-head p { font-size: 14px; color: var(--text-2); margin: 0; }

/* ---------- 表格（后台） ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line-soft); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px;
  padding: 12px 14px; background: var(--surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--line-soft); position: sticky; top: 0;
}
table.tbl td { padding: 12px 14px; border-bottom: .5px solid var(--line-soft); white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background var(--t-fast); }
table.tbl tbody tr:hover { background: var(--surface-2); }
.tag { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 550; }
.tag-ok { background: #EBFAF0; color: #1B7A39; }
.tag-warn { background: #FFF6E5; color: #8A5200; }
.tag-gray { background: var(--line-soft); color: var(--text-2); }
.tag-brand { background: var(--brand-tint); color: var(--brand); }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border-radius: var(--r-md); padding: 18px; box-shadow: var(--sh-1); }
.stat .k { font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.stat .v { font-family: var(--font-num); font-size: 28px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 3px; }

/* ---------- 台阶测试：俯视踏台示意 ---------- */
.stairs-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, #FFF9F0 0%, #FDF0E4 100%);
  margin-bottom: 18px; border: 1px solid #F3E3D2;
  padding: 12px 14px 0; display: flex; flex-direction: column;
}
.stage-top { display: flex; align-items: center; justify-content: center; gap: 10px; height: 42px; }
.stage-timer {
  font-family: var(--font-num); font-size: 34px; font-weight: 700; line-height: 1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand);
}
.stage-timer small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
/* 当前节拍动作提示 */
.stage-action {
  font-size: 13px; font-weight: 650; color: var(--brand-deep); white-space: nowrap;
  background: #FBEDE0; border: 1px solid #F0DCC6; border-radius: 999px; padding: 4px 12px;
  transition: background .15s ease-out, color .15s ease-out, border-color .15s ease-out;
}
.stage-action.moving { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 俯视示意图（台阶在上，地面在下） */
.field-svg { display: block; width: 100%; height: auto; aspect-ratio: 360 / 280; }
.field-svg .zone-label {
  font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: .16em;
  fill: #BE9B74;
}
.field-svg .edge-line { stroke: #D8B183; stroke-width: 3; stroke-dasharray: 7 6; opacity: .8; }
/* 脚印：默认是浅色轮廓（可能的位置）；点亮=此刻脚踩在这里 */
.field-svg .foot-base {
  fill: #FBF1E3; stroke: #C9A87F; stroke-width: 1.6;
  transition: fill .15s ease-out, stroke .15s ease-out;
}
.field-svg .foot-tag {
  font-family: var(--font); font-size: 11px; font-weight: 800; fill: #8A6540;
  pointer-events: none; transition: fill .15s ease-out;
}
.field-svg .foot-glow { fill: none; stroke: #B01F24; stroke-width: 0; opacity: 0; }
.field-svg .foot.on .foot-base {
  fill: #B01F24; stroke: #8E171B;
  filter: drop-shadow(0 2px 5px rgba(176,31,36,.35));
}
.field-svg .foot.on .foot-tag { fill: #FFFFFF; }
/* 落脚瞬间：外圈描边快速收缩，形成"踩下"的反馈 */
.field-svg .foot.on .foot-glow { animation: footLand .45s ease-out both; }
@keyframes footLand {
  0%   { stroke-width: 9; opacity: .5; }
  100% { stroke-width: 1; opacity: 0; }
}

/* 节拍条：1上 2上 3下 4下 */
.beat-seq { display: flex; justify-content: center; gap: 7px; padding: 8px 0 14px; }
.beat-seq span {
  display: flex; align-items: baseline; gap: 3px; padding: 4px 10px; border-radius: 999px;
  background: #F6E7D5; border: 1px solid #EEDCC6;
  transition: background .12s ease-out, border-color .12s ease-out, transform .12s ease-out;
}
.beat-seq span i { font-style: normal; font-size: 11px; font-weight: 700; color: #B99A78; }
.beat-seq span em { font-style: normal; font-size: 12.5px; font-weight: 800; color: #8C6C4A; }
.beat-seq span.on { background: var(--brand); border-color: var(--brand); transform: translateY(-1px); }
.beat-seq span.on i, .beat-seq span.on em { color: #fff; }

/* 进度条（内缩，避免压住圆角） */
.stage-progress-track {
  position: absolute; left: 14px; right: 14px; bottom: 6px; height: 4px;
  border-radius: 999px; background: #F1E2D0; overflow: hidden; z-index: 6;
}
.stage-progress {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-light), var(--brand));
  transition: width .3s linear;
}
.sound-wave { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.sound-wave i { width: 3px; background: var(--brand); border-radius: 2px; animation: wave .5s ease-in-out infinite; }
.sound-wave i:nth-child(2){ animation-delay:.1s } .sound-wave i:nth-child(3){ animation-delay:.2s }
.sound-wave i:nth-child(4){ animation-delay:.3s } .sound-wave i:nth-child(5){ animation-delay:.4s }
.sound-wave.muted i { animation: none; height: 6px; opacity: .35; }

/* ---------- 报告 ---------- */
.report-doc {
  background: var(--surface); border-radius: var(--r-lg); padding: 26px;
  box-shadow: var(--sh-2); animation: rise .55s var(--ease-out) both;
  position: relative; overflow: hidden;
}
.report-doc::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--brand-light), var(--brand), var(--brand-deep));
}
.report-doc h3 { font-size: 19px; font-weight: 700; margin: 20px 0 10px; letter-spacing: -.01em; }
.report-doc h3:first-of-type { margin-top: 8px; }
.report-doc p { font-size: 14.5px; line-height: 1.75; color: #333; margin: 0 0 12px; }
.report-doc ul { padding-left: 20px; margin: 0 0 12px; }
.report-doc li { font-size: 14.5px; line-height: 1.75; margin-bottom: 5px; }
.report-doc strong { color: var(--brand-deep); font-weight: 650; }
.report-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.report-head img { width: 48px; height: 48px; border-radius: 12px; }
.report-head .t { flex: 1; }
.report-head .t b { font-size: 17px; font-weight: 700; display: block; }
.report-head .t span { font-size: 12.5px; color: var(--text-3); }
.report-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--text-3); text-align: center; line-height: 1.7; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.38);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; animation: fade .25s var(--ease) both; }
.modal {
  background: var(--surface); border-radius: var(--r-xl); padding: 26px;
  width: 100%; max-width: 420px; box-shadow: var(--sh-3);
  animation: pop .4s var(--ease-out) both; max-height: 86dvh; overflow-y: auto;
}
.modal h3 { margin: 0 0 8px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.modal p { font-size: 14px; color: var(--text-2); margin: 0 0 20px; line-height: 1.65; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(20px);
  background: rgba(29,29,31,.94); color: #fff; padding: 13px 22px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 500; z-index: 300;
  opacity: 0; pointer-events: none; transition: all var(--t) var(--ease-out);
  backdrop-filter: blur(10px); box-shadow: var(--sh-2); max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(200,30,25,.95); }
.toast.ok { background: rgba(28,130,60,.95); }

/* ---------- 底部固定操作条 ---------- */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(245,245,247,0), rgba(245,245,247,.92) 34%);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.bottom-bar .inner { max-width: var(--maxw); margin: 0 auto; }

/* ---------- 动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wave { 0%,100% { height: 6px; } 50% { height: 20px; } }

.stagger > * { animation: rise .5s var(--ease-out) both; }
.stagger > *:nth-child(1){ animation-delay:.04s } .stagger > *:nth-child(2){ animation-delay:.09s }
.stagger > *:nth-child(3){ animation-delay:.14s } .stagger > *:nth-child(4){ animation-delay:.19s }
.stagger > *:nth-child(5){ animation-delay:.24s } .stagger > *:nth-child(6){ animation-delay:.29s }
.stagger > *:nth-child(7){ animation-delay:.34s } .stagger > *:nth-child(8){ animation-delay:.39s }
.stagger > *:nth-child(9){ animation-delay:.44s } .stagger > *:nth-child(10){ animation-delay:.49s }
.stagger > *:nth-child(n+11){ animation-delay:.54s }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* 响应式 */
@media (max-width: 420px) {
  .hero h1 { font-size: 24px; }
  .item-row .input { width: 108px; }
  :root { --pad: 18px; }
}
