:root {
  --bg: #111316;
  --card: #1c1f24;
  --fg: #eef0f3;
  --muted: #9aa3ad;
  --accent: #3d8bfd;
  --rec: #e5484d;
  --warn: #f5a524;
  --ok: #30a46c;
  --line: #2c3036;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 15px; }
main { max-width: 520px; margin: 0 auto; }
.screen { padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 22px; margin: 4px 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--rec); min-height: 1.5em; }
.warn { color: var(--warn); font-size: 14px; }
.info { font-size: 14px; color: var(--muted); }
.notice { background: var(--card); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ok { background: rgba(48, 164, 108, .15); border: 1px solid var(--ok); border-radius: 12px; padding: 14px; font-weight: 600; }

input[type=text] {
  width: 100%; font-size: 20px; letter-spacing: 2px; padding: 12px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg);
}
select { font-size: 15px; padding: 8px; border-radius: 8px; background: var(--card); color: var(--fg); border: 1px solid var(--line); }
button {
  font: inherit; border: 0; border-radius: 12px; padding: 14px 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: .4; cursor: default; }
.primary { background: var(--accent); color: #fff; font-weight: 600; font-size: 17px; }
.primary.rec { background: var(--rec); }
.secondary { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.danger { background: var(--rec); color: #fff; font-weight: 600; padding: 10px 18px; }
.link { background: none; color: var(--accent); padding: 8px; }
.danger-text { color: var(--rec); }

.check { display: flex; gap: 12px; align-items: flex-start; background: var(--card); padding: 14px; border-radius: 12px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 12px 6px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
}
.seg input:checked + span { border-color: var(--accent); background: rgba(61, 139, 253, .18); font-weight: 600; }

/* 架设检查 */
#s-setup { padding: 0 0 24px; gap: 0; }
.stage { position: relative; background: #000; height: 58vh; overflow: hidden; }
.stage video, #recPreview { width: 100%; height: 100%; object-fit: cover; display: block; }
.mirror { transform: scaleX(-1); } /* 只镜像预览画面，录进档案的内容不受影响 */
.guide { position: absolute; inset: 0; pointer-events: none; }
.face-box {
  position: absolute; left: 50%; top: 14%; width: 46%; aspect-ratio: 3 / 4;
  transform: translateX(-50%); border: 3px dashed rgba(255, 255, 255, .85); border-radius: 50%;
}
.shoulders {
  position: absolute; left: 12%; right: 12%; top: 68%; height: 18%;
  border: 3px dashed rgba(255, 255, 255, .6); border-bottom: 0; border-radius: 40% 40% 0 0;
}
.panel { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 12px; }
.tips { margin: 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.inline { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }

/* 录影中 */
#s-record { position: fixed; inset: 0; padding: 0; background: #000; z-index: 10; }
.hud {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .55);
  font-variant-numeric: tabular-nums; font-size: 18px;
}
.hud button { margin-left: auto; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); display: inline-block; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: rgba(0, 0, 0, .45); text-align: center; padding: 16px;
}
.overlay p { font-size: 22px; font-weight: 600; text-shadow: 0 1px 4px #000; }
.big { font-size: 96px; font-weight: 700; line-height: 1; text-shadow: 0 2px 8px #000; }
.blackout { position: absolute; inset: 0; background: #000; z-index: 2; }
.blackhud {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; display: flex; gap: 8px; align-items: center;
  color: #6b6f75; font-size: 14px; font-variant-numeric: tabular-nums;
}
.blackout .hint { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom)); width: 100%; text-align: center; color: #2a2d31; font-size: 13px; }
.floating { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 16px; right: 16px; background: rgba(0, 0, 0, .7); padding: 8px 10px; border-radius: 8px; }

/* 上传列表 */
.item { background: var(--card); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 14px; }
.item .btns { display: flex; gap: 8px; }
.item .btns button { flex: 1; padding: 11px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* 只支援竖屏：手机横放时盖一层提示（不会中断录影） */
.landscape { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .landscape {
    display: flex; position: fixed; inset: 0; z-index: 50; background: #000; align-items: center; justify-content: center;
    font-size: 20px; text-align: center; padding: 16px;
  }
}
