.header-wallet {
  justify-self: start;
  display: inline-flex;
  min-height: 3.4rem;
  align-items: center;
  gap: 0.62rem;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 0.35rem 0.78rem 0.35rem 0.4rem;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 4.5%), rgb(255 255 255 / 2%)),
    color-mix(in srgb, var(--color-surface-soft) 82%, transparent);
  box-shadow: 0 0.7rem 1.8rem rgb(0 0 0 / 16%);
}

.header-wallet-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  place-items: center;
  border: 2px solid #ffea8f;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe566, #ff9d22);
  box-shadow:
    0 0.5rem 1.1rem rgb(255 174 34 / 18%),
    inset 0 0 0 0.1rem rgb(255 255 255 / 22%);
  color: #663900;
  font-size: 0.76rem;
  font-weight: 900;
}

.header-wallet-copy {
  display: contents;
}

.header-wallet-label {
  display: none;
}

.header-wallet-value {
  font-size: 1rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.account,
.account-content {
  display: grid;
  gap: 1rem;
}

.account {
  width: min(100%, 72rem);
  justify-self: center;
  align-content: start;
  padding-top: clamp(1rem, 3vw, 2rem);
}

.account-content {
  width: 100%;
}

.account-card {
  display: grid;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--color-accent) 28%, var(--color-border));
  padding: 0;
  background:
    radial-gradient(circle at 0 45%, rgb(118 92 255 / 18%), transparent 28rem),
    radial-gradient(circle at 100% 100%, rgb(75 141 255 / 11%), transparent 24rem),
    var(--color-surface);
}

.account-overview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  min-height: 19rem;
  padding: clamp(1.35rem, 4vw, 2.5rem);
}

.account-identity {
  display: contents;
}

