/* ============================================================
 * 纯洁度测试 · 专属样式
 * 独立主题：粉蓝渐变 + 毛玻璃卡片，变量全部用 --pt- 前缀，
 * 不依赖也不污染 shared/style.css。
 * 不引用任何外部字体/CDN（大陆网络友好，见 HANDBOOK 2.2）。
 * ============================================================ */

:root {
  --pt-accent: #e85d8a;          /* 当前等级主题色，由 purity-app.js 随等级切换 */
  --pt-ink: #3b2a3f;             /* 卡片内正文 */
  --pt-ink-soft: #7d6a82;
  --pt-glass: rgba(255, 255, 255, .74);
  --pt-glass-line: rgba(255, 255, 255, .85);
  --pt-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
             "Source Han Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--pt-font);
  color: var(--pt-ink);
  background: #ffe4ee;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* ---------- 背景两层交叉淡入 ---------- */
.pt-bg {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  opacity: 0; transition: opacity .7s ease;
}
.pt-bg.is-on { opacity: 1; }

/* ---------- 舞台 ---------- */
.pt-stage {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.pt-screen {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center;
  animation: ptFade .4s ease both;
}

/* ---------- 开始页 ---------- */
.pt-title {
  margin: 0 0 14px; text-align: center;
  font-size: clamp(54px, 17vw, 88px); line-height: 1.12; font-weight: 900; letter-spacing: .02em;
  color: #fff;
  -webkit-text-stroke: .11em var(--pt-accent);
  paint-order: stroke fill;
  text-shadow: 0 .05em 0 rgba(90, 30, 70, .28), 0 .1em .25em rgba(90, 30, 70, .22);
}
.pt-tag {
  margin: 0 0 22px; padding: 8px 20px;
  font-size: 17px; font-weight: 700; color: var(--pt-ink);
  background: rgba(255, 255, 255, .82);
  border-radius: 6px 14px 8px 12px;
  transform: rotate(-1.6deg);
  box-shadow: 0 6px 16px rgba(120, 60, 100, .14);
}
.pt-notes {
  list-style: none; margin: 0 0 28px; padding: 16px 18px; width: 100%;
  font-size: 14px; line-height: 1.7; color: var(--pt-ink-soft);
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line); border-radius: 18px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.pt-notes li { position: relative; padding-left: 16px; }
.pt-notes li + li { margin-top: 4px; }
.pt-notes li::before {
  content: ""; position: absolute; left: 0; top: .72em;
  width: 7px; height: 7px; border-radius: 50%; background: var(--pt-accent);
}

.pt-go {
  appearance: none; border: 0; cursor: pointer;
  min-width: 220px; padding: 16px 36px;
  font: 800 20px/1 var(--pt-font); letter-spacing: .12em; color: #fff;
  background: var(--pt-accent); border-radius: 999px;
  box-shadow: 0 10px 24px rgba(120, 40, 90, .28);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--pt-accent) 45%, transparent); /* 旧 WebView 不认识就沿用上一行 */
  transition: transform .15s ease, box-shadow .15s ease;
}
.pt-go:active { transform: scale(.97); }

/* ---------- 访问码页 ---------- */
.pt-title--sm { font-size: clamp(44px, 14vw, 68px); margin-bottom: 22px; }
.pt-gate-box {
  width: 100%; padding: 22px 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line); border-radius: 24px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(90, 40, 90, .16);
}
.pt-gate-label { font-size: 15px; font-weight: 800; color: var(--pt-ink); letter-spacing: .1em; }
.pt-gate-input {
  width: 100%; max-width: 280px; padding: 14px 12px; text-align: center;
  font: 800 28px/1.1 var(--pt-font); letter-spacing: .5em; text-indent: .5em; color: var(--pt-ink);
  background: rgba(255, 255, 255, .92); border: 2px solid var(--pt-accent); border-radius: 16px; outline: none;
}
.pt-gate-input::placeholder { color: #c9b9cd; }
.pt-gate-input:focus { box-shadow: 0 0 0 4px rgba(232, 93, 138, .22); }
.pt-gate-msg { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 700; color: #c0314f; text-align: center; }
.pt-gate-box.is-wrong { animation: ptShake .38s ease; }
.pt-gate-box .pt-go { margin-top: 2px; }
@keyframes ptShake {
  0%, 100% { transform: none; } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); }
}

