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

/* 参考图铺满整屏，从屏幕顶端开始 */
.bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  pointer-events: none;
}

.fx {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 16px; right: 16px;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}
.hud-score {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 8px 16px 9px;
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(255, 138, 61, 0.35);
  box-shadow: 0 6px 16px rgba(60, 30, 0, 0.18);
  backdrop-filter: blur(6px);
}
.hud-label {
  font-size: 11px; letter-spacing: 0.14em; color: #A87A4E; font-weight: 600;
}
.hud-num {
  font-size: 26px; line-height: 1.05; font-weight: 800; color: #FF6A1A;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.hud-num.small { font-size: 17px; color: #6B4A28; }

.hud-right { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.hud-best {
  display: flex; flex-direction: column; align-items: center;
  padding: 7px 12px 8px;
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.86);
  border: 1px solid rgba(255, 138, 61, 0.28);
  box-shadow: 0 4px 12px rgba(60, 30, 0, 0.14);
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(255, 138, 61, 0.35);
  box-shadow: 0 4px 12px rgba(60, 30, 0, 0.16);
  color: #FF6A1A; font-size: 22px; cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.icon-btn:active { transform: scale(0.92); background: #FFE7D4; }

/* ---------- 下一个水果 ---------- */
.next-bubble {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 78px);
  right: 16px;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 10px 8px;
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.9);
  border: 1px solid rgba(255, 138, 61, 0.3);
  box-shadow: 0 6px 16px rgba(60, 30, 0, 0.16);
  z-index: 5;
  transition: opacity 0.2s ease;
}
.next-bubble.hidden { opacity: 0; pointer-events: none; }
.next-label { font-size: 10px; letter-spacing: 0.12em; color: #A87A4E; font-weight: 700; }
.next-bubble canvas { width: 44px; height: 44px; display: block; }

/* ---------- 连击提示 ---------- */
.combo {
  position: absolute;
  top: 30%; left: 0; right: 0;
  text-align: center;
  font-size: 24px; font-weight: 800; color: #FFF3E2;
  text-shadow: 0 2px 0 #FF6A1A, 0 6px 18px rgba(255, 106, 26, 0.55);
  opacity: 0; transform: translateY(8px) scale(0.9);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none; z-index: 6;
}
.combo.show { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- 危险提示 ---------- */
.danger-tip {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 132px);
  left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 800; color: #FFF;
  text-shadow: 0 1px 3px rgba(180, 30, 0, 0.6);
  opacity: 0; transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none; z-index: 6;
}
.danger-tip.show {
  opacity: 1; transform: translateY(0);
  animation: dangerPulse 0.8s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { color: #FFE08A; }
  50% { color: #FF4D3D; }
}
.danger-tip .mp-icon { width: 1em; height: 1em; }

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: radial-gradient(120% 80% at 50% 40%, rgba(40, 20, 0, 0.42), rgba(20, 10, 0, 0.72));
  backdrop-filter: blur(3px);
  z-index: 10;
  animation: fadeIn 0.22s ease both;
}
.overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: 100%; max-width: 340px;
  padding: 26px 22px 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF4E6 100%);
  border: 1px solid rgba(255, 138, 61, 0.4);
  box-shadow: 0 18px 44px rgba(30, 12, 0, 0.4), inset 0 1px 0 #FFFFFF;
  text-align: center;
  animation: popIn 0.26s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
@keyframes popIn { from { transform: scale(0.9) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-badge {
  width: 56px; height: 56px; margin: -46px auto 12px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #FFA45C, #FF6A1A);
  color: #FFF8EF; font-size: 28px;
  box-shadow: 0 10px 22px rgba(255, 106, 26, 0.45);
}
.panel-badge.fail { background: linear-gradient(160deg, #8E9BB3, #5C6B85); box-shadow: 0 10px 22px rgba(60, 70, 90, 0.4); }

.panel-title {
  margin: 0 0 8px; font-size: 21px; font-weight: 800; color: #3A2410;
  letter-spacing: 0.01em;
}
.panel-desc {
  margin: 0 0 18px; font-size: 13.5px; line-height: 1.65; color: #8A6A4A;
}

.result {
  display: flex; gap: 10px; margin: 4px 0 16px;
}
.result-item {
  flex: 1; padding: 12px 8px;
  border-radius: 16px;
  background: #FFF6EA;
  border: 1px solid rgba(255, 138, 61, 0.28);
}
.result-label { display: block; font-size: 11px; color: #A87A4E; letter-spacing: 0.1em; }
.result-num { display: block; margin-top: 4px; font-size: 24px; font-weight: 800; color: #FF6A1A; font-variant-numeric: tabular-nums; }

.btn-primary {
  width: 100%; min-height: 52px;
  border: 0; border-radius: 16px;
  background: linear-gradient(180deg, #FFA45C, #FF6A1A);
  color: #FFF9F2; font-size: 17px; font-weight: 800; letter-spacing: 0.04em;
  box-shadow: 0 10px 22px rgba(255, 106, 26, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:active { transform: translateY(2px) scale(0.985); box-shadow: 0 4px 12px rgba(255, 106, 26, 0.4); }

.btn-ghost {
  width: 100%; min-height: 46px; margin-top: 10px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid rgba(255, 138, 61, 0.45);
  color: #C2703A; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn-ghost:active { transform: scale(0.985); background: #FFEFE0; }

.panel-tip { margin: 14px 0 0; font-size: 12px; color: #B08A62; }

/* 图标尺寸跟随字号 */
.panel-badge .mp-icon,
.icon-btn .mp-icon { width: 1em; height: 1em; }
