:root {
  --red: #c8102e;
  --red-deep: #8e0614;
  --red-ink: #7a0010;
  --gold: #f3cd84;
  --gold-soft: #fbe3a6;
  --cream: #fff8ec;
  --paper: #fffdf8;
  --ink: #3a2418;
  --muted: #8a6b58;
  --line: #f0dcc0;
  --ok: #2f8f4e;
  --warn: #c77700;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #5a0610;
}
#app {
  max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative;
  background:
    radial-gradient(circle at 20px 20px, rgba(243,205,132,.08) 12px, transparent 13px) 0 0/56px 56px,
    radial-gradient(120% 60% at 50% 0%, #d9182b 0%, var(--red) 40%, var(--red-deep) 100%);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.loading { color: var(--gold-soft); text-align: center; padding: 120px 0; }

/* ---------- tabbar ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 20;
  display: flex; background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.12);
}
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 0 5px; font-size: 11px; color: var(--muted); }
/* 图标统一用线条 SVG（原来是表情符号，安卓和苹果上长得不一样） */
#tabbar a i { display: flex; align-items: center; justify-content: center; height: 26px; }
#tabbar a i svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#tabbar a.on { color: var(--red); font-weight: 600; }
#tabbar a.on i svg { stroke-width: 1.9; }
#tabbar a.primary i { width: 44px; height: 44px; margin-top: -18px; border-radius: 50%; background: linear-gradient(180deg, #e8273d, var(--red)); color: #fff3cf; border: 3px solid var(--gold); box-shadow: 0 4px 10px rgba(200,16,46,.4); }
#tabbar a.primary i svg { width: 22px; height: 22px; stroke-width: 1.8; }

/* ---------- common ---------- */
.page { padding: 14px 14px 20px; }
.card { background: var(--cream); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(80,0,10,.18); }
.card h2 { margin: 0 0 10px; font-size: 17px; color: var(--red-ink); display: flex; align-items: center; gap: 8px; }
.card h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(var(--red), #e8553e); }
.card p { margin: 0 0 8px; }
.card ul { margin: 0; padding-left: 20px; }
.card li { margin: 4px 0; }
.muted { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 20px; border-radius: 22px; background: linear-gradient(180deg, #e8273d, var(--red)); color: #fff; font-weight: 600; box-shadow: 0 4px 10px rgba(200,16,46,.3); }
.btn.gold { background: linear-gradient(180deg, #fde9b8, #eec06b); color: var(--red-ink); box-shadow: 0 4px 10px rgba(120,60,0,.25); }
.btn.ghost { background: transparent; color: var(--red); border: 1px solid var(--red); box-shadow: none; }
.btn.block { display: flex; width: 100%; }
.btn.small { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 16px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #fde7d0; color: var(--red-ink); }
.tag.ok { background: #e3f4e8; color: var(--ok); }
.tag.warn { background: #fff1d6; color: var(--warn); }
.tag.bad { background: #fde2e2; color: #c0392b; }
.tag.gray { background: #eee; color: #777; }
.empty { text-align: center; color: var(--gold-soft); padding: 60px 20px; }
.empty.dark { color: var(--muted); }

/* ---------- home ---------- */
/* 标题宋体：思源宋体 Noto Serif SC Black 的子集（SIL OFL 1.1，可免费商用、可嵌入网页，许可证见 /fonts/OFL.txt），
   由 tools/build_serif_font.mjs 生成。手机上没有宋体，不嵌字体的话标题会变成黑体 */
@font-face { font-family: "HB Serif"; src: url(/fonts/hb-serif.woff?v=1) format("woff"); font-weight: 900; font-display: swap; }
.serif { font-family: "HB Serif", serif; font-weight: 900; }
.hero { text-align: center; color: var(--gold-soft); padding: 26px 16px 8px; position: relative; overflow: hidden; }
.hero .year { font-size: 13px; letter-spacing: 6px; opacity: .9; }
.hero h1 { margin: 6px 0 4px; font-size: 30px; line-height: 1.25; letter-spacing: 2px; color: #fff3cf; text-shadow: 0 2px 0 #8e0614, 0 0 18px rgba(255,200,120,.35); font-weight: 900; }
.hero .sub { font-size: 14px; opacity: .95; }
.hero.has-kv { padding: 0 0 8px; }
.hero .kv { width: 100%; display: block; }

/* 首页首屏：标题、作品、数据、时间线、按钮一屏放下。中间作品区的高度跟着屏幕高度伸缩（--stage），
   403px ≈ 首屏其余内容 351px + 底部导航 56px − 首屏底部留白 6px + 余量；--demo 是演示环境提示条的高度。
   屏幕矮到作品区缩到最小还放不下时，参赛按钮贴在底部导航上方（sticky），任何手机一打开都能看到 */
.home-hero { padding: 14px 16px 6px; overflow: visible;
  --stage: clamp(120px, calc(100vh - 411px - var(--demo, 0px) - env(safe-area-inset-bottom)), 250px); }
@supports (height: 100svh) { .home-hero { --stage: clamp(120px, calc(100svh - 411px - var(--demo, 0px) - env(safe-area-inset-bottom)), 250px); } }
.home-hero.has-kv { padding: 0 0 6px; }
.home-hero.has-kv .panel { margin-left: 16px; margin-right: 16px; }
.home-hero.has-kv .cta { margin-left: 0; margin-right: 0; }
.home-hero .brand { display: block; height: 24px; margin: 0 auto; }
.home-hero .year { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 11px; letter-spacing: 4px; opacity: .85; }
.home-hero .year::before, .home-hero .year::after { content: ""; width: 28px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.home-hero .year::after { transform: scaleX(-1); }
.home-hero h1 { margin: 6px 0 3px; font-size: clamp(26px, 8.4vw, 33px); line-height: 1.2; letter-spacing: 2px; }
.home-hero h1 small { display: block; font-size: .64em; letter-spacing: 3px; }
.home-hero .sub { font-size: 13px; letter-spacing: .5px; opacity: .9; }
.home-hero .hero-stage { position: relative; height: var(--stage); max-width: 360px; margin: 10px auto 0; display: flex; justify-content: center; align-items: center; }
/* 作品背后一团暖光，红包更跳 */
.home-hero .hero-stage::before { content: ""; position: absolute; left: 50%; top: 50%; width: calc(var(--stage) * 1.6); height: calc(var(--stage) * 1.6); transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(255,210,130,.4), rgba(255,210,130,.12) 55%, transparent); pointer-events: none; }
.home-hero .env { position: relative; flex: none; height: 82%; filter: drop-shadow(0 10px 16px rgba(60,0,0,.45)); }
.home-hero .env img { height: 100%; width: auto; max-width: none; }
.home-hero .env:nth-child(1) { margin-right: calc(var(--stage) * -.07); transform: rotate(-9deg) translateY(4%); }
.home-hero .env:nth-child(2) { height: 100%; z-index: 2; }
.home-hero .env:nth-child(3) { margin-left: calc(var(--stage) * -.07); transform: rotate(9deg) translateY(4%); }
.home-hero .sheep { position: absolute; z-index: 3; right: -4px; bottom: -6px; height: 42%; width: auto; max-width: none; transform: rotate(6deg); filter: drop-shadow(0 6px 8px rgba(80,0,0,.35)); }
.home-hero .sheep.lamb { right: auto; left: -4px; height: 34%; transform: rotate(-8deg); }
.home-hero .panel { margin: 12px 0 0; padding: 9px 12px 10px; border-radius: 16px; background: rgba(255,248,236,.1); border: 1px solid rgba(243,205,132,.32); }
.home-hero .stats { display: flex; padding-bottom: 8px; border-bottom: 1px dashed rgba(243,205,132,.3); }
.home-hero .stats div { flex: 1; position: relative; }
.home-hero .stats div + div::before { content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 1px; background: rgba(243,205,132,.3); }
.home-hero .stats b { display: block; font: 900 22px/1.25 "HB Serif", serif; color: #fff3cf; }
.home-hero .stats span { display: block; font-size: 11px; line-height: 1.4; opacity: .8; }
/* 三个阶段的时间线：进行中的点是实心金色，已结束的点淡金色 */
.timeline { display: flex; margin: 0; padding: 9px 0 0; list-style: none; }
.timeline li { flex: 1; position: relative; padding-top: 14px; font-size: 11px; line-height: 1.5; color: rgba(251,227,166,.72); white-space: nowrap; }
.timeline li::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 1px; background: rgba(243,205,132,.35); }
.timeline li:first-child::before { left: 50%; }
.timeline li:last-child::before { right: 50%; }
.timeline li::after { content: ""; position: absolute; top: 0; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; border: 1.5px solid rgba(243,205,132,.65); background: #a50d1e; box-sizing: border-box; }
.timeline li.done::after { background: rgba(243,205,132,.65); }
.timeline li.now::after { background: var(--gold); border-color: #fff3cf; box-shadow: 0 0 0 3px rgba(243,205,132,.25); }
.timeline b { display: block; font-size: 13px; line-height: 1.45; font-weight: 600; color: var(--gold-soft); }
.timeline li.now b { color: #fff3cf; }
.timeline em { display: inline-block; margin-right: 3px; padding: 0 5px; border-radius: 8px; background: var(--gold); color: var(--red-ink); font-size: 10px; line-height: 15px; font-style: normal; font-weight: 600; vertical-align: 1px; }
.home-hero .cta { position: -webkit-sticky; position: sticky; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 10px; margin: 2px -16px 0; padding: 10px 16px 8px; transition: background .2s; }
.home-hero .cta.stuck { background: linear-gradient(rgba(120,4,18,0), rgba(120,4,18,.94) 32%); }
.home-hero .cta .btn { height: 46px; border-radius: 23px; font-size: 16px; padding: 0 12px; }
.home-hero .cta .btn.gold { flex: 1.5; }
.home-hero .cta .btn svg { width: 19px; height: 19px; margin-left: -2px; }
.btn.glass { background: rgba(255,248,236,.12); border: 1px solid rgba(243,205,132,.6); color: #fff3cf; box-shadow: none; }
.home-hero .cta .btn.glass { flex: 1; }
.demo-bar { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 26px; padding: 3px 12px; background: rgba(0,0,0,.22); color: var(--gold-soft); font-size: 11.5px; line-height: 1.4; }
.demo-bar span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-bar button { flex: none; background: rgba(243,205,132,.92); color: var(--red-ink); border-radius: 10px; padding: 0 8px; font-size: 11px; line-height: 19px; }

/* 首页下方的说明卡片 */
.home-page .card { padding: 16px 16px 14px; }
.home-page .card h2 { font: 900 18px/1.3 "HB Serif", serif; letter-spacing: 1px; gap: 9px; }
.home-page .card h2::before { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: linear-gradient(135deg, #ec5b3f, var(--red)); }
.home-page .card h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.home-page .card ul { list-style: none; padding: 0; }
.home-page .card li { position: relative; padding-left: 15px; margin: 5px 0; }
.home-page .card li::before { content: ""; position: absolute; left: 2px; top: .66em; width: 5px; height: 5px; border-radius: 1px; background: var(--red); transform: rotate(45deg); }
.home-page .theme { margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; background: #fdeedd; color: var(--red-ink); font-size: 13.5px; line-height: 1.6; }
.groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 10px; }
.groups div { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px 9px; border-radius: 12px; background: #fff; border: 1px solid var(--line); text-align: center; }
.groups b { font-size: 14px; line-height: 1.35; color: var(--red-ink); text-wrap: balance; }
.groups span { font-size: 12px; color: var(--muted); }
.groups em { margin-top: 5px; padding: 0 8px; border-radius: 10px; background: #fdeedd; color: var(--red); font-size: 12px; line-height: 20px; font-style: normal; font-weight: 600; }
table.groups { width: 100%; border-collapse: collapse; font-size: 14px; }
table.groups th, table.groups td { border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: left; }
table.groups th { color: var(--muted); font-weight: 500; font-size: 12px; }
.tpl-row { display: flex; gap: 10px; align-items: stretch; }
.tpl-row a { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; font-size: 13px; }
.tpl-row img { height: 120px; max-width: 100%; margin: 0 auto 6px; object-fit: contain; }
.tpl-row .file-ico { display: flex; align-items: center; justify-content: center; width: 72px; height: 120px; margin: 0 auto 6px; border-radius: 6px; background: #fdf1e2; border: 1px solid #f0d6b0; color: var(--red); font-weight: 700; font-size: 15px; }
.foot { text-align: center; color: var(--gold-soft); font-size: 12px; opacity: .8; padding: 10px 0 20px; }
.foot img { display: block; height: 30px; margin: 4px auto 10px; }
/* “我要参赛”提示：每 2.8 秒跳一下、扫过一道光，图标跟着晃；底部导航中间按钮一圈光晕往外扩 */
.btn.go { position: relative; overflow: hidden; animation: go-beat 2.8s ease-in-out infinite; }
.btn.go::after { content: ""; position: absolute; top: 0; bottom: 0; left: -50%; width: 36%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.9), transparent); transform: skewX(-20deg); animation: go-shine 2.8s ease-in-out infinite; pointer-events: none; }
.btn.go svg { animation: go-wiggle 2.8s ease-in-out infinite; transform-origin: 30% 80%; }
@keyframes go-beat { 0%, 56%, 100% { transform: scale(1); } 64% { transform: scale(1.08); } 72% { transform: scale(.97); } 80% { transform: scale(1.04); } 88% { transform: scale(1); } }
@keyframes go-shine { 0%, 30% { left: -50%; } 62%, 100% { left: 130%; } }
@keyframes go-wiggle { 0%, 56%, 100% { transform: rotate(0); } 64% { transform: rotate(-16deg); } 72% { transform: rotate(12deg); } 80% { transform: rotate(-6deg); } 88% { transform: rotate(0); } }
#tabbar a.primary i { position: relative; }
#tabbar a.primary.go i::before, #tabbar a.primary.go i::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--gold); animation: go-ring 2.8s ease-out infinite; pointer-events: none; }
#tabbar a.primary.go i::after { animation-delay: .5s; }
@keyframes go-ring { 0% { transform: scale(1); opacity: .9; } 60%, 100% { transform: scale(1.75); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .btn.go, .btn.go::after, .btn.go svg, #tabbar a.primary.go i::before, #tabbar a.primary.go i::after { animation: none; } }

/* ---------- gallery ---------- */
.gtabs { display: flex; gap: 6px; padding: 12px 14px 0; position: sticky; top: 0; z-index: 10; background: linear-gradient(var(--red) 70%, transparent); }
.gtabs button { flex: 1; padding: 8px 2px 6px; border-radius: 12px 12px 0 0; background: rgba(255,248,236,.15); color: var(--gold-soft); font-size: 13px; line-height: 1.25; }
.gtabs button small { display: block; font-size: 11px; opacity: .85; }
.gtabs button.on { background: var(--cream); color: var(--red-ink); font-weight: 700; }
.gbar { background: var(--cream); margin: 0 14px; padding: 10px 12px; border-radius: 0 0 12px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gbar .left { flex: 1 1 100%; font-size: 13px; color: var(--red-ink); }
.gbar .left b { color: var(--red); }
.gbar input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 17px; padding: 0 14px; background: #fff; }
.seg { display: inline-flex; background: #f4e3cc; border-radius: 17px; padding: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 15px; background: none; font-size: 13px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--red); font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 14px; }
.work { background: var(--cream); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(60,0,0,.2); display: flex; flex-direction: column; }
.work .pic { background: linear-gradient(#fff6e6, #f6e2c4); padding: 10px 18px 4px; position: relative; }
.work .pic img { aspect-ratio: var(--env-ratio, 70/144.5); width: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(80,0,0,.25)); }
.work .rank { position: absolute; z-index: 1; left: 0; top: 8px; background: var(--red); color: #fff3cf; font-size: 11px; padding: 1px 8px 1px 6px; border-radius: 0 10px 10px 0; }
.work .rank.top { background: linear-gradient(90deg, #d39b2a, #f2c66a); color: var(--red-ink); font-weight: 700; }
.work .meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.work .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work .a { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work .row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.work .v { color: var(--red); font-weight: 700; font-size: 15px; }
.work .v small { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 2px; }
.vote-btn { height: 30px; padding: 0 14px; border-radius: 15px; background: linear-gradient(180deg, #e8273d, var(--red)); color: #fff; font-size: 13px; font-weight: 600; }
.vote-btn.done { background: #f1e2cd; color: var(--muted); }
.more { text-align: center; padding: 6px 0 16px; }

/* ---------- detail ---------- */
.detail-stage { padding: 18px 0 4px; text-align: center; }
.detail-stage img { width: 44%; max-width: 210px; margin: 0 auto; filter: drop-shadow(0 14px 22px rgba(40,0,0,.5)); cursor: zoom-in; }
.detail-stage img.art { width: 52%; max-width: 240px; border-radius: 4px; border: 6px solid #fff; }
.toggle { display: flex; justify-content: center; margin-top: 14px; }
.toggle .seg { background: rgba(255,248,236,.2); }
.toggle .seg button { color: var(--gold-soft); }
.toggle .seg button.on { background: var(--cream); color: var(--red); }
.dinfo h3 { margin: 0; font-size: 20px; color: var(--red-ink); }
.dinfo .kv { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 12px; font-size: 13px; color: var(--muted); }
.dinfo .big { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; border-top: 1px dashed var(--line); }
.dinfo .big b { font: 900 30px/1.3 "HB Serif", serif; color: var(--red); }
.dinfo .actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

/* ---------- submit ---------- */
/* 投稿分三步：顶部步骤条（可点选、吸顶），底部固定上一步 / 下一步，投稿期间收起底部导航 */
body.flow #tabbar, body.typing .wz-bar { display: none; }
.wz-steps { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; padding: 12px 14px 10px; background: linear-gradient(#d0152c 78%, rgba(200,16,46,0)); }
.wz-steps button { display: flex; align-items: center; gap: 6px; padding: 4px 0; background: none; color: rgba(255,233,194,.62); font-size: 13px; white-space: nowrap; }
.wz-steps button i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,233,194,.5); font-style: normal; font-size: 12px; font-weight: 700; }
.wz-steps button.on { color: #fff3cf; font-weight: 700; }
.wz-steps button.on i { background: var(--gold); border-color: var(--gold); color: var(--red-ink); }
.wz-steps button.done { color: var(--gold-soft); }
.wz-steps button.done i { border-color: var(--gold); color: transparent; position: relative; }
.wz-steps button.done i::after { content: "✓"; position: absolute; color: var(--gold); }
.wz-steps span { flex: 1; height: 1px; margin: 0 8px; background: rgba(255,233,194,.35); }
.page.wz { padding: 2px 14px 8px; }
.page.wz .card { padding: 14px; margin-bottom: 0; }
body.flow #app { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
.wz-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 20; display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.12); }
.wz-bar .btn { flex: 1; }
.wz-bar .btn:last-child { flex: 2; }
.steps-tip { color: var(--gold-soft); font-size: 13px; padding: 4px 4px 12px; }
.upload-zone { border: 2px dashed #e5b97a; border-radius: 14px; background: #fff; padding: 28px 16px; text-align: center; color: var(--muted); cursor: pointer; }
.upload-zone b { display: block; color: var(--red); font-size: 17px; margin: 8px 0 4px; }
/* 上传作品：红包居中放大，操作按钮在下方 */
.editor { display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* 红包按屏幕高度尽量放大，让第一步在一屏内放下（扣掉步骤条、缩放条、按钮、底栏约 236px）。
   微信底部出现前进/后退栏时 iPhone 可视高度只有约 670px，下限放到 180px，传图后的按钮才不会被底栏挡住；更矮的屏再滚动 */
.env-wrap { max-width: 100%;
  width: clamp(180px, calc((100vh - 236px - env(safe-area-inset-bottom)) * var(--env-w) / var(--env-h)), 300px);
  width: clamp(180px, calc((100svh - 236px - env(safe-area-inset-bottom)) * var(--env-w) / var(--env-h)), 300px); }
.env-preview { position: relative; width: 100%; aspect-ratio: var(--env-ratio); background: var(--env-bg) center/100% 100% no-repeat; filter: drop-shadow(0 8px 14px rgba(80,0,0,.3)); user-select: none; }
.env-preview .frame { position: absolute; left: calc(var(--ax) - 4px); top: calc(var(--ay) - 4px); width: calc(var(--aw) + 8px); height: calc(var(--ah) + 8px); pointer-events: none; z-index: 3;
  /* 虚线用渐变画：iOS 微信里 dashed 边框在 drop-shadow 父元素、非整像素尺寸下会丢竖边 */
  --dash: #ffe9c2;
  background:
    repeating-linear-gradient(90deg, var(--dash) 0 6px, transparent 6px 10px) left top / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--dash) 0 6px, transparent 6px 10px) left bottom / 100% 2px no-repeat,
    repeating-linear-gradient(180deg, var(--dash) 0 6px, transparent 6px 10px) left top / 2px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--dash) 0 6px, transparent 6px 10px) right top / 2px 100% no-repeat; }
.env-preview .frame span { position: absolute; left: 0; right: 0; top: -19px; text-align: center; font-size: 11px; color: #ffe9c2; letter-spacing: .5px; white-space: nowrap; }
.env-preview .ghost-clip { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; z-index: 1; pointer-events: none; }
.env-preview .ghost { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; opacity: 0; pointer-events: none; z-index: 1; transition: opacity .15s; }
.env-preview.dragging .ghost { opacity: .5; }
.env-preview .vp-empty { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #ffe9c2; text-align: center; gap: 2px; }
.env-preview .vp-empty[hidden] { display: none; }
.env-preview .vp-empty i { display: block; width: 38px; height: 38px; opacity: .95; }
.env-preview .vp-empty i svg { display: block; width: 100%; height: 100%; }
.env-preview .vp-empty b { font-size: 15px; background: rgba(255,233,194,.18); border: 1px solid rgba(255,233,194,.6); border-radius: 16px; padding: 3px 14px; margin-top: 8px; }
.env-preview .vp { position: absolute; z-index: 2; left: var(--ax); top: var(--ay); width: var(--aw); height: var(--ah); overflow: hidden; touch-action: none; background: #fff repeating-linear-gradient(45deg, #fbeee0 0 8px, #fff 8px 16px); cursor: grab; }
.env-preview .vp.empty { background: transparent; cursor: pointer; }
.env-preview .vp img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.env-preview .sig { position: absolute; right: 3%; bottom: 1.6%; background: rgba(179,0,15,.86); border: 1px solid var(--gold); color: var(--gold-soft); border-radius: 20px; font-size: 10px; padding: 0 7px; line-height: 18px; white-space: nowrap; pointer-events: none; font-weight: 600; }
/* 红包两侧的手势提示：上传图片后出现，图标轻动几下引起注意；屏幕太窄放不下时改为按钮下方一行字 */
/* 两侧提示各借 10px 卡片内边距，360 宽的手机也放得下四个字 */
.env-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; width: calc(100% + 20px); margin: 0 -10px; }
.env-row .env-wrap { grid-column: 2; }
.side-tip { position: relative; top: 6%; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; white-space: nowrap; font-size: 11px; line-height: 1.4; color: var(--muted); visibility: hidden; }
.side-tip.l { grid-column: 1; }
.side-tip.r { grid-column: 3; }
.side-tip i { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 5px; border-radius: 50%; background: #fde5cf; color: var(--red); }
.side-tip i svg { width: 20px; height: 20px; }
.side-tip b { font-size: 12px; color: var(--red-ink); }
.editor.has-img .side-tip { visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .editor.has-img .side-tip.l svg { animation: tip-drag 1.4s ease-in-out .4s 3; }
  .editor.has-img .side-tip.r svg { animation: tip-pinch 1.4s ease-in-out .4s 3; }
}
@keyframes tip-drag { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes tip-pinch { 50% { transform: scale(1.22); } }
.editor .hint .post, .editor.has-img .hint .pre, .editor.has-img .hint { display: none; }
.editor.has-img .hint .post { display: inline; }
.editor .zoom { width: 100%; max-width: 300px; display: flex; align-items: center; gap: 10px; }
.editor .zoom input { flex: 1; accent-color: var(--red); }
.editor .zoom button { flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: #fde5cf; color: var(--red); font-size: 16px; line-height: 28px; }
.editor .ed-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.editor .hint { color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.editor [hidden] { display: none; }
@media (max-width: 349px) { .side-tip { display: none; } .editor.has-img .hint { display: block; } }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field label em { color: var(--red); font-style: normal; margin-left: 2px; }
.field label small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.field input, .field select { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; appearance: none; -webkit-appearance: none; }
.field select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a6b58' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") right 14px center no-repeat; }
.field input:focus, .field select:focus { outline: 2px solid rgba(200,16,46,.25); border-color: var(--red); }
.field .tip { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field.err input, .field.err select { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.14); }
.age-result { background: #fff1dc; border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--red-ink); margin: -4px 0 14px; }
.guardian { background: #fff6ea; border: 1px solid #f4d9b0; border-radius: 12px; padding: 12px 12px 2px; margin-bottom: 14px; }
.guardian .gt { font-size: 13px; color: var(--warn); margin-bottom: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.agree { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.agree:last-child { border: 0; }
.agree input { width: 20px; height: 20px; accent-color: var(--red); flex: none; margin: 1px 0 0; }
#agrees.tight .agree { font-size: 12px; }
/* 协议名整段换行，不会把《……条款》拆成两行 */
.agree .ref { display: inline-block; }
.agree a { display: inline-block; color: var(--red); text-decoration: underline; }
/* 第三步核对：左边作品缩略效果，右边填写的信息 */
.card h2 .edit { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 14px; border: 1px solid var(--red); border-radius: 16px; background: #fff0e6; color: var(--red); font-size: 14px; font-weight: 600; }
.card h2 .edit svg { width: 15px; height: 15px; }
.card h2.h2-gap { margin-top: 14px; }
/* 信息卡：左边作品缩略效果，右边一行一项（标签靠左、内容靠右），整块铺满不偏左 */
.review { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.review .mini { flex: none; width: 92px; text-align: center; }
.review .mini a { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--red); text-decoration: underline; cursor: pointer; }
.mini-env { position: relative; aspect-ratio: var(--env-ratio); background: var(--env-bg) center/100% 100% no-repeat; filter: drop-shadow(0 4px 8px rgba(80,0,0,.25)); cursor: pointer; }
.mini-art { position: absolute; left: var(--ax); top: var(--ay); width: var(--aw); height: var(--ah); overflow: hidden; background: #fff; }
.mini-art img { position: absolute; max-width: none; }
.review .label { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
/* 书名号左边自带空白，往左收一点，标题和下面的署名才对得齐 */
.review h3 { margin: 0; font-size: 17px; line-height: 1.35; color: var(--red-ink); letter-spacing: .5px; text-indent: -.3em; text-wrap: balance; }
/* 昵称放不下时整段换到下一行，左边对齐不缩进 */
.review .by { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; margin: 3px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
.review .by span { font-size: 12px; }
.review .by i { font-style: normal; color: var(--muted); margin-right: 4px; }
.review .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }
.review .tags span { padding: 0 8px; border-radius: 10px; background: #fdeedd; color: var(--red-ink); font-size: 11.5px; line-height: 20px; white-space: nowrap; }
.review dl { display: grid; gap: 7px; margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.review dt { font-size: 11px; line-height: 15px; color: var(--muted); }
.review dd { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; margin: 1px 0 0; font-size: 13.5px; line-height: 1.4; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.review dd span { font-size: 12px; font-weight: 400; color: var(--muted); }
.card .note { margin: 6px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.progress { height: 8px; background: #f3e1c8; border-radius: 4px; overflow: hidden; margin: 14px 0 6px; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, #e8273d, #f2a33a); transition: width .2s; }
.success { text-align: center; }
.success .ok-icon { font-size: 48px; }
.success img { width: 46%; margin: 14px auto; filter: drop-shadow(0 8px 14px rgba(80,0,0,.3)); }

/* ---------- my ---------- */
.mine { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.mine:last-child { border: 0; }
.mine img { width: 70px; flex: none; }
.mine .info { flex: 1; min-width: 0; font-size: 13px; }
.mine .info b { font-size: 15px; display: block; }
.mine .reason { background: #fde8e8; color: #b03030; padding: 6px 8px; border-radius: 8px; margin: 6px 0; font-size: 12px; }
.quota { display: flex; gap: 8px; margin-bottom: 10px; }
.quota div { flex: 1; text-align: center; background: #fff; border-radius: 10px; padding: 8px 4px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.quota b { display: block; font-size: 18px; color: var(--red); }
.myvote { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.myvote img { width: 34px; }
.myvote span { flex: 1; }

/* ---------- results ---------- */
.res-group h2 { color: var(--gold-soft); font-size: 18px; text-align: center; margin: 18px 0 10px; }
.res-group h2::before, .res-group h2::after { content: " ✦ "; color: var(--gold); }
.badge { display: inline-block; font-size: 11px; border-radius: 8px; padding: 0 6px; margin-bottom: 2px; }
.badge.public { background: #ffe6b3; color: #8a4b00; }
.badge.jury { background: #e2ecff; color: #2c4f9e; }

/* ---------- overlays ---------- */
#toast { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(30,10,5,.88); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80%; text-align: center; }
#toast.show { opacity: 1; }
#modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20,0,0,.72); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
#modal[hidden] { display: none; }
.sheet { background: var(--cream); border-radius: 16px; max-width: 480px; width: 100%; max-height: 82vh; overflow: auto; padding: 18px; position: relative; }
.sheet h3 { margin: 0 0 10px; color: var(--red-ink); }
.sheet pre { white-space: pre-wrap; font: inherit; font-size: 14px; margin: 0 0 14px; }
.sheet .doc { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.sheet .doc h4 { margin: 14px 0 4px; font-size: 15px; color: var(--red-ink); }
.sheet .doc h4:first-child { margin-top: 0; }
.sheet .doc p { margin: 0 0 4px; }
.sheet .doc b { color: var(--red-ink); }
.sheet .doc .notice { margin-bottom: 12px; padding: 8px 10px; border-radius: 8px; background: #fbe6d4; color: var(--red-ink); font-weight: 600; }
.foot .docs { margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
.foot .docs a { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 3px; }
.sheet p { margin: 0; }
.viewer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.92); z-index: 60; overflow: auto; display: flex; align-items: center; justify-content: center; }
.viewer img { max-height: 96vh; max-width: 96vw; }
.share-tip { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.8); z-index: 60; color: #fff; text-align: right; padding: 16px 24px; font-size: 16px; }
.share-tip .arrow { font-size: 44px; line-height: 1; }
.poster img { width: 100%; border-radius: 10px; }
.vote-pop { text-align: center; }
.vote-pop .big { font-size: 44px; }
@media (min-width: 521px) { body { padding: 0; } }

/* 老内核（iOS 14 / 旧安卓 X5）不支持 aspect-ratio：用 padding 撑出红包比例 */
@supports not (aspect-ratio: 1) {
  .env-preview, .mini-env { height: 0; padding-top: calc(100% * var(--env-h) / var(--env-w)); }
  .work .pic img { height: auto; }
}
