/* Profile page — neon-gradient identity shared with the Dual/Live Rush lobbies
   and the leaderboard: bg-portrait backdrop + ambient neon, display-font
   gradient titles, gradient-ring rows, gradient pill tabs. */

:root {
  --profile-bg: #050010;
  --profile-cyan: #2af6ff;
  --profile-cyan-2: #69f3ff;
  --profile-pink: #ff47de;
  --profile-purple: #8b53ff;
  --profile-gold: #ffd86f;
  --profile-text: #f8fbff;
  --profile-muted: rgba(231, 242, 255, .72);
  --profile-shape: polygon(24% 0, 76% 0, 100% 24%, 100% 76%, 76% 100%, 24% 100%, 0 76%, 0 24%);
  --font-display: Impact, Haettenschweiler, "Arial Narrow Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-ui-heavy: "Arial Black", Impact, system-ui, sans-serif;
  --font-meta: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Shared neon gradient ring — same 3-stop ramp as the leaderboard board,
     Dual/Live lobby rows and the Challenges paywall. */
  --profile-ring: linear-gradient(135deg, #41efff 0%, #815cff 50%, #f044d9 100%);
  --profile-row-fill:
    linear-gradient(90deg, rgba(16, 44, 75, .5), rgba(12, 0, 34, .86)) padding-box,
    linear-gradient(rgba(7, 0, 22, .92), rgba(7, 0, 22, .92)) padding-box;
  --profile-row-shadow:
    inset 0 0 18px rgba(42, 246, 255, .07),
    inset 0 0 42px rgba(149, 82, 255, .10),
    0 10px 28px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }

a, button, .profile-icon-link, .profile-secondary-action {
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--profile-bg);
  color: var(--profile-text);
  font-family: var(--font-meta);
}

body { overflow-x: hidden; }

/* ── Fixed neon backdrop (matches leaderboard / lobby background stack) ── */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background:
    linear-gradient(to bottom, rgba(9, 0, 33, .12), rgba(5, 0, 18, .52)),
    url('../assets/bg-portrait.png') center center / cover no-repeat;
  filter: saturate(1.08) contrast(1.05) brightness(.72);
  transform: scale(1.015);
}

body::after {
  z-index: 1;
  opacity: .9;
  background:
    radial-gradient(circle at 24% 16%, rgba(42, 246, 255, .22), transparent 16%),
    radial-gradient(circle at 78% 18%, rgba(255, 71, 222, .22), transparent 18%),
    radial-gradient(circle at 50% 78%, rgba(139, 83, 255, .16), transparent 28%),
    repeating-radial-gradient(circle at 50% 48%, rgba(105, 243, 255, .10) 0 1px, transparent 1px 46px),
    linear-gradient(to bottom, rgba(0, 0, 0, .12), rgba(0, 0, 0, .58));
  mix-blend-mode: screen;
}

.profile-shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 0 0 34px;
}

/* ── Sticky header bar ───────────────────────────────────────────────── */
.profile-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 0 10px;
  pointer-events: none;
}

/* Full-viewport-width frosted backdrop behind the sticky bar —
   opacity is driven by --topbar-opacity (0 at top → 1 after scrolling ~120 px) */
.profile-topbar::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: rgba(4, 0, 18, .9);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(42, 246, 255, .16);
  z-index: -1;
  opacity: var(--topbar-opacity, 0);
}

.profile-topbar-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui-heavy);
  font-size: clamp(.86rem, 3.5vw, 1.05rem);
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--profile-text);
  text-shadow: 0 2px 0 rgba(5, 0, 19, .9), 0 0 10px rgba(42, 246, 255, .3);
}

/* ── Nav icon buttons — violet octagons matching the lobby corner-actions.
   No border on the clipped button: a border would paint around the square
   border-box (ignoring the octagon clip). The rim is the gradient background
   showing around the inset ::before fill. ─────────────────────────────── */
