/* Profile-only layout. Shared contact/auth styles remain untouched. */

.profile-hub.profile-layout {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 auto 2rem;
}

#profilePage {
  min-height: 0;
  padding-bottom: 48px;
}

@media (max-width: 767px) {
  .profile-page .nav-actions { gap: 8px; }
  /* Identity already appears directly below; retain the logout control. */
  .profile-page #navUserBtn > a { display: none; }
}

.profile-layout {
  --pl-text: var(--primaryText, #f4f4f5);
  --pl-soft: var(--secondaryText, #c3c6cf);
  --pl-muted: var(--mutedText, #969aa6);
  --pl-border: var(--mainBorderDarker, #2a2c33);
  --pl-border-soft: var(--mainBorderSubtler, #23252b);
  --pl-surface: #17181d;
  --pl-surface-2: #1d1f26;
  --pl-accent: var(--primaryColor, #6d78d8);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

.profile-layout .pl-identity,
.profile-layout .pl-identity *,
.profile-layout .pl-tabs,
.profile-layout .pl-tabs *,
.profile-layout .pl-panel,
.profile-layout .pl-panel-heading,
.profile-layout .pl-panel-lead,
.profile-layout .pl-appearance,
.profile-layout .pl-appearance *,
.profile-layout .pl-invite,
.profile-layout .pl-invite * {
  box-sizing: border-box;
}

.profile-layout .pl-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--pl-border);
  color: var(--pl-text);
  text-align: left;
}

.profile-layout .pl-avatar.avatar-box {
  display: block;
  flex: 0 0 80px;
  width: 80px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.profile-layout .pl-avatar .avatar-img-wrap {
  width: 80px;
  height: 80px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--pl-border);
  border-radius: 50%;
  background: var(--pl-surface);
  box-shadow: none;
  overflow: hidden;
}

.profile-layout .pl-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #0f1013;
}

.profile-layout .pl-identity-copy {
  flex: 1 1 320px;
  min-width: 0;
  color: var(--pl-text);
  text-align: left;
}

.profile-layout .pl-identity-copy .user-title {
  margin: 0 0 4px;
  color: var(--pl-text);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-layout .pl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
  color: var(--pl-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.profile-layout .pl-meta .user-id-badge,
.profile-layout .pl-meta .badge-neutral,
.profile-layout .pl-meta .pl-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--pl-border);
  border-radius: 4px;
  background: var(--pl-surface);
  color: var(--pl-soft);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.profile-layout .pl-meta .pl-status--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.profile-layout .pl-meta .pl-status-wrap:empty {
  display: none;
}

.profile-layout .pl-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

.profile-layout .pl-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--pl-border);
  border-radius: 6px;
  background: var(--pl-surface);
  color: var(--pl-soft);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.profile-layout .pl-download:hover {
  border-color: #3a3d47;
  background: var(--pl-surface-2);
  color: var(--pl-text);
}

.profile-layout .pl-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--pl-border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.profile-layout .pl-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--pl-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.profile-layout .pl-tab:hover {
  color: var(--pl-text);
}

.profile-layout .pl-tab[aria-selected="true"] {
  color: var(--pl-text);
  border-bottom-color: var(--pl-accent);
}

.profile-layout .pl-panel {
  min-width: 0;
  padding: 26px 0 8px;
}

.profile-layout .pl-panel[hidden] {
  display: none !important;
}

.profile-layout .pl-panel-heading {
  margin: 0 0 6px;
  color: var(--pl-text);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-layout .pl-panel-lead {
  max-width: 72ch;
  margin: 0 0 20px;
  color: var(--pl-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-layout .pl-appearance {
  color: var(--pl-text);
}

.profile-layout .pl-appearance .pl-form {
  max-width: 640px;
  margin: 0;
}

.profile-layout .pl-appearance .form-group {
  margin: 0 0 12px;
}

.profile-layout .pl-appearance .form-label,
.profile-layout .pl-invite .form-label {
  display: block;
  margin: 0 0 6px;
  color: var(--pl-soft);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
}

.profile-layout .pl-appearance .input-with-button,
.profile-layout .pl-invite .input-with-button {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.profile-layout .pl-appearance .form-input,
.profile-layout .pl-invite .form-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--pl-border);
  border-radius: 6px;
  background: var(--pl-surface);
  color: var(--pl-text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.3;
  outline: none;
}

.profile-layout .pl-invite .form-input[readonly] {
  color: var(--pl-soft);
}

.profile-layout .pl-appearance .form-input:focus,
.profile-layout .pl-invite .form-input:focus {
  border-color: var(--pl-accent);
}

.profile-layout .pl-appearance .contained-button,
.profile-layout .pl-invite .contained-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--pl-border);
  border-radius: 6px;
  background: var(--pl-surface-2);
  background-image: none;
  box-shadow: none;
  color: var(--pl-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.profile-layout .pl-appearance .contained-button:hover,
.profile-layout .pl-invite .contained-button:hover {
  border-color: #3a3d47;
  background: #252833;
  color: var(--pl-text);
}

.profile-layout .pl-note {
  max-width: 640px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--pl-border-soft);
  border-radius: 6px;
  background: transparent;
  color: var(--pl-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-layout .pl-invite {
  color: var(--pl-text);
}

.profile-layout .pl-invite .pl-panel-lead {
  margin-bottom: 16px;
}

.profile-layout .pl-invite .pl-panel-lead a {
  color: var(--pl-accent);
  text-decoration: none;
}

.profile-layout .pl-invite .pl-panel-lead a:hover {
  text-decoration: underline;
}

.profile-layout .pl-invite code {
  padding: 1px 4px;
  border: 1px solid var(--pl-border);
  border-radius: 3px;
  background: var(--pl-surface);
  color: var(--pl-soft);
  font-size: 0.85em;
}

.profile-layout .pl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 0 0 18px;
  padding: 0;
}

.profile-layout .pl-stat {
  min-width: 92px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.profile-layout .pl-stat dt {
  margin: 0 0 2px;
  color: var(--pl-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-layout .pl-stat dd {
  margin: 0;
  color: var(--pl-text);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.profile-layout .pl-referral {
  max-width: 640px;
}

.profile-layout .pl-tab:focus-visible,
.profile-layout .pl-download:focus-visible,
.profile-layout .pl-appearance .form-input:focus-visible,
.profile-layout .pl-appearance .contained-button:focus-visible,
.profile-layout .pl-invite .form-input:focus-visible,
.profile-layout .pl-invite .contained-button:focus-visible {
  outline: 2px solid var(--pl-accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .profile-layout .pl-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-layout .pl-tab { white-space: normal; justify-content: center; padding: 8px 6px; font-size: 0.85rem; }
  .profile-layout .pl-identity {
    gap: 12px;
    padding-bottom: 16px;
  }

  .profile-layout .pl-identity-copy {
    flex-basis: 180px;
  }

  .profile-layout .pl-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .profile-layout .pl-download {
    flex: 1 1 140px;
  }

  .profile-layout .pl-panel {
    padding-top: 22px;
  }

  .profile-layout .pl-appearance .input-with-button,
  .profile-layout .pl-invite .input-with-button {
    flex-direction: column;
  }

  .profile-layout .pl-appearance .contained-button,
  .profile-layout .pl-invite .contained-button {
    width: 100%;
  }

  .profile-layout .pl-stats {
    gap: 18px;
  }
}

@media (max-width: 380px) {
  .profile-layout .pl-identity-copy {
    flex-basis: 160px;
  }

  .profile-layout .pl-avatar.avatar-box { flex-basis: 64px; width: 64px; }
  .profile-layout .pl-avatar .avatar-img-wrap { width: 64px; height: 64px; }
  .profile-layout .pl-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .profile-layout .pl-tab {
    padding: 8px 4px;
    font-size: 0.8rem;
    white-space: normal;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-layout .pl-tab,
  .profile-layout .pl-download,
  .profile-layout .pl-appearance .contained-button,
  .profile-layout .pl-invite .contained-button {
    transition: none;
  }
}

/* Profile name and account BB balance share one wrapping row. */
.profile-layout .pl-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 4px; }
.profile-layout .pl-name-row .user-title { margin: 0; }
.profile-layout .pl-balance { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid rgba(250, 204, 21, .3); border-radius: 7px; background: rgba(250, 204, 21, .1); color: #facc15; font-size: .8rem; font-weight: 700; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; }
.profile-layout .pl-balance .bb-coin-icon { width: 18px; height: 18px; flex: 0 0 18px; display: inline-block; vertical-align: middle; object-fit: contain; }
/* Match Discord's linked badge, including asynchronously rendered Telegram state. */
.profile-layout .telegram-card .badge-tg { font-size: .75rem; letter-spacing: normal; border-radius: 999px; }
.profile-layout .telegram-card .badge-tg-verified { background: rgba(88, 101, 242, .15); border: 1px solid rgba(88, 101, 242, .4); color: #a5b4fc; }

/* Direct BB top-up, beside its balance; 32px face inside a 44px hit target. */
.profile-layout .pl-wallet {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
}

.profile-layout .pl-topup {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  padding: 6px;
  color: #facc15;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: 0;
  background: transparent;
  border-radius: 7px;
}

.profile-layout .pl-topup::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: -1;
  box-sizing: border-box;
  border: 1px solid rgba(250, 204, 21, .3);
  border-radius: 7px;
  background: rgba(250, 204, 21, .1);
}

.profile-layout .pl-topup:hover::before,
.profile-layout .pl-topup:focus-visible::before {
  border-color: rgba(250, 204, 21, .55);
  background: rgba(250, 204, 21, .18);
}

.profile-layout .pl-topup:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: 2px;
}
.profile-layout .pl-topup[hidden] { display: none; }
