/* 小鲸鱼的射击 · 样式：深蓝夜空 + 鲸鱼蓝白 */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: #03081a;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #eaf2ff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(77, 107, 254, 0.22), transparent 60%),
    #03081a;
  touch-action: none;
}

#stage {
  position: relative;
  overflow: hidden;
  background: #06163a;
  touch-action: none;
  cursor: grab;
}
#stage:active { cursor: grabbing; }

@media (min-width: 600px) and (min-height: 700px) {
  #stage {
    border-radius: 18px;
    box-shadow: 0 0 0 1px rgba(160, 190, 255, 0.14), 0 24px 70px rgba(0, 0, 0, 0.55);
  }
}

#game {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  touch-action: none;
}

/* ---------- 受伤红屏 ---------- */
.hurt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 70, 100, 0.6));
}
.hurt.on { animation: hurt 0.45s ease-out; }
@keyframes hurt {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 62px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(8, 24, 70, 0.55);
  border: 1px solid rgba(170, 200, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stat .label {
  font-size: 11px;
  color: #a9c4ff;
  letter-spacing: 1px;
}
.stat b {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1.15;
}

.hp {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(8, 24, 70, 0.55);
  border: 1px solid rgba(170, 200, 255, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  min-width: 0;
}
.heart {
  font-size: 19px;
  line-height: 1.25;
  color: #ff5d7a;
  text-shadow: 0 0 8px rgba(255, 93, 122, 0.6);
  transition: color 0.2s, text-shadow 0.2s;
}
.heart.off {
  color: rgba(255, 255, 255, 0.18);
  text-shadow: none;
}

.btn-icon {
  pointer-events: auto;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(190, 215, 255, 0.4);
  background: rgba(20, 50, 130, 0.6);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn-icon:active { transform: scale(0.94); }

/* BOSS 血条 */
.boss-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(8, 10, 40, 0.6);
  border: 1px solid rgba(255, 120, 150, 0.3);
}
.boss-tag {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffb3c6;
}
.boss-bar {
  position: relative;
  flex: 1;
  height: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.boss-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff7a2e, #e0507a, #8b3dff);
  transition: width 0.2s ease-out;
}
/* 阶段分割线（1/3、2/3） */
.boss-bar::before,
.boss-bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
  z-index: 1;
}
.boss-bar::before { left: 33.33%; }
.boss-bar::after { left: 66.66%; }

/* buff 标签 */
.buffs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}
.buff {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 30, 80, 0.7);
  border: 1px solid rgba(160, 200, 255, 0.35);
  color: #eaf2ff;
  font-variant-numeric: tabular-nums;
}
.buff.sh { border-color: rgba(79, 227, 255, 0.7); color: #9ef0ff; }
.buff.fr { border-color: rgba(255, 154, 61, 0.7); color: #ffc38a; }
.buff.rp { border-color: rgba(255, 225, 107, 0.7); color: #ffe89a; }

/* 底部按钮 */
.hud-bottom {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pill {
  pointer-events: auto;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(190, 215, 255, 0.4);
  background: rgba(20, 50, 130, 0.6);
  color: #eaf2ff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
.pill:active { transform: scale(0.95); }
.pill.on {
  background: linear-gradient(135deg, #5c7cff, #4d6bfe);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 14px rgba(77, 107, 254, 0.6);
}
.pill-bomb {
  background: linear-gradient(135deg, #ffd54a, #ffb020);
  border-color: rgba(255, 240, 180, 0.8);
  color: #3a2600;
  box-shadow: 0 0 14px rgba(255, 210, 80, 0.45);
}
.pill-bomb:disabled {
  background: rgba(20, 50, 130, 0.6);
  border-color: rgba(190, 215, 255, 0.3);
  color: #eaf2ff;
  box-shadow: none;
  opacity: 0.45;
}
.pill:disabled { cursor: default; }

/* 提示 */
.toast {
  position: absolute;
  left: 50%;
  top: 36%;
  z-index: 3;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7), 0 0 20px rgba(77, 107, 254, 0.8);
}
.toast.show { animation: toast 1.6s ease forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  22% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -80%); }
}

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 10, 32, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.card {
  width: 100%;
  max-width: 310px;
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  padding: 24px 20px 22px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(60, 100, 220, 0.5), rgba(10, 26, 74, 0.82));
  border: 1px solid rgba(190, 215, 255, 0.28);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #9fbcff;
  margin-bottom: 4px;
}

.card h1 {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffffff 30%, #9cc2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}

.card h2 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  margin-bottom: 8px;
}

.lead {
  font-size: 14px;
  line-height: 1.7;
  color: #cfe0ff;
  margin-bottom: 14px;
}

.legend {
  list-style: none;
  text-align: left;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(3, 12, 40, 0.45);
  border: 1px solid rgba(170, 200, 255, 0.15);
}
.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  padding: 5px 0;
  color: #e4eeff;
}
.ic {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}
.ic-fire { background: #ff9a3d; }
.ic-shield { background: #4fe3ff; color: #05375a; }
.ic-heal { background: #5cf08c; color: #0b4a22; }
.ic-bomb { background: #ffe16b; color: #5a4300; }

.tips {
  font-size: 12px;
  line-height: 1.8;
  color: #a9c4ff;
  margin-bottom: 16px;
}

.btn-primary {
  display: block;
  width: 100%;
  min-height: 54px;
  margin: 0 auto 10px;
  border: none;
  border-radius: 27px;
  background: linear-gradient(135deg, #7d96ff, #4d6bfe);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(77, 107, 254, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  display: block;
  width: 100%;
  min-height: 50px;
  border-radius: 25px;
  border: 1px solid rgba(190, 215, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf2ff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn-ghost:active { transform: scale(0.97); }

.best-line {
  margin-top: 10px;
  font-size: 13px;
  color: #a9c4ff;
}
.best-line b {
  color: #ffffff;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.score-box {
  margin: 8px 0 12px;
  padding: 14px 10px;
  border-radius: 18px;
  background: rgba(3, 12, 40, 0.45);
  border: 1px solid rgba(170, 200, 255, 0.18);
}
.score-box .label {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: #a9c4ff;
}
.score-box b {
  display: block;
  font-size: 54px;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(77, 107, 254, 0.8);
}

.new-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #3a2600;
  background: linear-gradient(135deg, #ffd54a, #ffb020);
  vertical-align: middle;
}

/* 小屏幕微调 */
@media (max-width: 360px) {
  .stat { min-width: 54px; }
  .stat b { font-size: 17px; }
  .card h1 { font-size: 30px; }
}

/* ---------- 难度 ---------- */
.diff-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 16px;
  vertical-align: 1px;
  color: #cfe0ff;
  background: rgba(120, 150, 220, 0.3);
  border: 1px solid rgba(170, 200, 255, 0.4);
}
.diff-tag.hard {
  color: #ffe0e8;
  background: linear-gradient(135deg, #ff5d7a, #e0307a);
  border-color: rgba(255, 200, 215, 0.7);
  box-shadow: 0 0 10px rgba(255, 93, 122, 0.55);
}
.diff-wrap { margin: 0 0 14px; }
.diff-title {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: #a9c4ff;
  margin-bottom: 6px;
}
.diff-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(3, 12, 40, 0.5);
  border: 1px solid rgba(170, 200, 255, 0.2);
}
.diff-btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #cfe0ff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, color 0.2s;
}
.diff-btn:active { transform: scale(0.96); }
.diff-btn.on {
  color: #ffffff;
  background: linear-gradient(135deg, #7d96ff, #4d6bfe);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 18px rgba(77, 107, 254, 0.5);
}
.diff-btn[data-diff="hard"].on {
  background: linear-gradient(135deg, #ff7a8f, #e0307a);
  box-shadow: 0 6px 18px rgba(255, 93, 122, 0.5);
}
.diff-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #a9c4ff;
}
.run-stats {
  display: flex;
  gap: 10px;
  margin: 6px 0 10px;
}
.run-stats span {
  flex: 1;
  padding: 8px 6px;
  border-radius: 14px;
  background: rgba(3, 12, 40, 0.45);
  border: 1px solid rgba(170, 200, 255, 0.15);
  font-size: 12px;
  color: #a9c4ff;
}
.run-stats b {
  display: block;
  font-size: 20px;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
