/*
 * RAIN - an idle game about water, patience, and letting go
 *
 * Color palette:
 *   Background:  #0a0e17 -> #1a1e2e
 *   Silver-blue: #c8d6e5
 *   Cyan:        #00d2ff
 *   Slate blue:  #7b68ee
 *   Muted:       #4a5568
 *   Afford:      #48bb78
 *   White:       #ffffff
 */

/* ============================================================
   1. Custom Properties
   ============================================================ */

:root {
  --bg-deep: #0a0e17;
  --bg-surface: #1a1e2e;
  --text-primary: #c8d6e5;
  --text-white: #ffffff;
  --accent-cyan: #00d2ff;
  --accent-purple: #7b68ee;
  --muted: #4a5568;
  --afford: #48bb78;
  --glass-bg: rgba(0, 210, 255, 0.05);
  --glass-border: rgba(0, 210, 255, 0.15);
  --glass-bg-hover: rgba(0, 210, 255, 0.1);
  --glass-border-hover: rgba(0, 210, 255, 0.35);
  --purple-glass-bg: rgba(123, 104, 238, 0.08);
  --purple-glass-border: rgba(123, 104, 238, 0.2);
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s ease;
  --transition-slow: 0.6s ease;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: linear-gradient(170deg, var(--bg-deep) 0%, var(--bg-surface) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   3. Rain Background Animation
   ============================================================ */

.rain-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.raindrop-bg {
  position: absolute;
  top: -20px;
  width: 2px;
  height: 20px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 210, 255, 0.4),
    transparent
  );
  opacity: 0.3;
  animation: rainfall linear infinite;
}

.raindrop-bg:nth-child(odd) {
  width: 1px;
  height: 24px;
  opacity: 0.25;
}

.raindrop-bg:nth-child(3n) {
  opacity: 0.4;
  height: 16px;
}

@keyframes rainfall {
  from {
    transform: translateY(-10px);
  }
  to {
    transform: translateY(100vh);
  }
}

/* ============================================================
   4. Rain Container
   ============================================================ */

.rain-container {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================================================
   5. Header
   ============================================================ */

.rain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 24px;
}

.rain-logo {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  color: var(--muted);
  user-select: none;
}

.prestige-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-purple);
  background: var(--purple-glass-bg);
  border: 1px solid var(--purple-glass-border);
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

/* ============================================================
   6. Hero Section
   ============================================================ */

.hero {
  text-align: center;
  padding: 20px 0 32px;
}

.hero-count {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.1;
  text-shadow:
    0 0 30px rgba(0, 210, 255, 0.3),
    0 0 60px rgba(0, 210, 255, 0.1);
  animation: breathe 4s ease-in-out infinite;
  letter-spacing: -0.02em;
}

.hero-dps {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  transition: color var(--transition-med);
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.92;
  }
}

/* ============================================================
   7. Click Zone
   ============================================================ */

.click-section {
  padding: 0 0 28px;
}

.rain-click-zone {
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  overflow: hidden;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-med);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.rain-click-zone:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 0 40px rgba(0, 210, 255, 0.08);
}

.rain-click-zone:active {
  transform: scale(0.98);
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.4);
}

.click-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

.click-icon {
  font-size: 2.4rem;
  animation: bounce 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.3));
}

.click-text {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: lowercase;
}

/* Ripple effect */
.raindrop-ripple {
  position: absolute;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -20px;
  background: transparent;
  border: 2px solid rgba(0, 210, 255, 0.4);
  animation: ripple 0.6s ease-out forwards;
  pointer-events: none;
}

/* Floating +1 text */
.drop-floater {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-cyan);
  pointer-events: none;
  animation: float-up 0.8s ease-out forwards;
  text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.6;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes float-up {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-60px);
    opacity: 0;
  }
}

/* ============================================================
   8. Milestone
   ============================================================ */

.milestone-section {
  text-align: center;
  padding: 0 0 32px;
  min-height: 2.4em;
}

#milestone-display {
  font-style: italic;
  font-size: 0.95rem;
  color: #a0b4c8;
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(0, 210, 255, 0.12);
  transition: opacity var(--transition-slow);
  line-height: 1.5;
}

#milestone-display:empty {
  opacity: 0;
}

