/* ============================================================
   INTJ 人格测评 · 样式（移动端优先 / 二维 lowpoly 风格）
   ============================================================ */

:root {
  --bg: #f4eef9;
  --bg2: #e9e0f4;
  --ink: #241f2e;
  --ink-2: #5b5268;
  --ink-3: #8b819c;
  --purple: #7a5ea8;
  --purple-d: #4b3673;
  --purple-l: #c6b4e2;
  --purple-xl: #ece4f7;
  --pink: #e3afc9;
  --line: #e4d9f2;
  --card: #ffffff;
  --ok: #6d4c9f;
  --err: #d4576b;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(94, 63, 150, 0.10);
  --shadow-lg: 0 16px 40px rgba(94, 63, 150, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 注意：这里不要写 overflow-x: hidden，也不要在 body 上写 overscroll-behavior，
   微信内置浏览器（iOS WKWebView / 安卓 X5）会因此把整页滚动锁死。 */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* #app 只做居中容器，不做 flex 容器：页面滚动完全交给文档本身 */
#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 100% 0%, #f7f2fc 0%, rgba(247, 242, 252, 0) 60%),
    linear-gradient(180deg, #f7f2fc 0%, #f1e9f8 55%, #ece3f6 100%);
}

/* ------------------------------------------------------------------
 * 滚动自愈（兜底）
 * 正常情况下滚动交给文档；移动端 / 微信的内嵌 WebView 对「文档滚动」
 * 的触控处理不可靠（尤其结果页 / 历史列表页这类长页面），所以只要检测到
 * 是移动端（或检测到「内容超屏但文档滚不动」），JS 就给 body 加 .force-scroll，
 * 改用 #app 自己滚。见 js/app.js 的 ensureScrollable() 与 IS_MOBILE。
 *
 * 注意：这里千万不要在 #app 上写 overflow-x: hidden —— 它和 html/body 上一样
 * 是微信里把整页/容器滚动锁死的元凶；横向溢出由内容本身控制（回归检查会
 * 校验「无横向溢出」），滚动只留在纵向。
 * ------------------------------------------------------------------ */
body.force-scroll {
  overflow: hidden;
}
body.force-scroll #app {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 诊断面板（?debug=1 时出现） */
.debug-panel {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 999;
  max-height: 46vh;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(20, 14, 28, 0.9);
  color: #d8ffd8;
  font: 11px/1.6 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
.debug-panel b { color: #fff; }

/* 背景低多边形装饰 */
.bg-deco {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.bg-deco svg { position: absolute; }

/* ---------------- 屏幕切换 ---------------- */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
}
.screen.active { display: flex; animation: screenIn 0.36s cubic-bezier(0.22, 1, 0.36, 1); }

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

/* ---------------- 通用元件 ---------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.975); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #8b6bc4 0%, #5e3f96 100%);
  box-shadow: 0 10px 22px rgba(94, 63, 150, 0.32);
}
.btn-primary[disabled] { opacity: 0.45; box-shadow: none; }

.btn-ghost {
  color: var(--purple-d);
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: 0 4px 14px rgba(94, 63, 150, 0.08);
}

/* 删除历史记录 */
.btn-danger {
  color: #c0455c;
  background: #fff;
  border: 1.5px solid #f0ccd4;
  box-shadow: 0 4px 14px rgba(192, 69, 92, 0.1);
}
.btn-danger:active { background: #fff7f9; }
.btn-danger-solid {
  color: #fff;
  background: linear-gradient(135deg, #e2697f 0%, #c0455c 100%);
  box-shadow: 0 8px 18px rgba(192, 69, 92, 0.26);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ============================================================
   1. 邀请码
   ============================================================ */
.gate-hero {
  padding: 26px 26px 0;
  text-align: center;
}
.gate-hero h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.1;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: #2b2436;
  text-indent: 0.12em;
}
.gate-hero .sub-type {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--purple);
}
.gate-hero .sub-desc {
  margin: 14px auto 0;
  max-width: 300px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

/* 毛玻璃装饰：模糊色块 + 半透明玻璃面板，若隐若现 */
.hero-art {
  position: relative;
  height: 168px;
  margin: 10px 0 2px;
  overflow: hidden;
}
.glass-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(30px);
}
.glass-blob.b1 {
  width: 168px;
  height: 168px;
  left: -26px;
  top: 6px;
  opacity: 0.75;
  background: radial-gradient(circle at 35% 35%, #b79bdd, #8f6fc4 62%, rgba(143, 111, 196, 0) 74%);
}
.glass-blob.b2 {
  width: 150px;
  height: 150px;
  right: -10px;
  top: -6px;
  opacity: 0.6;
  background: radial-gradient(circle at 40% 40%, #e9b3ce, #cf93b8 60%, rgba(207, 147, 184, 0) 74%);
}
.glass-blob.b3 {
  width: 190px;
  height: 130px;
  left: 80px;
  bottom: -46px;
  opacity: 0.55;
  background: radial-gradient(circle at 50% 50%, #a98ccb, rgba(169, 140, 203, 0) 72%);
}
.glass-mark {
  position: absolute;
  left: 50%;
  top: 20px;
  width: 240px;
  height: 140px;
  transform: translateX(-50%);
  filter: blur(1.2px);
}
.glass-panel {
  position: absolute;
  inset: 20px 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow:
    0 14px 34px rgba(94, 63, 150, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(11px) saturate(140%);
  backdrop-filter: blur(11px) saturate(140%);
}

.gate-body {
  padding: 6px 22px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.invite-card {
  background: #fff;
  border-radius: 24px;
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(198, 180, 226, 0.5);
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* 已通过邀请码校验时的提示（此时输入框整体隐藏） */
.gate-note {
  margin: 0 0 4px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.gate-note::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--purple);
  transform: rotate(45deg) translateY(-1px);
}

.code-input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fbf8fe;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  color: var(--purple-d);
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.code-input::placeholder { color: #c9bedd; letter-spacing: 0.2em; font-weight: 600; }
.code-input:focus { border-color: var(--purple); background: #fff; }
.code-input.shake { animation: shake 0.4s ease; border-color: var(--err); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.err-msg {
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--err);
  min-height: 20px;
}

.gate-foot {
  padding: 20px 22px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.9;
}
.foot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.foot-link {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--purple);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.foot-link:active { background: #fff; border-color: var(--purple-l); }
.foot-link span { color: var(--ink-3); font-weight: 500; }
.gate-foot .dots { color: var(--purple-l); letter-spacing: 0.4em; }

/* ---------------- 历史测试结果 ---------------- */
.hist-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(247, 242, 252, 0.98) 60%, rgba(247, 242, 252, 0));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hist-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.hist-body { padding: 6px 22px 0; flex: 1; }
.hist-list { display: flex; flex-direction: column; gap: 12px; }

.hist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 14px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, border-color 0.16s ease;
}
.hist-item:active { transform: scale(0.985); border-color: var(--purple-l); }

.hi-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  transform: rotate(45deg);
}
.hi-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hi-tier {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hi-time { font-size: 12px; color: var(--ink-3); }
.hi-score {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hi-s {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.hi-s .d { width: 7px; height: 7px; border-radius: 50%; }
.hi-s .d.talent { background: #7a5ea8; }
.hi-s .d.flaw { background: #d97ba6; }
.hi-arrow {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
  color: var(--purple-l);
}

.hist-empty {
  padding: 66px 20px 0;
  text-align: center;
  color: var(--ink-3);
}
.hist-empty .he-icon { font-size: 28px; color: var(--purple-l); letter-spacing: 0.3em; }
.hist-empty p {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}
.hist-empty span { font-size: 12.5px; }

/* ============================================================
   2. 答题
   ============================================================ */
.quiz-top {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(180deg, rgba(247, 242, 252, 0.98) 60%, rgba(247, 242, 252, 0));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.quiz-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.quiz-back {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--purple-d);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.quiz-back:disabled { opacity: 0.35; }
.quiz-count {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--purple-d);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.quiz-count span { color: var(--ink-3); font-weight: 600; }

.progress-track {
  margin-top: 12px;
  height: 6px;
  border-radius: 999px;
  background: rgba(122, 94, 168, 0.14);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #a98ccb, #5e3f96);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.quiz-body {
  padding: 6px 22px 0;
  flex: 1;
}

.dim-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--purple-d);
  background: #fff;
  border: 1px solid var(--line);
}
.dim-tag i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--purple);
  transform: rotate(45deg);
  display: inline-block;
}
.dim-tag.flaw i { background: var(--pink); }

.q-text {
  margin: 16px 0 20px;
  font-size: 19px;
  line-height: 1.62;
  font-weight: 700;
  color: #241f2e;
  letter-spacing: 0.01em;
}

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

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.65;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
  animation: optIn 0.3s backwards;
}
.opt:active { transform: scale(0.985); }
.opt:nth-child(1) { animation-delay: 0.02s; }
.opt:nth-child(2) { animation-delay: 0.07s; }
.opt:nth-child(3) { animation-delay: 0.12s; }

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

.opt .badge {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--purple-xl);
  color: var(--purple-d);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease, color 0.16s ease;
}
.opt.picked {
  border-color: var(--purple);
  background: #f7f1fd;
}
.opt.picked .badge { background: var(--purple); color: #fff; }

.quiz-foot {
  padding: 18px 22px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ============================================================
   3. 结果
   ============================================================ */
.result-hero {
  position: relative;
  padding: calc(30px + env(safe-area-inset-top)) 24px 78px;
  color: #fff;
  overflow: hidden;
  border-radius: 0 0 30px 30px;
}
.result-hero .rh-art {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  line-height: 0;
  opacity: 0.9;
}
.result-hero .rh-inner { position: relative; z-index: 2; }
.rh-kicker {
  font-size: 12.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.78;
}
.rh-name {
  margin: 10px 0 0;
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.rh-tier {
  margin: 10px 0 0;
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
}
.rh-headline {
  margin: 14px 0 0;
  font-size: 14.5px;
  line-height: 1.6;
  opacity: 0.88;
  max-width: 82%;
}

.result-body { padding: 0 22px; margin-top: -46px; position: relative; z-index: 3; }

.score-card { padding: 20px; }
.score-card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.score-card h3 em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.score-row + .score-row { margin-top: 16px; }
.score-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.score-row-head b { font-size: 19px; font-weight: 800; color: var(--purple-d); }
.score-bar {
  margin-top: 8px;
  height: 9px;
  border-radius: 999px;
  background: rgba(122, 94, 168, 0.13);
  position: relative;
  overflow: hidden;
}
.score-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b49bd4, #5e3f96);
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-bar::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 80%;
  width: 2px;
  background: rgba(94, 63, 150, 0.45);
  border-radius: 2px;
}
.score-note { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }

/* ---------------- 八维度雷达图（左优势 / 右劣势） ---------------- */
.radar-card {
  margin-top: 14px;
  padding: 20px 12px 16px;
}
.radar-card h3 {
  margin: 0 0 2px;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.radar-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}
.radar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.radar-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.radar-legend .dot.talent { background: #7a5ea8; }
.radar-legend .dot.flaw { background: #d97ba6; }

.radar-wrap { width: 100%; margin-top: 2px; }
.radar-wrap svg { display: block; width: 100%; height: auto; }
.radar-wrap .rl-name {
  font-size: 15px;
  font-weight: 600;
  fill: #241f2e;
}
.radar-wrap .rl-val {
  font-size: 14.5px;
  font-weight: 700;
}

.quote-block {
  margin-top: 16px;
  padding: 18px 18px 18px 20px;
  border-left: 4px solid var(--purple);
  background: #fff;
  border-radius: 4px 18px 18px 4px;
  box-shadow: var(--shadow);
}
.quote-block p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.75;
  font-weight: 600;
  color: #332b40;
}
.quote-block span {
  display: block;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.para-block { margin-top: 18px; }
.para-block p {
  margin: 0 0 12px;
  font-size: 15.5px;
  line-height: 1.85;
  color: rgba(36, 31, 46, 0.86);
}

.tips-block {
  margin-top: 18px;
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 18px 20px;
  border-left: 4px solid var(--pink);
  box-shadow: var(--shadow);
}
.tips-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #b8658c;
}
.tips-block p {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(36, 31, 46, 0.86);
}

.result-actions {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result-actions .row { display: flex; gap: 12px; }

.fine-print {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-3);
}

/* ============================================================
   4. 海报弹层
   ============================================================ */
.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;   /* 配合子元素 auto 边距：放得下就居中，放不下就滚动 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  background: rgba(24, 18, 34, 0.9);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.poster-modal.open { display: flex; animation: fadeIn 0.24s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.poster-scroll {
  width: 100%;
  max-width: 400px;
  max-height: 70vh;
  margin-top: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.poster-scroll img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  -webkit-touch-callout: default;   /* 微信 / iOS 长按可保存 */
  -webkit-user-select: auto;
  user-select: auto;
}

.poster-tip {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.86);
  max-width: 340px;
}
.poster-tip b { color: #fff; }

.poster-actions {
  margin-top: 16px;
  margin-bottom: auto;
  width: 100%;
  max-width: 400px;
  display: flex;
  gap: 12px;
}
.poster-actions .btn { min-height: 48px; font-size: 15.5px; }

@media (max-height: 640px) {
  .poster-scroll { max-height: 58vh; }
  .poster-tip { margin-top: 10px; font-size: 12px; }
  .poster-actions { margin-top: 10px; }
}
.btn-light {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}
.btn-white { color: var(--purple-d); background: #fff; }

/* 生成中 */
.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(24, 18, 34, 0.6);
  color: #fff;
  font-size: 14px;
}
.gen-overlay.open { display: flex; }
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 340px) {
  .gate-hero h1 { font-size: 40px; }
  .q-text { font-size: 17.5px; }
  .opt { font-size: 14.5px; }
}

/* ============================================================
   6. 自定义确认弹窗
   ============================================================ */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-start;      /* 配合卡片 auto 边距：放得下居中，矮屏可滚动 */
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  background: rgba(24, 18, 34, 0.52);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.confirm-modal.open { display: flex; animation: fadeIn 0.2s ease; }

.confirm-card {
  width: 100%;
  max-width: 320px;
  margin: auto 0;
  padding: 26px 22px 20px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: popIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.confirm-card h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.confirm-card p {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.confirm-actions {
  margin-top: 22px;
  display: flex;
  gap: 12px;
}
.confirm-actions .btn { min-height: 46px; font-size: 15px; }

/* ============================================================
   7. 轻提示
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 120;
  transform: translate(-50%, 12px);
  max-width: 78vw;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(36, 31, 46, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
