/* Full-height branching lightning OVER the map, never a replacement backdrop.
   Legacy #rain is the existing shell mount, not a rain effect. No drops/clouds,
   white-screen flash, audio, shake, timers or per-frame particle allocation. */
#rain {
  position: fixed;
  inset: 0;
  z-index: 480;
  overflow: hidden;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  contain: strict;
}
#rain.on { opacity: 1; visibility: visible; }
#rain::before, #rain::after {
  content: '';
  position: absolute;
  inset: -8%;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background:
    radial-gradient(circle at 4% 18%, #ff453acc 0 1.5%, #ff1f1680 3%, transparent 13%),
    radial-gradient(circle at 96% 30%, #ff5d52c4 0 1.4%, #ff1f1670 3%, transparent 14%),
    radial-gradient(circle at 10% 78%, #ff392f9c 0 1.1%, #ff120a55 3%, transparent 12%);
  animation: captureLightningSky 1.8s linear infinite;
  animation-play-state: paused;
}
#rain::after {
  transform: scaleX(-1);
  animation-delay: -0.9s;
}
#rain.on::before, #rain.on::after { animation-play-state: running; }
#rain .capture-lightning {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}
.capture-bolt {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  filter:
    drop-shadow(0 0 2px #fff5f2)
    drop-shadow(0 0 8px #ff453a)
    drop-shadow(0 0 22px #ff1f16)
    drop-shadow(0 0 42px #d90b05);
  animation: captureLightning 1.8s linear infinite;
  animation-play-state: paused;
}
.capture-bolt-1 { animation-delay: -0.9s; }
.capture-bolt-glow { stroke: #ff160d; stroke-width: 24px; stroke-opacity: .24; }
.capture-bolt-halo { stroke: #ff5147; stroke-width: 8px; stroke-opacity: .88; }
.capture-bolt-core { stroke: #fff3f0; stroke-width: 2.4px; stroke-opacity: 1; }
#rain.on .capture-bolt { animation-play-state: running; }
/* Continuous warning while ×0,8 is active: the two bolts alternate every 0.9 s.
   Each cycle has two short peaks, keeping the storm visibly alive without a
   whole-screen strobe. The animation stops immediately when red mode ends. */
@keyframes captureLightning {
  0%, 100% { opacity: 0; transform: scale(.995); }
  4% { opacity: 1; transform: scale(1.006); }
  10% { opacity: .22; }
  14% { opacity: .98; transform: scale(1.01); }
  23% { opacity: .38; }
  32% { opacity: .86; }
  46% { opacity: .16; }
  58% { opacity: 0; transform: scale(1.012); }
}
@keyframes captureLightningSky {
  0%, 100% { opacity: 0; }
  4% { opacity: .78; }
  9% { opacity: .10; }
  14% { opacity: .58; }
  22% { opacity: .08; }
  32% { opacity: .34; }
  44%, 100% { opacity: 0; }
}

/* Same position and size for both mutually exclusive states. The main number
   is readable at holder distance; do not rename the smoothness label. */
#rainPenalty, #qualityBonus {
  position: absolute;
  top: calc(207px + env(safe-area-inset-top));
  left: 24px;
  right: 24px;
  z-index: 490;
  pointer-events: none;
  box-sizing: border-box;
  text-align: center;
  border: 2px solid currentColor;
  border-radius: 18px;
  padding: 8px 12px 10px;
  box-shadow: 0 4px 20px #0005;
}
#rainPenalty { background: #291216f2; color: #ff8a80; }
#qualityBonus { background: #0c2922f2; color: #6cf0bd; }
#rainPenalty[hidden], #qualityBonus[hidden] { display: none; }
#rainPenalty .capture-multiplier-value, #qualityBonus .capture-multiplier-value {
  display: block;
  font-size: clamp(56px, 16vw, 76px);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  color: inherit;
}
#rainPenalty b, #qualityBonus b { display: block; font-size: 16px; line-height: 1.2; margin-top: 5px; color: inherit; }
/* Keep the original localized explanation for assistive technology without
   a second, tiny multiplier competing with the large number. */
#rainPenalty span, #qualityBonus span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* The large active banner replaces the two small multiplier duplicates only. */
#glassBonusBadge, #glassPenaltyBadge { display: none; }

@media (max-height: 650px) {
  #rainPenalty, #qualityBonus { top: calc(180px + env(safe-area-inset-top)); padding: 6px 10px 8px; }
  #rainPenalty .capture-multiplier-value, #qualityBonus .capture-multiplier-value { font-size: 56px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  #rainPenalty, #qualityBonus { top: 145px; left: 8px; right: auto; width: 230px; max-width: calc(100vw - 16px); padding: 8px; }
  #rainPenalty .capture-multiplier-value, #qualityBonus .capture-multiplier-value { font-size: 52px; }
  #rainPenalty b, #qualityBonus b { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #rain { display: none; }
  #rain .capture-bolt, #rain::before, #rain::after { animation: none; }
}
