/* ============================================================
   校园人脸识别系统 — Design System v2.0
   设计基调: 深空蓝灰 + 科技靛蓝
   ============================================================ */

/* ---------- CSS Variables (Design System) ---------- */
:root {
  /* 品牌色 */
  --brand-600: #4338CA;
  --brand-500: #4F46E5;
  --brand-400: #6366F1;
  --brand-300: #818CF8;
  --brand-100: #E0E7FF;
  --brand-50:  #EEF2FF;

  /* 功能色 */
  --success-500: #10B981;
  --success-100: #D1FAE5;
  --success-50:  #ECFDF5;
  --warning-500: #F59E0B;
  --warning-100: #FEF3C7;
  --warning-50:  #FFFBEB;
  --danger-500:  #EF4444;
  --danger-100:  #FEE2E2;
  --danger-50:   #FEF2F2;

  /* 文字色 */
  --text-900: #111827;
  --text-800: #1F2937;
  --text-700: #374151;
  --text-600: #4B5563;
  --text-500: #6B7280;
  --text-400: #9CA3AF;
  --text-300: #D1D5DB;
  --text-200: #E5E7EB;

  /* 背景 */
  --bg-page: #F0F2F5;
  --bg-card: #FFFFFF;
  --bg-hover: #F8FAFC;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.03);
  --shadow-nav: 0 1px 3px rgba(0,0,0,0.05), inset 0 -1px 0 rgba(0,0,0,0.05);

  /* 过渡 */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: clamp(14px, 2.5vw, 16px);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(79, 70, 229, 0.06), transparent 60%),
    var(--bg-page);
  min-height: 100vh;
  color: var(--text-700);
  line-height: 1.6;
  padding-top: 56px; /* 固定导航栏高度 */
}

/* ---------- Safe Area ---------- */
@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom, 0); padding-top: calc(56px + env(safe-area-inset-top, 0)); }
}

/* ============================================================
   Navigation Header (fixed, 56px)
   ============================================================ */
.nav-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 56px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-nav);
  border-bottom: 1px solid #e8e8e8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  transition: box-shadow var(--transition-base);
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.nav-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.nav-title {
  font-size: 16px; font-weight: 600; color: var(--text-800);
  letter-spacing: -0.01em;
}
.brand-version {
  font-size: 11px; font-weight: 600;
  color: var(--brand-500);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  padding: 1px 8px;
  border-radius: 9999px;
  line-height: 1.5;
}
.divider-vertical {
  width: 1px; height: 20px;
  background: var(--text-200);
  margin: 0 4px;
}
.btn-nav svg { width: 16px; height: 16px; flex-shrink: 0; }

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

.nav-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  color: #065f46;
  background: var(--success-50);
  border: 1px solid var(--success-100);
}
.nav-status::before {
  content: ''; display: inline-block;
  width: 7px; height: 7px;
  background: var(--success-500);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px;
  border: none; border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-option svg { width: 15px; height: 15px; flex-shrink: 0; }
.tips-card summary svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--brand-500); }

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  color: var(--text-700);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-300);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-500);
  padding: 8px 14px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-700);
}

/* Danger */
.btn-danger {
  background: var(--bg-card);
  border: 1px solid #FECACA;
  color: var(--danger-500);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-50);
  border-color: var(--danger-500);
}

/* Nav buttons */
.btn-nav {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  border: none;
  color: var(--text-600);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-nav:hover {
  background: var(--bg-hover);
  color: var(--text-700);
}
.btn-nav.btn-nav-primary {
  color: var(--brand-500);
  border: 1.5px solid rgba(79, 70, 229, 0.2);
}
.btn-nav.btn-nav-primary:hover {
  background: var(--brand-50);
  border-color: var(--brand-500);
}
.btn-nav.btn-nav-logout {
  color: var(--text-500);
}
.btn-nav.btn-nav-logout:hover {
  background: var(--danger-50);
  color: var(--danger-500);
}

/* ============================================================
   Main Container
   ============================================================ */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ============================================================
   Waterfall Layout（单列瀑布流）
   ============================================================ */
.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

/* 统一面板卡片 */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-2xl);
  padding: 20px 24px 24px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-title {
  font-size: 16px; font-weight: 700; color: var(--text-900);
  letter-spacing: -0.01em;
}
.panel-desc {
  font-size: 12px; color: var(--text-500); margin-top: 2px;
}

