/* ========= 人脸对比工具页 ========= */
* { box-sizing: border-box; }

.tool-body {
  margin: 0; min-height: 100vh;
  background: #f4f6fa;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  color: #2b3a52;
}

/* hidden 属性必须生效(防止 display 样式覆盖) */
.tool-body [hidden] { display: none !important; }

svg { display: inline-block; vertical-align: middle; }

/* ---- 进入工具加载层 ---- */
.tool-loading {
  position: fixed; inset: 0; z-index: 999;
  background: #fff;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity .35s ease;
}
.tool-loading.hide { opacity: 0; pointer-events: none; }
.tool-spinner {
  width: 42px; height: 42px;
  border: 4px solid #e3ecf8;
  border-top-color: #6FA8FF;
  border-radius: 50%;
  animation: tool-spin .8s linear infinite;
}
@keyframes tool-spin { to { transform: rotate(360deg); } }
.tool-loading-text { font-size: 14px; color: #98a1b3; letter-spacing: 1px; }

/* 小转圈(检测中) */
.mini-spinner {
  width: 13px; height: 13px;
  border: 2px solid rgba(30, 58, 95, .2);
  border-top-color: #1e3a5f;
  border-radius: 50%;
  animation: tool-spin .7s linear infinite;
  flex-shrink: 0;
}

/* ---- 顶栏 ---- */
.tool-topbar {
  height: 56px; padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid #e8edf5;
  display: flex; align-items: center; justify-content: space-between;
}
.tool-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: #5c6b84; text-decoration: none;
  transition: color .15s;
}
.tool-back:hover { color: #1e3a5f; }
.tool-back svg { width: 16px; height: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-brand {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #1e3a5f;
  background: #f0f4fa;
  padding: 4px 14px; border-radius: 20px;
  border: 1px solid #e2e9f2;
}
.topbar-brand svg { width: 13px; height: 13px; }
.tool-no { font-size: 13px; color: #98a1b3; }
.tool-no b { color: #1e3a5f; font-family: Consolas, monospace; }

/* ---- 主容器 ---- */
.tool-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

/* ---- 头部 ---- */
.tool-head { text-align: center; margin-bottom: 28px; }
.tool-head h1 {
  margin: 0 0 8px;
  font-size: 26px; font-weight: 700; color: #1e3a5f;
  display: inline-flex; align-items: center; gap: 10px;
}
.tool-head h1 svg { width: 26px; height: 26px; color: #1e3a5f; }
.tool-head p { margin: 0; font-size: 14px; color: #6b7890; }

/* ---- 上传区卡片 ---- */
.upload-section {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 2px 8px rgba(30, 58, 95, .05);
}
.upload-row {
  display: flex; align-items: stretch;
  justify-content: center; gap: 20px;
}

/* 上传框 */
.upload-box {
  flex: 1; max-width: 280px;
  min-height: 220px;
  background: #fafbfd;
  border: 2px dashed #d5deeb;
  border-radius: 16px;
  padding: 20px 16px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
  position: relative;
}
.upload-box:hover,
.upload-box.drag-over {
  border-color: #1e3a5f;
  background: #f4f8fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(30, 58, 95, .08);
}
.face-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: #eaf1fb;
  border: 2px solid #d5deeb;
  display: flex; align-items: center; justify-content: center;
  color: #8aa3bc;
  margin-bottom: 12px;
  transition: all .2s;
}
.face-icon svg { width: 30px; height: 30px; }
.upload-box:hover .face-icon {
  border-color: #1e3a5f; color: #1e3a5f; background: #dce6f2;
}
.box-title { font-size: 15px; font-weight: 600; color: #1e3a5f; margin-bottom: 2px; }
.box-sub { font-size: 13px; color: #6b7890; margin-bottom: 8px; }
.box-meta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: #7a8ca3;
  background: #f0f4fa;
  padding: 3px 14px; border-radius: 20px;
  border: 1px solid #e8edf5;
}
.box-meta svg { width: 12px; height: 12px; }
.box-drag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: #b6bfd0;
  margin-top: 8px;
}
.box-drag svg { width: 12px; height: 12px; }

/* 传图后:隐藏占位内容 */
.upload-box.has-image .face-icon,
.upload-box.has-image .box-title,
.upload-box.has-image .box-sub,
.upload-box.has-image .box-meta,
.upload-box.has-image .box-drag { display: none; }

.preview-img {
  width: 100%; height: 150px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
}
.preview-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  margin-top: 8px;
}
.preview-status.ok { color: #2e9e5b; }
.preview-status.ok svg { width: 14px; height: 14px; }
.preview-status.checking { color: #1e3a5f; font-weight: 500; }

/* 删除按钮 */
.remove-btn {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; padding: 0;
  background: rgba(30, 58, 95, .7);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  z-index: 2;
}
.remove-btn:hover { background: rgba(30, 58, 95, .95); }
.remove-btn svg { width: 13px; height: 13px; }

/* VS 徽章 */
.vs-badge {
  flex-shrink: 0;
  width: 52px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
}
.vs-dot { width: 6px; height: 6px; border-radius: 50%; background: #cdd9e8; }
.vs-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: #eaf1fb;
  border: 2px solid #d5deeb;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #1e3a5f; letter-spacing: 1px;
}

/* ---- 操作区 ---- */
.tool-actions {
  text-align: center;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #eef2f7;
}
.compare-progress {
  height: 6px;
  background: #eef2f7;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}
.compare-progress-fill {
  height: 100%; width: 0;
  background: #1e3a5f;
  border-radius: 3px;
  transition: width .2s ease;
}
.btn-compare {
  display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 48px;
  border: none; border-radius: 10px;
  background: #1e3a5f; color: #fff;
  font-size: 16px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .5px;
  box-shadow: 0 4px 16px rgba(30, 58, 95, .25);
  transition: background .2s, box-shadow .2s, transform .15s;
}
.btn-compare svg { width: 18px; height: 18px; }
.btn-compare .arrow svg { width: 15px; height: 15px; }
.btn-compare:hover:not(:disabled) {
  background: #2a4f7a;
  box-shadow: 0 8px 28px rgba(30, 58, 95, .32);
  transform: translateY(-2px);
}
.btn-compare:hover:not(:disabled) .arrow { transform: translateX(4px); }
.btn-compare .arrow { display: inline-flex; transition: transform .2s; }
.btn-compare:active:not(:disabled) { transform: scale(.96); }
.btn-compare:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.tool-footer-links {
  display: flex; justify-content: center; gap: 28px;
  margin-top: 14px;
}
.tool-footer-links a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #98a1b3; text-decoration: none;
  transition: color .15s;
}
.tool-footer-links a:hover { color: #1e3a5f; }
.tool-footer-links svg { width: 14px; height: 14px; }

/* ---- 结果卡片 ---- */
.result-card {
  display: none;
  margin-top: 22px;
  padding: 24px 32px 20px;
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(30, 58, 95, .06);
}
.result-card:not([hidden]) {
  display: block;
  animation: resultFadeIn .4s ease;
}
@keyframes resultFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-top {
  display: flex; align-items: center;
  gap: 24px; flex-wrap: wrap;
}

/* 分数圆环(conic-gradient 按分数占比着色) */
.score-ring {
  flex-shrink: 0;
  width: 104px; height: 104px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--p) * 1%), #eef2f7 0);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background .8s ease;
}
.score-ring::after {
  content: '';
  position: absolute; inset: 9px;
  background: #fff;
  border-radius: 50%;
}
.score-number {
  position: relative; z-index: 2;
  font-size: 26px; font-weight: 700;
  font-family: Consolas, monospace;
  color: #1e3a5f;
  transition: color .3s;
}
.score-number.same { color: #2e9e5b; }
.score-number.mid  { color: #d99a22; }
.score-number.diff { color: #e35656; }
.score-suffix { font-size: 14px; font-weight: 400; }

.result-info { flex: 1; min-width: 180px; }
.result-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 700;
  padding: 5px 20px 5px 14px;
  border-radius: 40px;
  margin-bottom: 8px;
  transition: all .3s;
}
.result-badge svg { width: 18px; height: 18px; }
.result-badge.same { color: #2e9e5b; background: #e6f6ee; }
.result-badge.mid  { color: #b8860b; background: #fdf5e0; }
.result-badge.diff { color: #e35656; background: #fdeaea; }
.result-verdict { margin: 0; font-size: 14px; color: #6b7890; line-height: 1.7; }

.result-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid #eef2f7;
}
.btn-outline, .btn-primary-sm {
  height: 40px; padding: 0 24px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.btn-outline svg, .btn-primary-sm svg { width: 15px; height: 15px; }
.btn-outline {
  border: 1px solid #d5deeb;
  background: transparent; color: #5c6b84;
}
.btn-outline:hover { border-color: #1e3a5f; color: #1e3a5f; background: #f4f8fd; }
.btn-primary-sm {
  border: none;
  background: #1e3a5f; color: #fff;
}
.btn-primary-sm:hover { background: #2a4f7a; }

.result-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eef2f7;
  font-size: 12px; color: #b6bfd0;
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.result-footer svg { width: 13px; height: 13px; }

/* ---- API 接入条 ---- */
.api-bar {
  margin-top: 22px;
  padding: 12px 20px;
  background: #f0f4fa;
  border: 1px solid #e2e9f2;
  border-left: 4px solid #1e3a5f;
  border-radius: 10px;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 8px 16px;
}
.api-text {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; color: #6b7890;
}
.api-text svg { width: 16px; height: 16px; color: #1e3a5f; flex-shrink: 0; }
.api-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #1e3a5f; font-weight: 500;
  background: #fff;
  padding: 5px 18px; border-radius: 20px;
  border: 1px solid #d5deeb;
  white-space: nowrap;
  transition: all .15s;
}
.api-link:hover { border-color: #1e3a5f; background: #f8fafc; }
.api-link svg { width: 13px; height: 13px; }

/* ---- 响应式 ---- */
@media (max-width: 700px) {
  .tool-topbar { padding: 0 16px; }
  .tool-wrap { padding: 20px 16px 32px; }
  .upload-section { padding: 20px 16px; }
  .upload-row { flex-direction: column; align-items: center; gap: 16px; }
  .upload-box { max-width: 100%; width: 100%; min-height: 170px; }
  .vs-badge { flex-direction: row; width: 100%; gap: 12px; padding: 4px 0; }
  .vs-dot { display: none; }
  .vs-circle { width: 36px; height: 36px; font-size: 13px; }
  .btn-compare { width: 100%; justify-content: center; padding: 0 20px; }
  .api-bar { flex-direction: column; align-items: flex-start; }
  .topbar-brand { display: none; }
  .result-card { padding: 20px; }
  .result-top { flex-direction: column; align-items: center; text-align: center; gap: 14px; }
  .result-actions { justify-content: center; }
  .score-ring { width: 88px; height: 88px; }
  .score-number { font-size: 22px; }
}
@media (max-width: 420px) {
  .tool-head h1 { font-size: 21px; }
  .face-icon { width: 52px; height: 52px; }
  .face-icon svg { width: 24px; height: 24px; }
}
