/* 戳泡泡 · 限时挑战 — 薄荷绿主题（视觉增强版） */

:root {
  --bg: #040b16;
  --bg-elev: #0a1526;
  --card: rgba(10, 20, 40, 0.4);
  --card2: rgba(15, 30, 60, 0.5);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #00f0ff;
  --accent-2: #ff00ff;
  --accent-dim: rgba(0, 240, 255, 0.2);
  --on-accent: #020617;
  --line: rgba(255, 255, 255, 0.15);
  --line-soft: rgba(255, 255, 255, 0.08);
  --gold: #fbbf24;
  --danger: #ef4444;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-pill: 999px;
}

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

html, body { height: 100%; }

body {
  background: url('../img/bg.jpg') center/cover no-repeat fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

/* Dynamic Glowing Overlay */
body::before, body::after {
  content: '';
  position: absolute;
  width: 60vw; height: 60vw;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.2;
  animation: float-glow 15s ease-in-out infinite alternate;
  pointer-events: none;
  mix-blend-mode: screen;
}
body::before {
  background: var(--accent);
  bottom: -20vw; left: -10vw;
}
body::after {
  background: var(--accent-2);
  top: -20vw; right: -10vw;
  animation-delay: -7s;
  opacity: 0.15;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15vw, -15vh) scale(1.2); }
}

.game-shell { display:flex; flex-direction:column; height:100dvh; max-width:560px; margin:0 auto; position:relative; z-index:1; background: rgba(0,0,0,0.65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---- HUD ---- */
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 20, 40, 0.3);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  z-index: 3;
}

.hud-back {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  text-decoration: none;
  background: rgba(255,255,255,0.03);
  transition: all 0.2s ease;
}
.hud-back svg { width: 18px; height: 18px; }
.hud-back:active { transform: scale(.92); }
.hud-back:hover { background: rgba(255,255,255,0.1); color: var(--text); border-color: rgba(255,255,255,0.15); }

.hud-mid { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hud-kicker { font-size: 10px; letter-spacing: .22em; color: var(--accent); font-weight: 700; text-shadow: 0 0 8px var(--accent-dim); }
.hud-title { font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }

.hud-stats { display: flex; align-items: baseline; gap: 12px; }
.hud-score {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
  text-shadow: 0 0 15px var(--accent-dim), 0 0 30px var(--accent-dim);
}
.hud-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  background: rgba(52, 211, 153, 0.05);
  box-shadow: 0 0 10px inset rgba(52, 211, 153, 0.05);
}
.hud-time.is-low { 
  color: var(--danger); 
  border-color: rgba(240, 163, 163, .6); 
  background: rgba(240, 163, 163, 0.1);
  animation: pulse-danger 1s infinite alternate;
}
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 inset rgba(240, 163, 163, 0); }
  100% { box-shadow: 0 0 12px inset rgba(240, 163, 163, 0.3); }
}

/* ---- Stage ---- */
.stage-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }

.stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 60% at 50% 110%, rgba(0, 240, 255, 0.15), transparent 70%);
  touch-action: manipulation;
}