/* ============================================================
   9. Section Dividers
   ============================================================ */

.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(200, 214, 229, 0.12),
    transparent
  );
}

.section-divider span {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ============================================================
   10. Generators
   ============================================================ */

.generators-section {
  padding: 0 0 28px;
}

#generators-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.generator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid transparent;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-med);
}

.generator-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.generator-row.can-afford {
  border-left-color: var(--afford);
  background: rgba(72, 187, 120, 0.04);
  box-shadow: inset 0 0 20px rgba(72, 187, 120, 0.03);
}

.generator-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.generator-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.generator-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.generator-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.generator-desc {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--muted);
}

.generator-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 170px;
  justify-content: flex-end;
}

.generator-count {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.buy-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-med);
  -webkit-tap-highlight-color: transparent;
}

.buy-btn:not(.disabled):hover {
  color: var(--text-white);
  border-color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.15);
  transform: scale(1.05);
}

.buy-btn:not(.disabled):active {
  transform: scale(0.97);
}

.buy-btn.disabled {
  color: var(--muted);
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   11. Stats
   ============================================================ */

.stats-section {
  text-align: center;
  padding: 0 0 32px;
}

.stat-row {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

#total-collected {
  transition: color var(--transition-med);
}

/* ============================================================
   12. Prestige
   ============================================================ */

.prestige-section {
  padding: 0 0 40px;
}

.prestige-available {
  text-align: center;
  padding: 28px 20px;
  border-radius: var(--radius-md);
  background: var(--purple-glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--purple-glass-border);
  box-shadow: 0 0 30px rgba(123, 104, 238, 0.08);
}

.prestige-message {
  font-style: italic;
  font-size: 0.9rem;
  color: #b8a9f0;
  margin-bottom: 12px;
  line-height: 1.5;
}

.prestige-bonus {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.prestige-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: var(--text-white);
  background: linear-gradient(135deg, #7b68ee, #5a4fcf);
  border: 1px solid rgba(123, 104, 238, 0.4);
  padding: 12px 36px;
  border-radius: 100px;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-med);
  animation: pulse-glow 3s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.prestige-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 40px rgba(123, 104, 238, 0.5);
}

.prestige-btn:active {
  transform: scale(0.97);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(123, 104, 238, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(123, 104, 238, 0.6);
  }
}

.prestige-locked {
  text-align: center;
  padding: 16px 0;
}

.prestige-locked p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.4;
  letter-spacing: 0.04em;
}

/* ============================================================
   13. Turbo Frame / Stream transitions
   ============================================================ */

#raindrops-count {
  display: inline-block;
  transition: transform var(--transition-fast);
}

#dps-display {
  transition: color var(--transition-med);
}

/* ============================================================
   14. Scrollbar
   ============================================================ */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(200, 214, 229, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 214, 229, 0.2);
}

/* ============================================================
   15. Selection
   ============================================================ */

::selection {
  background: rgba(0, 210, 255, 0.2);
  color: var(--text-white);
}

/* ============================================================
   16. Weather Events
   ============================================================ */

.weather-section {
  margin: 16px 0;
  min-height: 0;
}

.weather-active {
  border-radius: var(--radius-md);
  padding: 16px;
  border: 2px solid;
}

.weather-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weather-emoji {
  font-size: 2rem;
  flex-shrink: 0;
}

.weather-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.weather-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.weather-desc {
  font-size: 0.78rem;
  font-style: italic;
  opacity: 0.8;
}

.weather-timer {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
}

.weather-progress {
  margin-top: 10px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.weather-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 1s linear;
}

/* Weather overlay - covers full screen for atmosphere */
.weather-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  transition: background 1s ease, opacity 1s ease;
  opacity: 0;
}

