:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #5d6470;
  --line: #e4e7ec;
  --input-border: #8b919c;
  --placeholder: #6b7280;
  --primary: #0062cc;
  --primary-active: #004fa6;
  --link: #0062cc;
  --ghost-bg: #e7f0fb;
  --ghost-text: #004a99;
  --danger: #c4261d;
  --success: #17803d;
  --focus: #2f7de1;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1aa;
    --line: #3a3a3c;
    --input-border: #6e6e73;
    --placeholder: #98989f;
    --primary: #0071e3;
    --primary-active: #005bb8;
    --link: #4da3ff;
    --ghost-bg: #1f2f45;
    --ghost-text: #8cc2ff;
    --danger: #ff6b61;
    --success: #4cd27a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

.env-tip {
  background: #fff4e5;
  color: #7a4100;
  font-size: 14px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .env-tip { background: #3a2a12; color: #ffd8a3; }
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
}

/* ---- 应用信息 ---- */
.app-panel, .empty-panel { text-align: center; padding-top: 28px; }
.icon-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.app-icon {
  display: block;
  width: 108px;
  height: 108px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}
.app-icon.fallback {
  background: linear-gradient(135deg, #4c8dff, #2858d6);
  color: #fff;
  font-size: 46px;
  font-weight: 600;
  line-height: 108px;
  text-align: center;
}
.empty-panel .app-icon { margin: 0 auto 14px; }
.app-name { font-size: 24px; line-height: 1.3; margin: 0 0 14px; font-weight: 700; word-break: break-word; }
.app-sub { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.facts {
  display: flex;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.facts > div { flex: 1; min-width: 0; padding: 0 4px; }
.facts > div + div { border-left: 1px solid var(--line); }
.facts dd { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts dt { font-size: 12px; color: var(--muted); }

/* ---- 表单与按钮 ---- */
.panel-title { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
.panel-title.success { color: var(--success); }
.panel-title:focus { outline: none; }

.input {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 17px;
  letter-spacing: .5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--placeholder); opacity: 1; letter-spacing: 0; font-family: inherit; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47, 125, 225, .3); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-active); }
.btn.ghost { background: var(--ghost-bg); color: var(--ghost-text); }
.btn[disabled] { opacity: .65; cursor: default; }
.btn:focus-visible, .link-btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.msg { min-height: 1.5em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.buy { margin: 14px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.buy a { color: var(--link); font-weight: 600; }

.steps { margin: 14px 0 0; padding: 12px 14px 12px 32px; background: var(--bg); border-radius: 12px; font-size: 14px; }
.steps li + li { margin-top: 6px; }
.steps:empty { display: none; }

.link-btn {
  display: block;
  margin: 14px auto 0;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--link);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.desc { font-size: 15px; white-space: pre-wrap; word-break: break-word; }

.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0; }

/* ---- 微信 / QQ 内打开时的遮罩 ---- */
.mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .86);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 24px 24px;
  text-align: center;
}
.mask-arrow { display: block; width: 110px; height: 110px; margin-left: auto; color: #fff; }
.mask-title { font-size: 22px; font-weight: 700; margin: 16px 0 10px; }
.mask-text { font-size: 16px; line-height: 1.8; margin: 0; }
.mask-text strong { font-size: 20px; letter-spacing: 2px; }
