* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px;
}

.app-container {
  width: 100%;
  max-width: 414px;
  height: 850px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.app-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 70px);
  padding: 24px;
  display: none;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(100%);
  background: #f8fafc;
}

.page.active {
  display: flex;
  transform: translateX(0);
}

.page.next {
  transform: translateX(100%);
}

.page.prev {
  transform: translateX(-100%);
}

.page-title {
  text-align: center;
  margin-bottom: 8px;
  color: #1e293b;
  font-size: 1.75rem;
  font-weight: 700;
}

.page-subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 24px;
  font-size: 1rem;
  line-height: 1.5;
}

.scan-area {
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  border: 3px solid #e2e8f0;
  border-radius: 20px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0 24px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

#scanVideo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px;
  display: none;
  visibility: hidden;
  opacity: 0;
  z-index: 1;
}

#scanPlaceholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  border-radius: 17px;
}

#scanPlaceholder.hidden {
  display: none;
}

#scanPlaceholder i {
  font-size: 48px;
  color: #94a3b8;
  margin-bottom: 12px;
}

#scanPlaceholder span {
  color: #64748b;
  font-size: 14px;
}

.scan-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(102, 126, 234, 0.03) 100%);
  pointer-events: none;
}

.scan-line {
  position: absolute;
  width: 80%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #667eea, transparent);
  animation: scan 2.5s infinite ease-in-out;
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

@keyframes scan {
  0% {
    top: 15%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 85%;
    opacity: 0;
  }
}

.scan-frame {
  position: absolute;
  width: 220px;
  height: 220px;
  border: 3px solid #667eea;
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.1), inset 0 0 20px rgba(102, 126, 234, 0.05);
}

.scan-frame::before,
.scan-frame::after {
  content: '';
  position: absolute;
  width: 35px;
  height: 35px;
  border-color: #667eea;
  border-style: solid;
}

.scan-frame::before {
  top: -3px;
  left: -3px;
  border-width: 4px 0 0 4px;
  border-radius: 18px 0 0 0;
}

.scan-frame::after {
  top: -3px;
  right: -3px;
  border-width: 4px 4px 0 0;
  border-radius: 0 18px 0 0;
}

.scan-frame-bottom::before,
.scan-frame-bottom::after {
  content: '';
  position: absolute;
  width: 35px;
  height: 35px;
  border-color: #667eea;
  border-style: solid;
}

.scan-frame-bottom::before {
  bottom: -3px;
  left: -3px;
  border-width: 0 0 4px 4px;
  border-radius: 0 0 0 18px;
}

.scan-frame-bottom::after {
  bottom: -3px;
  right: -3px;
  border-width: 0 4px 4px 0;
  border-radius: 0 0 18px 0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 16px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
  color: #1e293b;
}

.form-control:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
  color: #94a3b8;
}

.camera-container {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: 20px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.camera-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%236674ba' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2V6h4V4H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* 摄像头视频元素 */
#cameraVideo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  /* 移除默认隐藏，让JS控制显示 */
  /* display: none; */ 
}

.camera-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  text-align: center;
  padding: 24px;
  position: relative;
  z-index: 2;
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

.camera-placeholder.hidden {
  display: none;
}

.camera-icon {
  font-size: 4.5rem;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.camera-text {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

/* 人脸动画 */
.face-animation {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0) 70%);
  opacity: 0;
  animation: faceDetection 3s infinite ease-in-out;
  z-index: 3;
  pointer-events: none;
}

.face-animation.active {
  opacity: 1;
}

/* 人脸识别引导框 */
.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 220px;
  z-index: 4;
  display: none;
  pointer-events: none;
}

.face-guide.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: faceGuidePulse 2s infinite;
}

.face-guide-circle {
  width: 160px;
  height: 200px;
  border: 3px solid rgba(102, 126, 234, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2), inset 0 0 20px rgba(102, 126, 234, 0.1);
  animation: faceGuideRotate 4s linear infinite;
}

.face-guide-text {
  margin-top: 15px;
  color: white;
  font-size: 0.9rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
}

@keyframes faceGuidePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.02);
  }
}

@keyframes faceGuideRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.permission-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.permission-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.permission-btn:disabled {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: default;
  transform: none;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.permission-btn i {
  margin-right: 8px;
}

.protocol-container {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0 24px;
  height: 280px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.protocol-container::-webkit-scrollbar {
  width: 6px;
}

.protocol-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.protocol-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.protocol-title {
  font-size: 1.15rem;
  color: #1e293b;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f1f5f9;
  font-weight: 700;
}

.protocol-content {
  color: #475569;
  line-height: 1.8;
  font-size: 0.9rem;
}

.protocol-content p {
  margin-bottom: 12px;
}

.protocol-content strong {
  color: #334155;
  font-weight: 600;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin: 16px 0 24px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.checkbox-group input {
  margin-right: 14px;
  width: 22px;
  height: 22px;
  accent-color: #667eea;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  color: #475569;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.4;
}

.result-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
}

.result-icon {
  font-size: 5rem;
  color: #10b981;
  margin-bottom: 24px;
  filter: drop-shadow(0 4px 6px rgba(16, 185, 129, 0.3));
  animation: successPulse 2s infinite;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.result-title {
  font-size: 1.75rem;
  color: #059669;
  margin-bottom: 16px;
  font-weight: 700;
}

.result-desc {
  color: #64748b;
  margin-bottom: 32px;
  line-height: 1.6;
  font-size: 1rem;
}

.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 32px;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 12px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn:active {
  transform: translateY(-1px);
}

.btn:disabled {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-scan {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-scan:hover {
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.app-footer {
  padding: 16px;
  text-align: center;
  background: white;
  border-top: 1px solid #f1f5f9;
  color: #94a3b8;
  font-size: 0.85rem;
}

.step-indicator {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  padding: 0 20px;
}

.step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 8px;
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -20px;
  width: 12px;
  height: 2px;
  background: #e2e8f0;
  transform: translateY(-50%);
  z-index: 0;
}

.step.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.step.completed {
  background: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.step.completed::after {
  background: #10b981;
}

.face-animation {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0) 70%);
  opacity: 0;
  animation: faceDetection 3s infinite ease-in-out;
}

@keyframes faceDetection {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* 添加页面加载动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page.active .page-title,
.page.active .page-subtitle {
  animation: fadeInUp 0.5s ease forwards;
}

.page.active .page-subtitle {
  animation-delay: 0.1s;
}

/* 扫描区域图标样式优化 */
.scan-area > div:last-child {
  z-index: 2;
}

.scan-area > div:last-child i {
  opacity: 0.9;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}