:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-2: #eef1f5;
  --border: #d8dee6;
  --text: #1f2328;
  --muted: #646e7b;
  --accent: #2f7dd1;
  --good: #16a34a;
  --warn: #b45309;
  --bad: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding: max(12px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
header h1 { font-size: 17px; margin: 4px 0 2px; }
header p { margin: 0; font-size: 12px; color: var(--muted); }

/* 版本徽标：标题渐变文字里的徽标必须还原为普通小字，否则看不清 */
.app-version {
  font-size: .7rem; font-weight: 400; margin-left: 8px;
  color: #6b7280;
  background: none;
  -webkit-background-clip: initial; background-clip: initial;
  -webkit-text-fill-color: #6b7280;
  white-space: nowrap; user-select: none; vertical-align: middle;
}

.banner {
  margin-top: 10px; padding: 9px 11px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.45; display: none;
}
.banner.warn { background: #fff3cd; color: #7a5b08; border: 1px solid #f3dc9a; }
.banner.ok   { background: #e6f6ea; color: #166534; border: 1px solid #b8e3c3; }
.banner.show { display: block; }

.controls {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0;
}
button, select {
  appearance: none; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 14px; font-size: 14px; cursor: pointer;
}
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: #ffffff; border-color: var(--accent); font-weight: 600; }
select { min-width: 110px; }

.viewer { position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.viewer video { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; background: #000; }
.reticle {
  position: absolute; left: 50%; top: 50%; width: 30%; height: 30%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(78,161,255,.85);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.28);
  pointer-events: none;
}
.reticle::after {
  content: "对准屏幕中央"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); font-size: 11px; color: #d6e6ff;
  text-shadow: 0 1px 3px #000; opacity: .9;
}
.placeholder {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 20px;
}

.chart { margin-top: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.chart .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chart .head label { font-size: 12px; color: var(--muted); }
.chart canvas { width: 100%; height: 140px; display: block; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px;
}
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

.verdict { margin-top: 12px; padding: 13px; border-radius: 12px; font-size: 15px; font-weight: 600; text-align: center; }
.verdict.good { background: #e6f6ea; color: #166534; border: 1px solid #b8e3c3; }
.verdict.warn { background: #fff3cd; color: #7a5b08; border: 1px solid #f3dc9a; }
.verdict.bad  { background: #fde5e5; color: #b91c1c; border: 1px solid #f5bcbc; }
.verdict.wait { background: var(--panel); color: #6b7280; border: 1px solid var(--border); }

.card { margin-top: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--text); }
.card p { margin: 6px 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.card ol { margin: 6px 0 0; padding-left: 18px; }
.card ol li { margin: 6px 0; font-size: 13px; color: var(--text); line-height: 1.6; }
.card code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.card .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }

/* 操作反馈 toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2328; color: #ffffff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index: 999; max-width: 90vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.toast.show { opacity: 1; }
.toast.success { background: #16a34a; }
.toast.warn { background: #b45309; }
