/* ============ 基础 ============ */
:root {
  --ink: #10161d;
  --ink-2: #333f4d;
  --muted: #6b7787;
  --line: #e3e8ef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --accent: #1a56db;
  --accent-dark: #1442ad;
  --accent-soft: #eaf0ff;
  --danger: #d92d20;
  --warn: #b54708;
  --ok: #067647;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 17px; color: var(--ink); letter-spacing: .2px;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #34a0f7);
  transform: rotate(45deg);
}
.topbar nav { display: flex; gap: 6px; }
.topbar nav a {
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  padding: 7px 13px; border-radius: 9px;
}
.topbar nav a:hover { background: #eef2f8; text-decoration: none; }
.topbar nav a.active { color: var(--accent); background: var(--accent-soft); }

/* ============ 主视觉 ============ */
.hero { padding: 54px 0 10px; }
.hero-inner {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center;
}
.hero h1 {
  margin: 0 0 16px; font-size: 40px; line-height: 1.28; letter-spacing: -0.5px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin: 0; font-size: 16.5px; color: var(--muted); max-width: 520px; }
.hero-art img { width: 100%; height: auto; display: block; }
.hero-note {
  margin-top: 22px; font-size: 12.5px; color: var(--muted);
  border-left: 3px solid var(--line); padding-left: 10px;
}

/* ============ 上传卡片 ============ */
.upload { padding: 30px 0 60px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
#dropzone {
  border: 2px dashed #c9d4e3; background: #fbfcfe;
  padding: 46px 24px; text-align: center; cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
#dropzone:hover, #dropzone.dragover {
  border-color: var(--accent); background: var(--accent-soft);
}
#dropzone.dragover { transform: scale(1.005); }
.dz-icon {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: 14px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.dz-icon svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 2; }
.dz-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.dz-sub { font-size: 13.5px; color: var(--muted); }
.dz-types { margin-top: 14px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  font-size: 12px; color: var(--ink-2); background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
}

/* 已选文件 */
.file-state {
  margin-top: 14px; padding: 14px 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; gap: 12px;
}
.file-state .fname { font-weight: 600; font-size: 14.5px; word-break: break-all; }
.file-state .fmeta { font-size: 12.5px; color: var(--muted); }
.file-state .grow { flex: 1; min-width: 0; }
.link-btn {
  background: none; border: none; color: var(--muted); font-size: 13px;
  cursor: pointer; padding: 4px 8px; border-radius: 7px;
}
.link-btn:hover { background: #eef2f8; color: var(--ink); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 15px; font-weight: 600; font-family: inherit;
  padding: 11px 20px; border-radius: 11px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
}
.btn:hover { background: #f7f9fc; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(26, 86, 219, .28);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:disabled {
  background: #c3cddb; border-color: #c3cddb; box-shadow: none;
  cursor: not-allowed; transform: none;
}
.btn-lg { width: 100%; padding: 15px 20px; font-size: 16.5px; margin-top: 16px; border-radius: 12px; }
.btn-ghost { background: #fff; }

.hint { margin-top: 12px; font-size: 13px; color: var(--muted); text-align: center; min-height: 20px; }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }

/* ============ 页脚 ============ */
footer {
  border-top: 1px solid var(--line); background: #fff;
  padding: 34px 0 40px; margin-top: 10px;
}
.footer-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 12px; }
.links { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.links a {
  font-size: 13.5px; color: var(--ink-2); background: #f4f6f9;
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 13px; display: inline-block;
}
.links a:hover { background: var(--accent-soft); border-color: #c7d7f7; color: var(--accent); text-decoration: none; }
.footer-note { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.8; }

/* ============ 密码遮罩 ============ */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 22, 29, .55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gate-box {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px;
  padding: 32px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .28); text-align: center;
}
.gate-icon { font-size: 30px; margin-bottom: 10px; }
.gate-box h2 { margin: 0 0 8px; font-size: 20px; }
.gate-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--muted); }
.gate-box input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 11px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.gate-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26, 86, 219, .14); }
.gate-box .btn-primary { width: 100%; margin-top: 12px; }
.gate-error { margin: 12px 0 0; font-size: 13px; color: var(--danger); min-height: 18px; }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(16, 22, 29, .5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  width: 100%; max-width: 520px; background: #fff; border-radius: 18px;
  padding: 28px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}