@media (max-width: 480px) {
  .panel { padding: 16px; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Page title section */
.page-hero {
  text-align: center;
  margin-bottom: 32px;
}
.page-hero h1 {
  font-size: 28px; font-weight: 700;
  color: var(--text-900);
  letter-spacing: -0.02em;
}
.page-hero p {
  font-size: 14px; color: var(--text-500);
  margin-top: 8px;
}

/* ============================================================
   Upload Zone
   ============================================================ */

/* Segmented Control 分段控制器 */
.upload-options {
  position: relative;
  width: fit-content;
  margin: 0;
  display: flex; gap: 0;
  background: var(--text-200);
  border-radius: 9999px;
  padding: 4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.btn-option {
  position: relative; z-index: 1;
  padding: 9px 22px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-600);
  cursor: pointer;
  transition: color var(--transition-fast);
  font-weight: 600; font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
}
.btn-option:hover { color: var(--brand-500); }
.btn-option.active {
  color: var(--brand-600);
}

/* 滑动滑块（JS 定位） */
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 0;
  background: var(--bg-card);
  border-radius: 9999px;
  box-shadow: var(--shadow-sm);
  transition: left 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

/* Upload box */
.upload-mode { width: 100%; }

.upload-box {
  background: var(--bg-card);
  border: 2px dashed var(--text-200);
  border-radius: var(--radius-2xl);
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.upload-box:hover {
  border-color: var(--brand-500);
  background: var(--brand-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Upload icon area */
.upload-icon-area {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-hover);
  transition: background var(--transition-fast);
}
.upload-box:hover .upload-icon-area {
  background: var(--brand-100);
}
.upload-icon-svg {
  width: 40px; height: 40px;
  color: var(--text-300);
  transition: color var(--transition-fast);
}
.upload-box:hover .upload-icon-svg {
  color: var(--brand-500);
}

/* 拖拽悬停状态 */
.upload-box { position: relative; }
.upload-box.drag-active {
  border: 2px solid var(--brand-500);
  border-style: solid;
  background: var(--brand-50);
  box-shadow: var(--shadow-md);
}
.upload-box.drag-active .upload-icon-area {
  background: var(--brand-100);
  transform: scale(1.1);
}
.upload-box.drag-active .upload-icon-svg { color: var(--brand-500); }
.upload-box.drag-active::after {
  content: '释放以上传';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: var(--brand-600);
  font-size: 16px; font-weight: 700;
  border-radius: inherit;
  pointer-events: none;
}

.upload-box h3 {
  font-size: 16px; font-weight: 600;
  color: var(--text-800); margin-bottom: 6px;
}
.upload-box p {
  font-size: 13px; color: var(--text-500);
  margin-bottom: 0;
}

/* ============================================================
   Tips Card
   ============================================================ */
.tips-card {
  margin: 16px 0 0;
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-xl);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}
.tips-card summary {
  font-size: 16px; font-weight: 600; color: var(--text-700);
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  list-style: none;
}
.tips-card summary::-webkit-details-marker { display: none; }
.tips-card summary::after {
  content: '▾'; margin-left: auto; font-size: 12px;
  color: var(--text-400);
  transition: transform var(--transition-fast);
}
.tips-card[open] summary::after { transform: rotate(180deg); }
.tips-card ul { margin-top: 12px; }
.tips-card ul {
  list-style: none; padding: 0;
}
.tips-card ul li {
  font-size: 13px; color: var(--text-600);
  line-height: 1.8; padding: 2px 0;
}
.tips-card ul li::before {
  content: '•'; color: var(--brand-500);
  display: inline-block; width: 16px; font-weight: 700;
}

/* ============================================================
   Camera
   ============================================================ */
.camera-container { text-align: center; }
.camera-preview { margin-bottom: 16px; }

#cameraVideo {
  width: 100%; max-width: 520px;
  height: auto; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md); background: #000;
}

.camera-controls {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.zoom-controls {
  margin-top: 12px; display: flex; align-items: center;
  justify-content: center; gap: 10px;
  font-size: 13px; color: var(--text-500);
}
.zoom-controls input[type="range"] {
  accent-color: var(--brand-500); width: 160px;
}

.camera-instructions {
  text-align: center; color: var(--text-500); font-size: 13px; margin-top: 10px;
}

/* ============================================================
   Preview
   ============================================================ */
.preview-section {
  text-align: center; margin-top: 20px;
  width: 100%;
}

#imagePreview {
  display: block;
  max-width: 320px; max-height: 320px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.preview-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   Scan Overlay (识别中动画)
   ============================================================ */
.preview-scan-wrap {
  position: relative; display: inline-block;
  margin: 16px 0;
}
.preview-scan-wrap.scanning #imagePreview {
  filter: brightness(0.82) saturate(1.05);
  transition: filter 0.3s ease;
}

/* 扫描覆盖层：与图片本体精确重合（inset: 0，无任何偏移） */
.scan-overlay {
  position: absolute; inset: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  pointer-events: none;
  display: none;
}
.preview-scan-wrap.scanning .scan-overlay {
  display: block;
}

/* ============================================================
   科技感扫描动画（匀速推进式扫描框）
   ============================================================ */

/* 已识别区域：随扫描推进的淡蓝填充（scaleY 合成器动画，零回流） */
.scan-fill {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  transform: scaleY(0);
  transform-origin: top center;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.02), rgba(59, 130, 246, 0.05));
  animation: scanFill 3s linear infinite;
  pointer-events: none;
}
@keyframes scanFill {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

/* 蓝色半透明扫描框：底边即扫描线（高亮+光晕），匀速从上到下 */
.scan-band {
  position: absolute; left: 0; right: 0;
  top: -64px; height: 64px;
  background: linear-gradient(180deg,
    rgba(59, 130, 246, 0) 0%,
    rgba(59, 130, 246, 0.05) 35%,
    rgba(96, 165, 250, 0.14) 50%,
    rgba(59, 130, 246, 0.05) 65%,
    rgba(59, 130, 246, 0) 100%);
  border-bottom: 1.5px solid rgba(125, 180, 255, 0.9);
  box-shadow: 0 4px 16px -4px rgba(59, 130, 246, 0.45);
  animation: scanBand 3s linear infinite;
  pointer-events: none;
}
@keyframes scanBand {
  from { top: -64px; }
  to { top: calc(100% - 64px); }
}

/* 数字识别粒子：发光光点（白色内核+青色光晕）+ 数据短线，错峰闪烁 */
.scan-dot {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #7DD3FC 55%, transparent 100%);
  box-shadow: 0 0 8px 2px rgba(125, 211, 252, 0.85);
  animation: dotTwinkle 1.5s ease-in-out infinite;
  pointer-events: none;
}
.scan-dash {
  position: absolute;
  width: 10px; height: 1.5px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, #BFDBFE 70%, #E0F2FE);
  box-shadow: 0 0 5px rgba(147, 197, 253, 0.7);
  animation: dotTwinkle 1.7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes dotTwinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.6) translateY(2px); }
  50% { opacity: 1; transform: scale(1.3) translateY(-2px); }
}