.profile-icon-link {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  clip-path: var(--profile-shape);
  background: linear-gradient(135deg, #8f5bff 0%, #b46bff 48%, #ff35e8 100%);
  box-shadow: 0 0 16px rgba(137, 92, 255, .4), 0 0 24px rgba(255, 53, 232, .22);
  pointer-events: auto;
}

.profile-icon-link::before {
  content: '';
  position: absolute;
  inset: 2px;
  clip-path: var(--profile-shape);
  background:
    radial-gradient(circle at 28% 18%, rgba(97, 246, 255, .35), transparent 42%),
    radial-gradient(circle at 80% 86%, rgba(255, 71, 222, .32), transparent 46%),
    linear-gradient(145deg, rgba(22, 9, 68, .98), rgba(8, 2, 30, .99));
}

.profile-icon-link img { position: relative; z-index: 1; width: 20px; height: 20px; }

.profile-hero {
  text-align: center;
  margin: clamp(12px, 5vh, 42px) auto 22px;
}

.profile-copy,
.profile-since,
.profile-panel p,
.profileMeta {
  color: var(--profile-muted);
}

.profile-kicker {
  margin: 0 0 10px;
  font-family: var(--font-ui-heavy);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #8fd0ff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 10px rgba(69, 234, 255, .45);
}

/* Neon-gradient hero lettering (same treatment as the lobby guide titles).
   text-shadow would bleed through the transparent fill, so glows are
   drop-shadow filters on the rendered glyphs instead. */
.profile-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 11vw, 6rem);
  line-height: .86;
  letter-spacing: .01em;
  text-transform: uppercase;
  background-image: linear-gradient(97deg, #4ecbff 6%, #7f66ff 46%, #ff4fe6 94%);
  -webkit-background-clip: text;
  background-clip: text;
  color: #7f66ff;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 2px 0 rgba(10, 0, 42, .9))
    drop-shadow(0 0 12px rgba(69, 234, 255, .44))
    drop-shadow(0 0 24px rgba(255, 53, 232, .4));
}

.profile-copy {
  margin: 14px auto 0;
  max-width: 660px;
  line-height: 1.5;
  font-weight: 700;
  color: rgba(222, 236, 255, .78);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6);
}

.profile-panel {
  position: relative;
  /* Neon gradient ring — matches the Challenges paywall & leaderboard board */
  border: 2px solid transparent;
  border-radius: 28px;
  padding: clamp(18px, 3vw, 30px);
  background:
    rgba(0, 0, 0, .62) padding-box,
    var(--profile-ring) border-box;
  box-shadow:
    0 0 28px rgba(42, 246, 255, .30),
    0 0 22px rgba(255, 71, 222, .20),
    inset 0 0 22px rgba(129, 92, 255, .11),
    0 24px 72px rgba(0, 0, 0, .54);
}

.profile-signin-panel,
.profile-loading-panel { text-align: center; max-width: 760px; margin: 0 auto; }

.profile-signin-panel h2,
.profile-loading-panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.8rem);
  text-transform: uppercase;
  letter-spacing: .02em;
  text-shadow:
    0 3px 0 rgba(14, 0, 49, .95),
    0 0 12px rgba(255, 255, 255, .55),
    0 0 28px rgba(42, 246, 255, .34),
    0 0 36px rgba(255, 71, 222, .25);
}

.profile-loader-mark {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: var(--profile-cyan);
  filter: drop-shadow(0 0 18px rgba(65, 239, 255, .58));
  animation: profileLoaderPulse 1.2s ease-in-out infinite;
}

.profile-loader-mark img { width: 100%; height: 100%; }

@keyframes profileLoaderPulse {
  0%, 100% { transform: scale(.94); opacity: .72; }
  50% { transform: scale(1.04); opacity: 1; }
}