/* --- Drizzle: soft neon blue --- */
.weather-drizzle.weather-active {
  background: rgba(0, 150, 255, 0.1);
  border-color: #64b5f6;
  box-shadow: 0 0 15px rgba(100, 181, 246, 0.4), 0 0 40px rgba(100, 181, 246, 0.15), inset 0 0 15px rgba(100, 181, 246, 0.1);
  animation: neon-glow-blue 2s ease-in-out infinite;
}
.weather-drizzle .weather-name,
.weather-drizzle .weather-timer { color: #64b5f6; text-shadow: 0 0 10px rgba(100, 181, 246, 0.5); }
.weather-drizzle .weather-bar { background: #64b5f6; box-shadow: 0 0 8px #64b5f6; }
.weather-overlay.weather-drizzle {
  background: rgba(0, 100, 200, 0.12);
  opacity: 1;
}

/* --- Downpour: intense neon cyan --- */
.weather-downpour.weather-active {
  background: rgba(0, 210, 255, 0.12);
  border-color: #00d2ff;
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.5), 0 0 60px rgba(0, 210, 255, 0.2), inset 0 0 20px rgba(0, 210, 255, 0.1);
  animation: neon-glow-cyan 1.5s ease-in-out infinite;
}
.weather-downpour .weather-name,
.weather-downpour .weather-timer { color: #00d2ff; text-shadow: 0 0 12px rgba(0, 210, 255, 0.6); }
.weather-downpour .weather-bar { background: #00d2ff; box-shadow: 0 0 10px #00d2ff; }
.weather-overlay.weather-downpour {
  background: rgba(0, 160, 220, 0.15);
  opacity: 1;
}

/* --- Thunderstorm: electric neon yellow --- */
.weather-thunderstorm.weather-active {
  background: rgba(255, 235, 59, 0.1);
  border-color: #ffeb3b;
  box-shadow: 0 0 20px rgba(255, 235, 59, 0.5), 0 0 60px rgba(255, 235, 59, 0.2), inset 0 0 20px rgba(255, 235, 59, 0.08);
  animation: neon-glow-yellow 1s ease-in-out infinite, lightning-flicker 3s infinite;
}
.weather-thunderstorm .weather-name,
.weather-thunderstorm .weather-timer { color: #ffeb3b; text-shadow: 0 0 15px rgba(255, 235, 59, 0.7); }
.weather-thunderstorm .weather-bar { background: #ffeb3b; box-shadow: 0 0 10px #ffeb3b; }
.weather-overlay.weather-thunderstorm {
  background: rgba(180, 160, 0, 0.12);
  opacity: 1;
  animation: lightning-flash 2.5s infinite;
}

/* --- Hurricane: violent neon purple --- */
.weather-hurricane.weather-active {
  background: rgba(186, 85, 211, 0.12);
  border-color: #da70d6;
  box-shadow: 0 0 25px rgba(218, 112, 214, 0.5), 0 0 70px rgba(218, 112, 214, 0.25), inset 0 0 25px rgba(218, 112, 214, 0.1);
  animation: neon-glow-purple 0.8s ease-in-out infinite;
}
.weather-hurricane .weather-name,
.weather-hurricane .weather-timer { color: #da70d6; text-shadow: 0 0 15px rgba(218, 112, 214, 0.7); }
.weather-hurricane .weather-bar { background: #da70d6; box-shadow: 0 0 12px #da70d6; }
.weather-overlay.weather-hurricane {
  background: rgba(120, 40, 140, 0.18);
  opacity: 1;
}

/* --- Fog: ghostly neon white --- */
.weather-fog.weather-active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(200, 210, 220, 0.5);
  box-shadow: 0 0 20px rgba(200, 210, 220, 0.3), 0 0 50px rgba(200, 210, 220, 0.1), inset 0 0 20px rgba(200, 210, 220, 0.05);
  animation: neon-glow-white 3s ease-in-out infinite;
}
.weather-fog .weather-name,
.weather-fog .weather-timer { color: #cfd8dc; text-shadow: 0 0 10px rgba(200, 210, 220, 0.5); }
.weather-fog .weather-bar { background: #b0bec5; box-shadow: 0 0 6px #b0bec5; }
.weather-overlay.weather-fog {
  background: rgba(180, 190, 200, 0.1);
  opacity: 1;
}

/* --- Tsunami: neon green apocalypse --- */
.weather-tsunami.weather-active {
  background: rgba(0, 230, 118, 0.15);
  border-color: #69f0ae;
  box-shadow: 0 0 30px rgba(105, 240, 174, 0.6), 0 0 80px rgba(105, 240, 174, 0.3), 0 0 120px rgba(105, 240, 174, 0.1), inset 0 0 30px rgba(105, 240, 174, 0.15);
  animation: neon-glow-green 0.5s ease-in-out infinite;
}
.weather-tsunami .weather-name,
.weather-tsunami .weather-timer { color: #69f0ae; text-shadow: 0 0 20px rgba(105, 240, 174, 0.8); }
.weather-tsunami .weather-bar { background: #69f0ae; box-shadow: 0 0 15px #69f0ae; }
.weather-overlay.weather-tsunami {
  background: rgba(0, 180, 90, 0.2);
  opacity: 1;
}

/* --- Drought: cracked earth, amber/orange warning --- */
.weather-drought.weather-active {
  background: rgba(255, 152, 0, 0.1);
  border-color: #ff9800;
  box-shadow: 0 0 20px rgba(255, 152, 0, 0.4), 0 0 50px rgba(255, 152, 0, 0.15), inset 0 0 20px rgba(255, 152, 0, 0.08);
  animation: neon-glow-amber 1.5s ease-in-out infinite;
}
.weather-drought .weather-name,
.weather-drought .weather-timer { color: #ff9800; text-shadow: 0 0 12px rgba(255, 152, 0, 0.6); }
.weather-drought .weather-bar { background: #ff9800; box-shadow: 0 0 8px #ff9800; }
.weather-overlay.weather-drought {
  background: rgba(120, 60, 0, 0.15);
  opacity: 1;
}

/* Stop rain animation during drought */
body:has(.weather-overlay.weather-drought) .raindrop-bg {
  animation-play-state: paused;
  opacity: 0.03;
  transition: opacity 2s ease;
}

/* --- Relief: rainbow, warm gold/pink glow --- */
.weather-relief.weather-active {
  background: rgba(255, 215, 0, 0.1);
  border-color: #ffd700;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 100, 150, 0.2), inset 0 0 20px rgba(255, 215, 0, 0.1);
  animation: neon-glow-gold 1.2s ease-in-out infinite;
}
.weather-relief .weather-name,
.weather-relief .weather-timer { color: #ffd700; text-shadow: 0 0 15px rgba(255, 215, 0, 0.7); }
.weather-relief .weather-bar { background: linear-gradient(90deg, #ff6b6b, #ffd700, #69f0ae, #64b5f6, #da70d6); box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.weather-overlay.weather-relief {
  background: rgba(200, 150, 0, 0.1);
  opacity: 1;
}

/* Neon Glow Animations */
@keyframes neon-glow-blue {
  0%, 100% { box-shadow: 0 0 15px rgba(100, 181, 246, 0.4), 0 0 40px rgba(100, 181, 246, 0.15), inset 0 0 15px rgba(100, 181, 246, 0.1); }
  50% { box-shadow: 0 0 25px rgba(100, 181, 246, 0.6), 0 0 60px rgba(100, 181, 246, 0.25), inset 0 0 25px rgba(100, 181, 246, 0.15); }
}

@keyframes neon-glow-cyan {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 210, 255, 0.5), 0 0 60px rgba(0, 210, 255, 0.2), inset 0 0 20px rgba(0, 210, 255, 0.1); }
  50% { box-shadow: 0 0 35px rgba(0, 210, 255, 0.7), 0 0 90px rgba(0, 210, 255, 0.3), inset 0 0 30px rgba(0, 210, 255, 0.15); }
}

@keyframes neon-glow-yellow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 235, 59, 0.5), 0 0 60px rgba(255, 235, 59, 0.2), inset 0 0 20px rgba(255, 235, 59, 0.08); }
  50% { box-shadow: 0 0 35px rgba(255, 235, 59, 0.7), 0 0 90px rgba(255, 235, 59, 0.35), inset 0 0 30px rgba(255, 235, 59, 0.12); }
}

@keyframes neon-glow-purple {
  0%, 100% { box-shadow: 0 0 25px rgba(218, 112, 214, 0.5), 0 0 70px rgba(218, 112, 214, 0.25), inset 0 0 25px rgba(218, 112, 214, 0.1); }
  50% { box-shadow: 0 0 40px rgba(218, 112, 214, 0.7), 0 0 100px rgba(218, 112, 214, 0.35), inset 0 0 35px rgba(218, 112, 214, 0.15); }
}

@keyframes neon-glow-white {
  0%, 100% { box-shadow: 0 0 20px rgba(200, 210, 220, 0.3), 0 0 50px rgba(200, 210, 220, 0.1), inset 0 0 20px rgba(200, 210, 220, 0.05); }
  50% { box-shadow: 0 0 30px rgba(200, 210, 220, 0.4), 0 0 70px rgba(200, 210, 220, 0.15), inset 0 0 30px rgba(200, 210, 220, 0.08); }
}

@keyframes neon-glow-green {
  0%, 100% { box-shadow: 0 0 30px rgba(105, 240, 174, 0.6), 0 0 80px rgba(105, 240, 174, 0.3), 0 0 120px rgba(105, 240, 174, 0.1), inset 0 0 30px rgba(105, 240, 174, 0.15); }
  50% { box-shadow: 0 0 50px rgba(105, 240, 174, 0.8), 0 0 120px rgba(105, 240, 174, 0.4), 0 0 180px rgba(105, 240, 174, 0.15), inset 0 0 40px rgba(105, 240, 174, 0.2); }
}

@keyframes neon-glow-amber {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 152, 0, 0.4), 0 0 50px rgba(255, 152, 0, 0.15), inset 0 0 20px rgba(255, 152, 0, 0.08); }
  50% { box-shadow: 0 0 30px rgba(255, 152, 0, 0.6), 0 0 70px rgba(255, 152, 0, 0.25), inset 0 0 30px rgba(255, 152, 0, 0.12); }
}

@keyframes neon-glow-gold {
  0%, 100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 100, 150, 0.2), inset 0 0 20px rgba(255, 215, 0, 0.1); }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.7), 0 0 90px rgba(255, 100, 150, 0.3), inset 0 0 30px rgba(255, 215, 0, 0.15); }
}

@keyframes lightning-flash {
  0%, 47%, 51%, 88%, 92%, 100% { opacity: 1; }
  48% { opacity: 0.4; }
  49% { background: rgba(255, 255, 255, 0.2); opacity: 1; }
  50% { opacity: 0.8; }
  89% { opacity: 0.5; }
  90% { background: rgba(255, 255, 255, 0.15); opacity: 1; }
  91% { opacity: 0.7; }
}

@keyframes lightning-flicker {
  0%, 46%, 52%, 87%, 93%, 100% { border-color: #ffeb3b; }
  47% { border-color: #fff; box-shadow: 0 0 50px rgba(255, 255, 255, 0.6), 0 0 100px rgba(255, 235, 59, 0.4); }
  48% { border-color: #ffeb3b; }
  88% { border-color: #fff; box-shadow: 0 0 40px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 235, 59, 0.3); }
  89% { border-color: #ffeb3b; }
}

/* ============================================================
   17. Audio Toggle
   ============================================================ */

.audio-control {
  margin-left: auto;
}

.audio-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.audio-toggle.audio-active {
  background: rgba(0, 210, 255, 0.1);
  border-color: rgba(0, 210, 255, 0.3);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.1);
}

/* ============================================================
   18. Achievements
   ============================================================ */

/* Achievement counter button */
.achievement-counter-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.achievement-counter-btn:hover {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

/* Achievements panel */
.achievements-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: rgba(10, 14, 23, 0.98);
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 500;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.achievements-panel-open {
  transform: translateY(0);
}

.achievements-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  position: sticky;
  top: 0;
  background: rgba(10, 14, 23, 0.98);
  z-index: 1;
}

.achievements-panel-title {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: #ffd700;
}

.achievements-panel-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

.achievements-panel-close:hover {
  color: var(--text-white);
}

.achievements-category {
  margin-bottom: 16px;
}

.achievements-category-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.achievements-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  transition: background var(--transition-fast);
}

.achievement-item.earned {
  background: rgba(255, 215, 0, 0.04);
}

.achievement-item:not(.earned) {
  opacity: 0.4;
}

.achievement-item-emoji {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}

.achievement-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.achievement-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-white);
}

.achievement-item.earned .achievement-item-name {
  color: #ffd700;
}

.achievement-item-desc {
  font-size: 0.68rem;
  font-style: italic;
  color: var(--muted);
}

/* Desktop: wider panel, centered */
@media (min-width: 600px) {
  .achievements-panel {
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    max-width: 500px;
    border-radius: 16px 16px 0 0;
  }

  .achievements-panel-open {
    transform: translateX(-50%) translateY(0);
  }
}

/* Toast notifications */
#achievement-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.achievement-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(10, 14, 23, 0.95);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2), 0 0 50px rgba(255, 215, 0, 0.05);
  backdrop-filter: blur(20px);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  pointer-events: auto;
  max-width: 320px;
}

.achievement-toast-visible {
  transform: translateX(0);
}

.achievement-toast-leaving {
  transform: translateX(120%);
  opacity: 0;
}

.achievement-toast-emoji {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.achievement-toast-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.achievement-toast-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #ffd700;
  font-weight: 600;
}

.achievement-toast-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-white);
}

.achievement-toast-desc {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-primary);
  opacity: 0.8;
}

