:root {
  --accent: #e63946;
  --ink: #1d1d1f;
  --muted: rgba(0, 0, 0, .55);
  --bg: #fff5ef;
  --radius: 20px;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
button { font: inherit; cursor: pointer; border: 0; color: inherit; }
img { -webkit-user-drag: none; }
.wrap { max-width: 480px; margin: 0 auto; padding: 16px 16px 24px; }
.screen { display: none; animation: fade .25s ease; }
.screen.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 首页 */
.hero { text-align: center; padding-top: 6vh; }
.badge { display: inline-block; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; padding: 6px 14px; border-radius: 999px; letter-spacing: 1px; }
h1 { font-size: 46px; font-weight: 900; margin: 16px 0 6px; letter-spacing: 1px; }
.sub { color: var(--muted); margin: 0 0 12px; font-size: 15px; }
.hero-box { width: 168px; height: 168px; margin: 18px auto 4px; display: block; animation: float 2.4s ease-in-out infinite; filter: drop-shadow(0 16px 20px rgba(230,57,70,.25)); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
.collect { color: var(--accent); font-weight: 800; font-size: 14px; margin: 6px 0 14px; }
.invite { background: #fff; border-radius: var(--radius); padding: 12px 16px; font-weight: 600; font-size: 14px; line-height: 1.6; white-space: pre-line; box-shadow: 0 6px 20px rgba(0,0,0,.06); text-align: left; }

.btn { display: block; width: 100%; padding: 16px; border-radius: 999px; font-size: 17px; font-weight: 800; margin: 12px 0; text-align: center; text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid rgba(0,0,0,.08); }
.btn.text { background: none; color: var(--muted); font-weight: 500; }
.btn:active, .opt:active, .chip:active { transform: scale(.98); }
.fine { color: var(--muted); font-size: 12px; margin-top: 22px; line-height: 1.7; }

/* 答题 */
.topbar { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 700; }
.icon-btn { background: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 26px; line-height: 1; }
.bar { height: 8px; background: rgba(0,0,0,.06); border-radius: 99px; margin: 14px 0 8px; overflow: hidden; }
#bar-in { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.q-cart { font-size: 16px; letter-spacing: 2px; min-height: 22px; margin: 0 0 14px; }
.q { font-size: 25px; line-height: 1.45; font-weight: 900; margin: 6px 0 22px; }
.opts { display: grid; gap: 12px; }
.opt { background: #fff; text-align: left; padding: 18px; border-radius: var(--radius); font-size: 16px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.05); border: 1.5px solid transparent; }
.opt:hover { border-color: var(--accent); }
.opts.blind { grid-template-columns: 1fr 1fr; }
.opts.blind .opt { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-weight: 800; padding: 16px 8px; }
.opts.blind .opt img { width: 84px; height: 84px; transition: transform .3s; }
.opts.blind .opt:hover img { transform: rotate(-8deg) scale(1.06); }
.opts.blind .opt.opened img { animation: pop .6s ease; }
@keyframes pop { 30% { transform: scale(1.25) rotate(10deg); } 100% { transform: scale(0); opacity: 0; } }

/* 购物车 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chip { background: #fff; border-radius: 16px; padding: 12px 6px; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 2px solid transparent; }
.chip-i { font-size: 26px; }
.chip.on { border-color: var(--accent); background: #fff4f2; }
.h3 { font-size: 16px; margin: 24px 0 10px; }
.segs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seg { background: #fff; border-radius: 14px; padding: 12px; font-size: 15px; border: 2px solid transparent; }
.seg.on { border-color: var(--accent); font-weight: 800; }
.input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid rgba(0,0,0,.08); font-size: 16px; font-family: inherit; }

/* 开盒 */
.loading { text-align: center; padding-top: 26vh; color: var(--muted); font-weight: 700; }
.loading img { width: 150px; height: 150px; }
.shake { animation: shake .45s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg) scale(1.05); } 75% { transform: rotate(10deg) scale(1.05); } }
#s-load.holo { background: linear-gradient(120deg, #ff4d9d, #ffc94d, #4dd8ff, #b04dff); background-size: 300% 300%; animation: holo 1.2s linear infinite; border-radius: 24px; color: #fff; min-height: 80vh; }
#s-load.holo .loading { color: #fff; font-size: 22px; }
@keyframes holo { 0% { background-position: 0% 50%; } 100% { background-position: 100% 50%; } }

/* 结果 */
.ver { margin: 4px 0 0; }
.ver .seg { padding: 10px; font-size: 14px; }
.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0; }
.card-img { width: 100%; border-radius: 18px; box-shadow: 0 16px 40px rgba(0,0,0,.14); display: block; -webkit-touch-callout: default; }
.card-img.flip { animation: flip .7s cubic-bezier(.2,.8,.2,1); }
@keyframes flip { from { transform: perspective(900px) rotateY(90deg) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.actions .btn { margin: 8px 0 4px; }
.detail { background: #fff; border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; line-height: 1.7; font-size: 15px; }
.detail p { margin: 6px 0; }
.r-head { font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.tier { color: #fff; font-size: 13px; font-weight: 900; padding: 2px 10px; border-radius: 999px; }
.pair-title { font-weight: 900; font-size: 17px; text-align: center; color: var(--accent); }
.muted { color: var(--muted); font-size: 14px; }
.collect-tip { text-align: center; font-size: 14px; font-weight: 700; color: var(--accent); margin: 6px 0; }

/* 图鉴 */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.g-card { position: relative; border-radius: 18px; padding: 14px; min-height: 196px; border: 3px solid transparent; }
.g-tier { position: absolute; top: 10px; right: 10px; color: #fff; font-size: 11px; font-weight: 900; padding: 1px 8px; border-radius: 999px; }
.g-img { width: 56px; height: 56px; }
.g-card.locked .g-img { filter: brightness(0); opacity: .18; }
.g-card.locked { color: rgba(0,0,0,.45); }
.g-code { font-weight: 900; font-size: 21px; letter-spacing: .5px; margin-top: 4px; }
.g-name { font-weight: 800; font-size: 16px; margin: 2px 0 4px; }
.g-v { font-size: 12.5px; line-height: 1.5; color: rgba(0,0,0,.65); }

.site-foot { text-align: center; padding: 4px 0 calc(16px + env(safe-area-inset-bottom)); }
.site-foot a { color: rgba(0,0,0,.35); font-size: 12px; text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px); background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 9; white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
