@font-face { font-family: "Fredoka"; src: url("fonts/fredoka.woff") format("woff"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "ZCOOL KuaiLe"; src: url("fonts/zcool-kuaile.woff") format("woff"); font-weight: 400 700; font-display: swap; }
:root {
  --ink: #2B2540; --blob: #FFC83D; --cream: #FFF7EA; --ui: #FFC83D;
  --font: "Fredoka", "ZCOOL KuaiLe", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #0c0b12; overflow: hidden; font-family: var(--font); font-synthesis: none;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none;
}
button { font-family: inherit; color: var(--ink); cursor: pointer; }
[hidden] { display: none !important; }
#app { position: relative; height: 100vh; height: 100dvh; max-width: 480px; margin: 0 auto; background: #131417; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.round {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink);
  background: var(--cream); padding: 7px; box-shadow: 0 3px 0 var(--ink);
}
.round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.round svg { width: 100%; height: 100%; display: block; }
#hud { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
#hud .round { pointer-events: auto; }
#app:not([data-scene="play"]) #hud, #app:not([data-scene="play"]) #pad, #app:not([data-scene="play"]) #banner, #app[data-ending] #pad, #app[data-ending] #hud, #app[data-clean] #pad, #app[data-clean] #hud, #app[data-clean] #banner { display: none; }
#app[data-bright] .key:not(#key-jump) { background: rgba(43, 37, 64, 0.42); border-color: #2B2540; box-shadow: 0 6px 0 #2B2540; }
#app[data-bright] .key:not(#key-jump).on { background: rgba(43, 37, 64, 0.6); box-shadow: 0 2px 0 #2B2540; }

#banner {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 74px); transform: translate(-50%, -30px); opacity: 0;
  display: flex; align-items: center; gap: 10px; padding: 7px 18px 7px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); color: var(--ink); font-size: 19px; font-weight: 600; pointer-events: none;
}
#banner b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ui); border: 2.5px solid var(--ink); font-size: 17px; }
#banner.show { animation: banner 2.4s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
@keyframes banner { 0% { transform: translate(-50%, -30px); opacity: 0; } 12%, 78% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -16px); opacity: 0; } }