/* ── Buttons — ghost neon secondary / gradient primary (lobby language) ── */
.profile-secondary-action {
  min-height: 48px;
  padding: 0 20px;
  border: 2px solid rgba(146, 102, 255, .6);
  border-radius: 999px;
  color: var(--profile-text);
  background:
    radial-gradient(circle at 18% 20%, rgba(69, 234, 255, .14), transparent 38%),
    radial-gradient(circle at 88% 84%, rgba(255, 53, 232, .16), transparent 40%),
    rgba(5, 0, 20, .76);
  box-shadow:
    0 0 0 1px rgba(255, 53, 232, .3),
    0 0 14px rgba(69, 234, 255, .2),
    0 0 16px rgba(255, 53, 232, .14);
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  font-size: .82rem;
  letter-spacing: .05em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .72);
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

.profile-secondary-action:hover { filter: brightness(1.1); transform: translateY(-1px); }
.profile-secondary-action:active { transform: scale(.97); }

.profile-name-row button {
  min-height: 48px;
  padding: 0 26px;
  border: 2px solid rgba(213, 233, 255, .75);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(100deg, rgba(69, 234, 255, .95), rgba(118, 83, 255, .95), rgba(255, 53, 232, .96));
  box-shadow:
    0 0 0 2px rgba(69, 234, 255, .3),
    0 0 18px rgba(69, 234, 255, .34),
    0 0 22px rgba(255, 53, 232, .3),
    inset 0 0 14px rgba(255, 255, 255, .18);
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  letter-spacing: .05em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

.profile-name-row button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.profile-name-row button:active { transform: scale(.97); }

.profile-identity-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.profile-avatar-trigger {
  position: relative;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

.profile-avatar-trigger:hover { filter: brightness(1.12); transform: translateY(-1px); }
.profile-avatar-trigger:active { transform: scale(.96); }
.profile-avatar-trigger:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid rgba(213, 233, 255, .9);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #7250ff, #ec36ca);
  box-shadow: 0 0 12px rgba(255, 53, 232, .52);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 24%, rgba(69, 234, 255, .3), transparent 46%) padding-box,
    radial-gradient(circle at 82% 84%, rgba(255, 53, 232, .3), transparent 48%) padding-box,
    linear-gradient(145deg, rgba(22, 9, 68, .98), rgba(8, 2, 30, .99)) padding-box,
    var(--profile-ring) border-box;
  box-shadow: 0 0 16px rgba(42, 246, 255, .22), 0 0 20px rgba(255, 71, 222, .16);
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: .04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .7), 0 0 10px rgba(255, 255, 255, .3);
}

.profile-avatar.player-avatar {
  --avatar-size: 72px;
  border-width: 2px;
  border-color: rgba(83, 216, 255, .74);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .2), transparent 32%),
    linear-gradient(145deg, var(--avatar-colour-start), var(--avatar-colour-end));
  box-shadow:
    0 0 18px var(--avatar-glow),
    0 0 20px rgba(255, 71, 222, .12),
    inset 0 1px 0 rgba(255, 255, 255, .18);
}

.profile-avatar.player-avatar--catalogue {
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .14), transparent 54%),
    linear-gradient(145deg, rgba(22, 9, 68, .98), rgba(8, 2, 30, .99));
}

.profile-identity-card h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 3rem);
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow:
    0 3px 0 rgba(14, 0, 49, .95),
    0 0 12px rgba(255, 255, 255, .5),
    0 0 26px rgba(42, 246, 255, .3);
}
.profile-identity-card p { margin: 0; }

.profile-name-panel {
  margin-top: 20px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-name-panel label {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-ui-heavy);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8fd0ff;
  text-shadow: 0 0 10px rgba(69, 234, 255, .45);
}

.profile-name-row { display: flex; gap: 10px; }
.profile-name-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid rgba(69, 234, 255, .5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(3, 0, 16, .76), rgba(8, 0, 28, .86));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .44), 0 0 12px rgba(69, 234, 255, .16);
  color: var(--profile-text);
  font: inherit;
  font-weight: 700;
}

.profile-name-row input::placeholder { color: rgba(255, 255, 255, .6); }

.profile-avatar-panel {
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 22px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-avatar-modal {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--profile-text);
  background: transparent;
}

