/* ============ Design tokens ============ */
:root {
  --bg: #080b10;
  --bg-glow: radial-gradient(1200px 600px at 50% -10%, rgba(61, 220, 151, .09), transparent 70%);
  --surface: #10161f;
  --surface-2: #161e29;
  --surface-3: #1c2634;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #e6eef7;
  --text-dim: #9aabbd;
  --text-mute: #64748b;
  --accent: #3ddc97;
  --accent-soft: rgba(61, 220, 151, .12);
  --blue: #57c7ff;
  --warn: #ffb840;
  --danger: #ff5f6d;
  --radius: 14px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .8);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
canvas, video { display: block; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }

/* ============ Topbar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  background: rgba(8, 11, 16, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  color: #04120c;
  background: linear-gradient(145deg, var(--accent), #23b47a);
  box-shadow: 0 6px 18px -6px rgba(61, 220, 151, .7);
}

.brand-text h1 { font-size: 16px; line-height: 1.2; }
.brand-text p { font-size: 11.5px; color: var(--text-mute); letter-spacing: .04em; }

.top-actions { display: flex; align-items: center; gap: 12px; }

.privacy-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-dim);
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}
.privacy-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: blink 2.4s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

.engine-status {
  font-size: 11.5px; color: var(--text-mute);
  font-family: var(--mono);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.engine-status.ok { color: var(--accent); border-color: rgba(61, 220, 151, .28); }
.engine-status.err { color: var(--danger); border-color: rgba(255, 95, 109, .3); }

.ghost-btn {
  font-size: 12.5px; color: var(--text-dim);
  padding: 7px 14px; border-radius: 9px;
  border: 1px solid var(--line-strong);
  transition: .18s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.primary-btn {
  font-size: 14px; font-weight: 600;
  padding: 12px 30px; border-radius: 11px;
  color: #04120c;
  background: linear-gradient(145deg, var(--accent), #29b87c);
  box-shadow: 0 10px 26px -10px rgba(61, 220, 151, .75);
  transition: .18s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(61, 220, 151, .9); }
.primary-btn:active { transform: translateY(0); }

/* ============ Main ============ */
main { min-height: calc(100vh - 67px); }

/* ---- Dropzone ---- */
.dropzone {
  max-width: 880px;
  margin: 0 auto;
  padding: 46px 26px 90px;
  transition: .2s;
}
.dropzone.dragover .dz-inner {
  border-color: var(--accent);
  background: rgba(61, 220, 151, .05);
  transform: scale(1.005);
}

.dz-inner {
  border: 1.5px dashed rgba(255, 255, 255, .13);
  border-radius: 22px;
  padding: 52px 40px 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface), rgba(16, 22, 31, .4));
  transition: .22s;
}

.dz-icon {
  width: 68px; height: 68px; margin: 0 auto 20px;
  border-radius: 20px; display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(61, 220, 151, .22);
}

.dz-inner h2 { font-size: 23px; margin-bottom: 8px; }
.dz-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 10px; }
.dz-note {
  font-size: 11.5px;
  color: var(--text-mute);
  line-height: 1.6;
  margin-bottom: 26px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.dz-tips {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-top: 44px; text-align: left;
}
.tip {
  display: flex; gap: 11px;
  padding: 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tip-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--accent); opacity: .8;
  padding-top: 1px;
}
.tip strong { display: block; font-size: 13px; margin-bottom: 3px; }
.tip p { font-size: 12px; color: var(--text-mute); line-height: 1.55; }

.how { margin-top: 26px; text-align: left; }
.how summary {
  cursor: pointer; font-size: 13px; color: var(--text-dim);
  padding: 10px 0; list-style: none;
  display: flex; align-items: center; gap: 7px;
}
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: "＋"; color: var(--accent); font-weight: 700; }
.how[open] summary::before { content: "－"; }
.how summary:hover { color: var(--text); }
.how-body {
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px; color: var(--text-dim);
}
.how-body p { margin-bottom: 10px; }
.how-body ul { margin: 0 0 12px 18px; }
.how-body li { margin-bottom: 6px; }
.how-body b { color: var(--text); }
.how-body .warn {
  margin: 14px 0 0; padding: 11px 13px;
  border-left: 2px solid var(--warn);
  background: rgba(255, 184, 64, .06);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
}

