* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

header {
  text-align: center;
  padding: 32px 20px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

header h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 14px;
  opacity: 0.9;
}

.tabs {
  display: flex;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.tab-btn {
  flex: 1;
  padding: 14px;
  border: none;
  background: none;
  font-size: 15px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: #fff;
}

.tab-content {
  display: none;
  padding: 24px;
}

.tab-content.active {
  display: block;
}

.qr-reader {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
}

.camera-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.tip {
  text-align: center;
  color: #999;
  font-size: 13px;
  margin-top: 12px;
}

.upload-area {
  display: block;
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #667eea;
  background: #f0f2ff;
}

.upload-hint svg {
  color: #bbb;
  margin-bottom: 12px;
}

.upload-hint p {
  font-size: 16px;
  color: #555;
  margin-bottom: 4px;
}

.upload-hint span {
  font-size: 12px;
  color: #999;
}

.preview-wrap {
  margin-top: 20px;
  text-align: center;
  display: none;
}

.upload-tip {
  text-align: center;
  color: #1a73e8;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  padding: 10px 14px;
  background: #e8f0fe;
  border-left: 4px solid #1a73e8;
  border-radius: 6px;
}

.preview-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 清空按钮栏：始终显示，优先级最高，任何状态下都可点击 */
.clear-bar {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.clear-btn {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 999;
  padding: 10px 36px;
  font-size: 15px;
  font-weight: 600;
}

.clear-btn:active {
  transform: scale(0.96);
}

/* 识别状态提示区：成功/失败/加载中，醒目显示 */
.scan-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  display: none;
}

.scan-status.loading {
  display: block;
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #c2dbff;
}

.scan-status.success {
  display: block;
  background: #e6f7ee;
  color: #0d8a4a;
  border: 1px solid #a8e6c3;
}

.scan-status.error {
  display: block;
  background: #fef0f0;
  color: #d93025;
  border: 1px solid #f5c2c0;
  font-weight: 600;
}

.btn {
  padding: 10px 22px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
}

.btn:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

.btn.primary:hover:not(:disabled) {
  background: #5568d3;
}

.result-section {
  padding: 0 24px 24px;
}

.result-section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #333;
}

.result-box {
  background: #f8f9ff;
  border: 1px solid #e8ebff;
  border-radius: 10px;
  padding: 16px;
  word-break: break-all;
}

.result-type {
  display: inline-block;
  padding: 2px 10px;
  background: #667eea;
  color: #fff;
  font-size: 12px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.result-type.url {
  background: #10b981;
}

.result-type.text {
  background: #6b7280;
}

.result-content {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

.result-content a {
  color: #667eea;
  text-decoration: none;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ===== 粘贴/输入网址 ===== */
.input-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.url-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.url-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.url-input.invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 480px) {
  header h1 {
    font-size: 22px;
  }
  .btn {
    padding: 12px 18px;
    font-size: 15px;
  }
  .toast {
    font-size: 22px;
    padding: 16px 30px;
  }
  .footer {
    font-size: 17px;
    padding: 24px 0 36px;
  }
  .footer-notice {
    font-size: 15px;
  }
  .upload-hint p {
    font-size: 18px;
  }
  .upload-hint span {
    font-size: 14px;
  }
  .tab-btn {
    font-size: 17px;
    padding: 16px;
  }
  .url-input {
    font-size: 17px;
    padding: 16px;
  }
  .subtitle {
    font-size: 15px;
  }
}

/* 友情链接 + 声明 */
.footer {
  text-align: center;
  padding: 20px 0 30px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.footer-links {
  margin-bottom: 10px;
}

.footer a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  padding-bottom: 2px;
  transition: opacity 0.2s;
}

.footer a:hover {
  opacity: 0.8;
}

.footer-notice {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

/* ===== 验证码弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  padding: 20px;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.modal h3 {
  font-size: 22px;
  color: #333;
  margin-bottom: 12px;
}

.modal-url {
  font-size: 14px;
  color: #667eea;
  word-break: break-all;
  background: #f0f2ff;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  text-align: left;
}

.modal-desc {
  font-size: 14px;
  color: #888;
  margin-bottom: 18px;
}

.verify-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid #ddd;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 18px;
}

.verify-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.verify-btn {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  font-weight: 600;
  border-radius: 10px;
}

@media (max-width: 480px) {
  .modal h3 {
    font-size: 20px;
  }
  .verify-input {
    font-size: 18px;
    padding: 16px;
  }
  .verify-btn {
    font-size: 22px;
    padding: 18px;
  }
}
