:root {
  --profile-bg: #e6e2da;
  --profile-text: #141210;
  --profile-muted: #5e594f;
  --profile-card-bg: #faf8f4;
  --profile-card-border: #c9c2b6;
  --profile-card-shadow: 0 14px 32px rgba(20, 18, 16, 0.08);
  --profile-subcard-bg: #f3f0ea;
  --profile-subcard-border: #c9c2b6;
  --profile-primary: #a63b00;
  --profile-primary-solid: #a63b00;
  --profile-primary-text: #ffffff;
  --profile-secondary-bg: #ebe6dd;
  --profile-secondary-text: #3a3028;
  --profile-danger: #b42318;
}

.my-profile-page {
  --tg-surface: #faf8f4;
  --tg-surface-soft: #f3f0ea;
  --tg-border: #c9c2b6;
  --tg-title: #141210;
}

.my-profile-page .profile-layout {
  max-width: 760px;
  padding-top: 8px;
}

.my-profile-page .tg-topbar {
  position: static;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  margin-bottom: 8px;
}

.my-profile-page .tg-topbar h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--tg-title);
}

.my-profile-page .tg-profile-head {
  border-radius: 18px;
  background: var(--tg-surface);
  border: 1px solid var(--tg-border);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(32, 44, 76, 0.07);
}

.my-profile-page .tg-avatar {
  width: 88px;
  height: 88px;
  margin: 0;
  border-radius: 50%;
  font-size: 34px;
}

.my-profile-page .tg-name-wrap {
  margin-top: 10px;
  min-width: 0;
}

.my-profile-page .tg-name-row {
  font-size: clamp(22px, 4vw, 30px);
}

.my-profile-page .tg-username-line {
  margin-top: 4px;
  font-size: 14px;
  color: #7384a8;
}

.my-profile-page .tg-bio-preview {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: #34415f;
  word-break: break-word;
}

.my-profile-page .tg-chips {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.my-profile-page .tg-chip {
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-profile-page .tg-card {
  margin-top: 10px;
  border-radius: 16px;
  background: var(--tg-surface);
  border-color: var(--tg-border);
}

.my-profile-page .tg-block-title {
  font-size: 14px;
  color: #63759b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.my-profile-page .tg-edit-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.my-profile-page .tg-actions {
  margin-top: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.my-profile-page .tg-list {
  gap: 6px;
}

.my-profile-page .tg-list-item,
.my-profile-page .profile-tag-button {
  border-radius: 10px;
}

.my-profile-page .profile-tag-list {
  display: grid;
  gap: 6px;
}

.my-profile-page .profile-tag-button {
  width: 100%;
  text-align: left;
  min-height: 42px;
  padding: 0 12px;
  background: var(--tg-surface-soft);
  border-color: #dbe4f5;
}

.my-profile-page .profile-empty {
  padding: 8px 2px;
}

.profile-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  margin: 0;
  background: var(--profile-bg);
  color: var(--profile-text);
  font-family: var(--font-body, "Inter", "Segoe UI", Roboto, Arial, sans-serif);
  overflow-y: auto;
  overflow-x: hidden;
}

.profile-layout {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px 34px;
}

.profile-dashboard {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
}

.profile-card-main {
  grid-column: 1 / 2;
}

.profile-card-side {
  grid-column: 2 / 3;
}

.profile-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
}

.profile-topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--profile-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-top-meta {
  font-size: 12px;
  color: var(--profile-muted);
  margin-bottom: 2px;
}

.icon-btn.profile-back {
  flex-shrink: 0;
}

.profile-shell .icon-btn {
  border: 1px solid var(--profile-card-border);
  background: rgba(255, 255, 255, 0.8);
  color: #3a4f86;
}

.profile-shell .icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-shell .icon-btn:hover {
  background: #f0f5ff;
}

.profile-menu-anchor {
  margin-left: auto;
  position: relative;
}

.profile-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--profile-card-border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(28, 51, 103, 0.2);
}

.profile-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #ebeff9;
  background: transparent;
  color: #213058;
  font-size: 14px;
  padding: 11px 13px;
  cursor: pointer;
}

.profile-menu-item:last-child {
  border-bottom: 0;
}

