/* ============================================================
   全局重置与基础
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #fbf0e6;
  overflow-x: hidden;
}

a { text-decoration: none; }

/* ============================================================
   页面包装器 & 应用容器
   ============================================================ */
.page-wrapper {
  display: flex;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background-color: #fbf0e6;
}

.app-container {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: linear-gradient(141.73deg, #fbf0e6 8.49%, #f2c9a8 91.51%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

/* 查询页：顶部对齐，无 justify-between */
.app-flat {
  justify-content: flex-start;
}

/* ============================================================
   工具类
   ============================================================ */
.hidden {
  display: none !important;
}

/* ============================================================
   登录页 — 顶部渐变区域
   ============================================================ */
.top-section {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.top-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 24px 24px;
}

.logo-wrap {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: #1a1208;
  text-align: center;
  white-space: nowrap;
}

.sub-title {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #8a6a50;
  text-align: center;
  padding-top: 4px;
  white-space: nowrap;
}

/* ============================================================
   登录页 — 底部白色卡片
   ============================================================ */
.bottom-card {
  background-color: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0px -8px 20px rgba(26, 18, 8, 0.12);
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  flex-shrink: 0;
}

/* 拖拽把手 */
.drag-handle-wrap {
  display: flex;
  justify-content: center;
  margin-top: -20px;
  margin-bottom: -12px;
}

.drag-handle {
  width: 40px;
  height: 4px;
  background-color: rgba(26, 18, 8, 0.12);
  border-radius: 100px;
}

/* 微信授权行 */
.wechat-auth-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(26, 18, 8, 0.12);
}

.wechat-icon-wrap {
  width: 36px;
  height: 36px;
  background-color: #07c160;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wechat-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.wechat-auth-text {
  display: flex;
  flex-direction: column;
}

.auth-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #1a1208;
  white-space: nowrap;
}

.auth-desc {
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: #8a6a50;
  white-space: nowrap;
}

/* 用户信息行 */
.user-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8a87c 0%, #c97a40 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-letter {
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  color: #ffffff;
}

.user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.user-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: #1a1208;
  white-space: nowrap;
}

.user-meta {
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: #8a6a50;
  padding-top: 2px;
  white-space: nowrap;
}

/* 授权成功后的对勾 */
.user-check {
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: #00c950;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.user-check.visible {
  opacity: 1;
  transform: scale(1);
}

/* 权限申请框 */
.permission-box {
  background-color: #fbf0e6;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-mobile-wrap {
  width: 100%;
}

.login-mobile-input {
  width: 100%;
  height: 48px;
  background-color: #f5e6d5;
  border: 1.1px solid rgba(26, 18, 8, 0.12);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 15px;
  color: #1a1208;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.login-mobile-input::placeholder {
  color: rgba(26, 18, 8, 0.45);
}

.login-mobile-input:focus {
  border-color: rgba(26, 18, 8, 0.35);
  background-color: #faeedd;
}

.permission-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: #8a6a50;
  white-space: nowrap;
}

.permission-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.permission-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bullet {
  width: 6px;
  height: 6px;
  background-color: #e8a87c;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.permission-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #1a1208;
  white-space: nowrap;
}

.permission-text-block {
  display: flex;
  flex-direction: column;
}

.permission-sub {
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: #8a6a50;
  white-space: nowrap;
}

.radio-checked {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #07c160;
  border: 1.1px solid #07c160;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 1.1px;
}

.radio-checked::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background-color: #ffffff;
  border-radius: 50%;
}

/* 协议文字 */
.agreement-text {
  font-size: 12px;
  font-weight: 400;
  line-height: 19.5px;
  color: #8a6a50;
  text-align: center;
  padding: 0 16px;
}

.agreement-link {
  font-size: 12px;
  font-weight: 500;
  color: #e8a87c;
}

/* ============================================================
   登录页 — 按钮组
   ============================================================ */
.btn-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  height: 54px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.35px;
  cursor: pointer;
  border: none;
  outline: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn:active {
  opacity: 0.85;
  transform: scale(0.98);
}

