/* ================= 国庆头像裂变站 H5 样式（移动优先 / 多端自适应） ================= */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #3a1212;
  background: #a30f16;
  min-height: 100vh;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: 0; cursor: pointer; }

.page-bg {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(160deg, #d81f26 0%, #b3131b 45%, #8e0d13 100%);
}
.bg-stars {
  position: absolute; inset: 0; opacity: .25;
  background-image:
    radial-gradient(circle, rgba(255,215,0,.9) 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255,255,255,.5) 1px, transparent 1.5px);
  background-size: 90px 90px, 140px 140px;
  background-position: 10px 20px, 60px 80px;
}

.stage { max-width: 1080px; margin: 0 auto; display: flex; justify-content: center; align-items: flex-start; }
.phone { width: 100%; max-width: 480px; min-height: 100vh; position: relative; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(140,10,16,.95), rgba(179,19,27,.9));
  backdrop-filter: blur(6px);
  color: #ffe9a3;
}
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1.05rem; }
.lantern { font-size: 1.3rem; animation: swing 2.6s ease-in-out infinite; transform-origin: top center; }
@keyframes swing { 0%,100%{ transform: rotate(-7deg);} 50%{ transform: rotate(7deg);} }
.topbar-rank { font-size: .82rem; background: rgba(255,215,0,.18); border: 1px solid rgba(255,215,0,.5); padding: 3px 10px; border-radius: 20px; }

.content { padding: 14px 12px 20px; }

