/* Redesigned Card bases (Weapon, Skin, Map) with Glassmorphism and transitions */
.map-card,
.weapon-card,
.skin-card {
  padding: 16px;
  border-radius: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.map-card::before,
.weapon-card::before,
.skin-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.map-card:hover:not(:disabled),
.weapon-card:hover:not(:disabled),
.skin-card:hover:not(:disabled) {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 210, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.map-card:hover::before,
.weapon-card:hover::before,
.skin-card:hover::before {
  opacity: 1;
}

.map-card h4,
.weapon-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.map-card p,
.weapon-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

/* Weapon Cards States */
.weapon-card.locked {
  border-color: rgba(255, 74, 90, 0.2);
  background: rgba(255, 74, 90, 0.02);
}

.weapon-card.locked p {
  color: #ff9da6;
}

.weapon-card.unlocked {
  border-color: rgba(0, 230, 118, 0.25);
  background: rgba(0, 230, 118, 0.02);
}

.weapon-card.selected {
  border-color: var(--accent);
  background: rgba(0, 210, 255, 0.06);
  box-shadow: 0 0 18px var(--accent-glow), inset 0 0 10px rgba(0, 210, 255, 0.15);
}

.loadout-subtitle {
  text-align: left;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 14px;
  border-bottom: 1px solid rgba(0, 210, 255, 0.15);
  padding-bottom: 6px;
}

/* Skin Selection Cards */
.skin-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 84px;
}

.skin-card strong {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
}

.skin-card span {
  color: var(--muted);
  font-size: 0.78rem;
}

.skin-card.selected {
  border-color: var(--accent);
  background: rgba(0, 210, 255, 0.08);
  box-shadow: 0 0 15px var(--accent-glow), inset 0 0 8px rgba(0, 210, 255, 0.1);
}

.skin-card.gold {
  border-color: rgba(255, 200, 87, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 200, 87, 0.18), rgba(130, 88, 20, 0.08)),
    rgba(15, 22, 31, 0.76);
}

.skin-card.gold strong {
  color: #ffe39a;
  text-shadow: 0 0 8px rgba(255, 200, 87, 0.28);
}

.skin-card.silver {
  border-color: rgba(210, 229, 245, 0.34);
  background:
    linear-gradient(135deg, rgba(224, 238, 250, 0.16), rgba(87, 108, 130, 0.09)),
    rgba(15, 22, 31, 0.76);
}

.skin-card.silver strong {
  color: #edf7ff;
  text-shadow: 0 0 8px rgba(180, 216, 255, 0.22);
}

.skin-card.rainbow {
  border-color: rgba(125, 249, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 77, 242, 0.18), rgba(255, 230, 109, 0.14), rgba(125, 249, 255, 0.16)),
    rgba(13, 22, 38, 0.78);
}

.skin-card.rainbow strong {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(125, 249, 255, 0.4), 0 0 14px rgba(255, 77, 242, 0.28);
}

/* Premium Rival Skins (Neon Gold & Purple Rarity) */
.skin-card.rival {
  border-color: rgba(255, 231, 109, 0.38);
  background: 
    linear-gradient(135deg, rgba(140, 82, 255, 0.16), rgba(255, 77, 242, 0.12), rgba(255, 231, 109, 0.08)),
    rgba(13, 22, 38, 0.75);
}

.skin-card.rival strong {
  color: #ffe890;
  text-shadow: 0 0 8px rgba(255, 231, 109, 0.3);
}

.skin-card.rival:hover:not(:disabled) {
  border-color: rgba(255, 231, 109, 0.75);
  box-shadow: 0 0 18px var(--gold-glow), 0 8px 24px rgba(0,0,0,0.45);
}

.skin-card.rival.selected {
  border-color: var(--gold);
  background: 
    linear-gradient(135deg, rgba(140, 82, 255, 0.22), rgba(255, 77, 242, 0.16), rgba(255, 231, 109, 0.12)),
    rgba(14, 25, 45, 0.85);
  box-shadow: 0 0 20px var(--gold-glow), inset 0 0 12px rgba(255, 231, 109, 0.2);
}

/* AI Difficulty Panel (Glassmorphic) */
.difficulty-panel {
  width: 100%;
  max-width: 1020px;
  padding: 20px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.25s both;
}

.difficulty-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.difficulty-heading h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.difficulty-heading p {
  color: #d1e2f7;
  font-size: 0.88rem;
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* Difficulty Grid & Dynamic Cards Colors */
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.difficulty-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 128px;
  padding: 16px;
  border-radius: 14px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)), rgba(10, 24, 43, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  outline: none;
}

