.user-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.user-identity-shell {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.user-identity:hover .user-identity-name,
.user-identity:focus-visible .user-identity-name {
  text-decoration: underline;
}

.user-identity-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: cover;
}

.user-identity-text {
  display: inline-flex;
  min-width: 0;
  flex-direction: column;
}

.user-identity-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity-username {
  overflow: hidden;
  color: #666;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity-badge {
  align-self: flex-start;
  padding: 1px 3px;
  border: 1px solid #777;
  background: #eee;
  font-size: 9px;
  line-height: 1;
}

.profile-window-content {
  overflow: auto;
  padding: 0;
  background: #ece9d8;
  font: 11px Tahoma, sans-serif;
}

.profile-app {
  min-height: 100%;
  padding: 10px;
  box-sizing: border-box;
  color: #000;
}

.profile-state-panel {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 14px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-state-panel[hidden],
.profile-editor[hidden],
.profile-public[hidden] {
  display: none;
}

.profile-public {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  box-sizing: border-box;
}

.profile-public-hero {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.profile-public-avatar {
  width: 80px;
  height: 80px;
  border: 1px solid #777;
  background: #fff;
  object-fit: cover;
}

.profile-public-name {
  margin: 0 0 3px;
  font-size: 18px;
}

.profile-public-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
}

.profile-public-name-row .profile-public-name {
  min-width: 0;
  margin: 0;
}

.profile-public-username {
  margin: 0;
  color: #555;
}

.profile-public-bio {
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
  white-space: pre-wrap;
}

.profile-public-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.profile-public-summary {
  margin: 0;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-public-summary dt {
  color: #555;
}

.profile-public-summary dd {
  margin: 0 0 5px;
  font-weight: 700;
}

.profile-state-panel img {
  object-fit: cover;
  border: 1px solid #7f9db9;
  background: #fff;
}

.profile-state-copy {
  flex: 1;
}

.profile-state-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.profile-state-copy p {
  margin: 0 0 12px;
  line-height: 1.4;
}

.profile-error-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d72323;
  color: #fff;
  font: bold 30px/40px Tahoma, sans-serif;
  text-align: center;
}

.profile-tabs {
  height: 23px;
  padding-left: 7px;
  position: relative;
  z-index: 1;
}

.profile-tab {
  min-width: 66px;
  height: 24px;
  margin: 0;
  border-bottom-color: #ece9d8;
  position: relative;
  top: 1px;
}

.profile-form {
  border: 1px solid #919b9c;
  padding: 10px 9px 8px;
  background: #ece9d8;
}

.profile-group {
  min-width: 0;
  margin: 0 0 9px;
  padding: 9px 10px 10px;
}

.profile-identity-top {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.profile-avatar-column {
  display: flex;
  width: 68px;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.profile-header-holder-badge {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
}

.profile-header-holder-badge[hidden] {
  display: none;
}

.profile-avatar-frame {
  width: 68px;
  height: 68px;
  padding: 1px;
  flex: 0 0 auto;
  border: 1px solid #7f9db9;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #aca899;
  background: #fff;
  box-sizing: border-box;
}

.profile-avatar-frame img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
}

.profile-primary-fields {
  flex: 1;
  min-width: 0;
}

.profile-primary-fields label,
.profile-wide-field {
  display: block;
  margin-bottom: 7px;
}

.profile-primary-fields input,
.profile-wide-field > input,
.profile-wide-field textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  box-sizing: border-box;
  font: 11px Tahoma, sans-serif;
}

.profile-avatar-row {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}

.profile-avatar-row input {
  flex: 1;
  min-width: 0;
}

.profile-avatar-row button {
  white-space: nowrap;
}

.profile-character-count {
  display: block;
  margin-top: 2px;
  text-align: right;
  color: #555;
}

.profile-wallet-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-wallet-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.profile-wallet-address {
  font-family: "Lucida Console", Consolas, monospace;
  overflow-wrap: anywhere;
}

.profile-wallet-state {
  color: #555;
}

.profile-wallet-state--verified {
  color: #087a20;
  font-weight: bold;
}

.profile-wallet-chain,
.profile-wallet-empty {
  color: #555;
}

.profile-account-group {
  position: relative;
  min-height: 56px;
}

.profile-account-rows {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 9px;
  margin: 0 90px 0 0;
}

.profile-account-rows dt,
.profile-account-rows dd {
  margin: 0;
}

.profile-account-rows dd {
  overflow-wrap: anywhere;
}

.profile-account-group > button {
  position: absolute;
  right: 10px;
  top: 18px;
}

.profile-feedback {
  min-height: 15px;
  margin: 1px 2px 6px;
  color: #555;
}

.profile-feedback--success {
  color: #087a20;
}

.profile-feedback--warning {
  color: #805400;
}

.profile-feedback--error {
  color: #b00000;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.profile-actions button {
  min-width: 72px;
}

@media (max-width: 480px) {
  .profile-app {
    padding: 6px;
  }

  .profile-identity-top {
    gap: 7px;
  }

  .profile-account-rows {
    margin-right: 0;
    padding-bottom: 34px;
  }

  .profile-account-group > button {
    top: auto;
    bottom: 8px;
  }
}

/* ---------------------------------------------------------------------------
   Profile redesign, Phase 1 — X handle, member number, shareable link.
   --------------------------------------------------------------------------- */

/* The '@' is rendered as a fixed prefix rather than typed into the field, so
   the stored value stays canonical (no '@') no matter what the user pastes. */
.profile-handle-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-handle-prefix {
  color: #555;
  font-weight: 700;
}

.profile-handle-row input {
  min-width: 0;
  flex: 1 1 auto;
}

.profile-handle-open {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* The permanent membership badge. Read-only by nature: there is no input
   here because the number is not editable by anyone. */
.profile-member-number {
  margin: 6px 0 0;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-member-number[hidden] {
  display: none;
}

.profile-public-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.profile-public-link[hidden] {
  display: none;
}

.profile-public-link-label {
  color: #555;
}

.profile-public-link-url {
  font-family: "Lucida Console", Consolas, monospace;
  overflow-wrap: anywhere;
}

.profile-copy-link {
  flex: 0 0 auto;
}

/* Public read-only view. */
.profile-public-handle {
  display: inline-block;
  margin: 0 0 3px;
  color: #0a246a;
}

.profile-public-status {
  margin: 0;
  color: #555;
}

.profile-public-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-public-wallet {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-public-wallet-label {
  color: #555;
  font-weight: 700;
}

/* ── Holder section ────────────────────────────────────────────────────────
   Compact, read-only, and deliberately WITHOUT progress bars: a supply share
   is not progress toward anything, and a bar would imply a next tier the user
   is working toward. Standard XP inset panel, same chrome as the wallet block
   above it, so the section reads as part of the window rather than a widget
   bolted onto it. */
.profile-holder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-holder-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
}

/* Two-column definition list: label left, value right. The value column takes
   the remaining width so a long holdings line wraps under itself rather than
   pushing the labels out of alignment. */
.profile-holder-rows {
  display: grid;
  margin: 0;
  gap: 2px 10px;
  grid-template-columns: auto 1fr;
}

.profile-holder-rows dt {
  color: #555;
  white-space: nowrap;
}

.profile-holder-rows dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* The unavailable state. Muted and italic so it reads as an absence at a
   glance and cannot be mistaken for a real figure — particularly not for a
   zero holding, which is a different fact entirely. */
.profile-holder-unavailable {
  color: #777;
  font-style: italic;
}

/* The test-asset disclaimer. Present until the real $XP contract ships. */
.profile-holder-note {
  margin: 0;
  color: #777;
  font-size: 10px;
}

/* ---------------------------------------------------------------------------
   Profile Phase 3 — combined public model + EXPERIENCE Rank.
   --------------------------------------------------------------------------- */

.profile-data-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.85fr);
  gap: 8px;
  align-items: stretch;
}

.profile-ranks {
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-ranks-title {
  margin: 0 0 6px;
  font-size: 11px;
}

.profile-rank-rows {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 0;
}

.profile-rank-rows dt {
  color: #555;
}

.profile-rank-rows dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-rank-unavailable {
  color: #777;
  font-style: italic;
}

.profile-public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.profile-public-actions button {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .profile-data-sections {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Profile v2 — public view additions, the React owner editor, and the
   pre-login public profile gateway.
   --------------------------------------------------------------------------- */

/* The XP "User not found" / "Profile unavailable" panels inside a window. */
.profile-window-content > .profile-state-panel {
  margin: 12px;
}

.profile-state-panel--notice img {
  border: 0;
  background: transparent;
}

.profile-state-copy .profile-state-hint {
  color: #555;
}

.profile-public-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.profile-public-facts p {
  margin: 0;
}

.profile-public-joined {
  color: #555;
}

.profile-public-wallet .profile-wallet-row {
  flex-wrap: wrap;
  align-items: center;
}

.profile-public-links {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-public-link-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

.profile-public-link-row dt {
  color: #555;
  font-weight: 700;
}

.profile-public-link-row dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-public-links a,
.profile-public-link-url {
  color: #0a246a;
}

.profile-public-forum {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px;
  border: 1px solid #aca899;
  background: #fff;
}

.profile-edit-button {
  font-weight: 700;
}

/* The owner editor. */
.profile-tab--active {
  background: #fcfcfe;
  font-weight: 700;
}

.profile-form [role="tabpanel"][hidden] {
  display: none;
}

.profile-editor-v2 .profile-wide-field {
  margin: 7px 0 0;
}

.profile-editor-v2 .profile-group > input,
.profile-editor-v2 .profile-group > textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  box-sizing: border-box;
  font: 11px Tahoma, sans-serif;
}

.profile-editor-v2 .profile-handle-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
}

.profile-editor-v2 .profile-handle-row input {
  flex: 1 1 auto;
  min-width: 0;
  font: 11px Tahoma, sans-serif;
}

.profile-editor-v2 input[aria-invalid="true"],
.profile-editor-v2 textarea[aria-invalid="true"] {
  border-color: #b00000;
  background: #fff5f5;
}

.profile-field-error {
  display: block;
  margin-top: 2px;
  color: #b00000;
}

.profile-field-hint {
  display: block;
  margin-top: 2px;
  color: #555;
}

.profile-picture-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.profile-picture-controls {
  flex: 1;
  min-width: 0;
}

.profile-picture-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.profile-picture-hint {
  margin: 6px 0 0;
  color: #555;
  line-height: 1.35;
}

.profile-picture-controls .profile-feedback {
  margin: 4px 0 0;
}

/* Visually hidden but still a real file input the buttons can open. */
.profile-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.profile-account-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.profile-editor-v2 .profile-account-rows {
  margin-right: 0;
}

.profile-data-mount {
  margin: 0 0 9px;
}

/* XP-style progress: a sunken track filled with green blocks. */
.profile-save-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 2px 6px;
}

.profile-save-progress-track {
  flex: 0 0 160px;
  height: 14px;
  padding: 1px;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  background: #fff;
  box-sizing: border-box;
  overflow: hidden;
}

.profile-save-progress-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    #2fb32f 0 8px,
    transparent 8px 10px
  );
  transition: width 0.25s ease-out;
}