.profile-menu-item:hover {
  background: var(--bg-hover, #ebe6dd);
}

.profile-hero {
  margin-top: 4px;
  padding: 18px 18px 18px;
  border-radius: 28px;
  background: var(--bg-card, #faf8f4);
  border: 1px solid var(--border, #c9c2b6);
  display: grid;
  gap: 12px;
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border, #c9c2b6);
  background: var(--bg-hover, #ebe6dd);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #141210);
}

.profile-chip-orbs img {
  width: 14px;
  height: 14px;
}

.profile-avatar-big {
  width: 118px;
  height: 118px;
  margin: 0 auto 14px;
  border-radius: 32px;
  border: 1px solid var(--border, #c9c2b6);
  box-shadow: none;
  background-color: var(--bg-hover, #ebe6dd);
  color: var(--text-primary, #141210);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  line-height: 1;
}

.profile-avatar-big svg {
  width: 56%;
  height: 56%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-avatar-big.profile-avatar-img {
  background-size: cover;
  background-position: center;
  font-size: 0;
}

.profile-avatar-big.profile-avatar-fallback {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.profile-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary, #141210);
}

.profile-title-row .verified-check--before,
.profile-title-row .verified-check-slot.verified-check--before {
  margin: 0 2px 0 0;
}

.profile-title-row .verified-check--after,
.profile-title-row .verified-check-slot.verified-check--after {
  margin: 0 0 0 2px;
}

.verified-check-placeholder {
  display: none !important;
}

.verified-check,
.profile-title-row .verified-check,
.profile-title-row .verified-check-slot {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.profile-title-row .verified-check {
  width: auto;
  height: auto;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
  margin: 0;
  font-size: 12px;
  line-height: 1;
  color: #7ad4ff;
}

.profile-title-row .verified-check.verified-check-team {
  width: var(--badge-lg-team);
  height: var(--badge-lg-team);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/Hi! Team Verify.svg");
}

.profile-title-row .verified-check.verified-check-verify {
  width: var(--badge-lg-verify);
  height: var(--badge-lg-verify);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/VerifyIcon.svg");
}

.profile-title-row .verified-check.verified-check-premium,
.profile-title-row .verified-check.verified-check-hi-plus {
  width: var(--badge-lg-plus);
  height: var(--badge-lg-plus);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/Hi! Plus icon.svg");
}

.profile-title-row .verified-check.verified-check-tester {
  width: var(--badge-lg-tester);
  height: var(--badge-lg-tester);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/Tester Icon.svg");
}

.profile-title-row .verified-check.verified-check-scam {
  width: var(--badge-lg-scam-w);
  height: var(--badge-lg-scam-h);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/SCAM-BADGE.svg");
}

.profile-title-row .verified-check.verified-check-fake {
  width: var(--badge-lg-fake-w);
  height: var(--badge-lg-fake-h);
  transform: translateY(2px);
  font-size: 0;
  color: transparent;
  background: center / contain no-repeat url("/static/img/FAKE-BADGE.svg");
}

.profile-sub {
  margin-top: 4px;
  color: #5f6f93;
  font-size: 14px;
}

.profile-card {
  margin: 0;
  padding: 16px;
  background: var(--profile-card-bg);
  border: 1px solid var(--profile-card-border);
  border-radius: 18px;
  box-shadow: var(--profile-card-shadow);
}

.profile-handle,
.profile-my-verified {
  margin: 0 0 9px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5f96;
}

.profile-bio {
  margin: 0;
  color: #1e2a49;
  font-size: 17px;
  line-height: 1.45;
}

.profile-stats {
  margin: 16px 0 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-stat {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--profile-subcard-border);
  background: var(--profile-subcard-bg);
}

.profile-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #21386d;
}

.profile-stat-label {
  margin-top: 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7082aa;
}

.profile-section-title {
  margin: 8px 0 10px;
  color: #5f7198;
  font-size: 13px;
  font-weight: 700;
}

.profile-block-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: #2a3f71;
}

.profile-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--profile-muted);
}

.profile-list-wrap {
  display: grid;
  gap: 8px;
}

.profile-list-item {
  border: 1px solid var(--profile-subcard-border);
  border-radius: 12px;
  background: var(--profile-subcard-bg);
  padding: 9px 10px;
  font-size: 13px;
  color: #233c73;
}

.profile-item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--profile-muted);
}

.profile-empty {
  font-size: 12px;
  color: var(--profile-muted);
}

.profile-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tag-button {
  min-height: 34px;
  border: 1px solid #d9e4ff;
  background: var(--profile-secondary-bg);
  color: var(--profile-secondary-text);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.profile-members {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 250px;
  overflow-y: auto;
}

.profile-members li {
  margin-bottom: 7px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--profile-subcard-border);
  background: var(--profile-subcard-bg);
  font-size: 14px;
  color: #223964;
}

.profile-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-actions button,
.profile-row-actions button {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.profile-actions button:not(.secondary),
.profile-row-actions button:not(.secondary) {
  background: var(--profile-primary);
  color: var(--profile-primary-text);
  box-shadow: 0 9px 20px rgba(79, 125, 255, 0.3);
}

.profile-actions button.secondary,
.profile-row-actions button.secondary {
  background: var(--profile-secondary-bg);
  color: var(--profile-secondary-text);
  border: 1px solid #d9e4ff;
}

.profile-error {
  margin-top: 10px;
  color: var(--profile-danger);
  font-size: 14px;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-edit-field-full {
  grid-column: 1 / -1;
}

.profile-edit-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6378a9;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.profile-edit-field input,
.profile-edit-field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #dbe4ff;
  background: #f7f9ff;
  color: #1c2b50;
  font-size: 14px;
  font-family: inherit;
}

.profile-edit-field input[readonly],
.profile-edit-field input:disabled {
  background: #edf2ff;
  color: #7083ad;
}

.profile-edit-field textarea {
  resize: vertical;
  min-height: 84px;
}

.profile-row-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hidden-file {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

body.embed-panel.profile-shell {
  min-height: 100%;
  height: 100%;
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
}

body.embed-panel.profile-shell .profile-layout {
  max-width: none;
  padding: 10px 14px 18px;
}

body.embed-panel.profile-shell .profile-topbar {
  position: static;
  padding: 8px 0 12px;
}

body.embed-panel.profile-shell .profile-back,
body.embed-panel.profile-shell .mobile-bottom-nav {
  display: none !important;
}

@media (max-width: 860px) {
  .profile-layout {
    padding: 0 12px 24px;
  }

  .profile-dashboard {
    grid-template-columns: 1fr;
  }

  .profile-card-main,
  .profile-card-side {
    grid-column: 1 / -1;
  }

  .profile-topbar {
    padding: 12px 0;
  }

  .profile-topbar h1 {
    font-size: 20px;
  }

  .profile-hero {
    border-radius: 24px;
    padding: 14px 10px 14px;
  }

  .profile-hero-main {
    align-items: flex-start;
  }

  .profile-avatar-big {
    width: 98px;
    height: 98px;
    border-radius: 24px;
    font-size: 34px;
  }

  .profile-title-row {
    font-size: 28px;
  }

  .profile-card {
    border-radius: 18px;
    padding: 14px;
  }

  .profile-bio {
    font-size: 15px;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .profile-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-row-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .profile-edit-field-full {
    grid-column: 1;
  }
}

@media (max-width: 560px) {
  .my-profile-page .tg-actions {
    grid-template-columns: 1fr;
  }

  .my-profile-page .tg-avatar {
    width: 76px;
    height: 76px;
  }

  .my-profile-page .tg-name-row {
    font-size: 24px;
  }
}

@media (max-width: 460px) {
  .profile-actions,
  .profile-row-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) and (hover: none), (max-width: 768px) and (pointer: coarse) {
  .profile-layout {
    padding-bottom: 98px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-radius: 999px;
    padding: 5px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #d8e3ff;
    box-shadow: var(--rd-tabbar-shadow, 0 12px 28px rgba(40, 64, 130, 0.2), var(--rd-btn-bevel));
    z-index: 60;
  }

  .mobile-bottom-nav button:not(.active) {
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #5b6690;
    min-height: 58px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 999px;
    line-height: 1.1;
  }

  .mobile-bottom-nav button img {
    width: 18px;
    height: 18px;
  }

  .mobile-bottom-nav button .nav-label {
    white-space: nowrap;
  }

  .mobile-bottom-nav button.active {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 58px;
    font-size: 12px;
    border-radius: 999px;
    line-height: 1.1;
    background: color-mix(in srgb, var(--rd-nav-active, var(--bg-active, #e0d9ce)) 92%, transparent);
    color: var(--accent, #a63b00);
    font-weight: 700;
    box-shadow:
      var(--rd-btn-bevel, inset 0 1px 0 rgba(255, 255, 255, 0.14)),
      inset 0 0 0 1px color-mix(in srgb, var(--rd-border, #d8e3ff) 35%, transparent);
  }
}

@media (hover: hover) and (pointer: fine) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

body[data-theme="dark"].profile-shell,
body[data-theme="midnight"].profile-shell,
body[data-theme="graphite"].profile-shell {
  --profile-bg: #0f0d0b;
  --profile-text: #f2ede6;
  --profile-muted: #9a9288;
  --profile-card-bg: #1a1714;
  --profile-card-border: #3d3832;
  --profile-card-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
  --profile-subcard-bg: #141210;
  --profile-subcard-border: #3d3832;
  --profile-primary: #e0702c;
  --profile-secondary-bg: #252220;
  --profile-secondary-text: #e8e2da;
  --profile-danger: #f09090;
}

body[data-theme="graphite"].profile-shell {
  --profile-bg: #111214;
  --profile-text: #eceff4;
  --profile-muted: #8f96a3;
  --profile-card-bg: #1c1f24;
  --profile-card-border: #3a3f47;
  --profile-subcard-bg: #15171a;
  --profile-subcard-border: #3a3f47;
  --profile-primary: #c9a227;
  --profile-secondary-bg: #25282e;
  --profile-secondary-text: #dce0e8;
}

body[data-theme="dark"].profile-shell .icon-btn,
body[data-theme="midnight"].profile-shell .icon-btn,
body[data-theme="graphite"].profile-shell .icon-btn {
  background: var(--bg-hover, #252220);
  color: var(--text-primary, #f2ede6);
}

body[data-theme="dark"].my-profile-page,
body[data-theme="midnight"].my-profile-page,
body[data-theme="graphite"].my-profile-page {
  --tg-surface: #1a1714;
  --tg-surface-soft: #252220;
  --tg-border: #3d3832;
  --tg-title: #f2ede6;
}

body[data-theme="graphite"].my-profile-page {
  --tg-surface: #1c1f24;
  --tg-surface-soft: #25282e;
  --tg-border: #3a3f47;
  --tg-title: #eceff4;
}

body[data-theme="dark"].my-profile-page .tg-username-line,
body[data-theme="midnight"].my-profile-page .tg-username-line,
body[data-theme="graphite"].my-profile-page .tg-username-line {
  color: var(--text-muted, #9a9288);
}

body[data-theme="dark"].my-profile-page .tg-bio-preview,
body[data-theme="midnight"].my-profile-page .tg-bio-preview,
body[data-theme="graphite"].my-profile-page .tg-bio-preview {
  color: var(--text-secondary, #d4cdc4);
}

body[data-theme="dark"].profile-shell .profile-chip,
body[data-theme="midnight"].profile-shell .profile-chip,
body[data-theme="graphite"].profile-shell .profile-chip {
  background: #252220;
  color: #f2ede6;
  border-color: #3d3832;
}

body[data-theme="graphite"].profile-shell .profile-chip {
  background: #25282e;
  color: #eceff4;
  border-color: #3a3f47;
}

body[data-theme="dark"].profile-shell .profile-title-row,
body[data-theme="midnight"].profile-shell .profile-title-row,
body[data-theme="graphite"].profile-shell .profile-title-row,
body[data-theme="dark"].profile-shell .profile-bio,
body[data-theme="midnight"].profile-shell .profile-bio,
body[data-theme="graphite"].profile-shell .profile-bio,
body[data-theme="dark"].profile-shell .profile-stat-value,
body[data-theme="midnight"].profile-shell .profile-stat-value,
body[data-theme="graphite"].profile-shell .profile-stat-value,
body[data-theme="dark"].profile-shell .profile-members li,
body[data-theme="midnight"].profile-shell .profile-members li,
body[data-theme="graphite"].profile-shell .profile-members li {
  color: var(--profile-text, #f2ede6);
}

body[data-theme="dark"].profile-shell .mobile-bottom-nav,
body[data-theme="midnight"].profile-shell .mobile-bottom-nav,
body[data-theme="graphite"].profile-shell .mobile-bottom-nav {
  background: var(--profile-card-bg, #1a1714);
  border-color: var(--profile-card-border, #3d3832);
}

body[data-theme="dark"].profile-shell .mobile-bottom-nav button,
body[data-theme="midnight"].profile-shell .mobile-bottom-nav button,
body[data-theme="graphite"].profile-shell .mobile-bottom-nav button {
  color: var(--profile-muted, #9a9288);
}

body[data-theme="dark"].profile-shell .mobile-bottom-nav button.active,
body[data-theme="midnight"].profile-shell .mobile-bottom-nav button.active,
body[data-theme="graphite"].profile-shell .mobile-bottom-nav button.active {
  background: color-mix(
    in srgb,
    var(--rd-nav-active, var(--profile-secondary-bg, #252220)) 88%,
    transparent
  );
  color: var(--profile-primary, #e0702c);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--profile-card-border, #3d3832) 45%, transparent);
}
