* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #bfe6ff;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 14px;
  pointer-events: none;
  z-index: 10;
}

.hud-left, .hud-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-right {
  pointer-events: auto;
}

.chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 7px 14px;
  box-shadow: 0 4px 14px rgba(60, 90, 120, 0.16);
  font-weight: 700;
  color: #2b4a63;
}

.chip-label {
  font-size: 12px;
  color: #6a87a0;
  font-weight: 600;
}

.chip-value {
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.chip-unit {
  font-size: 12px;
  color: #6a87a0;
}

.chip-apple {
  gap: 6px;
  padding: 7px 12px;
}

.apple-icon {
  position: relative;
  top: 2px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #2b4a63;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(60, 90, 120, 0.16);
  transition: transform .12s ease;
}

.icon-btn:active {
  transform: scale(0.9);
}

/* ---------- 飞翔状态 ---------- */
#flyHud {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: flyPop .3s ease;
}

@keyframes flyPop {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fly-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ffe9a0, #ffc53d);
  color: #7a4d00;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(245, 179, 1, 0.4);
  white-space: nowrap;
}

.fly-bar {
  width: 130px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}

#flyBarFill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd24d, #ff9d2e);
  transform-origin: left center;
}

/* ---------- 滑铲按钮 ---------- */
#slideBtn {
  position: absolute;
  right: 22px;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 12;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(43, 74, 99, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(30, 50, 70, 0.3);
  transition: transform .08s ease, background .08s ease;
  touch-action: none;
}

#slideBtn.pressed,
#slideBtn:active {
  transform: scale(0.88);
  background: rgba(43, 74, 99, 0.78);
}

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(45, 75, 100, 0.32);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.panel {
  width: min(460px, 92vw);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 30px 28px 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(40, 70, 100, 0.3);
  animation: panelIn .35s cubic-bezier(.2,.9,.3,1.2);
}

.panel.small {
  width: min(320px, 86vw);
}

@keyframes panelIn {
  from { transform: translateY(22px) scale(.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #2f8fd6 0%, #43b581 60%, #f5b301 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  color: #6a87a0;
  margin-bottom: 22px;
}

.panel-title {
  font-size: 26px;
  font-weight: 800;
  color: #2b4a63;
  margin-bottom: 20px;
}

.panel-title.over {
  color: #d9604c;
}

.help-grid {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.help-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(235, 244, 250, 0.85);
  border-radius: 14px;
  padding: 10px 14px;
}

.key {
  flex: 0 0 132px;
  font-size: 12.5px;
  font-weight: 800;
  color: #2b4a63;
  background: #fff;
  border: 1px solid #d7e6f0;
  border-bottom-width: 2px;
  border-radius: 9px;
  padding: 6px 8px;
  text-align: center;
}

.key.help-gold {
  color: #8a5a00;
  border-color: #f0d28a;
  background: linear-gradient(135deg, #fff7dd, #ffeeb8);
}

.help-desc {
  font-size: 12.5px;
  color: #5d7c94;
  line-height: 1.5;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #3fb57a, #2f9d68);
  box-shadow: 0 8px 20px rgba(47, 157, 104, 0.38);
  transition: transform .12s ease, box-shadow .12s ease;
}

.primary-btn:active {
  transform: translateY(2px) scale(.99);
  box-shadow: 0 3px 10px rgba(47, 157, 104, 0.35);
}

.ghost-btn {
  width: 100%;
  margin-top: 10px;
  border: 1.5px solid #c9deec;
  border-radius: 999px;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 700;
  color: #5d7c94;
  background: transparent;
  cursor: pointer;
  transition: background .12s ease;
}

.ghost-btn:active {
  background: rgba(201, 222, 236, 0.35);
}

.best-line {
  margin-top: 14px;
  font-size: 12.5px;
  color: #94aabd;
  font-weight: 600;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.result-item {
  background: rgba(235, 244, 250, 0.85);
  border-radius: 14px;
  padding: 12px 8px;
}

.result-label {
  font-size: 12px;
  color: #6a87a0;
  margin-bottom: 4px;
}

.result-value {
  font-size: 24px;
  font-weight: 900;
  color: #2b4a63;
  font-variant-numeric: tabular-nums;
}

.result-value em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: #6a87a0;
  margin-left: 2px;
}

.result-value.gold {
  color: #e0990f;
}

.god-save-row {
  margin-bottom: 18px;
  text-align: center;
}

.god-save-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #5d7c94;
  cursor: pointer;
}

.god-save-row input {
  width: 17px;
  height: 17px;
  accent-color: #2f9d68;
  cursor: pointer;
}

.revive-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  border: none;
  border-radius: 999px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #ffb347, #ff7a3d);
  box-shadow: 0 8px 20px rgba(255, 122, 61, 0.38);
  transition: transform .12s ease, box-shadow .12s ease;
}

.revive-btn:active {
  transform: translateY(2px) scale(.99);
  box-shadow: 0 3px 10px rgba(255, 122, 61, 0.35);
}

/* ---------- 广告复活弹窗 ---------- */
.ad-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 42, 56, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ad-dialog {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(20, 35, 50, 0.4);
}

.ad-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #2b4a63;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(20, 35, 50, 0.35);
  z-index: 2;
}

.ad-close:active {
  transform: scale(.92);
}

.ad-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.ad-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.ad-countdown {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 42, 0.72);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.ad-countdown.done {
  background: rgba(47, 157, 104, 0.92);
}

.ad-claim-btn {
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #3fb57a, #2f9d68);
  box-shadow: 0 8px 20px rgba(47, 157, 104, 0.38);
  transition: transform .12s ease, box-shadow .12s ease;
}

.ad-claim-btn:active {
  transform: translateY(2px) scale(.99);
}

.ad-claim-btn:disabled {
  background: #b9c6d1;
  box-shadow: none;
  cursor: not-allowed;
}

.ad-note {
  margin-top: 10px;
  text-align: center;
  font-size: 12.5px;
  color: #8aa0b2;
}

/* ---------- 加载 ---------- */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(40,70,100,.35);
  letter-spacing: 2px;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 桌面端提示 ---------- */
@media (hover: hover) and (pointer: fine) {
  #slideBtn {
    width: 76px;
    height: 76px;
    right: 26px;
    bottom: 26px;
    opacity: .82;
  }
}

/* ---------- 窄屏微调 ---------- */
@media (max-width: 380px) {
  .chip-value { font-size: 16px; }
  .chip { padding: 6px 11px; }
  .title { font-size: 32px; }
  .key { flex: 0 0 104px; font-size: 11.5px; }
  .help-desc { font-size: 11.5px; }
}
