/*
 * 气球射手（BALLOON POP）· 样式
 *
 * 版面只有四层，**整页不滚动**（手机上瞄准时页面跟着动是最难受的）：
 *   顶栏（按钮） / 副栏（心 + 分数） / 瞄准方式一行 / 游戏区（吃掉剩下的全部空间）
 * 画布的尺寸不是 CSS 定的，是 `game.mjs` 的 `layout()` 按可用空间算出来写上去的
 * （玩法坐标固定 360 宽，纵向按屏幕比例拉伸，所以任何手机上都不留黑边）。
 */

/* ① [hidden] 必须压过作者样式 —— 下面的 .scores / .overlay / .title 都写了 display:flex，
      浏览器给 [hidden] 的 display:none 会被盖掉 → 面板一进页面就浮着、点「关闭」没反应。 */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b1a2b;
  color: #e8f2ff;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.balloon-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 2px;
  flex: 0 0 auto;
}

.back-link {
  color: #bfe0ff;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.back-link:active { background: rgba(255, 255, 255, 0.18); }

.tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  min-width: 34px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #eaf4ff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn--wide {
  font-size: 12px;
  padding: 0 8px;
}

.icon-btn:active { transform: translateY(1px); }

.icon-btn--off { opacity: 0.45; }

/* ---------- 副栏：心 + 分数 ---------- */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 12px;
  flex: 0 0 auto;
}

.hearts {
  margin: 0;
  font-size: 15px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.22);
}

.heart--on { color: #fb7185; }

.stat {
  margin: 0;
  font-size: 12px;
  color: #9fc4e8;
  white-space: nowrap;
}

.stat__value {
  color: #ffffff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}

.stat__value:first-child { margin-left: 0; }

.stat__value--combo { color: #fde047; }

.stat__sep { margin: 0 4px; opacity: 0.45; }

.stat__label { margin-left: 1px; }

.mode {
  margin: 0;
  padding: 0 12px 3px;
  font-size: 11px;
  color: #7fa8cc;
  text-align: center;
  flex: 0 0 auto;
}

/* ---------- 游戏区 ---------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.board {
  display: block;
  border-radius: 14px;
  background: #7cc4f0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  /* 瞄准全靠手指在画布上：禁掉浏览器的滚动 / 缩放 / 选中 */
  touch-action: none;
  cursor: crosshair;
}

/* ---------- 提示条 ---------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  max-width: 88%;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(12, 26, 43, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eaf4ff;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

/* ---------- 通用按钮 ---------- */

.btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.1);
  color: #eaf4ff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(180deg, #ffd166, #f97316);
  border-color: rgba(255, 255, 255, 0.35);
  color: #3b1d05;
  font-weight: 700;
}

.btn--ghost {
  background: transparent;
  color: #bfe0ff;
}

.btn--small { padding: 8px 14px; font-size: 14px; }

/* ---------- 覆盖面板：暂停 / 结束 / 主界面 / 高分榜 ---------- */

.overlay,
.title,
.scores {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  background: rgba(8, 20, 34, 0.82);
  backdrop-filter: blur(2px);
  border-radius: 14px;
}

.overlay__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.overlay__stats {
  margin: 0;
  font-size: 13px;
  color: #cfe4f7;
  line-height: 1.6;
}

.overlay__tip {
  margin: 0;
  font-size: 12px;
  color: #8fb4d4;
}

.overlay__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.save-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-row__input {
  width: 132px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 15px;
  font-family: inherit;
}

/* ---------- 主界面 ---------- */

.title__card {
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.title__balloons {
  margin: 0;
  font-size: 30px;
  letter-spacing: 4px;
}

.title__name {
  margin: 6px 0 2px;
  font-size: 26px;
  letter-spacing: 2px;
}

.title__sub {
  margin: 0 0 10px;
  font-size: 11px;
  color: #8fb4d4;
  letter-spacing: 1px;
}

.title__rules {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 13px;
  line-height: 1.75;
  color: #d6e8f8;
}

.title__rules b { color: #ffd166; }

.title__btn { min-width: 190px; }

.title__hint {
  margin: 0;
  max-width: 320px;
  font-size: 11px;
  color: #7fa8cc;
  line-height: 1.5;
}

/* ---------- 高分榜 ---------- */

.scores__title {
  margin: 0;
  font-size: 18px;
}

.scores__note {
  margin: 0;
  font-size: 11px;
  color: #8fb4d4;
}

.scores__list {
  margin: 0;
  padding: 0;
  list-style: none;
  width: min(320px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scores__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.scores__rank {
  width: 18px;
  color: #ffd166;
  font-weight: 700;
}

.scores__name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.scores__meta {
  color: #8fb4d4;
  font-size: 11px;
  white-space: nowrap;
}

.scores__score {
  min-width: 46px;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.scores__empty {
  padding: 10px;
  color: #8fb4d4;
  font-size: 13px;
}