.profile-avatar-modal::backdrop {
  background: rgba(2, 0, 12, .78);
  backdrop-filter: blur(8px);
}

.profile-avatar-modal[open] { animation: profile-avatar-in .16s ease-out; }

@keyframes profile-avatar-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-avatar-modal .profile-avatar-panel {
  box-sizing: border-box;
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
}

.profile-avatar-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.profile-avatar-modal-head .profile-kicker { margin: 0 0 4px; }
.profile-avatar-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(14, 0, 49, .95), 0 0 18px rgba(42, 246, 255, .34);
}

.profile-avatar-close {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(105, 243, 255, .34);
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 1, 30, .82);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.profile-avatar-close:hover { filter: brightness(1.18); }
.profile-avatar-panel .profile-message { margin: 0 0 16px; min-height: 20px; }

.profile-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 12px;
}

.profile-avatar-choice {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 128px;
  padding: 12px 10px;
  border: 1px solid rgba(105, 243, 255, .25);
  border-radius: 16px;
  color: var(--profile-text);
  background:
    radial-gradient(circle at 28% 18%, rgba(69, 234, 255, .14), transparent 38%),
    linear-gradient(180deg, rgba(3, 0, 16, .66), rgba(8, 0, 28, .86));
  box-shadow: inset 0 0 18px rgba(105, 243, 255, .06);
  cursor: pointer;
}

.profile-avatar-choice:disabled {
  cursor: not-allowed;
  filter: saturate(.76) brightness(.82);
}

.profile-avatar-choice.is-selected {
  border-color: rgba(255, 216, 111, .78);
  box-shadow:
    0 0 18px rgba(255, 216, 111, .18),
    inset 0 0 18px rgba(255, 216, 111, .08);
}

.profile-avatar-choice .player-avatar { --avatar-size: 62px; }

.profile-avatar-name {
  max-width: 100%;
  color: rgba(248, 251, 255, .9);
  font-family: var(--font-meta);
  font-size: .78rem;
  font-weight: 900;
  text-align: center;
}

.profile-avatar-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 216, 111, .45);
  border-radius: 999px;
  color: #ffe6a0;
  background: rgba(8, 1, 22, .78);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.profile-avatar-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── KPI cards — gradient-ring tiles with leaderboard-style neon values ── */
.profile-kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.profile-kpi-grid article {
  min-height: 108px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-kpi-grid span {
  display: block;
  color: var(--profile-muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-kpi-grid strong {
  display: block;
  margin-top: 10px;
  font-family: var(--font-ui-heavy);
  font-size: clamp(1.4rem, 3.6vw, 2.1rem);
  line-height: .95;
  letter-spacing: -.02em;
  color: #bdfcff;
  text-shadow: 0 0 14px rgba(42, 246, 255, .42);
}

.profile-since { margin: 14px 0 0; font-size: .95rem; }

/* ── Wallet — gold gradient ring variant ─────────────────────────────── */
.profile-wallet-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 20px 22px;
  border: 2px solid transparent;
  border-radius: 22px;
  background:
    radial-gradient(120% 150% at 0 0, rgba(255, 214, 96, .16), transparent 60%) padding-box,
    linear-gradient(180deg, rgba(24, 14, 6, .9), rgba(10, 3, 22, .94)) padding-box,
    linear-gradient(135deg, #ffd86f 0%, #e8965a 50%, #ffd86f 100%) border-box;
  box-shadow:
    inset 0 0 22px rgba(255, 216, 111, .1),
    0 0 20px rgba(255, 216, 111, .18),
    0 10px 28px rgba(0, 0, 0, .22);
}

.profile-wallet-balance {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.profile-wallet-coin {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--profile-gold) 46%, #c8922b);
  border: 1px solid rgba(255, 233, 160, .85);
  box-shadow: 0 0 18px rgba(255, 214, 96, .35), inset 0 -4px 8px rgba(140, 90, 10, .45);
}

.profile-wallet-label {
  display: block;
  color: var(--profile-muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-wallet-balance strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-ui-heavy);
  font-size: clamp(1.7rem, 4.6vw, 2.5rem);
  line-height: .95;
  letter-spacing: -.02em;
  color: var(--profile-gold);
  text-shadow: 0 0 16px rgba(255, 216, 111, .4);
}

.profile-wallet-lifetime { text-align: right; }

.profile-wallet-lifetime strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-ui-heavy);
  font-size: clamp(1rem, 2.8vw, 1.4rem);
  line-height: .95;
  color: #bdfcff;
  text-shadow: 0 0 14px rgba(42, 246, 255, .35);
}

.profile-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.profile-breakdown-card,
.profile-mode-stats-card {
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 22px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-breakdown-card h3,
.profile-mode-stats-card h3,
.profile-battle-section h3 {
  margin: 0 0 14px;
  font-family: var(--font-ui-heavy);
  font-size: .86rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #d18bff;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, .78),
    0 0 12px rgba(186, 92, 255, .65),
    0 0 24px rgba(255, 53, 232, .35);
}

.profile-bars { display: grid; gap: 12px; }
.profile-bar-label { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; color: var(--profile-muted); }
.profile-bar-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.profile-bar-fill {
  height: 100%;
  width: var(--pct);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--profile-cyan), var(--profile-purple) 52%, var(--profile-pink));
  box-shadow: 0 0 10px rgba(42, 246, 255, .35);
}

