/* ==================== FONT & BASE ==================== */
@font-face {
  font-family: "BORD";
  src: url("/fonts/BORD.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

html,
body {
  height: 100%;
}

body {
  font-family: "BORD", Arial, sans-serif;
  background: url("/images/CLArcade.png") center center / contain no-repeat
    fixed;
  background-color: #0e1018;
  color: #d43108c5;
  margin: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

button {
  background: #0a49e9b9;
  color: #ee0d0d;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #6c9cff;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(14, 16, 24, 0) 0%,
    /* 0.5 instead of 0.8 */ rgba(19, 21, 34, 0.2) 100%
  );
  background-size: 400% 400%;
  animation: bgShift 16s ease-in-out infinite;
  z-index: 0;
}

@keyframes bgShift {
  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* ✅ Make sure all main content appears above the gradient */
body > header,
body > main {
  position: relative;
  z-index: 1;
}

/* ==================== HEADER ==================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: linear-gradient(90deg, #131522 0%, #1a1f36 100%);
  border-bottom: 2px solid #ffd94f33;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.wallet-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.address {
  font-size: 0.9em;
  color: #56d30d;
}

/* ==================== MAIN ==================== */
main {
  padding: 20px;
}

/* ==================== GRID & NFT CARDS ==================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 20px;
}

.card {
  background: #161a2b;
  border-radius: 12px;
  border: 1px solid #272b43;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.card img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  background: #0e1018;
  border-bottom: 1px solid #272b43;
}

.card-body {
  padding: 12px;
}

.card-body h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.power {
  font-weight: 700;
  color: #4cff98;
  margin-top: 4px;
  font-size: 14px;
}

.rarity {
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
}

/* ==================== COLLAPSIBLE TRAITS ==================== */
.traits-wrapper {
  margin-top: 6px;
  border-top: 1px solid #272b43;
}

.traits-toggle {
  cursor: pointer;
  font-size: 13px;
  color: #e00f89be;
  user-select: none;
  padding: 4px 0;
  transition: color 0.2s;
}

.traits-toggle:hover {
  color: #1aacd1;
}

.traits {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 6px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.traits.open {
  max-height: 240px;
  opacity: 1;
}

.traits div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted #333;
  padding: 2px 0;
}

/* === Colored trait labels/values (applies to grid + profile modal) === */
.grid .traits div span,
#profileNFTs .traits div span {
  color: #e60e0e;
  /* label (trait_type) */
}

.grid .traits div b,
#profileNFTs .traits div b {
  color: #86e40b;
  /* value */
}

/* === Wrap long trait text === */

#profileNFTs .traits div,
.grid .traits div {
  flex-wrap: wrap;
}

#profileNFTs .traits div span,
#profileNFTs .traits div b,
.grid .traits div span,
.grid .traits div b {
  word-break: break-word;
}

/* ==================== TEMP MESSAGE ==================== */
.temp-msg {
  display: inline-block;
  padding: 10px 12px;
  background: #20243b;
  border: 1px solid #2a2d3f;
  border-radius: 8px;
  color: #d49f0d;
  font-size: 14px;
}

/* ==================== PROFILE NFTs ==================== */
#profileNFTs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  padding-bottom: 8px;
}

/* === Reuse card styles with tweaks === */
#profileNFTs .card {
  background: #1ca095c5;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}

#profileNFTs .card:hover {
  transform: scale(1.03);
}

#profileNFTs .card img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  display: block;
  cursor: pointer;
  transition: transform 0.25s ease;
  background: #0e1018;
}

#profileNFTs .card img:hover {
  transform: scale(1.08);
}

#profileNFTs .card-body {
  padding: 8px;
  text-align: center;
}

#profileNFTs .card-body h3 {
  font-size: 14px;
  margin: 4px 0;
}

#profileNFTs .power {
  font-size: 12px;
  color: #12d48ad2;
}

.profile-nft-scroll {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 6px;
}

.profile-nft-scroll::-webkit-scrollbar {
  width: 8px;
}

.profile-nft-scroll::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.profile-nft-scroll::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ==================== MODALS ==================== */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
}

