.profilePage{
  margin-top: -74px;
  padding: 140px 0 96px;
  background:
    radial-gradient(closest-side, rgba(255,214,236,.55), rgba(255,214,236,0)) 85% 0% / 900px 520px no-repeat,
    radial-gradient(closest-side, rgba(212,207,242,.9), rgba(212,207,242,0)) 20% 30% / 900px 700px no-repeat,
    radial-gradient(rgba(123,63,228,.16) 1.2px, transparent 1.3px) 0 0 / 22px 22px,
    var(--bg);
  overflow: hidden;
}
.pfShell{ width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.pfGrid{ display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 56px; align-items: start; }
/* la carta queda fija arriba: antes se re-centraba (y bajaba) cuando cargaban stats y wishlist */
.pfCardCol{ position: sticky; top: 110px; }

.skeleton{ position: relative; overflow: hidden; background: var(--lav-100) !important; }
.skeleton::after{ content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.7) 50%, transparent 80%); animation: pfShimmer 1.3s infinite; }
@keyframes pfShimmer{ from{ transform: translateX(-100%); } to{ transform: translateX(100%); } }

/* carta favorita */
.pfCardCol{ position: relative; display: grid; place-items: center; padding: 20px 0; }
.pfCardCol::before{ content: ""; position: absolute; inset: -40px -60px; border-radius: 50%; border: 1px solid rgba(123,63,228,.18); box-shadow: inset 0 0 0 60px rgba(212,207,242,.12); pointer-events: none; }
.pfCard{ position: relative; width: 100%; max-width: 360px; aspect-ratio: 3 / 4; border-radius: 30px; transform: rotate(-3deg); box-shadow: 0 30px 60px rgba(60,48,130,.22); transition: transform .35s ease; }
.pfCard:hover{ transform: rotate(-1deg) translateY(-6px); }
.pfCard img{ display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 30px; }
.pfCard.isEmpty{ display: grid; place-items: center; padding: 30px; background: #fff; border: 2px dashed var(--lav-300); text-align: center; color: var(--ink-2); font-weight: 600; }
.pfSpark{ position: absolute; width: 34px; height: 34px; background: var(--lav-500); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: pfTwinkle 3s ease-in-out infinite; z-index: 1; }
.pfSpark.s1{ top: 4%; left: -4%; }
.pfSpark.s2{ bottom: 6%; right: 0; width: 26px; height: 26px; animation-delay: .8s; }
.pfSpark.s3{ bottom: 14%; left: -8%; width: 20px; height: 20px; animation-delay: 1.6s; background: var(--lav-400); }
@keyframes pfTwinkle{ 0%,100%{ transform: scale(1) rotate(0); opacity: 1; } 50%{ transform: scale(.7) rotate(20deg); opacity: .6; } }

/* cabecera */
.pfHead{ display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.pfAvatar{ flex: none; width: 104px; height: 104px; border-radius: 28px; overflow: hidden; background: var(--lav-200); border: 4px solid #fff; box-shadow: 0 12px 30px rgba(60,48,130,.18); }
.pfAvatar img{ width: 100%; height: 100%; object-fit: cover; }
.pfHeadText{ min-width: 0; }
.pfName{
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 76px);
  line-height: .95;
  letter-spacing: -.045em;
  background: linear-gradient(100deg, #7B3FE4, #A974F5 60%, #C9A7FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  overflow-wrap: anywhere;
}
.pfHandle{ margin: 8px 0 0; color: var(--ink-2); font-weight: 600; }

/* sobre mí */
.pfAbout{ margin-bottom: 18px; padding: 18px 24px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 0 var(--lav-100); }
.pfLabel{ margin: 0 0 6px; color: #8A4FF0; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pfAboutText{ margin: 0; font-size: 20px; color: var(--ink); overflow-wrap: anywhere; }
.pfEmoji{ display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -.25em; object-fit: contain; }

/* estadísticas */
.pfStats{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.pfStat{ display: flex; align-items: center; gap: 16px; min-height: 104px; padding: 16px 20px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 0 var(--lav-200); }
.pfStatIcon{ flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--lav-50); }
.pfStatIcon img{ width: 46px; height: 46px; object-fit: contain; }
.pfStatText{ display: grid; min-width: 0; }
.pfStatText b{ font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 3.2vw, 42px); line-height: 1; letter-spacing: -.03em; color: #7B3FE4; overflow-wrap: anywhere; }
.pfStatText small{ margin-top: 4px; font-size: 17px; color: var(--ink-2); }

/* rank + xp */
.pfRank{ display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: stretch; }
.pfRankPos{ display: grid; place-items: center; align-content: center; min-width: 136px; padding: 12px 22px; border-radius: 24px; background: linear-gradient(140deg, #A06BF5, #7B3FE4); color: #fff; box-shadow: 0 6px 0 #5B2BB8; }
.pfRankPos small{ font-size: 12px; font-weight: 800; letter-spacing: .24em; opacity: .85; }
.pfRankPos b{ font-family: var(--font-display); font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.03em; }
.pfXp{ display: flex; align-items: center; gap: 0; padding: 10px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 0 var(--lav-100); }
.pfLvl{ position: relative; z-index: 1; flex: none; display: grid; place-items: center; align-content: center; width: 78px; height: 78px; border-radius: 50%; background: linear-gradient(140deg, #A06BF5, #7B3FE4); color: #fff; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--lav-300); }
.pfLvl small{ font-size: 11px; font-weight: 800; letter-spacing: .08em; opacity: .9; }
.pfLvl b{ font-family: var(--font-display); font-size: 28px; line-height: 1; }
.pfBar{ position: relative; flex: 1; height: 48px; margin-left: -24px; border-radius: 999px; background: var(--lav-100); overflow: hidden; }
.pfBarFill{ position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, #8A4FF0, #C9A7FF); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.pfXpText{ position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 800; font-size: 16px; color: #6A35D0; white-space: nowrap; }

.pfCollBtn{ display: flex; justify-content: center; gap: 10px; margin-top: 18px; min-height: 52px; font-size: 16px; }
.pfNoData .pfCollBtn{ display: none; }

/* estados */
.profileState{ margin-top: 18px; padding: 22px 24px; border-radius: 24px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; line-height: 1.6; }
.profileState .btn{ margin-top: 12px; display: inline-flex; }
.pfNoData .pfStats, .pfNoData .pfRank, .pfNoData .pfAbout{ display: none; }
.pfNoData .pfCard{ visibility: hidden; }

@media (max-width: 900px){
  .pfGrid{ grid-template-columns: 1fr; gap: 36px; }
  .pfCardCol{ order: 2; }
  .pfCard{ max-width: 300px; }
  .pfNoData .pfCardCol{ display: none; }
}
@media (max-width: 560px){
  .profilePage{ padding-top: 120px; }
  .pfShell{ padding: 0 16px; }
  .pfHead{ gap: 14px; }
  .pfAvatar{ width: 72px; height: 72px; border-radius: 20px; }
  .pfStats{ gap: 10px; }
  .pfStat{ flex-direction: column; align-items: flex-start; gap: 10px; min-height: 0; padding: 14px; }
  .pfStatIcon{ width: 48px; height: 48px; border-radius: 14px; }
  .pfStatIcon img{ width: 34px; height: 34px; }
  .pfStatText small{ font-size: 14px; }
  .pfRank{ grid-template-columns: 1fr; }
  .pfRankPos{ grid-auto-flow: column; justify-content: center; gap: 12px; }
  .pfRankPos b{ font-size: 38px; }
  .pfLvl{ width: 64px; height: 64px; }
  .pfLvl b{ font-size: 22px; }
  .pfBar{ height: 40px; }
  .pfXpText{ font-size: 13px; right: 12px; }
}

.pfShare{ display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--lav-800); font: 700 13px/1 var(--font-body, inherit); cursor: pointer; transition: background .15s ease; }
.pfShare:hover{ background: var(--lav-50); }

.pfHeadBtns{ display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pfHeadBtns .pfShare{ margin-top: 0; }
.pfLike{ position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid #F6C6D6; background: #fff; color: #E0558A; font: 800 14px/1 var(--font-body, inherit); cursor: pointer; transition: transform .15s ease, background .15s ease; }
.pfLike:hover{ transform: translateY(-2px); background: #FFF0F5; }
.pfLike i{ font-size: 15px; }
.pfLike b{ color: var(--ink); }
.pfLike.is-liked{ background: linear-gradient(120deg, #FF7BA6, #F0436B); border-color: transparent; color: #fff; box-shadow: 0 4px 0 #C42F55; }
.pfLike.is-liked b{ color: #fff; }
.pfLike.isMine{ cursor: default; }
.pfLike.isMine:hover{ transform: none; background: #fff; }
.pfLike.pop i{ animation: likePop .55s cubic-bezier(.22,1.8,.36,1); }
.pfLike.pop::after{ content: ""; position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; box-shadow: 0 -16px 0 -6px #FF7BA6, 14px -10px 0 -6px #FFD86B, 16px 6px 0 -6px #C9A7FF, 0 16px 0 -6px #FF7BA6, -14px 8px 0 -6px #FFD86B, -14px -10px 0 -6px #C9A7FF; animation: likeBurst .55s ease-out forwards; pointer-events: none; }
@keyframes likePop{ 0%{ transform: scale(1); } 40%{ transform: scale(1.6); } 100%{ transform: scale(1); } }
@keyframes likeBurst{ from{ opacity: 1; transform: scale(.4); } to{ opacity: 0; transform: scale(1.6); } }
@media (prefers-reduced-motion: reduce){ .pfLike.pop i, .pfLike.pop::after{ animation: none; } }

.pfFollowStats{ display: flex; gap: 14px; margin-top: 8px; font-size: 14px; }
.pfFollowStats a{ color: var(--ink-2); text-decoration: none; }
.pfFollowStats a:hover{ color: #7B3FE4; }
.pfFollowStats b{ color: var(--ink); font-weight: 800; }
.pfFollow{ display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 999px; border: 0; background: var(--lav-900); color: #fff; font: 800 14px/1 var(--font-body, inherit); cursor: pointer; box-shadow: 0 4px 0 var(--lav-950); transition: transform .15s ease; }
.pfFollow:hover{ transform: translateY(-2px); }
.pfFollow.is-on{ background: #fff; color: var(--lav-800); border: 1px solid var(--line-2); box-shadow: none; }

.pfWish{ margin-top: 18px; padding: 18px 22px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 0 var(--lav-100); }
.pfWish[hidden]{ display: none; }
.pfWishHead{ display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pfWishHead .pfLabel{ margin: 0; }
.pfWishHead a{ color: #7B3FE4; font-size: 13px; font-weight: 800; text-decoration: none; }
.pfWishGrid{ display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pfWishItem{ display: grid; gap: 4px; justify-items: center; text-decoration: none; color: var(--ink-2); font-size: 12px; font-weight: 700; text-align: center; }
.pfWishItem img{ width: 100%; aspect-ratio: 3 / 4; object-fit: contain; transition: transform .2s ease; }
.pfWishItem:hover img{ transform: translateY(-3px) rotate(-2deg); }
.pfWishItem span{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfNoData .pfWish{ display: none; }
@media (max-width: 560px){ .pfWishGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* móvil: carta a la izquierda y las stats como cuadritos verticales a la derecha */
@media (max-width: 600px){
  .pfGrid{
    grid-template-columns: minmax(0, 1fr) 84px;
    grid-template-areas: "head head" "about about" "card stats" "rank rank" "coll coll" "recap recap" "ach ach" "wish wish" "state state";
    gap: 0 12px;
  }
  .pfInfo{ display: contents; }
  .pfHead{ grid-area: head; }
  .pfAbout{ grid-area: about; }
  .pfCardCol{ grid-area: card; order: 0; position: relative; top: auto; padding: 0; align-self: start; }
  .pfCardCol::before, .pfSpark{ display: none; }
  .pfCard{ max-width: none; transform: rotate(-2deg); border-radius: 22px; }
  .pfCard img{ border-radius: 22px; }
  .pfStats{ grid-area: stats; grid-template-columns: 1fr; gap: 8px; margin: 0; align-self: start; }
  .pfStat{ flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 0; padding: 10px 4px; border-radius: 18px; text-align: center; box-shadow: 0 4px 0 var(--lav-200); }
  .pfStat.skeleton{ height: 88px; }
  .pfStatIcon{ width: 38px; height: 38px; border-radius: 12px; }
  .pfStatIcon img{ width: 30px; height: 30px; }
  .pfStatText b{ font-size: 18px; letter-spacing: -.02em; }
  .pfStatText small{ display: none; }
  .pfRank{ grid-area: rank; margin-top: 18px; }
  .pfCollBtn{ grid-area: coll; }
  .pfRecapBtn{ grid-area: recap; }
  .pfWish{ grid-area: wish; }
  .pfAch{ grid-area: ach; }
  .profileState{ grid-area: state; }
  .pfNoData .pfCardCol{ display: none; }
}

/* logros */
.pfAch{ margin-top: 18px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 0 var(--lav-100); overflow: hidden; }
.pfAch[hidden]{ display: none; }
.pfAchToggle{ display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 22px; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.pfAchToggle .pfLabel{ margin: 0; }
.pfAchPeek{ display: flex; gap: 4px; flex: 1; min-width: 0; overflow: hidden; }
.pfAch.isOpen .pfAchPeek{ visibility: hidden; }
.pfAchCount{ color: var(--muted); font-size: 13px; font-weight: 800; }
.pfAchCaret{ color: var(--lav-600); transition: transform .25s cubic-bezier(.23,1,.32,1); }
.pfAch.isOpen .pfAchCaret{ transform: rotate(180deg); }
.pfAchBody{ padding: 0 22px 20px; animation: pfAchOpen .25s cubic-bezier(.23,1,.32,1); }
.pfAchBody[hidden]{ display: none; }
@keyframes pfAchOpen{ from{ opacity: 0; transform: translateY(-6px); } to{ opacity: 1; transform: none; } }
.pfAchHint{ margin: 0 0 12px; padding: 9px 12px; border-radius: 12px; background: var(--lav-50); color: var(--ink-2); font-size: 13px; }
.pfAchHint i{ color: #8A4FF0; margin-right: 4px; }
.pfAchHint b{ color: #6A35D0; }
.pfAchGrid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.pfAchItem{ position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 18px; background: var(--lav-50); text-align: center; outline: none; }
.pfAchItem.isPinned{ background: #F1E8FF; box-shadow: inset 0 0 0 2px #B79BFF; }
.pfAchItem:focus-visible{ box-shadow: 0 0 0 2px #8A4FF0; }

/* medalla: el color sale del nivel */
.pfAchMedal{ position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 21px; color: #fff; background: var(--t-bg); box-shadow: inset 0 -4px 0 rgba(0,0,0,.12), 0 4px 0 var(--t-sh); overflow: hidden; transition: transform .2s cubic-bezier(.23,1,.32,1); }
.pfAchMedal{ --t-bg: #E3DFF2; --t-sh: #CFC9E6; }
.pfAchMedal[data-tier="0"]{ color: #A49CC4; }
.pfAchMedal[data-tier="1"]{ --t-bg: linear-gradient(140deg, #E2A36B, #B86B35); --t-sh: #8E4F23; }
.pfAchMedal[data-tier="2"]{ --t-bg: linear-gradient(140deg, #E4E7F1, #9AA1B8); --t-sh: #747B93; }
.pfAchMedal[data-tier="3"]{ --t-bg: linear-gradient(140deg, #FFE08A, #E8A93B); --t-sh: #B27A12; }
.pfAchMedal[data-tier="4"]{ --t-bg: linear-gradient(120deg, #A5F3FF, #C9B2FF 25%, #FFC4E8 50%, #B4FFD8 75%, #A5F3FF); --t-sh: #8B7BD8; background-size: 300% 300%; animation: pfDiamond 5s ease-in-out infinite; color: #6435BE; }
.pfAchMedal[data-tier="4"]::after{ content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.75) 50%, transparent 65%) -150% 0 / 200% 100% no-repeat; animation: pfShine 3s ease-in-out infinite; }
@keyframes pfDiamond{ 0%, 100%{ background-position: 0% 50%; } 50%{ background-position: 100% 50%; } }
@keyframes pfShine{ 0%, 45%{ background-position: -150% 0; } 100%{ background-position: 150% 0; } }
.pfAchMedal.isMini{ width: 26px; height: 26px; border-radius: 9px; font-size: 11px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 2px 0 var(--t-sh); }

.pfAchSteps{ display: flex; gap: 3px; margin-top: 4px; }
.pfAchSteps i{ width: 12px; height: 4px; border-radius: 4px; background: #DDD8F0; }
.pfAchSteps i.on{ background: #8A4FF0; }
.pfAchName{ margin-top: 2px; font-size: 12.5px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.pfAchProg{ font-size: 11.5px; font-weight: 700; color: var(--muted); }
.pfAchProg em{ font-style: normal; color: #6A35D0; text-transform: capitalize; }
.pfAchPin{ position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 9px; background: #fff; color: #B4ACD4; font-size: 11px; cursor: pointer; transition: transform .12s ease, color .15s ease; }
.pfAchPin:active{ transform: scale(.9); }
.pfAchItem.isPinned .pfAchPin{ background: #8A4FF0; color: #fff; transform: rotate(-30deg); }
.pfAchTip{ position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 5; width: 180px; padding: 8px 10px; border-radius: 12px; background: var(--lav-900); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.35; transform: translateX(-50%) scale(.96); transform-origin: bottom center; opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.pfAchItem:hover .pfAchTip, .pfAchItem:focus .pfAchTip{ opacity: 1; transform: translateX(-50%); }
@media (hover: hover) and (pointer: fine){ .pfAchItem:hover .pfAchMedal{ transform: translateY(-3px) rotate(-4deg); } }

/* logros fijados, debajo de la foto de perfil */
.pfAvatarCol{ display: grid; justify-items: center; gap: 8px; flex: none; }
.pfPins{ display: flex; gap: 5px; }
.pfPins[hidden]{ display: none; }
.pfPin{ display: block; animation: pfPinIn .35s cubic-bezier(.23,1,.32,1) both; }
.pfPin:nth-child(2){ animation-delay: .06s; }
.pfPin:nth-child(3){ animation-delay: .12s; }
@keyframes pfPinIn{ from{ opacity: 0; transform: translateY(6px) scale(.9); } to{ opacity: 1; transform: none; } }

@media (max-width: 600px){
  .pfAchGrid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pfAchTip{ display: none; }
  .pfAchToggle{ padding: 14px 16px; }
  .pfAchBody{ padding: 0 16px 16px; }
  .pfAchPeek .pfAchMedal:nth-child(n+4){ display: none; }
}
@media (prefers-reduced-motion: reduce){
  .pfAchMedal[data-tier="4"], .pfAchMedal[data-tier="4"]::after, .pfAchBody, .pfPin{ animation: none; }
}

.pfRecapBtn{ margin-top: 10px; }

/* medallas de logros: planas, fondo suave + icono del color del nivel */
.pfAchMedal{ border-radius: 14px; font-size: 20px; box-shadow: none; animation: none; background: var(--m-bg); color: var(--m-fg); }
.pfAchMedal::before, .pfAchMedal::after{ content: none; }
.pfAchMedal[data-tier="0"]{ --m-bg: #F1EFF7; --m-fg: #C2BDD6; }
.pfAchMedal[data-tier="1"]{ --m-bg: #FBEADF; --m-fg: #C0672E; }
.pfAchMedal[data-tier="2"]{ --m-bg: #ECEEF4; --m-fg: #6F7790; }
.pfAchMedal[data-tier="3"]{ --m-bg: #FFF3D1; --m-fg: #D99A0B; }
.pfAchMedal[data-tier="4"]{ --m-bg: #DDF4FF; --m-fg: #1E8FD6; color: var(--m-fg); background: var(--m-bg); }
.pfAchMedal.isMini{ border-radius: 7px; font-size: 11px; box-shadow: none; }