.profile-mode-stats-card { margin-top: 20px; }
.profile-mode-stats { display: grid; gap: 14px; }

.profile-mode-block {
  border: 1px solid rgba(105, 243, 255, .22);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(4, 0, 18, .4);
}

.profile-mode-block-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(42, 246, 255, .12), rgba(139, 83, 255, .12) 52%, rgba(255, 71, 222, .12));
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  font-size: .86rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--profile-text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6);
  border-bottom: 1px solid rgba(105, 243, 255, .18);
}

.profile-mode-h-legend {
  font-size: .72rem;
  font-weight: 900;
  color: var(--profile-cyan-2);
  letter-spacing: .12em;
  text-shadow: 0 0 8px rgba(42, 246, 255, .5);
}

.profile-mode-v-legend {
  font-size: .72rem;
  font-weight: 900;
  color: var(--profile-pink);
  letter-spacing: .12em;
  text-shadow: 0 0 8px rgba(255, 71, 222, .5);
}

.profile-mode-vs-stats {
  padding: 12px 16px;
  display: grid;
  gap: 14px;
}

.profile-vs-stat-row {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 10px;
}

.profile-vs-h-val {
  font-size: .95rem;
  font-weight: 900;
  color: var(--profile-cyan-2);
  text-align: left;
  text-shadow: 0 0 10px rgba(42, 246, 255, .35);
}

.profile-vs-v-val {
  font-size: .95rem;
  font-weight: 900;
  color: var(--profile-pink);
  text-align: right;
  text-shadow: 0 0 10px rgba(255, 71, 222, .35);
}

.profile-vs-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.profile-vs-bar-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--profile-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.profile-vs-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  background: rgba(255, 255, 255, .05);
}

.profile-vs-bar-h {
  height: 100%;
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(42, 246, 255, .95), rgba(42, 246, 255, .55));
}

.profile-vs-bar-v {
  height: 100%;
  flex: 1;
  background: linear-gradient(90deg, rgba(255, 71, 222, .55), rgba(255, 71, 222, .95));
}

.profile-message { min-height: 1.3em; color: var(--profile-gold); }

/* ── Store panel (Remove Ads) ───────────────────────────────────────────── */

.profile-store-panel {
  max-width: 560px;
  margin: 22px auto 0;
  text-align: center;
}

.profile-store-heading {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  text-transform: uppercase;
  letter-spacing: .02em;
  text-shadow:
    0 3px 0 rgba(14, 0, 49, .95),
    0 0 12px rgba(255, 255, 255, .5),
    0 0 28px rgba(42, 246, 255, .3),
    0 0 36px rgba(255, 71, 222, .22);
}