/* 四角边框装饰 */
.scan-corners {
  position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px;
  pointer-events: none;
}
.scan-corner {
  position: absolute; width: 24px; height: 24px;
  border-color: var(--brand-500); border-style: solid;
  opacity: 0.6; transition: opacity 0.5s;
}
.preview-scan-wrap.scanning .scan-corner {
  animation: cornerBreathe 2s ease-in-out infinite;
  filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.85));
}
@keyframes cornerBreathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.scan-corner.tl { top: 0; left: 0; border-width: 2px 0 0 2px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-radius: 0 0 4px 0; }

/* 扫描状态文案 */
.scan-status {
  display: none;
  margin-top: 12px;
  text-align: center;
  color: var(--text-600);
  font-size: 14px; font-weight: 500;
}
.preview-scan-wrap.scanning ~ .scan-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.scan-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-500);
  animation: scan-dot-blink 0.8s ease-in-out infinite;
}
.scan-status-dot:nth-child(2) { animation-delay: 0.15s; }
.scan-status-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes scan-dot-blink {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 扫描进度条（流光效果） */
.scan-progress {
  display: none;
  width: 100%; max-width: 320px; height: 4px;
  margin: 10px auto 0;
  background: var(--text-200);
  border-radius: 2px; overflow: hidden;
}
.preview-scan-wrap.scanning ~ .scan-progress {
  display: block;
}
.scan-progress-bar {
  width: 40%; height: 100%;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-500), var(--brand-400));
  border-radius: 2px;
  animation: scan-progress-slide 1.5s ease-in-out infinite;
  position: relative;
}
@keyframes scan-progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* 取消按钮 */
.scan-cancel {
  display: none;
  margin-top: 14px;
}
.preview-scan-wrap.scanning ~ .scan-cancel {
  display: block; text-align: center;
}

/* ============================================================
   Results Section
   ============================================================ */
.result-section {
  width: 100%;
  padding-top: 0;
}

/* Annotated Image */
.annotated-image-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: box-shadow var(--transition-base);
}
.annotated-image-container:hover {
  box-shadow: var(--shadow-lg);
}
.annotated-image-container:hover .image-zoom-hint {
  opacity: 1;
}
.annotated-image {
  width: 100%; display: block;
  border-radius: var(--radius-xl);
}

.image-zoom-hint {
  position: absolute; bottom: 28px; right: 28px;
  background: rgba(0,0,0,0.6);
  color: #fff; font-size: 12px;
  padding: 5px 12px; border-radius: 20px;
  opacity: 0; transition: opacity var(--transition-fast);
  pointer-events: none;
}

/* 恢复上次识别结果的提示条 */
.restored-notice {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-hover);
  border: 1px dashed var(--text-300);
  color: var(--text-600);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

/* 标注图链接过期后的降级提示 */
.annotated-expired {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover);
  border: 1px dashed var(--text-300);
  color: var(--text-500);
  font-size: 14px;
  padding: 24px 16px;
  border-radius: var(--radius-2xl);
  margin-bottom: 24px;
}


/* Result heading */
.result-heading {
  font-size: 16px; font-weight: 600; color: var(--text-700);
  margin-bottom: 16px;
}

