:root {
  --bg: #f7f8fa;
  --card: #fff;
  --text: #0e0f13;
  --muted: #4b4f57;
  --brand: #0e0f13;
  --btn: #0e0f13;
  --btn-text: #fff;
  --ok: #10b981;
  --border: rgba(0, 0, 0, 0.08);
  --link: #0b6bcb;
  --badge-bg: #fff;

  --badge-size: 44px; /* 徽章正方形外框尺寸 */
  --badge-inset: 4px; /* 徽章内边距（可 0~8 调整） */

  --header-h: 56px; /* 顶部固定栏高度（触控友好 ≥ 48px） */
  --header-pad: 10px; /* 顶部内边距 */
}
html[data-theme="dark"] {
  --bg: #0b0c0f;
  --card: #111318;
  --text: #e8e8ea;
  --muted: #a7acb4;
  --brand: #e8e8ea;
  --btn: #e8e8ea;
  --btn-text: #111318;
  --border: rgba(255, 255, 255, 0.12);
  --link: #6aa9ff;
  --badge-bg: #151922;
}

/* 解决浏览器“强制深色”误暗化 */
.auto-dark-bug body {
  filter: none !important;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial;
  -webkit-text-size-adjust: 100%;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* 顶部固定品牌栏（右侧加入语言切换） */
.brand-bar {
  position: fixed;
  z-index: 1000;
  left: 0;
  right: 0;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: calc(env(safe-area-inset-top, 0px));
}
.brand-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--header-pad) 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px; /* ✅ 新增：两端对齐 */
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
}

/* 语言切换（与首页 www.css 保持风格统一的轻量版本） */
.brand-actions {
  display: flex;
  align-items: center;
}
.lang-switcher {
  position: relative;
}
.lang-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.lang-caret {
  font-size: 12px;
  opacity: 0.8;
}
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 2000;
}
.lang-menu button {
  width: 100%;
  text-align: left;
  height: 34px;
  line-height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
}
.lang-menu button:hover {
  background: color-mix(in oklab, var(--bg) 80%, transparent);
}
.lang-switcher.open .lang-menu {
  display: block;
}

/* 徽章容器（正方形外框，内边距可控） */
.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--badge-size);
  height: var(--badge-size);
  border: 1px solid var(--border);
  background: var(--badge-bg);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: var(--badge-inset);
  flex: 0 0 var(--badge-size); /* ✅ 固定尺寸，不收缩 */
  min-width: var(--badge-size);
  min-height: var(--badge-size);
  flex-shrink: 0; /* ✅ 禁止被挤瘪 */
}
.brand-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-logo-img--light {
  display: block;
}
.brand-logo-img--dark {
  display: none;
}
html[data-theme="dark"] .brand-logo-img--light {
  display: none;
}
html[data-theme="dark"] .brand-logo-img--dark {
  display: block;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 18px;
  color: var(--brand);
  overflow: hidden;            /* ✅ 文本过长 → 省略号 */
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-sub {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 占位，避免内容被固定头部遮挡 */
.brand-spacer {
  height: calc(
    var(--header-h) + var(--header-pad) * 2 + env(safe-area-inset-top, 0px)
  );
}

/* 页面容器/卡片 */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 24px;
}
.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 20px;
  border: 1px solid var(--border);
}

/* 标题模块（适老化） */
.title {
  font-size: 22px;
  font-weight: 800;
  margin: 6px 0 10px;
  letter-spacing: 0.2px;
}
.sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 16px;
}
.center {
  text-align: center;
}

/* 二维码区（适老化：更大留白） */
.qr {
  display: grid;
  place-items: center;
  margin: 14px 0;
}
.qr__box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.qr__img {
  width: 280px;
  height: 280px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
@media (max-width: 360px) {
  .qr__img {
    width: 240px;
    height: 240px;
  }
}
.hint {
  margin: 10px 0 0;
  color: #444;
  font-size: 15px;
  text-align: center;
}
html[data-theme="dark"] .hint {
  color: #c9c9cc;
}
.hint .wx {
  color: #1aad19;
  font-weight: 800;
}

/* 主按钮（适老化） */
.btns {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 52px;
  border-radius: 14px;
  font-weight: 800;
  border: 0;
  font-size: 17px;
  letter-spacing: 0.2px;
}
.btn--primary {
  background: var(--btn);
  color: var(--btn-text);
}
.btn--primary:active {
  transform: translateY(1px);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show {
  opacity: 1;
}

/* 更健壮的视觉隐藏（含 #wxId） */
.sr-only,
#wxId.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
[hidden] {
  display: none !important;
}
