.profile-avatar { overflow: hidden; flex: 0 0 auto; }
.profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.referral-shell {
  --referral-surface: #101319;
  --referral-highlight: #d363ba;
  --referral-glow: #352338;
  --referral-shadow: #231929;
  --referral-track: #2d2933;
  --referral-radius: clamp(21px, 5.5vw, 26px);
  --referral-body-size: clamp(13px, 3.52vw, 16px);
  --referral-button-height: clamp(38px, 10.4vw, 47px);
  --referral-tab-height: clamp(31px, 8.2vw, 37px);
}

body.light .referral-shell {
  --referral-surface: #fff;
  --referral-highlight: #a33c91;
  --referral-glow: #f2e1f4;
  --referral-shadow: #fcf6fd;
  --referral-track: #eee3ef;
}

.referral-panel {
  display: grid;
  padding: clamp(15px, 4.45vw, 20px);
  border: 1px solid var(--line);
  border-radius: var(--referral-radius);
  background: radial-gradient(ellipse at 88% 11%, var(--referral-glow), transparent 64%),
              linear-gradient(150deg, var(--referral-shadow), var(--referral-surface) 71%);
}

.referral-shell-with-tabs .referral-panel { border-bottom-right-radius: 0; }

.referral-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.referral-panel-header h2 { margin: 0; font-size: clamp(14px, 3.75vw, 17px); font-weight: 750; line-height: 1.3; }
.referral-panel-header p { margin: 5px 0 0; color: var(--muted); font-size: var(--referral-body-size); line-height: 1.35; }
.referral-info { width: 34px; height: 34px; flex: 0 0 auto; color: var(--muted); font-size: 18px; font-weight: 700; }

.referral-wallet { margin-top: clamp(10px, 3.4vw, 15px); }
.referral-wallet strong { display: block; color: var(--referral-highlight); font-size: clamp(27px, 7.8vw, 35px); line-height: 1.08; font-weight: 750; }
.referral-wallet span { display: block; margin-top: 5px; color: var(--muted); font-size: var(--referral-body-size); line-height: 1.3; }

.referral-progress { margin-top: clamp(13px, 4.3vw, 19px); }
.referral-progress p { margin: 0 0 8px; color: var(--muted); font-size: var(--referral-body-size); line-height: 1.3; }
.referral-progress progress { appearance: none; display: block; width: 100%; height: clamp(7px, 2.2vw, 10px); overflow: hidden; border: 0; border-radius: 12px; background: var(--referral-track); }
.referral-progress progress::-webkit-progress-bar { background: var(--referral-track); }
.referral-progress progress::-webkit-progress-value { background: var(--referral-highlight); }
.referral-progress progress::-moz-progress-bar { background: var(--referral-highlight); }

.referral-race-link {
  display: grid;
  grid-template-columns: clamp(20px, 5.8vw, 26px) minmax(0, 1fr) 17px;
  align-items: center;
  gap: clamp(9px, 3vw, 14px);
  min-height: clamp(60px, 18vw, 82px);
  width: 100%;
  margin-top: clamp(10px, 3.1vw, 14px);
  padding: 6px 0;
  border-block: 1px solid var(--referral-track);
  text-align: left;
  font-size: var(--referral-body-size);
  line-height: 1.45;
}
.referral-race-link b { font-weight: 750; }
.referral-race-link small { display: block; color: var(--muted); font-size: inherit; }
.referral-race-link > .icon { width: 17px; height: 17px; color: var(--muted); }
.referral-cup { display: grid; place-items: center; color: #ffc84d; }
.referral-cup .icon { width: clamp(18px, 5.2vw, 23px); height: auto; stroke-width: 2; }

.referral-share {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(9px, 3vw, 14px);
  margin-top: clamp(10px, 3.3vw, 15px);
}
.referral-share .button {
  min-width: 0;
  min-height: var(--referral-button-height);
  gap: clamp(5px, 2vw, 10px);
  padding: 5px 7px;
  border-radius: 30px;
  background: var(--referral-surface);
  box-shadow: none;
  font-size: var(--referral-body-size);
  font-weight: 750;
  line-height: 1.2;
}
.referral-share .icon { width: clamp(14px, 4vw, 18px); height: auto; aspect-ratio: 1; }
.referral-story-button { grid-column: 1 / -1; }

.referral-tabs {
  display: flex;
  position: relative;
  justify-content: flex-end;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: -1px 0 0 auto;
  padding: 6px clamp(8px, 2.7vw, 12px) 7px 6px;
  border: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  border-bottom-right-radius: var(--referral-radius);
  background: var(--referral-surface);
}
.referral-tabs button {
  flex: 0 1 auto;
  min-width: 0;
  min-height: var(--referral-tab-height);
  padding: 4px clamp(6px, 2.2vw, 10px);
  border: 1px solid transparent;
  border-radius: 24px;
  font-size: var(--referral-body-size);
  font-weight: 720;
  line-height: 1.2;
}
.referral-tabs button[aria-selected="true"] { border-color: var(--line); background: var(--referral-surface); }
.referral-tabs-join { position: absolute; right: calc(100% - 1px); top: 0; bottom: -1px; width: clamp(31px, 9.2vw, 42px); height: calc(100% + 1px); pointer-events: none; }
.referral-tabs-join path:first-child { fill: var(--referral-surface); }
.referral-tabs-join path:last-child { fill: none; stroke: var(--line); }

.referral-payout-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; }
.referral-payout-row .referral-wallet { flex: 1 0 135px; }
.referral-payout-row .referral-withdraw { width: auto; min-height: 38px; padding: 5px 12px; font-size: var(--referral-body-size); }
.referral-payout-row .referral-withdraw .icon { width: 16px; height: 16px; }
.referral-payout-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--referral-track); color: var(--muted); font-size: var(--referral-body-size); }
.referral-payout-stats > :last-child { text-align: right; }
.referral-payout-stats strong { display: block; margin-top: 3px; color: inherit; }

.profile-menu { margin-top: 9px; }
.profile-menu .card {
  padding-block: 4px;
  border-radius: clamp(20px, 5.6vw, 26px);
}
.profile-menu .section-heading {
  margin: clamp(21px, 6vw, 28px) clamp(11px, 3.2vw, 15px) 7px;
  color: #b7c5e8;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 500;
  line-height: 1.25;
}
body.light .profile-menu .section-heading { color: var(--muted); }
.profile-menu .list-item {
  min-height: clamp(50px, 14.45vw, 65px);
  width: calc(100% - 8px);
  margin-inline: 4px;
  gap: clamp(9px, 2.5vw, 12px);
  padding: 8px clamp(10px, 3vw, 14px);
  border-radius: 20px;
}
.profile-menu .list-item:hover { background: color-mix(in srgb, currentColor 5%, transparent); }
.profile-menu .list-item .label {
  min-width: 0;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
  line-height: 1.25;
}
.profile-menu .list-item .sub {
  margin-top: 3px;
  font-size: clamp(12px, 3.7vw, 16px);
  line-height: 1.3;
}
.profile-menu .list-item > .icon { width: clamp(17px, 4.75vw, 22px); height: auto; aspect-ratio: 1; }
.profile-menu .list-item > .chevron { width: clamp(14px, 3.6vw, 17px); color: var(--muted); }
.profile-menu .list-item > .sidebar-solid { fill: currentColor; stroke: none; }
