/* Public player profile: banner hero with the level badge, played games and the badge collection. */
.player-profile-page { --family: #a57aff; }

/* Hero: the banner fades into a dark card tinted by the player's badge family. */
.pp-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--family) 38%, var(--border));
  border-radius: 22px;
  background:
    radial-gradient(ellipse 50% 80% at 0% 100%, color-mix(in srgb, var(--family) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 40% 70% at 100% 100%, #8a52ff2e, transparent 70%),
    linear-gradient(160deg, #241a3a, #15111d 70%);
  color: #fff;
  box-shadow: 0 24px 64px #0a051a45, inset 0 1px #ffffff14;
}
.pp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(#ffffff07 1px, transparent 1px), linear-gradient(90deg, #ffffff07 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent 30%, #000 75%);
}
.pp-cover { position: relative; aspect-ratio: 4 / 1; min-height: 150px; max-height: 300px; width: 100%; overflow: hidden; }
.pp-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pp-cover[data-empty] {
  background:
    radial-gradient(ellipse 45% 120% at 85% 10%, color-mix(in srgb, var(--family) 45%, transparent), transparent 70%),
    linear-gradient(90deg, #25133e, #25133e55),
    url('assets/optimized/profile-background-1200.webp') center 44% / cover;
}
.pp-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, #15111dcc 85%, #1a1428); pointer-events: none; }

.pp-hero-body {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'avatar identity level';
  align-items: end;
  gap: 18px 28px;
  margin-top: -72px;
  padding: 0 32px 24px;
}
.pp-avatar { grid-area: avatar; position: relative; }
.pp-avatar .public-player-avatar {
  width: 136px;
  height: 136px;
  border: 0;
  font-size: 34px;
  box-shadow: 0 0 0 5px #1a1428, 0 0 0 8px color-mix(in srgb, var(--family) 75%, transparent), 0 18px 40px #0009, 0 0 40px color-mix(in srgb, var(--family) 45%, transparent);
}
.pp-avatar-badge {
  position: absolute;
  right: -18px;
  bottom: -10px;
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px #000a) drop-shadow(0 0 14px color-mix(in srgb, var(--family) 60%, transparent));
  animation: quest-float 5s ease-in-out infinite;
}
.pp-identity { grid-area: identity; min-width: 0; padding-bottom: 4px; }
.pp-identity h1 { margin: 6px 0 0; font-size: clamp(28px, 3.4vw, 44px); line-height: 1.05; letter-spacing: -1.2px; text-shadow: 0 4px 24px #0008; overflow-wrap: anywhere; }
.pp-hero .profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: #cbbfe0; font-size: 14px; }
.pp-hero .profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.pp-hero .profile-meta .icon { width: 15px; height: 15px; }
.pp-bio { max-width: 640px; margin-top: 12px; color: #e3daf3; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.pp-level { grid-area: level; display: flex; align-items: center; gap: 16px; min-width: 260px; padding: 14px 18px; border: 1px solid #ffffff1c; border-radius: 18px; background: #ffffff0a; backdrop-filter: blur(8px); }
.pp-level-ring {
  --p: 0;
  display: grid;
  place-items: center;
  align-content: center;
  flex: none;
  width: 74px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, #1d1630 80%, transparent 81%),
    conic-gradient(color-mix(in srgb, var(--family) 80%, #fff) calc(var(--p) * 1%), #ffffff14 0);
  box-shadow: 0 0 22px color-mix(in srgb, var(--family) 35%, transparent);
}
.pp-level-ring strong { font-family: var(--font-pixel, 'Outfit', sans-serif); font-size: 24px; line-height: 1; }
.pp-level-ring small { color: #cbbfe0; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.pp-level-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.pp-level-copy > strong { font-family: var(--font-pixel, 'Outfit', sans-serif); font-size: 20px; }
.pp-level-copy > strong small { color: #cbbfe0; font-size: 12px; font-weight: 500; }
.pp-level-copy > span { color: #cbbfe0; font-size: 12px; }
.pp-level .progress-track { height: 8px; margin-top: 4px; border-radius: 99px; background: #ffffff14; }
.pp-level .progress-track > span { min-width: 8px; border-radius: 99px; background: linear-gradient(90deg, #8950fa, color-mix(in srgb, var(--family) 60%, #d6a8ff)); box-shadow: 0 0 12px color-mix(in srgb, var(--family) 55%, transparent); }

.pp-stats { margin: 0 32px; padding: 18px 0 24px; }

/* Played games: cover-first cards, each one a link to the game page. */
.played-game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.played-game-grid > li { min-width: 0; animation: pp-rise .5s var(--soft-ease, ease) both; animation-delay: calc(min(var(--i), 12) * 40ms); }
.played-game {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .25s var(--soft-ease, ease), border-color .25s, box-shadow .25s;
}
.played-game:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 16px 34px #3b1f7a33; }
.played-game:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.played-game-media { position: relative; display: block; overflow: hidden; }
.played-game-art { border: 0; border-radius: 0; transition: transform .45s cubic-bezier(.2, .75, .3, 1), filter .45s ease; }
.played-game:hover .played-game-art { transform: scale(1.06); filter: saturate(1.12); }
.played-game-media::after { content: ''; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, #0b0812b3); pointer-events: none; }
.played-game-play {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: #fff;
  box-shadow: 0 10px 30px #4b22a080;
  opacity: 0;
  transform: translate(-50%, -40%) scale(.85);
  transition: opacity .25s, transform .3s var(--soft-ease, ease);
}
.played-game-play .icon { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.played-game:hover .played-game-play, .played-game:focus-visible .played-game-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.played-game-count { position: absolute; left: 10px; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid #ffffff26; border-radius: 999px; background: #120d1fb3; backdrop-filter: blur(6px); color: #fff; font-size: 11px; font-weight: 600; }
.played-game-count .icon { width: 13px; height: 13px; }
.played-game-copy { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; min-width: 0; }
.played-game-copy strong { overflow: hidden; font-size: 15px; letter-spacing: -.15px; text-overflow: ellipsis; white-space: nowrap; }
.played-game:hover .played-game-copy strong { color: var(--accent); }
.played-game-copy small { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 11px; }
.played-game-copy small span { display: inline-flex; align-items: center; gap: 4px; }
.played-game-genre { padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.played-game-copy small .icon { width: 12px; height: 12px; }

.pp-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; border: 1px dashed var(--border); border-radius: 16px; color: var(--muted); text-align: center; }
.pp-empty .icon { width: 36px; height: 36px; color: var(--accent); }

/* Badges: every earned level badge, then special achievements. */
.pp-badge-panel { padding: 22px; background: radial-gradient(ellipse 50% 60% at 0% 0%, color-mix(in srgb, var(--family) 10%, transparent), transparent 70%), var(--surface); }
.pp-badge-families h3, .pp-badge-panel .achievement-strip h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 16px; }
.pp-badge-families .quest-count, .pp-badge-panel .achievement-strip .quest-count { margin-left: auto; }

.pp-badge-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 124px;
  gap: 12px;
  margin: 18px -22px 0;
  padding: 6px 22px 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  list-style: none;
  mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 22px), transparent);
}
.pp-badge-strip .badge-tile { scroll-snap-align: start; }
.pp-badge-strip .badge-tile.is-current .badge-art img { animation: quest-float 5s ease-in-out infinite; }
.pp-badge-panel .achievement-strip { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.pp-badge-panel .achievement-chip { animation: pp-rise .5s var(--soft-ease, ease) both; animation-delay: calc(var(--i) * 50ms); }

@keyframes pp-rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1100px) {
  .pp-hero-body { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'avatar identity' 'level level'; }
  .pp-level { min-width: 0; }
}
@media (max-width: 680px) {
  .pp-hero { border-radius: 18px; }
  .pp-cover { min-height: 110px; }
  .pp-hero-body { grid-template-columns: 1fr; grid-template-areas: 'avatar' 'identity' 'level'; justify-items: center; gap: 16px; margin-top: -56px; padding: 0 16px 18px; text-align: center; }
  .pp-avatar .public-player-avatar { width: 104px; height: 104px; font-size: 26px; }
  .pp-avatar-badge { width: 52px; height: 52px; right: -14px; }
  .pp-hero .profile-meta { justify-content: center; }
  .pp-bio { margin-inline: auto; }
  .pp-level { width: 100%; text-align: left; }
  .pp-stats { margin: 0 16px; padding-bottom: 18px; }
  .played-game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .played-game-copy { padding: 10px 11px 12px; }
  .played-game-copy strong { font-size: 13px; }
  .played-game-count { left: 6px; bottom: 6px; font-size: 10px; }
  .pp-badge-panel { padding: 16px; }
  .pp-badge-strip { grid-auto-columns: 104px; margin-inline: -16px; padding-inline: 16px; }
}