/* ============================================================
   Face Cards
   ============================================================ */
.face-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.face-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--text-200);
  transition: all var(--transition-base);
  overflow: hidden;
}
.face-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.face-card.face-matched {
  border-color: rgba(16, 185, 129, 0.25);
}
.face-card.face-unmatched {
  border-color: rgba(245, 158, 11, 0.25);
}

/* 卡片头部：头像 + 身份 + 大号分数 */
.face-card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 0;
}
.face-avatar {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}
.face-avatar.warn {
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.face-avatar.unknown {
  background: linear-gradient(135deg, #9CA3AF, #D1D5DB);
  box-shadow: none;
}
.face-identity { flex: 1; min-width: 0; }
.face-name {
  font-size: 17px; font-weight: 700; color: var(--text-900);
  letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.face-identity-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 3px;
}
.face-sub { font-size: 12px; color: var(--text-400); }
.face-score-block { text-align: right; flex-shrink: 0; }
.face-score {
  display: block;
  font-size: 22px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.face-score-label {
  display: block;
  font-size: 11px; color: var(--text-400); margin-top: 2px;
}

.face-card-body { padding: 14px 20px 20px; }

/* 相似度进度条（8px 圆角胶囊） */
.progress-bar-md { height: 8px; border-radius: 9999px; }

/* 元数据网格：桌面 4 列 / 窄屏 2×2 */
.face-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.face-meta-grid-2 { grid-template-columns: 1fr 1fr; }
.face-meta-item {
  background: var(--bg-hover);
  border: 1px solid #F3F4F6;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  min-width: 0;
}
.face-meta-item .label {
  display: block; font-size: 11px; color: var(--text-400);
}
.face-meta-item .value {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--text-800);
  margin-top: 2px;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* 低置信度警示：左侧琥珀竖条 */
.face-card.face-card-warn {
  border-left: 3px solid var(--warning-500);
}

@media (max-width: 640px) {
  .face-meta-grid { grid-template-columns: 1fr 1fr; }
}

/* 窄屏适配：结果卡头部（头像/身份/分数）不互相遮挡 */
@media (max-width: 480px) {
  .face-card-head { gap: 10px; padding: 14px 16px 0; }
  .face-avatar { width: 36px; height: 36px; font-size: 15px; }
  .face-score { font-size: 18px; }
  .face-identity-meta { flex-wrap: wrap; gap: 4px 8px; }
  .face-card-body { padding: 12px 16px 16px; }
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px; font-weight: 600;
  line-height: 1.5;
}
.badge-success {
  background: var(--success-50); color: #059669;
  border: 1px solid var(--success-100);
}
.badge-warning {
  background: var(--warning-50); color: #D97706;
  border: 1px solid var(--warning-100);
}
.badge-danger {
  background: var(--danger-50); color: #DC2626;
  border: 1px solid var(--danger-100);
}

/* 详情折叠开关（其他候选） */
.face-details-toggle {
  display: flex; align-items: center; gap: 6px;
  margin: 14px auto 0;
  padding: 6px 16px;
  border: 1px solid var(--text-200);
  border-radius: 9999px;
  background: transparent;
  font-size: 12px; color: var(--text-500);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.face-details-toggle:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-500);
}
.face-details-toggle .arrow {
  transition: transform var(--transition-fast);
  font-size: 10px;
}
.face-details-toggle.open .arrow {
  transform: rotate(180deg);
}

.face-card-details {
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-base), margin var(--transition-base);
}
.face-card-details.collapsed {
  max-height: 0; opacity: 0; margin-top: 0;
}
.face-card-details.expanded {
  max-height: 600px; opacity: 1; margin-top: 12px;
}

/* Progress bar for similarity */
.progress-bar {
  width: 100%; height: 8px;
  background: var(--text-200);
  border-radius: 4px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar-fill.low { background: var(--danger-500); }
.progress-bar-fill.medium { background: var(--warning-500); }
.progress-bar-fill.high { background: var(--success-500); }
.progress-bar-fill.primary { background: var(--brand-500); }

.other-matches {
  margin-top: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--text-200);
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-base), margin var(--transition-base);
}
.other-matches.collapsed {
  max-height: 0; padding-top: 0; padding-bottom: 0;
  margin-top: 0; opacity: 0; border-width: 0;
}
.other-matches.expanded {
  max-height: 400px; opacity: 1;
}
.other-matches h5 {
  font-size: 12px; color: var(--text-500); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.other-matches ul { list-style: none; padding: 0; }
.other-matches ul li {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-600); padding: 3px 0;
}
.other-matches ul li .rank {
  color: var(--brand-500); font-weight: 600; font-size: 12px; min-width: 16px;
}