/* The pre-login public profile gateway: an XP window above the login
   screen (#xp-login is 15000, the wallet picker 15100, the boot screen
   16000 — the gateway only exists while the login screen is up). */
.xp-public-profile {
  position: fixed;
  inset: 0;
  z-index: 15500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.35);
}

.xp-public-profile__window {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100% - 16px);
}

.xp-public-profile__window:focus {
  outline: none;
}

.xp-public-profile__window .title-bar-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

.xp-public-profile__body {
  flex: 1 1 auto;
  min-height: 160px;
  margin: 0;
  overflow: auto;
}

.xp-public-profile__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 7px 10px;
  border-top: 1px solid #aca899;
  background: #ece9d8;
  font: 11px Tahoma, sans-serif;
}

.xp-public-profile__footer button {
  min-width: 120px;
  font-weight: 700;
}

@media (max-width: 480px) {
  .xp-public-profile {
    padding: 0;
  }

  .xp-public-profile__window {
    width: 100%;
    height: 100%;
    max-height: none;
  }

  .profile-picture-row {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-picture-row .profile-avatar-column {
    flex-direction: row;
    width: auto;
  }

  .profile-public-link-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .profile-window-content button,
  .xp-public-profile__footer button {
    min-height: 32px;
  }

  .profile-editor-v2 .profile-group > input,
  .profile-editor-v2 .profile-group > textarea,
  .profile-editor-v2 .profile-handle-row input {
    font-size: 16px;
  }
}