.difficulty-card span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.difficulty-card strong {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.difficulty-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  margin-top: 2px;
}

.difficulty-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Color Coding for Difficulty Levels via child selectors */
.difficulty-grid button:nth-child(1) span {
  color: #00e676;
}
.difficulty-grid button:nth-child(1).selected {
  border-color: #00e676;
  background: rgba(0, 230, 118, 0.06);
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.3), inset 0 0 8px rgba(0, 230, 118, 0.1);
}

.difficulty-grid button:nth-child(2) span {
  color: #29b6f6;
}
.difficulty-grid button:nth-child(2).selected {
  border-color: #29b6f6;
  background: rgba(41, 182, 246, 0.06);
  box-shadow: 0 0 15px rgba(41, 182, 246, 0.3), inset 0 0 8px rgba(41, 182, 246, 0.1);
}

.difficulty-grid button:nth-child(3) span {
  color: #ff9100;
}
.difficulty-grid button:nth-child(3).selected {
  border-color: #ff9100;
  background: rgba(255, 145, 0, 0.06);
  box-shadow: 0 0 15px rgba(255, 145, 0, 0.3), inset 0 0 8px rgba(255, 145, 0, 0.1);
}

/* Nightmare level gets Threatening Pulsing Red glow */
.difficulty-grid button:nth-child(4) span {
  color: #ff3d00;
}
.difficulty-grid button:nth-child(4).selected {
  border-color: #ff3d00;
  background: rgba(255, 61, 0, 0.08);
  box-shadow: 0 0 18px rgba(255, 61, 0, 0.4);
  animation: nightmareGlowPulse 2s infinite alternate;
}

@keyframes nightmareGlowPulse {
  0% {
    box-shadow: 0 0 10px rgba(255, 61, 0, 0.25), inset 0 0 5px rgba(255, 61, 0, 0.1);
    border-color: #ff3d00;
  }
  100% {
    box-shadow: 0 0 20px rgba(255, 61, 0, 0.65), inset 0 0 10px rgba(255, 61, 0, 0.2);
    border-color: #ff6e40;
  }
}

/* Custom Scrollbar for Weapon Grids to fit nicely */
.weapon-grid::-webkit-scrollbar {
  width: 5px;
}
.weapon-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}
.weapon-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.2);
  border-radius: 999px;
}
.weapon-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 210, 255, 0.45);
}

/* LAN Lobby Input styling */
#lanManualHostInput {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(3, 8, 18, 0.6);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  outline: none;
}

#lanManualHostInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
  background: rgba(3, 8, 18, 0.85);
}

/* LAN Room cards */
.lan-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 210, 255, 0.15);
  text-align: left;
  transition: all 0.3s ease;
}

.lan-room:hover {
  border-color: rgba(0, 210, 255, 0.35);
  background: rgba(0, 210, 255, 0.03);
}

.lan-room > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lan-room strong {
  font-size: 1rem;
  color: #fff;
}

.lan-room span {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Balance report styling (Match Result Screen) */
.balance-summary {
  margin: 16px auto 0 auto;
  width: 100%;
  max-width: 640px;
  padding: 20px;
  border-radius: 16px;
  text-align: left;
  background: rgba(4, 11, 23, 0.65);
  border: 1px solid rgba(0, 210, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.balance-summary h4 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  border-bottom: 1px solid rgba(0, 210, 255, 0.15);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.balance-summary .balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.balance-summary .balance-row:last-of-type {
  border-bottom: none;
}

.balance-summary .balance-row span {
  color: var(--muted);
}

.balance-summary .balance-row strong {
  color: #fff;
  font-weight: 700;
}

/* Challenge ranking preview widget */
.ranking-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(0, 210, 255, 0.03);
  border: 1px solid rgba(0, 210, 255, 0.12);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

.ranking-preview strong {
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ranking-preview span {
  display: block;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2eeff;
}

.ranking-preview span:nth-of-type(1) {
  border-color: rgba(255, 231, 109, 0.25);
  color: #ffe699;
  background: rgba(255, 231, 109, 0.04);
  font-weight: 700;
}

/* Responsiveness media overrides */
@media (max-width: 820px) {
  .difficulty-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .difficulty-heading p {
    align-self: flex-start;
  }

  .difficulty-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .difficulty-grid {
    grid-template-columns: 1fr;
  }
}