/* Result messages */
.result-success {
  color: #065f46; background: var(--success-50);
  padding: 20px; border-radius: var(--radius-xl);
  border-left: 4px solid var(--success-500);
}
.result-error {
  color: #991b1b; background: var(--danger-50);
  padding: 20px; border-radius: var(--radius-xl);
  border-left: 4px solid var(--danger-500);
}
.result-info {
  background: #EFF6FF; border-left: 4px solid var(--brand-500);
  padding: 20px; border-radius: var(--radius-xl);
}
.result-success h4, .result-error h4, .result-info h4 { margin-bottom: 8px; }

/* 结果区空状态 */
.result-empty {
  background: var(--bg-hover);
  border: 2px dashed var(--text-200);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-400);
}
.result-empty svg {
  width: 44px; height: 44px; margin-bottom: 12px;
  stroke: var(--text-300);
}
.result-empty-title {
  font-size: 15px; font-weight: 600; color: var(--text-700);
}
.result-empty-sub {
  font-size: 13px; color: var(--text-400); margin-top: 4px;
}

/* ============================================================
   一体化统计带（Stats Strip）
   ============================================================ */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.stats-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  min-width: 0;
}
.stats-cell + .stats-cell {
  border-left: 1px solid #F3F4F6;
}
.stats-cell-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tint-bg);
  color: var(--tint);
}
.stats-cell-icon svg { width: 17px; height: 17px; }
.stats-cell-body { min-width: 0; }
.stats-num {
  display: block;
  font-size: 22px; font-weight: 700; color: var(--text-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stats-cell-label {
  display: block;
  font-size: 12px; color: var(--text-500); margin-top: 1px;
}
.stats-cell-trend {
  display: block;
  font-size: 11px; font-weight: 500; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats-cell-trend.up { color: #059669; }
.stats-cell-trend.mid { color: #D97706; }
.stats-cell-trend.down { color: #DC2626; }
.stats-cell-trend.neutral { color: var(--text-400); }

@media (max-width: 480px) {
  .stats-strip { grid-template-columns: 1fr; }
  .stats-cell { padding: 12px 16px; }
  .stats-cell + .stats-cell {
    border-left: none;
    border-top: 1px solid #F3F4F6;
  }
}

/* ============================================================
   Skeleton 骨架屏
   ============================================================ */
.skeleton-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.skeleton-block {
  height: 96px; border-radius: var(--radius-xl);
}
.skeleton-card { margin-bottom: 16px; }
.skeleton-card-inner {
  background: var(--bg-card);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-xl);
  padding: 16px;
}
.skeleton-line {
  height: 14px; border-radius: 4px; margin-bottom: 10px;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-bar {
  height: 6px; border-radius: 3px; width: 100%;
}
.skeleton-block, .skeleton-line, .skeleton-bar {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   错误抖动
   ============================================================ */
@keyframes shake3 {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.error-shake { animation: shake3 0.5s ease; }

/* ============================================================
   URL Search
   ============================================================ */
/* URL 识别模式面板 */
.url-mode-box {
  background: var(--bg-hover);
  border: 1px solid var(--text-200);
  border-radius: var(--radius-xl);
  padding: 20px;
}
.url-mode-hint {
  font-size: 13px; color: var(--text-500);
  margin-bottom: 14px;
}

.url-input-group { display: flex; gap: 12px; }

.url-input {
  flex: 1; height: 44px;
  padding: 0 16px;
  border: 1px solid var(--text-200);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  color: var(--text-700);
}
.url-input::placeholder { color: var(--text-400); }
.url-input:hover { border-color: var(--text-300); }
.url-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.url-input:disabled {
  background: #F9FAFB; color: var(--text-400); cursor: not-allowed;
}

/* ============================================================
   Loading Overlay
   ============================================================ */
.loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none; justify-content: center; align-items: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loading-content {
  text-align: center;
  background: var(--bg-card);
  padding: 40px 32px; border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  max-width: 380px; width: 90%;
  animation: scaleIn 0.3s ease;
  position: relative; overflow: hidden;
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.loading-content::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400), #f472b6);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--text-200);
  border-top-color: var(--brand-500);
  border-right-color: var(--brand-400);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 15px; font-weight: 600;
  color: var(--text-800); margin-top: 12px;
}

.progress-container {
  width: 100%; max-width: 280px;
  background: var(--text-200); border-radius: 10px;
  overflow: hidden; margin: 16px auto; height: 8px;
}
.progress-container .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
  border-radius: 10px; width: 0%;
  transition: width 0.4s ease;
  position: relative;
}
.progress-container .progress-bar::after {
  content: ''; position: absolute; top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { left: -100%; } 100% { left: 100%; } }

.step-indicator {
  display: flex; justify-content: center; gap: 16px; margin-top: 14px;
}
.step {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-200);
  transition: all 0.3s ease;
  position: relative;
}
.step.active { background: var(--brand-500); box-shadow: 0 0 8px rgba(79, 70, 229, 0.4); }
.step.completed { background: var(--success-500); }
.step::before {
  content: attr(data-step);
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--text-500); white-space: nowrap;
}

.loading {
  display: inline-block; width: 18px; height: 18px;
  border: 2.5px solid var(--text-200);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px; vertical-align: middle;
}

/* ============================================================
   Footer
   ============================================================ */
.footer { margin-top: 40px; padding-top: 16px; text-align: center; }
.beian-info { font-size: 13px; }
.beian-info a { color: var(--text-600); text-decoration: none; }
.beian-info a:hover { color: var(--brand-500); text-decoration: underline; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: 20px !important;
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(79, 70, 229, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 90%, rgba(99, 102, 241, 0.06), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(79, 70, 229, 0.028) 31px, rgba(79, 70, 229, 0.028) 32px),
    repeating-linear-gradient(90deg, transparent, transparent 31px, rgba(79, 70, 229, 0.028) 31px, rgba(79, 70, 229, 0.028) 32px),
    var(--bg-page);
}

.login-container {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--text-200);
  max-width: 400px; width: 100%;
  text-align: center;
  animation: fadeUp 0.5s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 30px; color: #fff;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.3);
}
.login-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-800); margin-bottom: 4px;
}
.login-subtitle { font-size: 14px; color: var(--text-500); margin-bottom: 28px; }

/* Password Dots */
.password-dots {
  display: flex; justify-content: center; gap: 10px; margin: 16px 0;
}
.dot {
  position: relative;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--text-300);
  transition: all 0.25s ease;
}
.dot.filled {
  background: var(--brand-500);
  border-color: var(--brand-500);
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
  animation: dotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dotPop {
  0% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
/* 当前待输入位：脉冲光环提示 */
.dot.current::after {
  content: ''; position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--brand-300);
  animation: haloPulse 1.6s ease-out infinite;
}
@keyframes haloPulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.5); opacity: 0; }
}