/* ---- Loading ---- */
.loading {
  max-width: 520px; margin: 0 auto;
  padding: 110px 26px;
  text-align: center;
}
.pulse-ring { position: relative; width: 62px; height: 62px; margin: 0 auto 28px; }
.pulse-ring span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0; animation: pulse 2.4s infinite;
}
.pulse-ring span:nth-child(2) { animation-delay: .8s; }
.pulse-ring span:nth-child(3) { animation-delay: 1.6s; }
@keyframes pulse {
  0% { transform: scale(.55); opacity: 0; }
  25% { opacity: .65; }
  100% { transform: scale(1.25); opacity: 0; }
}
.loading h2 { font-size: 19px; margin-bottom: 8px; }
.loading-hint { font-size: 13px; color: var(--text-dim); min-height: 22px; }
.progress-track {
  height: 5px; border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden; margin: 26px 0 10px;
}
.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #23b47a, var(--accent), #7df0bd);
  border-radius: 999px;
  transition: width .18s ease-out;
  box-shadow: 0 0 12px rgba(61, 220, 151, .6);
}
.loading-pct { font-family: var(--mono); font-size: 12px; color: var(--text-mute); margin-bottom: 10px; }
.loading-tip {
  font-size: 12px; color: var(--text-mute);
  margin-bottom: 22px; max-width: 320px; text-align: center; line-height: 1.6;
}

/* ---- Result ---- */
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 452px;
  gap: 20px;
  padding: 18px 22px 40px;
  align-items: start;
  max-width: 1680px;
  margin: 0 auto;
}

.stage { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }

.video-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10;
}
.video-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-wrap canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.v-badge {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; font-family: var(--mono);
  color: var(--accent);
  padding: 4px 9px; border-radius: 6px;
  background: rgba(4, 18, 12, .75);
  border: 1px solid rgba(61, 220, 151, .3);
  letter-spacing: .04em;
}
.v-play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .28);
  color: #fff; cursor: pointer;
  opacity: 0; transition: .2s;
}
.v-play svg { filter: drop-shadow(0 4px 12px rgba(0,0,0,.6)); }
.video-wrap:hover .v-play { opacity: 1; }
.video-wrap.playing .v-play { opacity: 0; }

/* ---- Timeline ---- */
.timeline-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 8px;
}
.tl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tl-label { font-size: 11.5px; color: var(--text-dim); letter-spacing: .04em; }
.tl-legend { font-size: 11px; color: var(--text-mute); display: flex; align-items: center; gap: 5px; }
.lg-hit {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 6px var(--warn); display: inline-block;
}
.lg-hl {
  width: 11px; height: 7px; border-radius: 2px;
  background: rgba(87, 199, 255, .55); display: inline-block;
  margin-left: 7px;
}
#timeline { width: 100%; height: 74px; cursor: pointer; border-radius: 8px; }
.tl-foot {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--text-mute);
  padding: 2px 2px 4px;
}

/* ---- Report ---- */
.report {
  display: flex; flex-direction: column; gap: 14px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.report::-webkit-scrollbar { width: 6px; }
.report::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
.report::-webkit-scrollbar-track { background: transparent; }

.score-card {
  display: flex; align-items: center; gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ring-wrap { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1), stroke .4s;
  filter: drop-shadow(0 0 6px rgba(61, 220, 151, .55));
}
.ring-txt {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-txt b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.ring-txt span { font-size: 10.5px; color: var(--text-mute); margin-top: 4px; }

.score-side { min-width: 0; }
.score-side h2 { font-size: 17px; margin-bottom: 5px; }
.score-side p { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.meta-line {
  margin-top: 9px; font-family: var(--mono); font-size: 10.5px;
  color: var(--text-mute); line-height: 1.7;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 13px;
}
.section-head h3 { font-size: 13.5px; letter-spacing: .01em; }
.section-head .hint { font-size: 11px; color: var(--text-mute); }
.badge-count {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: 6px; display: grid; place-items: center;
  background: rgba(255, 95, 109, .14); color: var(--danger);
}

/* ---- 精彩片段 ---- */
.hl-sub {
  font-size: 11.5px; color: var(--text-mute);
  margin: -4px 0 11px; line-height: 1.55;
}
.mini-btn {
  font-size: 11px; font-weight: 600;
  color: var(--blue);
  padding: 4px 10px; border-radius: 7px;
  background: rgba(87, 199, 255, .1);
  border: 1px solid rgba(87, 199, 255, .28);
  transition: background .15s, transform .1s;
}
.mini-btn:hover { background: rgba(87, 199, 255, .18); }
.mini-btn:active { transform: scale(.96); }

.highlights { display: flex; flex-direction: column; gap: 8px; }

.hl-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color .16s, background .16s;
}
.hl-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--blue); opacity: 0; transition: opacity .16s;
}
.hl-card:hover { border-color: rgba(87, 199, 255, .35); background: var(--surface-3); }
.hl-card.active {
  border-color: rgba(87, 199, 255, .55);
  background: linear-gradient(90deg, rgba(87, 199, 255, .13), var(--surface-2));
}
.hl-card.active::before { opacity: 1; }

