/* Player Profile Hub + customization pickers (avatar / badges / edit-card).
   Same dark-glass Capicúa identity as the player card popup, with a subtle Cuban
   tricolor accent. These overlays layer ABOVE the card popup (.player-modal, z 120). */

.ph-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 10, 18, .58);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: ph-fade .15s ease-out;
}
@keyframes ph-fade { from { opacity: 0; } to { opacity: 1; } }

.ph-panel {
  --ph-accent: #cfe0f5;
  --ph-border: rgba(255, 255, 255, .18);
  --ph-glow: rgba(90, 150, 225, .35);
  --ph-text: #eef3fb;
  --ph-muted: #9fb1c8;
  position: relative;
  width: min(400px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 18px 18px 20px;
  color: var(--ph-text);
  background: linear-gradient(160deg, rgba(22, 28, 44, .62), rgba(9, 13, 24, .68));
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    inset 0 0 0 1px var(--ph-border),
    0 0 26px var(--ph-glow),
    0 24px 60px rgba(0, 0, 0, .62);
  animation: ph-rise .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes ph-rise { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
/* Cuban tricolor hairline, matching the card popup */
.ph-panel::before {
  content: "";
  position: absolute; left: 16px; right: 16px; top: 10px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #1f4e8c 0 46%, #ffffff 46% 54%, #c1272d 54% 100%);
  opacity: .7;
}

.ph-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 4px; }
.ph-title { font-size: 19px; font-weight: 800; color: #fff; margin: 0; }
.ph-close {
  width: 30px; height: 30px; border: 0; border-radius: 9px; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: var(--ph-text); font-size: 14px;
  transition: background .12s ease;
}
.ph-close:hover { background: rgba(255, 255, 255, .18); }
.ph-sub { font-size: 12.5px; color: var(--ph-muted); margin: 0 0 14px; }

/* ── HUB list ── */
.ph-hub-list { display: flex; flex-direction: column; gap: 9px; }
.ph-hub-item {
  display: flex; align-items: center; gap: 13px; text-align: left; cursor: pointer;
  padding: 14px 14px; border: 0; border-radius: 13px;
  color: var(--ph-text);
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--ph-border);
  transition: background .12s ease, transform .1s ease;
}
.ph-hub-item:hover { background: rgba(255, 255, 255, .12); transform: translateX(2px); }
.ph-hub-item.soon { cursor: default; opacity: .72; }
.ph-hub-item.soon:hover { background: rgba(255, 255, 255, .06); transform: none; }
.ph-hub-ico { font-size: 24px; flex: 0 0 auto; width: 30px; text-align: center; }
.ph-hub-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ph-hub-name { font-size: 15px; font-weight: 800; color: #fff; }
.ph-hub-desc { font-size: 11.5px; color: var(--ph-muted); }
.ph-hub-arrow { font-size: 22px; color: var(--ph-muted); flex: 0 0 auto; }
.ph-hub-soon, .ph-lock, .ph-soon-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; font-style: normal;
  color: #ffd7a1; background: rgba(232, 179, 74, .16); box-shadow: inset 0 0 0 1px rgba(232, 179, 74, .3);
  padding: 3px 8px; border-radius: 999px; flex: 0 0 auto; white-space: nowrap;
}

/* ── Avatar picker ── */
.ph-avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.ph-avatar-cell {
  position: relative; aspect-ratio: 1; cursor: pointer; overflow: hidden;
  border: 0; border-radius: 14px; padding: 0;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--ph-border);
  transition: transform .1s ease, box-shadow .12s ease;
}
.ph-avatar-cell:hover { transform: scale(1.04); }
.ph-avatar-cell.sel { box-shadow: inset 0 0 0 2px var(--ph-accent), 0 0 12px var(--ph-glow); }
.ph-avatar-cell.sel::after {
  content: "✓"; position: absolute; top: 3px; right: 4px;
  font-size: 12px; font-weight: 800; color: #10233b;
  width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%;
  background: var(--ph-accent);
}
.ph-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-avatar-default { display: grid; place-items: center; }
.ph-avatar-mono { font-size: 24px; font-weight: 800; color: #fff; }
/* Section label above each avatar group (Estándar / Especiales). */
.ph-avatar-section {
  margin: 14px 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ph-muted);
}
.ph-avatar-section:first-of-type { margin-top: 4px; }

/* ── Reward (earned) tiles ── reuse the standard .ph-avatar-cell grid. The REAL artwork is
   always shown; locked → art dimmed + a 🔒; hovering reveals ONLY the challenge (no name). */
.ph-avatar-cell.earned.locked { cursor: help; }
.ph-avatar-cell.earned.locked .ph-avatar-img { filter: grayscale(.85) brightness(.5); }
.ph-avatar-cell.earned.locked:hover { transform: none; }
.ph-avatar-cell.earned.unlocked { box-shadow: inset 0 0 0 1px rgba(120, 200, 130, .5); }
.ph-avatar-lock {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 22px; text-shadow: 0 2px 6px rgba(0, 0, 0, .85); pointer-events: none;
}
/* Hover overlay: the challenge (icon + title + how-to). Hidden until hover. */
.ph-avatar-tip {
  position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 6px; text-align: center;
  background: rgba(6, 10, 18, .9);
}
.ph-avatar-cell.earned:hover .ph-avatar-tip { display: flex; }
.ph-tip-title { font-size: 11px; font-weight: 800; color: #ffd98a; line-height: 1.15; }
.ph-tip-desc { font-size: 10px; color: #d7e3fb; line-height: 1.15; }
.ph-tip-state { font-size: 10px; font-weight: 800; margin-top: 2px; color: #8fe6a0; }
.ph-avatar-cell.earned.locked .ph-tip-state { color: #ffd7a1; }

.ph-upload, .ph-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; cursor: pointer;
  padding: 12px; border: 0; border-radius: 12px; font-size: 13.5px; font-weight: 800; color: var(--ph-text);
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px var(--ph-border);
  transition: background .12s ease;
}
.ph-upload:hover { background: rgba(255, 255, 255, .12); }
.ph-upload.soon { opacity: .82; }
.ph-upload-ico { font-size: 15px; }

/* ── Badge picker ── */
.ph-badge-count { font-size: 11.5px; font-weight: 700; color: var(--ph-muted); text-align: right; margin-bottom: 8px; }
.ph-badge-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ph-badge-item {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  padding: 11px 12px; border: 0; border-radius: 12px; color: var(--ph-text);
  background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--ph-border);
  transition: background .12s ease, box-shadow .12s ease;
}
.ph-badge-item:hover { background: rgba(255, 255, 255, .1); }
.ph-badge-item.on { box-shadow: inset 0 0 0 1.5px var(--ph-accent), 0 0 10px var(--ph-glow); background: rgba(207, 224, 245, .1); }
.ph-badge-item .ph-badge-ico { font-size: 20px; flex: 0 0 auto; }
.ph-badge-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.ph-badge-name { font-size: 13.5px; font-weight: 800; color: #fff; }
.ph-badge-desc { font-size: 11px; color: var(--ph-muted); }
.ph-badge-check { flex: 0 0 auto; font-size: 15px; color: var(--ph-accent); opacity: 0; transition: opacity .12s ease; }
.ph-badge-item.on .ph-badge-check { opacity: 1; }
.ph-empty { padding: 20px 12px; text-align: center; font-size: 13px; color: var(--ph-muted); }

/* ── Logros — reuses .ph-badge-item/.ph-badge-list; only the locked state is new.
   Read-only rows, so no hover lift and no pointer cursor. ── */
.ph-logro { cursor: default; }
.ph-logro:hover { background: rgba(255, 255, 255, .06); }
.ph-logro.is-locked { opacity: .55; }
.ph-logro.is-locked .ph-badge-ico { filter: grayscale(1); }
.ph-logro-sep { margin: 14px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ph-muted); }

.ph-actions { display: flex; gap: 10px; }
.ph-actions .ph-btn { margin: 0; }
.ph-btn-primary { color: #10233b; background: linear-gradient(180deg, #ffffff, var(--ph-accent)); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.ph-btn-primary:hover { filter: brightness(1.05); }
.ph-btn:disabled { opacity: .6; cursor: default; }

/* ── Edit-card (appearance) ── */
.ph-editcard-list { display: flex; flex-direction: column; gap: 9px; }
.ph-editcard-item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--ph-border);
}

/* ── Header chip avatar (reflects the chosen avatar in the top-nav) ── */
#authedChip .profile-av.has-img {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 0 0 1.5px rgba(232, 179, 74, .6);
}

/* ── Toast ── */
.ph-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  z-index: 200; pointer-events: none;
  max-width: 88vw; padding: 11px 18px; border-radius: 12px;
  font-size: 13.5px; font-weight: 700; color: #eef3fb;
  background: rgba(14, 20, 34, .92); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; transition: opacity .18s ease, transform .18s ease;
}
.ph-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .ph-avatar-grid { grid-template-columns: repeat(3, 1fr); }
}
