:root {
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --display: "Didot", "Bodoni 72", "Playfair Display", Georgia, serif;
  --sans: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }

/* ───────── 观看页 ───────── */
body.view { background: radial-gradient(ellipse at 50% 35%, #213447, #0b141d 70%); color: #f4efe4; overflow: hidden; touch-action: none; }
body.view[data-type="calendar"] { overflow: auto; touch-action: auto; background: #120c08; }
#stage { position: fixed; inset: 0; }
body[data-type="calendar"] #stage { position: relative; min-height: 100%; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

.scene { position: absolute; inset: 0; perspective: 1300px; perspective-origin: 50% 40%; cursor: grab; }
.scene:active { cursor: grabbing; }
.rig { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.rig > *, .pieces > * { transform-style: preserve-3d; }
.pieces { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }

.floor { position: absolute; left: -150px; top: 0; width: 300px; height: 360px; transform-origin: 50% 0; transform: rotateX(90deg);
  box-shadow: 0 30px 60px rgba(0,0,0,.55), 0 4px 10px rgba(0,0,0,.35); }
.floor .paper { position: absolute; inset: 0; background: var(--grain), linear-gradient(#ece5d6, #f6f1e7 40%, #fbf8f1); border-radius: 0 0 3px 3px; }
.floor-shades { position: absolute; inset: 0; }
.pp-shadow { position: absolute; height: 40px; border-radius: 50%; background: radial-gradient(ellipse at 50% 70%, rgba(40,30,20,.45), transparent 70%); filter: blur(4px); }
.floor-note { position: absolute; right: 22px; bottom: 26px; font-family: var(--serif); font-size: 13px; color: #6b5a48; letter-spacing: .1em; transform: translateZ(0.3px); }
.tab { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%) translateZ(0.5px); height: 30px; padding: 0 18px;
  border: 0; border-radius: 0 0 10px 10px; background: var(--grain), #b8352f; color: #fbe9c8; font-family: var(--serif); font-size: 13px; letter-spacing: .25em;
  box-shadow: 0 6px 10px rgba(0,0,0,.25); transition: opacity .4s; }

.pp { position: absolute; transform-origin: 50% 100%; backface-visibility: visible; }
.pp svg { display: block; overflow: visible; filter: drop-shadow(0 2px 1.5px rgba(0,0,0,.28)); }
.pp mask * { fill: #fff !important; stroke: #fff !important; }

.wall { position: absolute; left: -150px; top: -360px; width: 300px; height: 360px; transform-origin: 50% 100%; transform-style: preserve-3d; }
.wall .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; border-radius: 3px 3px 0 0; }
.wall .outer { transform: rotateX(180deg); border-radius: 0 0 3px 3px; }
.wall-dim { position: absolute; inset: 0; background: #000; pointer-events: none; backface-visibility: hidden; transform: translateZ(.2px); }
.backdrop { position: absolute; inset: 0; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; mix-blend-mode: soft-light; }
.backdrop i { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff8e2; box-shadow: 0 0 6px #fff3c4; animation: tw 4s ease-in-out infinite; }
@keyframes tw { 50% { opacity: .25; } }

.cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
.cover::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .6; mix-blend-mode: soft-light; pointer-events: none; }
.cv-text { position: relative; z-index: 2; }
.cv-en { font-family: var(--display); font-style: italic; font-size: 22px; letter-spacing: .04em; opacity: .9; }
.cv-title { font-family: var(--serif); font-size: 44px; font-weight: 600; letter-spacing: .18em; margin: 10px 0 0 .18em; text-shadow: 0 1px 0 rgba(255,255,255,.18), 0 -1px 0 rgba(0,0,0,.25); }
.cv-to { font-family: var(--serif); font-size: 15px; letter-spacing: .3em; margin-top: 18px; opacity: .85; }
.cv-frame { position: absolute; inset: 16px; border: 1.5px solid; opacity: .75; }
.cv-frame.in { inset: 22px; border-width: .8px; }
.cv-flake { position: absolute; width: 46px; bottom: 44px; left: 50%; transform: translateX(-50%); opacity: .55; }
.cv-rib { position: absolute; background: linear-gradient(90deg, #b88f3e, #f0d38c 45%, #c9a24a); box-shadow: 0 0 8px rgba(0,0,0,.35); }
.cv-rib.v { top: 0; bottom: 0; left: 80%; width: 18px; }
.cv-rib.h { left: 0; right: 0; top: 17%; height: 18px; background: linear-gradient(#b88f3e, #f0d38c 45%, #c9a24a); }
.cv-bow { position: absolute; width: 110px; left: calc(80% - 46px); top: calc(17% - 24px); filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); z-index: 3; }
.cover:has(.cv-rib) .cv-text { margin-top: 50px; margin-right: 34px; }
.cover:has(.cv-rib) .cv-flake { display: none; }
.cv-twine { position: absolute; height: 2px; left: -10%; right: -10%; background: repeating-linear-gradient(90deg, #f5ecdd 0 5px, #d8c8ad 5px 8px); box-shadow: 0 1px 1px rgba(0,0,0,.25); }
.cv-twine.a { top: 30%; transform: rotate(-12deg); }
.cv-twine.b { top: 30%; transform: rotate(9deg); }
.cv-tag { position: absolute; right: 28px; top: 70px; padding: 10px 14px 10px 20px; background: #f6efe2; color: #8a3b2e; font-family: var(--serif); font-size: 14px; letter-spacing: .15em; transform: rotate(8deg);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); box-shadow: 0 3px 6px rgba(0,0,0,.2); }
.cover:has(.cv-twine) .cv-text { margin-top: 60px; }

/* 底部按钮 */
#bar { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); display: flex; gap: 10px; z-index: 20; opacity: 0; transition: .6s cubic-bezier(.2,.8,.2,1); pointer-events: none; }
#bar.in { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#bar button { height: 40px; min-width: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid rgba(255,255,255,.18); background: rgba(20,28,36,.45); color: #f4efe4;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-family: var(--serif); font-size: 14px; letter-spacing: .12em; white-space: nowrap; }
#bar .b-music { padding: 0; font-size: 17px; }
#bar .b-music.off { opacity: .45; text-decoration: line-through; }
body[data-type="calendar"] #bar { right: 18px; left: auto; transform: none; }

/* 开场：信封 */
#intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; align-content: center; gap: 30px;
  background: radial-gradient(ellipse at 50% 40%, #24384c, #0b141d 75%); transition: opacity .7s; cursor: pointer; perspective: 900px; }
#intro.gone { opacity: 0; pointer-events: none; }
.envelope { position: relative; width: min(78vw, 330px); aspect-ratio: 1.45; transform-style: preserve-3d; animation: float 3.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-.6deg); } }
.env-back, .env-front { position: absolute; inset: 0; border-radius: 6px; }
.env-front { transform: translateZ(2px); }
.env-back { background: #d9ccb4; }
.env-card { position: absolute; left: 6%; right: 6%; top: 8%; bottom: 8%; border-radius: 3px; transform: translateZ(1px); transition: transform .95s cubic-bezier(.3,.7,.2,1) .62s; box-shadow: 0 2px 6px rgba(0,0,0,.3); will-change: transform; }
.env-front { background: var(--grain), linear-gradient(160deg, #f4ecdc, #e7dcc6); clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); box-shadow: 0 20px 50px rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14%; }
.env-to { font-family: var(--serif); font-size: 19px; letter-spacing: .3em; color: #5a4632; }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 56%; transform-origin: 50% 0; transform: translateZ(3px); transition: transform .6s cubic-bezier(.5,0,.3,1); z-index: 3; will-change: transform;
  background: var(--grain), linear-gradient(#ece2cf, #dfd2b9); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.env-seal { position: absolute; left: 50%; bottom: -6px; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #c94b43, #8e221f 70%);
  color: #f3c7a8; display: grid; place-items: center; font-size: 20px; box-shadow: inset 0 0 0 4px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.35); }
.env-flap { clip-path: none; }
.env-flap::before { content: ""; position: absolute; inset: 0; background: inherit; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.env-flap { background: none; filter: none; }
.env-flap::before { background: var(--grain), linear-gradient(#ece2cf, #dfd2b9); filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.env-hint { font-family: var(--serif); letter-spacing: .4em; font-size: 14px; color: rgba(244,239,228,.7); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#intro.opening .env-flap { transform: translateZ(-1px) rotateX(180deg); }   /* 翻开后在信封背面那一层，不和卡片抢同一个平面 */
#intro.opening .env-seal { opacity: 0; transition: opacity .2s; }
#intro.opening .env-card { transform: translateZ(1px) translateY(-62%); }
#intro.opening .envelope { animation-play-state: paused; }   /* 停在当前位置，不要跳回去 */
#intro.opening .env-hint { opacity: 0; animation: none; transition: opacity .3s; }

/* 日历开场：礼盒 */
.gift-tap { position: relative; width: 150px; height: 150px; animation: float 3.4s ease-in-out infinite; }
.gt-box { position: absolute; left: 10px; right: 10px; bottom: 0; height: 110px; background: linear-gradient(90deg, transparent 43%, #e9c46a 43% 57%, transparent 57%), #b8352f; border-radius: 3px; box-shadow: 0 20px 40px rgba(0,0,0,.5); }
.gt-lid { position: absolute; left: 0; right: 0; top: 18px; height: 30px; background: linear-gradient(90deg, transparent 43%, #f0d38c 43% 57%, transparent 57%), #c8423a; border-radius: 3px; transition: transform .8s cubic-bezier(.4,0,.2,1); box-shadow: 0 4px 6px rgba(0,0,0,.25); }
#intro.opening .gt-lid { transform: translateY(-70px) rotate(-16deg); }

/* 信纸 */
#letter { position: fixed; inset: 0; z-index: 25; background: rgba(6,10,14,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .45s; overflow: auto; padding: 8vh 0 12vh; }
#letter.in { opacity: 1; }
.letter-sheet { position: relative; width: min(88vw, 440px); margin: 0 auto; padding: 44px 30px 34px; color: #3d3024; font-family: "LXGW WenKai Screen", var(--serif);
  background: var(--grain), repeating-linear-gradient(transparent 0 33px, rgba(120,90,60,.13) 33px 34px), #f8f3e8; background-position: 0 0, 0 30px, 0 0;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); border-radius: 2px; transform: translateY(60px) rotate(-1deg); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
#letter.in .letter-sheet { transform: none; }
.letter-sheet .x { position: absolute; right: 10px; top: 8px; width: 36px; height: 36px; border: 0; background: none; font-size: 26px; color: #9c8a74; }
.l-to { font-size: 18px; margin-bottom: 14px; line-height: 34px; }
.l-body { font-size: 16.5px; line-height: 34px; white-space: pre-wrap; text-indent: 0; }
.l-photos { display: flex; justify-content: center; gap: 6px; margin: 30px -6px 10px; flex-wrap: wrap; }
.l-photos figure { position: relative; margin: 0; padding: 7px 7px 26px; background: #fff; box-shadow: 0 6px 14px rgba(0,0,0,.18); transform: rotate(var(--r)); flex: 0 1 46%; }
.l-photos.n1 figure { flex-basis: 78%; }
.l-photos.n3 figure { flex-basis: 31%; padding-bottom: 16px; }
.l-photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.tape { position: absolute; left: 50%; top: -10px; width: 60px; height: 20px; margin-left: -30px; background: rgba(236,222,190,.75); transform: rotate(-4deg); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.l-from { text-align: right; font-size: 17px; margin-top: 26px; }
.l-date { text-align: right; font-size: 12px; color: #9c8a74; letter-spacing: .2em; margin-top: 6px; }

.err { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: var(--serif); line-height: 2.2; color: #d9cdb8; }
.err a { color: #e9c46a; }

/* ───────── 日历 ───────── */
.cal { min-height: 100vh; padding: 34px 16px 90px; position: relative; color: var(--ink); }
.cal::before { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .55; mix-blend-mode: soft-light; pointer-events: none; }
.cal-head { text-align: center; margin-bottom: 22px; position: relative; }
.cal-en { font-family: var(--display); font-style: italic; font-size: 17px; opacity: .8; }
.cal h1 { font-family: var(--serif); font-size: 34px; letter-spacing: .2em; margin: 6px 0 4px .2em; font-weight: 600; }
.cal-to { font-family: var(--serif); letter-spacing: .3em; font-size: 14px; opacity: .85; }
.cal-left { margin-top: 14px; font-family: var(--serif); font-size: 13px; letter-spacing: .15em; opacity: .85; }
.cal-left b { font-family: var(--display); font-size: 22px; margin: 0 4px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; max-width: 460px; margin: 0 auto; position: relative; }
.cell { position: relative; aspect-ratio: .82; perspective: 700px; cursor: pointer; }
.cell.big { grid-column: 2 / span 2; grid-row: 4 / span 2; aspect-ratio: auto; }
.inside { position: absolute; inset: 0; border-radius: 4px; background: var(--page); box-shadow: inset 0 3px 10px rgba(0,0,0,.6); overflow: hidden; display: grid; place-items: center; }
.inside img { width: 100%; height: 100%; object-fit: cover; }
.inside .star { color: #e9c46a; font-size: 18px; text-shadow: 0 0 10px rgba(233,196,106,.7); }
.cell.big .inside .star { font-size: 40px; }
.door { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.35,.1,.2,1); }
.cell.open .door { transform: rotateY(-118deg); }
.door > div { position: absolute; inset: 0; border-radius: 4px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.front { background: var(--grain), var(--door); border: 1px dashed var(--line); display: grid; place-items: center; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 2px 5px rgba(0,0,0,.25); }
.front span { font-family: var(--display); font-size: 26px; color: var(--ink); }
.cell.big .front span { font-size: 62px; }
.cell.big .front::after { content: "Christmas"; position: absolute; bottom: 14%; font-family: var(--display); font-style: italic; font-size: 15px; color: var(--ink); opacity: .75; }
.back { transform: rotateY(180deg); background: var(--grain), #efe6d4; }
.cell.locked .front { filter: saturate(.85) brightness(.92); }
.cell.ok:not(.open) .front { box-shadow: 0 0 0 1.5px rgba(233,196,106,.75), 0 2px 8px rgba(0,0,0,.25); }
.cell.today:not(.open) .front { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px #f0d38c, 0 0 22px rgba(240,211,140,.75); } }
.cell.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px) rotate(-1deg); } 40%, 80% { transform: translateX(4px) rotate(1deg); } }
.cal-foot { text-align: right; max-width: 460px; margin: 22px auto 0; font-family: var(--serif); letter-spacing: .15em; opacity: .85; }

.day-modal { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(6,8,10,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s; padding: 20px; }
.day-modal.in { opacity: 1; }
.day-card { position: relative; width: min(86vw, 380px); background: var(--grain), #f8f3e8; color: #3d3024; padding: 34px 26px 30px; border-radius: 3px; text-align: center; font-family: var(--serif);
  box-shadow: 0 30px 80px rgba(0,0,0,.5); transform: scale(.9) translateY(20px); transition: transform .5s cubic-bezier(.2,.9,.25,1.2); }
.day-modal.in .day-card { transform: none; }
.day-card .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 26px; color: #9c8a74; width: 36px; height: 36px; }
.day-n { font-family: var(--display); font-size: 54px; color: #b8352f; line-height: 1; }
.day-n small { font-family: var(--serif); font-size: 14px; color: #8a7660; margin: 0 6px; letter-spacing: .2em; }
.day-card img { display: block; width: 100%; margin: 18px 0 4px; border: 7px solid #fff; box-shadow: 0 6px 14px rgba(0,0,0,.15); }
.day-card p { font-size: 17px; line-height: 1.9; margin: 18px 0 0; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px); background: rgba(20,20,20,.8); color: #f4efe4; padding: 10px 18px; border-radius: 20px; font-family: var(--serif); letter-spacing: .1em;
  font-size: 14px; opacity: 0; transition: .3s; z-index: 50; pointer-events: none; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ───── 立体卡（浅色纸面） ───── */
body.view[data-type="card"] { background: var(--card-bg, #ece7df); }
body[data-type="card"] #bar button { background: rgba(255,252,246,.72); color: #3d3024; border-color: rgba(60,40,20,.12); box-shadow: 0 6px 18px rgba(60,40,20,.1); }
#intro.light { background: radial-gradient(ellipse at 50% 40%, #f6f2eb, #e4ddd1 80%); }
#intro.light .env-hint { color: #8a7660; }
#intro.light .envelope .env-front { box-shadow: 0 24px 50px rgba(60,40,20,.22); }

.env-card { z-index: 1; }
.env-front { z-index: 2; }
#intro.opening .env-card { z-index: 1; }

/* ───── 日历 v2：手绘底板 + 纸门 + 烫金数字 ───── */
body.view[data-type="calendar"] { background: #1a120c; }
.cal { padding: 13% 9% 120px; background-attachment: scroll; }
.cal::before { display: none; }
.cal-head { color: var(--head); text-shadow: 0 1px 8px rgba(0,0,0,.18); }
.cal h1 { font-family: "LXGW WenKai Screen", var(--serif); font-weight: 400; font-size: 36px; }
.cal-to, .cal-left { font-family: "LXGW WenKai Screen", var(--serif); }
.grid { gap: 8px; max-width: 420px; }
.front { background: var(--grain), linear-gradient(160deg, rgba(255,255,255,.35), rgba(0,0,0,.04)), var(--door); border: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 0 0 1px var(--line) inset, 0 3px 8px rgba(30,15,5,.28); }
.front::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(176,138,62,.45); border-radius: 2px; }
.front span { font-family: "Didot", "Bodoni 72", Georgia, serif; background: linear-gradient(160deg, #f3d98f, #b48a3c 45%, #f0d58c 60%, #9c7430); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)); }
.cell.big .front::after { color: #a8803a; }
.inside { background: radial-gradient(ellipse at 50% 40%, #3b2a1d, #1a110b); }
.ico { width: 78%; aspect-ratio: 1; background: url(/cards/calendar/icons.webp) no-repeat; background-size: 500% 500%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.day-card .ico.big { display: block; width: 46%; margin: 14px auto 0; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); }
.day-card { font-family: "LXGW WenKai Screen", var(--serif); }
.cell.ok:not(.open) .front { box-shadow: 0 0 0 1.5px rgba(214,174,92,.9), 0 3px 10px rgba(30,15,5,.3); }

.cal-bg { position: fixed; inset: 0; z-index: 0; }
.cal { position: relative; z-index: 1; background: none !important; padding: max(19vh, 120px) 11% 120px; }
.front span { background: linear-gradient(160deg, #d9b465, #8a6526 45%, #c9a04f 62%, #7a5a22); -webkit-background-clip: text; background-clip: text; }
.cal-head { margin-bottom: 18px; }

/* 彩蛋：节日那天浮出来的一行金字 */
#egg { position: fixed; left: 0; right: 0; top: 13%; z-index: 25; text-align: center; pointer-events: none; opacity: 0; transform: translateY(14px); }
#egg b { display: block; font: 400 44px/1.2 "LXGW WenKai Screen", "Kaiti SC", serif; letter-spacing: .12em; color: #f6dc97;
  background: linear-gradient(100deg, #b98a35 20%, #fff2c4 45%, #d6a64a 60%, #b98a35 80%); background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(60,30,0,.35)); animation: eggShine 3.2s linear infinite; }
#egg span { display: block; margin-top: 6px; font: italic 18px Didot, "Bodoni 72", Georgia, serif; color: #e9d29a; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
#egg.in { animation: eggIn 1.2s cubic-bezier(.2,.8,.2,1) forwards; }
#egg.out { opacity: 1; transform: none; animation: eggOut .9s ease forwards; }
@keyframes eggIn { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes eggOut { to { opacity: 0; transform: translateY(-10px); filter: blur(4px); } }
@keyframes eggShine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
body[data-type="calendar"] #egg { top: 0; bottom: 0; display: grid; place-content: center; background: radial-gradient(closest-side, rgba(30,15,5,.55), rgba(30,15,5,0)); }

/* 3D 还在加载 */
body.view.loading::after { content: "正在加载…"; position: fixed; left: 0; right: 0; bottom: 18%; text-align: center; font: 14px/1 "LXGW WenKai Screen", serif; color: #8b7a62; letter-spacing: .2em; z-index: 5; animation: ld 1.4s ease-in-out infinite; pointer-events: none; }
body.view[data-type="card"] { background: var(--card-bg, #ece7df); }
@keyframes ld { 50% { opacity: .35; } }

.nogl { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; padding: 24px; text-align: center; }
.nogl img { max-width: 70vw; max-height: 60vh; border-radius: 6px; box-shadow: 0 20px 40px rgba(60,40,20,.2); margin: 0 auto; }
.nogl p { color: #8b7a62; font-size: 13px; margin: 0; }

#intro.wait { cursor: progress; }
#intro.wait .env-hint { animation: none; opacity: .45; }

/* 开格子顺一点：门单独一层，转的时候不重画纸纹和金字 */
.door { will-change: transform; backface-visibility: hidden; }
.cell.ok .door > div { transform: translateZ(0); }
.cell.ok .back { transform: rotateY(180deg) translateZ(0); }
.day-modal { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: rgba(12,8,5,.62) !important; }

/* 彩蛋浮字：毛笔字 + 花体英文，烫金 */
@font-face { font-family: "EggBrush"; src: url(/fonts/egg/mashanzheng-egg.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "EggScript"; src: url(/fonts/egg/greatvibes-egg.woff2) format("woff2"); font-display: block; }
#egg b { font: 400 64px/1.15 "EggBrush", "Kaiti SC", serif; letter-spacing: .06em;
  background: linear-gradient(100deg, #a8772a 15%, #fff1bd 40%, #e2b453 55%, #fbe6a6 68%, #a8772a 85%); background-size: 260% 100%; -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(255,250,230,.55)) drop-shadow(0 3px 10px rgba(50,25,0,.45)); }
#egg span { font: 400 34px/1 "EggScript", Didot, Georgia, serif; font-style: normal; margin-top: 2px; color: #f3dc9e; letter-spacing: .02em; }

/* ───── 信封 v2：红/绿棉纸 + 内衬 + 火漆 + 冬青 + 牛皮纸名签 ───── */
.envelope { --paper: url(/img/env/paper_red.webp); width: min(80vw, 340px); filter: drop-shadow(0 22px 34px rgba(60,30,10,.35)); }
.envelope.green { --paper: url(/img/env/paper_green.webp); }
.env-back { background: url(/img/env/liner.webp) center/cover; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.env-front { background: var(--paper) center/cover; border-radius: 5px; box-shadow: none; padding: 0; display: block; }
.env-front::after { content: ""; position: absolute; inset: 7px; border: 1.2px solid rgba(226,186,104,.85); border-radius: 3px; clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%); pointer-events: none; }
.env-flap { height: 56%; transform-style: preserve-3d; }
.env-flap::before { display: none; }
.env-flap .fl-front, .env-flap .fl-back { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.env-flap .fl-front { background: var(--paper) center/cover; filter: brightness(1.06); }
.env-flap .fl-front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 60%, rgba(0,0,0,.18)); }
.env-flap .fl-back { background: url(/img/env/liner.webp) center/cover; transform: rotateX(180deg); }
.env-seal { position: absolute; left: 50%; bottom: -15%; width: 26%; height: auto; margin: 0; transform: translateX(-50%) translateZ(1px); background: none; box-shadow: none; border-radius: 0; filter: drop-shadow(0 3px 4px rgba(40,10,0,.35)); }
.env-holly { position: absolute; left: 50%; bottom: -10%; width: 30%; transform: translateX(-96%) rotate(-12deg) translateZ(1px); filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.env-tag { position: absolute; right: 6%; bottom: 10%; width: 46%; aspect-ratio: 1213 / 420; background: url(/img/env/tag.webp) center/contain no-repeat; transform: rotate(-4deg); display: flex; align-items: center; justify-content: center; padding-left: 14%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.env-tag span { font: 15px/1 "LXGW WenKai Screen", "Kaiti SC", serif; color: #4a3220; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#intro.opening .env-seal, #intro.opening .env-holly { opacity: 0; transition: opacity .25s; }
#intro.light { background: radial-gradient(ellipse at 50% 42%, #f6f0e4, #e6dccb 80%); }
.env-hint { color: #8b6a3e; }
/* 盖子一圈细金边 + 一点投影，合着时能看出三角形 */
.env-flap .fl-front { background: linear-gradient(#e8c477, #b98a35); filter: none; }
.env-flap .fl-front::before { content: ""; position: absolute; inset: 0; background: var(--paper) center/cover; filter: brightness(1.08); clip-path: polygon(1.6% 0, 98.4% 0, 50% 96.5%); }
.env-flap .fl-front::after { clip-path: polygon(1.6% 0, 98.4% 0, 50% 96.5%); background: linear-gradient(rgba(255,255,255,.06), rgba(0,0,0,.12)); }
.env-front::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 60%; background: linear-gradient(to bottom right, transparent 49.4%, rgba(0,0,0,.16) 50%, transparent 53%) left/50% 100% no-repeat, linear-gradient(to bottom left, transparent 49.4%, rgba(0,0,0,.16) 50%, transparent 53%) right/50% 100% no-repeat; pointer-events: none; }
