:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1b1f24;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

a { color: var(--accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 22px 80px; }

header.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px;
}
header.top h1 { font-size: 26px; margin: 0; letter-spacing: .5px; }
header.top .sub { color: var(--muted); font-size: 15px; }
header.top .spacer { flex: 1; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 20px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 11px 18px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn.secondary {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
}
.btn.ghost { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--muted);
  transition: .15s ease;
}
.drop.over, .drop:hover { border-color: var(--accent); color: var(--accent); background: #f3f7ff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 14px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: #eef2f6; color: var(--muted); font-size: 13px;
}
.pill.ok { background: #e7f6ee; color: var(--ok); }
.pill.warn { background: #fdf3e7; color: var(--warn); }

.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; word-break: break-all; }

.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.linkrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #101828; color: #fff; padding: 12px 20px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: .2s ease; font-size: 15px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* reader */
.reader-body { background: #2b2f36; }
.reader-page { max-width: 900px; margin: 0 auto; padding: 18px 12px 120px; }
.doc-page { background: #fff; margin: 16px 0; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.doc-page canvas { display: block; width: 100%; height: auto; }
.reader-topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(20,22,26,.92);
  color: #dfe3e8; padding: 10px 16px; display: flex; gap: 14px; align-items: center;
  backdrop-filter: blur(6px);
}
.reader-topbar .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-topbar .meta { color: #9aa4b2; font-size: 14px; }
video.doc-video { width: 100%; border-radius: 10px; background: #000; }

/* replay */
.replay-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
@media (max-width: 900px) { .replay-grid { grid-template-columns: 1fr; } }

.stage {
  position: relative; background: #22262c; border-radius: var(--radius);
  height: min(64vh, 620px); overflow: hidden; border: 1px solid #14171b;
}
.stage .paper {
  position: absolute; left: 8%; right: 8%; top: 6%; bottom: 6%;
  background: #fff; border-radius: 6px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.stage .paper-inner { position: absolute; left: 0; right: 0; padding: 6% 7%; color: #98a2b3; font-size: 13px; }
.stage .paper-line { height: 10px; background: #eef1f5; border-radius: 4px; margin: 10px 0; }
.stage .paper-line.short { width: 62%; }
.stage .cursor {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 4px rgba(255,59,48,.22);
  transform: translate(var(--x, 50%), var(--y, 50%)); pointer-events: none;
}
.stage .click-ripple {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border: 3px solid rgba(255,59,48,.7); border-radius: 50%;
  animation: ripple .6s ease-out forwards; pointer-events: none;
}
@keyframes ripple { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.stage .hud {
  position: absolute; left: 12px; bottom: 12px; right: 12px;
  display: flex; gap: 10px; color: #cbd5e1; font-size: 13px;
  background: rgba(10,12,15,.55); padding: 8px 12px; border-radius: 10px;
}

.controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.controls input[type=range] { flex: 1; min-width: 160px; }
.timeline { width: 100%; height: 8px; border-radius: 999px; background: #e4e7ec; overflow: hidden; margin-top: 10px; }
.timeline .fill { height: 100%; width: 0; background: var(--accent); }

.stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.stat:last-child { border-bottom: 0; }
.stat b { font-weight: 600; }