.profile-store-copy {
  margin: 0 0 22px;
}

.profile-store-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.profile-store-primary-btn {
  min-height: 54px;
  min-width: 220px;
  padding: 0 36px;
  border: 2px solid rgba(213, 233, 255, .75);
  border-radius: 999px;
  background: linear-gradient(100deg, rgba(69, 234, 255, .95), rgba(118, 83, 255, .95), rgba(255, 53, 232, .96));
  color: #fff;
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  cursor: pointer;
  box-shadow:
    0 0 0 2px rgba(69, 234, 255, .3),
    0 0 20px rgba(69, 234, 255, .38),
    0 0 24px rgba(255, 53, 232, .34),
    inset 0 0 16px rgba(255, 255, 255, .18);
  transition: filter .18s, transform .12s;
}

.profile-store-primary-btn:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.profile-store-primary-btn:active { filter: none; transform: scale(.97); }
.profile-store-primary-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.profile-store-primary-btn.purchased {
  background:
    radial-gradient(circle at 18% 20%, rgba(69, 234, 255, .18), transparent 38%),
    radial-gradient(circle at 88% 84%, rgba(255, 53, 232, .2), transparent 40%),
    rgba(5, 0, 20, .76);
  border: 2px solid rgba(69, 234, 255, .48);
  box-shadow: none;
}

.profile-store-restore-btn {
  min-width: 180px;
  padding: 0 24px;
  font-size: .82rem;
}

@media (max-width: 1100px) {
  .profile-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .profile-provider-grid,
  .profile-breakdown-grid { grid-template-columns: 1fr; }
  .profile-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .profile-shell { width: min(100% - 20px, 1180px); }
  .profile-identity-card { grid-template-columns: auto 1fr; }
  .profile-secondary-action { grid-column: 1 / -1; }
  .profile-name-row { flex-direction: column; }
  .profile-wallet-card { grid-template-columns: 1fr; }
  .profile-wallet-lifetime { text-align: left; }
  .profile-avatar-modal { width: calc(100vw - 20px); }
  .profile-avatar-modal .profile-avatar-panel {
    max-height: min(760px, calc(100vh - 32px));
    padding: 16px;
  }
  .profile-avatar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-avatar-choice { min-height: 116px; }
  .profile-avatar-modal-actions .profile-secondary-action { width: 100%; }
}

/* ── Battles tab ─────────────────────────────────────────────────────────── */
.profile-tabs {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

/* Gradient pill tabs — same language as the lobby format options. */
.profile-tab {
  flex: 1;
  min-height: 48px;
  padding: 12px 16px;
  border: 2px solid rgba(140, 116, 255, .78);
  border-radius: 999px;
  background:
    radial-gradient(circle at 22% 22%, rgba(69, 234, 255, .1), transparent 40%),
    radial-gradient(circle at 84% 82%, rgba(255, 53, 232, .12), transparent 42%),
    rgba(6, 1, 24, .78);
  box-shadow:
    0 0 0 1px rgba(69, 234, 255, .16),
    0 0 12px rgba(137, 92, 255, .28),
    inset 0 0 14px rgba(0, 0, 0, .5);
  color: #fff;
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: .82rem;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .78);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .16s ease, border-color .16s ease;
}

.profile-tab:active { transform: scale(.97); }

.profile-tab.is-active {
  border-color: rgba(216, 240, 255, .92);
  background: linear-gradient(95deg, #2fb4ff 0%, #8a4dff 52%, #f13fe3 100%);
  box-shadow:
    0 0 0 2px rgba(120, 220, 255, .35),
    0 0 18px rgba(69, 234, 255, .45),
    0 0 26px rgba(255, 53, 232, .45),
    inset 0 0 14px rgba(255, 255, 255, .2);
}

.profile-battle-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.profile-battle-kpi-grid article {
  min-height: 96px;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-battle-kpi-grid span {
  display: block;
  color: var(--profile-muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-battle-kpi-grid strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-ui-heavy);
  font-size: clamp(1.25rem, 3.2vw, 1.9rem);
  line-height: .95;
  letter-spacing: -.02em;
  color: #bdfcff;
  text-shadow: 0 0 14px rgba(42, 246, 255, .42);
}

.profile-battle-section { margin-top: 26px; }

.profile-battle-list { display: grid; gap: 12px; }

/* Battle rows carry the shared gradient ring; the win/loss accent moves to
   an inset left bar (a border-left can't cut through the border-box ring). */
.profile-battle-row {
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}

.profile-battle-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-battle-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-ui-heavy);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .12);
  color: var(--profile-text);
}

