:root {
  --desk: #e8e0d3;
  --paper: #f6f0e4;
  --ink: #2a231c;
  --ink-2: #6f6253;
  --muted: #9a8b78;
  --red: #b8322a;
  --kraft: #d9ae72;
  /* 思源宋体（SC Serif）与朝华打字机（ZH Typewriter）由 /fonts/fonts.css 提供 */
  --serif: "SC Serif", "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  --typewriter: "ZH Typewriter", var(--serif);
  --hand: var(--serif);
  --type: var(--serif);
  --sans: var(--serif);
  --ts-font: var(--typewriter);
  --zt-font: var(--serif);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --wood: repeating-linear-gradient(90deg, rgba(60,30,10,.09) 0 1px, transparent 1px 7px), repeating-linear-gradient(90deg, rgba(255,232,196,.07) 0 3px, transparent 3px 26px), linear-gradient(#c48c55, #a56d3b);
  --wood-in: repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 1px, transparent 1px 9px), linear-gradient(#2f1e10, #553820 70%, #5e3f25);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--desk); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
/* 像 App 一样：文档本身不滚动（没有下拉刷新、没有橡皮筋、地址栏伸缩也不带动元素），只在 .app 内部滚动 */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, .ts-text { -webkit-user-select: text; user-select: text; }
body { background-image: var(--grain); min-height: 100%; transition: background-color .8s; }
body[data-light="night"] { background-color: #0e0b09; }
body[data-light="dawn"] { background-color: #2e3446; }
body[data-light="dusk"] { background-color: #4a2c20; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* 手机优先；PC 上居中成一个手机宽度的窗口 */
.app { position: fixed; inset: 0; max-width: 520px; margin: 0 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 640px) {
  body, body[data-light] { background-color: #241e19; }
  .app { box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 30px 80px rgba(0,0,0,.5); overflow: hidden; }
}

.btn-ink {
  appearance: none; border: 0; border-radius: 999px; padding: 12px 22px; min-height: 44px;
  background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 15px; letter-spacing: .08em; cursor: pointer;
}
.btn-ink:active { transform: translateY(1px); }

/* ---------- 随箱字条 ---------- */
.note-stage { min-height: 100%; display: grid; place-items: center; padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); background: var(--desk) var(--grain); }
.app.under-box .note-card { opacity: 0; transform: translateY(40px) rotate(-1deg) scale(.96); }
.note-card {
  position: relative; width: min(100%, 420px); padding: 38px 28px 28px; background: #fbf7ee var(--grain);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 18px 40px -12px rgba(60,40,20,.35);
  transform: rotate(-1deg); transition: transform .9s cubic-bezier(.2,.9,.25,1) .25s, opacity .7s .25s; font-family: var(--serif);
}
.note-card.is-leaving { transition: transform .38s ease-in, opacity .38s; transform: translateY(-30px) rotate(-3deg); opacity: 0; }
.tape { position: absolute; top: -12px; width: 86px; height: 26px; background: rgba(240,228,200,.75); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tape.tl { left: 18px; transform: rotate(-6deg); }
.tape.tr { right: 18px; transform: rotate(5deg); }
.note-title { margin: 0 0 18px; font-size: 12px; letter-spacing: .4em; color: var(--muted); }
.note-body { white-space: pre-wrap; font-size: 17px; line-height: 1.95; }
.note-sign { margin: 22px 0 26px; text-align: right; color: var(--ink-2); font-size: 15px; }
.note-go { display: block; margin-left: auto; }

/* ================= 房间 · 胶卷收纳盒 ================= */
.room { position: relative; min-height: 100%; padding: calc(14px + env(safe-area-inset-top)) 12px calc(30px + env(safe-area-inset-bottom)); overflow: hidden;
  --wall-ink: var(--ink); --wall-ink-2: var(--ink-2); transition: background .8s; background: var(--desk) var(--grain); }
.room[data-light="night"] { background: radial-gradient(ellipse 95% 55% at 50% 48%, #3b2a1c 0%, #1a130e 55%, #0c0907 100%); --wall-ink: #eadfcd; --wall-ink-2: #a8977f; }
.room[data-light="dawn"] { background: radial-gradient(ellipse 100% 60% at 50% 30%, #8390ab 0%, #4a5268 50%, #262b39 100%); --wall-ink: #eef0f6; --wall-ink-2: #c0c6d6; }
.room[data-light="dusk"] { background: radial-gradient(ellipse 100% 60% at 50% 25%, #e0a26e 0%, #9c5a3a 50%, #43271c 100%); --wall-ink: #fff1e1; --wall-ink-2: #f0c9a6; }
.lamp { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s; background: radial-gradient(ellipse 70% 38% at 50% 50%, rgba(255,205,140,.22), rgba(255,205,140,0) 70%); }
.room[data-light="night"] .lamp { opacity: 1; }

.wall { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 6px 0; color: var(--wall-ink); }
.aclock { margin: 0; display: grid; justify-items: center; gap: 6px; }
.clock-face { width: min(86px, 23vw); height: auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); }
.clock-face .rim { fill: #2a221b; }
.clock-face .face { fill: #f4eee2; }
.clock-face .ticks line { stroke: #2a221b; }
.clock-face .hand-h { stroke: #1d1814; stroke-width: 4; stroke-linecap: round; }
.clock-face .hand-m { stroke: #1d1814; stroke-width: 2.6; stroke-linecap: round; }
.clock-face .hand-s { stroke: var(--red); stroke-width: 1.2; stroke-linecap: round; }
.clock-face .pin { fill: var(--red); }
.room[data-light="night"] .clock-face .face { fill: #cfc4b0; }
.aclock figcaption { display: grid; justify-items: center; gap: 1px; font-variant-numeric: tabular-nums; }
.aclock figcaption b { font: 600 14px/1.2 var(--serif); letter-spacing: .3em; padding-left: .3em; }
.aclock figcaption span { font: 13px var(--type); }
.aclock figcaption small { font-size: 11px; color: var(--wall-ink-2); }
.tzgap { display: grid; justify-items: center; gap: 4px; font: 12px var(--type); color: var(--wall-ink-2); margin-top: -34px; }
.tzgap i { width: 46px; height: 1px; background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px); }

.tape-note {
  position: relative; width: fit-content; max-width: 92%; margin: 18px auto 0; padding: 7px 16px; text-align: center;
  background: rgba(241,232,207,.93); color: #2b241d; font: 15px/1.5 var(--hand); transform: rotate(-1.2deg);
  clip-path: polygon(0 4%, 3% 0, 97% 2%, 100% 0, 99% 50%, 100% 100%, 96% 97%, 3% 100%, 0 96%, 1% 50%);
  font-variant-numeric: tabular-nums; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* 木盒 */
.crate { position: relative; z-index: 1; margin: 20px 0 0; padding: 12px 12px 30px; border-radius: 8px; background: var(--wood);
  box-shadow: inset 0 1px 0 rgba(255,235,200,.35), inset 0 -3px 0 rgba(0,0,0,.15), 0 24px 40px -14px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.2); transition: filter .8s; }
.room[data-light="night"] .crate { filter: brightness(.86) saturate(.92); }
.room[data-light="dawn"] .crate { filter: brightness(.9) saturate(.8) hue-rotate(-8deg); }
.tier { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--wood-in); border-radius: 3px;
  box-shadow: inset 0 10px 14px rgba(0,0,0,.45), inset 0 -2px 4px rgba(0,0,0,.3); }
.tier + .tier { margin-top: 18px; }
.tier::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: -6px; height: 22px; z-index: 3; border-radius: 2px; background: var(--wood);
  box-shadow: inset 0 2px 0 rgba(255,235,200,.4), 0 3px 4px rgba(0,0,0,.25); pointer-events: none; }
.crate-stamp { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font: 700 9.5px var(--type); letter-spacing: .22em; color: rgba(55,28,8,.5); }

.slot { position: relative; display: block; height: 136px; text-decoration: none; color: inherit; outline: none; }
.slot + .slot { box-shadow: inset 5px 0 0 -1px rgba(0,0,0,.25), inset 6px 0 0 rgba(150,100,58,.55); }
.slot:focus-visible .can, .slot:focus-visible .envelope { outline: 2px solid #ffd27a; outline-offset: 3px; }
.cell { position: absolute; inset: 0; }

.can { position: absolute; left: 50%; bottom: 10px; z-index: 2; width: 48px; height: 86px; margin-left: -24px; transform: rotate(var(--tilt)); transition: transform .28s cubic-bezier(.3,1.4,.5,1); }
.can i, .wrapped i, .envelope i { position: absolute; display: block; font-style: normal; }
.can-bottom { left: 0; right: 0; bottom: 0; height: 11px; border-radius: 50%; background: linear-gradient(90deg, #3a3835, #8a8780 40%, #3e3c39); z-index: 1; }
.can-body { left: 0; right: 0; top: 6px; bottom: 5px; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 14px; gap: 1px;
  background: linear-gradient(90deg, rgba(0,0,0,.42), rgba(255,255,255,.3) 30%, rgba(255,255,255,0) 52%, rgba(0,0,0,.36)), linear-gradient(var(--c1) 0 20%, var(--c2) 20% 80%, var(--c1) 80%); color: var(--c3); }
.can-body b { font: 800 7px/1 "Helvetica Neue", Arial, sans-serif; letter-spacing: .04em; white-space: nowrap; }
.can-body small { font: 700 6.5px/1 "Helvetica Neue", Arial, sans-serif; }
.can-top { left: -1px; right: -1px; top: 0; height: 13px; border-radius: 50%; z-index: 3; background: radial-gradient(ellipse at 50% 38%, #eceae5, #a4a19a 55%, #5b5853); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.can-top::after { content: ""; position: absolute; left: 50%; top: 2px; width: 14px; height: 6px; margin-left: -7px; border-radius: 50%; background: radial-gradient(ellipse at 50% 30%, #f6f5f2, #8c8982); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.can-tape { left: -5px; right: -5px; top: 44%; z-index: 4; padding: 3px 2px 2px; text-align: center; background: rgba(243,236,214,.95); color: #2b241d;
  font: 9px/1.2 var(--hand); transform: rotate(-3deg); box-shadow: 0 1px 1px rgba(0,0,0,.2); white-space: nowrap;
  clip-path: polygon(0 8%, 4% 0, 96% 4%, 100% 0, 98% 50%, 100% 96%, 95% 100%, 5% 96%, 0 100%, 2% 50%); }
.can-dot, .can-star, .can-check { z-index: 5; display: none !important; }
.can-dot { right: -3px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: #d63a2f; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.can-star { right: -6px; top: -4px; color: #e7b931; font-size: 15px; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.can-check { left: 50%; bottom: 11px; margin-left: -6px; color: #2b241d; font: 700 11px var(--hand); }
.slot.is-new .can-dot { display: block !important; }
.slot.is-kept .can-star { display: block !important; }
.slot.is-solved .can-check { display: block !important; }
.slot.lift .can, .slot.lift .envelope { transform: translateY(-20px) rotate(0deg) scale(1.04); }
.slot:not(.is-locked):active .can { transform: translateY(-6px) rotate(var(--tilt)); }

/* 还没寄到：牛皮纸包着，挂着吊牌 */
.wrapped { position: absolute; left: 50%; bottom: 10px; z-index: 2; width: 52px; height: 84px; margin-left: -26px; display: none; border-radius: 9px 9px 5px 5px;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,240,210,.35), transparent 60%), linear-gradient(90deg, rgba(0,0,0,.25), rgba(255,255,255,.12) 35%, rgba(0,0,0,.2)), var(--kraft);
  box-shadow: inset 0 -6px 8px rgba(80,45,15,.25), 0 2px 4px rgba(0,0,0,.3); transform: rotate(-2deg); }
.wrapped::before { content: ""; position: absolute; left: 6px; right: 6px; top: -6px; height: 12px; border-radius: 50% 50% 0 0; background: var(--kraft); clip-path: polygon(0 100%, 10% 20%, 25% 60%, 40% 0, 55% 55%, 70% 10%, 85% 60%, 100% 100%); }
.twine { inset: 0; background: linear-gradient(90deg, transparent calc(50% - 1px), #efe4c7 calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), linear-gradient(transparent 46%, #efe4c7 46% 49%, transparent 49%); opacity: .85; }
.wrapped.env { width: 58px; height: 44px; margin-left: -29px; bottom: 24px; border-radius: 3px; }
.wrapped.env::before { display: none; }
.slot.is-locked .can, .slot.is-locked .envelope { display: none; }
.slot.is-locked .wrapped { display: block; }
.tag { position: absolute; z-index: 4; left: 50%; bottom: -20px; transform: translateX(-50%) rotate(4deg); display: none; padding: 3px 7px 3px 12px; min-width: 52px;
  background: #f3ead6; color: #2b241d; border-radius: 2px 6px 6px 2px; font: 11px/1.15 var(--hand); text-align: center; box-shadow: 0 2px 3px rgba(0,0,0,.3);
  clip-path: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%); font-variant-numeric: tabular-nums; }
.tag::before { content: ""; position: absolute; left: 6px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: #7a5a3a; }
.tag b { display: block; font-weight: 400; font-size: 12px; }
.tag small { display: block; font-size: 9.5px; color: #6f6253; }
.slot.is-locked .tag { display: block; }
.slot.nudge .wrapped, .slot.nudge .tag { animation: wiggle .45s; }
@keyframes wiggle { 25% { translate: -3px 0; } 50% { translate: 3px 0; } 75% { translate: -2px 0; } }

/* 生日信封 */
.envelope { position: absolute; left: 50%; bottom: 22px; z-index: 2; width: 60px; height: 42px; margin-left: -30px; transform: rotate(-5deg); transition: transform .28s;
  background: linear-gradient(160deg, #fbf7ef, #e9e1d2); border-radius: 2px; box-shadow: 0 3px 6px rgba(0,0,0,.35); }
.envelope .flap { left: 0; right: 0; top: 0; height: 24px; background: linear-gradient(#efe7d8, #e2d8c6); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.envelope .seal { left: 50%; top: 13px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #c9443a, #8e1f1a); color: #f3c9b9; font-size: 10px; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* 礼物夹：牛皮纸文件夹 */
.folder { position: relative; z-index: 1; display: block; width: min(86%, 360px); margin: 34px auto 0; padding-top: 18px; text-decoration: none; color: #2b241d; transform: rotate(.8deg); }
.folder-tab { position: absolute; left: 14px; top: 0; height: 24px; padding: 3px 14px 0; border-radius: 6px 6px 0 0; background: #c99a5e; font: 13px var(--hand); }
.folder-body { display: grid; gap: 2px; padding: 16px 18px; border-radius: 2px 6px 6px 6px; background: radial-gradient(ellipse at 20% 0%, rgba(255,240,210,.35), transparent 60%), #d4a96d var(--grain);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,240,210,.4); }
.folder-body b { font: 600 20px var(--type); }
.folder-body small { font: 12px var(--hand); color: #5b4630; }

/* ================= 胶卷 + 打字机 ================= */
.roll { position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--desk) var(--grain); transition: background .8s; --bar-ink: var(--ink); --bar-ink-2: var(--muted); }
.roll[data-light="night"] { background: #0e0b09; --bar-ink: #e6dccb; --bar-ink-2: #8c7f6d; }
.roll[data-light="dawn"] { background: linear-gradient(#2b3142, #4a5167); --bar-ink: #eef0f6; --bar-ink-2: #aab2c6; }
.roll[data-light="dusk"] { background: linear-gradient(#3a2219, #7c4a31); --bar-ink: #fff0de; --bar-ink-2: #e7bf9b; }
.bar { position: relative; z-index: 4; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: calc(6px + env(safe-area-inset-top)) 8px 4px; color: var(--bar-ink, var(--ink)); }
.back { display: grid; place-items: center; width: 44px; height: 44px; font-size: 30px; line-height: 1; text-decoration: none; color: inherit; }
.bar-title { text-align: center; display: grid; gap: 3px; min-width: 0; }
.bar-title b { font: 600 16px/1.2 var(--serif); letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title small { font: 10px var(--type); letter-spacing: .06em; color: var(--bar-ink-2, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snd { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.snd::before { content: ""; width: 20px; height: 20px; background: var(--bar-ink-2); -webkit-mask: var(--snd-icon) center/contain no-repeat; mask: var(--snd-icon) center/contain no-repeat;
  --snd-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3 7h3l4-3v12l-4-3H3z'/%3E%3Cpath d='M13 7a4 4 0 010 6M15 5a7 7 0 010 10' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); }
.snd[aria-pressed="false"]::before { opacity: .5;
  --snd-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3 7h3l4-3v12l-4-3H3z'/%3E%3Cpath d='M13 8l4 4M17 8l-4 4' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* 胶片压在稿纸上 */
.film-wrap { position: relative; z-index: 3; margin: 2px -14px -34px; transform: rotate(-1.2deg); filter: drop-shadow(0 12px 10px rgba(20,12,5,.35)) drop-shadow(0 2px 2px rgba(20,12,5,.25)); }
.film-wrap .fs { --fs-h: clamp(130px, min(26dvh, calc((100vw - 72px) / 1.5)), 270px); }
.tail-q { display: grid; justify-items: center; gap: 6px; font-family: var(--serif); }
.tail-q b { font: 400 52px/1 var(--type); }
.tail-q small { font-size: 12px; letter-spacing: .3em; opacity: .8; }
.machine { position: relative; z-index: 1; flex: 1; min-height: 280px; margin-bottom: env(safe-area-inset-bottom); }
.machine > .ts { position: absolute; inset: 0; }

.film-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .film-nav { display: flex; position: absolute; left: 0; right: 0; top: calc(56px + clamp(130px, 26dvh, 270px) * .62); justify-content: space-between; padding: 0 6px; pointer-events: none; z-index: 5; }
  .film-nav button { pointer-events: auto; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(246,240,228,.9); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer; font-size: 20px; }
}

/* 纸上的谜题与按键 */
.quiz { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; width: 100%; max-width: 100%; }
.opt { display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 44px; padding: 6px 4px; text-align: left; border: 0; border-bottom: 1px dashed rgba(35,29,23,.22);
  background: none; font: 17px/1.6 var(--typewriter); color: #231d17; cursor: pointer; }
.opt span { font: 13px var(--type); color: rgba(35,29,23,.5); }
.opt:active { background: rgba(35,29,23,.05); }
.opt:disabled { opacity: .35; text-decoration: line-through; }
.ans { display: flex; align-items: baseline; gap: 8px; min-width: 0; max-width: 100%; font: 17px var(--typewriter); }
.ans span { flex: none; }
.ans input { flex: 1 1 0; width: 0; min-width: 0; -webkit-appearance: none; appearance: none; border: 0; border-bottom: 1.5px solid #231d17; background: transparent; font: 18px var(--typewriter); padding: 6px 2px; outline: none; border-radius: 0; color: #231d17; }
.key { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 10px; padding: 8px 20px; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: radial-gradient(circle at 50% 30%, #3a3631, #1b1916); color: #f1ebdf; font: 14px var(--serif); letter-spacing: .12em; box-shadow: 0 3px 0 #0b0a09, 0 5px 8px rgba(0,0,0,.3); }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b0a09; }
.quiz .key { justify-self: end; }
.nope { animation: wiggle .4s; }
.receipt-end { display: grid; justify-items: center; }
.letter-sign { text-align: right; color: #6f6253; margin: 1.6em 0 0; font-family: var(--typewriter); }
.letter-sign small { font: 11px var(--type); letter-spacing: .1em; }

/* 红章 */
.stamp {
  display: inline-grid; justify-items: center; gap: 2px; margin: 4px 0 6px 40%; padding: 8px 14px; border: 2.5px solid var(--red); border-radius: 8px;
  color: var(--red); transform: rotate(-10deg); opacity: .82; mix-blend-mode: multiply; font-family: var(--serif); line-height: 1.2;
  animation: stamp .45s cubic-bezier(.2,1.6,.4,1) both;
}
.stamp b { font-size: 20px; letter-spacing: .3em; }
.stamp small { font: 9px var(--type); letter-spacing: .1em; }
.stamp.is-still { animation: none; }
.stamp.small { margin: 0; padding: 4px 10px; position: absolute; right: 14px; bottom: 14px; }
.stamp.small b { font-size: 14px; }
@keyframes stamp { from { transform: rotate(-10deg) scale(2.2); opacity: 0; } }

/* ---------- 礼物夹 ---------- */
.gifts { min-height: 100%; background: var(--desk) var(--grain); }
.empty { text-align: center; color: var(--ink-2); font-family: var(--serif); line-height: 2; margin-top: 18vh; }
.slips { list-style: none; margin: 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.slip { position: relative; padding: 18px 18px 22px; background: var(--paper) var(--grain); border-top: 4px solid var(--edge); font-family: var(--serif); box-shadow: 0 10px 24px -14px rgba(60,40,20,.4); }
.slip:nth-child(odd) { transform: rotate(-.6deg); }
.slip:nth-child(even) { transform: rotate(.5deg); }
.slip-no { margin: 0; font: 11px var(--type); letter-spacing: .14em; color: var(--muted); }
.slip-title { display: block; margin-top: 6px; font-size: 19px; }
.slip-detail { margin: 4px 0 10px; color: var(--ink-2); font-size: 14px; }
.slip-note { margin: 0; font-size: 15px; line-height: 1.9; padding-right: 64px; }

/* ---------- 浮层 ---------- */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 50;
  padding: 10px 16px; border-radius: 999px; background: rgba(42,35,28,.92); color: #f6f0e4; font: 13px var(--sans); transition: .25s; pointer-events: none; white-space: nowrap; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(14,11,9,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; opacity: 0; transition: opacity .25s; }
.lightbox.is-on { opacity: 1; }
.lightbox img { max-width: 100%; max-height: 78dvh; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox p { max-width: 520px; margin: 0; color: rgba(246,240,228,.8); font: 15px/1.8 var(--serif); text-align: center; }

/* ---------- 调试面板 ---------- */
.dbg { position: fixed; left: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2147483600; font: 12px var(--sans); color: #222; }
.dbg-toggle { border: 0; border-radius: 6px; padding: 6px 9px; background: #1d4ed8; color: #fff; font-weight: 700; letter-spacing: .08em; cursor: pointer; opacity: .85; }
.dbg-body { margin-top: 6px; width: min(310px, calc(100vw - 20px)); padding: 12px; border-radius: 12px; background: rgba(255,255,255,.97); box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; gap: 8px; }
.dbg-body[hidden] { display: none; }
.dbg-body label { display: grid; gap: 4px; }
.dbg-body input[type=range], .dbg-body select { width: 100%; }
.dbg-time { margin: 0; color: #444; font-variant-numeric: tabular-nums; }
.dbg-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dbg-row label { display: flex; gap: 4px; align-items: center; }
.dbg-row button { border: 1px solid #ccc; background: #f6f6f6; border-radius: 6px; padding: 5px 8px; cursor: pointer; }
.dbg-row .dbg-danger { width: 100%; border-color: #e3a7a2; background: #fdf0ee; color: #a3261d; }

@media (prefers-reduced-motion: reduce) {
  .note-card, .stamp, .can { transition: none; animation: none; }
}


/* ---------- 弹出卡片（未到取件时间 / 调试密码） ---------- */
.modal { position: fixed; inset: 0; z-index: 2147483500; display: grid; place-items: center; padding: 24px;
  background: rgba(20,14,9,.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .2s; }
.modal-card { position: relative; width: min(100%, 360px); padding: 30px 24px 22px; background: #fbf7ee var(--grain); color: var(--ink);
  box-shadow: 0 20px 50px rgba(0,0,0,.35); transform: rotate(-1deg); font-family: var(--serif); animation: popIn .32s cubic-bezier(.2,1.3,.4,1); }
.modal-card .tape.tl { left: 50%; margin-left: -43px; }
.modal-title { margin: 0 0 16px; font-size: 20px; letter-spacing: .2em; text-align: center; }
.ny-line { margin: 6px 0; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.ny-line b { color: var(--ink); font-weight: 600; }
.ny-wait { margin: 18px 0 6px; text-align: center; font-size: 15px; }
.ny-wait b { display: block; margin-top: 4px; font-size: 22px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.ny-note { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.modal-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.modal-field { display: flex; align-items: baseline; gap: 10px; font-size: 15px; }
.modal-field input { flex: 1 1 0; width: 0; min-width: 0; border: 0; border-bottom: 1.5px solid var(--ink); background: transparent; font: 20px var(--serif); letter-spacing: .3em; padding: 6px 2px; outline: none; border-radius: 0; -webkit-appearance: none; }
.btn-ghost2 { appearance: none; border: 1px solid rgba(42,35,28,.25); background: transparent; border-radius: 999px; padding: 10px 20px; min-height: 44px; font-family: var(--serif); font-size: 15px; cursor: pointer; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) rotate(-1deg) scale(.96); } }
.ny-times { margin: 0; display: grid; gap: 2px; text-align: center; }
.ny-times dt { font-size: 12px; color: var(--muted); letter-spacing: .04em; margin-top: 8px; }
.ny-times dd { margin: 0; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ny-times dd b { font-weight: 600; }

/* iOS 主屏幕全屏模式下，屏幕最下方有一条页面画不到的区域，只显示页面底色。
   让底色跟着当前场景走，那一条就和画面融为一体。 */
html { background-color: var(--desk); transition: background-color .6s; }
html[data-scene="room"][data-light="night"] { background-color: #0c0907; }
html[data-scene="room"][data-light="dawn"] { background-color: #262b39; }
html[data-scene="room"][data-light="dusk"] { background-color: #43271c; }
html[data-scene="roll"][data-light="night"] { background-color: #0e0b09; }
html[data-scene="roll"][data-light="dawn"] { background-color: #4a5167; }
html[data-scene="roll"][data-light="dusk"] { background-color: #7c4a31; }

/* ---------- 箱子上的便签 ---------- */
.box-note { position: relative; padding: 16px 14px 12px; background: #fbf6e8; color: #2b241d; font-family: var(--serif); font-size: 13px; line-height: 1.6;
  box-shadow: 0 1px 1px rgba(60,40,20,.2), 0 8px 16px -6px rgba(60,40,20,.45); }
.box-note .tape { position: absolute; top: -10px; left: 50%; width: 70px; height: 20px; margin-left: -35px; background: rgba(240,228,200,.8); transform: rotate(-4deg); box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.box-note p { margin: 0 0 4px; }
.bn-to { font-size: 12px; color: #6f6253; }
.box-note b { font-weight: 600; }
.bn-local { font-size: 12px; color: #6f6253; }
.bn-left { margin-top: 6px !important; }
.bn-left b { font-variant-numeric: tabular-nums; }
.box-note[data-state="wait"] .bn-ready, .box-note[data-state="ready"] .bn-wait { display: none; }
.bn-ready p:first-child { font-size: 17px; color: var(--red); }
.bn-stamp { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border: 2px solid var(--red); border-radius: 5px; color: var(--red); font-size: 12px; letter-spacing: .2em;
  transform: rotate(-12deg); opacity: 0; mix-blend-mode: multiply; }
.box-note[data-state="ready"] .bn-stamp { opacity: .8; }
.box-note.arrive { animation: noteWiggle .9s ease; }
.box-note.arrive .bn-stamp { animation: stamp .45s .35s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes noteWiggle { 0% { transform: scale(1); } 20% { transform: scale(1.08) rotate(-3deg); } 45% { transform: scale(.98) rotate(2deg); } 70% { transform: rotate(-1deg); } 100% { transform: none; } }

/* ---------- 新胶卷寄到：从上方垂下来、晃两下的寄件吊牌 ---------- */
.arrive { position: fixed; inset: 0; z-index: 2147483400; display: flex; justify-content: center; align-items: flex-start; padding-top: calc(env(safe-area-inset-top) + 8px);
  background: rgba(20,14,9,.32); animation: fadeIn .3s; }
.arrive.is-leaving { animation: fadeOut .35s forwards; }
.arrive.is-leaving .arrive-tag { animation: tagUp .35s ease-in forwards; }
.arrive-tag { position: relative; width: min(84vw, 330px); margin-top: 70px; padding: 26px 22px 18px; background: #f7efdc var(--grain); color: #2b241d; font-family: var(--serif); text-align: center;
  border-radius: 6px; clip-path: polygon(14% 0, 86% 0, 100% 9%, 100% 100%, 0 100%, 0 9%);
  box-shadow: 0 18px 40px rgba(0,0,0,.35); transform-origin: 50% -70px; animation: tagDrop 1.5s cubic-bezier(.2,.8,.25,1) both; filter: drop-shadow(0 12px 18px rgba(0,0,0,.3)); }
.arrive-string { position: absolute; left: 50%; top: -70px; width: 2px; height: 82px; margin-left: -1px; background: linear-gradient(#e9dcc0, #cdb68c); }
.arrive-hole { position: absolute; left: 50%; top: 10px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #8a6a45; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.arrive-kicker { margin: 8px 0 6px; font-size: 13px; letter-spacing: .14em; color: #6f6253; }
.arrive-title { display: block; font-size: 22px; font-weight: 600; letter-spacing: .06em; line-height: 1.35; }
.arrive-when { display: block; margin-top: 6px; font-size: 12px; color: #9a8b78; font-variant-numeric: tabular-nums; }
.arrive-stamp { position: absolute; right: 14px; top: 34px; padding: 3px 9px; border: 2px solid var(--red); border-radius: 6px; color: var(--red); font-size: 13px; letter-spacing: .2em;
  transform: rotate(14deg); opacity: .82; mix-blend-mode: multiply; animation: stamp .45s .9s cubic-bezier(.2,1.6,.4,1) both; }
.arrive-actions { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.arrive-actions .btn-ink { text-decoration: none; display: inline-flex; align-items: center; }
@keyframes tagDrop {
  0% { transform: translateY(-140%) rotate(-14deg); }
  35% { transform: translateY(0) rotate(9deg); }
  55% { transform: rotate(-6deg); }
  72% { transform: rotate(3.5deg); }
  86% { transform: rotate(-1.5deg); }
  100% { transform: rotate(0); }
}
@keyframes tagUp { to { transform: translateY(-140%) rotate(8deg); } }
@keyframes fadeOut { to { opacity: 0; } }

/* ---------- 胶卷盒：刚寄到的那一格，拆开牛皮纸 ---------- */
.slot.arriving .wrapped { display: block; animation: unwrap .7s cubic-bezier(.5,0,.6,1) forwards; }
.slot.arriving .tag { display: block; animation: tagFall .8s ease-in forwards; }
.slot.arriving .can { display: block; animation: canPop .9s .35s cubic-bezier(.2,1.5,.4,1) both; }
.slot.arriving::after { content: ""; position: absolute; left: 50%; bottom: 40px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; z-index: 1; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(255,214,140,.75); animation: ring 1.2s .45s ease-out both; }
@keyframes unwrap { 0% { transform: rotate(-2deg); opacity: 1; } 30% { transform: translateY(4px) scaleY(.96) rotate(-4deg); } 100% { transform: translateY(-70px) rotate(-22deg) scale(.8); opacity: 0; } }
@keyframes tagFall { to { transform: translateX(-50%) translateY(50px) rotate(40deg); opacity: 0; } }
@keyframes canPop { 0% { transform: translateY(14px) scale(.6); opacity: 0; } 60% { transform: translateY(-8px) scale(1.08); opacity: 1; } 100% { transform: rotate(var(--tilt)); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255,214,140,.8); } 100% { box-shadow: 0 0 0 46px rgba(255,214,140,0); } }
