* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #02060f;
  color: #dff2ff;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(1, 4, 10, 0.55) 100%);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0 0 auto 0;
  padding: calc(8px + env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
  font-size: 14px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
}

.hudRow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.hudRow.bottom {
  margin-top: 6px;
  align-items: center;
}

#hud .left { display: flex; gap: 12px; align-items: baseline; }
#hud .right { display: flex; gap: 10px; align-items: center; }

#hud .stat span,
#hud .power span {
  opacity: 0.5;
  font-size: 10.5px;
  margin-right: 4px;
  letter-spacing: 0.08em;
}

#hud b { font-variant-numeric: tabular-nums; font-weight: 700; }

#score { font-size: 23px; color: #7fe3ff; letter-spacing: 0.01em; }
#best { color: #9ab6d6; font-size: 13px; }

.bars { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

#hp {
  color: #ff7a9c;
  font-size: 15px;
  letter-spacing: 0.08em;
  line-height: 1.1;
  filter: drop-shadow(0 0 6px rgba(255, 110, 150, 0.45));
}

#bombs { color: #ffd166; font-size: 12.5px; letter-spacing: 0.04em; }

#pauseBtn {
  pointer-events: auto;
  padding: 6px 13px;
  font-size: 12px;
  color: #cfe9ff;
  background: rgba(26, 68, 112, 0.5);
  border: 1px solid rgba(120, 200, 255, 0.34);
  border-radius: 999px;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}

#pauseBtn:active {
  background: rgba(58, 128, 198, 0.7);
  transform: scale(0.96);
}

/* 火力条 */
.power {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #9fe8ff;
  font-size: 11px;
}

.power b { font-size: 12px; color: #bfefff; min-width: 14px; }

.pwbar {
  display: block;
  position: relative;
  width: 78px;
  height: 5px;
  border-radius: 999px;
  background: rgba(120, 190, 240, 0.22);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(150, 220, 255, 0.12);
}

.pwbar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #63d2ff, #b6f0ff);
  box-shadow: 0 0 8px rgba(120, 220, 255, 0.7);
  transition: width 0.22s ease;
}

#weapon {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #bff2ff;
  background: rgba(16, 48, 82, 0.6);
  border: 1px solid rgba(120, 210, 255, 0.28);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s, transform 0.2s;
}

#weapon.on { opacity: 1; transform: translateY(0); }

/* ---------- 技能轮盘 ---------- */
#wheelLayer {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 18, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity 0.15s ease;
}

#wheelLayer.hidden {
  opacity: 0;
  pointer-events: none;
}

#wheel {
  position: absolute;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
}

.abil {
  position: absolute;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  font-family: inherit;
  color: #d8f1ff;
  background: radial-gradient(circle at 50% 35%, rgba(64, 146, 216, 0.96), rgba(11, 30, 56, 0.97));
  border: 1px solid rgba(130, 215, 255, 0.5);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(70, 180, 240, 0.28);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

/* 冷却/存量环 */
.abil::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(rgba(150, 230, 255, 0.85) var(--cd, 0%), rgba(255, 255, 255, 0.07) 0);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 67%);
  mask: radial-gradient(circle, transparent 66%, #000 67%);
  pointer-events: none;
  opacity: 0.9;
}

.abil .ic { font-size: 23px; line-height: 1; }
.abil .lb { font-size: 10px; opacity: 0.78; letter-spacing: 0.06em; }

.abil .cd {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #d6efff;
  background: rgba(4, 12, 24, 0.72);
  border-radius: 50%;
}

.abil.disabled {
  opacity: 0.5;
  filter: grayscale(0.65);
}

.abil.disabled .cd { display: flex; }

.abil:active { transform: scale(0.93); }

#wheelTip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(26px + env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(200, 226, 247, 0.75);
  letter-spacing: 0.08em;
}

/* ---------- 开始 / 结束面板 ---------- */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 38%, rgba(12, 46, 88, 0.6), rgba(2, 6, 15, 0.92));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#overlay.show {
  opacity: 1;
  pointer-events: auto;
}

#overlay.show .panel {
  animation: panelIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.panel {
  width: min(340px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 24px 20px 18px;
  text-align: center;
  background: rgba(8, 22, 44, 0.88);
  border: 1px solid rgba(110, 200, 255, 0.26);
  border-radius: 20px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.panel h1 {
  margin: 0 0 12px;
  font-size: 23px;
  letter-spacing: 0.05em;
  color: #9fe8ff;
  text-shadow: 0 0 18px rgba(90, 200, 255, 0.45);
}

.panel p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.75;
  color: #a9c4dc;
}

.panel p.tip {
  margin: 13px 0 0;
  font-size: 11px;
  color: #6f8aa6;
}

.howto {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.55;
  color: #a9c4dc;
}

.howto li {
  position: relative;
  padding: 4px 0 4px 14px;
  border-bottom: 1px dashed rgba(120, 190, 240, 0.13);
}

.howto li:last-child { border-bottom: 0; }

.howto li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: #63d2ff;
  box-shadow: 0 0 6px rgba(90, 210, 255, 0.8);
}

.howto b { color: #cdefff; font-weight: 700; }

.panel button {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #04202f;
  background: linear-gradient(180deg, #9deaff, #4bb8ee);
  border: none;
  border-radius: 13px;
  box-shadow: 0 8px 22px rgba(70, 180, 240, 0.34);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.panel button:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 4px 12px rgba(70, 180, 240, 0.28);
}

@media (max-height: 460px) {
  .panel { padding: 16px 16px 14px; }
  .panel h1 { font-size: 19px; margin-bottom: 8px; }
  .howto { font-size: 11.5px; line-height: 1.4; margin-bottom: 12px; }
  .howto li { padding: 2px 0 2px 13px; }
}

/* ---------- 本地排行榜 ---------- */
.board { margin: 16px 0 0; text-align: left; }

.boardTitle {
  margin-bottom: 6px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: #7fb8e0;
}

.boardList {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: #a9c4dc;
  font-variant-numeric: tabular-nums;
}

.boardList li {
  display: grid;
  grid-template-columns: 24px 1fr 62px 84px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 9px;
  border-bottom: 1px dashed rgba(120, 190, 240, 0.13);
}

.boardList li:last-child { border-bottom: 0; }

.boardList .rk { color: #6f8aa6; }
.boardList .sc { color: #7fe3ff; font-weight: 700; }
.boardList .dt { font-size: 11px; opacity: 0.6; text-align: right; }

.boardList li.me {
  color: #e6f8ff;
  background: rgba(76, 184, 238, 0.18);
  box-shadow: inset 0 0 0 1px rgba(127, 227, 255, 0.55);
}

.boardList li.me .rk { color: #9fe8ff; }

.boardNote {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  color: #6f8aa6;
}

.panel .linkBtn {
  width: auto;
  display: block;
  margin: 12px auto 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #6f8aa6;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
