/* ============ 宝宝的照片墙 · 主样式 ============ */
:root {
  --ink: #5b4a3f; --ink-2: #8a7666; --cream: #fdf8ee; --cream-2: #f6eedd;
  --pink: #e8738f; --pink-2: #f4a9bd; --mint: #8fd0a8; --sun: #f2d98a; --sky: #a8d8ef;
  --wA: #eaf4dd; --wB: #d3e9c0; --skirt: #b9d8a0; --accent: #7fa86b; --deco: #5d8a4a; --inkonwall: #4a5b3f;
  --swayAmp: 2.2deg;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  color: var(--ink); background: var(--wA); overflow: hidden;
  user-select: none; -webkit-user-select: none;
}
body.boot #topbar, body.boot #ribbon, body.boot #eventsLayer, body.boot #fxCanvas { display: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--ink); }
img { display: block; }

/* ---------- 视口与墙体 ---------- */
#viewport { position: fixed; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; overscroll-behavior-x: contain; }
#viewport::-webkit-scrollbar { display: none; }
#wallCanvas { position: absolute; top: 0; bottom: 84px; left: 0; min-width: 100%;
  background: linear-gradient(var(--wA), var(--wB));
  transition: background .8s linear;
}
#wallCanvas::after { /* 墙面细纹 */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .35) 1px, transparent 1.4px);
  background-size: 26px 26px;
}
.skirt { position: absolute; left: 0; right: 0; bottom: 0; height: 84px; z-index: 5;
  background: linear-gradient(var(--skirt), color-mix(in srgb, var(--skirt) 82%, #9c8468));
  border-top: 3px solid rgba(255, 255, 255, .55);
  box-shadow: 0 -6px 14px rgba(120, 100, 70, .08);
}
.skirt::before { content: ""; position: absolute; inset: 12px 0 auto 0; height: 20px; opacity: .35;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.6) 0 3px, transparent 3px 24px);
}
/* 星空主题下墙面文字变亮 */
body.dark-wall { --inkonwall: #dfe6ff; }

/* ---------- 相框 ---------- */
.frames-layer { position: absolute; inset: 0; z-index: 8; }
.frame { position: absolute; width: var(--fw, 240px); z-index: 8; cursor: pointer;
  filter: drop-shadow(0 10px 18px rgba(105, 85, 60, .22));
  animation: pinIn .7s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: var(--pin-d, 0s);
}
@keyframes pinIn { from { transform: rotate(var(--rot)) translateY(-46px) scale(.7); opacity: 0; } to { transform: rotate(var(--rot)) translateY(0) scale(1); opacity: 1; } }
.sway { transform-origin: 50% -26px; animation: sway var(--dur, 7s) ease-in-out var(--delay, 0s) infinite alternate; }
@keyframes sway { from { transform: rotate(calc(var(--swayAmp) * -1)); } to { transform: rotate(var(--swayAmp)); } }
@keyframes swayHard { from { transform: rotate(-5.5deg); } to { transform: rotate(5.5deg); } }
body.windy .sway { animation-name: swayHard; animation-duration: 1.1s; }
.frame.wiggle .sway { animation: wiggle .75s ease; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 55% { transform: rotate(6deg); } 80% { transform: rotate(-3.5deg); } }
body.lb-open .sway, body.lb-open .frame { animation-play-state: paused; }

.fcard { position: relative; border-radius: 6px; padding: 10px; }
.ph { position: relative; overflow: hidden; background: linear-gradient(135deg, #f2ead8, #e9dfc8); aspect-ratio: 4/3; border-radius: 4px; }
.ph img { width: 100%; height: 100%; object-fit: cover; object-position: center 32%; opacity: 0; transition: opacity .6s; }
.ph img.on { opacity: 1; }
.ph.shimmer { background-size: 200% 100%; animation: shim 1.6s linear infinite; }
@keyframes shim { from { background-position: 200% 0; } to { background-position: -40% 0; } }

.vbadge { position: absolute; inset: 0; display: grid; place-items: center; }
.vbadge svg { filter: drop-shadow(0 2px 6px rgba(60, 45, 30, .45)); }
.favb { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; z-index: 3;
  background: #fff; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 3px 8px rgba(105, 85, 60, .3); animation: pop .5s cubic-bezier(.2, 1.8, .4, 1) both;
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.durb { position: absolute; left: 8px; bottom: 8px; background: rgba(52, 42, 34, .62); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; backdrop-filter: blur(2px); }

.plaque { position: absolute; left: 50%; top: calc(100% + 14px); transform: translateX(-50%);
  background: #e7cda4; border: 1.5px solid #c9a36f; border-radius: 5px 5px 5px 2px;
  padding: 3px 10px 4px; font-size: 11.5px; color: #7a5b36; white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 3px 6px rgba(105, 85, 60, .25);
}
.plaque::before { content: ""; position: absolute; top: -14px; left: 50%; width: 1.5px; height: 14px; background: #b08a5c; transform: translateX(-50%); }
.plaque.pl-empty { opacity: 0; }

/* 拍立得 */
.f-polaroid .fcard { background: #fdfaf2; padding: 10px 10px 44px; border-radius: 4px; border: 1px solid #efe6d2; }
.f-polaroid .fcard::after { content: ""; position: absolute; top: -12px; left: 50%; width: 74px; height: 22px;
  transform: translateX(-50%) rotate(-3deg); background: rgba(244, 169, 189, .75);
  border-left: 1px dashed rgba(255,255,255,.8); border-right: 1px dashed rgba(255,255,255,.8); opacity: .92;
}
.f-polaroid .plaque { display: none; }
.f-polaroid .ptext { position: absolute; left: 0; right: 0; bottom: 9px; text-align: center; font-size: 12px; color: #8a7666; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 原木框 + 挂绳 */
.f-wood .fcard { background: linear-gradient(135deg, #b98d5f, #a17a4d); padding: 12px; border-radius: 8px;
  box-shadow: inset 0 0 0 3px rgba(255, 246, 234, .5), inset 0 0 0 5px rgba(90, 62, 34, .25); }
.f-wood .fcard::before { content: ""; position: absolute; top: -22px; left: 0; right: 0; height: 24px;
  background: linear-gradient(105deg, transparent 49.6%, #b08a5c 49.8%, #b08a5c 50.2%, transparent 50.4%),
              linear-gradient(75deg, transparent 49.6%, #b08a5c 49.8%, #b08a5c 50.2%, transparent 50.4%); }
.f-wood .fcard::after { content: ""; position: absolute; top: -26px; left: 50%; width: 11px; height: 11px; transform: translateX(-50%);
  background: radial-gradient(circle at 35% 35%, #d9c9a8, #8a6a48 70%); border-radius: 50%; box-shadow: 0 2px 3px rgba(60,45,30,.4); }
.f-wood .ph { border: 3px solid #fdf8ee; }

/* 云朵框 */
.f-cloud .fcard { background: #fff; padding: 13px; border-radius: 46% 46% 40% 40% / 34% 34% 46% 46%; }
.f-cloud .fcard::before, .f-cloud .fcard::after { content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%; background: #fff; top: -12px; }
.f-cloud .fcard::before { left: 12%; } .f-cloud .fcard::after { right: 12%; width: 26px; height: 26px; top: -8px; }
.f-cloud .ph { border-radius: 42% 42% 36% 36% / 30% 30% 40% 40%; border: 2px solid #f4ecdd; }

/* 软糖框 */
.f-candy .fcard { background: linear-gradient(135deg, #f7c8d4, #c9e8d5); padding: 12px; border-radius: 22px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .65); }
.f-candy .ph { border-radius: 16px; }
.f-candy .fcard::after { content: ""; position: absolute; right: -8px; bottom: -8px; width: 24px; height: 24px; z-index: 2;
  background: radial-gradient(circle at 30% 30%, #ff9aa8, #e8556f); border-radius: 50%;
  box-shadow: 0 2px 5px rgba(150, 60, 80, .35); }
.f-candy .fcard::before { content: ""; position: absolute; right: -3.5px; bottom: -3.5px; width: 15px; height: 15px; z-index: 3; background: #fff; border-radius: 50%; opacity: .85; }

/* 藤编框 */
.f-rattan .fcard { padding: 11px; border-radius: 18px;
  background: repeating-linear-gradient(45deg, #c9a36f 0 7px, #b98d5f 7px 14px);
  box-shadow: inset 0 0 0 2px #8a6a48; }
.f-rattan .fcard::before, .f-rattan .fcard::after { content: ""; position: absolute; top: -9px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d9c9a8, #8a6a48 70%); box-shadow: 0 2px 3px rgba(60,45,30,.4); }
.f-rattan .fcard::before { left: 16px; } .f-rattan .fcard::after { right: 16px; }
.f-rattan .ph { border-radius: 12px; border: 4px solid #fdf8ee; }

/* 小木夹 */
.f-clip .fcard { background: #fff; padding: 7px; border-radius: 3px; border: 1px solid #eee4d0; }
.f-clip .fcard::before { content: ""; position: absolute; top: -21px; left: 50%; transform: translateX(-50%);
  width: 13px; height: 26px; border-radius: 7px; background: linear-gradient(180deg, #d9a76a, #b98455);
  box-shadow: inset 0 -8px 0 #a17a4d, 0 2px 4px rgba(60,45,30,.35); z-index: 3; }
.f-clip .ph { border-radius: 2px; }

/* ---------- 墙面装饰 ---------- */
.deco-group { position: absolute; z-index: 6; pointer-events: none; opacity: 0; transition: opacity 1s; }
.twinkle circle, .twinkle path { animation: twk 2.8s ease-in-out infinite; }
@keyframes twk { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.twinkle circle:nth-child(3n) { animation-delay: .9s; } .twinkle circle:nth-child(3n+1) { animation-delay: 1.7s; }
.deco-group .bounce { animation: dbo 2.4s ease-in-out infinite; }
@keyframes dbo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.deco-group .spin { animation: dsp 9s linear infinite; transform-origin: 50% 60%; }
@keyframes dsp { to { transform: rotate(360deg); } }
svg.star-dot { animation-name: twk; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.bf-w { transform-box: view-box; }
body.lb-open .deco-group * { animation-play-state: paused; }

/* ---------- 顶栏 ---------- */
#topbar { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); z-index: 60; display: flex; flex-direction: column; gap: 12px; }
#topbar button { width: 50px; height: 50px; border-radius: 50%; background: var(--cream);
  box-shadow: 0 4px 12px rgba(105, 85, 60, .25), inset 0 -3px 0 rgba(105, 85, 60, .08);
  display: grid; place-items: center; transition: transform .18s, box-shadow .18s; border: 1.5px solid rgba(183, 138, 94, .25); }
#topbar button:hover { transform: translateY(-3px) scale(1.06); }
#topbar button:active { transform: scale(.92); }
#btnUpload { background: linear-gradient(160deg, #fff, #ffe8ef); border-color: rgba(232, 115, 143, .35); }
body.dragging::before { content: "松手，把照片挂上墙~"; position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(253, 248, 238, .8); backdrop-filter: blur(6px); font-size: 22px; color: var(--pink); border: 4px dashed var(--pink-2); }

/* ---------- 空墙引导 ---------- */
#emptyState { display: none; position: fixed; inset: 0; z-index: 40; place-items: center; pointer-events: none; }
body.empty #emptyState { display: grid; }
.empty-card { pointer-events: auto; background: var(--cream); border: 3px dashed #e3d5bd; border-radius: 26px;
  padding: 34px 44px 30px; text-align: center; box-shadow: 0 18px 40px rgba(105, 85, 60, .18); animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.empty-card h2 { margin: 10px 0 6px; font-size: 22px; }
.empty-card p { margin: 0 0 18px; color: var(--ink-2); line-height: 1.7; font-size: 14px; }
.empty-go { background: linear-gradient(160deg, #e8738f, #e05c7c); color: #fff; padding: 12px 26px; border-radius: 40px; font-size: 16px;
  box-shadow: 0 6px 16px rgba(232, 115, 143, .4); transition: transform .18s; }
.empty-go:hover { transform: translateY(-2px) scale(1.04); }
.empty-spark { animation: twk 2.2s ease-in-out infinite; }

/* ---------- 丝带小地图 ---------- */
#ribbon { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: rgba(253, 248, 238, .92); backdrop-filter: blur(8px); border-radius: 40px; padding: 7px 14px;
  box-shadow: 0 6px 18px rgba(105, 85, 60, .22); border: 1.5px solid rgba(183, 138, 94, .2); max-width: calc(100vw - 20px); }
.ribbon-inner { position: relative; display: flex; gap: 4px; }
#ribbon .ricon { display: grid; place-items: center; height: 24px; }
#ribbon .rwave { position: absolute; left: 22px; right: 22px; top: 50%; height: 10px; transform: translateY(-50%);
  background: radial-gradient(circle at 5px 50%, #e8cfa0 4.5px, transparent 5px) repeat-x; background-size: 26px 10px; opacity: .8; pointer-events: none; }
#ribbon .rbtn { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 9px; border-radius: 14px; min-width: 52px; transition: background .2s, transform .2s; }
#ribbon .rbtn:hover { background: #f4ead6; transform: translateY(-2px); }
#ribbon .rbtn .rname { font-size: 10px; color: var(--ink-2); }
#ribbon .rbtn.cur { background: linear-gradient(160deg, #fff, #fdf0f4); }
#ribbon .rbtn.cur .rname { color: var(--pink); font-weight: 600; }
#ribbon .rticks { position: absolute; top: 4px; left: 0; right: 0; height: 3px; pointer-events: none; }
#ribbon .rticks i { position: absolute; top: 0; width: 2.5px; height: 3px; background: var(--pink-2); border-radius: 2px; }
#ribbon .rtick { position: absolute; top: 6px; width: 2.5px; height: 3px; background: var(--pink-2); border-radius: 2px; }
#ribbon .rpos { position: absolute; bottom: 3px; left: 0; width: 18px; height: 18px; color: var(--pink);
  transform: rotate(-12deg); transition: left .5s ease; filter: drop-shadow(0 2px 3px rgba(232,115,143,.4)); }

/* ---------- 事件层 ---------- */
#fxCanvas { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#eventsLayer { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.sprite { position: absolute; will-change: transform; }
.sprite svg { overflow: visible; }

/* 小火车 */
.sprite.train { left: -420px; bottom: 96px; animation: crossL 26s linear forwards; }
.sprite.train.dir-back { animation-name: crossR; }
@keyframes crossL { to { transform: translateX(calc(100vw + 860px)); } }
@keyframes crossR { to { transform: translateX(calc(100vw + 860px)); } }
.tr-body { display: flex; align-items: flex-end; gap: 6px; }
.tr-loco { position: relative; width: 92px; height: 54px; }
.tr-loco .boiler { position: absolute; left: 0; bottom: 0; width: 56px; height: 38px; border-radius: 12px 12px 6px 6px;
  background: linear-gradient(160deg, #f2a38f, #e0785c); box-shadow: inset 0 -6px 0 rgba(120, 60, 45, .25); }
.tr-loco .cab { position: absolute; right: 0; bottom: 0; width: 34px; height: 50px; border-radius: 8px;
  background: linear-gradient(160deg, #f6c66a, #e2a04c); box-shadow: inset 0 -6px 0 rgba(140, 90, 40, .3); }
.tr-loco .cab::before { content: ""; position: absolute; inset: 7px 6px 14px; background: #fdf6ea; border-radius: 4px; }
.tr-loco .chim { position: absolute; left: 10px; bottom: 34px; width: 12px; height: 16px; background: #8a6a48; border-radius: 3px 3px 0 0; }
.tr-loco .smoke { position: absolute; left: 2px; bottom: 44px; width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, .75); animation: puff 1.6s ease-out infinite; }
.tr-loco .smoke:nth-child(2) { animation-delay: .55s; } .tr-loco .smoke:nth-child(3) { animation-delay: 1.1s; }
@keyframes puff { from { transform: translateY(0) scale(.6); opacity: .8; } to { transform: translateY(-46px) scale(2.2); opacity: 0; } }
.tr-wheel { position: absolute; bottom: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fdf6ea, #b78a5e 65%); animation: roll .8s linear infinite; }
.tr-wheel::after { content: ""; position: absolute; inset: 7.5px; background: #8a6a48; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
@keyframes roll { to { transform: rotate(360deg); } }
.tr-wagon { position: relative; width: 72px; height: 40px; border-radius: 8px;
  background: linear-gradient(160deg, #9ad0e8, #7fb6d4); box-shadow: inset 0 -5px 0 rgba(50, 90, 120, .25); }
.tr-wagon:nth-of-type(2) { background: linear-gradient(160deg, #f4a9bd, #e88ba6); }
.tr-wagon:nth-of-type(3) { background: linear-gradient(160deg, #c9e8a8, #a5d088); }
.tr-wagon .mini { position: absolute; inset: 3px 4px 10px; border-radius: 5px; background: #fdf6ea; object-fit: cover; }
.tr-wagon .dwheel { position: absolute; bottom: -6px; left: 12px; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fdf6ea, #b78a5e 65%); animation: roll .8s linear infinite; }
.tr-wagon .dwheel.r { left: auto; right: 12px; }

/* 小飞机 */
.sprite.plane { left: -240px; top: 60px; animation: planeX 18s linear forwards; }
@keyframes planeX { to { transform: translateX(calc(100vw + 300px)); } }
.pl-body { animation: bobY 2.6s ease-in-out infinite; }
@keyframes bobY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.pl-banner { position: absolute; right: -14px; top: 24px; transform: translateY(-100%); background: #fff; border-radius: 4px;
  padding: 3px 10px; font-size: 13px; color: #e05c7c; white-space: nowrap; box-shadow: 0 2px 6px rgba(105, 85, 60, .2); }
.pl-banner::after { content: ""; position: absolute; left: -7px; top: 0; border: 6px solid transparent; border-right-color: #fff; border-top: 0; }

/* 热气球 */
.sprite.balloon { left: var(--x, 50%); bottom: 90px; animation: rise 14s ease-in forwards; }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(-110vh); } }
.bl-body { animation: swayR 5s ease-in-out infinite; }
@keyframes swayR { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

/* 小鸟 */
.sprite.bird { left: -60px; top: var(--y, 120px); animation: planeX var(--t, 12s) linear forwards; }
.bird-body { animation: flapPath 3.4s ease-in-out infinite; }
@keyframes flapPath { 0%, 100% { transform: translateY(0) rotate(3deg); } 50% { transform: translateY(-26px) rotate(-6deg); } }
.bird-wing { animation: flapW .28s ease-in-out infinite alternate; transform-origin: 8px 8px; }
@keyframes flapW { from { transform: rotate(18deg); } to { transform: rotate(-32deg); } }

/* 松鼠/企鹅/骆驼/蜗牛 */
.sprite.runner { left: -90px; bottom: 92px; animation: planeX var(--t, 9s) linear forwards; }
.run-bob { animation: bobX .5s ease-in-out infinite alternate; }
@keyframes bobX { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-4px) rotate(2deg); } }
.sprite.snail { left: -70px; bottom: 88px; animation: planeX 46s linear forwards; }

/* 风滚草 */
.sprite.tumble { left: -80px; bottom: 96px; animation: tumbleX 8s linear forwards; }
.tumble-body { animation: roll 1.1s linear infinite; }
@keyframes tumbleX { 0% { transform: translateX(0) translateY(0); } 20% { transform: translateX(20vw) translateY(-52px); } 40% { transform: translateX(40vw) translateY(0); } 60% { transform: translateX(60vw) translateY(-38px); } 80% { transform: translateX(80vw) translateY(0); } 100% { transform: translateX(calc(100vw + 90px)) translateY(-10px); } }

/* 飞天鲸鱼 */
.sprite.whale { left: -220px; top: var(--y, 120px); animation: planeX 30s linear forwards; opacity: .9; }
.whale-body { animation: bobY 6s ease-in-out infinite; }
.whale-spout { animation: spout 2.8s ease-in-out infinite; }
@keyframes spout { 0%, 100% { opacity: 0; transform: scaleY(.6); } 45% { opacity: .9; } }

/* 流星 / 泡泡 / 风 / 爱心 */
.sprite.meteor { right: -160px; top: var(--y, 80px); animation: shoot 1.4s cubic-bezier(.4, 0, .8, .6) forwards; }
@keyframes shoot { from { transform: translate(0, 0) rotate(18deg); opacity: 1; } to { transform: translate(-60vw, 34vh) rotate(18deg); opacity: 0; } }
.sprite.bubble { left: var(--x, 30%); bottom: 100px; animation: rise 9s linear forwards; }
.sprite.ripple { animation: rip .8s ease-out forwards; }
@keyframes rip { from { transform: scale(.3); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.hearts { position: absolute; z-index: 58; pointer-events: none; }
.hearts i { position: absolute; font-style: normal; color: var(--pink); font-size: 15px; animation: popUp 1.3s ease-out forwards; }
.hearts i:nth-child(2) { animation-delay: .13s; } .hearts i:nth-child(3) { animation-delay: .26s; }
@keyframes popUp { from { transform: translate(0, 0) scale(.5); opacity: 1; } to { transform: translate(var(--dx, 0px), var(--dy, -70px)) scale(1.25); opacity: 0; } }

/* 蝴蝶 */
.sprite.fly { left: -50px; top: var(--y, 180px); animation: planeX var(--t, 14s) ease-in-out forwards; }
.fly-body { animation: flapPath 4s ease-in-out infinite; }
.bf-w { transform-origin: 10px 10px; animation: bfFlap .3s ease-in-out infinite alternate; }
.bf-w.r { animation-name: bfFlapR; }
@keyframes bfFlap { from { transform: rotateY(0); } to { transform: rotateY(68deg); } }
@keyframes bfFlapR { from { transform: rotateY(0); } to { transform: rotateY(-68deg); } }

/* 刮风线 */
.windlines { position: absolute; left: -220px; top: var(--y, 150px); width: 200px; height: 60px; animation: gust 2.2s ease-out forwards; }
.windlines i { position: absolute; left: 0; height: 14px; width: 150px; opacity: 0;
  background: radial-gradient(ellipse 60px 7px at 50% 50%, rgba(255, 255, 255, .9), transparent 70%); }
.windlines i:nth-child(1) { top: 0; animation: wl 2s ease-out .1s forwards; }
.windlines i:nth-child(2) { top: 24px; width: 110px; animation: wl 1.7s ease-out .35s forwards; }
.windlines i:nth-child(3) { top: 48px; width: 130px; animation: wl 1.9s ease-out .6s forwards; }
@keyframes wl { from { transform: translateX(0) scaleX(.4); opacity: 0; } 30% { opacity: .9; } to { transform: translateX(60vw) scaleX(1.6); opacity: 0; } }
@keyframes gust { to { transform: translateX(120vw); } }

/* ---------- 上传面板 ---------- */
#uploadPanel { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -130%); z-index: 70;
  background: var(--cream); border-radius: 18px; padding: 14px 16px; width: min(400px, calc(100vw - 28px));
  box-shadow: 0 16px 40px rgba(105, 85, 60, .3); transition: transform .4s cubic-bezier(.2, 1.4, .4, 1); border: 1.5px solid rgba(183, 138, 94, .2); }
#uploadPanel.show { transform: translate(-50%, 0); }
.up-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.up-title { font-weight: 700; color: var(--pink); }
.up-count { font-size: 12px; color: var(--ink-2); }
.up-list { max-height: 44vh; overflow: auto; display: flex; flex-direction: column; gap: 7px; scrollbar-width: thin; }
.up-row { display: grid; grid-template-columns: 1fr 84px 58px; align-items: center; gap: 8px; font-size: 12.5px; }
.up-row .up-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.up-bar { height: 7px; background: #eee1c8; border-radius: 4px; overflow: hidden; }
.up-bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), #6db98a); border-radius: 4px; transition: width .3s; }
.up-row .up-st { text-align: right; color: var(--ink-2); font-size: 11.5px; }
.up-row.done .up-bar div { background: var(--mint); }
.up-row.fail .up-st { color: #d95c6a; }

/* ---------- 灯箱 ---------- */
#lightbox { position: fixed; inset: 0; z-index: 80; display: none; }
#lightbox.show { display: block; }
.lb-veil { position: absolute; inset: 0; background: rgba(30, 24, 18, .82); backdrop-filter: blur(10px); animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; } }
.lb-media { position: absolute; inset: 0 0 0 0; right: 0; display: grid; place-items: center; }
body.has-panel .lb-media { right: 348px; }
.lb-x { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; background: rgba(253, 248, 238, .92); color: var(--ink); font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3); transition: transform .18s; }
.lb-x:hover { transform: rotate(90deg); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(253, 248, 238, .92); font-size: 30px; line-height: 1; color: var(--ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); transition: transform .18s; }
.lb-nav:hover { transform: translateY(-50%) scale(1.1); }
.lb-prev { left: calc(14px + env(safe-area-inset-left)); }
.lb-next { right: calc(14px + env(safe-area-inset-right)); }
body.has-panel .lb-next { right: 360px; }

.lb-prog { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, 60vw); display: none; text-align: center; }
.lb-prog.show { display: block; }
.lb-prog-bar { height: 8px; background: rgba(255, 255, 255, .22); border-radius: 5px; overflow: hidden; }
.lb-prog-bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink-2), var(--pink)); border-radius: 5px; transition: width .25s; }
.lb-prog-txt { margin-top: 10px; color: #f4e9d8; font-size: 13px; }

/* 照片缩放 */
.ph-zoom { position: relative; width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.ph-zoom img { max-width: 88%; max-height: 88%; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  cursor: grab; transition: box-shadow .3s; }
.ph-zoom img:active { cursor: grabbing; }
.ph-err { color: #d8c8b8; font-size: 15px; }
.ph-zoombtns { position: absolute; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; z-index: 4; }
.ph-zoombtns button { width: 44px; height: 44px; border-radius: 50%; background: rgba(253, 248, 238, .94); color: var(--ink);
  font-size: 17px; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); transition: transform .15s; }
.ph-zoombtns button:hover { transform: scale(1.1); }

/* 视频播放器 */
.v-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; padding: 16px; }
.v-stage { position: relative; max-width: 100%; max-height: calc(100% - 70px); border-radius: 10px; overflow: hidden; background: #000;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6); }
.v-stage video { max-width: min(92vw, 1200px); max-height: 100%; display: block; }
.v-bigplay { position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; background: rgba(0, 0, 0, .08); transition: opacity .2s; }
.v-bigplay:hover svg { transform: scale(1.08); }
.v-bigplay svg { transition: transform .2s; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .35)); }
.v-spin { position: absolute; inset: 0; display: none; place-items: center; }
.v-spin::after { content: ""; width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: roll .9s linear infinite; }
.v-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 42px;
  background: rgba(38, 30, 24, .86); backdrop-filter: blur(10px); color: #f4e9d8; max-width: calc(100vw - 32px); flex-wrap: nowrap; }
.v-bar button { color: #f4e9d8; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; transition: background .2s, transform .15s; }
.v-bar button:hover { background: rgba(255, 255, 255, .14); transform: scale(1.06); }
.v-bar button.on { color: #f4a9bd; }
.vb-cur, .vb-dur { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; }
.vb-track { position: relative; flex: 1; min-width: 130px; height: 22px; display: flex; align-items: center; cursor: pointer; }
.vb-track .vb-buf, .vb-track .vb-fill { position: absolute; left: 0; top: 9.5px; height: 4.5px; border-radius: 3px; width: 0; }
.vb-buf { background: rgba(255, 255, 255, .22); }
.vb-fill { background: linear-gradient(90deg, var(--pink-2), var(--pink)); }
.vb-track input { position: relative; z-index: 2; width: 100%; height: 22px; margin: 0; -webkit-appearance: none; background: transparent; cursor: pointer; }
.vb-track input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.vb-track input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.vb-mute.muted { color: #d97f8f; }
.vb-vol { width: 68px; height: 20px; -webkit-appearance: none; background: transparent; cursor: pointer; }
.vb-vol::-webkit-slider-runnable-track { height: 4.5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.vb-vol::-webkit-slider-thumb { -webkit-appearance: none; margin-top: -5px; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.vb-vol::-moz-range-track { height: 4.5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.vb-rate { background: rgba(255, 255, 255, .12); color: #f4e9d8; border: 0; border-radius: 14px; padding: 5px 4px; font-size: 12.5px; cursor: pointer; }
.vb-rate option { color: #333; }

/* 元信息面板 */
.lb-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 348px; background: var(--cream); box-shadow: -14px 0 40px rgba(0, 0, 0, .25);
  padding: 22px 22px 18px; overflow-y: auto; transform: translateX(105%); transition: transform .38s cubic-bezier(.2, 1.2, .4, 1); z-index: 4; }
body.has-panel .lb-panel { transform: translateX(0); }
.lb-ptype { font-size: 12px; color: var(--ink-2); margin-bottom: 14px; letter-spacing: .5px; }
.lb-flds { display: flex; flex-direction: column; gap: 13px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.fld input[type="date"], .fld input[type="text"], .fld textarea { border: 1.5px solid #e3d5bd; border-radius: 12px; padding: 9px 12px;
  background: #fff; outline: none; transition: border-color .2s; }
.fld input:focus, .fld textarea:focus { border-color: var(--pink-2); }
.fld textarea { resize: vertical; min-height: 66px; }
.fld-row { flex-direction: row; align-items: center; gap: 10px; }
.lb-fav { border: 1.5px solid #e3d5bd; border-radius: 30px; padding: 8px 14px; background: #fff; font-size: 13px; color: var(--ink-2); transition: all .2s; }
.lb-fav.on { background: #fdeef2; border-color: var(--pink); color: var(--pink); }
.lb-frame { flex: 1; border: 1.5px solid #e3d5bd; border-radius: 12px; padding: 8px 10px; background: #fff; outline: none; }
.lb-actions { display: flex; gap: 10px; margin-top: 20px; }
.lb-actions button { flex: 1; border-radius: 30px; padding: 11px 0; font-size: 14px; transition: transform .15s, box-shadow .15s; }
.lb-actions button:hover { transform: translateY(-2px); }
.lb-save { background: linear-gradient(160deg, #e8738f, #e05c7c); color: #fff; box-shadow: 0 5px 14px rgba(232, 115, 143, .35); }
.lb-dl { background: #fff; border: 1.5px solid #e3d5bd; }
.lb-del { background: #fff; border: 1.5px solid #f0c9cf; color: #d95c6a; }

/* ---------- 锁屏 ---------- */
#lock { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: linear-gradient(160deg, #fdf3e3, #f9e2d0); }
#lock::before { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(232, 115, 143, .1) 2px, transparent 2.6px); background-size: 34px 34px; }
.lock-card { position: relative; z-index: 1; background: var(--cream); border-radius: 28px; padding: 34px 40px 30px; width: min(400px, calc(100vw - 36px));
  box-shadow: 0 24px 60px rgba(150, 105, 70, .25), inset 0 -6px 0 rgba(183, 138, 94, .1); text-align: center;
  animation: pop .55s cubic-bezier(.2, 1.5, .4, 1) both; }
.lock-card.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.lock-art { animation: bobY 4s ease-in-out infinite; }
.lock-title { margin: 6px 0 4px; font-size: 21px; }
.lock-sub { margin: 0 0 18px; color: var(--ink-2); font-size: 13.5px; }
.lk-fld { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-bottom: 12px; text-align: left; font-size: 12.5px; color: var(--ink-2); }
.lk-fld input { width: 100%; border: 1.5px solid #e3d5bd; border-radius: 14px; padding: 11px 14px; background: #fff; outline: none; font-size: 15px; letter-spacing: .22em; }
.lk-fld input:focus { border-color: var(--pink-2); box-shadow: 0 0 0 3px rgba(244, 169, 189, .25); }
.lk-warn { font-size: 11.5px; color: #b08a3c; background: #fdf4dd; border-radius: 10px; padding: 8px 10px; line-height: 1.6; margin: 2px 0 10px; text-align: left; }
.lk-warn b { color: #c96a1e; }
.lk-go { width: 100%; background: linear-gradient(160deg, #e8738f, #e05c7c); color: #fff; border-radius: 40px; padding: 13px 0; font-size: 16.5px;
  box-shadow: 0 8px 20px rgba(232, 115, 143, .4); transition: transform .18s, filter .18s; }
.lk-go:hover { transform: translateY(-2px); filter: brightness(1.05); }
.lk-go:disabled { opacity: .7; cursor: wait; }
.lk-err { min-height: 20px; margin: 10px 0 0; color: #d95c6a; font-size: 12.5px; }
.lk-err.shake { animation: shake .45s; }
.lock-key { animation: bobY 2.6s ease-in-out infinite; transform-origin: 160px 60px; }

/* ---------- 设置 ---------- */
#settings { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; }
.st-veil { position: absolute; inset: 0; background: rgba(30, 24, 18, .5); backdrop-filter: blur(6px); animation: fadeIn .25s; }
.st-card { position: relative; z-index: 1; background: var(--cream); border-radius: 24px; width: min(430px, calc(100vw - 30px));
  max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px 24px; box-shadow: 0 22px 60px rgba(0, 0, 0, .35);
  animation: pop .45s cubic-bezier(.2, 1.5, .4, 1) both; }
.st-card h3 { margin: 0 0 14px; font-size: 19px; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 14px; border-bottom: 1px dashed #eee1c8; }
.st-row small { color: var(--ink-2); font-size: 11px; }
.st-row input[type="text"] { border: 1.5px solid #e3d5bd; border-radius: 10px; padding: 7px 10px; background: #fff; outline: none; width: 60%; }
.st-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--pink); }
.st-usage { text-align: right; flex: 1; }
.st-usage-bar { height: 8px; background: #eee1c8; border-radius: 5px; overflow: hidden; margin-bottom: 4px; }
.st-usage-bar div { height: 100%; background: linear-gradient(90deg, var(--mint), #6db98a); border-radius: 5px; }
.st-usage small { font-size: 11px; color: var(--ink-2); }
.st-sec { margin: 14px 0 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; letter-spacing: 1px; }
.st-col { flex-direction: column; align-items: stretch; }
.st-col input { border: 1.5px solid #e3d5bd; border-radius: 10px; padding: 8px 12px; background: #fff; outline: none; margin-bottom: 7px; }
.st-mini { background: linear-gradient(160deg, #e8738f, #e05c7c); color: #fff; border-radius: 26px; padding: 9px; font-size: 13px; }
.st-btns { gap: 10px; }
.st-btns button { flex: 1; background: #fff; border: 1.5px solid #e3d5bd; border-radius: 26px; padding: 10px 0; font-size: 13.5px; transition: all .15s; }
.st-btns button:hover { border-color: var(--pink-2); color: var(--pink); }
.st-foot { margin-top: 14px; font-size: 11px; color: var(--ink-2); line-height: 1.7; }

/* ---------- 提示与对话框 ---------- */
.bw-toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 95;
  background: rgba(52, 42, 34, .92); color: #f4e9d8; padding: 11px 22px; border-radius: 30px; font-size: 13.5px;
  opacity: 0; transition: all .35s; pointer-events: none; max-width: 86vw; text-align: center; }
.bw-toast.show { opacity: 1; transform: translate(-50%, 0); }
.bw-dialog { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; }
.bw-dialog.show { display: grid; }
.bw-dialog .bw-dlg-card { position: relative; z-index: 1; background: var(--cream); border-radius: 20px; padding: 24px 26px 18px;
  width: min(380px, calc(100vw - 40px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: pop .4s cubic-bezier(.2, 1.5, .4, 1) both; }
.bw-dialog::before { content: ""; position: absolute; inset: 0; background: rgba(30, 24, 18, .45); backdrop-filter: blur(4px); }
.bw-dlg-card p { margin: 0 0 16px; font-size: 14px; line-height: 1.7; }
.bw-dlg-card div { display: flex; gap: 10px; }
.bw-dlg-card button { flex: 1; border-radius: 26px; padding: 10px 0; font-size: 14px; }
.d-cancel { background: #fff; border: 1.5px solid #e3d5bd; }
.d-ok { background: linear-gradient(160deg, #e8738f, #e05c7c); color: #fff; }

.fatal { position: fixed; inset: 0; display: grid; place-items: center; background: #f9e2d0; }
.fatal-card { background: var(--cream); border-radius: 20px; padding: 30px; text-align: center; box-shadow: 0 16px 40px rgba(150, 105, 70, .2); }
.fatal-card p { color: var(--ink-2); line-height: 1.7; max-width: 300px; }

/* ---------- 移动端 ---------- */
@media (max-width: 760px) {
  #topbar { top: auto; bottom: calc(78px + env(safe-area-inset-bottom)); right: calc(12px + env(safe-area-inset-right)); }
  #topbar button { width: 46px; height: 46px; }
  .lb-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 46vh; border-radius: 22px 22px 0 0;
    transform: translateY(105%); padding: 16px 18px 22px; }
  body.has-panel .lb-panel { transform: translateY(0); }
  body.has-panel .lb-media { right: 0; bottom: 46vh; }
  .lb-nav { display: none; }
  .lb-next, .lb-prev { display: none; }
  body.has-panel .lb-next { right: 14px; }
  .v-bar { flex-wrap: wrap; justify-content: center; border-radius: 24px; padding: 8px 12px; }
  .v-stage video { max-width: 96vw; }
  .plaque { display: none; }
  .f-polaroid .ptext { display: block; }
  .lb-prog { top: 42%; }
  .empty-card { padding: 24px 22px; }
  .lock-card { padding: 26px 24px 24px; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; }
  .sway { animation: none !important; }
  #eventsLayer, #fxCanvas { display: none !important; }
}
