/* 隐藏天赋说明书 · 移动端优先的纸感 App Shell */
:root {
  --paper: #f7f6f2;
  --paper-2: #efede6;
  --surface: #ffffff;
  --ink: #18201d;
  --ink-2: #4a524e;
  --muted: #7c817b;
  --line: rgba(24, 32, 29, 0.1);
  --primary: #123b32;
  --primary-press: #0b2a23;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --partner: #d97706;
  --danger: #b42318;
  --r-shell: 32px;
  --r-panel: 22px;
  --r-ctl: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.45); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
p, li { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

.app {
  position: relative;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
@media (min-width: 600px) {
  body { background: #e6e4dc; }
  .app {
    margin: 24px auto;
    min-height: calc(100dvh - 48px);
    border-radius: var(--r-shell);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 30px 80px -30px rgba(24, 32, 29, 0.35), 0 0 0 1px rgba(24, 32, 29, 0.06);
  }
  .dock { border-radius: 0 0 var(--r-shell) var(--r-shell); }
}

.view { flex: 1; display: flex; flex-direction: column; padding: calc(12px + var(--safe-t)) 20px 0; }
.view.enter { animation: rise 0.32s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 启动态 */
.boot { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.boot-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--primary); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.noscript { padding: 24px; text-align: center; }

/* 顶栏 */
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; }
.link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 4px; margin-left: -4px;
  border: 0; background: none; color: var(--ink-2); font-size: 15px;
}
.link:active { opacity: 0.6; }
.link svg { width: 18px; height: 18px; }
.step { font: 600 15px/1 var(--mono); color: var(--ink-2); letter-spacing: 0.02em; }
.step b { color: var(--ink); }
.progress { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width 0.35s var(--ease); }

/* 底部操作区（固定易按，保护安全区） */
.dock {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto -20px 0; padding: 14px 20px calc(14px + var(--safe-b));
  background: linear-gradient(to top, var(--paper) 72%, rgba(247, 246, 242, 0));
  display: grid; gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; width: 100%;
  border-radius: var(--r-ctl); border: 1px solid transparent;
  font-size: 17px; font-weight: 600; letter-spacing: 0.01em;
  transition: transform 0.12s var(--ease), background-color 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 8px 20px -10px rgba(18, 59, 50, 0.6); }
.btn.primary:active { background: var(--primary-press); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.quiet { background: transparent; color: var(--ink-2); min-height: 44px; font-weight: 500; font-size: 15px; }
.btn.sm { min-height: 44px; font-size: 15px; width: auto; padding: 0 16px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.legal { text-align: center; font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; padding-top: 2px; }

/* 首页 */
.hero { padding-top: 28px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.hero h1 { margin-top: 18px; font-size: 40px; line-height: 1.15; font-weight: 800; letter-spacing: 0.02em; }
.hero .sub { margin-top: 10px; color: var(--ink-2); font-size: 16px; }
.preview { margin: 18px auto 0; width: min(100%, 320px); }
.radar { display: block; width: 100%; height: auto; overflow: visible; }
.radar text { font-family: var(--font); }

/* 答题 */
.question { flex: 1; display: flex; flex-direction: column; padding-top: 28px; }
.question .q { font-size: 22px; line-height: 1.6; font-weight: 650; letter-spacing: 0.01em; min-height: 5.2em; }
.question.swap { animation: swap 0.28s var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.options { display: grid; gap: 10px; margin-top: 26px; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 0 18px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface);
  font-size: 17px; font-weight: 500; text-align: left;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s, transform 0.12s var(--ease);
}
.opt:active { transform: scale(0.99); }
.opt .dots { display: inline-flex; gap: 4px; }
.opt .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.opt .dots i.on { background: var(--accent); }
.opt[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt[aria-checked="true"] .dots i { background: rgba(255, 255, 255, 0.28); }
.opt[aria-checked="true"] .dots i.on { background: #fff; }

/* 拦截页 */
.gate { padding-top: 20px; }
.gate h2 { font-size: 26px; line-height: 1.3; font-weight: 800; }
.blurwrap { position: relative; margin: 18px auto 0; width: min(100%, 300px); }
.blurwrap .radar { filter: blur(7px); opacity: 0.9; }
.lock {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px;
  color: var(--primary); font-size: 13px; font-weight: 600;
}
.lock span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: rgba(255, 255, 255, 0.86); box-shadow: 0 8px 24px -10px rgba(24, 32, 29, 0.35); }
.lock svg { width: 22px; height: 22px; }
.teaser { margin-top: 12px; font-size: 17px; line-height: 1.65; color: var(--ink); }
.teaser b { color: var(--accent); }

/* 口令表单 */
.redeem { margin-top: 22px; padding: 18px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; }
.redeem > p { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.field {
  width: 100%; height: 54px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1.5px solid var(--line); background: var(--paper);
  font: 600 18px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field.text { font: 500 17px/1 var(--font); letter-spacing: 0; text-transform: none; }
.field::placeholder { color: #b3b6ae; font-weight: 500; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
.field.bad { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.08); }
form[data-form] { display: grid; gap: 10px; }
.err { min-height: 1.3em; color: var(--danger); font-size: 13.5px; line-height: 1.3; }
.err:empty { min-height: 0; margin-bottom: -10px; }
.shake { animation: shake 0.32s; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* 结果页 */
.poster {
  margin-top: 6px; width: 100%; aspect-ratio: 3 / 4; border-radius: var(--r-panel); overflow: hidden;
  background: var(--paper-2); box-shadow: 0 24px 50px -28px rgba(24, 32, 29, 0.55), 0 0 0 1px rgba(24, 32, 29, 0.06);
}
.poster img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-touch-callout: default; }
.poster.loading { display: grid; place-content: center; color: var(--muted); font-size: 14px; }
.actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
.codeline {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 4px 4px 4px 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface);
}
.codeline code { font: 700 16px/1 var(--mono); letter-spacing: 0.04em; -webkit-user-select: all; user-select: all; overflow-wrap: anywhere; }

.section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section h3 { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.08em; margin-bottom: 12px; }
.section p { font-size: 16px; line-height: 1.7; }
.bars { display: grid; gap: 12px; }
.barrow { display: grid; grid-template-columns: 4.5em 1fr 2.2em; align-items: center; gap: 12px; font-size: 14.5px; }
.barrow .track { height: 8px; border-radius: 8px; background: var(--paper-2); overflow: hidden; }
.barrow .track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.barrow b { font: 700 15px/1 var(--mono); text-align: right; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: n; }
.list li { display: grid; grid-template-columns: 26px 1fr; gap: 6px; font-size: 16px; line-height: 1.65; counter-increment: n; }
.list li::before { content: counter(n, decimal-leading-zero); font: 700 13px/1.9 var(--mono); color: var(--accent); }
.partner { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.partner strong { font-size: 19px; }

/* 双人合拍 */
.pairbox { margin-top: 8px; padding: 18px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; }
.pairbox h2, .pairhead h2 { font-size: 20px; font-weight: 800; }
.locked { position: relative; }
.locked .blurwrap { width: min(100%, 240px); margin-top: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.scorecard {
  margin-top: 14px; padding: 20px; border-radius: var(--r-panel);
  background: #221b19; color: #fff; display: grid; gap: 8px;
}
.scorecard .num { display: flex; align-items: baseline; gap: 10px; }
.scorecard .num strong { font-size: 64px; line-height: 1; font-weight: 800; color: #fcd34d; letter-spacing: -0.02em; }
.scorecard .num span { font-size: 18px; font-weight: 700; }
.scorecard .band { font-size: 20px; font-weight: 800; line-height: 1.35; }
.scorecard p { color: rgba(255, 255, 255, 0.78); font-size: 15px; line-height: 1.65; }
.insight { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.insight:last-child { border-bottom: 0; }
.insight .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.insight .h { font-size: 17px; font-weight: 800; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.insight .h small { font: 600 13px/1 var(--mono); color: var(--ink-2); }
.insight p { font-size: 15.5px; line-height: 1.7; color: var(--ink); }

/* 浮层：底部弹层 / 确认框 / 长按存图 */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(16, 22, 20, 0.42); animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 430px; margin: 0 auto; padding: 10px 20px calc(20px + var(--safe-b));
  background: var(--paper); border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px -20px rgba(16, 22, 20, 0.4);
  display: grid; gap: 12px; animation: up 0.3s var(--ease);
}
@keyframes up { from { transform: translateY(100%); } }
.grip { width: 38px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 6px; }
.sheet h2 { font-size: 20px; font-weight: 800; }
.sheet .hint { font-size: 14px; color: var(--ink-2); margin-top: -4px; }
.dialog {
  position: fixed; left: 50%; top: 50%; z-index: 41; width: min(calc(100% - 48px), 340px);
  transform: translate(-50%, -50%); padding: 22px 20px 16px; border-radius: var(--r-panel);
  background: var(--surface); box-shadow: 0 30px 80px -20px rgba(16, 22, 20, 0.45); display: grid; gap: 10px;
  animation: pop 0.22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); } }
.dialog h2 { font-size: 18px; font-weight: 800; }
.dialog p { font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.dialog .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.dialog .btn { min-height: 48px; font-size: 16px; }
.btn.danger { background: var(--danger); color: #fff; }
.viewer {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 13, 12, 0.96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b)); animation: fade 0.2s;
}
.viewer img { max-width: min(100%, 420px); max-height: calc(100dvh - 160px); border-radius: 16px; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.viewer p { color: rgba(255, 255, 255, 0.86); font-size: 15px; font-weight: 600; }
.viewer .btn { width: auto; min-width: 140px; background: rgba(255, 255, 255, 0.14); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 48px); padding: 11px 18px; border-radius: 999px;
  background: rgba(24, 32, 29, 0.92); color: #fff; font-size: 14.5px; font-weight: 600; text-align: center;
  transition: opacity 0.2s, transform 0.25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.foot { display: grid; gap: 4px; padding: 18px 0 calc(22px + var(--safe-b)); }
