/* =============================================================
   DESMOCHEE · IDENTIDAD DEL JUGADOR · v163 6U
   -------------------------------------------------------------
   - Perfil + monedas visibles en Home
   - Marcos de perfil data-driven mediante data-frame
   - Sin modificar geometría ni lógica de la partida
   ============================================================= */

/* ---------- HOME · perfil + wallet ---------- */
body:not(.game-open) .menu-player-bar {
  width: min(100%, 326px);
  margin: -8px auto 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  position: relative;
  z-index: 6;
}

body:not(.game-open) .menu-player-profile,
body:not(.game-open) .menu-player-wallet {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255,255,255,.085);
  background:
    linear-gradient(145deg, rgba(255,255,255,.060), rgba(255,255,255,.014)),
    rgba(4, 31, 22, .72);
  box-shadow: inset 0 1px rgba(255,255,255,.045), 0 9px 22px rgba(0,0,0,.12);
  color: #eef7f2;
}

body:not(.game-open) .menu-player-profile {
  min-width: 0;
  flex: 1 1 auto;
  min-height: 54px;
  padding: 6px 10px 6px 7px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}

body:not(.game-open) .menu-player-profile:active,
body:not(.game-open) .menu-player-wallet:active {
  transform: scale(.975);
}

body:not(.game-open) .menu-player-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body:not(.game-open) .menu-player-copy strong {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .74rem;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: .01em;
  color: #f2f8f5;
}

body:not(.game-open) .menu-player-copy small {
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #9db8aa;
  font-size: .47rem;
  font-weight: 700;
}

body:not(.game-open) .menu-player-wallet {
  flex: 0 0 auto;
  min-width: 84px;
  min-height: 48px;
  padding: 0 10px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

body:not(.game-open) .menu-player-wallet strong {
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .01em;
  color: #e7f5ed;
}

.menu-wallet-coin {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(224, 202, 127, .58);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.36), transparent 22%),
    linear-gradient(145deg, #bca45e, #75652f);
  box-shadow: inset 0 0 0 2px rgba(33,34,18,.20), 0 3px 8px rgba(0,0,0,.20);
  color: #172119;
  font-size: .56rem;
  font-weight: 950;
}

/* Perfil deja de repetirse como acceso rápido: Tutorial + Más ocupan el ancho. */
body:not(.game-open) .menu-quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

/* ---------- MARCO UNIVERSAL ---------- */
.player-frame {
  --frame-a: rgba(197, 218, 207, .72);
  --frame-b: rgba(77, 119, 98, .82);
  --frame-glow: rgba(111, 208, 161, .12);
  position: relative;
  isolation: isolate;
  overflow: visible !important;
}

.player-frame::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from 220deg, var(--frame-b), var(--frame-a), var(--frame-b), var(--frame-a), var(--frame-b));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: drop-shadow(0 0 5px var(--frame-glow));
}

.player-frame::after {
  content: "";
  position: absolute;
  z-index: 4;
  pointer-events: none;
  width: 6px;
  height: 6px;
  right: -2px;
  bottom: 3px;
  border: 1px solid rgba(5, 25, 18, .75);
  border-radius: 50%;
  background: var(--frame-a);
  box-shadow: 0 0 7px var(--frame-glow);
}

.menu-player-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
}

.player-frame-core {
  position: absolute;
  inset: 2px;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 28%, rgba(98, 211, 157, .16), transparent 38%),
    linear-gradient(145deg, #173e30, #081f17);
}

.player-frame-core img {
  width: 61%;
  height: 61%;
  object-fit: contain;
  opacity: .90;
  filter: invert(93%) sepia(6%) saturate(226%) hue-rotate(93deg) brightness(103%);
}

/* Marco también visible en el avatar del modal Perfil. */
#profileModal .profile-v140-avatar.player-frame {
  border-radius: 15px;
}

/* ---------- PERFIL · resumen de colección ---------- */
.collection-summary-mark.frame-mark {
  position: relative;
  border-radius: 50%;
  background: transparent !important;
}
.collection-summary-mark.frame-mark::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid rgba(110, 211, 161, .78);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(110,211,161,.08);
}

/* ---------- COLECCIÓN · pestaña MARCOS ---------- */
.collection-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.collection-thumb.frame {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(91, 200, 147, .09), transparent 42%),
    rgba(255,255,255,.014);
}

.collection-thumb.frame .player-frame {
  width: 48px;
  height: 48px;
  border-radius: 17px;
}

.collection-frame-preview {
  min-height: 182px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background:
    radial-gradient(circle at 50% 43%, rgba(89, 213, 155, .12), transparent 34%),
    linear-gradient(145deg, rgba(17, 69, 51, .46), rgba(5, 28, 20, .82));
}
.collection-frame-preview[hidden] { display: none !important; }

.collection-frame-preview-glow {
  position: absolute;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88,211,154,.11), transparent 68%);
  pointer-events: none;
}

.collection-frame-avatar {
  width: 76px;
  height: 76px;
  border-radius: 24px;
}

.collection-frame-avatar::before { inset: -5px; padding: 3px; }
.collection-frame-avatar::after { width: 8px; height: 8px; right: -3px; bottom: 6px; }

.collection-frame-preview > strong {
  position: relative;
  z-index: 2;
  margin-top: 5px;
  color: #f0f7f3;
  font-size: .76rem;
}
.collection-frame-preview > small {
  position: relative;
  z-index: 2;
  color: rgba(181, 204, 193, .60);
  font-size: .46rem;
}

@media (max-width: 380px) {
  body:not(.game-open) .menu-player-bar {
    width: min(100%, 318px);
  }
  body:not(.game-open) .menu-player-wallet {
    min-width: 78px;
    padding-inline: 8px;
  }
  body:not(.game-open) .menu-player-copy strong { max-width: 128px; }
  body:not(.game-open) .menu-player-copy small { max-width: 132px; }
}

#profileModal .collection-profile-equipped:has(.frame-mark) {
  grid-column: 1 / -1;
}

.collection-table-preview[hidden],
.collection-palette-row[hidden] {
  display: none !important;
}