.hl-num {
  flex: 0 0 22px; width: 22px; text-align: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--text-mute); transition: color .16s;
}
.hl-card:hover .hl-num, .hl-card.active .hl-num { color: var(--blue); }

.hl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.hl-row1 { display: flex; align-items: baseline; gap: 6px; }
.hl-score {
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  color: var(--blue); line-height: 1;
}
.hl-score-unit { font-size: 10px; color: var(--text-mute); }
.hl-rank {
  font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-dim);
}
.hl-rank.top { background: rgba(255, 184, 64, .14); color: var(--warn); }
.hl-time {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-mute);
  margin-left: auto;
}

.hl-desc {
  font-size: 11.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hl-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 1px; }
.hl-tags i {
  font-style: normal; font-size: 10px;
  padding: 1px 6px; border-radius: 5px;
  background: rgba(87, 199, 255, .11); color: var(--blue);
  border: 1px solid rgba(87, 199, 255, .2);
}

.hl-go {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-mute);
  transition: background .16s, color .16s, box-shadow .16s;
}
.hl-card:hover .hl-go, .hl-card.active .hl-go {
  background: var(--blue); color: #04141c;
  box-shadow: 0 0 10px rgba(87, 199, 255, .4);
}

/* 视频上的片段播放指示条 */
.v-clip {
  position: absolute; left: 50%; bottom: 10px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 10px;
  border-radius: 999px;
  background: rgba(4, 12, 20, .82);
  border: 1px solid rgba(87, 199, 255, .4);
  backdrop-filter: blur(8px);
  font-size: 11px; color: var(--text);
  white-space: nowrap;
  max-width: calc(100% - 20px);
}
.v-clip-dot {
  flex: 0 0 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 7px var(--blue);
  animation: clipPulse 1.4s ease-in-out infinite;
}
@keyframes clipPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.v-clip-exit {
  font-size: 10.5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .09); color: var(--text-dim);
  transition: background .15s, color .15s;
}
.v-clip-exit:hover { background: rgba(255, 255, 255, .16); color: var(--text); }

