/* 扫码验真 H5。颜色以 OKLCH 编写；不支持 OKLCH 的旧内核（iOS < 15.4、Chromium < 111）先吃 hex 兜底。
   品牌色相关变量由 verify.js 运行时按品牌色相重算后覆盖。 */

:root {
  --bg: #f3f8f7;
  --surface: #fcfefe;
  --line: #dae3e2;
  --skel: #e6edec;
  --ink: #172221;
  --muted: #5a6665;
  --accent: #1ba79f;
  --accent-strong: #00736d;
  --accent-soft: #def6f3;
  --ok: #00736d;
  --ok-soft: #def6f3;
  --ok-ink: #0a5954;
  --warn-bg: #fef2d9;
  --warn-line: #edcc95;
  --warn-icon: #b77610;
  --warn-ink: #744711;
  --bad: #b9463f;
  --bad-soft: #ffedeb;
  --bad-ink: #93332d;
  --idle: #6e7e7c;
  --idle-soft: #e6edec;

  --radius: 12px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(0.975 0.006 188);
    --surface: oklch(0.995 0.002 188);
    --line: oklch(0.91 0.01 188);
    --skel: oklch(0.94 0.008 188);
    --ink: oklch(0.24 0.015 188);
    --muted: oklch(0.5 0.015 188);
    --accent: oklch(0.66 0.11 188);
    --accent-strong: oklch(0.5 0.09 188);
    --accent-soft: oklch(0.955 0.025 188);
    --ok: oklch(0.5 0.09 188);
    --ok-soft: oklch(0.955 0.025 188);
    --ok-ink: oklch(0.42 0.07 188);
    --warn-bg: oklch(0.965 0.035 85);
    --warn-line: oklch(0.86 0.08 80);
    --warn-icon: oklch(0.62 0.13 70);
    --warn-ink: oklch(0.44 0.09 65);
    --bad: oklch(0.55 0.15 27);
    --bad-soft: oklch(0.96 0.02 25);
    --bad-ink: oklch(0.46 0.13 27);
    --idle: oklch(0.58 0.02 188);
    --idle-soft: oklch(0.94 0.008 188);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p, dl, dd { margin: 0; }

a { color: inherit; }

.page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- 品牌头 ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.brand-mark.has-logo {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.brand-mark svg { width: 22px; height: 22px; }

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-name {
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-slogan {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}

.brand-tag svg { width: 14px; height: 14px; color: var(--accent-strong); }

/* ---------- 卡片 ---------- */

main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20, 40, 40, 0.04);
}

/* ---------- 结果区 ---------- */

.hero {
  align-items: center;
  gap: 8px;
  padding: 32px 20px 24px;
  text-align: center;
}

.seal {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
  border-radius: 50%;
}

.seal svg { width: 44px; height: 44px; }

.tone-ok .seal {
  background: var(--ok-soft);
  box-shadow: 0 0 0 6px var(--surface), 0 0 0 7px var(--ok-soft);
  color: var(--ok);
}
.tone-idle .seal { background: var(--idle-soft); color: var(--idle); }
.tone-bad .seal { background: var(--bad-soft); color: var(--bad); }
.tone-warn .seal { background: var(--warn-bg); color: var(--warn-icon); }

.hero-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.tone-ok .hero-title {
  color: var(--ok-ink);
  font-size: 32px;
  letter-spacing: 0.12em;
  text-indent: 0.12em; /* 抵消末字字距，保持视觉居中 */
}
.tone-bad .hero-title { color: var(--bad-ink); }

.hero-sub {
  max-width: 22em;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  text-wrap: balance;
}

.code-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
}

.code-pill .mono { color: var(--ink); font-size: 13px; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.attention {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  box-shadow: inset 0 0 0 1px var(--warn-line);
  color: var(--warn-ink);
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
}

.attention svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--warn-icon);
}

.attention strong { font-weight: 600; }

.nowrap { white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 160px;
  height: 44px;
  margin-top: 16px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-strong);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), opacity 160ms var(--ease-out);
}

.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 商品与明细 ---------- */

.product {
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-media {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--idle);
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media svg { width: 28px; height: 28px; }

.product-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.product-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.product-spec {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.facts {
  display: flex;
  flex-direction: column;
}

.facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}

.product + .facts > div:first-child { margin-top: 0; }
.facts > div:last-child { padding-bottom: 0; }
.card > .facts:first-child > div:first-child { padding-top: 0; border-top: 0; }

.facts dt { flex: none; color: var(--muted); }

.facts dd {
  min-width: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.tips {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tips svg { flex: none; width: 16px; height: 16px; margin-top: 3px; }

/* ---------- 页脚 ---------- */

.foot {
  margin-top: auto;
  padding-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.foot a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

/* ---------- 骨架屏 ---------- */

.skel {
  border-radius: 6px;
  background: var(--skel);
  animation: skel-pulse 1.2s var(--ease-out) infinite alternate;
}

.skel-line { height: 14px; }
.skel-sm { height: 12px; }
.skel-seal { width: 80px; height: 80px; margin-bottom: 8px; border-radius: 50%; }
.skel-title { width: 96px; height: 32px; margin-bottom: 4px; }
.skel-pill { width: 168px; height: 28px; margin-top: 8px; border-radius: 999px; }
.brand-mark.skel { border-radius: 10px; }
.product-media.skel { box-shadow: none; }

@keyframes skel-pulse {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

/* ---------- 入场动效（仅 ease-out，无回弹） ---------- */

.reveal {
  animation: reveal 320ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.reveal .seal { animation: seal-in 420ms var(--ease-out) both; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes seal-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .skel,
  .reveal,
  .reveal .seal { animation: none; }
  .btn { transition: none; }
}

/* ---------- 其他 ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.notice-bar {
  position: fixed;
  inset: auto 0 0;
  padding: 12px 16px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 14px;
  text-align: center;
}

@media (min-width: 640px) {
  .page { padding-top: 48px; gap: 20px; }
  .hero { padding: 40px 32px 32px; }
  .card { padding: 24px; }
}
