@font-face { font-family: "Fusion Pixel"; src: url("assets/fonts/fusion-pixel-12px-proportional-zh_hans.otf.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: url("assets/fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --u: 3px;                       /* 全站统一像素倍率 ×3 */
  --ink: #000;
  --white: #f8f8f8;
  --gold: #f8d870;
  --red: #b82800;
  --blue: #0060b8;
  --sky: #98e0e0;
  --cream: #f8e0b0;
  --zh: "Fusion Pixel", monospace;
  --en: "Press Start 2P", monospace;
}
* { box-sizing: border-box; }
html { background: #98e0e0; }
body {
  min-height: 100vh; background: #98e0e0 url("assets/bg/hills_cyan.png") center bottom / 1024px auto repeat-x;
  margin: 0; color: var(--white); font: 24px/1.5 var(--zh);
  -webkit-font-smoothing: none; -webkit-text-size-adjust: 100%;
}
img { image-rendering: pixelated; image-rendering: crisp-edges; display: block; max-width: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* 手机宽度的列，平板和电脑上居中 */
#app { width: 100%; max-width: 430px; margin: 0 auto; position: relative; background: #000; overflow-x: hidden; overflow-x: clip; } /* clip 不会破坏 HUD 的 sticky */

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 4px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: #000;
  font: 10px/1.6 var(--en); text-align: center; color: var(--white);
}
.hud span { white-space: nowrap; }
.hud .left { text-align: left; }
#sound { position: fixed; right: 8px; top: calc(8px + env(safe-area-inset-top)); z-index: 30; font: 10px/1 var(--en); background: #000; border: 2px solid var(--white); padding: 6px 8px; }

/* ---------- 通用屏 ---------- */
.screen { position: relative; overflow: hidden; padding: 40px 20px; }
.screen.sky { background: var(--sky) url("assets/bg/hills_cyan.png") center bottom 96px / 1024px auto repeat-x; min-height: max(640px, 100svh); padding-bottom: 220px; }
.screen.night { background: #101840 url("assets/bg/hills_blue.png") center bottom 96px / 1024px auto repeat-x; min-height: max(640px, 100svh); padding-bottom: 220px; }
.screen.black { background: #000; }
.screen.blue { background: var(--blue); }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; background: url("assets/bg/ground_tile.png") left top / 552px 48px repeat-x, var(--cream); }
.ground.dark { background: url("assets/bg/ground_tile.png") left top / 552px 48px repeat-x, #6c4818; filter: brightness(.7); }
.stage { position: absolute; left: 0; right: 0; bottom: 96px; height: 0; }
.stage img { position: absolute; bottom: 0; }

h2.world { margin: 0 0 16px; text-align: center; font: 14px/1.6 var(--en); color: var(--gold); text-shadow: 3px 3px 0 var(--red); letter-spacing: 1px; }
.outline { color: #fff; text-shadow: 2px 2px 0 #000, -2px 0 0 #000, 0 -2px 0 #000, 2px 0 0 #000, 0 2px 0 #000; }

/* SMW 消息框：黑底、白色像素描边 */
.box { position: relative; z-index: 2; background: #000; border: 3px solid var(--white); box-shadow: 0 0 0 3px #000; padding: 14px 16px; margin: 0 0 20px; color: var(--white); }
.box h3 { margin: 0 0 6px; font-size: 24px; color: var(--gold); font-weight: normal; }
.box p { margin: 0; white-space: pre-line; }
.box .dim { color: #a8b0c8; }
.btn { display: block; width: 100%; background: #000; border: 3px solid var(--white); box-shadow: 0 0 0 3px #000; padding: 8px 12px; text-align: center; color: var(--white); text-decoration: none; margin: 0 0 14px; }
.btn.primary { background: var(--red); }
.btn.gold { background: var(--gold); color: #000; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { translate: 0 -6px; } }

/* ---------- 0 标题 ---------- */
#title { min-height: max(600px, 100svh); padding-top: 24px; padding-bottom: 0; }
.lang-picker { position: absolute; left: 8px; top: calc(8px + env(safe-area-inset-top)); z-index: 6; }
.lang-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; background: #000; border: 2px solid var(--white); font: 22px/1 sans-serif; }
.lang-options { position: absolute; top: calc(100% + 4px); left: 0; display: flex; gap: 3px; padding: 3px; background: #000; border: 2px solid var(--white); }
.lang-options button { min-width: 42px; height: 32px; padding: 2px 6px; background: #000; border: 1px solid var(--white); font-size: 14px; }
.lang-options button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #000; }
.lang-toggle:focus-visible, .lang-options button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.logo { text-align: center; position: relative; z-index: 2; }
.logo img { margin: 0 auto; }
.logo .sub { margin-top: 10px; font: 14px/1.6 var(--en); letter-spacing: 1px; }
#title .names { text-align: center; margin-top: 28px; font-size: 24px; position: relative; z-index: 2; }
#title .names b { color: var(--gold); font-weight: normal; }
#title .info { text-align: center; margin-top: 4px; position: relative; z-index: 2; }
#title .start { position: absolute; left: 0; right: 0; bottom: 60px; text-align: center; font: 14px/1 var(--en); z-index: 3; }
#title .qb { left: 50%; margin-left: -24px; bottom: 150px; animation: bob 1s steps(2) infinite; }

/* ---------- 1 WORLD 1-1 ---------- */
#intro { min-height: max(360px, 100svh); display: grid; place-content: center; text-align: center; gap: 22px; font: 14px/1.8 var(--en); }
#intro .lives { font-size: 14px; }
#intro .row { display: flex; gap: 14px; align-items: flex-end; justify-content: center; }

/* ---------- 2 请帖 ---------- */
#invite { min-height: max(700px, 100svh); }
#invite .qb-wrap { display: grid; justify-items: center; gap: 8px; margin: 12px 0 28px; position: relative; z-index: 2; }
#invite .qb-wrap img { animation: bob 1s steps(2) infinite; }
#invite .hint { font: 10px/1.6 var(--en); color: #fff; text-shadow: 2px 2px 0 #000; }
#invite .card dl { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
#invite .card dt { color: var(--gold); }
#invite .card dd { margin: 0; }

/* ---------- 3 参加吗 ---------- */
#rsvp-choice .opts { display: grid; gap: 10px; }
.opt { position: relative; text-align: left; background: none; border: 0; padding: 4px 0 4px 28px; font-size: 24px; color: var(--white); }
.opt.on::before { content: "▶"; position: absolute; left: 0; animation: blink 1s steps(1) infinite; color: var(--gold); }

/* ---------- 4 登记 ---------- */
.form label { display: block; margin: 0 0 12px; }
.form label > span { display: block; color: var(--gold); margin-bottom: 4px; }
.form input[type=text], .form textarea, .form select {
  width: 100%; background: #000; color: var(--white); border: 3px solid var(--white); border-radius: 0; padding: 6px 8px; font: inherit;
}
.form textarea { min-height: 76px; resize: vertical; }
.counter { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.counter .lbl { flex: 1; }
.counter .lbl small { display: block; color: #a8b0c8; font-size: 20px; }
.counter button { width: 44px; height: 44px; background: #000; border: 3px solid var(--white); padding: 0; font: 14px/1 var(--en); }
.counter .n { width: 36px; text-align: center; font: 14px/1 var(--en); color: var(--gold); }
.people { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; min-height: 84px; align-items: flex-end; }
.guest { border: 3px solid var(--white); padding: 10px 12px; margin: 0 0 14px; }
.guest h4 { margin: 0 0 8px; font-weight: normal; color: var(--gold); display: flex; gap: 8px; align-items: flex-end; }
.choice { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.choice .c { border: 3px solid var(--white); padding: 5px 8px; background: #000; font-size: 15px; line-height: 1.3; }
.choice .c.on { background: var(--gold); color: #000; border-color: var(--gold); }
.course { color: #a8b0c8; margin: 4px 0; }
.deadline { color: var(--gold); font-size: 20px; }

/* ---------- 旗杆 ---------- */
#flag { min-height: max(560px, 100svh); padding-top: 20px; }
#flag .clear { position: relative; z-index: 2; text-align: center; font: 16px/1.8 var(--en); margin-top: 34px; }
#flag .summary { position: relative; z-index: 2; }
#flag .pole { left: 28px; }

/* ---------- 5 小游戏占位 ---------- */
#story { padding-bottom: 140px; }
#story .stage-demo { position: relative; z-index: 2; height: 210px; border: 3px solid var(--white); background: url("assets/bg/scene_blue_sky.png") center / cover; margin-bottom: 18px; }
#story .stage-demo img { position: absolute; bottom: 36px; }
#story .pad { display: flex; justify-content: space-between; position: relative; z-index: 2; margin-top: 8px; }
#story .pad span { width: 64px; height: 64px; border: 3px solid var(--white); display: grid; place-items: center; font: 16px/1 var(--en); background: #000; }
#story .pad .a { background: var(--red); }
#story .skip { text-align: right; font: 10px/1.6 var(--en); color: var(--gold); position: relative; z-index: 2; margin-bottom: 10px; }
#story .worlds { margin: 0; padding: 0; list-style: none; position: relative; z-index: 2; }
#story .worlds li { padding: 4px 0; }
#story .worlds b { color: var(--gold); font-weight: normal; margin-right: 8px; font: 10px/1.6 var(--en); }

/* ---------- 6 世界地图 ---------- */
#map { background: #38a038; }
#map h2.world { color: #fff; }
.path { position: relative; z-index: 2; margin: 0; padding: 0 0 0 36px; list-style: none; }
.path::before { content: ""; position: absolute; left: 16px; top: 18px; bottom: 18px; width: 0; border-left: 6px dotted #f8f8f8; }
.path li { position: relative; margin-bottom: 20px; background: #000; border: 3px solid var(--white); box-shadow: 0 0 0 3px #000; padding: 8px 12px; }
.path li::before { content: ""; position: absolute; left: -35px; top: 16px; width: 24px; height: 24px; background: var(--red); border: 3px solid #fff; border-radius: 0; }
.path .t { font: 10px/1.6 var(--en); color: var(--gold); }
.path .w { font: 10px/1.6 var(--en); color: #98e0e0; margin: 2px 0 4px; }
.path .note { color: #a8b0c8; font-size: 20px; }
.mini { position: absolute; left: 4px; top: 28px; z-index: 3; }

/* ---------- 7 水管·交通 ---------- */
#pipe { padding-bottom: 140px; }
.pipe-top { display: grid; justify-items: center; gap: 8px; position: relative; z-index: 2; margin: 8px 0 24px; }

/* ---------- 8 结尾 ---------- */
#end { padding: 52px 20px 340px; text-align: center; min-height: max(640px, 100svh); }
#end .thanks { position: relative; z-index: 2; font: 12px/2 var(--en); }
#end .roll { position: relative; z-index: 2; margin: 24px 0; display: grid; gap: 10px; }
#end .castle { position: relative; z-index: 2; }

/* ---------- 9 遗憾 ---------- */
#sad { min-height: max(640px, 100svh); }
#sad .big { position: relative; z-index: 2; text-align: center; font-size: 40px; margin: 0 0 8px; color: var(--gold); }

[hidden] { display: none !important; }
html { scroll-padding-top: 52px; }
.start { background: none; border: 0; }
.block-btn { background: none; border: 0; padding: 0; display: block; }
.block-zone { position: relative; width: 160px; height: 190px; }
.block-zone .block-btn { position: absolute; left: 56px; top: 14px; }
.block-zone .hopper { position: absolute; left: 56px; bottom: 0; cursor: pointer; }
.block-zone .reward { position: absolute; left: 56px; top: 14px; z-index: 1; }
.block-zone.bump .block-btn { animation: bump .25s steps(3); }
.block-zone.hop .hopper { animation: hop .5s steps(5); }
.block-zone.hop .hopper { z-index: 3; }
.reward.pop { animation: pop .6s steps(6) forwards; }
@keyframes bump { 50% { translate: 0 -12px; } }
@keyframes hop { 40% { translate: 0 -42px; } 60% { translate: 0 -42px; } }
@keyframes pop { from { translate: 0 0; } to { translate: 0 -56px; } }
.qb-wrap { margin-bottom: 8px; }
.err { position: relative; z-index: 2; margin: 0 0 10px; min-height: 0; color: #f8d870; background: #b82800; padding: 0; }
.err:not(:empty) { padding: 6px 10px; border: 3px solid #fff; }
.guest.bad, .choice.bad { outline: 3px solid #f83800; }
.choice .c { cursor: pointer; font-family: inherit; color: var(--white); }
.guest label.bad input { border-color: #f83800; }
.slider { left: 134px; bottom: 360px; }
.slider.go { animation: slide 1.6s steps(18) forwards; }
@keyframes slide { to { bottom: 0; } }
.fireworks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.fireworks i { position: absolute; width: 6px; height: 6px; background: #f8d870; animation: burst 1s steps(6) forwards; }
@keyframes burst { to { translate: var(--dx) var(--dy); opacity: 0; } }
#iris { position: fixed; inset: 0; z-index: 100; background: #000; pointer-events: none; clip-path: circle(0 at 50% 50%); transition: clip-path .55s steps(8); }
#iris.on { clip-path: circle(150vmax at 50% 50%); pointer-events: auto; }
.endbtns { padding: 16px 20px; background: #000; }
.foot { text-align: center; color: #8890a8; font-size: 20px; padding: 16px 0 32px; background: #000; }
.skiplinks { position: sticky; bottom: 0; z-index: 30; display: flex; gap: 6px; padding: 8px; background: #000; border-top: 3px solid #fff; overflow-x: auto; font: 9px/1 var(--en); }
.skiplinks a { color: #fff; border: 2px solid #fff; padding: 6px 8px; text-decoration: none; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
#choice-mario.jump { animation: hop2 .5s steps(5); }
@keyframes hop2 { 50% { translate: 0 -72px; } }
.zh { font-family: var(--zh); font-size: 18px; }

/* ---------- 小游戏浮层 ---------- */
body.playing { overflow: hidden; }
#game { position: fixed; inset: 0; z-index: 90; background: #98e0e0; display: flex; flex-direction: column; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
#g-hud { width: 100%; max-width: 430px; display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; font: 10px/1.6 var(--en); color: #fff; }
#g-hud button, #g-skipall { background: #000; color: var(--gold); border: 2px solid var(--gold); font: 9px/1 var(--en); padding: 6px 8px; }
#g-canvas { position: relative; flex: none; border: 0; background: #000; }
#g-canvas canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#g-msg { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); width: min(340px, 92vw); z-index: 5; background: #000; border: 3px solid #fff; box-shadow: 0 0 0 3px #000; padding: 10px 14px; font-size: 22px; line-height: 1.4; }
#g-banner { position: absolute; left: 0; right: 0; top: 40%; z-index: 6; text-align: center; font: 18px/1.6 var(--en); color: #fff; text-shadow: 3px 3px 0 #b82800; pointer-events: none; }
#g-pad { width: 100%; max-width: 430px; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); margin-top: auto; }
#g-pad .dir, #g-pad .act { display: flex; gap: min(12px, 2.5vw); }
#g-pad button { width: min(68px, 15vw); height: min(68px, 15vw); background: #000; color: #fff; border: 3px solid #fff; font: 16px/1 var(--en); touch-action: none; }
#g-pad button.a { background: var(--red); }
#g-pad button.on { background: var(--gold); color: #000; }
#g-story { position: absolute; inset: 0; z-index: 8; background: #101840; display: flex; flex-direction: column; justify-content: center; padding: 32px 28px; gap: 18px; cursor: pointer; }
#g-story-title { font: 12px/1.8 var(--en); color: var(--gold); text-shadow: 2px 2px 0 var(--red); min-height: 22px; }
#g-story-text { margin: 0; font-size: 26px; line-height: 1.7; white-space: pre-line; min-height: 200px; }
#g-story-hint { font: 10px/1.6 var(--en); color: #98e0e0; text-align: right; }
#g-skipall { position: absolute; right: 12px; top: calc(10px + env(safe-area-inset-top)); }
[data-cfg], #invite .card dd { white-space: pre-line; }
#g-pad button.a { width: min(104px, 24vw); font-size: 12px; }
#g-pad button.t { width: min(104px, 24vw); font-size: 11px; }
.stage .cap { position: absolute; bottom: -46px; transform: translateX(-50%); text-align: center; font-size: 22px; line-height: 1.15; z-index: 5; text-shadow: 2px 2px 0 #000; white-space: nowrap; }
.stage .cap small { display: block; color: var(--gold); font-size: 18px; }

#end .poem { padding: 22px 18px 8px; margin-bottom: 0; }
#end .poem p { margin: 0 0 12px; font-size: 20px; line-height: 1.6; }

#end .poem { background: transparent; color: #4a2c10; border: 20px solid transparent; border-image: url("assets/bg/frame_ornate.png") 10 fill / 20px / 0 round; box-shadow: none; image-rendering: pixelated; }
#end .poem p.last { color: #4a2c10; }
#end .poem .gold { color: var(--red); }
#pipe .box { background: #000; }
/* 矮屏手机（视口高 ≤ 700）：标题页收紧一点，问号砖块不压住地址 */
@media (max-height: 700px) {
  #title { padding-top: 12px; }
  #title .names { margin-top: 12px; }
  #title .qb { bottom: 112px !important; }
  #title .stage img[src*="heart"] { bottom: 84px !important; }
}
