/* ============ 设计变量 ============ */
:root {
  --paper: #FBF6EC;
  --paper-2: #F3EBDA;
  --card: #FFFDF8;
  --ink: #1E2B45;
  --ink-2: #5B6478;
  --ink-3: #8A90A0;
  --line: rgba(30, 43, 69, .12);
  --blue: #4A6FA5;      /* 治愈蓝 */
  --blue-deep: #2E4A78;
  --blue-light: #B3CBE5;
  --sky: #50BBFF;
  --yellow: #FFEC6C;
  --green: #74F092;
  --orange: #FF602E;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --col: min(100vw, 480px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.locked { overflow: hidden; height: 100dvh; }
/* 纸张颗粒 */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
.defs { position: absolute; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .14em; color: var(--blue); font-weight: 600;
}
.eyebrow::before {
  content: ""; width: 24px; height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 8'%3E%3Cpath d='M1 5 C4 1 7 1 9 4 S14 7 16 4 S21 1 23 3' fill='none' stroke='%23FF602E' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s, color .2s, box-shadow .2s;
}
.btn:active { transform: scale(.96); }
.btn svg { font-size: 18px; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 18px -8px rgba(30, 43, 69, .6); }
.btn-ghost { background: var(--card); color: var(--ink); border: 2px solid var(--ink); border-radius: 18px 225px 15px 255px / 255px 15px 225px 18px; }
.btn-ghost.on { background: var(--orange); color: #fff; border-color: var(--ink); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn-text { color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 4px; padding: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; position: relative;
  font-size: 20px; color: var(--ink);
}
.icon-btn:active { background: var(--line); }

/* ============ 开场 ============ */
.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; justify-content: center;
  background: var(--paper);            /* 盖住两半纸之间的接缝，撕开时再去掉 */
}
.intro.leaving { background: transparent; }
.intro-half {
  position: absolute; top: 0; bottom: 0; width: calc(50% + 14px); background: var(--paper);
}
.intro-half.left { left: 0; }
.intro-half.right { right: 0; }
.intro-stage {
  position: relative; width: var(--col); height: 100dvh; overflow: hidden;
}
.intro-tools {
  position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
}
.skip {
  font-size: 13px; color: var(--ink-2); padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .7);
  box-shadow: inset 0 0 0 1px var(--line); opacity: 0; pointer-events: none; transition: opacity .3s;
}
.intro[data-stage="play"] .skip { opacity: 1; pointer-events: auto; }

/* 加载 */
.loader, .ready {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 32px; transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.loader-girl { width: 92px; margin-bottom: 26px; animation: sway 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.load-bar { width: 160px; height: 6px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.load-bar i { display: block; height: 100%; background: var(--blue); transform-origin: left; transform: scaleX(0); transition: transform .3s; border-radius: 6px; }
.load-text { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.load-note { margin-top: 6px; font-size: 12px; color: var(--orange); min-height: 1em; }
.intro:not([data-stage="loading"]) .loader { opacity: 0; pointer-events: none; transform: translateY(-12px); }

/* 准备 */
.ready { gap: 18px; opacity: 0; pointer-events: none; transform: translateY(12px); }
.intro[data-stage="ready"] .ready { opacity: 1; pointer-events: auto; transform: none; transition-delay: .25s; }
.intro:not([data-stage="loading"]) .loader { transition-duration: .25s; }
.ready-title { font: 700 32px/1.35 var(--serif); letter-spacing: .02em; margin: 6px 0 18px; }
.btn-start { height: 56px; padding: 0 30px; font-size: 16px; animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 96, 46, .35), 0 6px 18px -8px rgba(30, 43, 69, .6); } 50% { box-shadow: 0 0 0 12px rgba(255, 96, 46, 0), 0 6px 18px -8px rgba(30, 43, 69, .6); } }
.btn-enter { margin-top: -6px; }
.ready-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }

/* 字幕 */
.caption {
  position: absolute; left: 16px; right: 16px; top: 13%; z-index: 6; text-align: center;
  font: 700 23px/1.45 var(--serif); letter-spacing: .03em; pointer-events: none;
  text-shadow: 0 0 10px var(--paper), 0 0 4px var(--paper);
}
.caption span { display: inline-block; }

/* 画作卡片 */
.cards { position: absolute; inset: 0; pointer-events: none; }
.icard {
  position: absolute; left: 50%; top: 50%; width: 76px; margin: -42px 0 0 -38px;
  padding: 4px 4px 12px; background: #fff; border-radius: 3px;
  box-shadow: 0 6px 14px -6px rgba(30, 43, 69, .45), 0 1px 2px rgba(30, 43, 69, .2);
  opacity: 0; will-change: transform, opacity;
}
.icard img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 1px; }