.account-avatar {
  position: relative;
  display: grid;
  width: clamp(6rem, 13vw, 8rem);
  height: clamp(6rem, 13vw, 8rem);
  place-items: center;
  overflow: visible;
  border: 2px solid rgb(255 255 255 / 16%);
  border-radius: 2rem;
  background: linear-gradient(145deg, #ff765f, #8a4fff);
  box-shadow: 0 1.2rem 3rem rgb(0 0 0 / 28%);
  color: var(--color-on-accent);
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 850;
}

.account-avatar img,
.account-avatar > [data-account-avatar-fallback] {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.account-avatar img {
  display: block;
  object-fit: cover;
}

.account-avatar > [data-account-avatar-fallback] {
  display: grid;
  place-items: center;
}

.account-avatar-level {
  position: absolute;
  right: -0.25rem;
  bottom: -0.25rem;
  display: grid;
  min-width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border: 3px solid var(--color-surface);
  border-radius: 50%;
  padding-inline: 0.25rem;
  background: #151a35;
  color: var(--color-text);
  font-size: 0.68rem;
  font-weight: 850;
}

.account-identity-copy {
  min-width: 0;
}

.account-identity-copy h3 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(2.25rem, 6vw, 4rem);
  letter-spacing: -0.055em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-progress {
  display: grid;
  grid-column: 1 / -1;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.account-progress-label,
.account-friend-id > span {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.account-progress > span:last-child {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.account-progress progress {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  appearance: none;
  background: rgb(255 255 255 / 9%);
}

.account-progress progress::-webkit-progress-bar {
  border-radius: inherit;
  background: rgb(255 255 255 / 9%);
}

.account-progress progress::-webkit-progress-value {
  border-radius: inherit;
  background: linear-gradient(90deg, #a334ff, var(--color-accent), var(--color-accent-secondary));
  box-shadow: 0 0 0.75rem rgb(118 92 255 / 40%);
}

.account-progress progress::-moz-progress-bar {
  border-radius: inherit;
  background: linear-gradient(90deg, #a334ff, var(--color-accent), var(--color-accent-secondary));
  box-shadow: 0 0 0.75rem rgb(118 92 255 / 40%);
}

.account-card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.2rem;
  background: color-mix(in srgb, var(--color-surface-soft) 78%, transparent);
}

.account-friend-id {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.account-friend-id code {
  max-width: 100%;
  overflow: hidden;
  color: color-mix(in srgb, var(--color-accent-soft) 76%, var(--color-text-muted));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-footer button {
  min-height: 2.75rem;
}

.account-error,
.account > [data-account-loading] {
  width: min(100%, 36rem);
  justify-self: center;
  text-align: center;
}

.account-error {
  border-color: color-mix(in srgb, var(--color-danger) 38%, var(--color-border));
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-weight: 700;
}

@media (max-width: 48rem) {
  .header-wallet {
    min-height: 3.15rem;
    gap: 0.5rem;
    padding: 0.28rem 0.62rem 0.28rem 0.32rem;
  }

  .header-wallet-mark {
    width: 2.1rem;
    height: 2.1rem;
    flex-basis: 2.1rem;
  }

  .header-wallet-value {
    font-size: 0.9rem;
  }

  .account {
    padding-top: 0.75rem;
  }

  .account-overview {
    min-height: 17rem;
  }
}

@media (max-width: 36rem) {
  .account-card {
    border-radius: 1.2rem;
  }

  .account-overview {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1rem;
    min-height: auto;
    padding: 1.25rem 1rem;
    text-align: center;
  }

  .account-avatar {
    width: 6rem;
    height: 6rem;
    border-radius: 1.6rem;
    font-size: 2.35rem;
  }

  .account-identity-copy h3 {
    max-width: 100%;
    font-size: 2.35rem;
  }

  .account-progress {
    width: 100%;
    grid-column: 1;
    text-align: left;
  }

  .account-card-footer {
    grid-template-columns: 1fr;
    padding: 0.9rem;
  }

  .account-card-footer button {
    width: 100%;
  }
}

@media (max-width: 22rem) {
  .header-wallet {
    gap: 0.38rem;
    padding-right: 0.5rem;
  }

  .header-wallet-mark {
    width: 1.95rem;
    height: 1.95rem;
    flex-basis: 1.95rem;
  }

  .account-overview {
    padding: 1rem 0.8rem;
  }
}

/* UX-02 Profile composition using only the canonical account projection. */
[data-view="account"][data-account-profile-experience="ux02"] {
  padding-top: clamp(0.75rem, 2vw, 1.35rem);
}

[data-account-profile-experience="ux02"] .account-card {
  border-radius: 1.5rem;
  box-shadow: 0 1.6rem 4.6rem rgb(0 0 0 / 24%);
}

[data-account-profile-experience="ux02"] .account-overview {
  grid-template-columns: minmax(0, 0.92fr) minmax(19rem, 1.08fr);
  align-items: start;
  gap: 1.25rem;
  min-height: auto;
  padding: clamp(1.25rem, 3.4vw, 2rem);
}

[data-account-profile-experience="ux02"] .account-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

[data-account-profile-experience="ux02"] .account-avatar {
  width: clamp(5.6rem, 11vw, 7rem);
  height: clamp(5.6rem, 11vw, 7rem);
  border-radius: 1.6rem;
}

[data-account-profile-experience="ux02"] .account-identity-copy {
  display: grid;
  gap: 0.4rem;
}

[data-account-profile-experience="ux02"] .account-identity-copy h3 {
  font-size: clamp(1.9rem, 4vw, 3.15rem);
}

[data-account-profile-experience="ux02"] .account-profile-description {
  max-width: 31rem;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

[data-account-profile-experience="ux02"] .account-profile-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
}

[data-account-profile-experience="ux02"] [data-account-profile-metric] {
  display: grid;
  min-width: 0;
  gap: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 0.9rem;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 3.5%), transparent 62%),
    color-mix(in srgb, var(--color-surface-soft) 82%, transparent);
}

[data-account-profile-experience="ux02"] [data-account-profile-metric] dt {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.25;
}

[data-account-profile-experience="ux02"] [data-account-profile-metric] dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-account-profile-experience="ux02"] [data-account-profile-metric] {
  transition: border-color 160ms ease, background-color 160ms ease;
}

[data-account-profile-experience="ux02"] [data-account-profile-metric]:hover {
  border-color: color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
  background:
    linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 62%),
    color-mix(in srgb, var(--color-surface-soft) 88%, transparent);
}

[data-account-profile-experience="ux02"] .account-profile-metrics .account-avatar-level {
  position: static;
  display: block;
  width: auto;
  min-width: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

[data-account-profile-experience="ux02"] .account-progress {
  grid-column: 1 / -1;
  margin-top: 0.1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

[data-account-profile-experience="ux02"] .account-card-footer {
  padding: 0.9rem 1.15rem;
}

@media (max-width: 52rem) {
  [data-account-profile-experience="ux02"] .account-overview {
    grid-template-columns: 1fr;
  }

  [data-account-profile-experience="ux02"] .account-profile-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  [data-account-profile-experience="ux02"] .account-profile-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 34rem) {
  [data-account-profile-experience="ux02"] .account-overview {
    justify-items: stretch;
    text-align: left;
  }

  [data-account-profile-experience="ux02"] .account-identity {
    grid-template-columns: auto minmax(0, 1fr);
  }

  [data-account-profile-experience="ux02"] .account-avatar {
    width: 4.7rem;
    height: 4.7rem;
    border-radius: 1.3rem;
    font-size: 1.9rem;
  }

  [data-account-profile-experience="ux02"] .account-identity-copy h3 {
    font-size: clamp(1.7rem, 9vw, 2.35rem);
  }
}

@media (max-width: 22rem) {
  [data-account-profile-experience="ux02"] .account-overview {
    padding: 0.85rem;
  }

  [data-account-profile-experience="ux02"] .account-identity {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  [data-account-profile-experience="ux02"] .account-profile-description {
    text-align: center;
  }

  [data-account-profile-experience="ux02"] .account-profile-metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-account-profile-experience="ux02"] [data-account-profile-metric] {
    transition: none;
  }
}
