* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #052c4c; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  user-select: none; -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; }

.stage { position: fixed; inset: 0; overflow: hidden; }
.home, .game { position: absolute; inset: 0; overflow: hidden; }
.is-hidden { display: none !important; }

/* ---------- 首页：整张海底画面铺满 ---------- */
.home-art {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
}
.start-btn {
  position: absolute; left: 50%; top: 82%;
  transform: translate(-50%, -50%);
  width: min(84vw, 39vh, 390px);
  aspect-ratio: 2.05;
  padding: 0;
  border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #FFE57B 0%, #FFC72C 46%, #FF9D12 100%);
  box-shadow: 0 6px 0 #C96A00, 0 14px 30px rgba(255, 133, 20, .45), inset 0 3px 0 rgba(255, 255, 255, .75);
  color: #fff; font-size: clamp(22px, 4.4vh, 40px); font-weight: 900;
  letter-spacing: .16em; text-indent: .16em;
  text-shadow: 0 2px 0 #D97600, 0 0 10px rgba(160, 70, 0, .45);
}
.start-btn:active { transform: translate(-50%, -50%) scale(.97); }
.home-tip {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%); margin: 0;
  padding: 7px 16px; border-radius: 999px;
  background: rgba(4, 45, 78, .55);
  border: 1px solid rgba(255, 255, 255, .18);
  color: rgba(255, 255, 255, .94); font-size: 12.5px; letter-spacing: .02em;
  white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* ---------- 游戏画面 ---------- */
.game-art {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
  filter: blur(9px) brightness(.52) saturate(1.15);
  transform: scale(1.12);
}
.game-shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(10, 90, 140, .10), rgba(1, 20, 40, .35) 75%),
    linear-gradient(180deg, rgba(2, 28, 52, .18) 0%, rgba(1, 16, 34, .55) 100%);
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}
.hud button { pointer-events: auto; }
.score-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px 6px 7px; border-radius: 999px;
  background: rgba(3, 40, 70, .62);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.score-icon { width: 27px; height: 27px; border-radius: 50%; display: block; }
.score-label { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .72); letter-spacing: .08em; }
.score-num { font-size: 19px; font-weight: 900; line-height: 1; min-width: 14px; color: #fff; }
.hearts {
  display: flex; align-items: center; gap: 3px;
  padding: 7px 9px; border-radius: 999px;
  background: rgba(3, 40, 70, .42);
  border: 1px solid rgba(255, 255, 255, .16);
}
.heart { width: 15px; height: 15px; color: #FF6B6B; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); transition: color .18s; }
.heart.lost { color: rgba(255, 255, 255, .22); }
.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(3, 40, 70, .6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.icon-btn .mp-icon { width: 22px; height: 22px; }
.icon-btn:active { background: rgba(255, 138, 61, .8); }

/* 左右移动 */
.controls {
  position: absolute; left: 0; right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 5; display: flex; justify-content: space-between;
  padding: 0 18px; pointer-events: none;
}
.move-btn {
  pointer-events: auto;
  width: 68px; height: 68px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(3, 40, 70, .5);
  color: #fff; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .25); touch-action: none;
}
.move-btn .mp-icon { width: 32px; height: 32px; }
.move-btn:active { background: rgba(255, 138, 61, .8); }

/* 暂停 / 结束 */
.panel {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(2, 22, 42, .5);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.sheet {
  width: 100%; max-width: 330px; padding: 26px 22px 20px;
  border-radius: 26px; text-align: center;
  background: linear-gradient(180deg, rgba(15, 78, 124, .97), rgba(5, 38, 68, .98));
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .45);
}
.sheet h2 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .08em; }
.panel-text { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: rgba(255, 255, 255, .76); }
.panel-text:empty { display: none; }
.primary-btn {
  width: 100%; height: 52px; margin-top: 20px;
  border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #FFB25C, #FF8A3D);
  color: #fff; font-size: 17px; font-weight: 800; letter-spacing: .06em;
  box-shadow: 0 5px 0 #C25714, 0 10px 20px rgba(0, 0, 0, .25);
}
.primary-btn:active { transform: translateY(2px); box-shadow: 0 3px 0 #C25714; }
.ghost-btn {
  width: 100%; height: 48px; margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .9); font-size: 15px; font-weight: 600;
}
.ghost-btn:active { background: rgba(255, 255, 255, .14); }

/* 桌面/横屏预览时保持竖屏游戏画面完整居中，不要求玩家横屏 */
@media (min-width: 700px) and (min-aspect-ratio: 1/1) {
  body { background: radial-gradient(120% 80% at 50% 0%, #0A5D8C 0%, #041D33 70%); }
  .stage {
    left: 50%; right: auto;
    width: min(430px, calc(100vh * 0.5625));
    transform: translateX(-50%);
    box-shadow: 0 0 80px rgba(0, 0, 0, .6);
  }
}