/* 标志 */
.logo-form { position: absolute; left: 50%; top: 50%; opacity: 0; pointer-events: none; z-index: 2; }
.logo-block { position: relative; background: var(--blue); overflow: hidden; }
.logo-block img { width: 100%; height: 100%; }
.heart-ring {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 3px solid var(--orange); opacity: 0;
}

/* 礼物 */
.gift { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.intro[data-stage="gift"] .gift { pointer-events: auto; }
.gift-kicker {
  position: absolute; top: 11%; left: 0; right: 0; text-align: center;
  font: 700 24px/1.4 var(--serif); opacity: 0;
}
.gift-card {
  position: absolute; left: 50%; top: 45%; transform-style: preserve-3d; opacity: 0;
}
.gift-card .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 4px;
}
.gift-card .front { background: #fff; padding: 8px 8px 26px; box-shadow: 0 24px 40px -18px rgba(30, 43, 69, .55), 0 2px 4px rgba(30, 43, 69, .15); }
.gift-card .front img { width: 100%; height: 100%; object-fit: contain; background: var(--paper-2); }
.gift-card .back { background: var(--blue); transform: rotateY(180deg); display: grid; place-items: center; }
.gift-card .back img { height: 70%; }
.gift-info { position: absolute; left: 24px; right: 24px; bottom: calc(118px + var(--safe-b)); text-align: center; opacity: 0; }
.gift-title { font: 700 24px/1.3 var(--serif); }
.gift-meta { margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.btn-accept { position: absolute; left: 50%; bottom: calc(44px + var(--safe-b)); transform: translateX(-50%); opacity: 0; height: 54px; padding: 0 34px; }
.btn-accept:active { transform: translateX(-50%) scale(.96); }
.intro.leaving .intro-stage > * { opacity: 0 !important; transition: opacity .3s; }

/* ============ 页面骨架 ============ */
.app, .topbar { width: var(--col); margin: 0 auto; }
.app { position: relative; background: var(--paper); }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 8px 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(251, 246, 236, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.topbar.scrolled { border-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; text-decoration: none; letter-spacing: .06em; }
.mark { width: 16px; height: 38px; background: var(--blue); display: grid; place-items: center; padding: 3px 2px; }
.mark img { height: 100%; }
.topbar-actions { display: flex; gap: 2px; }
.badge {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.badge.bump { animation: bump .5s var(--ease); }
@keyframes bump { 40% { transform: scale(1.5); } }

.section, .hero { position: relative; }
.section { padding: 72px 20px; }
.section.tint { background: var(--paper-2); }
.section h2 { font: 700 28px/1.35 var(--serif); margin-top: 12px; letter-spacing: .01em; }
.lead { margin-top: 12px; color: var(--ink-2); }

[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

/* 画框 */
.frame { position: relative; margin: 0; background: #fff; padding: 10px 10px 30px; border-radius: 3px; box-shadow: 0 22px 40px -22px rgba(30, 43, 69, .5), 0 1px 3px rgba(30, 43, 69, .12); }
.frame img { width: 100%; height: auto; background: var(--paper-2); }
.tape { position: absolute; width: 74px; height: 22px; background: rgba(255, 236, 108, .78); z-index: 2; }
.tape.t1 { top: -9px; left: 16px; transform: rotate(-8deg); }
.tape.t2 { top: -8px; right: 14px; transform: rotate(6deg); background: rgba(116, 240, 146, .7); }

/* ============ 你的画 ============ */
.hero { padding: 28px 20px 40px; }
.hero-frame { margin-top: 22px; transform: rotate(-1.2deg); }
.hero-img { max-height: 62vh; object-fit: contain; }
.hero-title { font: 800 34px/1.25 var(--serif); margin-top: 28px; letter-spacing: .02em; }
.hero-meta { margin-top: 6px; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.story {
  position: relative; margin: 22px 0 0; padding: 16px 18px 16px 22px; background: var(--card); border-radius: 4px;
  box-shadow: inset 3px 0 0 var(--orange);
  color: var(--ink); font-size: 15px;
}
.story p { white-space: pre-line; }
.story.clamped p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.story cite { display: block; margin-top: 8px; font-style: normal; font-size: 12px; color: var(--ink-3); }
.story-more { padding: 4px 0 0; font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.scroll-cue { margin-top: 36px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); text-decoration: none; }
.scroll-cue svg { font-size: 18px; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); } }

/* ============ 画它的人 ============ */
.artist-name { font: 800 44px/1.2 var(--serif) !important; margin-top: 14px !important; }
.artist-meta { color: var(--ink-2); margin-top: 6px; }
.hscroll {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 22px -20px 0; padding: 4px 20px 12px;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.mini {
  flex: none; width: 128px; margin: 0; scroll-snap-align: start; text-align: left;
}
.mini .thumb { background: #fff; padding: 5px 5px 14px; border-radius: 3px; box-shadow: 0 8px 16px -10px rgba(30, 43, 69, .45); }
.mini img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.mini span { display: block; margin-top: 8px; font-size: 13px; line-height: 1.4; }
.artist-quote { margin-top: 18px; }
#artist .btn { margin-top: 24px; width: 100%; }

/* ============ 1/2 的故事 ============ */
.story-sec { background: var(--blue-deep); color: #fff; position: relative; overflow: clip; }
.story-visual {
  position: sticky; top: 56px; height: 52vh; display: grid; place-items: center; z-index: 3; overflow: hidden;
  background: var(--blue-deep);
  box-shadow: 0 18px 24px -8px var(--blue-deep);
}
.sv-block { height: 40vh; width: calc(40vh * 274 / 664); background: var(--blue); position: relative; transition: transform .8s var(--ease), box-shadow .8s; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
.sv-block img { width: 100%; height: 100%; transition: opacity .6s, filter .6s; }
.sv-ring {
  position: absolute; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--yellow);
  left: 50%; top: 50%; opacity: 0; pointer-events: none; transition: opacity .4s;
}
.sv-hand {
  position: absolute; width: 74px; height: 98px; left: 50%; bottom: 2%;
  fill: none; stroke: var(--yellow); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 520; stroke-dashoffset: 520; transition: stroke-dashoffset 1.2s var(--ease), opacity .4s; opacity: 0;
}
.sv-dots { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sv-dots li { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .3); transition: background .3s, transform .3s; }
.story-visual[data-step="1"] .sv-dots li:nth-child(1), .story-visual[data-step="2"] .sv-dots li:nth-child(2),
.story-visual[data-step="3"] .sv-dots li:nth-child(3), .story-visual[data-step="4"] .sv-dots li:nth-child(4) { background: var(--yellow); transform: scale(1.4); }
.story-visual[data-step="2"] .sv-block img { opacity: .35; }
.story-visual[data-step="2"] .sv-ring { opacity: 1; animation: ring 1.4s ease-out infinite; }
.story-visual[data-step="3"] .sv-hand { opacity: 1; stroke-dashoffset: 0; }
.story-visual[data-step="3"] .sv-block { transform: rotate(-4deg); }
.story-visual[data-step="4"] .sv-block { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(255, 236, 108, .18); }
@keyframes ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.story-steps { position: relative; z-index: 1; padding: 0 20px 18vh; }
.step {
  min-height: 40vh; padding: 4vh 0; display: flex; flex-direction: column; justify-content: center;
  opacity: .25; transition: opacity .5s;
}
.step.active { opacity: 1; }
.step-no { align-self: flex-start; font-size: 12px; letter-spacing: .14em; color: var(--yellow); padding: 2px 0; }
.step h3 { font: 700 26px/1.4 var(--serif); margin-top: 10px; }
.step p { margin-top: 10px; color: rgba(255, 255, 255, .78); }
.step[data-step="4"] h3 { font-size: 24px; color: var(--yellow); }

/* ============ 我们在做什么 ============ */
.flow { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 14px; }
.flow li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: center;
  padding: 16px; background: var(--card); border: 1.5px solid var(--ink);
  border-radius: 14px 6px 12px 5px / 5px 12px 6px 14px; box-shadow: 3px 4px 0 var(--ink);
}
.flow-no { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); font-weight: 800; }
.flow li:nth-child(2) .flow-no { background: var(--green); }
.flow li:nth-child(3) .flow-no { background: var(--sky); color: #fff; }
.flow li:nth-child(4) .flow-no { background: var(--orange); color: #fff; }
.flow h4 { font-size: 16px; }
.flow p { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.6; }
.flow-img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.example { margin-top: 28px; }
.example-title { font-size: 13px; color: var(--ink-2); }
.example-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.example-row .mini { width: auto; }

/* ============ 画廊 ============ */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 24px -20px 0; padding: 2px 20px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); transition: background .2s, color .2s;
}
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }
.chip .x { margin-left: 6px; opacity: .7; }
.masonry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; align-items: start; }
.masonry .col { display: grid; gap: 14px; }
.tile { display: block; width: 100%; text-align: left; position: relative; animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.tile .thumb { position: relative; background: #fff; padding: 5px 5px 0; border-radius: 3px; box-shadow: 0 8px 18px -12px rgba(30, 43, 69, .5); }
.col:first-child .tile:nth-child(odd) .thumb { transform: rotate(-1.2deg); }
.col:first-child .tile:nth-child(even) .thumb { transform: rotate(.8deg); }
.col:last-child .tile:nth-child(odd) .thumb { transform: rotate(1deg); }
.col:last-child .tile:nth-child(even) .thumb { transform: rotate(-.7deg); }
.tile:nth-child(3n+1) .thumb::before {
  content: ""; position: absolute; top: -8px; left: 50%; width: 54px; height: 18px; margin-left: -27px; z-index: 2;
  background: rgba(255, 236, 108, .8); transform: rotate(-4deg);
}
.tile:nth-child(3n+2) .thumb::before {
  content: ""; position: absolute; top: -7px; right: 10px; width: 40px; height: 16px; z-index: 2;
  background: rgba(116, 240, 146, .7); transform: rotate(8deg);
}
.tile img { width: 100%; height: auto; background: var(--paper); }
.tile .cap { padding: 8px 4px 10px; font-size: 13px; line-height: 1.4; }
.tile .cap small { display: block; color: var(--ink-3); font-size: 11px; margin-top: 2px; }
.tile .fav { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; display: none; place-items: center; font-size: 13px; }
.tile.collected .fav { display: grid; }
.tile.broken .thumb::after { content: "画作正在路上 · 点我重试"; display: grid; place-items: center; aspect-ratio: 1; font-size: 12px; color: var(--ink-3); }
.tile.broken img { display: none; }
.btn-more { width: 100%; margin-top: 24px; }
.gallery-empty { margin-top: 24px; text-align: center; color: var(--ink-3); }

/* ============ 二创 ============ */
.cocreate .mini { width: 210px; }
.cocreate .mini img { aspect-ratio: 4 / 5; }
.cocreate .mini small { display: block; color: var(--ink-3); font-size: 11px; }

/* ============ 参与 ============ */
.join { background: linear-gradient(180deg, var(--paper) 0%, #FFF6C9 100%); }
.join-cards { display: grid; gap: 14px; margin-top: 28px; }
.join-card {
  position: relative; padding: 22px 20px 20px; background: var(--card); overflow: hidden;
  border: 2px solid var(--ink); border-radius: 18px 8px 16px 6px / 6px 16px 8px 18px; box-shadow: 5px 6px 0 var(--ink);
}
.join-card:nth-child(2) { transform: rotate(-.8deg); }
.join-card:nth-child(3) { transform: rotate(.6deg); }
.join-card::before { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; opacity: .55; }
.join-card.c1::before { background: var(--yellow); }
.join-card.c2::before { background: var(--green); }
.join-card.c3::before { background: var(--blue-light); }
.join-ico { position: relative; font-size: 26px; color: var(--ink); }
.join-card h3 { font: 700 21px/1.4 var(--serif); margin-top: 10px; position: relative; }
.join-card p { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.join-card .btn { margin-top: 16px; width: 100%; }
.soon { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }

/* ============ 页脚 ============ */
.footer { background: var(--blue); color: #fff; text-align: center; padding: 56px 24px calc(40px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.footer-logo { width: 46px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.footer-word { width: 180px; filter: brightness(0) invert(1); }
.footer p { font-size: 12px; color: rgba(255, 255, 255, .75); }
.footer .btn-text { color: #fff; }
.fine { font-size: 11px !important; color: var(--ink-3); }
.footer .fine { color: rgba(255, 255, 255, .55) !important; }

/* ============ 浮层 ============ */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(20, 28, 46, .45); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 70; width: var(--col); max-height: 90dvh;
  transform: translateX(-50%); background: var(--paper); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; animation: up .38s var(--ease);
  box-shadow: 0 -10px 40px -10px rgba(20, 28, 46, .35);
}
@keyframes up { from { transform: translate(-50%, 100%); } }
.sheet.closing { animation: down .26s ease-in forwards; }
@keyframes down { to { transform: translate(-50%, 100%); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 4px 20px; position: relative; min-height: 52px; }
.sheet-head h3 { font: 700 18px var(--serif); }
.grip { position: absolute; left: 50%; top: 7px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line); }
.sheet-head .icon-btn { margin-left: auto; }
.sheet-body { overflow-y: auto; padding: 4px 20px calc(28px + var(--safe-b)); overscroll-behavior: contain; }
.detail-frame img { max-height: 52vh; object-fit: contain; }
.detail-title { font: 800 26px/1.3 var(--serif); margin-top: 20px; }
.detail-meta { color: var(--ink-2); margin-top: 4px; }
.detail-artist { display: block; margin: 16px auto 0; }

.folder-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.folder-grid .mini { width: auto; }
.folder-empty { text-align: center; padding: 20px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--ink-2); }
.folder-empty img { width: 70px; }

.msg-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-presets .chip { height: auto; padding: 7px 12px; text-align: left; }
.msg-field { display: block; position: relative; margin-top: 14px; }
.msg-field textarea {
  width: 100%; border: 0; border-radius: 8px; padding: 12px 14px 26px; resize: none; background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line); font: 15px/1.6 var(--sans); color: var(--ink); outline: none;
}
.msg-field textarea:focus { box-shadow: inset 0 0 0 1.5px var(--blue); }
.msg-count { position: absolute; right: 12px; bottom: 8px; font-size: 11px; color: var(--ink-3); }
.msg-error { color: var(--orange); font-size: 13px; margin-top: 8px; }
.btn-send { width: 100%; margin-top: 16px; }
.btn-send.loading { pointer-events: none; }
.btn-send.loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.msg-done { text-align: center; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.msg-done h3 { font: 700 24px var(--serif); }
.msg-done p { color: var(--ink-2); }
.msg-heart { width: 72px; height: 72px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 34px; animation: pop .6s var(--ease); }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.15); } }

.modal {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 56px 24px calc(28px + var(--safe-b)); background: rgba(20, 28, 46, .86); color: #fff; animation: fade .25s;
}
.modal-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; }
.share-img { flex: none; width: min(78vw, 360px, calc(66dvh * 750 / 1334)); height: auto; border-radius: 6px; box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .5); animation: pop .5s var(--ease); }
.share-hint { font-size: 14px; }
/* 本地打开时的分享卡片（HTML 版，和 canvas 版排版一致） */
.share-dom {
  flex: none; width: min(78vw, 340px, calc(66dvh * 750 / 1334)); aspect-ratio: 750 / 1334; container-type: inline-size;
  display: flex; flex-direction: column; padding: 8cqw 8cqw 6cqw; border-radius: 6px; background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .5); animation: pop .5s var(--ease); text-align: left;
}
.sd-head { display: flex; align-items: center; gap: 2.5cqw; font-size: 3.2cqw; font-weight: 600; }
.sd-head img { height: 6.5cqw; width: auto; }
.sd-title { margin-top: 5cqw; font: 700 7.6cqw/1.3 var(--serif); }
.sd-title em { font-style: normal; color: var(--orange); }
.sd-pic { position: relative; flex: 1; min-height: 0; margin: 5cqw 0 4cqw; }
.sd-half { position: absolute; inset: 0; filter: drop-shadow(0 1.5cqw 2cqw rgba(30, 43, 69, .3)); }
.sd-half img { width: 100%; height: 100%; object-fit: contain; }
.sd-half.l { transform: translateX(-1.5%) rotate(-1.5deg); }
.sd-half.r { transform: translate(2%, 2%) rotate(2.5deg); }
.sd-name { font: 700 5.4cqw/1.3 var(--serif); }
.sd-meta { margin-top: 1cqw; font-size: 3.4cqw; color: var(--ink-2); }
.sd-story { margin-top: 2.5cqw; font-size: 3.2cqw; line-height: 1.6; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-foot { display: flex; align-items: center; justify-content: space-between; gap: 3cqw; margin-top: 4cqw; padding-top: 4cqw; border-top: 1px solid var(--line); }
.sd-foot b { display: block; font: 700 4cqw/1.4 var(--serif); }
.sd-foot small { display: block; margin-top: 1cqw; font-size: 3cqw; color: var(--ink-3); }
.sd-qr { flex: none; width: 20cqw; aspect-ratio: 1; background: #fff; display: grid; place-items: center; }
.sd-qr svg { width: 100%; height: 100%; }
.sd-qr span { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; border: 1.5px dashed var(--ink-3); font-size: 2.6cqw; color: var(--ink-3); }
.share-error { font-size: 14px; color: var(--yellow); text-align: center; }
.share-loading { display: flex; align-items: center; gap: 10px; }
.modal .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b)); z-index: 95; transform: translate(-50%, 20px);
  max-width: calc(var(--col) - 40px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 96; padding: 8px 16px; background: var(--orange); color: #fff; font-size: 13px; text-align: center; }
.fly-heart { position: fixed; z-index: 99; width: 22px; height: 22px; color: var(--orange); pointer-events: none; }

/* ============ 手绘元素 ============ */
.doodle { position: absolute; width: 28px; height: 28px; overflow: visible; pointer-events: none; z-index: 1; animation: wob 1.3s steps(1) infinite; }
.doodle.star { fill: var(--yellow); stroke: var(--ink); stroke-width: 2.8; stroke-linejoin: round; }
.doodle.spark { fill: var(--green); stroke: var(--ink); stroke-width: 2.8; stroke-linejoin: round; }
.doodle.heart { fill: var(--orange); stroke: var(--ink); stroke-width: 2.8; stroke-linejoin: round; }
.doodle.spiral { fill: none; stroke: var(--blue); stroke-width: 3.2; stroke-linecap: round; width: 36px; height: 36px; }
.doodle.squiggle { fill: none; stroke: var(--orange); stroke-width: 3.5; stroke-linecap: round; width: 72px; height: 18px; }
@keyframes wob { 0% { transform: rotate(-7deg); } 50% { transform: rotate(6deg) translateY(-1px); } }
.h-spark { top: 20px; right: 22px; width: 32px; height: 32px; }
.a-heart { top: 66px; right: 28px; }
.w-spiral { top: 58px; right: 24px; }
.g-star { top: 60px; right: 28px; width: 32px; height: 32px; }
.t-squiggle { top: 76px; right: 22px; }
.j-heart { top: 58px; right: 70px; }
.j-star { top: 92px; right: 28px; width: 22px; height: 22px; animation-delay: -.6s; }
.ready .doodle { width: 34px; height: 34px; }
.ready .r1 { top: 22%; left: 12%; }
.ready .r2 { top: 30%; right: 12%; width: 26px; height: 26px; animation-delay: -.4s; }
.ready .r3 { bottom: 20%; right: 22%; width: 24px; height: 24px; animation-delay: -.8s; }
.ready-girl { width: 64px; margin-bottom: 4px; animation: sway 2.4s ease-in-out infinite; transform-origin: 50% 100%; }

/* 会自己画出来的马克笔下划线 */
.scribble { position: relative; z-index: 0; white-space: nowrap; }
.scribble svg { position: absolute; left: -4%; bottom: -.1em; width: 108%; height: .45em; z-index: -1; overflow: visible; pointer-events: none; }
.scribble path {
  fill: none; stroke: var(--orange); stroke-opacity: .85; stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.6, 0, .3, 1) .15s;
}
.scribble.in path { stroke-dashoffset: 0; }
.ready-title .scribble path, .artist-name .scribble path { stroke: var(--yellow); stroke-opacity: 1; stroke-width: 12; }
.story-sec .scribble path { stroke-width: 5; }

/* ============ 盲盒 ============ */
.gift { --bw: 250px; --box-y: 60%; perspective: 1200px; }
.bx, .box-hit {
  position: absolute; left: 50%; top: var(--box-y); width: var(--bw); height: calc(var(--bw) * 220 / 240);
  margin: calc(var(--bw) * -110 / 240) 0 0 calc(var(--bw) / -2);
  transform-origin: 50% 92%; overflow: visible;
}
.bx { opacity: 0; pointer-events: none; }
.bx-back { z-index: 1; }
.gift-card { z-index: 2; }
.bx-front { z-index: 3; }
.bx-lid, .bx-deco { z-index: 4; }
.box-hit { z-index: 7; pointer-events: none; border-radius: 24px; }
.intro[data-stage="box"] .box-hit { pointer-events: auto; cursor: pointer; }
.box-hint {
  position: absolute; left: 20px; right: 20px; top: 20%; z-index: 5; text-align: center; opacity: 0;
  font-size: 14px; line-height: 1.6; color: var(--ink-2);
}
.box-hint b { display: block; margin-top: 6px; font: 700 26px/1.4 var(--serif); color: var(--ink); }
.hand-arrow { position: absolute; left: calc(50% + 6px); top: calc(20% + 84px); width: 96px; height: 72px; z-index: 5; overflow: visible; }
.hand-arrow path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.burst { position: absolute; left: 50%; top: var(--box-y); width: 0; height: 0; z-index: 6; }
.burst-bit { position: absolute; left: 0; top: 0; }
.burst-bit svg { display: block; transform: translate(-50%, -50%); overflow: visible; }
.intro[data-stage="box"] .skip { opacity: 0; pointer-events: none; }

/* ============ 桌面端 ============ */
.desk-note { display: none; }
@media (min-width: 900px) {
  html { background: #E9E1CF; }
  body { background: #E9E1CF; }
  .app { box-shadow: 0 0 60px -20px rgba(30, 43, 69, .35); }
  .topbar { background: rgba(251, 246, 236, .92); }
  .desk-note {
    display: flex; position: fixed; left: 40px; bottom: 40px; width: 240px; gap: 14px; align-items: flex-end;
    font-size: 13px; color: var(--ink-2); line-height: 1.6;
  }
  .desk-note img { width: 32px; }
  .desk-note b { color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