/* 暂不授权 */
.btn-cancel {
  flex: 1;
  background-color: transparent;
  border: 1.1px solid rgba(26, 18, 8, 0.15);
  color: #8a6a50;
}

/* 允许授权（状态1 — 绿色） */
.btn-confirm {
  flex: 2.45;
  background-color: #07c160;
  color: #ffffff;
  box-shadow: 0px 4px 8px rgba(7, 193, 96, 0.35);
  padding: 0 24px;
  transition: background-color 0.35s ease, box-shadow 0.35s ease, opacity 0.2s ease, transform 0.1s ease;
}

/* 进入查询（状态2 — 深色） */
.btn-confirm.btn-dark {
  background-color: #1a1208;
  box-shadow: 0px 4px 8px rgba(138, 106, 80, 0.42);
}

/* ============================================================
   步骤指示点（登录页：absolute bottom）
   ============================================================ */
.step-dots {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.dot {
  height: 6px;
  border-radius: 100px;
  display: inline-block;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.dot-inactive {
  width: 6px;
  background-color: rgba(26, 18, 8, 0.25);
}

.dot-active {
  width: 24px;
  background-color: #1a1208;
}

/* 查询页步骤点 */
.step-dots-flat {
  position: relative;
  bottom: auto;
  margin-top: 20px;
  padding-bottom: 28px;
}

/* ============================================================
   查询页 — 整体 section 切换
   ============================================================ */
.query-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   查询页 — 紧凑标题区
   ============================================================ */
.compact-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px 16px;
  width: 100%;
  flex-shrink: 0;
}

.compact-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.compact-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.compact-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: #1a1208;
  text-align: center;
  white-space: nowrap;
}

.compact-sub {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: #8a6a50;
  text-align: center;
  padding-top: 4px;
  white-space: nowrap;
}

/* ============================================================
   查询页 — 白色内容卡片
   ============================================================ */
.card-wrapper {
  width: 100%;
  padding: 16px 20px 0;
  flex-shrink: 0;
}