/* Mobile toast positioning */
@media (max-width: 480px) {
  #achievement-toast {
    top: auto;
    bottom: 20px;
    right: 10px;
    left: 10px;
  }

  .achievement-toast {
    max-width: none;
    transform: translateY(120%);
  }

  .achievement-toast-visible {
    transform: translateY(0);
  }

  .achievement-toast-leaving {
    transform: translateY(120%);
    opacity: 0;
  }
}

/* ============================================================
   19. Upgrades
   ============================================================ */

.upgrades-section {
  margin-top: 24px;
}

.upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(123, 104, 238, 0.03);
  border-left: 3px solid transparent;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-med);
  margin-bottom: 2px;
}

.upgrade-row:hover {
  background: rgba(123, 104, 238, 0.06);
}

.upgrade-row.can-afford {
  border-left-color: var(--accent-purple);
  background: rgba(123, 104, 238, 0.06);
  box-shadow: inset 0 0 20px rgba(123, 104, 238, 0.03);
}

.upgrade-row.maxed {
  opacity: 0.5;
}

.upgrade-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.upgrade-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.upgrade-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.upgrade-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #b8a9f0;
}

.upgrade-desc {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--muted);
}

.upgrade-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 170px;
  justify-content: flex-end;
}

.upgrade-level {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-purple);
  min-width: 36px;
  text-align: right;
}