.modal.open {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.modal-content img {
  max-width: 85vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  background: #0e1018;
  border-radius: 10px;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 16px;
  color: #f50808;
  font-size: 26px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.close-modal:hover {
  color: #1172e0;
}

#nftModal {
  z-index: 20000 !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ==================== CHAT & LOBBY ==================== */
.lobby-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 12px 0 20px;
  overflow: visible;
  /* allow hover/glows to render fully */
  padding: 8px 8px 16px;
  /* tiny breathing room so glows aren’t flush */
}

/* REPLACE your existing .chat-box rule with this */
.chat-box {
  height: 420px;
  /* ↑ taller; tweak as you like */
  overflow-y: auto;
  background: rgba(12, 102, 177, 0.2);
  /* was #0c66b1; now 20% opacity */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  /* the blur magic */
  -webkit-backdrop-filter: blur(8px);
}

.chat-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#chatInput {
  flex: 1;
  background: rgba(40, 54, 133, 0.25);
  /* semi-transparent */
  color: #0eddd3;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#usernameInput {
  font-size: 14px;
  background: #20243b;
  color: #ec0c0c;
}

#usernameInput::placeholder {
  color: #73f00d;
}

/* --- Lobby chat bubbles --- */
.chat-line {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.chat-line.me {
  justify-content: flex-end;
}

.chat-inner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 80%;
}

.chat-line.me .chat-inner {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-line.me .chat-stack {
  align-items: flex-end;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4bb90a;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.chat-bubble {
  background: rgba(26, 29, 43, 0.6);
  color: #5cd60b;
  border-radius: 10px 10px 10px 0;
  padding: 6px 10px;
  margin-top: 2px;
  transition: background 0.15s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.chat-line.me .chat-bubble {
  background: rgba(43, 59, 91, 0.6);
  color: #0dd60d;
  border-radius: 10px 10px 0 10px;
}

.chat-line:hover .chat-meta {
  opacity: 1;
}

.chat-line.me:hover .chat-bubble {
  background: #354a73;
}

.chat-line:not(.me):hover .chat-bubble {
  background: #232846;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

#emojiBtn,
#sendChat {
  background: rgba(32, 36, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

#emojiBtn:hover,
#sendChat:hover {
  background: rgba(32, 36, 59, 0.55);
}

.emoji-panel {
  position: absolute;
  bottom: 48px;
  left: 10px;
  background: #1a1f36;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 8px;
  width: 260px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  max-height: 200px;
  overflow-y: auto;
  animation: emojiPop 0.2s ease;
}

.emoji-panel button {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.1s;
}

.emoji-panel button:hover {
  transform: scale(1.2);
}

@keyframes emojiPop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================
     BATTLE ARENA
     ============================ */
#battle {
  /* default/fallback */
  --arena-url: url("/images/arena.jpeg");

  /* keep your other arena styling */
  position: relative;
  min-height: 100vh;
  color: #fff;
  padding: 80px 40px 20px;

  text-align: center;
  overflow: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;

  /* use the variable for the image */
  background-image: var(--arena-url);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#battle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.85)
  );
  pointer-events: none;
  z-index: 0;
}

#battleStatus {
  font-size: 1.2rem;
  margin: 10px 0 30px;
  color: #eee;
  transition: opacity 0.3s;
}

#playerCards {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 60px;
  margin-top: 40px;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}

.battle-player {
  background: rgba(20, 24, 40, 0.8);
  border: 1px solid #333;
  border-radius: 16px;
  padding: 20px;
  width: 240px;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.battle-player.active {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(255, 217, 79, 0.6);
  animation: playerGlow 1.5s ease-in-out infinite alternate;
}

@keyframes playerGlow {
  from {
    box-shadow: 0 0 15px rgba(255, 217, 79, 0.4);
  }

  to {
    box-shadow: 0 0 35px rgba(255, 217, 79, 0.9);
  }
}

/* Floating ⚡ tag */
.active-turn-tag {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 217, 79, 0.9);
  color: #000;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(255, 217, 79, 0.6);
  animation: tagFloat 1s ease-in-out;
}

@keyframes tagFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

.player-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd94f;
  text-shadow: 0 0 10px rgba(255, 217, 79, 0.5);
  margin-bottom: 8px;
}

.battle-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid #444;
  object-fit: cover;
  margin-bottom: 10px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.battle-player.active .battle-avatar {
  transform: scale(1.1);
  border-color: #ffd94f;
  box-shadow: 0 0 20px rgba(255, 217, 79, 0.7);
}

.hp-bar {
  position: relative;
  height: 16px;
  border-radius: 10px;
  overflow: hidden;
  background: #222;
}

