* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", sans-serif;
  background: linear-gradient(165deg, #1a1a2e 0%, #16213e 48%, #0f3460 100%);
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ===== 游戏容器 ===== */
#gameWrap {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ===== HUD ===== */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 16px 18px 8px;
  pointer-events: none;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 62px;
}

.hud-label {
  font-size: 11px;
  color: #8fa3c8;
  margin-bottom: 2px;
  letter-spacing: 1px;
}

.hud-value {
  font-size: 26px;
  font-weight: 800;
  color: #ffd54f;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hud-center .hud-value {
  color: #fff;
}

.hud-value.warn {
  color: #ff5252;
  animation: pulse .5s ease infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.15); }
}

.time-bar {
  position: absolute;
  top: 68px; left: 18px; right: 18px;
  height: 6px;
  background: rgba(255,255,255,.12);
  border-radius: 3px;
  overflow: hidden;
  z-index: 40;
}

.time-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #66bb6a, #ffd54f, #ff7043);
  border-radius: 3px;
  transition: width .2s linear;
}

/* ===== 气泡 ===== */
#bubbleLayer {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
}

.bubble {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 30px;
  will-change: transform;
  transition: transform .08s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,.3), inset 0 -4px 10px rgba(0,0,0,.12);
  animation: bubbleFloat 3s ease-in-out infinite alternate;
}

@keyframes bubbleFloat {
  from { margin-top: -4px; }
  to   { margin-top: 4px; }
}

.bubble.bless {
  background: radial-gradient(circle at 32% 28%, #fff9c4 0%, #ffd54f 40%, #ffa726 100%);
  border: 3px solid rgba(255,255,255,.6);
}

.bubble.bomb {
  background: radial-gradient(circle at 32% 28%, #ff8a80 0%, #e53935 45%, #b71c1c 100%);
  border: 3px solid rgba(255,255,255,.45);
}

.bubble:active {
  transform: scale(.82);
}

.bubble.pop {
  animation: popOut .3s ease forwards;
  pointer-events: none;
}

@keyframes popOut {
  to { transform: scale(1.7); opacity: 0; }
}

/* ===== 飘字 ===== */
#floatLayer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.float-text {
  position: absolute;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  animation: floatUp .9s ease forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.float-text.plus { color: #ffd54f; }
.float-text.minus { color: #ff5252; }

@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  25%  { opacity: 1; transform: translate(-50%, -14px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}

/* ===== 面板 ===== */
.panel {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 24px;
  background: radial-gradient(circle at 50% 38%, rgba(22,33,62,.82) 0%, rgba(15,20,40,.96) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: panelIn .35s ease both;
}

.panel.hidden {
  display: none;
}

@keyframes panelIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.panel-emoji {
  font-size: 64px;
  margin-bottom: 10px;
  animation: bob 2s ease-in-out infinite alternate;
}

@keyframes bob {
  from { transform: translateY(-6px) rotate(-4deg); }
  to   { transform: translateY(6px) rotate(4deg); }
}

.panel-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd54f;
  text-shadow: 0 0 22px rgba(255,213,79,.5);
  margin-bottom: 8px;
}

.panel-sub {
  font-size: 15px;
  color: #b8c6db;
  margin-bottom: 26px;
  letter-spacing: 1px;
}

/* 规则 */
.rules {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 28px;
  max-width: 300px;
}

.rules p {
  font-size: 14px;
  color: #d7e0f0;
  line-height: 1.9;
  text-align: left;
}

.rules b {
  color: #ffd54f;
}

.rule-goal {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,.18);
  font-size: 14px;
  color: #d7e0f0;
  text-align: left;
}

.rule-goal b {
  color: #ff7043;
  font-size: 17px;
}

/* 按钮 */
.btn-main {
  background: linear-gradient(135deg, #ff8a65 0%, #f4511e 100%);
  color: #fff;
  border: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 15px 46px;
  border-radius: 50px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(244,81,30,.45);
  transition: transform .15s ease, box-shadow .15s ease;
}

.btn-main:active {
  transform: scale(.94);
  box-shadow: 0 4px 12px rgba(244,81,30,.35);
}

/* 结算 */
.stat-row {
  display: flex;
  gap: 36px;
  margin-bottom: 22px;
}

.stat {
  text-align: center;
}

.stat-num {
  font-size: 40px;
  font-weight: 800;
  color: #ffd54f;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: #8fa3c8;
  margin-top: 6px;
}

.bless-scroll {
  max-width: 320px;
  width: 100%;
  max-height: 132px;
  overflow-y: auto;
  margin-bottom: 24px;
  padding: 12px 14px;
  background: rgba(255,255,255,.06);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  -webkit-overflow-scrolling: touch;
}

.bless-line {
  font-size: 13px;
  color: #d7e0f0;
  line-height: 1.9;
  text-align: left;
}

.panel-foot {
  margin-top: 18px;
  font-size: 14px;
  color: #ffd54f;
  letter-spacing: 2px;
}

/* ===== 彩带 ===== */
#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

/* ===== 移动端 ===== */
@media (max-width: 480px) {
  .panel-title { font-size: 28px; }
  .panel-emoji { font-size: 54px; }
  .hud-value { font-size: 22px; }
  .bubble { font-size: 26px; }
}

@media (max-height: 640px) {
  .panel-emoji { font-size: 44px; margin-bottom: 6px; }
  .panel-title { font-size: 26px; }
  .panel-sub { margin-bottom: 16px; }
  .rules { padding: 14px 18px; margin-bottom: 20px; }
  .rules p { font-size: 13px; line-height: 1.7; }
}
