.letter-swarm-shell {
  position: relative;
  min-height: clamp(420px, 58vw, 680px);
  margin-top: 18px;
  border: 1px solid rgba(139, 220, 203, 0.34);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--swarm-x, 50%) var(--swarm-y, 48%), rgba(139, 220, 203, 0.18), transparent 28%),
    linear-gradient(135deg, #070909 0%, #11100d 48%, #151014 100%);
  touch-action: none;
}

.letter-swarm-shell[hidden] {
  display: none;
}

.letter-swarm {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  user-select: none;
}

.letter-swarm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.letter-swarm::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 7.142% 100%,
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 100% 12.5%;
  opacity: 0.52;
  mix-blend-mode: screen;
}

.letter-swarm-hud {
  position: absolute;
  inset: 14px 14px auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #d9fff8;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.letter-swarm-mode {
  color: #8bdccb;
}

.letter-swarm-count {
  color: rgba(243, 240, 232, 0.68);
}

.letter-swarm-phrase {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 2;
  width: min(92%, 820px);
  transform: translateX(-50%);
  color: rgba(255, 247, 204, 0.92);
  font-size: clamp(1.6rem, 6vw, 5.8rem);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(139, 220, 203, 0.22);
  pointer-events: none;
}

.letter-swarm-shell[data-swarm-mode="collapse"] .letter-swarm-phrase {
  color: #fff7cc;
  text-shadow: 0 0 32px rgba(255, 215, 122, 0.42);
}

.letter-swarm-shell[data-swarm-mode="burst"] {
  border-color: rgba(255, 122, 102, 0.72);
  background:
    radial-gradient(circle at var(--swarm-x, 50%) var(--swarm-y, 48%), rgba(255, 122, 102, 0.22), transparent 28%),
    linear-gradient(135deg, #080708 0%, #12100c 48%, #171012 100%);
}

.letter-swarm-shell[data-swarm-mode="burst"] .letter-swarm-mode {
  color: #ff9a86;
}

.letter-swarm-shell[data-swarm-mode="phrase"] {
  border-color: rgba(255, 247, 204, 0.76);
  box-shadow: inset 0 0 0 1px rgba(255, 247, 204, 0.16), 0 0 42px rgba(255, 215, 122, 0.14);
}

@media (max-width: 760px) {
  .letter-swarm-shell {
    min-height: 460px;
  }

  .letter-swarm-hud {
    inset: 12px 12px auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .letter-swarm-phrase {
    bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .letter-swarm-shell {
    transition: none;
  }
}