.profile-battle-opp { font-weight: 800; }
.profile-battle-time {
  margin-left: auto;
  color: var(--profile-muted);
  font-size: .78rem;
}

.profile-battle-row-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 8px;
  color: var(--profile-muted);
  font-size: .86rem;
}
.profile-battle-points em { font-style: normal; color: var(--profile-text); }

.profile-battle-row-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.profile-battle-meta {
  color: var(--profile-muted);
  font-size: .76rem;
  letter-spacing: .04em;
}

/* Result accents (shared by rows + rival last-result chips). */
.result-win { --result-color: var(--profile-cyan); }
.result-loss { --result-color: var(--profile-pink); }
.result-draw { --result-color: var(--profile-gold); }
.result-abandoned { --result-color: rgba(231, 242, 255, .5); }

.profile-battle-row.result-win,
.profile-battle-row.result-loss,
.profile-battle-row.result-draw,
.profile-battle-row.result-abandoned {
  box-shadow:
    inset 4px 0 0 var(--result-color),
    inset 0 0 18px rgba(42, 246, 255, .07),
    inset 0 0 42px rgba(149, 82, 255, .10),
    0 10px 28px rgba(0, 0, 0, .22);
}
.profile-battle-row.result-win .profile-battle-badge,
.profile-battle-row.result-loss .profile-battle-badge,
.profile-battle-row.result-draw .profile-battle-badge,
.profile-battle-row.result-abandoned .profile-battle-badge {
  background: color-mix(in srgb, var(--result-color) 26%, transparent);
  color: var(--result-color);
  box-shadow: 0 0 12px color-mix(in srgb, var(--result-color) 30%, transparent);
}

.profile-rivals-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-rival-card {
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: var(--profile-row-fill), var(--profile-ring) border-box;
  box-shadow: var(--profile-row-shadow);
}
.profile-rival-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.profile-rival-head strong {
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(5, 0, 19, .9), 0 0 10px rgba(255, 255, 255, .35);
}
.profile-rival-record {
  color: var(--profile-muted);
  font-size: .82rem;
  font-weight: 800;
}
.profile-rival-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: .78rem;
}
.profile-rival-last { font-weight: 800; color: var(--result-color, var(--profile-muted)); }
.profile-rival-time { color: var(--profile-muted); }

/* Rematch — violet gradient pill like the lobby invite buttons. */
.profile-rematch-btn {
  margin-left: auto;
  padding: 8px 18px;
  border: 2px solid rgba(213, 233, 255, .75);
  border-radius: 999px;
  background: linear-gradient(100deg, rgba(108, 76, 255, .96), rgba(190, 64, 255, .96));
  box-shadow:
    0 0 14px rgba(137, 92, 255, .45),
    0 0 20px rgba(255, 53, 232, .3),
    inset 0 0 12px rgba(255, 255, 255, .16);
  color: #fff;
  font-family: var(--font-ui-heavy);
  font-weight: 900;
  font-size: .72rem;
  letter-spacing: .06em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}
.profile-rematch-btn:hover { filter: brightness(1.08); }
.profile-rematch-btn:active { transform: scale(.97); }
.profile-rematch-btn:disabled { opacity: .5; cursor: default; filter: none; }

@media (max-width: 1100px) {
  .profile-battle-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .profile-battle-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-rivals-list { grid-template-columns: 1fr; }
}
