:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --border: #E4E2DA;
  --border-strong: #D3D1C7;
  --text: #2C2C2A;
  --text-2: #5F5E5A;
  --text-3: #888780;
  --accent: #185FA5;
  --accent-soft: #E6F1FB;
  --hit: #BA7517;
  --hit-soft: #FAEEDA;
  --ok: #3B6D11;
  --ok-soft: #EAF3DE;
  --danger: #A32D2D;
  --danger-soft: #FCEBEB;
  --pending: #888780;
  --pending-soft: #F1EFE8;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ---- 动效（Motion）----
     统一时长与缓动：短促用于按钮/图标，适中用于卡片/菜单，偏慢用于首屏揭示。
     进入类动画统一用减速缓动（ease-out）：响应要及时，停稳要柔和。 */
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 460ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  /* 「追踪中的视频」滚动组件：固定显示 3 行 */
  --video-row-h: 78px;
  --video-rows: 3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 500; margin: 0; }
h1 { font-size: 15px; }
h2 { font-size: 14px; }
h3 { font-size: 14px; }
h4 { font-size: 12.5px; color: var(--text-2); margin: 18px 0 8px; letter-spacing: .02em; }

.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.muted { color: var(--text-3); font-size: 12.5px; line-height: 1.7; margin: 0; }

.app { display: flex; flex-direction: column; height: 100%; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 9px; }
.chainbar { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chain-chip.clickable {
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.chain-chip.clickable:hover { background: var(--accent-soft); border-color: #C3DCF2; color: var(--accent); }
.chain-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.chain-chip b { font-weight: 500; color: var(--text); }
.chain-chip .mono { font-size: 11.5px; }
.chain-chip.good { background: var(--ok-soft); border-color: #CFE0B8; color: var(--ok); }
.chain-chip.good b { color: var(--ok); }
.chain-chip.warn { background: var(--hit-soft); border-color: #EDD9B0; color: #8A6212; }
.chain-chip.warn b { color: #8A6212; }

.icon-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .55; cursor: default; }

/* ---------- layout ---------- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 320px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}
.sidebar, .inspector, .stage { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.inspector { overflow: hidden; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel.grow { flex: 1; overflow: hidden; }
.panel h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.count {
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-family: var(--mono);
}

/* 面板内提示条：把「哪一块没渲染出来 / 存证状态变了什么」写在页面上，而不是只丢控制台 */
.panel-alert {
  margin: 0 4px 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.panel-alert.good {
  border-color: #CFE0B8;
  background: var(--ok-soft);
  color: var(--ok);
}
.panel-alert.error {
  border-color: #E9C4C0;
  background: var(--danger-soft);
  color: var(--danger);
}
.inspector-head .copy-chip { margin-left: auto; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 5px; }

input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#videoUrl { margin-bottom: 10px; }

button.primary {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
button.primary:hover { background: #14528F; }
button.primary:disabled { opacity: .6; cursor: default; }

button.ghost, a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
button.ghost:hover, a.ghost:hover { background: var(--surface-2); color: var(--text); }
button.ghost:disabled { opacity: .6; cursor: default; }
button.small, a.small { padding: 5px 10px; font-size: 12px; }
button.danger { color: var(--danger); border-color: #E7C6C6; }
button.danger:hover { background: var(--danger-soft); }

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-3);
}
.hint.error { color: var(--danger); }
.hint.busy { color: var(--accent); }

/* ---------- 追踪中的视频：固定 3 行的滑动组件 ---------- */
.video-scroll {
  position: relative;
  height: calc(var(--video-row-h) * var(--video-rows));
  overflow: hidden;
}

/* 上下边缘淡出：提示「还能继续滚」。不可滚动时两侧都隐藏 */
.video-scroll::before,
.video-scroll::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 22px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.video-scroll::before {
  top: 0;
  background: linear-gradient(to bottom, var(--surface), rgba(255, 255, 255, 0));
}
.video-scroll::after {
  bottom: 0;
  background: linear-gradient(to top, var(--surface), rgba(255, 255, 255, 0));
}
.video-scroll.is-scrollable:not(.at-top)::before { opacity: 1; }
.video-scroll.is-scrollable:not(.at-bottom)::after { opacity: 1; }

.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.video-list::-webkit-scrollbar { width: 6px; }
.video-list::-webkit-scrollbar-track { background: transparent; }
.video-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
.video-list::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* 刻意不做位移 / 缩放反馈：文字一移动就没法用鼠标拖选复制了。
   这里的反馈改用背景色 + 左侧色条，既不打断选择又不失可点性。 */
.video-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  height: calc(var(--video-row-h) - 6px);
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  scroll-snap-align: start;
  user-select: text;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.video-item:hover {
  background: var(--surface-2);
  box-shadow: inset 2px 0 0 var(--border-strong);
}
.video-item:active { background: var(--accent-soft); }
.video-item.active { background: var(--accent-soft); border-color: #C3DCF2; }
.video-item.enter { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.video-item.enter.in { opacity: 1; transform: none; }

.video-thumb {
  width: 42px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.video-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: text;
}
.video-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.video-author { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-desc {
  font-size: 11.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-stats { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; overflow: hidden; }
.video-likes { font-size: 12.5px; font-weight: 500; color: var(--accent); white-space: nowrap; }
.pill {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); border-color: #CFE0B8; color: var(--ok); }
.pill.hit { background: var(--hit-soft); border-color: #EDD9B0; color: #8A6212; }

.scroll-tip {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.scroll-tip.show { opacity: 1; }

/* ---------- 凭证码 / 复制按钮 ---------- */
.copy-chip {
  font-size: 11px;
  font-family: inherit;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}
.copy-chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-chip:disabled { opacity: 0.7; cursor: default; }

.cred-block {
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}
.cred-block.wide { padding: 10px 12px; margin-bottom: 12px; }
.cred-block.wide .cred-code { margin-bottom: 8px; }
.cred-block.wide > .primary { width: auto; }
.cred-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.cred-label { font-size: 11px; color: var(--text-3); }
.cred-code {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--accent);
  word-break: break-all;
  user-select: all; /* 点一下就能整串选中 */
  cursor: text;
}
.cred-block.wide .cred-code { font-size: 12px; }

.new-cert { margin-bottom: 6px; }

/* 「为什么这串改不了」—— 讲清楚不可伪造性，默认折叠，点开看原理 */
.cred-why {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.cred-why > summary {
  cursor: pointer;
  padding: 7px 10px;
  font-size: 11.5px;
  color: var(--text-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.cred-why > summary::-webkit-details-marker { display: none; }
.cred-why > summary::before {
  content: '?';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
}
.cred-why[open] > summary { border-bottom: 1px solid var(--border); color: var(--text); }
.cred-why-body { padding: 10px 11px 4px; }
.cred-why-body p {
  margin: 0 0 8px;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--text-2);
}
.cred-why-body b { color: var(--text); }
.cred-why-body u { text-decoration: underline; text-decoration-color: var(--hit); text-underline-offset: 2px; }
.cred-why-body code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
  word-break: break-all;
}

.form-actions { display: flex; gap: 8px; }
.form-actions .primary { flex: 1; }
.form-actions .ghost { flex-shrink: 0; }

.toolbar-chip {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  white-space: nowrap;
}

.empty-note {
  list-style: none;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 6px 2px;
  margin: 0;
}

/* ---------- stage ---------- */
.stage-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  flex-shrink: 0;
}
.toolbar-title { font-size: 13px; color: var(--text-2); }
.toolbar-title b { color: var(--accent); font-weight: 500; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  padding: 5px 11px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-2);
  border: none;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.active { background: var(--accent); color: #fff; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex-shrink: 0; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.stat-value.ok { color: var(--ok); }
.stat-unit { font-size: 13px; color: var(--text-3); font-weight: 400; }

/* ---------- chart ---------- */
.chart-card {
  position: relative;
  flex: 1;
  min-height: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
}
.chart { width: 100%; height: 100%; display: block; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(30, 30, 28, .94);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.5;
  z-index: 5;
  max-width: 220px;
}
.tt-likes { font-weight: 500; font-size: 13px; }
.tt-time { color: #CFCDC6; font-size: 11.5px; }
.tt-delta { color: #8FC7F5; font-size: 11.5px; margin-top: 2px; }
.tt-cert { color: #F0C46A; margin-top: 3px; font-size: 11.5px; }

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  pointer-events: none;
}
.empty-state p { margin: 0; font-size: 14px; color: var(--text-2); }
.empty-state span { font-size: 12.5px; }

/* ---------- progress ---------- */
.progress-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; flex-shrink: 0; }
.progress-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.progress-item.done { border-color: #EDD9B0; background: var(--hit-soft); }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.progress-label { font-size: 12.5px; font-weight: 500; }
.progress-note { font-size: 11.5px; color: var(--text-3); }
.progress-item.done .progress-note { color: #8A6212; }
.progress-bar { height: 6px; background: var(--pending-soft); border-radius: 999px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .35s ease; }
.progress-item.done .progress-bar i { background: var(--hit); }

/* ---------- legend ---------- */
.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); flex-shrink: 0; padding: 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.sw-curve { background: var(--accent); }
.sw-hit { background: var(--hit); }
.sw-idle { background: var(--border-strong); }
.legend-hint { margin-left: auto; }

/* ---------- cert list ---------- */
.inspector-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; flex-shrink: 0; }
.cert-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.cert-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
}
.cert-card:hover { border-color: var(--border-strong); }
.cert-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cert-milestone { font-size: 15px; font-weight: 500; }
.cert-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-confirmed { background: var(--ok-soft); border-color: #CFE0B8; color: var(--ok); }
.badge-broadcast { background: var(--hit-soft); border-color: #EDD9B0; color: #8A6212; }
.badge-pending { background: var(--pending-soft); border-color: var(--border); color: var(--text-3); }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 10px; margin: 0 0 11px; font-size: 12px; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 11.5px; }
.kv dd.plain { font-family: inherit; font-size: 12px; }

.share-block {
  margin-top: 10px;
  border-color: #CFE0B8;
  background: var(--ok-soft);
}
.share-block .cred-code { color: var(--ok); }
.share-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
}
.cert-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.cert-actions.wide { margin-top: 16px; }
.cert-actions .primary { width: auto; padding: 6px 12px; font-size: 12.5px; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 28, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: min(720px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .18);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-body { padding: 6px 18px 20px; overflow-y: auto; }

.verify-result { border-radius: var(--radius-sm); padding: 11px 13px; font-size: 12.5px; line-height: 1.7; margin-top: 14px; }
.verify-result.pass { background: var(--ok-soft); color: var(--ok); }
.verify-result.warn { background: var(--hit-soft); color: #8A6212; }
.verify-result.fail { background: var(--danger-soft); color: var(--danger); }

.hash-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.65;
  margin-bottom: 7px;
  word-break: break-all;
}
.hash-block.pre { white-space: pre-wrap; font-size: 11.5px; max-height: 220px; overflow: auto; }
.hash-label { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
.verify-steps { margin-top: 8px; }

.check-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border); }
.check-icon { color: var(--text-3); width: 14px; flex-shrink: 0; }
.check-icon.pass { color: var(--ok); }
.check-icon.fail { color: var(--danger); }
.check-label { color: var(--text-2); }
.check-value { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--text-3); max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spin {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
  margin-right: 5px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 动效 ---------- */

/* 页面加载 · 按行显现（Line reveal）：文字从自己的裁剪容器里向上滑出 */
.line-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 2px;
}
.line-reveal > span {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
}
.line-reveal.in > span {
  transform: none;
  opacity: 1;
  transition:
    transform var(--dur-slow) var(--ease-out),
    opacity var(--dur-slow) var(--ease-out);
}

/* 交错出现（Stagger）：由 motion.js 逐项加 .enter → .in */
.enter { opacity: 0; transform: translateY(10px); }
.enter.in {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

/* 悬停抬升（Hover lift）：卡片轻微上移并加重阴影 */
.stat-card,
.cert-card,
.progress-item {
  transition:
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
  will-change: transform;
}
.stat-card:hover,
.cert-card:hover {
  box-shadow: 0 6px 18px rgba(44, 44, 42, 0.07);
}

/* 立体倾斜（Tilt card）：transform 由 motion.js 接管，这里只负责回正的手感 */
.cert-card {
  transform-style: preserve-3d;
  --mx: 50%;
  --my: 50%;
}
.cert-card.tilt-back { transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out); }
/* 光标位置的柔光，让倾斜有可感知的厚度 */
.cert-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
  background: radial-gradient(
    220px circle at var(--mx) var(--my),
    rgba(24, 95, 165, 0.07),
    transparent 62%
  );
}
.cert-card:hover::after { opacity: 1; }
.cert-card { position: relative; }

/* 磁吸按钮（Magnetic button）：位移由 motion.js 计算 */
button.primary {
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur) var(--ease-spring),
    box-shadow var(--dur) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}
button.primary:hover { box-shadow: 0 6px 16px rgba(24, 95, 165, 0.22); }
button.primary:active { transform: scale(0.985); }

/* 状态变化（State change）：进度条从 0 增长，锚定后变色 */
.progress-bar i {
  transition: width 720ms var(--ease-out), background var(--dur) var(--ease-out);
}

/* 键盘焦点（Focus-visible）：与悬停共用同一套颜色语言，但用可见焦点环 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
.video-item:focus-visible,
.cert-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 减少动效（Reduced motion）：去掉所有位移与循环，只保留必要的状态切换 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .line-reveal > span { transform: none; opacity: 1; }
  .enter { opacity: 1; transform: none; }
  .video-item:hover { transform: none; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; max-height: 420px; }
}
@media (max-width: 820px) {
  html, body { height: auto; }
  .app { height: auto; }
  .layout { display: flex; flex-direction: column; overflow: visible; }
  .sidebar, .stage, .inspector { overflow: visible; }
  .cert-list { overflow: visible; }
  /* 视频列表在窄屏依然保持 3 行高度，只是行高略收 */
  :root { --video-row-h: 74px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .chart-card { min-height: 300px; }
  .inspector { max-height: none; }
}
@media (hover: none) {
  /* 触屏：没有持续悬停，关掉跟随光与位移类反馈 */
  .cert-card::after { display: none; }
  .video-item:hover { transform: none; }
}
