/* 充电宝「宝编号」信息页 — 手机竖屏扫码优先 */

:root {
  --primary: #3c9cff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --bg-top: #ffffff;
  --bg-bottom: #fff5ef;
  /* 内容区按常见手机逻辑宽（约 375）收口，大屏不无限拉宽 */
  --content-max: 390px;
  --page-pad-x: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --page-pad-y: 16px;
  /* 产品图竖图比例（充电宝竖拍约 3:4） */
  --hero-ratio: 3 / 4;
  --hero-width: min(58vw, 220px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  /* 禁止横向滚动，适配窄屏 */
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.page {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--content-max);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: calc(var(--page-pad-y) + env(safe-area-inset-top)) var(--page-pad-x)
    calc(var(--page-pad-y) + env(safe-area-inset-bottom));
  text-align: center;
}

.brand-name {
  margin: 0 0 6px;
  max-width: 100%;
  padding: 0 8px;
  font-size: clamp(22px, 6.4vw, 28px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  word-break: break-word;
}

.page-title {
  margin: 0 0 clamp(20px, 5vh, 32px);
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 竖图容器：定宽 + 固定宽高比，避免横图撑破手机屏 */
.hero-wrap {
  width: var(--hero-width);
  max-width: min(72vw, 260px);
  /* 高度随屏高收敛，矮屏（横屏/小手机）不把 ID 顶出视口 */
  max-height: min(42vh, 360px);
  aspect-ratio: var(--hero-ratio);
  margin: 0 auto clamp(24px, 5vh, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.id-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: 100%;
  padding: 0 4px;
  font-size: clamp(17px, 5vw, 20px);
  font-weight: 700;
  line-height: 1.4;
}

.id-label {
  flex-shrink: 0;
}

.id-value {
  max-width: min(70vw, 260px);
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}

.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -4px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  /* 增大点击热区，方便拇指操作 */
  touch-action: manipulation;
}

.copy-btn:active {
  opacity: 0.7;
}

.copy-btn svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* 矮屏：压缩产品图，保证一屏看全 */
@media (max-height: 640px) {
  :root {
    --hero-width: min(48vw, 180px);
  }

  .page-title {
    margin-bottom: 16px;
  }

  .hero-wrap {
    max-height: 34vh;
    margin-bottom: 20px;
  }
}

/* 极矮横屏：进一步缩小图，优先展示品牌名与 ID */
@media (max-height: 480px) {
  .page {
    justify-content: flex-start;
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .hero-wrap {
    max-height: 28vh;
    margin-bottom: 12px;
  }
}

/* 错误态：无品牌皮肤 */
.error-state {
  max-width: min(280px, 86vw);
  padding: 0 8px;
}

.error-state .error-title {
  margin: 0 0 8px;
  font-size: clamp(18px, 5vw, 20px);
  font-weight: 600;
}

.error-state .error-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(48px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
}

.toast[hidden] {
  display: none;
}
