/* Perfil (#perfil, iteration 27, js/ui/profile.js).
   A warm card with your rat on a little lit stage, then the numbers as small tiles with pixel icons,
   then two columns: newest achievements + wallet, account + settings. Jersey 10 only at 20/30/40 px. */

.screen-profile { display: flex; flex-direction: column; gap: var(--sp-5); }

/* ------------------------------------------------------------ the card */
.pf-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-5);
  background: linear-gradient(180deg, #2A1E4D 0%, var(--surface-1) 70%);
}
.pf-portrait {
  position: relative;
  display: grid;
  place-items: end center;
  width: 160px;
  height: 160px;
  padding-bottom: 10px;
  background: var(--well);
  box-shadow: var(--sunk), var(--ring2);
  overflow: hidden;
}
.pf-portrait-glow {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 120px;
  height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 60%, rgba(244, 199, 82, 0.28), rgba(146, 118, 245, 0.12) 55%, transparent 72%);
  pointer-events: none;
}
.pf-portrait::after { /* the little stage under the rat */
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 8px;
  height: 8px;
  background: #2B1D5C;
  box-shadow: inset 0 2px 0 #4A3590;
}
.pf-portrait > .sprite, .pf-portrait > canvas, .pf-portrait > img { position: relative; z-index: 1; }

.pf-id { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pf-name {
  margin: 0;
  font: 400 var(--px-m)/1 var(--f-display);
  color: var(--text);
  overflow-wrap: anywhere;
}
.pf-since { margin: 0; color: var(--text-2); font-size: var(--fs-5); }

.pf-level { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.pf-lvl {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px 5px;
  font: 400 var(--px-m)/1 var(--f-display);
  color: #fff;
  background: var(--violet);
  box-shadow: inset 0 3px 0 var(--violet-hi), inset 0 -3px 0 var(--violet-lo), var(--ring2);
}
.pf-lvl small { font: 400 var(--px-s)/1 var(--f-display); color: #E2D8FF; }
.pf-xp { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.pf-xp-bar {
  display: block;
  height: 14px;
  background: var(--well);
  box-shadow: var(--sunk-2), var(--ring2);
  overflow: hidden;
}
.pf-xp-fill {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, var(--violet-hi) 0 3px, var(--violet) 3px 100%);
  transition: width var(--t-fast, 160ms) steps(4);
}
.pf-xp-text { color: var(--text-2); font-size: var(--fs-6); }

.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font: 500 var(--fs-6)/1.2 var(--f-body);
  color: var(--text-2);
  background: var(--surface-2);
  box-shadow: var(--bevel-2s), var(--ring2);
  border: 0;
}
.pf-chip.is-ok { color: var(--success); }
.pf-chip.is-ok::before { content: '✓'; font-weight: 700; }
.pf-chip.is-google { color: var(--text); }
.pf-chip.is-warn { color: var(--gold); }
.pf-chip.is-button { cursor: pointer; }
.pf-chip.is-button:hover { background: var(--surface-3); }

/* ------------------------------------------------------------ numbers */
.pf-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: var(--sp-3) 0 0;
}
.pf-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  padding: 10px 12px;
  background: var(--well);
  box-shadow: var(--sunk-2);
  min-width: 0;
}
.pf-tile-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 32px; height: 32px; }
.pf-tile dt { font-size: var(--fs-6); color: var(--text-2); line-height: 1.3; }
.pf-tile dd { margin: 0; font: 400 var(--px-s)/1.1 var(--f-display); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.pf-more { color: var(--violet-text); font-size: var(--fs-5); text-decoration: none; white-space: nowrap; }
.pf-more:hover { text-decoration: underline; }
.screen-profile .panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }

/* ------------------------------------------------------------ two columns */
.pf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
@media (min-width: 900px) { .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pf-grid > .panel { display: flex; flex-direction: column; gap: var(--sp-3); }
.pf-grid > .panel > .btn, .pf-grid > .panel > .pf-more { align-self: flex-start; }

.pf-ach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pf-ach-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); box-shadow: var(--bevel-2s); }
.pf-ach-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; }
.pf-ach-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-ach-text strong { font-weight: 600; color: var(--text); }
.pf-ach-text small { color: var(--text-3); font-size: var(--fs-6); }

.pf-kv { margin: 0; }
.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ------------------------------------------------------------ the top bar opens the profile */
.hud-player.is-link { cursor: pointer; }
.hud-player.is-link:hover .hud-name { color: var(--violet-text); }
.hud-player.is-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ------------------------------------------------------------ phones */
@media (max-width: 639.98px) {
  .pf-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .pf-id { align-items: center; width: 100%; }
  .pf-level { width: 100%; }
  .pf-xp { text-align: left; }
  .pf-chips { justify-content: center; }
  .pf-portrait { width: 136px; height: 136px; }
  .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .pf-xp-fill { transition: none; } }

/* «Invita y gana» (iteration 35): the referral link, a copy button and what it earned. */
.pf-ref { display: flex; flex-direction: column; gap: var(--sp-3); }
.pf-ref-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.pf-ref-body > p { margin: 0; color: var(--text-2); line-height: 1.5; }
.pf-ref-body strong { color: var(--gold); }
.pf-ref-row { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.pf-ref-link { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.pf-ref-stats { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.pf-ref-stats > div { flex: 1 1 140px; padding: 10px 12px; background: var(--well); box-shadow: var(--sunk-2); }
.pf-ref-stats dt { font-size: var(--fs-6); color: var(--text-2); }
.pf-ref-stats dd { margin: 4px 0 0; font: 400 var(--px-s)/1 var(--f-display); color: var(--text); }
.pf-ref-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-ref-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 10px; background: var(--surface-2); box-shadow: var(--bevel-2s); }
.pf-ref-list li span { color: var(--text); overflow-wrap: anywhere; }
.pf-ref-list li strong { color: var(--gold); text-align: right; }
.pf-ref-list li small { grid-column: 1 / -1; color: var(--text-3); font-size: var(--fs-6); }
.pf-ref-note { font-size: var(--fs-6); }