.hp-inner {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1), background 0.4s ease;
}

/* Numeric overlay */
.hp-value {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 0 5px #000;
  pointer-events: none;
}

.hp-label {
  font-size: 0.9rem;
  margin-top: 4px;
  color: #ddd;
  letter-spacing: 0.5px;
}

/* Low HP warning pulse */
.hp-bar.low .hp-inner {
  animation: hpPulse 1s ease-in-out infinite alternate;
}

@keyframes hpPulse {
  from {
    filter: brightness(1);
  }

  to {
    filter: brightness(1.4) saturate(1.2);
  }
}

/* === HP color gradient === */
.hp-inner[data-val] {
  background: linear-gradient(
    90deg,
    hsl(calc(120 * (var(--hp, 1))), 70%, 50%),
    hsl(calc(120 * (var(--hp, 1) - 0.3)), 70%, 40%)
  );
}

/* Hit flash */
.battle-player.flash {
  animation: flashHit 0.5s ease;
}

@keyframes flashHit {
  0% {
    filter: brightness(1);
    transform: translateY(0);
  }

  25% {
    filter: brightness(2);
    transform: translateY(-4px);
  }

  50% {
    filter: brightness(1);
    transform: translateY(0);
  }

  75% {
    filter: brightness(2);
    transform: translateY(-2px);
  }

  100% {
    filter: brightness(1);
    transform: translateY(0);
  }
}

/* Floating damage / heal text */
.floating-text {
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translate(-50%, 0);
  font-size: 22px;
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 0 6px #000;
  animation: floatText 1.6s ease-out forwards;
  z-index: 5;
}

.floating-text.dmg {
  color: #ff5b5b;
}

.floating-text.heal {
  color: #4cff98;
}

@keyframes floatText {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -40px);
  }
}

.shield-icon {
  margin-top: 4px;
  font-size: 14px;
  color: #4cff98;
  text-shadow: 0 0 4px #1a1;
  font-weight: bold;
  animation: shieldPulse 1.8s infinite alternate;
}

@keyframes shieldPulse {
  from {
    opacity: 0.7;
    transform: scale(1);
  }

  to {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes shieldShimmer {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 255, 152, 0.3);
  }

  50% {
    box-shadow: 0 0 30px 15px rgba(76, 255, 152, 0.5);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(76, 255, 152, 0.3);
  }
}

.shield-shimmer {
  animation: shieldShimmer 1s ease-out;
}

.turn-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 5000;
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes arenaEnter {
  0% {
    opacity: 0;
    transform: scale(1.1);
    filter: blur(6px);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.arena-enter {
  animation: arenaEnter 1s ease-out;
}

#battleControls {
  display: none;
  margin-top: 30px;
  position: relative;
  z-index: 2;
}

#battleControls button {
  background: #ffd94f;
  border: none;
  color: #000;
  padding: 10px 25px;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

#battleControls button:hover {
  background: #ffcf4d;
  transform: translateY(-2px);
}

.nft-select-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #161a2b;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #272b43;
  z-index: 10000;
  max-width: 600px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.nft-choice {
  background: #1b1f33;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
}

.nft-choice:hover {
  transform: scale(1.05);
  background: #23284b;
}

.nft-choice img {
  width: 100%;
  height: 100px;
  object-fit: contain;
  border-radius: 6px;
}

.cooldown-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 12px;
}

.nft-choice.on-cd {
  opacity: 0.5;
  pointer-events: none;
}

/* Invite popup */
.invite-popup {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  border: 2px solid #555;
  border-radius: 12px;
  padding: 15px 20px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

.invite-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #666;
}

.invite-text {
  flex-grow: 1;
  font-size: 15px;
}

.invite-actions button {
  background: #2a2a3d;
  border: 1px solid #666;
  color: #fff;
  border-radius: 6px;
  margin-left: 4px;
  padding: 6px 10px;
  cursor: pointer;
}

.invite-actions button:hover {
  background: #444;
}

/* === Action Effects === */

/* Attack impact flash */
@keyframes attackFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 60, 60, 0);
  }

  30% {
    box-shadow: 0 0 40px 20px rgba(255, 60, 60, 0.9);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 60, 60, 0);
  }
}

.attack-flash {
  animation: attackFlash 0.5s ease-out;
}

