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

:root {
  --bg: #eaf6ff;
  --surface: #ffffff;
  --border: rgba(38, 38, 77, 0.1);
  --text: #26264d;
  --muted: rgba(38, 38, 77, 0.55);
  --accent: #ff6b6b;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
}

.back-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(38, 38, 77, 0.12);
  z-index: 10;
  transition: transform 0.15s ease;
}

.back-link:active {
  transform: scale(0.94);
}

#install-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  font-family: inherit;
  padding: 0.5rem 1.1rem;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(38, 38, 77, 0.18);
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

#install-btn:active {
  transform: scale(0.94);
}

/* Sky */
#sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: linear-gradient(to bottom, #7ec8f0 0%, #bfe4fb 55%, #eaf6ff 100%);
}

.cloud {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0.85;
  will-change: transform;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before { width: 60%; height: 60%; top: -30%; left: 12%; }
.cloud::after { width: 70%; height: 70%; top: -22%; right: 8%; }

@keyframes drift {
  from { transform: translateX(-20vw); }
  to   { transform: translateX(120vw); }
}

/* Stars HUD */
#stars-hud {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.15rem;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(38, 38, 77, 0.12);
  z-index: 10;
}

@media (max-width: 380px) {
  .back-link, #install-btn, #stars-hud {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}

#stars-icon { font-size: 1.15rem; }

#stars-count.bump {
  display: inline-block;
  animation: bump 0.4s ease;
}

@keyframes bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* Balloons */
.balloon {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  cursor: pointer;
  will-change: transform;
  filter: drop-shadow(0 6px 10px rgba(38, 38, 77, 0.18));
}

.balloon .shine {
  position: absolute;
  top: 16%;
  left: 20%;
  width: 30%;
  height: 36%;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  filter: blur(1px);
}

.balloon .knot {
  position: absolute;
  bottom: -5%;
  left: 50%;
  width: 12%;
  height: 8%;
  background: var(--balloon-color);
  transform: translateX(-50%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.balloon .string {
  position: absolute;
  bottom: -32%;
  left: 50%;
  width: 2px;
  height: 28%;
  background: rgba(38, 38, 77, 0.3);
  transform: translateX(-50%);
}

.balloon.reward {
  filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.85)) drop-shadow(0 6px 10px rgba(38, 38, 77, 0.18));
  animation: sparkle 1.1s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 209, 102, 0.7)) drop-shadow(0 6px 10px rgba(38, 38, 77, 0.18)); }
  50% { filter: drop-shadow(0 0 22px rgba(255, 209, 102, 1)) drop-shadow(0 6px 10px rgba(38, 38, 77, 0.18)); }
}

.balloon .star-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transform: translateY(-10%);
}

/* Pop particles */
.particle {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 3px;
  pointer-events: none;
  animation: pop-fly 0.6s ease-out forwards;
}

@keyframes pop-fly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}

/* Reward celebration */
#celebrate-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}

.celebrate-text {
  position: absolute;
  font-weight: 900;
  font-size: 1.9rem;
  color: #f59e0b;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
  animation: floatUp 1.3s ease-out forwards;
  white-space: nowrap;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.7); }
  15% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-130px) scale(1.15); }
}
