/**
 * Item.showCooldown + Shader/ItemProgress.gdshader
 *
 * Filled texels: mix(rgb, white, 0.05) then * 1.5. Progress grows from
 * screen-bottom (direction = DOWN, rotateProgress inverts UP/RIGHT).
 * Pad is the game's `progress + 0.05` so a thin strip is visible at 0.
 *
 * Overlay is the sprite itself (PNG alpha = silhouette). No white plate,
 * no extra WebGL — one background image + brightness, painted only while .is-on.
 */

.sim-cd-shade {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  z-index: 6;
  pointer-events: none;
  visibility: hidden;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-image: linear-gradient(
    var(--sim-cd-unspin, 0deg),
    #000 0%,
    #000 calc((var(--sim-cd, 0) + 0.05) * 100%),
    transparent calc((var(--sim-cd, 0) + 0.05) * 100% + 2%)
  );
  mask-image: linear-gradient(
    var(--sim-cd-unspin, 0deg),
    #000 0%,
    #000 calc((var(--sim-cd, 0) + 0.05) * 100%),
    transparent calc((var(--sim-cd, 0) + 0.05) * 100% + 2%)
  );
}

/* Inside .bpb-live: sit on flask/base, under glass overlay + glow children. */
.sim-cd-shade--live {
  top: 0;
  left: 0;
  translate: none;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.sim-cd-shade.is-on {
  visibility: visible;
  /* ItemProgress: COLOR.rgb *= 1.5 after a 5% white mix (mix is nearly invisible). */
  filter: brightness(1.5);
}

/* Coverage markers — item root is unrotated, so top-right is the board corner. */
.sim-cov-mark {
  display: none;
  position: absolute;
  top: 0.04em;
  right: 0.04em;
  z-index: 12;
  width: clamp(0.9rem, 0.3em, 1.6rem);
  height: clamp(0.9rem, 0.3em, 1.6rem);
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(40, 30, 20, 0.45));
}

.sim-cov-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sim-shell--coverage .sim-cov-mark {
  display: block;
}

/* Engineer / Battery charge spark (Band S) — em coords match .bpb-bg__item */
.sim-charge-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  overflow: visible;
  font-size: inherit;
}

.sim-charge-tile {
  position: absolute;
  left: 0;
  top: 0;
  width: 1em;
  height: 1em;
  will-change: left, top, opacity;
}

.sim-charge-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: screen;
  opacity: 0.85;
}

.sim-charge-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 0.7em;
  height: 0.7em;
  will-change: left, top, transform, opacity;
  filter: drop-shadow(0 0 0.08em rgba(255, 236, 180, 0.85));
}

.sim-charge-spark__trail,
.sim-charge-spark__ball {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  pointer-events: none;
  user-select: none;
}

.sim-charge-spark__trail {
  width: 0.45em;
  height: 0.45em;
  opacity: 0.75;
}

.sim-charge-spark__ball {
  width: 0.65em;
  height: 0.65em;
}

@media (prefers-reduced-motion: reduce) {
  .sim-charge-spark,
  .sim-charge-tile {
    transition: none;
  }
}
