/* Aujunpeak Soft Rain v7 — always-on, pointer-safe public rain layer. */
.soft-rain-canvas,
#auj-soft-rain-canvas {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100vh;
  z-index: 80 !important;
  pointer-events: none !important;
  display: block !important;
  visibility: visible !important;
  opacity: .84;
  background: transparent !important;
  mix-blend-mode: normal !important;
  transform: translateZ(0);
  contain: strict;
}

.rain-sound-toggle {
  position: fixed;
  left: calc(var(--sidebar-w, 264px) + 16px);
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  min-width: 42px;
  height: 40px;
  padding: 0 11px 0 9px;
  border: 1px solid rgba(191, 229, 255, .20);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: visible;
  isolation: isolate;
  color: rgba(226, 244, 255, .86);
  background:
    linear-gradient(145deg, rgba(30, 51, 70, .82), rgba(9, 19, 30, .88)),
    rgba(8, 17, 27, .88);
  box-shadow:
    0 8px 24px rgba(0, 7, 14, .36),
    inset 0 1px 0 rgba(255, 255, 255, .11),
    inset 0 -8px 15px rgba(7, 19, 30, .24);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  cursor: pointer;
  opacity: .90;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.rain-sound-toggle::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px 2px auto 2px;
  height: 44%;
  border-radius: 12px 12px 48% 48%;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0));
  pointer-events: none;
}

.rain-sound-toggle::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: min(230px, calc(100vw - 28px));
  padding: 6px 9px;
  border: 1px solid rgba(191, 229, 255, .15);
  border-radius: 9px;
  color: rgba(238, 248, 255, .88);
  background: rgba(6, 14, 23, .94);
  box-shadow: 0 8px 24px rgba(0, 5, 11, .42);
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .01em;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .18s ease, transform .18s ease;
}

.rain-sound-toggle:hover,
.rain-sound-toggle:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(195, 232, 255, .35);
  box-shadow:
    0 11px 28px rgba(0, 7, 14, .42),
    0 0 18px rgba(95, 180, 230, .11),
    inset 0 1px 0 rgba(255, 255, 255, .14);
}

.rain-sound-toggle:hover::after,
.rain-sound-toggle:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.rain-sound-toggle:focus-visible {
  outline: 2px solid rgba(147, 215, 255, .72);
  outline-offset: 3px;
}

.rain-sound-toggle__drop {
  position: relative;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 7px rgba(130, 210, 255, .25));
}

.rain-sound-toggle__drop svg {
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: rgba(171, 222, 251, .84);
  stroke: rgba(237, 249, 255, .54);
  stroke-width: .7;
}

.rain-sound-toggle__drop::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 4px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255,255,255,.72);
  transform: rotate(-35deg);
}

.rain-sound-toggle__drop::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 16px;
  height: 1.5px;
  border-radius: 9px;
  background: rgba(236, 246, 252, .76);
  box-shadow: 0 0 5px rgba(0, 7, 14, .48);
  opacity: 0;
  transform: rotate(-42deg) scaleX(.7);
  transition: opacity .2s ease, transform .2s ease;
}

.rain-sound-toggle__label {
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .025em;
  white-space: nowrap;
}

.rain-sound-toggle__meter {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5px;
  opacity: .52;
}

.rain-sound-toggle__meter i {
  width: 2px;
  height: 3px;
  border-radius: 4px;
  background: #a9ddfa;
  transform-origin: bottom;
}

.rain-sound-toggle.is-on {
  color: rgba(239, 250, 255, .96);
  border-color: rgba(132, 207, 248, .32);
  background:
    linear-gradient(145deg, rgba(29, 65, 88, .88), rgba(8, 25, 39, .91)),
    rgba(7, 18, 29, .92);
}

.rain-sound-toggle.is-on .rain-sound-toggle__meter { opacity: .92; }
.rain-sound-toggle.is-on .rain-sound-toggle__meter i { animation: rainSoundWave .95s ease-in-out infinite alternate; }
.rain-sound-toggle.is-on .rain-sound-toggle__meter i:nth-child(2) { animation-delay: -.62s; }
.rain-sound-toggle.is-on .rain-sound-toggle__meter i:nth-child(3) { animation-delay: -.31s; }