/* Defend barrier pulse */
@keyframes defendBarrier {
  0% {
    box-shadow: 0 0 0 0 rgba(80, 200, 255, 0.3);
  }

  50% {
    box-shadow: 0 0 40px 25px rgba(80, 200, 255, 0.7);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(80, 200, 255, 0.3);
  }
}

.defend-barrier {
  animation: defendBarrier 0.8s ease-out;
}

/* Heal aura */
@keyframes healAura {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 255, 152, 0);
  }

  50% {
    box-shadow: 0 0 40px 25px rgba(76, 255, 152, 0.7);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(76, 255, 152, 0);
  }
}

.heal-aura {
  animation: healAura 0.9s ease-out;
}

/* ==================== FADE ANIMATIONS ==================== */
.fade-enter {
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-enter.fade-active {
  opacity: 1;
  transform: scale(1);
}

.fade-exit {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-exit.fade-active {
  opacity: 0;
  transform: scale(0.98);
}

/* ==================== VERSUS OVERLAY ==================== */
.vs-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0a0a12 60%, #000);
  z-index: 9999;
  flex-direction: row;
  gap: 60px;
}

.vs-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.vs-left,
.vs-right {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #ffd94f;
  box-shadow: 0 0 20px #000;
  opacity: 0;
  transform: scale(0.85);
  animation: avatarIn 0.8s ease forwards;
}

.vs-left {
  animation-delay: 0.2s;
}

.vs-right {
  animation-delay: 0.4s;
}

.vs-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vs-text {
  font-size: 4rem;
  font-weight: 900;
  color: #ffd94f;
  text-shadow: 0 0 15px #000;
  opacity: 0;
  animation: vsPop 1s ease forwards;
  animation-delay: 0.6s;
}

@keyframes avatarIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes vsPop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ==================== RESULTS OVERLAY ==================== */
.results-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0a0a12 60%, #000);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 9999;
  text-align: center;
  overflow: hidden;
}

.results-overlay.show {
  display: flex;
  animation: fadeIn 0.5s ease;
}

.result-avatars {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 100px;
  margin-bottom: 20px;
}

.result-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid #ffd94f;
  object-fit: cover;
  transition: transform 1.5s ease, opacity 1.5s ease;
}

.result-avatar.winner {
  animation: winnerZoom 1.5s ease forwards;
  z-index: 2;
}

.result-avatar.loser {
  animation: loserFade 1.5s ease forwards;
}

@keyframes winnerZoom {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(1.4);
    opacity: 1;
  }
}

@keyframes loserFade {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(0.7);
    opacity: 0;
  }
}

#resultsText {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 16px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
}

#resultsText.victory {
  color: #4cff98;
}

#resultsText.defeat {
  color: #e63946;
}

.back-btn {
  margin-top: 25px;
  padding: 10px 24px;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  background: #ffd94f;
  color: #000;
  cursor: pointer;
  transition: transform 0.2s;
}

.back-btn:hover {
  transform: scale(1.1);
}

/* ==================== LOBBY USER CARDS (GLASS MATCHED TO CHAT) ==================== */
.lobby-list .user-card {
  position: relative;
  text-align: center;
  color: #5ddd13;
  border-radius: 16px;
  padding: 14px;
  transition: all 0.25s ease;
  overflow: visible;
  isolation: isolate;

  /* TRUE glass — identical to chat */
  background: rgba(12, 103, 177, 0.055);
  /* slightly transparent */
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  /* MORE BLUR = more frosted */
  -webkit-backdrop-filter: blur(14px);

  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35), 0 8px 25px rgba(0, 0, 0, 0.55);
}

/* frosted highlight, same as chat */
.lobby-list .user-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;

  /* Light shiny film like CHAT */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.03)
  );

  z-index: 0;
  pointer-events: none;
}

.lobby-list .user-card:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: rgba(255, 217, 79, 0.35);
  background: rgba(12, 102, 177, 0.26);
  box-shadow: 0 0 25px rgba(255, 217, 79, 0.45), 0 8px 28px rgba(0, 0, 0, 0.55);
}

/* Content ABOVE the glass layers */
.lobby-list .user-card img,
.lobby-list .user-card .username,
.lobby-list .user-card .stats,
.lobby-list .user-card .challenge-btn {
  position: relative;
  z-index: 2;
}

/* Avatar */
.lobby-list .user-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #ffd94f;
  object-fit: cover;
  margin-bottom: 8px;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.lobby-list .user-card:hover img {
  border-color: #ffea80;
  transform: scale(1.08);
}