.white-card {
  background-color: #ffffff;
  border-radius: 24px;
  box-shadow: 0px 10px 7.5px rgba(0, 0, 0, 0.10), 0px 4px 3px rgba(0, 0, 0, 0.10);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

/* ============================================================
   输入防伪码 — 输入框
   ============================================================ */
.code-input-wrap {
  width: 100%;
}

.code-input {
  width: 100%;
  height: 54px;
  background-color: #f5e6d5;
  border: 1.1px solid rgba(26, 18, 8, 0.12);
  border-radius: 16px;
  padding: 0 17px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 2.8px;
  color: #1a1208;
  text-align: center;
  outline: none;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.code-input::placeholder {
  color: rgba(26, 18, 8, 0.5);
  letter-spacing: normal;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  text-transform: none;
}

.code-input:focus {
  border-color: rgba(26, 18, 8, 0.35);
  background-color: #faeedd;
}

.code-input.phone-input {
  letter-spacing: normal;
  font-family: 'Noto Sans SC', sans-serif;
  text-transform: none;
  margin-bottom: 12px;
}

.code-input.phone-input::placeholder {
  letter-spacing: normal;
}

/* ============================================================
   输入防伪码 — 温馨提示框
   ============================================================ */
.tips-box {
  background-color: #fbf0e6;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: #1a1208;
  padding-bottom: 4px;
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tip-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tip-bullet-wrap {
  padding-top: 7px;
  flex-shrink: 0;
}

.tip-text {
  font-size: 12px;
  font-weight: 400;
  line-height: 19.5px;
  color: #8a6a50;
}

/* ============================================================
   立即验证 / 再次查询 按钮
   ============================================================ */
.btn-verify {
  width: 100%;
  height: 54px;
  border-radius: 16px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0.8px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.25s ease, box-shadow 0.25s ease, transform 0.1s ease;
}

.btn-verify-disabled {
  background-color: #1a1208;
  color: #fbf0e6;
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-verify-active {
  background-color: #1a1208;
  color: #fbf0e6;
  opacity: 1;
  box-shadow: 0px 8px 12px rgba(26, 18, 8, 0.25);
}

.btn-verify-active:active {
  opacity: 0.85;
  transform: scale(0.98);
}

/* ============================================================
   验证结果 — 绿色通过横幅
   ============================================================ */
.result-banner {
  width: 100%;
  background: linear-gradient(140.79deg, #52ae36 0%, #3d8a28 100%);
  border-radius: 16px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.result-check-circle {
  width: 80px;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-check-icon {
  font-size: 36px;
  line-height: 40px;
  color: #ffffff;
}

.result-text-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  color: #ffffff;
  letter-spacing: 1.2px;
  text-align: center;
}

.result-sub {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

/* ============================================================
   验证结果 — 产品信息框
   ============================================================ */
.info-box {
  background-color: #fbf0e6;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.info-box-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  color: #1a1208;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.info-label {
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: #8a6a50;
  white-space: nowrap;
}

.info-value {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: #1a1208;
  white-space: nowrap;
}

/* ============================================================
   验证结果 — 警示框
   ============================================================ */
.warning-box {
  width: 100%;
  background-color: rgba(232, 168, 124, 0.08);
  border: 1.1px solid #e8a87c;
  border-radius: 16px;
  padding: 17px;
}

.warning-text {
  font-size: 12px;
  font-weight: 400;
  line-height: 19.5px;
  color: #8a6a50;
  text-align: center;
}

/* ============================================================
   安全区域（刘海屏 / 全面屏）
   ============================================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-card {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   超小屏幕适配
   ============================================================ */
@media (max-width: 360px) {
  .main-title,
  .compact-title {
    font-size: 18px;
  }
  .user-avatar {
    width: 48px;
    height: 48px;
  }
  .avatar-letter {
    font-size: 20px;
  }
  .result-banner {
    padding: 28px 16px;
  }
  .result-title {
    font-size: 20px;
  }
}

/* ============================================================
   协议页面
   ============================================================ */
.protocol-page {
  padding: 16px 16px 32px;
}

.protocol-header {
  margin-bottom: 20px;
}

.protocol-back {
  display: inline-block;
  font-size: 14px;
  color: #8a6a50;
  text-decoration: none;
  margin-bottom: 12px;
}

.protocol-title {
  font-size: 22px;
  font-weight: 700;
  color: #2d1f14;
  line-height: 1.4;
}

.protocol-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 18px;
  color: #4a3728;
  font-size: 14px;
  line-height: 1.8;
  box-shadow: 0 4px 24px rgba(180, 120, 80, 0.08);
}

.protocol-content p {
  margin: 0 0 12px;
}

.protocol-content p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   刮涂层弹窗
   ============================================================ */
body.scratch-modal-open {
  overflow: hidden;
}

.scratch-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.scratch-modal.hidden {
  display: none;
}

.scratch-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 18, 8, 0.55);
}

.scratch-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 12px 40px rgba(26, 18, 8, 0.2);
}

.scratch-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1208;
  text-align: center;
}

.scratch-modal-sub {
  margin: 8px 0 16px;
  font-size: 13px;
  color: #8a6a50;
  text-align: center;
}

.scratch-area {
  position: relative;
  width: 100%;
  height: 120px;
  border-radius: 16px;
  overflow: hidden;
  background: #f5e6d5;
  border: 1px solid rgba(26, 18, 8, 0.12);
}

.scratch-code {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #1a1208;
  user-select: none;
  pointer-events: none;
}

#scratchCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.scratch-progress-hint {
  margin: 12px 0 16px;
  font-size: 12px;
  color: #8a6a50;
  text-align: center;
}

.scratch-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-scratch-copy,
.btn-scratch-close {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-scratch-copy {
  background: linear-gradient(135deg, #e8a87c 0%, #c97a40 100%);
  color: #ffffff;
}

.btn-scratch-copy.hidden {
  display: none !important;
}

.btn-scratch-close {
  background: #f5e6d5;
  color: #1a1208;
}