.rain-sound-toggle.is-waiting .rain-sound-toggle__drop {
  animation: rainSoundWaiting 2.4s ease-in-out infinite;
}

.rain-sound-toggle.is-off {
  color: rgba(214, 224, 231, .56);
  border-color: rgba(190, 214, 228, .12);
  opacity: .68;
}

.rain-sound-toggle.is-off .rain-sound-toggle__drop svg { opacity: .48; }
.rain-sound-toggle.is-off .rain-sound-toggle__drop::before { opacity: .28; }
.rain-sound-toggle.is-off .rain-sound-toggle__drop::after {
  opacity: .88;
  transform: rotate(-42deg) scaleX(1);
}

body.theme-light .rain-sound-toggle,
body.auth-body-light .rain-sound-toggle {
  color: rgba(27, 71, 101, .84);
  border-color: rgba(35, 100, 142, .20);
  background: linear-gradient(145deg, rgba(238, 248, 253, .92), rgba(205, 226, 239, .90));
  box-shadow: 0 8px 22px rgba(28, 73, 103, .18), inset 0 1px 0 rgba(255,255,255,.72);
}

body.theme-light .rain-sound-toggle__drop svg,
body.auth-body-light .rain-sound-toggle__drop svg { fill: rgba(39, 116, 164, .70); stroke: rgba(15, 78, 118, .42); }

body.auth-body .rain-sound-toggle { left: max(14px, env(safe-area-inset-left)); }

/*
 * Collision-safe floating controls:
 * - Desktop: rain control is docked above the music launcher.
 * - Phone/tablet: both compact launchers sit side by side below the music panel.
 */
@media (min-width: 769px) {
  .rain-sound-toggle {
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 80px));
  }
}

@keyframes rainSoundWave {
  0% { height: 3px; opacity: .48; }
  100% { height: 11px; opacity: 1; }
}

@keyframes rainSoundWaiting {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 5px rgba(130,210,255,.18)); }
  50% { transform: translateY(-1px); filter: drop-shadow(0 0 10px rgba(130,210,255,.42)); }
}

body.theme-light .soft-rain-canvas,
body.theme-light #auj-soft-rain-canvas {
  opacity: .60;
}

@media (max-width: 768px) {
  .soft-rain-canvas,
  #auj-soft-rain-canvas { opacity: .72; }
  body.theme-light .soft-rain-canvas,
  body.theme-light #auj-soft-rain-canvas { opacity: .52; }

  .rain-sound-toggle {
    left: max(80px, calc(env(safe-area-inset-left) + 80px));
    bottom: max(12px, env(safe-area-inset-bottom));
    height: 38px;
    min-width: 38px;
    border-radius: 13px;
  }
}

@media (max-width: 600px) {
  .rain-sound-toggle {
    left: max(64px, calc(env(safe-area-inset-left) + 64px));
  }
}

@media (max-width: 480px) {
  .rain-sound-toggle {
    width: 38px;
    padding: 0;
    gap: 0;
  }
  .rain-sound-toggle__label,
  .rain-sound-toggle__meter { display: none; }
  .rain-sound-toggle::after { display: none; }
}

/* Do not hide the canvas for reduced-motion: the JS engine automatically reduces density instead. */
@media (prefers-reduced-motion: reduce) {
  .soft-rain-canvas,
  #auj-soft-rain-canvas { opacity: .48; }
  .rain-sound-toggle,
  .rain-sound-toggle::after { transition: none; }
  .rain-sound-toggle.is-on .rain-sound-toggle__meter i,
  .rain-sound-toggle.is-waiting .rain-sound-toggle__drop { animation: none; }
}

@media print {
  .soft-rain-canvas,
  #auj-soft-rain-canvas,
  .rain-sound-toggle { display: none !important; }
}