#pad { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 26px); display: flex; justify-content: space-between; align-items: center; padding: 0 18px; }
#dpad { display: flex; gap: 10px; touch-action: none; }
.key {
  width: 84px; height: 84px; border-radius: 26px; border: 3px solid #0d0b16; background: rgba(255, 247, 234, 0.16); color: var(--cream);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 0 #0d0b16, inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  touch-action: none; cursor: pointer; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.key svg { width: 44px; height: 44px; pointer-events: none; }
.key.on { transform: translateY(4px); box-shadow: 0 2px 0 #0d0b16; background: rgba(255, 247, 234, 0.34); }
#key-jump { width: 96px; height: 96px; border-radius: 50%; background: var(--blob); color: var(--ink); box-shadow: 0 6px 0 #0d0b16, 0 0 26px rgba(255, 200, 61, 0.35); }
#key-jump.on { background: #FFE07A; box-shadow: 0 2px 0 #0d0b16, 0 0 34px rgba(255, 200, 61, 0.6); }

.big {
  width: 100%; height: 62px; border-radius: 20px; border: 3.5px solid var(--ink); background: var(--blob);
  font-size: 24px; font-weight: 700; letter-spacing: 1px; box-shadow: 0 6px 0 var(--ink);
}
.big:active, .mid:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.mid { flex: 1; height: 50px; border-radius: 16px; border: 3px solid var(--ink); background: var(--blob); font-size: 18px; font-weight: 600; box-shadow: 0 5px 0 var(--ink); }
.ghost { background: var(--cream); }

/* 标题页 */
.screen { position: absolute; inset: 0; }
#title { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 0 28px calc(env(safe-area-inset-bottom, 0px) + 46px); background: linear-gradient(180deg, rgba(8, 6, 16, 0.78) 0%, rgba(8, 6, 16, 0.25) 34%, rgba(8, 6, 16, 0) 52%, rgba(8, 6, 16, 0.5) 72%, rgba(8, 6, 16, 0.86) 100%); }
#title .btn-mute { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; }
.btn-mute .cross { display: none; } .btn-mute.off .cross { display: block; } .btn-mute.off .wave { display: none; }
.logo-wrap { margin-top: 11vh; text-align: center; }
.logo {
  margin: 0; font-size: min(22vw, 104px); line-height: 1.1; font-weight: 700; letter-spacing: 1px; color: var(--blob); white-space: nowrap;
  -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; transform: rotate(-4deg);
  text-shadow: 0 7px 0 var(--ink), 0 0 42px rgba(255, 200, 61, 0.55);
  animation: logo 3.2s ease-in-out infinite;
}
html[lang="en"] .logo { font-size: min(23vw, 108px); letter-spacing: 0; }
@keyframes logo { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-3deg) translateY(-7px); } }
.tagline { margin: 22px 0 0; color: var(--cream); font-size: 17px; letter-spacing: 1px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
#btn-play { max-width: 300px; height: 70px; font-size: 28px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }

/* 地图：从山底往山顶 */
#map { display: flex; flex-direction: column; background: linear-gradient(0deg, #17181c 0%, #1e1633 14%, #16423C 26%, #3B1414 38%, #132A4A 50%, #59401f 61%, #4FA3E3 72%, #59253A 82%, #0F172A 91%, #EA580C 100%); }
#map::before { content: ""; position: absolute; inset: 0; background: rgba(8, 6, 16, 0.42); }
#map header { position: relative; display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 6px; }
#map h2 { margin: 0; flex: 1; color: var(--cream); font-size: 26px; font-weight: 600; text-shadow: 0 3px 0 var(--ink); }
#map-stars { display: flex; align-items: center; gap: 6px; padding: 5px 14px 5px 8px; border-radius: 999px; background: var(--cream); border: 3px solid var(--ink); font-size: 18px; font-weight: 600; box-shadow: 0 3px 0 var(--ink); }
#map-stars svg { width: 24px; height: 24px; }
#map-list { position: relative; flex: 1; display: flex; flex-direction: column-reverse; padding: 4px 22px calc(env(safe-area-inset-bottom, 0px) + 14px); min-height: 0; }
.node { flex: 1; min-height: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; text-align: left; color: var(--cream); }
.node.r { flex-direction: row-reverse; text-align: right; }
.node.l { padding-right: 22%; } .node.r { padding-left: 22%; }
.node i {
  flex: none; display: grid; place-items: center; height: 84%; max-height: 62px; aspect-ratio: 1; border-radius: 50%; font-style: normal;
  background: radial-gradient(circle at 35% 30%, var(--b), var(--a)); border: 3.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink), 0 0 0 3px rgba(255, 247, 234, 0.85);
}
.node i b { font-size: 24px; font-weight: 700; color: #fff; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.node .nm { font-size: 18px; font-weight: 600; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7); white-space: nowrap; }
.node .st { display: flex; } .node .st svg { width: 19px; height: 19px; margin: 0 -1px; }
.node.locked i { background: #3a3648; box-shadow: 0 4px 0 var(--ink); } .node.locked i b { color: #8d879c; }
.node.locked .nm { opacity: 0.5; letter-spacing: 2px; }
.node.here i { animation: here 1.2s ease-in-out infinite; }
@keyframes here { 0%, 100% { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px var(--blob), 0 0 0 0 rgba(255, 200, 61, 0.7); } 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px var(--blob), 0 0 0 12px rgba(255, 200, 61, 0); } }
.node:not(.locked):active i { transform: translateY(3px); }

/* 结算 */
#panel, #ending { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
#ending { background: rgba(255, 244, 205, 0.35); }
.card {
  width: 100%; max-width: 330px; background: var(--cream); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 0 9px 0 var(--ink), 0 0 60px rgba(255, 200, 61, 0.25);
  padding: 22px 22px 24px; text-align: center; color: var(--ink); animation: pop 0.32s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.75) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
#stars { display: flex; justify-content: center; gap: 6px; height: 64px; margin-top: -4px; }
#stars span { width: 60px; height: 60px; } #stars span:nth-child(2) { transform: translateY(-8px); }
#stars svg { width: 100%; height: 100%; }
#stars span.on svg { animation: star 0.45s cubic-bezier(0.2, 1.8, 0.4, 1) both; animation-delay: inherit; }
@keyframes star { from { transform: scale(0) rotate(-140deg); } to { transform: none; } }
#result { font-size: 29px; font-weight: 700; margin-top: 12px; }
#best { font-size: 16px; margin-top: 4px; opacity: 0.66; min-height: 22px; }
#quote { margin: 14px 0 0; padding: 10px 12px; border-radius: 14px; background: #f3e6cf; font-size: 16px; font-family: "ZCOOL KuaiLe", var(--font); }
#btn-next { margin-top: 18px; }
.row { display: flex; gap: 12px; margin-top: 14px; }
.card.dawn { background: linear-gradient(180deg, #FFF7EA 0%, #FFE9B8 100%); }
#end-title { font-size: 44px; font-weight: 700; color: var(--ink); }
#end-line { font-size: 19px; margin-top: 4px; }
#end-stat { font-size: 21px; font-weight: 600; margin-top: 20px; }
#end-best { font-size: 15px; opacity: 0.7; margin-top: 4px; }
#btn-share { margin-top: 20px; font-size: 20px; }
#btn-end-map { width: 100%; margin-top: 14px; flex: none; }
#end-toast { min-height: 20px; margin-top: 10px; font-size: 14px; opacity: 0.75; }
@media (prefers-reduced-motion: reduce) { .card, .logo, #btn-play, .node.here i { animation: none; } }
