/* ── TEAM GENERATOR — GAME STYLE ── */

@keyframes tgGlowPulse {
  0%,
  100% {
    box-shadow:
      0 0 8px rgba(0, 255, 135, 0.2),
      0 0 20px rgba(0, 255, 135, 0.07);
  }
  50% {
    box-shadow:
      0 0 16px rgba(0, 255, 135, 0.4),
      0 0 36px rgba(0, 255, 135, 0.15);
  }
}
@keyframes tgGlowPulseB {
  0%,
  100% {
    box-shadow:
      0 0 8px rgba(168, 85, 247, 0.2),
      0 0 20px rgba(168, 85, 247, 0.07);
  }
  50% {
    box-shadow:
      0 0 16px rgba(168, 85, 247, 0.4),
      0 0 36px rgba(168, 85, 247, 0.15);
  }
}
@keyframes tgTitleFlicker {
  0%,
  94%,
  100% {
    opacity: 1;
    text-shadow:
      0 0 20px rgba(0, 255, 135, 0.5),
      0 0 40px rgba(0, 255, 135, 0.2);
  }
  95% {
    opacity: 0.6;
    text-shadow: none;
  }
  97% {
    opacity: 1;
    text-shadow: 0 0 20px rgba(0, 255, 135, 0.5);
  }
  98% {
    opacity: 0.7;
  }
}
@keyframes tgShake {
  0%,
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
  }
  15% {
    transform: translateX(-5px) rotate(-4deg) scale(1.06);
  }
  35% {
    transform: translateX(5px) rotate(4deg) scale(1.06);
  }
  55% {
    transform: translateX(-4px) rotate(-2deg) scale(1.03);
  }
  75% {
    transform: translateX(4px) rotate(2deg) scale(1.03);
  }
}
@keyframes tgSpin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(200deg) scale(1.35);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}
@keyframes tgDot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.8);
    opacity: 1;
  }
}
@keyframes tgPopIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.88);
  }
  65% {
    transform: translateY(-2px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes tgCounterPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.5);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes tgScanline {
  0% {
    top: -10%;
  }
  100% {
    top: 110%;
  }
}

.teamgen-modal {
  max-width: 580px;
  width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 24px 28px;
  position: relative;
  background: #0d1117;
  border: 1px solid rgba(0, 255, 135, 0.2);
  box-shadow:
    0 0 0 1px rgba(0, 255, 135, 0.05),
    0 28px 70px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  contain: paint;
}

/* Scanlines */
.teamgen-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.05) 3px,
    rgba(0, 0, 0, 0.05) 4px
  );
  pointer-events: none;
  z-index: 0;
}
.teamgen-modal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 255, 135, 0.025),
    transparent
  );
  pointer-events: none;
  z-index: 0;
  animation: tgScanline 5s linear infinite;
}
.teamgen-modal > * {
  position: relative;
  z-index: 1;
}

.teamgen-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}
.teamgen-close:hover {
  background: rgba(255, 60, 60, 0.15);
  border-color: rgba(255, 60, 60, 0.4);
  color: #ff5555;
}

.teamgen-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #00ff87;
  text-shadow:
    0 0 20px rgba(0, 255, 135, 0.5),
    0 0 40px rgba(0, 255, 135, 0.2);
  margin-bottom: 3px;
  animation: tgTitleFlicker 7s ease-in-out infinite;
}
.teamgen-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

/* Counter dots */
.teamgen-counter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}
.teamgen-counter-dot {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.2);
  transition: all 0.2s;
}
.teamgen-counter-dot.filled {
  border-color: rgba(0, 255, 135, 0.55);
  background: rgba(0, 255, 135, 0.1);
  color: #00ff87;
  text-shadow: 0 0 8px rgba(0, 255, 135, 0.7);
  animation: tgCounterPop 0.25s ease;
}
.teamgen-counter-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.25);
  margin-left: 4px;
}
.teamgen-counter-label.warn {
  color: #f97316;
  text-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}
.teamgen-counter-label.ok {
  color: #00ff87;
  text-shadow: 0 0 8px rgba(0, 255, 135, 0.4);
}

/* Player grid */
.teamgen-player-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  gap: 9px;
  margin-bottom: 18px;
}

.teamgen-player-card {
  border: 1.5px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  min-height: 80px;
  width: 100%;
  transition:
    border-color 0.15s,
    transform 0.12s,
    opacity 0.2s;
  user-select: none;
  background: #1a1f2e;
}
.teamgen-player-card:hover:not(.maxed) {
  transform: translateY(-2px) scale(1.02);
}
.teamgen-player-card.selected {
  border-color: rgba(0, 255, 135, 0.6);
  box-shadow: 0 0 14px rgba(0, 255, 135, 0.2);
}
.teamgen-player-card.selected .teamgen-check {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.teamgen-player-card.maxed:not(.selected) {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none !important;
}
.teamgen-player-card.shuffling {
  animation: tgShake 0.55s ease-in-out;
  border-color: rgba(168, 85, 247, 0.7) !important;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.3) !important;
}

