* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  background: #2A1B12;
  color: #2B1B10;
  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: #FFD9A8;
}

/* 背景成品图：铺满全屏 */
.bg-art {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #FFD9A8;
}
.bg-art::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 45%, rgba(255, 255, 255, 0) 40%, rgba(60, 26, 6, 0.26) 100%);
  pointer-events: none;
}

/* 无成品图时的卡通天空兜底 */
.bg-art.no-art {
  background-image:
    radial-gradient(60% 45% at 18% 12%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(45% 35% at 82% 8%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #FFE2B8 0%, #FFC98A 42%, #FFB067 68%, #F79A4A 100%);
}
.bg-art.no-art::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: radial-gradient(70% 100% at 50% 100%, #8BC34A 0%, #6DA83A 60%, #4E8A2A 100%);
  border-top-left-radius: 50% 42%;
  border-top-right-radius: 50% 42%;
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.35);
}

#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 10px 14px;
  pointer-events: none;
  z-index: 5;
}
.hud-left, .hud-right { display: flex; gap: 8px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px 0 10px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 0 rgba(150, 78, 24, 0.35), 0 8px 18px rgba(90, 44, 10, 0.18);
  font-size: 15px; font-weight: 800;
  color: #4A2A12;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}
.chip .mp-icon { font-size: 18px; width: 1em; height: 1em; flex: 0 0 auto; }
.score-chip .mp-icon { color: #FFB300; }
.combo-chip .mp-icon { color: #FF5722; }
.ammo-chip .mp-icon { color: #FF8A3D; }
.best-chip .mp-icon { color: #7E57C2; }

.combo-chip { transition: transform 0.16s ease, opacity 0.16s ease; }
.combo-chip.pop { transform: scale(1.18); }
.combo-chip.dim { opacity: 0.45; }

/* ---------- 提示 ---------- */
.hint {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(43, 27, 16, 0.55);
  color: #FFF3E2;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 5;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.hint.hide { opacity: 0; }

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(38, 20, 8, 0.42);
  backdrop-filter: blur(3px);
  z-index: 20;
  animation: fadeIn 0.22s ease both;
}
.overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel {
  width: min(420px, 92vw);
  max-height: 92vh;
  overflow: auto;
  padding: 18px 20px 20px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF2DF 100%);
  border: 3px solid #FFFFFF;
  box-shadow: 0 10px 0 rgba(150, 78, 24, 0.35), 0 24px 48px rgba(60, 26, 6, 0.35);
  text-align: center;
  animation: popIn 0.26s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}

.panel-badge {
  width: 54px; height: 54px; margin: -42px auto 8px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFB067, #FF8A3D);
  border: 3px solid #FFFFFF;
  box-shadow: 0 6px 0 rgba(180, 92, 26, 0.45);
  color: #FFF8EF;
}
.panel-badge .mp-icon { font-size: 28px; width: 1em; height: 1em; }
.panel-badge.danger { background: linear-gradient(160deg, #FF8A80, #E64A19); }

.panel-title {
  margin: 4px 0 6px;
  font-size: 24px; font-weight: 900;
  letter-spacing: 0.02em;
  color: #4A2A12;
}
.panel-desc {
  margin: 0 0 14px;
  font-size: 14px; line-height: 1.55;
  color: #8A6A4E;
}

.panel-stats { display: flex; gap: 10px; margin-bottom: 16px; }
.stat {
  flex: 1;
  padding: 10px 8px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid #FFE3C4;
  box-shadow: 0 3px 0 rgba(200, 130, 70, 0.18);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-k { font-size: 12px; color: #A98A6E; font-weight: 600; }
.stat-v { font-size: 20px; font-weight: 900; color: #FF8A3D; }

.btn {
  width: 100%;
  min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 18px;
  font-size: 17px; font-weight: 900; letter-spacing: 0.04em;
  color: #FFF8EF;
  background: linear-gradient(180deg, #FFA45C 0%, #FF8A3D 55%, #F2741F 100%);
  box-shadow: 0 6px 0 #C85E14, 0 12px 22px rgba(200, 94, 20, 0.35);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn .mp-icon { font-size: 22px; width: 1em; height: 1em; flex: 0 0 auto; }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C85E14, 0 6px 12px rgba(200, 94, 20, 0.3);
}

@media (max-height: 420px) {
  .panel { padding: 12px 16px 14px; border-radius: 20px; }
  .panel-badge { width: 44px; height: 44px; margin-top: -34px; border-radius: 14px; }
  .panel-badge .mp-icon { font-size: 22px; }
  .panel-title { font-size: 19px; margin: 2px 0 4px; }
  .panel-desc { font-size: 12px; margin-bottom: 10px; }
  .panel-stats { margin-bottom: 10px; }
  .stat { padding: 6px; border-radius: 12px; }
  .stat-v { font-size: 16px; }
  .btn { min-height: 44px; font-size: 15px; border-radius: 14px; }
  .chip { height: 28px; font-size: 13px; padding: 0 10px 0 8px; }
  .chip .mp-icon { font-size: 15px; }
  .hint { font-size: 11px; padding: 6px 12px; bottom: 8px; }
}