.modal-box h3 { margin: 0 0 14px; font-size: 19px; }
.modal-warn {
  background: #fff8eb; border: 1px solid #fde4b3; color: #8a5a00;
  border-radius: 11px; padding: 14px 16px; font-size: 14px; line-height: 1.75; margin: 0 0 22px;
}
.modal-warn strong { color: #7a4d00; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }
.modal-actions .btn { min-width: 96px; }

/* ============ 进度 ============ */
.progress-wrap {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(244, 246, 249, .97);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.progress-box { width: 100%; max-width: 560px; text-align: center; }
.progress-box h3 { margin: 0 0 8px; font-size: 20px; }
.progress-step { font-size: 14px; color: var(--muted); margin: 0 0 24px; min-height: 22px; }
.bar-track {
  height: 10px; background: #e1e7f0; border-radius: 99px; overflow: hidden; position: relative;
}
.bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), #4f9bf5);
  border-radius: 99px; transition: width .35s ease;
}
.bar-fill.done { background: linear-gradient(90deg, #067647, #22b573); }
.progress-pct { margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-log {
  margin-top: 22px; max-height: 150px; overflow: auto; text-align: left;
  font-size: 12.5px; color: var(--muted); background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.75;
}

/* ============ 报告页 ============ */
.report-main { padding: 34px 0 70px; }
.report-head { margin-bottom: 22px; }
.report-head h1 { margin: 0 0 6px; font-size: 27px; letter-spacing: -.3px; }
.report-meta { font-size: 13px; color: var(--muted); }
.score-card {
  background: linear-gradient(135deg, #17233a, #23406e);
  color: #fff; border-radius: var(--radius); padding: 26px 28px;
  display: flex; align-items: center; gap: 28px; margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(23, 35, 58, .22);
}
.score-num { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.score-num small { font-size: 16px; font-weight: 500; opacity: .65; margin-left: 4px; letter-spacing: 0; }
.score-side { flex: 1; }
.score-level { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.score-level.tag-ok { color: #6ee7a8; }
.score-level.tag-mid { color: #ffd166; }
.score-level.tag-bad { color: #ff8f85; }
.score-bar { height: 8px; background: rgba(255, 255, 255, .16); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.score-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #6ee7a8, #4f9bf5); border-radius: 99px; }

.report-body {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 40px; box-shadow: var(--shadow);
}
.report-body h2 {
  font-size: 19px; margin: 34px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line); letter-spacing: -.2px;
}
.report-body h2:first-child { margin-top: 0; }
.report-body h3 { font-size: 15.5px; margin: 24px 0 8px; }
.report-body p { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); }
.report-body ul, .report-body ol { margin: 0 0 14px; padding-left: 22px; }
.report-body li { margin-bottom: 6px; font-size: 15px; color: var(--ink-2); }
.report-body strong { color: var(--ink); font-weight: 700; }
.report-body blockquote {
  margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--accent);
  background: #f7f9fd; color: var(--ink-2); border-radius: 0 8px 8px 0;
}
.report-body hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }
.sev { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; margin-right: 8px; vertical-align: 2px; }
.sev-high { background: #fee4e2; color: var(--danger); }
.sev-mid { background: #fef0c7; color: var(--warn); }
.sev-low { background: #dcfae6; color: var(--ok); }

.report-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.report-actions .btn { flex: 1; min-width: 180px; }

/* ============ 说明页 ============ */
.guide-main { padding: 60px 0 80px; }
.guide-box {
  max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 46px 48px; text-align: center;
}
.guide-box h1 { font-size: 25px; margin: 0 0 28px; }
.guide-box p { font-size: 15.5px; color: var(--ink-2); line-height: 2; margin: 0 0 20px; text-align: justify; }
.guide-box p.warn-line { color: var(--danger); font-weight: 600; text-align: center; }
.guide-box .btn { margin-top: 12px; }

/* ============ 打印 / 导出 PDF ============ */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; }
  .topbar, footer, .report-actions, .gate, .modal, .progress-wrap { display: none !important; }
  .report-main { padding: 0; }
  .report-body { border: none; box-shadow: none; padding: 0; }
  .score-card { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report-body h2 { page-break-after: avoid; }
  .report-body h3 { page-break-after: avoid; }
  a { color: var(--ink); }
}

/* ============ 窄屏 ============ */
@media (max-width: 860px) {
  .hero { padding: 34px 0 6px; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero h1 { font-size: 30px; }
  .hero-art { max-width: 340px; margin: 0 auto; }
  .report-body { padding: 24px 20px; }
  .score-card { padding: 20px; gap: 18px; flex-wrap: wrap; }
  .guide-box { padding: 30px 22px; }
  .topbar nav a { padding: 7px 9px; font-size: 13.5px; }
  .brand { font-size: 15.5px; }
}
