/* 每一页自己的样子 */

/* ========== 1 封面 ========== */
.page-cover {
  background: radial-gradient(120% 90% at 50% 0%, #34436a 0%, var(--night) 45%, var(--night-deep) 100%);
  color: var(--paper);
}
.stars { position: absolute; inset: 0; }
.stars i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.3); } }
.gyp { position: absolute; bottom: 0; width: clamp(230px, 38vw, 520px); height: auto; overflow: visible; }
.gyp-left { left: 0; }
.gyp-right { right: 0; transform: scaleX(-1); }
.gyp path { fill: none; stroke: #8fae93; stroke-width: 1.3; stroke-linecap: round; }
.gyp circle { fill: #fffdf6; }
.gyp circle.is-soft { fill: #f6d9dc; }
.gyp circle.is-twinkle { animation: twinkle 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

.cover-body { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; text-align: center; }
.kicker { margin: 0; font-family: var(--font-pixel); letter-spacing: .28em; font-size: clamp(.7rem, .5vw + .6rem, .95rem); color: var(--sun); }
.page-cover h1 {
  margin: .12em 0 0; font-family: var(--font-title); font-weight: 400;
  font-size: clamp(3.2rem, 9vw + 1rem, 8.5rem); line-height: 1.05;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.days { margin: .2em 0 0; font-family: var(--font-hand); font-size: clamp(1.4rem, 1.6vw + 1rem, 2.3rem); }
.days b { font-family: var(--font-title); font-weight: 400; font-size: 1.7em; color: var(--sun); padding: 0 .08em; }
.camera {
  margin-top: clamp(8px, 3vh, 34px); width: clamp(170px, 24vw, 280px);
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .45));
  transform: rotate(-4deg); transition: transform .3s var(--ease-back);
}
.camera svg { display: block; width: 100%; height: auto; overflow: visible; }
.camera:hover { transform: rotate(-1deg) scale(1.04); }
.camera:active, .camera.is-snap { transform: rotate(-4deg) scale(.94); }
.camera.is-snap .camera-flash { fill: #fff; }
.hint { margin: .7em 0 0; font-family: var(--font-hand); font-size: clamp(1.15rem, 1vw + .9rem, 1.55rem); opacity: .85; }

.shots { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.shot {
  position: absolute; width: clamp(96px, 13vw, 176px);
  transform: rotate(var(--r));
  animation: develop 1s var(--ease-out) backwards;
}
.shot img { aspect-ratio: 1; }
.shot figcaption { font-size: clamp(.85rem, .6vw + .7rem, 1.2rem); }
.shot.slot-0 { left: 7%; top: 46%; --r: -9deg; }
.shot.slot-1 { right: 7%; top: 42%; --r: 7deg; }
.shot.slot-2 { left: 5%; top: 9%; --r: 6deg; }
.shot.slot-3 { right: 5%; top: 8%; --r: -6deg; }
@keyframes develop {
  0% { opacity: 0; transform: translateY(40px) scale(.5) rotate(0deg); filter: brightness(3) saturate(0); }
  45% { opacity: 1; filter: brightness(1.8) saturate(.2); }
  100% { filter: none; }
}

/* ========== 2 胶卷 ========== */
.page-film {
  background: radial-gradient(90% 70% at 50% 40%, #5a1f17 0%, #2c0f0c 60%, #160806 100%);
  color: var(--paper); padding-left: 0; padding-right: 0;
}
.strip {
  --frame-h: clamp(110px, 21vh, 210px);
  flex: none; width: 108%; display: flex; gap: 12px; padding: 30px 6vw;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; cursor: grab;
  background-color: var(--film);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 10px, #f1e3c8 10px 24px, transparent 24px 34px),
    repeating-linear-gradient(90deg, transparent 0 10px, #f1e3c8 10px 24px, transparent 24px 34px);
  background-size: 34px 13px; background-repeat: repeat-x;
  background-position: 0 8px, 0 calc(100% - 8px); background-attachment: local;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
.strip::-webkit-scrollbar { display: none; }
.strip.is-drag { cursor: grabbing; }
.strip-a { transform: rotate(-2deg); }
.strip-b { transform: rotate(1.5deg); }
.frame {
  flex: none; position: relative; height: var(--frame-h); aspect-ratio: 4 / 5;
  border-radius: 3px; overflow: hidden; background: #000;
  transition: transform .3s var(--ease-back);
}
.frame img {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
  filter: sepia(.35) saturate(.85) contrast(1.05); transition: filter .3s, transform .5s var(--ease-out);
}
.frame::after {
  content: attr(data-no); position: absolute; left: 5px; bottom: 3px;
  font: 700 .62rem var(--font-pixel); color: #ffb347; letter-spacing: .08em; text-shadow: 0 0 3px #000;
}
.frame:hover, .frame:focus-visible { transform: translateY(-6px) scale(1.04); z-index: 2; }
.frame:hover img, .frame:focus-visible img { filter: none; transform: scale(1.06); }

/* ========== 3 小餐桌 ========== */
.page-table {
  background-color: #f7e9d2;
  background-image:
    linear-gradient(90deg, rgba(217, 72, 43, .16) 50%, transparent 50%),
    linear-gradient(rgba(217, 72, 43, .16) 50%, transparent 50%);
  background-size: 56px 56px;
}
.page-table .page-head h2 { background: var(--paper); display: inline-block; padding: .08em .5em; transform: rotate(-1.2deg); box-shadow: 0 3px 0 var(--ink); border: 2px solid var(--ink); }
.page-table .sub { opacity: 1; }
.table {
  --size: min(86vw, 58vh, 560px);
  position: relative; flex: none; width: var(--size); height: var(--size); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c98d5a, #9c6238 70%);
  border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 calc(var(--size) * .035) #b57a48, 0 calc(var(--size) * .03) 0 #6e4324, 0 30px 40px rgba(60, 30, 10, .35);
}
.table-center {
  position: absolute; inset: 31%; border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: #fffdf6; border: 3px dashed var(--tomato); transform: rotate(-4deg);
}
.table-count { margin: 0; font-family: var(--font-hand); font-size: calc(var(--size) * .058); line-height: 1.2; padding: 0 .4em; }
.table-count b { font-family: var(--font-title); font-weight: 400; font-size: 1.7em; color: var(--tomato); }
.dish {
  --d: calc(var(--size) * .215);
  position: absolute; left: calc(50% + var(--x) * var(--size) - var(--d) / 2); top: calc(50% + var(--y) * var(--size) - var(--d) / 2);
  width: var(--d); height: var(--d); border-radius: 50%;
  background: radial-gradient(circle, #fff 0 52%, #ece4d6 53% 62%, #fff 63%);
  border: 3px solid var(--ink); box-shadow: 0 5px 0 rgba(43, 38, 34, .35);
  display: grid; place-items: center;
  transition: transform .6s var(--ease-out), opacity .5s ease .1s, box-shadow .2s;
}
.dish-icon { font-size: calc(var(--d) * .46); line-height: 1; }
.dish-name {
  position: absolute; bottom: -0.55em; left: 50%; transform: translateX(-50%) rotate(-3deg);
  font-family: var(--font-hand); font-size: calc(var(--d) * .2); white-space: nowrap;
  background: var(--sun); padding: 0 .4em; border: 2px solid var(--ink);
}
.dish:hover:not(:disabled) { transform: translateY(-5px) rotate(-5deg); box-shadow: 0 10px 0 rgba(43, 38, 34, .3); }
.dish.is-removed { transform: translate(calc(var(--x) * 260%), calc(var(--y) * 260%)) rotate(200deg) scale(.5); opacity: 0; pointer-events: none; }
.dish.is-kept { animation: wiggle .55s var(--ease-out); }
.dish.is-kept::before, .table.is-done .dish:not(.is-removed)::before {
  content: '♥'; position: absolute; top: -0.5em; right: -0.1em; color: var(--tomato);
  font-size: calc(var(--d) * .36); animation: pop .4s var(--ease-back);
}
.table.is-done .dish:not(.is-removed) { box-shadow: 0 0 0 5px var(--sun), 0 5px 0 rgba(43, 38, 34, .35); }
@keyframes wiggle { 20% { transform: rotate(-10deg); } 45% { transform: rotate(9deg); } 70% { transform: rotate(-5deg); } }
.say {
  margin: 0; min-height: 1.5em; font-family: var(--font-hand); font-size: clamp(1.3rem, 1.2vw + 1rem, 1.9rem);
  background: var(--paper); padding: 0 .7em; border-radius: 999px;
}
.say:empty { visibility: hidden; }

/* ========== 4 两只手 ========== */
.page-hands {
  background: #d9c3a0 repeating-linear-gradient(115deg, transparent 0 22px, rgba(120, 90, 50, .06) 22px 23px);
  transition: opacity .5s ease, transform .7s var(--ease-out), visibility 0s .7s, background-color 1.2s ease, color 1.2s ease;
  justify-content: space-between; padding-bottom: 0;
}
.page-hands.is-duo { background-color: #1a1436; color: var(--paper); }
.duo-text, .page-hands.is-duo .solo-text { display: none; }
.page-hands.is-duo .duo-text { display: inline; animation: fade .9s ease; }
.hands {
  position: relative; flex: 1; width: min(100%, 760px); min-height: 0; z-index: 3;
  display: block; margin-bottom: var(--pager-h);
}
.hand { position: absolute; bottom: -6%; height: min(96%, 92vw); aspect-ratio: 200 / 400; filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .35)); }
.hand svg { width: 100%; height: 100%; overflow: visible; display: block; }
.hand-1 { left: 50%; transform: translateX(-50%) rotate(3deg); transform-origin: 50% 100%; transition: transform .9s var(--ease-out); }
.hands:hover .hand-1 { transform: translateX(-50%) rotate(-1deg); }
.hand-2 { left: 50%; transform: translate(60%, 110%) rotate(30deg); transform-origin: 50% 100%; opacity: 0; transition: transform 1s var(--ease-back) .15s, opacity .3s ease .15s; }
.is-duo .hand-1, .is-duo .hands:hover .hand-1 { transform: translateX(-92%) rotate(-9deg); }
.is-duo .hand-2 { transform: translateX(-8%) rotate(9deg); opacity: 1; }
.ticket-count {
  position: absolute; right: 2%; top: 12%; transform: rotate(8deg);
  font-family: var(--font-hand); font-size: clamp(1.3rem, 1.5vw + 1rem, 2.2rem); color: var(--ink);
  background: var(--sun); border: 2px solid var(--ink); padding: 0 .5em; box-shadow: 0 3px 0 var(--ink);
}
.ticket-count b { font-family: var(--font-title); font-weight: 400; font-size: 1.5em; color: var(--tomato); }
/* 两只手分开后，中间上方正好空出来 */
.is-duo .ticket-count { right: auto; left: 50%; top: 0; transform: translateX(-50%) rotate(-4deg); animation: stamp .5s var(--ease-back) .5s backwards; }
@keyframes stamp { from { scale: 2.4; opacity: 0; } }

.stage-fx { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease .2s; pointer-events: none; }
.is-duo .stage-fx { opacity: 1; }
.beam {
  position: absolute; top: -10%; width: 26vw; height: 130%; transform-origin: 50% 0;
  background: linear-gradient(to bottom, var(--c), transparent 82%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); mix-blend-mode: screen;
  animation: sway 6s ease-in-out infinite alternate;
}
.beam-1 { left: 2%; --c: rgba(255, 210, 63, .5); --a: 16deg; --b: -6deg; }
.beam-2 { left: 26%; --c: rgba(243, 120, 160, .5); --a: -12deg; --b: 10deg; animation-duration: 7.5s; }
.beam-3 { right: 26%; --c: rgba(110, 170, 255, .5); --a: 12deg; --b: -10deg; animation-duration: 5.5s; }
.beam-4 { right: 2%; --c: rgba(170, 120, 255, .5); --a: -16deg; --b: 6deg; animation-duration: 8s; }
@keyframes sway { from { transform: rotate(var(--a)); } to { transform: rotate(var(--b)); } }
.notes i {
  position: absolute; bottom: 20%; left: var(--l); font-style: normal; font-size: var(--s); color: var(--c);
  animation: float var(--t) linear var(--dl) infinite; opacity: 0;
}
@keyframes float {
  0% { transform: translateY(0) rotate(-10deg); opacity: 0; } 15% { opacity: .9; }
  100% { transform: translateY(-70vh) rotate(25deg); opacity: 0; }
}
.sticks { position: absolute; left: 0; right: 0; bottom: calc(var(--pager-h) - 10px); height: 15%; display: flex; justify-content: space-around; align-items: flex-end; }
.sticks i {
  width: 7px; height: var(--h); border-radius: 4px; background: var(--c); box-shadow: 0 0 14px 3px var(--c);
  transform-origin: 50% 100%; animation: wave 1.1s ease-in-out var(--dl) infinite alternate;
}
@keyframes wave { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }

/* ========== 5 小游戏 ========== */
.page-game { background: #12152a radial-gradient(80% 60% at 50% 45%, #2a2f5a, transparent); color: var(--paper); gap: clamp(8px, 1.6vh, 16px); }
.console {
  position: relative; flex: none; width: min(94vw, calc((100vh - 290px) * 400 / 224), 860px);
  width: min(94vw, calc((100dvh - 290px) * 400 / 224), 860px); min-width: 260px;
  border: 4px solid var(--ink); border-radius: 14px; background: #000; padding: 8px;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 8px var(--ink), 0 24px 40px rgba(0, 0, 0, .5);
}
#gameCanvas { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; background: #1b1f3a; }
.console::after {
  content: ''; position: absolute; inset: 8px; border-radius: 6px; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, .14) 2px 3px);
}
.hud { position: absolute; top: 14px; left: 16px; right: 16px; z-index: 2; display: flex; gap: 8px; font: 700 clamp(.7rem, 1.2vw, 1rem) var(--font-pixel); }
.hud-p { padding: .1em .5em; border: 2px solid #fff; }
.hud-p1 { background: #3f6bd9; }
.hud-p2 { opacity: .3; border-style: dashed; }
.hud-p2.is-on { opacity: 1; background: #e0568a; border-style: solid; animation: blink .25s steps(2) 6; }
.hud-hearts { margin-left: auto; color: #ff8fb0; text-shadow: 2px 2px 0 #000; }
@keyframes blink { 50% { opacity: .2; } }
.game-banner {
  position: absolute; left: 50%; top: 26%; transform: translateX(-50%); margin: 0; z-index: 2; width: max-content; max-width: 92%;
  font-family: var(--font-title); font-size: clamp(1rem, 2.2vw, 1.9rem); text-align: center; line-height: 1.2;
  color: #fff; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  pointer-events: none;
}
.game-banner.is-big { font-family: var(--font-pixel); font-weight: 700; color: var(--sun); font-size: clamp(1.1rem, 3.2vw, 2.4rem); animation: blink .4s steps(2) infinite; }
.game-overlay {
  position: absolute; inset: 8px; z-index: 3; border-radius: 6px; background: rgba(10, 12, 30, .78);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%;
}
.game-overlay-title { margin: 0; font: 700 clamp(1.2rem, 3.4vw, 2.6rem) var(--font-pixel); color: #fff; letter-spacing: .12em; text-align: center; }
.btn-pixel {
  font: 700 clamp(.9rem, 2vw, 1.4rem) var(--font-pixel); color: var(--ink); background: var(--sun);
  padding: .5em 1.1em; border: 3px solid #fff; box-shadow: 4px 4px 0 #000; animation: blink 1s steps(2) infinite;
}
.btn-pixel:hover, .btn-pixel:focus-visible { animation: none; background: #fff; }
.pad { display: flex; justify-content: space-between; width: min(94vw, 520px); flex: none; }
.pad-move { display: flex; gap: 12px; }
.pad-btn {
  width: 64px; height: 56px; border-radius: 14px; background: #2e3566; color: #fff; font-size: 1.3rem;
  border: 3px solid var(--paper); box-shadow: 0 5px 0 #0b0d1c; touch-action: none; user-select: none; -webkit-user-select: none;
}
.pad-btn.is-down { transform: translateY(4px); box-shadow: 0 1px 0 #0b0d1c; }
.pad-jump { width: 88px; background: var(--tomato); font-family: var(--font-title); border-radius: 28px; }

/* ========== 6 结尾 ========== */
.page-finale { background: #100d1f radial-gradient(70% 60% at 30% 40%, #2b2350, transparent); color: var(--paper); }
.finale-wrap { display: flex; align-items: center; justify-content: center; gap: clamp(18px, 4vw, 56px); width: 100%; max-width: 1240px; min-height: 0; }
.finale-photo {
  position: relative; margin: 0; flex: none; width: min(92vw, 660px, calc((100vh - 190px) * 4 / 3));
  width: min(92vw, 660px, calc((100dvh - 190px) * 4 / 3));
  background: #fffdf6; padding: 12px 12px 0; transform: rotate(-1.5deg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.finale-photo canvas, .finale-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; background: #0c0a18; }
.finale-photo img { position: absolute; top: 12px; left: 12px; width: calc(100% - 24px); object-fit: cover; opacity: 0; transition: opacity 2s ease; }
.finale-photo.is-real img { opacity: 1; }
.finale-photo figcaption { display: flex; justify-content: space-between; padding: .5em .2em .55em; color: var(--ink); font-family: var(--font-hand); font-size: clamp(1rem, 1vw + .7rem, 1.35rem); }
.tag-game { color: #3f6bd9; } .tag-live { color: var(--tomato); }
.letter { flex: 1 1 320px; max-width: 440px; }
.letter h2 { margin: 0 0 .3em; font-family: var(--font-title); font-weight: 400; font-size: clamp(2rem, 2.5vw + 1rem, 3.4rem); color: var(--sun); }
.letter p { margin: 0 0 .6em; font-family: var(--font-hand); font-size: clamp(1.2rem, .9vw + .95rem, 1.6rem); line-height: 1.5; opacity: 0; transform: translateY(10px); transition: opacity .9s ease, transform .9s var(--ease-out); }
.letter p.is-shown { opacity: 1; transform: none; }
.letter-sign { text-align: right; color: var(--blush); }
.letter .btn-paper { color: var(--ink); margin-top: .3em; }

@media (max-width: 860px) {
  .finale-wrap { flex-direction: column; overflow-y: auto; justify-content: flex-start; max-height: 100%; }
  .finale-photo { width: min(92vw, calc((100dvh - 330px) * 4 / 3)); min-width: 240px; }
  .letter { flex: none; max-width: 92vw; }
  .letter h2 { display: none; }
  .letter p { margin-bottom: .35em; line-height: 1.35; }
}
@media (max-width: 560px) {
  .shot.slot-0 { left: 3%; top: 67%; } .shot.slot-1 { right: 3%; top: 66%; }
  .shot.slot-2 { left: 3%; top: 3%; } .shot.slot-3 { right: 3%; top: 4%; }
  .strip { --frame-h: clamp(110px, 20vh, 180px); }
  .console { width: min(94vw, calc((100dvh - 300px) * 400 / 224)); }
}

/* 手机横屏 / 很矮的窗口：压缩纵向空间，保证按键和内容都还在屏幕里 */
@media (max-height: 460px) {
  .page-game .page-head { display: none; }
  .console { width: min(60vw, calc((100dvh - 140px) * 400 / 224)); min-width: 0; }
  .pad { position: absolute; left: 14px; right: 14px; bottom: 14px; width: auto; }
  .page-head h2 { font-size: 1.5rem; }
  .sub { font-size: 1rem; margin-top: 0; }
  .page-cover h1 { font-size: 3rem; }
  .camera { width: 110px; margin-top: 4px; }
  .hint { margin-top: .2em; }
  .strip { --frame-h: 78px; padding: 22px 6vw; }
  .table { --size: min(86vw, calc(100dvh - 170px)); }
  .say { font-size: 1.1rem; }
  .finale-wrap { flex-direction: row; overflow: visible; }
  .finale-photo { width: min(46vw, calc((100dvh - 150px) * 4 / 3)); min-width: 0; }
  .letter { flex: 1 1 0; max-width: 46vw; max-height: 100%; overflow-y: auto; }
  .letter p { font-size: 1rem; line-height: 1.3; margin-bottom: .3em; }
}