/* ---------- 答题页 ---------- */
.pt-top {
  width: 100%; display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.pt-back {
  appearance: none; border: 1px solid var(--pt-glass-line); cursor: pointer;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  font: 700 26px/1 var(--pt-font); color: var(--pt-ink);
  background: var(--pt-glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pt-back:disabled { opacity: .35; cursor: default; }
.pt-level {
  flex: 1; min-width: 0; padding: 6px 14px; border-radius: 14px;
  display: flex; flex-direction: column; line-height: 1.25;
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pt-lv { font-size: 15px; font-weight: 800; color: var(--pt-accent); }
.pt-lvdesc { font-size: 12px; color: var(--pt-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-count {
  flex: none; padding: 6px 12px; border-radius: 14px;
  font-size: 13px; font-weight: 700; color: var(--pt-ink); font-variant-numeric: tabular-nums;
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}

.pt-progress {
  width: 100%; height: 8px; border-radius: 99px; overflow: hidden; margin-bottom: 18px;
  background: rgba(255, 255, 255, .55);
}
.pt-progress i {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: var(--pt-accent); transition: width .35s ease, background .5s ease;
}

.pt-card {
  width: 100%; padding: 26px 22px 22px; border-radius: 26px;
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 18px 44px rgba(90, 40, 90, .18);
}
.pt-card.is-in { animation: ptIn .28s ease both; }
.pt-qnum { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .1em; color: var(--pt-accent); }
.pt-q {
  margin: 0; min-height: 4.2em; display: flex; align-items: center;
  font-size: clamp(22px, 6.4vw, 28px); line-height: 1.45; font-weight: 800; color: var(--pt-ink);
}
.pt-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.pt-btn {
  appearance: none; cursor: pointer; min-height: 68px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: var(--pt-font); transition: transform .12s ease, background .2s ease;
}
.pt-btn b { font-size: 22px; letter-spacing: .04em; }
.pt-btn small { font-size: 13px; opacity: .85; }
.pt-btn:active { transform: scale(.96); }
.pt-yes { border: 2px solid var(--pt-accent); color: #fff; background: var(--pt-accent); }
.pt-no  { border: 2px solid var(--pt-accent); color: var(--pt-accent); background: rgba(255, 255, 255, .85); }
.pt-btn.is-picked { box-shadow: 0 0 0 4px rgba(255, 255, 255, .85); }
.pt-btn.is-picked { box-shadow: 0 0 0 4px color-mix(in srgb, var(--pt-accent) 35%, white); }

/* ---------- 结果页 ---------- */
.pt-result { text-align: center; }
.pt-result-label {
  margin: 0; padding: 5px 16px; font-size: 14px; font-weight: 700; letter-spacing: .2em;
  color: var(--pt-ink); background: rgba(255, 255, 255, .75); border-radius: 99px;
}
.pt-score {
  margin: 6px 0 12px; display: flex; align-items: baseline; justify-content: center; gap: 4px;
  font-weight: 900; color: #fff; line-height: 1;
  -webkit-text-stroke: .09em var(--pt-accent); paint-order: stroke fill;
  text-shadow: 0 .05em 0 rgba(90, 30, 70, .28), 0 .1em .25em rgba(90, 30, 70, .22);
}
.pt-score span { font-size: clamp(84px, 28vw, 128px); font-variant-numeric: tabular-nums; }
.pt-score em { font-style: normal; font-size: 30px; }

.pt-idcard {
  position: relative; width: min(64vw, 260px); aspect-ratio: 3 / 4; margin-bottom: 16px;
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(60, 20, 70, .28), 0 0 0 4px rgba(255, 255, 255, .8);
  animation: ptPop .5s cubic-bezier(.2, 1.2, .4, 1) both;
}
.pt-idcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 身份卡图片加载成功后：按原图比例显示（各张卡比例可以不同），不裁切 */
.pt-idcard.has-img { aspect-ratio: auto; width: min(66vw, 280px); }
.pt-idcard.has-img img { position: static; display: block; height: auto; }
.pt-idfallback {
  position: absolute; inset: 0; padding: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border-radius: 22px;
}
.pt-idfallback::before {
  content: ""; position: absolute; inset: 10px; border-radius: 14px;
  border: 2px solid currentColor; opacity: .35;
}
.pt-id-sub { font-size: 11px; font-weight: 700; letter-spacing: .3em; opacity: .75; }
.pt-idfallback strong {
  font-size: 44px; line-height: 1.15; font-weight: 900; letter-spacing: .06em;
  writing-mode: vertical-rl; text-orientation: upright;
}
.pt-id-range { font-size: 13px; font-weight: 700; opacity: .8; }

.pt-tier { margin: 0 0 6px; font-size: 26px; font-weight: 900; color: var(--pt-ink); }
.pt-blurb {
  margin: 0 0 10px; padding: 12px 18px; font-size: 15px; line-height: 1.6; color: var(--pt-ink);
  background: var(--pt-glass); border: 1px solid var(--pt-glass-line); border-radius: 16px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.pt-detail { margin: 0 0 20px; font-size: 13px; color: var(--pt-ink); opacity: .75; }
.pt-hint { margin: 16px 0 0; font-size: 12px; line-height: 1.7; color: var(--pt-ink); opacity: .7; }

/* ---------- 深色背景（LEVELS[i].dark = true）---------- */
body.is-dark { --pt-glass: rgba(255, 255, 255, .9); --pt-glass-line: rgba(255, 255, 255, .55); }
body.is-dark .pt-tier { color: #fff; text-shadow: 0 2px 10px rgba(20, 8, 40, .45); }
body.is-dark .pt-detail,
body.is-dark .pt-hint { color: #fff; opacity: .85; }
body.is-dark .pt-progress { background: rgba(255, 255, 255, .3); }

/* ---------- 升级提示 ---------- */
.pt-toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 76px); z-index: 5;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 10px 22px; border-radius: 99px; white-space: nowrap;
  font-size: 15px; font-weight: 800; color: #fff; background: var(--pt-accent);
  box-shadow: 0 10px 24px rgba(60, 20, 70, .25);
  transition: opacity .3s ease, transform .3s ease;
}
.pt-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 动画 ---------- */
@keyframes ptFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ptIn   { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ptPop  { from { opacity: 0; transform: scale(.8) rotate(-4deg); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 小屏手机再收紧一点，保证一屏内放得下 */
@media (max-height: 640px) {
  .pt-card { padding: 18px 18px 16px; }
  .pt-q { min-height: 3.4em; }
  .pt-btn { min-height: 58px; }
  .pt-idcard { width: min(50vw, 200px); }
}