.maxed-label {
  color: #ffd700;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.upgrade-buy {
  border-color: rgba(123, 104, 238, 0.3);
}

.upgrade-buy:not(.disabled):hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(123, 104, 238, 0.2);
}

/* ============================================================
   20. Responsive Adjustments
   ============================================================ */

@media (max-width: 380px) {
  .rain-container {
    padding: 16px 14px 48px;
  }

  .rain-click-zone {
    min-height: 170px;
  }

  .generator-row {
    padding: 12px 12px;
  }

  .buy-btn {
    padding: 7px 12px;
    font-size: 0.68rem;
  }

  .generator-emoji {
    font-size: 1.2rem;
    width: 28px;
  }
}

@media (min-width: 481px) {
  .rain-container {
    padding: 28px 24px 80px;
  }

  .rain-click-zone {
    min-height: 220px;
  }
}

/* ============================================================
   The Ending
   ============================================================ */

.game-ended .rain-header .prestige-badge,
.game-ended .generators-section,
.game-ended .upgrades-section,
.game-ended .stats-section,
.game-ended .prestige-section,
.game-ended .weather-section {
  display: none;
}

.game-ended .hero-count {
  animation: none;
  font-size: clamp(2rem, 8vw, 3.5rem);
  opacity: 0.6;
}

.game-ended .hero-dps {
  display: none;
}

.game-ended .rain-click-zone {
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
}

.game-ended .click-text {
  display: none;
}

.game-ended .click-icon {
  animation: none;
  opacity: 0.4;
}

.game-ended .milestone-text {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-top: 40px;
}

.game-ended .rain-logo {
  opacity: 0.3;
}

/* Stop rain when game has ended */
body:has(.game-ended) .raindrop-bg {
  animation-play-state: paused;
  opacity: 0;
  transition: opacity 3s ease;
}

/* ============================================================
   20. Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .raindrop-bg,
  .click-icon,
  .hero-count,
  .prestige-btn {
    animation: none;
  }

  .raindrop-ripple,
  .drop-floater {
    animation: none;
    display: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
