/* Floating formulas / graphs background (homepage + leaderboard) */
.math-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.math-rain__item {
  position: absolute;
  top: -12%;
  left: 0;
  color: var(--math-color, rgba(147, 197, 253, 0.22));
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 0 8px color-mix(in srgb, var(--math-color, #93c5fd) 40%, transparent);
  animation: math-rain-fall linear infinite;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
}

.math-rain__item--graph {
  padding: 0;
  color: rgba(125, 211, 252, 0.28);
  text-shadow: none;
}

.math-rain__svg {
  width: 120px;
  height: 74px;
  display: block;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--math-color, #93c5fd) 45%, transparent));
}

.math-rain__axis {
  stroke: color-mix(in srgb, var(--math-color, #93c5fd) 55%, #94a3b8 45%);
  stroke-width: 1;
}

.math-rain__curve {
  fill: none;
  stroke: var(--math-color, rgba(125, 211, 252, 0.8));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.math-rain__shape {
  fill: none;
  stroke: var(--math-color, rgba(125, 211, 252, 0.85));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.math-rain__shape--fill {
  fill: color-mix(in srgb, var(--math-color, #93c5fd) 30%, transparent);
  stroke: var(--math-color, rgba(125, 211, 252, 0.85));
  stroke-width: 1.4;
}

@keyframes math-rain-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -6vh, 0) rotate(-2deg);
  }
  10% { opacity: 0.24; }
  80% { opacity: 0.2; }
  100% {
    opacity: 0;
    transform: translate3d(0, 116vh, 0) rotate(2deg);
  }
}

/* App layout: rain only in the main panel — do not restyle the sidebar */
body.page-math-rain .math-rain {
  z-index: 0;
}

@media (min-width: 901px) {
  body.page-math-rain .math-rain {
    left: 260px;
    width: auto;
    right: 0;
  }
}

body.page-math-rain .main {
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  body.page-math-rain .sidebar-overlay {
    z-index: 1000;
  }

  body.page-math-rain .sidebar {
    z-index: 1001;
  }
}