/* Username + stats */
.user-card .username {
  font-size: 1rem;
  font-weight: 700;
  color: #aaff33;
}

.user-card .stats {
  color: #ddd;
  font-size: 0.85rem;
}

/* Challenge button — GLASS MATCH CHAT */
.user-card .challenge-btn {
  margin-top: 10px;
  background: rgba(255, 217, 79, 0.2);
  border: 1px solid rgba(255, 217, 79, 0.35);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  color: #ffd94f;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 8px rgba(255, 217, 79, 0.25);
}

.user-card .challenge-btn:hover {
  background: rgba(255, 217, 79, 0.35);
  border-color: rgba(255, 217, 79, 0.6);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 16px rgba(255, 217, 79, 0.55);
}

.user-card .challenge-btn:active {
  transform: translateY(0);
}

/* ==================== LIVE TICKER ==================== */
.ticker {
  height: 24px;
  line-height: 24px;
  color: #ffd94f;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.ticker.show {
  opacity: 1;
}

#battleTicker {
  opacity: 0;
  transition: opacity 0.5s ease;
}

#battleTicker.show {
  opacity: 1;
}

/* ==================== ONLINE COUNT ANIMATION ==================== */
#onlineCount {
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

#onlineCount.updated {
  color: #f11a13;
  text-shadow: 0 0 8px #1eced4;
}

/* ==================== SPLIT LOBBY LAYOUT ==================== */
.lobby-wrapper {
  display: flex;
  align-items: flex-start;
  width: 100%;
  max-width: 1750px;
  margin: 0 auto;
  padding: 0 20px;
  /* adds left/right breathing room */
  margin-top: 0px;
  /* pushes the whole lobby down */
  gap: 40px;
  position: relative;
}

.lobby-left {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  padding-left: 0px;
  margin-left: -10px;
  max-height: 60vh;
  /* was on .lobby-list before */
  overflow-y: auto;
  /* move scroll here */
  padding-right: 10px;
  /* scrollbar gutter so glows aren’t clipped */
  background: none;
}

/* NEW: glassy right column panel */
.lobby-right {
  background: rgba(10, 14, 26, 0.25);
  /* semi-transparent */
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 25px;
  max-width: 480px;
  width: 100%;
  flex-shrink: 0;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  margin-top: 55px;
  /* ⬅️ lower the whole chat area slightly */
}

/* Increase chat box height */
#chatArea {
  /* taller chat for lobby */
  min-height: fit-content;
}

/* optional subtle divider between columns */
.lobby-wrapper::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 217, 79, 0.2),
    transparent
  );
  pointer-events: none;
}

/* Responsive stacking on mobile */
@media (max-width: 900px) {
  .lobby-wrapper {
    flex-direction: column;
  }

  .lobby-wrapper::after {
    display: none;
  }

  .lobby-left,
  .lobby-right {
    width: 100%;
  }

  .chat-box {
    height: 240px;
  }
}

/* ===== Mentions dropdown ===== */
.mention-panel {
  position: absolute;
  bottom: 48px;
  /* sits above input row */
  left: 60px;
  /* near the textarea; adjust if needed */
  min-width: 220px;
  max-height: 220px;
  overflow-y: auto;
  background: #1a1f36;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 6px;
  z-index: 25;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.mention-item img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.mention-item:hover,
.mention-item.active {
  background: #232846;
}

/* ===== Mention highlight inside chat bubbles ===== */
.chat-bubble .mention {
  color: #ffd94f;
  font-weight: 800;
}

.chat-line.me .chat-bubble .mention {
  color: #ffea80;
}

/* ==================== DEBUG OUTLINE MODE ==================== */
.debug * {
  outline: 1px dashed rgba(255, 255, 255, 0.15);
}

/* Highlight key sections with colors */
.debug .lobby-wrapper {
  outline: 2px solid rgba(255, 217, 79, 0.8);
}

.debug .lobby-left {
  outline: 2px solid rgba(0, 255, 255, 0.6);
}

.debug .lobby-right {
  outline: 2px solid rgba(255, 100, 100, 0.6);
}

.debug #chatArea {
  outline: 2px solid rgba(100, 255, 100, 0.6);
}

.debug #lobbyUsers {
  outline: 2px solid rgba(100, 150, 255, 0.7);
}