/* dims */
.dims { display: flex; flex-direction: column; gap: 11px; }
.dim { cursor: pointer; }
.dim:hover .dim-name { color: var(--text); }
.dim-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 5px;
}
.dim-name { font-size: 12.5px; color: var(--text-dim); transition: .15s; }
.dim-val { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.dim-bar {
  height: 6px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.dim-fill {
  height: 100%; width: 0; border-radius: 999px;
  transition: width .9s cubic-bezier(.2, .8, .2, 1);
}

/* metrics */
.metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
}
.metric {
  padding: 10px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.metric-label { font-size: 10.5px; color: var(--text-mute); margin-bottom: 4px; }
.metric-value { font-family: var(--mono); font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.metric-unit { font-size: 10px; color: var(--text-mute); margin-left: 2px; font-weight: 400; }

/* problems */
.problems { display: flex; flex-direction: column; gap: 9px; }
.prob {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
  transition: .18s;
}
.prob:hover { border-color: var(--line-strong); }
.prob-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 13px;
  cursor: pointer;
}
.sev-bar { width: 3px; height: 30px; border-radius: 2px; flex-shrink: 0; }
.sev-bar.s3 { background: var(--danger); box-shadow: 0 0 8px rgba(255,95,109,.5); }
.sev-bar.s2 { background: var(--warn); box-shadow: 0 0 8px rgba(255,184,64,.4); }
.sev-bar.s1 { background: var(--blue); box-shadow: 0 0 8px rgba(87,199,255,.35); }
.prob-title { flex: 1; font-size: 13px; font-weight: 500; }
.sev-tag {
  font-size: 10px; padding: 2px 7px; border-radius: 5px;
  font-family: var(--mono); letter-spacing: .03em;
}
.sev-tag.s3 { color: var(--danger); background: rgba(255, 95, 109, .12); }
.sev-tag.s2 { color: var(--warn); background: rgba(255, 184, 64, .12); }
.sev-tag.s1 { color: var(--blue); background: rgba(87, 199, 255, .12); }
.prob-chev { color: var(--text-mute); font-size: 11px; transition: .2s; }
.prob.open .prob-chev { transform: rotate(90deg); }

.prob-body { display: none; padding: 0 13px 14px; }
.prob.open .prob-body { display: block; }

.prob-block { margin-bottom: 12px; }
.prob-block:last-child { margin-bottom: 0; }
.prob-block h5 {
  font-size: 11px; color: var(--text-mute); font-weight: 500;
  letter-spacing: .06em; margin-bottom: 5px;
  text-transform: uppercase;
}
.prob-block p { font-size: 12.5px; color: var(--text-dim); line-height: 1.68; }
.prob-block ol, .prob-block ul { margin-left: 17px; }
.prob-block li { font-size: 12.5px; color: var(--text-dim); line-height: 1.68; margin-bottom: 4px; }
.prob-block li::marker { color: var(--accent); font-size: 11px; }
.prob-block.symptom p {
  color: var(--text); font-family: var(--mono); font-size: 11.5px;
  background: var(--bg); padding: 8px 10px; border-radius: 7px;
  border-left: 2px solid var(--line-strong); line-height: 1.6;
}
.prob-jump {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--accent);
  padding: 5px 10px; border-radius: 7px;
  background: var(--accent-soft);
  transition: .15s;
}
.prob-jump:hover { background: rgba(61, 220, 151, .2); }

/* plan */
.plan { display: flex; flex-direction: column; gap: 12px; }
.phase {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  position: relative;
}
.phase::before {
  content: ""; position: absolute; left: -5px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.phase-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.phase-head h4 { font-size: 12.5px; font-weight: 600; }
.phase-weeks { font-family: var(--mono); font-size: 10.5px; color: var(--accent); white-space: nowrap; }
.phase-note { font-size: 12px; color: var(--text-mute); margin-bottom: 9px; line-height: 1.6; }
.phase-item { margin-bottom: 9px; }
.phase-item-name { font-size: 12.5px; color: var(--text); margin-bottom: 3px; }
.phase-item ol { margin-left: 16px; }
.phase-item li { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 2px; }
.phase-item li::marker { color: var(--accent); }

.disclaimer {
  padding: 14px 16px;
  background: rgba(255, 184, 64, .05);
  border: 1px solid rgba(255, 184, 64, .18);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.disclaimer strong { font-size: 11.5px; color: var(--warn); display: block; margin-bottom: 5px; letter-spacing: .03em; }
.disclaimer p { font-size: 11.5px; color: var(--text-mute); line-height: 1.7; }

/* error state */
.error-box {
  max-width: 540px; margin: 90px auto; padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 95, 109, .25);
  border-radius: var(--radius);
}
.error-box h3 { font-size: 16px; color: var(--danger); margin-bottom: 10px; }
.error-box p { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 18px; }

/* 离屏解码容器：必须保持渲染，不能用 display:none */
.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 480px;
  height: 360px;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
}

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0; transition: .25s; pointer-events: none;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 启动失败兜底 */
.boot-error {
  max-width: 560px;
  margin: 80px auto;
  padding: 34px 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 95, 109, .28);
  border-radius: var(--radius);
}
.boot-error h3 { font-size: 17px; color: var(--danger); margin-bottom: 12px; }
.boot-error p {
  font-size: 13px; color: var(--text-dim); line-height: 1.7;
  margin-bottom: 10px; word-break: break-all;
}
.boot-error .boot-hint { font-size: 12px; color: var(--text-mute); margin-bottom: 22px; }

/* ---- Responsive ---- */
@media (max-width: 1240px) {
  .result { grid-template-columns: minmax(0, 1fr) 400px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .result { grid-template-columns: 1fr; }
  .stage { position: static; }
  .report { max-height: none; overflow: visible; padding-right: 0; }
  .dz-tips { grid-template-columns: 1fr; }
}
@media (min-width: 641px) {
  /* 电脑上不存在锁屏中断的问题，这句提示只在手机上出现 */
  .loading-tip { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 11px 16px; }
  .privacy-chip { display: none; }
  .brand-text p { display: none; }
  .result { padding: 12px; gap: 12px; }
  .dz-inner { padding: 36px 20px 28px; }
  .dz-inner h2 { font-size: 19px; }
  .score-card { flex-direction: column; text-align: center; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  /* 手机上视频比例由 JS 按实际朝向设置；这里只限高，避免竖屏视频顶掉整页 */
  .video-wrap { aspect-ratio: auto; height: 52vh; max-height: 460px; min-height: 260px; }
}

/* ================================================================
   报告逐项浮现
   ----------------------------------------------------------------
   报告里的条目不再"啪"一下全部出现——先占好位置（避免滚动跳动），
   再由 JS 按分析顺序逐个点亮。节奏表在 app.js 的 REVEAL_STEP 里。
   ================================================================ */
.rv {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .42s cubic-bezier(.25, .8, .3, 1),
              transform .42s cubic-bezier(.25, .8, .3, 1);
}
.rv.on { opacity: 1; transform: none; }

/* 用户偏好减少动效，或自测模式：一律直接显示，不做逐项渐入 */
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
}

/* 逐帧分析阶段的"心跳"：网络/算力卡住时进度条不动，靠它告诉用户还活着 */
.loading-hint.live::after {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: liveDot 1.1s infinite;
}
@keyframes liveDot {
  0%, 100% { opacity: .2; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1); }
}