.password-input-hidden {
  position: absolute; opacity: 0; pointer-events: none;
}

/* Number Pad */
.number-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.key {
  height: 56px;
  border: none; border-radius: var(--radius-lg);
  background: var(--bg-hover);
  font-size: 20px; font-weight: 700;
  color: var(--text-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  border: 1px solid var(--text-200);
}
.key:hover {
  background: var(--brand-500);
  color: #fff; border-color: var(--brand-500);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.key:active { transform: scale(0.95); }
.key-clear, .key-delete { font-size: 16px; }

.unlock-btn {
  width: 100%; margin-top: 16px;
  padding: 14px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #fff; font-size: 16px; font-weight: 700;
  border: none; cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.unlock-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45); }
.unlock-btn:active:not(:disabled) { transform: scale(0.97); }
.unlock-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* 错误提示：顶部 Toast 滑入，避免表单跳动 */
.error-message {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  color: #991b1b; background: var(--danger-50);
  font-size: 13px;
  padding: 12px 18px; border-radius: var(--radius-lg);
  border: 1px solid var(--danger-100);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: min(90vw, 420px);
  transition: opacity 0.3s ease;
  animation: toastSlideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toastSlideDown {
  from { opacity: 0; transform: translate(-50%, -16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.hint-text { font-size: 13px; color: var(--text-500); margin-top: 14px; }

/* ============================================================
   统一登录页：模式切换 + 管理员表单
   ============================================================ */
.login-tabs {
  display: flex;
  background: var(--text-200);
  border-radius: 9999px;
  padding: 4px;
  margin: 0 auto 20px;
  width: fit-content;
}
.login-tab {
  padding: 8px 22px;
  border: none; border-radius: 9999px;
  background: transparent;
  color: var(--text-600);
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.login-tab:hover { color: var(--brand-500); }
.login-tab.active {
  background: var(--bg-card);
  color: var(--brand-600);
  box-shadow: var(--shadow-sm);
}

/* 管理员表单（登录/强制改密） */
.admin-form { text-align: left; }
.admin-form .form-group { margin-bottom: 14px; }
.admin-form label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-600); margin-bottom: 6px;
}
.admin-form .form-input {
  width: 100%; height: 44px;
  padding: 0 16px;
  border: 1px solid var(--text-200);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  color: var(--text-700);
}
.admin-form .form-input::placeholder { color: var(--text-400); }
.admin-form .form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.admin-form .btn-block { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }
.form-message { font-size: 13px; margin-top: 8px; min-height: 18px; text-align: left; }
.form-message.error { color: var(--danger-500); }
.form-message.success { color: var(--success-500); }
.alert-warning {
  background: var(--warning-50); color: #92400e;
  border: 1px solid var(--warning-100);
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 16px; text-align: left;
}

/* 蜜罐字段：人类不可见，机器人会自动填充 */
.honeypot-field {
  position: absolute; left: -9999px; top: -9999px;
  opacity: 0; height: 0; width: 0;
  z-index: -1; pointer-events: none;
}

/* ============================================================
   Image Lightbox (keep existing functionality)
   ============================================================ */
.image-lightbox {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.image-lightbox.closing { animation: fadeOut 0.2s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }

.lightbox-backdrop {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-controls {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  z-index: 2002;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 14px; border-radius: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.lightbox-btn {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff; font-size: 18px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.25); }
.lightbox-btn:active { background: rgba(255,255,255,0.35); transform: scale(0.92); }
.lightbox-close {
  background: rgba(239, 68, 68, 0.7); font-size: 20px;
}
.lightbox-close:hover { background: rgba(239, 68, 68, 0.9); }

.lightbox-zoom-level {
  color: rgba(255,255,255,0.8); font-size: 13px; min-width: 42px; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 600;
}

.lightbox-stage {
  position: relative; z-index: 2001;
  width: 90vw; height: 80vh;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
}

.lightbox-wrap {
  position: relative;
  will-change: transform;
  /* 宽高由 JS 按图片比例显式计算，避免百分比循环引用 */
}
.lightbox-image {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

/* 原图/标注对比滑块 */
.lightbox-compare-controls {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 2002;
  display: none; align-items: center; gap: 10px;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 16px; border-radius: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.lb-compare-label { color: rgba(255,255,255,0.85); font-size: 12px; white-space: nowrap; }
#lbCompareRange { accent-color: #10B981; width: 150px; }
@media (max-width: 480px) {
  #lbCompareRange { width: 110px; }
  .lightbox-compare-controls { top: 12px; gap: 8px; padding: 6px 12px; }
}

.lightbox-hint {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.8);
  font-size: 13px; padding: 6px 16px; border-radius: 20px;
  z-index: 2002; pointer-events: none;
  transition: opacity 0.3s;
}

/* ============================================================
   Screen reader only
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============================================================
   Responsive Design
   ============================================================ */

/* Tablet (≤768px) */
@media (max-width: 768px) {
  body { padding-top: 56px; }
  .nav-header { height: 56px; padding: 0 16px; }
  .nav-title { font-size: 14px; }
  .nav-logo { width: 28px; height: 28px; font-size: 14px; }
  .nav-status { display: none; }

  .container { padding: 24px 14px 40px; }
  .page-hero h1 { font-size: 22px; }
  .page-hero p { font-size: 13px; }

  .upload-box { padding: 32px 14px; }
  .upload-icon-area { width: 60px; height: 60px; }
  .upload-icon-svg { width: 32px; height: 32px; }
  .upload-box h3 { font-size: 15px; }
  .upload-box p { font-size: 13px; }

  .tips-card { margin: 12px 0 0; }

  #cameraVideo { max-width: 100%; }
  .camera-controls { flex-direction: column; }
  .camera-controls .btn { width: 100%; }
  .zoom-controls input[type="range"] { width: 120px; }

  #imagePreview { max-width: 100%; max-height: 200px; }
  .preview-actions { flex-direction: column; }
  .preview-actions .btn { width: 100%; }

  .stats-cell { padding: 12px 14px; }
  .stats-cell-icon { width: 32px; height: 32px; }

  .face-cards { grid-template-columns: 1fr; }
  .face-name { font-size: 18px; }

  .url-input-group { flex-direction: column; gap: 8px; }
  .url-input-group .btn { width: 100%; }
  .url-input { flex: none; font-size: 15px; height: 48px; }

  .btn { padding: 12px 20px; font-size: 15px; }
  .footer { margin-top: 24px; }

  /* Loading */
  .loading-content { padding: 28px 20px; border-radius: var(--radius-xl); width: 92%; }
  .loading-text { font-size: 14px; }
  .progress-container { max-width: 240px; }

  /* Lightbox */
  .lightbox-controls { bottom: 12px; gap: 8px; padding: 6px 12px; border-radius: 24px; }
  .lightbox-btn { width: 40px; height: 40px; font-size: 18px; }
  .lightbox-hint { bottom: 76px; font-size: 11px; }

  /* Annotated image */
  .image-zoom-hint { font-size: 11px; bottom: 22px; right: 22px; padding: 4px 10px; opacity: 0.7; }
}

/* Large phone (≤480px) */
@media (max-width: 480px) {
  .nav-header { padding: 0 12px; }
  .nav-title { font-size: 13px; }
  .btn-nav { padding: 6px 10px; font-size: 12px; }

  .container { padding: 16px 10px; }
  .page-hero h1 { font-size: 20px; }

  .upload-box { padding: 24px 10px; }
  .upload-icon-area { width: 50px; height: 50px; }
  .upload-icon-svg { width: 28px; height: 28px; }

  .btn-option { font-size: 13px; padding: 8px 14px; }
  .btn-option svg { width: 13px; height: 13px; }

  #imagePreview { max-height: 170px; }

  .other-matches { padding: 10px 12px; }
  .other-matches h5 { font-size: 11px; }
  .other-matches ul li { font-size: 12px; }

  .loading-content { padding: 24px 16px; width: 94%; }
  .progress-container { max-width: 200px; height: 6px; }
  .step-indicator { gap: 12px; }
  .step { width: 8px; height: 8px; }
  .step::before { font-size: 9px; top: -14px; }

  .lightbox-controls { bottom: 8px; gap: 6px; padding: 5px 10px; border-radius: 22px; }
  .lightbox-btn { width: 36px; height: 36px; font-size: 16px; }
  .lightbox-zoom-level { font-size: 11px; min-width: 32px; }
  .lightbox-hint { bottom: 68px; font-size: 10px; }
  .image-zoom-hint { font-size: 10px; }
}

/* Tiny screen (≤360px) */
@media (max-width: 360px) {
  .container { padding: 12px 8px; }
  .page-hero h1 { font-size: 18px; }
  .upload-box h3 { font-size: 14px; }
  .upload-box p { font-size: 12px; }
  #imagePreview { max-height: 140px; }
  .btn { padding: 10px 16px; font-size: 14px; }
}

/* Login page tablet */
@media (max-width: 768px) {
  .login-container { padding: 32px 24px; border-radius: var(--radius-xl); }
  .login-icon { width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
  .login-title { font-size: 20px; }
  .number-pad { gap: 8px; }
  .key { height: 50px; font-size: 18px; }
  .unlock-btn { padding: 13px; font-size: 15px; }
}
@media (max-width: 480px) {
  .login-container { padding: 24px 16px; border-radius: var(--radius-xl); }
  .login-icon { width: 44px; height: 44px; font-size: 20px; }
  .login-title { font-size: 18px; }
  .login-subtitle { font-size: 12px; margin-bottom: 20px; }
  .password-dots { gap: 8px; margin: 12px 0; }
  .dot { width: 12px; height: 12px; }
  .number-pad { gap: 6px; margin-top: 14px; }
  .key { height: 48px; font-size: 17px; border-radius: var(--radius-md); }
  .key-clear, .key-delete { font-size: 14px; }
  .unlock-btn { margin-top: 12px; padding: 12px; font-size: 14px; }
  .error-message { font-size: 12px; padding: 10px 12px; }
  .hint-text { font-size: 12px; }
}

/* Landscape (short height) */
@media (max-height: 500px) and (orientation: landscape) {
  body { padding-top: 48px; }
  .nav-header { height: 48px; }
  .container { padding-top: 12px; padding-bottom: 12px; }
  .page-hero { margin-bottom: 12px; }
  .page-hero h1 { font-size: 18px; }
  .upload-box { padding: 16px; }
  .upload-icon-svg { width: 24px; height: 24px; margin-bottom: 4px; }
  .upload-box h3 { font-size: 14px; }
  #cameraVideo { max-height: 180px; }
  #imagePreview { max-height: 140px; }

  .login-container { padding: 16px 20px; max-width: 500px; }
  .login-icon { width: 36px; height: 36px; font-size: 16px; margin-bottom: 10px; }
  .login-title { font-size: 18px; }
  .login-subtitle { margin-bottom: 12px; }
  .number-pad { gap: 5px; margin-top: 8px; }
  .key { height: 38px; font-size: 16px; }
  .unlock-btn { margin-top: 8px; padding: 10px; }
  .password-dots { margin: 8px 0; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn, .btn-option, .key { min-height: 44px; }
  .annotated-image-container .image-zoom-hint { opacity: 0.6; }
  .upload-box { min-height: 100px; }
}

/* Large screen (≥1400px) */
@media (min-width: 1400px) {
  .container { max-width: 880px; padding: 32px 56px 60px; }
}

/* ============================================================
   Keyboard Focus (a11y)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Toast 轻提示
   ============================================================ */
.toast-container {
  position: fixed; top: 68px; right: 24px;
  z-index: 1500;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
@media (max-width: 480px) {
  .toast-container { right: 12px; left: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
.toast {
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: min(90vw, 480px);
  text-align: center;
}
.toast-error { background: rgba(153, 27, 27, 0.92); }
.toast-success { background: rgba(6, 95, 70, 0.92); }
.toast-out { opacity: 0; transform: translateY(-8px); transition: all 0.3s ease; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Confirm 确认框
   ============================================================ */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.confirm-card {
  background: var(--bg-card); border-radius: var(--radius-2xl);
  padding: 28px; width: 100%; max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s ease;
  text-align: center;
}
.confirm-message {
  font-size: 15px; font-weight: 600; color: var(--text-800);
  margin-bottom: 20px; line-height: 1.6;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

/* 顶部导航状态标记：异常态 */
.nav-status-error {
  color: #991b1b;
  background: var(--danger-50);
  border-color: var(--danger-100);
}
.nav-status-error::before {
  background: var(--danger-500);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
