/* 正姿小卫士的页面样式：浅色、明亮，手机和电脑都能看清 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #eef6ff 0%, #f7fbff 100%);
  color: #1f2a37;
}
.page-header { padding: 20px 16px 4px; text-align: center; }
.page-header h1 { margin: 0; font-size: 28px; }
.subtitle { color: #4b5563; max-width: 720px; margin: 8px auto; line-height: 1.6; }
.layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  max-width: 1100px;
  margin: 12px auto;
  padding: 0 12px;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  /* 手机版的其余规则在文件最后统一写，避免被通用规则覆盖 */
}
.card {
  background: #ffffff;
  border: 1px solid #dbe7f5;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(30, 80, 160, 0.06);
}
.video-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #0b1526; border-radius: 10px; overflow: hidden; }
.video-frame video, .video-frame canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); /* 镜像显示，和照镜子一样，左右更直观 */
}
.status-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.92); font-weight: 700; font-size: 15px;
}
.status-badge.good { background: #16a34a; color: #ffffff; }
.status-badge.warn { background: #f97316; color: #ffffff; }
.status-badge.idle { background: rgba(255,255,255,0.92); color: #475467; }
.reminder-banner {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #fef3f2; color: #b42318; font-weight: 700; line-height: 1.5;
}
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
button {
  border: none; border-radius: 10px; padding: 10px 16px;
  font-size: 16px; cursor: pointer; background: #1570ef; color: #fff;
}
button:disabled { background: #b2c6de; cursor: not-allowed; }
button.btn-finish { background: #12805c; }
.hint-text { color: #4b5563; line-height: 1.6; font-size: 14px; }
.card h2 { font-size: 18px; margin: 14px 0 6px; }
.card h2:first-child { margin-top: 0; }
.big-text { font-size: 22px; font-weight: 700; margin: 4px 0; }
.metric-list { list-style: none; padding: 0; margin: 6px 0; line-height: 1.9; }
.setting-item { display: block; margin: 8px 0; font-size: 14px; color: #344054; }
.setting-item input[type="text"], .setting-item input[type="password"], .setting-item input[type="number"] {
  width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid #cfd8e3; border-radius: 8px; font-size: 14px;
}
.setting-item input[type="number"] { width: 110px; }
/* 数值设置用滑块拖动：手机和电脑操作一致，滑块占满一行方便手指拖，
   当前数值显示在标题旁边的 .setting-value 里 */
.setting-item input[type="range"] { width: 100%; margin-top: 6px; accent-color: var(--green); height: 28px; }
.setting-value { font-weight: 700; color: var(--green-dark); white-space: nowrap; }
.summary-area {
  white-space: pre-wrap; word-break: break-word;
  background: #f2f7ff; border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 14px; line-height: 1.7; min-height: 72px;
}
.page-footer { text-align: center; color: #667085; font-size: 13px; padding: 8px 16px 24px; line-height: 1.6; }
/* 用后置摄像头时画面不做镜像，和眼睛看到的方向一致 */
.video-frame.rear video, .video-frame.rear canvas { transform: none; }
/* 连接智能体的折叠栏目：标题像小标题一样，点一下展开或收起 */
.agent-panel { margin-top: 16px; border-top: 1px solid #e4ebf5; padding-top: 10px; }
.agent-panel summary { font-size: 18px; font-weight: 700; cursor: pointer; padding: 4px 0; }

/* 手机版式（放在文件最后，保证覆盖上面的通用规则） */
@media (max-width: 820px) {
  /* 手机版也显示标题，但只留“正姿小卫士”五个字居中显示，
     副标题说明就不显示了，省地方 */
  .page-header { display: block; padding: 10px 8px 0; }
  .page-header h1 { font-size: 20px; text-align: center; }
  .page-header .subtitle { display: none; }
  .layout { margin: 0 auto; padding: 6px; gap: 10px; }
  .card { padding: 10px; }
  .desktop-hint { display: none; }
  .video-frame {
    aspect-ratio: 9 / 16;
    /* 宽度优先占满（程序会再按同样思路写确切像素值）：
       不再按高度反算宽度，避免视频偏小、两边留白 */
    width: min(100%, 430px);
    margin: 0 auto;
  }
  .button-row { justify-content: center; }
}

/* 手机标记版式：由程序检测到“触摸屏 + 小屏幕”时给页面根部加上 is-mobile 标记，
   效果和文件最后的宽度规则相同。两条路都通，避免某种浏览器里宽度规则没生效时退回电脑版式。 */
html.is-mobile .page-header { display: block; padding: 10px 8px 0; }
html.is-mobile .page-header h1 { font-size: 20px; text-align: center; }
html.is-mobile .page-header .subtitle { display: none; }
html.is-mobile .layout { margin: 0 auto; padding: 6px; gap: 10px; grid-template-columns: 1fr; }
html.is-mobile .card { padding: 10px; }
html.is-mobile .desktop-hint { display: none; }
html.is-mobile .video-frame {
  aspect-ratio: 9 / 16;
  width: min(100%, 430px);
  margin: 0 auto;
}
html.is-mobile .button-row { justify-content: center; }

/* 姿态模型加载状态（在视频窗口下方、开始按键上方的一行，
   宽度就是整行，不随视频宽度变化） */
.model-status { margin: 8px 0; font-size: 14px; font-weight: 700; color: #475467; overflow-wrap: break-word; }
/* 设置折叠栏目：和智能体栏目一样，标题点一下展开或收起 */
.settings-panel { margin-top: 16px; border-top: 1px solid #e4ebf5; padding-top: 10px; }
.settings-panel summary { font-size: 18px; font-weight: 700; cursor: pointer; padding: 4px 0; }
/* 设置区里的小标题（例如“判断宽容度”） */
.setting-subtitle { font-size: 16px; margin: 16px 0 4px; }
.model-status::before {
  content: ""; display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px; background: #f59e0b;
}
.model-status.ready { color: #067647; }
.model-status.ready::before { background: #16a34a; }
.model-status.failed { color: #b42318; }
.model-status.failed::before { background: #dc2626; }

/* 调试信息行：字小一点，方便对照和复制 */
.debug-info { font-size: 12px; color: #98a2b3; word-break: break-all; }
/* 本次小结标题行：左边是标题，右边是“播报小结”开关 */
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary-voice-toggle { font-size: 14px; color: #475467; white-space: nowrap; cursor: pointer; margin-top: 8px; }