/* ---------------- 通用卡片 / 按钮 ---------------- */
.card {
  background: #fffdf8;
  border-radius: 16px;
  padding: 16px 14px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(90, 0, 0, .18);
}
.card-title { font-size: 1.02rem; color: #b3131b; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.card-link { font-size: .78rem; color: #c8830f; font-weight: 400; }
.page-tip { font-size: .82rem; color: #9a6a6a; margin-bottom: 12px; }

.btn {
  display: inline-block; text-align: center; border-radius: 999px;
  padding: 10px 18px; font-size: .95rem; font-weight: 600;
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.96); }
.btn-gold { background: linear-gradient(180deg, #ffe289, #f7b733); color: #8a4b00; box-shadow: 0 4px 0 #c9871a, 0 6px 14px rgba(200,135,26,.45); }
.btn-outline { background: #fff; color: #c8161d; border: 1.5px solid #e57b80; }
.btn-green { background: linear-gradient(180deg, #3ec76a, #1ea34d); color: #fff; box-shadow: 0 4px 10px rgba(30,163,77,.35); flex: 1; }
.btn-ghost { background: transparent; color: #ffe9a3; border: 1px solid rgba(255,233,163,.7); margin-top: 14px; }
.btn-red-reward { background: linear-gradient(180deg, #ff7a59, #f4511e); color: #fff; flex-basis: 100%; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-lg { padding: 14px 20px; font-size: 1.08rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------------- 首页 hero ---------------- */
.hero {
  text-align: center; color: #fff;
  background: linear-gradient(165deg, rgba(255,255,255,.10), rgba(255,255,255,0)) , radial-gradient(120% 90% at 50% 0%, #e8343c 0%, #c0161e 70%);
  border-radius: 20px; padding: 24px 16px 20px; margin-bottom: 14px;
  border: 1px solid rgba(255,215,0,.35);
  box-shadow: 0 10px 30px rgba(80,0,0,.35);
}
.hero-ribbon { display: inline-block; font-size: .75rem; color: #6e2b00; background: linear-gradient(90deg,#ffe289,#ffd05e); padding: 3px 12px; border-radius: 20px; font-weight: 700; }
.hero-title { font-size: 2rem; margin: 12px 0 4px; letter-spacing: 2px; text-shadow: 0 2px 8px rgba(0,0,0,.25); }
.hero-title em { font-style: normal; color: #ffe289; font-size: 2.5rem; padding: 0 2px; }
.hero-sub { color: #ffe9d2; font-size: .9rem; margin-bottom: 16px; }
.hero-preview { display: flex; justify-content: center; gap: 14px; margin: 6px 0 18px; }
.ring-demo {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; font-size: 2rem;
  background: radial-gradient(circle, rgba(255,255,255,.16), rgba(255,255,255,.04));
  border: 2px solid rgba(255,215,0,.7);
  animation: float 3s ease-in-out infinite;
}
.ring-demo-2 { animation-delay: .4s; } .ring-demo-3 { animation-delay: .8s; }
@keyframes float { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-8px);} }
.hero .btn { margin: 4px 0; }
.hot-line { margin-top: 14px; font-size: .85rem; color: #ffe9c9; }
.hot-line b { color: #ffe289; font-size: 1.05rem; }

/* 解锁步骤 */
.unlock-steps { display: flex; align-items: stretch; justify-content: space-between; gap: 4px; text-align: center; }
.step { flex: 1; }
.step i {
  display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto 6px;
  border-radius: 50%; background: linear-gradient(180deg,#ff7676,#d81f26); color: #fff; font-style: normal; font-weight: 700;
}
.step p { font-size: .76rem; color: #7a4a4a; }
.step-arrow { color: #d8a23b; align-self: center; }
.unlock-bar { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: .8rem; color: #7a4a4a; }
.bar { flex: 1; height: 8px; background: #f4e4d6; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg,#f7b733,#d81f26); transition: width .4s; }

/* feed */
.feed { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.feed-item { text-align: center; }
.feed-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 2px solid #f3d8a8; }
.feed-item span { display: block; font-size: .68rem; color: #9a6a6a; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.features { display: flex; text-align: center; gap: 8px; }
.feature { flex: 1; }
.feature i { font-size: 1.7rem; }
.feature p { font-size: .78rem; color: #7a4a4a; margin-top: 4px; }

/* ---------------- 制作页 ---------------- */
.uploader { display: block; position: relative; border: 2px dashed #e5a95f; border-radius: 14px; background: #fff8ee; min-height: 170px; cursor: pointer; overflow: hidden; }
.uploader-inner { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; color: #c8830f; }
.uploader-icon { font-size: 2.2rem; }
.uploader p { font-weight: 600; }
.uploader span { font-size: .74rem; color: #b9947a; }
#originPreview { width: 100%; max-height: 320px; object-fit: contain; background: #f7ece0; }

.tpl-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.tpl-loading { width: 100%; text-align: center; color: #b9947a; font-size: .85rem; padding: 18px 0; }
.tpl {
  flex: 0 0 112px; scroll-snap-align: start; text-align: center; position: relative;
  border-radius: 12px; overflow: hidden; border: 3px solid transparent; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.tpl.on { border-color: #f7b733; }
.tpl img { width: 112px; height: 112px; object-fit: cover; background: #f7ece0; }
.tpl span { display: block; font-size: .74rem; padding: 4px 2px; color: #7a4a4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl .vip-tag { position: absolute; top: 4px; left: 4px; background: linear-gradient(90deg,#b3131b,#f7b733); color: #fff; font-size: .62rem; padding: 1px 6px; border-radius: 8px; }
.tpl .lock-mask { position: absolute; inset: 0; background: rgba(60,0,0,.55); color: #ffe289; display: grid; place-content: center; justify-items: center; gap: 2px; font-size: .72rem; }
.tpl .lock-mask i { font-style: normal; font-size: 1.4rem; }

.unlock-tip { font-size: .84rem; color: #9a6a6a; margin-bottom: 10px; }
.unlock-tasks { border: 1px solid #f3ddc4; border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.task { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #fffaf2; border-bottom: 1px solid #f3ddc4; }
.task:last-child { border-bottom: 0; }
.task b { display: block; font-size: .88rem; color: #b3131b; }
.task span { font-size: .76rem; color: #9a6a6a; }
.task em { font-style: normal; font-weight: 700; color: #d88c14; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.result-card { text-align: center; }
.result-img { margin: 0 auto 12px; width: 260px; max-width: 80%; }
.result-img img { border-radius: 18px; border: 4px solid #f7b733; box-shadow: 0 8px 24px rgba(150,40,0,.25); width: 100%; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn { flex: 1; }
.poster-link { display: inline-block; margin-top: 12px; color: #c8161d; font-size: .85rem; font-weight: 600; }

/* ---------------- 海报 ---------------- */
.poster-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #7a0c12; }
#posterImg { width: 100%; margin: 0 auto; }
.poster-loading { position: absolute; inset: 0; display: grid; place-content: center; color: #ffe289; }
.poster-wrap .result-actions { padding: 12px; }
.poster-code { text-align: center; font-size: .82rem; color: #9a6a6a; margin-top: 8px; }
.poster-code b { color: #b3131b; letter-spacing: 2px; }

/* ---------------- 排行榜 ---------------- */
.rank-hero { background: linear-gradient(160deg,#fff7e6,#fffdf8); }
.my-rank { display: flex; align-items: center; gap: 10px; }
.my-rank > div { flex: 1; background: #fff; border-radius: 10px; padding: 8px 10px; border: 1px solid #f3ddc4; }
.my-rank span { display: block; font-size: .72rem; color: #b9947a; }
.my-rank b { font-size: .95rem; color: #b3131b; }
.rank-list .rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #f6ece0; }
.rank-list .rank-row:last-child { border-bottom: 0; }
.rank-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: #f3e6d6; color: #a87a55; flex: 0 0 auto; }
.rank-no.no1 { background: linear-gradient(180deg,#ffd34d,#f7a928); color: #fff; }
.rank-no.no2 { background: linear-gradient(180deg,#cfd6df,#a7b0bc); color: #fff; }
.rank-no.no3 { background: linear-gradient(180deg,#e8a87a,#c97e4a); color: #fff; }
.rank-row img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid #f3d8a8; }
.rank-row .rname { flex: 1; font-size: .88rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-row .rcount { color: #d88c14; font-weight: 700; font-size: .88rem; }

/* ---------------- 规则 ---------------- */
.rules-text { white-space: normal; font-size: .88rem; color: #5f3535; }
.faq details { border-bottom: 1px solid #f3ddc4; padding: 8px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { font-weight: 600; color: #b3131b; font-size: .9rem; }
.faq p { font-size: .84rem; color: #7a4a4a; padding: 6px 0 2px; }

/* ---------------- 广告 ---------------- */
.ad-wrap { position: relative; margin-bottom: 14px; border-radius: 12px; overflow: hidden; background: #fff; }
.ad-tag { position: absolute; top: 4px; left: 4px; z-index: 2; font-size: .6rem; color: #b9947a; background: rgba(255,255,255,.85); border: 1px solid #e8d5bf; border-radius: 4px; padding: 0 4px; }
.ad-img img { width: 100%; }
.ad-code { min-height: 50px; overflow: hidden; }
.ad-code iframe { max-width: 100%; }

/* ---------------- 底部 tabbar ---------------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  display: flex; background: #fffdf8;
  border-top: 1px solid #f0e0cc;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 14px rgba(90,0,0,.08);
}
.tabbar a { flex: 1; text-align: center; padding: 7px 0 6px; font-size: .66rem; color: #a87a55; }
.tabbar a i { display: block; font-style: normal; font-size: 1.25rem; line-height: 1.2; }
.tabbar a.on { color: #d81f26; font-weight: 700; }

/* ---------------- 分享遮罩 / toast ---------------- */
.share-mask { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.72); }
.share-arrow { position: absolute; top: 8px; right: 18px; color: #ffe289; font-size: 3rem; animation: float 1.2s infinite; }
.share-tip { position: absolute; top: 70px; right: 20px; color: #fff; text-align: right; font-size: 1.05rem; }
.share-tip b { color: #ffe289; font-size: 1.3rem; }
.share-sub { color: #ffd9d9; font-size: .85rem; margin-top: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: .88rem; z-index: 200; max-width: 80%; text-align: center;
}

/* ---------------- 桌面端适配 ---------------- */
.desktop-aside {
  display: none; width: 460px; color: #ffe9c9; padding: 70px 30px 30px 20px;
}
.desktop-aside h2 { font-size: 1.9rem; color: #ffe289; margin-bottom: 8px; }
.aside-slogan { color: #ffd9c9; margin-bottom: 24px; }
.aside-qr { background: #fff; border-radius: 16px; padding: 16px; width: 230px; text-align: center; color: #7a4a4a; }
.aside-qr img { border-radius: 8px; }
.aside-qr p { font-size: .82rem; margin-top: 8px; }
.aside-points { list-style: none; margin-top: 22px; font-size: .92rem; line-height: 2.1; }

@media (min-width: 900px) {
  .desktop-aside { display: block; }
  .phone { box-shadow: 0 0 60px rgba(0,0,0,.35); }
}
@media (max-width: 340px) {
  html { font-size: 13px; }
  .tpl { flex-basis: 100px; }
  .tpl img { width: 100px; height: 100px; }
}