/* ==================== ABILITY ANNOUNCEMENT ==================== */
.ability-announce {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 22px;
  color: #ffe86c;
  text-shadow: 0 0 8px #000;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 999;
}

.ability-announce.show {
  opacity: 1;
}

/* ==================== BATTLE STATUS MESSAGE ==================== */
.battle-status {
  margin-top: 18px;
  font-size: 20px;
  color: #ffe27a;
  min-height: 28px;
  /* keeps layout stable */
  text-shadow: 0 0 6px #000;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.battle-status.fade-out {
  opacity: 0;
}

/* ==================== NARRATION BOX ==================== */
.narration {
  width: 100%;
  text-align: center;
  font-weight: 600;
  margin-top: 12px;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.3s ease;
  transform: translateY(10px);
  font-size: 1rem;
}

.narration.show {
  opacity: 1;
  transform: translateY(0);
}

/* message types */
.narration.attack {
  color: #ff6b6b;
}

/* red */
.narration.defend {
  color: #4da6ff;
}

/* blue */
.narration.heal {
  color: #4cff98;
}

/* green */
.narration.crit {
  color: #ffcf4d;
}

/* golden */
.narration.ability {
  color: #b084ff;
}

/* purple */

/* ==================== BATTLE TOAST (SHORT NARRATION) ==================== */
.battle-toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-shadow: 0 0 6px #000;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.battle-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* color variants */
.battle-toast.attack {
  border: 1px solid #ff6b6b;
}

.battle-toast.defend {
  border: 1px solid #4da6ff;
}

.battle-toast.heal {
  border: 1px solid #4cff98;
}

.battle-toast.crit {
  border: 1px solid #ffcf4d;
}

.battle-toast.ability {
  border: 1px solid #b084ff;
}

/* ==================== FLOATING TEXT ANIMATIONS ==================== */
.floating-text.dodge {
  color: #66d9ff;
  font-weight: bold;
  animation: floatUp 1.5s ease-out forwards;
}

.floating-text.block {
  color: #ffd84d;
  font-weight: bold;
  animation: floatUp 1.5s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -40px);
  }
}

/* ============================================================
   📱 MOBILE / TABLET RESPONSIVE BATTLE LAYOUT
   ============================================================ */
@media (max-width: 900px) {
  /* Battle section spacing */
  #battle {
    padding: 20px 10px;
  }

  #battle h2 {
    font-size: 1.4rem;
  }

  #battleControls {
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  /* --- PLAYER CARDS STACKED --- */
  #playerCards {
    flex-direction: column !important;
    gap: 20px !important;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .battle-player {
    width: 95% !important;
    max-width: 360px;
    margin: 0 auto;
    padding: 15px;
  }

  .battle-avatar {
    width: 100px;
    height: 100px;
  }

  .player-name {
    font-size: 1rem;
  }

  /* HP bar + text */
  .hp-bar {
    height: 14px;
  }

  .hp-value {
    font-size: 0.7rem;
  }

  /* Ability / Status messages */
  .ability-announce {
    font-size: 18px;
    top: 10px;
  }

  .battle-status {
    margin-top: 12px;
    font-size: 16px;
    padding: 0 6px;
  }

  .narration {
    font-size: 0.9rem;
  }

  /* --- FLOATING DAMAGE TEXT --- */
  .floating-text {
    font-size: 18px !important;
    top: 30% !important;
  }

  /* Dodge / block */
  .floating-text.dodge,
  .floating-text.block {
    font-size: 18px;
  }

  /* --- BATTLE CONTROLS: move to bottom --- */
  #battleControls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex !important;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.75);
    padding: 14px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 9999;
    backdrop-filter: blur(6px);
  }

  #battleControls button {
    width: 44%;
    padding: 12px 0;
    font-size: 1.1rem;
    border-radius: 10px;
  }

  /* --- VS Screen --- */
  .vs-overlay {
    gap: 30px;
  }

  .vs-left,
  .vs-right {
    width: 130px;
    height: 130px;
  }

  .vs-text {
    font-size: 3rem;
  }

  /* --- RESULTS --- */
  .result-avatars {
    gap: 40px;
  }

  .result-avatar {
    width: 120px;
    height: 120px;
  }

  #resultsText {
    font-size: 2.2rem;
  }
}

/* Prevent overflow on small screens */
body,
html {
  overflow-x: hidden !important;
}