.teamgen-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #00ff87;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #0a1628;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.3) rotate(45deg);
  transition:
    opacity 0.18s,
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 3;
}

.teamgen-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  border: none;
  display: block;
  margin: 0;
}
.teamgen-avatar-ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: none;
  margin: 0;
}

.teamgen-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    rgba(0, 0, 0, 0.75) 70%,
    rgba(0, 0, 0, 0.92) 100%
  );
  border-radius: 10px;
  z-index: 1;
  pointer-events: none;
}
.teamgen-player-card.selected .teamgen-card-overlay {
  background: linear-gradient(
    to bottom,
    rgba(0, 255, 135, 0.1) 0%,
    transparent 35%,
    rgba(0, 0, 0, 0.75) 70%,
    rgba(0, 0, 0, 0.92) 100%
  );
}

.teamgen-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 7px 8px;
  z-index: 2;
}

.teamgen-pname {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.teamgen-prating {
  font-size: 10px;
  color: rgba(255, 255, 135, 0.7);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Actions */
.teamgen-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.teamgen-btn-all,
.teamgen-btn-none {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.15s;
}
.teamgen-btn-all:hover {
  background: rgba(0, 255, 135, 0.08);
  border-color: rgba(0, 255, 135, 0.35);
  color: #00ff87;
}
.teamgen-btn-none:hover {
  background: rgba(255, 80, 80, 0.08);
  border-color: rgba(255, 80, 80, 0.3);
  color: #ff6464;
}

.teamgen-btn-go {
  flex: 1;
  min-width: 150px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1.5px solid #00ff87;
  background: rgba(0, 255, 135, 0.08);
  color: #00ff87;
  cursor: pointer;
  text-shadow: 0 0 10px rgba(0, 255, 135, 0.5);
  box-shadow:
    0 0 14px rgba(0, 255, 135, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: all 0.15s;
}
.teamgen-btn-go:not(:disabled):hover {
  background: rgba(0, 255, 135, 0.15);
  box-shadow: 0 0 24px rgba(0, 255, 135, 0.25);
  transform: translateY(-1px);
}
.teamgen-btn-go:not(:disabled):active {
  transform: scale(0.97);
}
.teamgen-btn-go:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.18);
  cursor: not-allowed;
  text-shadow: none;
  box-shadow: none;
}

/* Loading */
.teamgen-rolling {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 0;
  gap: 16px;
}
.teamgen-rolling-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 255, 135, 0.55);
}
.teamgen-dice {
  font-size: 46px;
  filter: drop-shadow(0 0 14px rgba(0, 255, 135, 0.5));
  animation: tgSpin 0.75s ease-in-out infinite;
}
.teamgen-rolling-dots {
  display: flex;
  gap: 8px;
}
.teamgen-rolling-dots span {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: tgDot 0.65s ease-in-out infinite;
}
.teamgen-rolling-dots span:nth-child(1) {
  background: #00ff87;
  box-shadow: 0 0 8px rgba(0, 255, 135, 0.7);
}
.teamgen-rolling-dots span:nth-child(2) {
  background: #00d4ff;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.7);
  animation-delay: 0.18s;
}
.teamgen-rolling-dots span:nth-child(3) {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
  animation-delay: 0.36s;
}

/* Teams */
.teamgen-teams-wrap {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.teamgen-vs {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
  text-transform: uppercase;
}
.teamgen-team {
  flex: 1;
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.teamgen-team-a {
  background: rgba(0, 255, 135, 0.04);
  border: 1px solid rgba(0, 255, 135, 0.22);
  animation: tgGlowPulse 3s ease-in-out infinite;
}
.teamgen-team-b {
  background: rgba(168, 85, 247, 0.04);
  border: 1px solid rgba(168, 85, 247, 0.22);
  animation: tgGlowPulseB 3s ease-in-out infinite 0.5s;
}

.teamgen-team-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.teamgen-team-a .teamgen-team-header {
  color: #00ff87;
  text-shadow: 0 0 10px rgba(0, 255, 135, 0.4);
}
.teamgen-team-b .teamgen-team-header {
  color: #a855f7;
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}
.teamgen-team-avg {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.5;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
}

.teamgen-res-player {
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
}
.teamgen-res-player.pop-in {
  animation: tgPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.teamgen-res-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.teamgen-res-avatar-ph {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.teamgen-res-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.teamgen-res-rating {
  font-size: 11px;
  color: rgba(255, 255, 135, 0.4);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.teamgen-fair-label {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.teamgen-reshuffle {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.teamgen-reshuffle:hover {
  border-color: rgba(168, 85, 247, 0.4);
  color: #a855f7;
  background: rgba(168, 85, 247, 0.07);
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}
