* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #070B18; color: #F4F1EA;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

.stage { position: fixed; inset: 0; overflow: hidden; background: #070B18; }

/* ============ 场景 ============ */
.scene { position: absolute; inset: 0; }

.sky {
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, #24325C 0%, #16203C 38%, #0C1226 68%, #070B18 100%);
}

.moon {
  position: absolute; top: 7%; right: 11%;
  width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #FFF6D8 0%, #FFD98A 55%, #F2B45C 100%);
  box-shadow: 0 0 26px rgba(255, 214, 138, .55), 0 0 70px rgba(255, 190, 110, .28);
}

.stars { position: absolute; inset: 0; }
.star {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: #FFF7E0; opacity: .8;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: .95; transform: scale(1.15); } }

.fog {
  position: absolute; left: -10%; right: -10%; bottom: 0; height: 46%;
  background: radial-gradient(60% 100% at 50% 100%, rgba(255, 138, 61, .16) 0%, rgba(255, 138, 61, 0) 70%);
  pointer-events: none;
}

.ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: linear-gradient(180deg, #1B2A3A 0%, #131E2C 45%, #0A111C 100%);
  border-top: 2px solid rgba(255, 138, 61, .18);
}

/* 房子 */
.house { position: absolute; left: 6%; bottom: 30%; width: 34%; max-width: 210px; }
.roof {
  width: 100%; height: 60px;
  background: linear-gradient(180deg, #4A3358 0%, #33243F 100%);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
}
.wall {
  position: relative; height: 92px; margin: 0 8%;
  background: linear-gradient(180deg, #2C3A52 0%, #1E2938 100%);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.window {
  position: absolute; top: 16px; width: 26px; height: 26px; border-radius: 4px;
  background: radial-gradient(circle at 50% 40%, #FFD98A 0%, #FF8A3D 100%);
  box-shadow: 0 0 14px rgba(255, 160, 80, .75);
  animation: flicker 4.5s ease-in-out infinite;
}
.window.win-a { left: 14%; }
.window.win-b { right: 14%; animation-delay: 1.6s; }
@keyframes flicker { 0%,100% { opacity: .95; } 45% { opacity: .62; } 70% { opacity: .88; } }
.door {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 34px; height: 50px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #3B2A22 0%, #241812 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .22);
}

/* 树 */
.trees { position: absolute; inset: 0; pointer-events: none; }
.tree {
  position: absolute; bottom: 26%; width: 0; height: 0;
  border-left: 26px solid transparent; border-right: 26px solid transparent;
  border-bottom: 74px solid #16283A;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.5));
}
.tree.t1 { right: 7%; transform: scale(1.15); }
.tree.t2 { right: 25%; bottom: 24%; transform: scale(.8); border-bottom-color: #12202F; }
.tree.t3 { left: 44%; bottom: 27%; transform: scale(.62); border-bottom-color: #12202F; }

/* ============ HUD ============ */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none; z-index: 20;
}
.hud-left { display: flex; gap: 8px; }
.hud-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(12, 18, 34, .62);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 600; color: #F4F1EA;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.hud-chip i { font-size: 16px; color: #FF8A3D; }
.hud-chip.timer i { color: #FFD98A; }
.hud-chip.timer.warn { border-color: rgba(255, 90, 90, .6); }
.hud-chip.timer.warn i, .hud-chip.timer.warn span { color: #FF7A7A; }

.progress-wrap {
  position: absolute; left: 16px; right: 16px;
  top: calc(env(safe-area-inset-top, 0px) + 54px);
  z-index: 20; pointer-events: none;
}
.progress-bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4);
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #FF8A3D 0%, #FFC46B 100%);
  box-shadow: 0 0 12px rgba(255, 138, 61, .7);
  transition: width .28s ease;
}
.progress-label {
  margin-top: 6px; font-size: 11px; letter-spacing: .04em;
  color: rgba(244, 241, 234, .62); text-align: center;
}

/* ============ 怪物 ============ */
.monster {
  position: absolute; width: 92px; height: 92px;
  left: 50%; top: 30%; transform: translate(-50%, -50%);
  z-index: 12; pointer-events: none;
}
.monster-glow {
  position: absolute; inset: -26px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 60, 60, .34) 0%, rgba(255, 60, 60, 0) 68%);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.12); opacity: 1; } }
.monster-body {
  position: absolute; inset: 0; border-radius: 50% 50% 44% 44%;
  background: radial-gradient(circle at 36% 28%, #6B2A4A 0%, #3A1230 55%, #1B0718 100%);
  box-shadow: inset 0 -8px 18px rgba(0,0,0,.6), 0 10px 26px rgba(0,0,0,.55);
  border: 1px solid rgba(255, 90, 90, .28);
}
.monster-eye {
  position: absolute; top: 32%; width: 20px; height: 20px; border-radius: 50%;
  background: #FFF3D6; box-shadow: 0 0 12px rgba(255, 220, 150, .8);
}
.monster-eye.e1 { left: 20%; }
.monster-eye.e2 { right: 20%; }
.monster-eye span {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #C81E3C;
  animation: eyeMove 2.4s ease-in-out infinite;
}
@keyframes eyeMove { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
.monster-mouth {
  position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
  width: 34px; height: 12px; border-radius: 0 0 16px 16px;
  background: #12040F;
  box-shadow: inset 0 3px 0 rgba(255, 90, 90, .5);
}

/* ============ 玩家 ============ */
.player {
  position: absolute; width: 58px; height: 58px;
  left: 50%; top: 70%; transform: translate(-50%, -50%);
  z-index: 14; pointer-events: none;
  transition: filter .2s ease;
}
.player-body {
  position: absolute; inset: 0; border-radius: 46% 46% 40% 40%;
  background: linear-gradient(180deg, #FFB067 0%, #FF8A3D 62%, #E86F22 100%);
  box-shadow: inset 0 -6px 12px rgba(180, 80, 20, .45), 0 8px 18px rgba(0,0,0,.45);
  border: 1px solid rgba(255, 220, 180, .5);
}
.player-ear {
  position: absolute; top: -10px; width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-bottom: 16px solid #FF9A50;
}
.player-ear.l { left: 8px; transform: rotate(-14deg); }
.player-ear.r { right: 8px; transform: rotate(14deg); }
.player-face { position: absolute; inset: 0; }
.player-eye { position: absolute; top: 40%; width: 7px; height: 9px; border-radius: 50%; background: #2A1608; }
.player-eye.l { left: 26%; }
.player-eye.r { right: 26%; }
.player-nose {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  width: 8px; height: 6px; border-radius: 50%; background: #FFD9B8;
}
.player-shadow {
  position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%);
  width: 46px; height: 12px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); filter: blur(3px);
}
.player.hidden-state { filter: brightness(.45) saturate(.6); }
.player.hit { animation: hitShake .4s ease; }
@keyframes hitShake {
  0%,100% { transform: translate(-50%, -50%); }
  25% { transform: translate(calc(-50% - 6px), -50%); }
  75% { transform: translate(calc(-50% + 6px), -50%); }
}

/* ============ 躲藏点 ============ */
.spots { position: absolute; inset: 0; z-index: 10; }
.spot {
  position: absolute; width: 84px; height: 84px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(20, 30, 52, .92) 0%, rgba(12, 18, 34, .55) 62%, rgba(12, 18, 34, 0) 100%);
  border: 2px dashed rgba(255, 255, 255, .22);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.spot i { font-size: 30px; color: rgba(255, 255, 255, .5); transition: color .2s ease; }
.spot.active {
  border-color: rgba(255, 138, 61, .9);
  background: radial-gradient(circle, rgba(255, 138, 61, .3) 0%, rgba(255, 138, 61, .1) 62%, rgba(255, 138, 61, 0) 100%);
  transform: translate(-50%, -50%) scale(1.06);
}
.spot.active i { color: #FFC46B; }
.spot.done {
  border-style: solid; border-color: rgba(120, 230, 160, .8);
  background: radial-gradient(circle, rgba(120, 230, 160, .26) 0%, rgba(120, 230, 160, .06) 66%, rgba(120, 230, 160, 0) 100%);
}
.spot.done i { color: #7BE6A0; }

/* ============ 提示 ============ */
.toast {
  position: absolute; left: 50%; bottom: 12%;
  transform: translate(-50%, 12px);
  padding: 10px 18px; border-radius: 999px;
  background: rgba(12, 18, 34, .86);
  border: 1px solid rgba(255, 138, 61, .45);
  color: #FFE0C4; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; z-index: 30;
  transition: opacity .22s ease, transform .22s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 面板 ============ */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(120% 90% at 50% 30%, rgba(10, 16, 32, .72) 0%, rgba(5, 8, 18, .94) 100%);
  backdrop-filter: blur(6px);
  transition: opacity .25s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.panel {
  width: 100%; max-width: 340px;
  padding: 26px 22px 20px;
  border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, rgba(38, 48, 76, .96) 0%, rgba(20, 27, 46, .98) 100%);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.panel-badge {
  width: 62px; height: 62px; margin: -50px auto 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FF9E55 0%, #FF8A3D 55%, #E86F22 100%);
  box-shadow: 0 10px 26px rgba(255, 138, 61, .45), inset 0 1px 0 rgba(255,255,255,.4);
  border: 3px solid rgba(20, 27, 46, .95);
}
.panel-badge i { font-size: 30px; color: #2A1608; }
.panel-title {
  margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .01em;
  color: #FFF6EC; text-shadow: 0 2px 10px rgba(255, 138, 61, .35);
}
.panel-desc { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: rgba(244, 241, 234, .72); }
.panel-tips { display: flex; justify-content: center; gap: 8px; margin: 18px 0 4px; }
.tip {
  flex: 1; padding: 10px 4px; border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.tip i { font-size: 20px; color: #FF8A3D; }
.tip span { font-size: 11px; color: rgba(244, 241, 234, .78); }

.btn-primary {
  width: 100%; margin-top: 18px;
  padding: 15px 18px; border: 0; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 16px; font-weight: 800; color: #2A1608;
  background: linear-gradient(180deg, #FFB067 0%, #FF8A3D 60%, #EE7326 100%);
  box-shadow: 0 10px 24px rgba(255, 138, 61, .38), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
}
.btn-primary i { font-size: 20px; }
.btn-primary:active { transform: scale(.97); box-shadow: 0 5px 14px rgba(255, 138, 61, .3); }

.panel-foot { margin: 14px 0 0; font-size: 11px; letter-spacing: .06em; color: rgba(244, 241, 234, .42); }

.score-row { display: flex; gap: 10px; margin-top: 18px; }
.score-item {
  flex: 1; padding: 12px 6px; border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  display: flex; flex-direction: column; gap: 4px;
}
.score-num { font-size: 22px; font-weight: 800; color: #FFC46B; }
.score-label { font-size: 11px; color: rgba(244, 241, 234, .6); }

/* 横屏紧凑适配 */
@media (orientation: landscape) and (max-height: 460px) {
  .panel { max-width: 420px; padding: 18px 20px 14px; }
  .panel-badge { width: 50px; height: 50px; margin: -40px auto 8px; }
  .panel-badge i { font-size: 24px; }
  .panel-title { font-size: 19px; }
  .panel-desc { margin-top: 6px; font-size: 12px; }
  .panel-tips { margin: 12px 0 2px; }
  .tip { padding: 7px 4px; }
  .btn-primary { margin-top: 12px; padding: 12px; font-size: 15px; }
  .panel-foot { margin-top: 8px; }
  .score-row { margin-top: 12px; }
  .score-item { padding: 8px 6px; }
  .score-num { font-size: 18px; }
  .moon { width: 54px; height: 54px; }
  .monster { width: 74px; height: 74px; }
  .player { width: 48px; height: 48px; }
  .spot { width: 70px; height: 70px; }
  .spot i { font-size: 24px; }
}
