/* 只管结构和动作；长相全在各风格页面里 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--page, #000); }
@supports (height: 100dvh) { html, body { height: 100dvh; } }
button { font: inherit; color: inherit; cursor: pointer; }
.stage { position: relative; width: 100%; max-width: 480px; height: calc(100% - 38px - env(safe-area-inset-bottom, 0px)); margin: 0 auto; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  --sb: env(safe-area-inset-bottom, 0px); --st: env(safe-area-inset-top, 0px); --k: 1; }
/* 手机上长按图片会弹“保存图片”，长按按钮会选中文字：全部关掉 */
.stage img { -webkit-user-drag: none; -webkit-touch-callout: none; pointer-events: none; }
.stage image { -webkit-user-drag: none; -webkit-touch-callout: none; }
.stage textarea, .stage input { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
body.embedded .stage { height: 100%; }
body:not(.embedded) .stage { --sb: 0px; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }

/* 烟花筒：落地、发射后坐 */
.tube-in { transform-box: fill-box; transform-origin: 50% 100%; }
.tube-in.drop { animation: tubeDrop .75s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes tubeDrop { 0% { transform: translateY(-300px) rotate(-14deg); opacity: 0; } 55% { opacity: 1; } 72% { transform: translateY(0) scale(1.18, .78); } 86% { transform: scale(.94, 1.08); } 100% { transform: none; } }
.tube.fired .tube-in { animation: tubeKick .45s ease-out; }
@keyframes tubeKick { 25% { transform: scale(1.2, .72); } 60% { transform: scale(.92, 1.1); } }

/* 年兽：姿势切换 + 呼吸 */
.nian .p-idle, .nian .p-ears, .nian .p-cheer { display: none; }
.nian[data-pose="idle"] .p-idle, .nian[data-pose="ears"] .p-ears, .nian[data-pose="cheer"] .p-cheer { display: inline; }
.nian .n-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: nBreath 2.6s ease-in-out infinite; }
.nian[data-pose="ears"] .n-bob { animation: nShiver .11s linear infinite; }
.nian[data-pose="cheer"] .n-bob { animation: nHop .62s cubic-bezier(.3, 0, .4, 1) infinite; }
.nian.boing .n-bob { animation: nBoing .5s ease; }
.nian .n-arm, .nian .n-arm-k { fill: none; stroke-linecap: round; }
@keyframes nBreath { 50% { transform: scale(1.025, .975); } }
@keyframes nShiver { 50% { transform: translateX(1.4px); } }
@keyframes nHop { 0%, 100% { transform: translateY(0) scale(1.04, .96); } 45% { transform: translateY(-9px) scale(.97, 1.04); } }
@keyframes nBoing { 30% { transform: scale(1.14, .84); } 60% { transform: scale(.9, 1.12); } }

/* 放烟花面板 */
.sheet-wrap, .card-wrap { position: absolute; inset: 0; z-index: 20; display: flex; background: var(--veil, rgba(0, 0, 0, .5)); }
.sheet-wrap[hidden], .card-wrap[hidden], .toast[hidden] { display: none; }
.sheet-wrap { align-items: flex-end; }
.sheet { width: 100%; display: flex; flex-direction: column; gap: 13px; padding: 20px 20px 24px; animation: sheetUp .32s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet h2 { margin: 0; text-align: center; }
.sheet .row { display: flex; align-items: center; gap: 14px; }
.sheet .row label { flex: none; width: 2.4em; }
.inks, .shapes { display: flex; gap: 10px; }
.ink-sw { width: 34px; height: 34px; padding: 0; }
.shape-sw { min-width: 46px; height: 38px; padding: 0 10px; }
.sheet textarea, .sheet input { width: 100%; resize: none; outline: none; font: inherit; }
.fuse { position: relative; overflow: hidden; touch-action: none; --p: 0; }
.fuse i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p) * 100%); pointer-events: none; }
.fuse span { position: relative; }
.fuse.burning { animation: nShiver .1s linear infinite; }

.card-wrap { align-items: center; justify-content: center; padding: 26px; }
.card { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 100%; }
.toast { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 30; white-space: nowrap; }

/* 样张控制条（正式版没有） */
.proto { position: fixed; left: 0; right: 0; bottom: 0; height: calc(38px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px) !important; display: flex; gap: 4px; padding: 5px; justify-content: center; background: #111; font: 12px -apple-system, "PingFang SC", sans-serif; }
.proto button { padding: 0 10px; border-radius: 6px; border: 1px solid #333; background: #1c1c1c; color: #aaa; }
.proto button.on { background: #f2e6cf; color: #111; border-color: #f2e6cf; font-weight: 700; }

/* 点筒时冒出来的名牌 */
.nametag { position: absolute; z-index: 7; transform: translate(-50%, -100%); margin-top: -10px; padding: 5px 10px; white-space: nowrap; pointer-events: none; background: #fff; color: #111; font-size: 13px; animation: tagPop 1.9s ease both; }
.nametag[hidden] { display: none; }
@keyframes tagPop { 0% { opacity: 0; transform: translate(-50%, -70%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); } 20%, 80% { opacity: 1; transform: translate(-50%, -100%); } 100% { opacity: 0; transform: translate(-50%, -150%); } }

/* 仓库模式 */
.tube-in.hop { animation: tubeHop .55s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes tubeHop { 0% { transform: translateY(46px) scale(.5); opacity: 0; } 60% { opacity: 1; transform: translateY(-8px) scale(1.08, .94); } 100% { transform: none; } }
.depot { position: absolute; z-index: 5; }
.depot-row { display: flex; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.depot-row::-webkit-scrollbar { display: none; }
.dp { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; }
.dp-art { display: block; line-height: 0; transition: transform .15s; }
.dp:active .dp-art { transform: translateY(-4px) scale(1.06); }
.dp.out .dp-art { visibility: hidden; }
.dp.new { animation: dpIn .6s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes dpIn { from { transform: translateY(-60px) rotate(-12deg); opacity: 0; } }

/* 仓库放不下时：右边渐隐提示还能滑；“全部”页是一整页格子 */
.depot.many .depot-row { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
.depot-all { display: none; border: 0; background: none; padding: 0; }
.depot.many .depot-all { display: inline-block; }
.depot-sheet { width: 100%; max-height: 72%; display: flex; flex-direction: column; animation: sheetUp .3s cubic-bezier(.2, .9, .3, 1) both; }
.ds-head { display: flex; align-items: center; justify-content: space-between; flex: none; }
.ds-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); align-content: start; justify-items: center; -webkit-overflow-scrolling: touch; }

.nametag.keep { animation: tagIn .35s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes tagIn { from { opacity: 0; transform: translate(-50%, -70%) scale(.6); } to { opacity: 1; transform: translate(-50%, -100%); } }
/* 常用祝福：一行可横向滑动的小按钮 */
.quick { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; padding: 7px 12px; border: 2px solid var(--ink, #2a1d14); border-radius: 999px; background: #fbf3e1; color: var(--ink, #2a1d14); font: 700 13px/1.2 var(--song, serif); white-space: nowrap; cursor: pointer; }
.quick button:active { background: var(--ochre, #e9b23c); }
/* 性能：带纸纹滤镜的部分各自放一层，浏览器画一次就缓存，烟花动的时候不用重算滤镜 */
.rough, .grain { will-change: transform; }
