* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #f3eee4; color: #1d1712; overflow-x: hidden;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#bg {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255,255,255,.9), rgba(255,255,255,0) 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0l28 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='%23c9bda7' stroke-opacity='.28' stroke-width='1'/%3E%3C/svg%3E"),
    #f3eee4;
}
#dim { position: fixed; inset: 0; z-index: -1; background: radial-gradient(60% 45% at 50% 46%, #2a2236 0%, #0d0a12 70%); opacity: 0; transition: opacity .6s ease; pointer-events: none; }
body.dark #dim { opacity: 1; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
#app { max-width: 440px; margin: 0 auto; min-height: 100%; padding: max(14px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); position: relative; }
.screen { display: none; flex-direction: column; align-items: center; min-height: calc(100vh - 40px); min-height: calc(100dvh - 40px); }
.screen.on { display: flex; animation: in .45s cubic-bezier(.2,.8,.2,1); }
@keyframes in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 ---------- */
.brand { text-align: center; margin: clamp(6px, 3vh, 22px) 0 clamp(12px, 2.4vh, 22px); }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: .5em; color: #8a7a62; margin-bottom: 10px; padding-left: .5em; }
h1 { font-size: clamp(30px, 9.4vw, 38px); font-weight: 900; letter-spacing: .01em; line-height: 1.15; }
h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #ff7a33 0%, #e2a321 35%, #9a7bff 70%, #5fd47a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { margin-top: 10px; color: #7a6b56; font-size: 14px; letter-spacing: .04em; }
.namebox {
  display: flex; align-items: center; gap: 10px; width: 100%; background: #fffdf8; border-radius: 16px;
  padding: 6px 8px 6px 18px; box-shadow: 0 1px 0 #fff inset, 0 6px 18px -8px rgba(60,40,10,.28), 0 0 0 1px #e4d9c6;
}
.namebox span { font-size: 13px; font-weight: 800; color: #8a7a62; letter-spacing: .2em; }
.namebox input { flex: 1; border: none; outline: none; background: transparent; font-size: 18px; font-weight: 700; padding: 10px 4px; color: #1d1712; min-width: 0; }
.namebox input::placeholder { color: #c2b49c; font-weight: 500; }
.namebox.shake { animation: nshake .4s; box-shadow: 0 0 0 2px #ff7a33; }
@keyframes nshake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* ---------- 扇形兽核卡 ---------- */
.fan { position: relative; width: 100%; height: clamp(232px, 33vh, 280px); margin-top: clamp(18px, 4vh, 40px); }
.core-card {
  --r: 0deg; --x: 0px; --lift: 0px;
  position: absolute; left: 50%; bottom: 0; width: clamp(108px, 31vw, 136px); aspect-ratio: 5 / 7.2;
  margin-left: calc(clamp(108px, 31vw, 136px) / -2);
  transform-origin: 50% 135%;
  transform: translateX(var(--x)) rotate(var(--r)) translateY(var(--lift));
  border: none; cursor: pointer; font: inherit; color: #fff; padding: 0; border-radius: 14px;
  background: linear-gradient(160deg, var(--a), var(--b) 55%, var(--d));
  box-shadow: 0 0 0 2px rgba(255,255,255,.55) inset, 0 0 0 5px var(--d) inset, 0 18px 26px -14px rgba(30,15,0,.7);
  transition: transform .35s cubic-bezier(.2,1.3,.4,1), opacity .3s, filter .3s;
  overflow: hidden;
}
.core-card::before {
  content: ""; position: absolute; inset: 0; opacity: .18;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='38' viewBox='0 0 22 38'%3E%3Cpath d='M11 0l11 6.5v13L11 26 0 19.5v-13zM11 26v12' fill='none' stroke='white' stroke-width='1'/%3E%3C/svg%3E");
}
.core-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 48%, transparent 60%);
  background-size: 300% 300%; animation: sheen 4.5s ease-in-out infinite; animation-delay: var(--delay, 0s);
}
@keyframes sheen { 0%,100% { background-position: 100% 100%; } 50% { background-position: 0% 0%; } }
.core-card .egg { position: absolute; left: 17%; top: 12%; width: 70%; height: auto; overflow: visible; filter: drop-shadow(0 8px 8px rgba(0,0,0,.45)); animation: bob 3s ease-in-out infinite; animation-delay: var(--delay, 0s); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
.core-card b { position: absolute; left: 9px; top: 9px; width: 1.1em; font-size: 16px; line-height: 1.05; font-weight: 900; text-align: center; text-shadow: 0 2px 4px rgba(0,0,0,.55); }
.core-card i { display: none; position: absolute; left: 0; right: 0; bottom: 9px; font-style: normal; font-size: 13px; font-weight: 900; letter-spacing: .1em; opacity: .92; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.core-card small { display: none; }
.core-card:hover, .core-card:focus-visible { --lift: -14px; }
.core-card:active { --lift: -18px; }
.fan.picked .core-card { opacity: .25; filter: grayscale(.6); }
.fan.picked .core-card.chosen { opacity: 1; filter: none; --lift: -46px; z-index: 5; }
.tip { margin-top: 14px; font-size: 13px; color: #a5937a; letter-spacing: .1em; text-align: center; }
.wx-cover { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- 敲兽核 ---------- */
.crack-tip { margin-top: clamp(30px, 9vh, 70px); color: #d9cbe8; font-size: 15px; letter-spacing: .3em; font-weight: 700; min-height: 22px; }
.crack-stage { position: relative; width: 300px; height: 380px; display: flex; align-items: center; justify-content: center; margin-top: 30px; cursor: pointer; }
.big-core { position: relative; width: 168px; height: 210px; z-index: 2; transition: filter .3s; animation: bob 2.6s ease-in-out infinite; }
.big-core .egg-host, .big-core .egg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.big-core.hit { animation: hit .32s; }
@keyframes hit { 0% { transform: scale(1); } 30% { transform: scale(.92, 1.06) rotate(-4deg); } 60% { transform: scale(1.05, .95) rotate(3deg); } 100% { transform: scale(1); } }
.big-core.gone { animation: none; transform: scale(1.5); opacity: 0; transition: transform .35s ease-in, opacity .35s ease-in; }
.cracks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cracks path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px var(--glow)) drop-shadow(0 0 8px var(--glow)); stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw .25s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.core-shadow { position: absolute; bottom: 40px; width: 150px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.55), rgba(0,0,0,0)); }
.rays {
  position: absolute; width: 640px; height: 640px; border-radius: 50%; opacity: 0; transition: opacity .3s;
  background: repeating-conic-gradient(from 0deg, var(--glow) 0deg 3deg, transparent 3deg 15deg);
  -webkit-mask: radial-gradient(closest-side, #000 18%, transparent 72%); mask: radial-gradient(closest-side, #000 18%, transparent 72%);
  animation: spin 9s linear infinite;
}
.rays.on { opacity: .55; }
.rays.full { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.flying { position: absolute; left: 50%; top: 52%; width: 250px; aspect-ratio: 750/1050; margin-left: -125px; margin-top: -175px; pointer-events: none; perspective: 900px; z-index: 5; }
.flying canvas { width: 100%; height: 100%; border-radius: 13px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.7); }

/* ---------- 卡 ---------- */
.track { display: flex; gap: 6px; align-items: center; margin: 6px 0 14px; }
.track i { width: 30px; height: 6px; border-radius: 3px; background: #ddd2bf; transition: background .4s, box-shadow .4s; }
.track i.on { background: linear-gradient(90deg, #e2a321, #ff7a33); box-shadow: 0 0 10px rgba(255,140,40,.6); }
.track span { font-size: 11px; color: #a5937a; font-weight: 800; letter-spacing: .1em; }

.card3d { width: min(76vw, 320px, calc((100dvh - 360px) * .714)); min-width: 200px; perspective: 1000px; position: relative; }
.card3d.big { width: min(84vw, 350px, calc((100dvh - 290px) * .714)); }
.card-inner {
  --rx: 0deg; --ry: 0deg; --px: 50%; --py: 50%;
  position: relative; border-radius: 5.3% / 3.8%; transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  box-shadow: 0 2px 0 rgba(255,255,255,.4) inset, 0 28px 40px -22px rgba(40,25,5,.55), 0 8px 14px -8px rgba(40,25,5,.4);
  transition: box-shadow .4s;
}
.card-inner canvas { display: block; width: 100%; border-radius: inherit; }
.card-inner .foil, .card-inner .glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.foil { opacity: 0; mix-blend-mode: color-dodge; background-size: 250% 250%; background-position: var(--px) var(--py); transition: opacity .5s; }
.foil.SR { opacity: .3; background-image: linear-gradient(115deg, transparent 30%, rgba(220,230,255,.9) 46%, rgba(255,255,255,.95) 50%, rgba(200,215,255,.8) 54%, transparent 70%); }
.foil.SSR { opacity: .38; background-image: linear-gradient(115deg, transparent 28%, rgba(255,214,120,.9) 44%, rgba(255,250,220,1) 50%, rgba(255,190,80,.9) 56%, transparent 72%); }
.foil.UR {
  opacity: .3;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.8) 0 1px, transparent 2px),
    repeating-linear-gradient(115deg, #ff5f8f 0%, #ffb35c 8%, #ffe96b 16%, #6cf0a0 24%, #5fc8ff 32%, #9b7bff 40%, #ff5f8f 48%);
  background-size: 23px 23px, 31px 31px, 250% 250%;
}
.glare { background: radial-gradient(circle at var(--px) var(--py), rgba(255,255,255,.55), rgba(255,255,255,0) 42%); mix-blend-mode: overlay; opacity: .8; }
.card-inner.charge { animation: charge .9s ease-in infinite; }
@keyframes charge { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.35) drop-shadow(0 0 18px var(--glow, #ffd27a)); } }
.card-inner.shiver { animation: shiver .08s linear infinite; }
@keyframes shiver { 50% { translate: 2px -1px; } }
.card-inner.flip { transition: transform .26s ease-in; transform: rotateY(90deg) scale(1.04); }
.card-inner.flip-back { transition: transform .38s cubic-bezier(.2,1.5,.4,1); }
.card-inner.dud { filter: grayscale(.6) brightness(.85); transition: filter .5s; }

.banner { height: 34px; margin-top: 14px; font-size: 19px; font-weight: 900; text-align: center; opacity: 0; transform: translateY(6px); transition: all .35s; }
.banner.on { opacity: 1; transform: none; }
.banner .tier { display: inline-block; padding: 2px 10px; margin-right: 8px; border-radius: 8px; font-size: 14px; color: #fff; vertical-align: 2px; font-family: "Bahnschrift","DIN Alternate",sans-serif; }

.ask { width: 100%; margin-top: 6px; transition: opacity .3s; }
.ask.off { opacity: 0; pointer-events: none; }
.ask-q { font-size: clamp(16px, 4.6vw, 18px); font-weight: 900; line-height: 1.45; text-align: center; margin-bottom: 14px; padding: 0 6px; }
.ask-opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  border: none; cursor: pointer; font: inherit; text-align: left; font-size: 15px; font-weight: 700; line-height: 1.4;
  padding: 12px 14px 12px 44px; border-radius: 14px; position: relative; color: #1d1712;
  background: linear-gradient(180deg, #fffdf8, #f7f0e3);
  box-shadow: 0 1px 0 #fff inset, 0 8px 18px -12px rgba(60,40,10,.5), 0 0 0 1px #e6dbc8;
  transition: transform .12s;
}
.opt::before { content: attr(data-k); position: absolute; left: 14px; top: 50%; margin-top: -11px; width: 22px; height: 22px; border-radius: 7px; background: #1d1712; color: #f3eee4; font-size: 12px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.opt:active { transform: scale(.97); }
.opt.lazy { background: transparent; box-shadow: 0 0 0 1px #ddd0bb; color: #8a7a62; font-weight: 600; }
.opt.lazy::before { background: #c9bba3; content: "躺"; }
.opt small { display: block; font-size: 12px; font-weight: 600; color: #8a7a62; margin-top: 2px; }

/* ---------- 结果 ---------- */
.res-who { margin: 4px 0 14px; font-size: 15px; font-weight: 800; letter-spacing: .12em; color: #7a6b56; }
.chain { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 18px 0 6px; flex-wrap: wrap; }
.chain .c { width: 46px; text-align: center; }
.chain .c img { width: 40px; height: 40px; object-fit: contain; }
.chain .c b { display: block; font-size: 10px; color: #7a6b56; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chain .arr { color: #c2b49c; font-weight: 900; font-size: 12px; }
.res-line { font-size: 15px; font-weight: 800; text-align: center; margin: 8px 0 16px; line-height: 1.5; }
.row { display: flex; gap: 10px; width: 100%; }
.btn { flex: 1; border: none; cursor: pointer; font: inherit; font-size: 16px; font-weight: 900; padding: 15px 10px; border-radius: 14px; text-align: center; text-decoration: none; }
.btn.gold { color: #3a2400; background: linear-gradient(180deg, #ffe08a, #e2a321); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 20px -10px rgba(160,100,0,.7); }
.btn.ghost { color: #5a4b38; background: transparent; box-shadow: 0 0 0 1.5px #d6c8b0; }
.btn:active { transform: scale(.97); }

.sheet { position: fixed; inset: 0; background: rgba(20,14,8,.94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.sheet.on { display: flex; animation: in .3s; }
.sheet-box { width: 100%; max-width: 400px; text-align: center; color: #f3eee4; }
.sheet-box img { width: auto; max-width: 100%; max-height: calc(100dvh - 170px); display: block; margin: 0 auto; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.6); -webkit-touch-callout: default; user-select: auto; }
.sheet-box p { margin: 12px 0; font-size: 14px; letter-spacing: .1em; }
.sheet .btn.ghost { color: #f3eee4; box-shadow: 0 0 0 1.5px rgba(255,255,255,.4); }

.wx-tip { margin-top: 12px; font-size: 13px; color: #8a7a62; text-align: center; line-height: 1.5; }
.wx-tip:empty { display: none; }
@media (max-height: 640px) {
  .sub { display: none; }
  .banner { height: 28px; margin-top: 8px; font-size: 17px; }
  .ask-opts { gap: 7px; }
}
.res-line b { display: block; font-size: 17px; font-weight: 900; color: #b0601a; }
.res-line span { display: block; font-size: 14px; font-weight: 700; color: #5a4b38; margin-top: 4px; }
.res-line span:empty { display: none; }

/* ---------- 3D 兽核祭坛 ---------- */
#stage { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0; transition: opacity .6s; pointer-events: none; display: block; }
body.has3d.home3d #stage, body.has3d.stage-crack #stage { opacity: 1; pointer-events: auto; }
body.has3d.home3d #dim, body.has3d.stage-crack #dim { opacity: 1; background: radial-gradient(90% 60% at 50% 58%, #3a2348 0%, #160e22 55%, #08060d 100%); }
.pick3d { display: none; }
body.has3d .fan, body.has3d .fan-tip { display: none; }
body.has3d .pick3d { display: flex; flex-direction: column; align-items: center; width: 100%; margin-top: auto; pointer-events: none; }
body.has3d .pick3d > * { pointer-events: auto; }
body.has3d.home3d #s-home { pointer-events: none; }
body.has3d.home3d #s-home .brand, body.has3d.home3d #s-home .pick3d { pointer-events: none; }
body.has3d.home3d #s-home .pick3d button { pointer-events: auto; }
body.has3d.home3d .brand h1 { color: #fff6e8; text-shadow: 0 2px 20px rgba(0,0,0,.5); }
body.has3d.home3d .brand .kicker { color: #c9b59a; }
body.has3d.home3d .brand .sub { color: #d8c8e8; }
.pick-info { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.pick-arrow { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(255,240,220,.35); background: rgba(255,255,255,.06); color: #fff6e8; font-size: 28px; line-height: 1; cursor: pointer; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.pick-arrow:active { transform: scale(.92); }
.pick-text { flex: 1; text-align: center; }
.pick-text b { --glow: #ffc860; display: block; font-size: clamp(26px, 8vw, 32px); font-weight: 900; color: #fff; letter-spacing: .08em; text-shadow: 0 0 18px var(--glow), 0 0 40px var(--glow); }
.pick-text b.pop { animation: lpop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes lpop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.pick-text span { display: block; margin-top: 6px; font-size: 14px; color: #e9dccb; font-weight: 700; }
.pick-dots { display: flex; gap: 8px; margin: 14px 0 16px; }
.pick-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.3); transition: all .3s; }
.pick-dots i.on { width: 22px; border-radius: 4px; background: #ffc860; box-shadow: 0 0 10px #ffc860; }
.pick-go { width: 78%; max-width: 300px; flex: none; font-size: 19px; padding: 16px; letter-spacing: .1em; }
body.has3d .pick3d .tip { color: #a99ab8; margin-top: 10px; }
body.stage-crack #s-crack .crack-stage { display: none; }
body.stage-crack #s-crack { pointer-events: none; }
body.stage-crack .crack-tip { color: #fff3e0; font-size: 18px; text-shadow: 0 0 14px rgba(255,200,120,.8); }
.flying { display: none; }
.flying.on { display: block; position: fixed; top: 50%; }
body.has3d.home3d #app, body.has3d.stage-crack #app { pointer-events: none; }
body.has3d.home3d #app button { pointer-events: auto; }