/* ============================================================
   📱 SMALL PHONE MODE (iPhone SE / older Android)
   ============================================================ */
@media (max-width: 600px) {
  .battle-player {
    padding: 12px;
  }

  .battle-avatar {
    width: 80px;
    height: 80px;
  }

  .player-name {
    font-size: 0.9rem;
  }

  .hp-value {
    font-size: 0.65rem;
  }

  .battle-status {
    font-size: 14px;
  }

  .ability-announce {
    font-size: 16px;
  }

  .floating-text {
    font-size: 16px !important;
  }

  #battleControls button {
    font-size: 1rem;
  }
}

/* ==================== PROFILE PAGE LAYOUT ==================== */

.profile-content-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 8px;
}

/* Mobile collapse */
@media (max-width: 820px) {
  .profile-content-grid {
    grid-template-columns: 1fr !important;
    max-height: 75vh;
  }

  #profileNFTs {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 12px;
  }

  #profileNFTs .card {
    max-height: 360px;
  }
}

/* ========== FIX: NFT SELECT SCROLLING ========== */
.nft-select-panel {
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* ========== FIX: BATTLE ARENA SCROLLING ========== */
#battle {
  overflow-y: auto !important;
  padding-bottom: 120px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* ==================== SAFE AREA INSET SUPPORT ==================== */
@supports (padding: max(0px)) {
  .chat-input-row {
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
  }
}

/* === User Info Modal === */

.user-info-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;

  /* dark overlay + slight radial highlight */
  background: radial-gradient(
      circle at top,
      rgba(80, 255, 210, 0.08),
      transparent 55%
    ),
    rgba(0, 0, 0, 0.7);
}

/* Card container */
.user-info-content {
  position: relative;
  width: min(360px, 95vw);
  max-height: 80vh;
  padding: 24px;
  border-radius: 18px;
  overflow-y: auto;

  /* gradient + blur glass look */
  background: linear-gradient(
    145deg,
    rgba(18, 22, 41, 0.96),
    rgba(27, 31, 61, 0.94)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  color: #fff;
}

/* Close button */
.close-user-info {
  position: absolute;
  right: 12px;
  top: 12px;
  background: none;
  color: #ffffff;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* Title (username) */
.user-info-content h2 {
  margin-top: 10px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.45);
}

/* Address line */
.ui-address {
  font-size: 12px;
  margin-bottom: 14px;
  opacity: 0.75;
  text-align: center;
}

/* Avatar with neon frame */
.ui-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 10px auto;

  border: 3px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 14px rgba(76, 255, 152, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.9);
}

/* Stats block */
.ui-stats {
  margin-top: 16px;
  margin-bottom: 14px;
}

.ui-stats div {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.ui-stats b {
  color: #4dcaff;
}

/* Top NFTs header already in HTML (h3) */
.user-info-content h3 {
  margin-top: 6px;
  margin-bottom: 8px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

/* Top NFT list */
.ui-nft-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* NFT card */
.ui-nft-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(7, 10, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* NFT image */
.ui-nft-item img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

/* NFT text */
.ui-nft-item div {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.ui-nft-item small {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

/* === Rarity-colored outlines (needs data-grade attribute) === */

.ui-nft-item[data-grade="mythic"] img {
  border-color: #e72aded2;
  box-shadow: 0 0 10px rgba(255, 207, 77, 0.75);
}

.ui-nft-item[data-grade="ultra-legendary"] img {
  border-color: #ff9b4d;
  box-shadow: 0 0 10px rgba(255, 155, 77, 0.75);
}

.ui-nft-item[data-grade="legendary"] img {
  border-color: #f89b2b;
  box-shadow: 0 0 10px rgba(248, 155, 43, 0.7);
}

.ui-nft-item[data-grade="epic"] img {
  border-color: #815eff;
  box-shadow: 0 0 10px rgba(177, 94, 255, 0.7);
}

.ui-nft-item[data-grade="rare"] img {
  border-color: #5fc7ff;
  box-shadow: 0 0 10px rgba(95, 199, 255, 0.7);
}
.ui-nft-item[data-grade="uncommon"] img {
  border-color: #4cff98;
  box-shadow: 0 0 10px rgba(76, 255, 152, 0.7);
}

.ui-nft-item[data-grade="common"] img,
.ui-nft-item:not([data-grade]) img {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}
