/* style.css — all styling */
:root {
  --bg: #0d0b1a;
  --bg-2: #1a1430;
  --fg: #f5f3ff;
  --muted: #9a93c7;
  --accent: #ff5c8a;
  --accent-2: #ffd166;
  --accent-3: #4cc9f0;
  --glow: rgba(255, 92, 138, 0.45);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f4ff;
    --bg-2: #ece6ff;
    --fg: #2a1f4d;
    --muted: #6b6196;
    --accent: #ff3d7f;
    --accent-2: #ff9d2e;
    --accent-3: #2da8e0;
    --glow: rgba(255, 61, 127, 0.3);
    color-scheme: light;
  }
}

html[data-theme="dark"] {
  --bg: #0d0b1a;
  --bg-2: #1a1430;
  --fg: #f5f3ff;
  --muted: #9a93c7;
  --accent: #ff5c8a;
  --accent-2: #ffd166;
  --accent-3: #4cc9f0;
  --glow: rgba(255, 92, 138, 0.45);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f7f4ff;
  --bg-2: #ece6ff;
  --fg: #2a1f4d;
  --muted: #6b6196;
  --accent: #ff3d7f;
  --accent-2: #ff9d2e;
  --accent-3: #2da8e0;
  --glow: rgba(255, 61, 127, 0.3);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  overflow: hidden;
  touch-action: manipulation;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--bg-2) 0%, transparent 60%),
    radial-gradient(100% 100% at 50% 100%, rgba(76,201,240,0.08) 0%, transparent 50%),
    var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
}

.halo {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 65%);
  filter: blur(20px);
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 1; }
}

.counter {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.count-label {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.count-value {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.pop-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  width: 188px;
  height: 188px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.12s ease;
}

.pop-btn:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 6px;
}

.pop-btn:hover { transform: translateY(-2px); }
.pop-btn:active { transform: scale(0.93); }

.pop-btn-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background:
    radial-gradient(120% 120% at 30% 25%, #ffffff 0%, transparent 28%),
    linear-gradient(160deg, var(--accent) 0%, #ff7b00 55%, var(--accent-2) 100%);
  box-shadow:
    0 18px 40px -8px var(--glow),
    0 8px 18px -6px rgba(0,0,0,0.4),
    inset 0 -10px 22px rgba(0,0,0,0.22),
    inset 0 10px 18px rgba(255,255,255,0.25);
  transition: box-shadow 0.2s ease;
}

.pop-btn .emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
  transition: transform 0.15s ease;
}

.pop-label {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,0.35);
}

.pop-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}

.pop-animate .pop-ring {
  animation: ring 0.7s ease-out;
}
.pop-animate .emoji {
  animation: bump 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pop-animate .pop-btn-inner {
  box-shadow:
    0 26px 60px -6px var(--glow),
    0 8px 18px -6px rgba(0,0,0,0.4),
    inset 0 -10px 22px rgba(0,0,0,0.22),
    inset 0 12px 20px rgba(255,255,255,0.4);
}

@keyframes ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.35) rotate(-8deg); }
  60% { transform: scale(0.92) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.hint {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.emoji-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.flying-emoji {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  user-select: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

@media (max-width: 360px) {
  .pop-btn { width: 160px; height: 160px; }
  .pop-btn .emoji { font-size: 44px; }
  .count-value { font-size: 36px; }
}