/* ---- Bubble ---- */
.bubble {
  position: absolute;
  bottom: -100px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.5);
  background:
    radial-gradient(110% 110% at 20% 20%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(100% 100% at 80% 80%, rgba(0, 240, 255, 0.4) 0%, rgba(0, 240, 255, 0) 60%),
    rgba(255, 255, 255, 0.05);
  box-shadow: 
    inset 0 -5px 15px rgba(0, 240, 255, 0.3),
    inset 0 5px 15px rgba(255, 255, 255, 0.4),
    0 8px 32px rgba(0, 240, 255, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  will-change: transform;
  animation: rise linear forwards;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

.bubble::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 20%;
  width: 30%;
  height: 20%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transform: rotate(-45deg);
  filter: blur(1px);
}

.bubble:hover { filter: brightness(1.3) contrast(1.2); transform: scale(1.05); }

.bubble.is-gold {
  border-color: rgba(255, 215, 0, 0.8);
  background:
    radial-gradient(110% 110% at 20% 20%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(100% 100% at 80% 80%, rgba(255, 215, 0, 0.5) 0%, rgba(255, 215, 0, 0) 60%),
    rgba(255, 215, 0, 0.1);
  box-shadow: 
    inset 0 -5px 15px rgba(255, 215, 0, 0.4),
    inset 0 5px 15px rgba(255, 255, 255, 0.6),
    0 8px 40px rgba(255, 215, 0, 0.3);
}

@keyframes rise {
  from { transform: translateY(0) translateX(0); }
  to { transform: translateY(var(--rise, -110vh)) translateX(var(--sway, 0px)); }
}

.bubble.is-pop {
  animation: pop .3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.bubble.is-pop::after {
  display: none;
}

@keyframes pop {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(2); filter: blur(8px); }
}

/* 得分飘字 */
.float-score {
  position: absolute;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  pointer-events: none;
  animation: float-up .8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  text-shadow: 0 4px 15px rgba(52, 211, 153, 0.8);
  z-index: 2;
}
.float-score.is-gold { color: var(--gold); text-shadow: 0 4px 15px rgba(232, 200, 106, 0.8); }

@keyframes float-up {
  0% { opacity: 0; transform: translateY(10px) scale(0.8); }
  20% { opacity: 1; transform: translateY(0) scale(1.2); }
  100% { opacity: 0; transform: translateY(-50px) scale(1); }
}

/* 连击提示 */
.combo {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 15px rgba(52, 211, 153, 0.4);
  border-radius: var(--r-pill);
  padding: 6px 18px;
  opacity: 0;
  transition: all .25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 2;
}
.combo.is-show { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---- Overlays ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 11, 22, 0.6);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 4;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.overlay-card {
  width: 100%;
  max-width: 340px;
  background: rgba(10, 20, 40, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2), 
    0 30px 60px rgba(0, 0, 0, 0.8), 
    0 0 40px rgba(0, 240, 255, 0.15);
  padding: 32px 24px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(25px) saturate(200%);
  -webkit-backdrop-filter: blur(25px) saturate(200%);
}
.overlay-card::before {
  content: '';
  position: absolute;
  top: -50px; left: -50px; right: -50px; height: 150px;
  background: radial-gradient(ellipse at top, rgba(0, 240, 255, 0.25), transparent 70%);
  pointer-events: none;
}
.overlay.is-open .overlay-card { animation: card-in .4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.overlay-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 0 8px 20px rgba(52, 211, 153, 0.15);
  position: relative;
}
.overlay-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  z-index: -1;
  background: var(--accent);
  opacity: 0.15;
  filter: blur(8px);
}
.overlay-icon svg { width: 32px; height: 32px; }

.overlay-kicker { font-size: 11px; letter-spacing: .2em; color: var(--accent); font-weight: 700; text-shadow: 0 0 10px var(--accent-dim); }

.overlay-card h1, .overlay-card h2 { 
  font-size: 1.7rem; 
  font-weight: 800; 
  letter-spacing: .02em; 
  margin: 8px 0 12px; 
  background: linear-gradient(to right, #fff, var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.overlay-card p { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 24px; }

.end-score {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 8px;
  text-shadow: 0 0 30px rgba(52, 211, 153, 0.5);
  background: linear-gradient(to bottom, #fff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.end-meta { font-size: 14px; color: rgba(134, 168, 153, 0.9); margin-bottom: 0 !important; font-weight: 500;}
.overlay-best { font-size: 12px; letter-spacing: .08em; color: rgba(134, 168, 153, 0.8); margin: 16px 0 0 !important; font-weight: 600;}

.end-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--on-accent);
  background: linear-gradient(135deg, #00e5ff, #0077ff);
  border: none;
  border-radius: var(--r-pill);
  box-shadow: 0 8px 24px rgba(0, 229, 255, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-20deg);
  animation: shine 3s infinite;
}
.btn-primary:active { transform: scale(.96); box-shadow: 0 4px 12px rgba(0, 229, 255, 0.3); }
.btn-primary:hover { box-shadow: 0 12px 30px rgba(0, 229, 255, 0.6); filter: brightness(1.1); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.5); }

.btn-ghost {
  display: block;
  width: 100%;
  padding: 13px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ghost:active { transform: scale(.96); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(52, 211, 153, 0.4); color: #fff; }
.btn-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3); }

.is-hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .overlay { transition: none; }
  .overlay.is-open .overlay-card { animation: none; }
  .float-score { animation-duration: .3s; }
  body::before, body::after, .btn-primary::after { animation: none; }
}

/* Stunning particles */
.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #00f0ff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px #00f0ff, 0 0 20px #00f0ff;
  animation: particle-burst 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  z-index: 5;
}

.particle.is-gold {
  background: #fbbf24;
  box-shadow: 0 0 10px #fbbf24, 0 0 20px #fbbf24;
}

@keyframes particle-burst {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0) rotate(var(--r)); opacity: 0; }
}

.bubble-trail {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,240,255,0.4) 0%, transparent 60%);
  filter: blur(8px);
  z-index: -1;
  opacity: 0.6;
  animation: pulse-trail 2s infinite alternate;
}

.bubble.is-gold .bubble-trail {
  background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 60%);
}

@keyframes pulse-trail {
  0% { transform: scale(0.9); opacity: 0.4; }
  100% { transform: scale(1.1); opacity: 0.8; }
}

