:root {
  --profile-paper: #170c29;
  --profile-panel: #23143a;
  --profile-ink: #fff7df;
  --profile-muted: #b9a9c8;
  --profile-line: #4a2c68;
  --profile-yellow: #ffe600;
  --profile-pink: #ff4f9a;
}

.player-profile {
  min-height: 100vh;
  padding: 48px 28px 70px;
  color: var(--profile-ink);
  background-color: var(--profile-paper);
  background-image:
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, #662b8b 0, transparent 45%);
  background-size: 28px 28px, 28px 28px, auto;
  font-family: Arial, Helvetica, sans-serif;
}

.player-profile * { box-sizing: border-box; }
.profile-shell { max-width: 1180px; margin: auto; }
.profile-hero,
.profile-panel {
  background: var(--profile-panel);
  border: 2px solid var(--profile-line);
  box-shadow: 7px 7px 0 #07030d;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr minmax(280px, 360px);
  align-items: center;
  gap: 28px;
  margin-bottom: 24px;
  padding: 30px;
  border-radius: 4px 28px 4px 28px;
}

.profile-avatar {
  position: relative;
  overflow: visible;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  color: #191919;
  background: var(--profile-yellow);
  border-radius: 26px;
  box-shadow: inset 0 0 0 7px #ffffff66;
  transform: rotate(-2deg);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.profile-avatar-fallback {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.profile-online-status {
    position: absolute;
    left: 50%;
    bottom: -8px;
    z-index: 2;

    transform: translateX(-50%);

    padding: 6px 13px;
    border: 3px solid #173c62;
    border-radius: 999px;

    color: #fff;
    background: #00b978;

    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    line-height: 1;
    white-space: nowrap;
}

.profile-identity p,
.section-heading span {
  margin: 0 0 6px;
  color: var(--profile-pink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
}

.profile-identity h1 {
  margin: 0;
  color: var(--profile-ink);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  letter-spacing: -.055em;
}
.profile-identity h1 span { color: var(--profile-muted); font-weight: 500; }
.identity-tags { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 13px; color: var(--profile-muted); font-size: 11px; }
.identity-tags span:not(:first-child)::before { content: "•"; margin-right: 14px; color: var(--profile-pink); }

.xp-meta { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.xp-meta span:first-child { color: var(--profile-pink); }
.xp-track, .quest-progress { overflow: hidden; height: 15px; padding: 3px; background: #10081d; border-radius: 20px; }
.xp-track span, .quest-progress span { display: block; height: 100%; background: var(--profile-yellow); border-radius: 20px; }
.xp-wrap small { display: block; margin-top: 7px; color: var(--profile-muted); font-size: 9px; text-align: right; font-weight: 700; letter-spacing: .1em; }

.profile-body { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.profile-panel { min-width: 0; padding: 24px; border-radius: 4px; }
.profile-panel.wide { grid-column: 1 / -1; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--profile-ink); font-size: 22px; letter-spacing: -.03em; }

.quest-list { display: grid; gap: 10px; }
.quest-item, .score-row, .badge-item, .era-grid article {
  background: #190e2b;
  border: 1px solid var(--profile-line);
}
.quest-item { padding: 15px 16px; border-radius: 12px; }
.quest-top { display: flex; justify-content: space-between; gap: 10px; }
.quest-top strong, .quest-top span { display: block; }
.quest-top strong { font-size: 13px; }
.quest-top span { margin-top: 4px; color: var(--profile-muted); font-size: 10px; }
.quest-top b { white-space: nowrap; color: var(--profile-pink); font-size: 11px; }
.quest-progress { height: 9px; margin-top: 12px; padding: 0; }
.quest-progress span { background: var(--profile-pink); }
.quest-item small { display: block; margin-top: 5px; color: var(--profile-muted); font-size: 9px; text-align: right; }

.era-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.era-grid article { min-height: 112px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 12px; }
.era-grid article > span { color: var(--profile-muted); font-weight: 800; text-transform: uppercase; }
.era-grid strong { color: var(--profile-ink); font-size: 32px; letter-spacing: -.05em; }
.era-grid small { color: var(--profile-muted); }
.era-grid .featured-era { color: #191919; background: var(--profile-yellow); transform: rotate(1deg); }
.era-grid .featured-era > span, .era-grid .featured-era small { color: #191919aa; }
.era-grid .featured-era strong { color: #191919; }

.score-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; }
.score-row { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; }
.game-dot { width: 38px; height: 38px; display: grid; place-items: center; color: #171717; background: #ffd000; border-radius: 10px; font-style: normal; font-weight: 900; }
.score-row strong, .score-row div span { display: block; }
.score-row strong { color: var(--profile-ink); font-size: 12px; }
.score-row div span { margin-top: 3px; color: var(--profile-muted); font-size: 9px; }
.score-row > b { color: var(--profile-ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.rank { min-width: 34px; padding: 6px 7px; color: white; background: #252b32; border-radius: 8px; text-align: center; font-size: 11px; }
.rank-1 { color: #171717; background: #ffcb15; }
.rank-2 { color: #171717; background: #c8d0d7; }

.badge-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.badge-item { padding: 14px 8px; text-align: center; border-radius: 12px; }
.badge-icon { width: 56px; height: 56px; margin: 0 auto 9px; display: grid; place-items: center; color: #322a12; background: #ffd24b; border: 5px double #fff8; border-radius: 50%; font-size: 17px; font-weight: 900; box-shadow: 0 3px 0 #d5a900; }
.tone-coral { background: #ff806b; box-shadow: 0 3px 0 #c84c39; }
.tone-mint { background: #6bd7ab; box-shadow: 0 3px 0 #2f9d70; }
.tone-blue { background: #77c8f3; box-shadow: 0 3px 0 #3189b8; }
.tone-violet { background: #b8a2ff; box-shadow: 0 3px 0 #7055c6; }
.badge-item strong, .badge-item div span { display: block; }
.badge-item strong { color: var(--profile-ink); font-size: 10px; }
.badge-item div span { margin-top: 4px; color: var(--profile-muted); font-size: 8px; }
.badge-item.locked { filter: grayscale(1); opacity: .42; }
.empty-state { color: var(--profile-muted); }

@media (max-width: 900px) {
  .player-profile { padding: 24px 14px 50px; }
  .profile-hero { grid-template-columns: auto 1fr; padding: 20px; }
  .profile-hero .xp-wrap { grid-column: 1 / -1; }
  .profile-body { grid-template-columns: 1fr; }
  .profile-panel.wide { grid-column: auto; }
  .score-list { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .profile-hero { gap: 16px; }
  .profile-avatar { width: 72px; height: 72px; border-radius: 17px; }
  .profile-avatar > span { font-size: 26px; }
  .profile-identity h1 { font-size: 29px; }
  .identity-tags { gap: 6px; }
  .identity-tags span:not(:first-child)::before { margin-right: 6px; }
  .era-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; }
  .era-grid article { min-width: 145px; scroll-snap-align: start; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .score-row { grid-template-columns: 38px 1fr auto; }
  .score-row > b { grid-column: 2; }
  .score-row .rank { grid-row: 1 / 3; grid-column: 3; }
}
