/* TASK 9A: profile / identity / badge wall. Strictly scoped to #view-profile. */

body:has(#view-profile.active),
body:has(#view-profile.active) #app {
  background: #fff;
}

body:has(#view-profile.active) #app {
  gap: 0;
  padding: 0 0 72px;
}

body:has(#view-profile.active) #app > .bg {
  display: none;
}

body:has(#view-profile.active) #main-topbar.plaza-redesign-topbar .plaza-top-publish,
body:has(#view-profile.active) #main-topbar.plaza-redesign-topbar #role-switch {
  display: none !important;
}

#view-profile.plaza-profile {
  width: min(calc(100% - 64px), 1360px);
  margin: 0 auto;
  padding: 0;
  color: #1f2937;
}

#view-profile.plaza-profile.active {
  display: block;
}

#view-profile .plaza-profile-summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 54px 0 46px;
  border-bottom: 1px solid #d9dde5;
}

#view-profile .plaza-profile-avatar-shell {
  position: relative;
  width: 112px;
  height: 112px;
  padding: 3px;
  border: 1px solid #cfd5e1;
  border-radius: 50%;
  background: #fff;
}

#view-profile .plaza-profile-avatar-shell::before,
#view-profile .plaza-profile-avatar-shell::after {
  position: absolute;
  content: '';
  pointer-events: none;
}

#view-profile .plaza-profile-avatar-shell::before {
  top: -4px;
  right: 13px;
  width: 15px;
  height: 1px;
  background: #6570e8;
  transform: rotate(38deg);
}

#view-profile .plaza-profile-avatar-shell::after {
  right: -4px;
  bottom: 17px;
  width: 7px;
  height: 7px;
  border: 1px solid #d49c43;
  transform: rotate(45deg);
}

#view-profile #profile-avatar.big-avatar {
  width: 104px;
  height: 104px;
  border: 0;
  border-radius: 50%;
  background-color: #eef0f7;
  box-shadow: none;
  font-size: 34px;
}

#view-profile .plaza-profile-summary-main {
  min-width: 0;
}

#view-profile .plaza-profile-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

#view-profile .plaza-profile-name-row h1 {
  min-width: 0;
  margin: 0;
  color: #171b24;
  font-size: clamp(28px, 2vw, 34px);
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

#view-profile .plaza-profile-role-chip,
#view-profile .plaza-profile-level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d9ddeb;
  border-radius: 6px;
  color: #535bd8;
  background: #fafaff;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

#view-profile .plaza-profile-level {
  gap: 5px;
  color: #6d7483;
  background: #fff;
}

#view-profile .plaza-profile-level::before {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  content: '';
  transform: rotate(45deg);
}

#view-profile .plaza-profile-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 9px 0 0;
  color: #707889;
  font-size: 14px;
}

#view-profile #profile-rank-label:not([hidden])::before {
  margin-right: 7px;
  color: #a1a8b4;
  content: '·';
}

#view-profile .plaza-profile-bio {
  max-width: 760px;
  margin: 16px 0 0;
  color: #4f5868;
  font-size: 15px;
  line-height: 1.75;
}

#view-profile .plaza-profile-top-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

#view-profile .plaza-profile-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 9px 0 7px;
  border: 1px solid #dce0e8;
  border-radius: 7px;
  color: #4f596b;
  background: #fff;
  font-size: 12px;
  font-weight: 630;
}

#view-profile .plaza-profile-top-badge svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

#view-profile .plaza-profile-top-badge.is-special {
  color: #9a6a1f;
  border-color: #ead9b7;
  background: #fffdf8;
}

#view-profile .plaza-profile-summary-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 20px;
}

#view-profile .plaza-profile-text-action,
#view-profile .plaza-profile-points-link {
  appearance: none;
  padding: 0;
  border: 0;
  color: #535dd9;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

#view-profile .plaza-profile-text-action:hover,
#view-profile .plaza-profile-points-link:hover {
  color: #3d46c4;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#view-profile .plaza-profile-points-link {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: #687284;
  font-weight: 560;
}

#view-profile .plaza-profile-points-link strong {
  color: #333b4a;
  font-size: 14px;
}

#view-profile .plaza-profile-section {
  margin: 0;
  padding: 40px 0 44px;
  border: 0;
  border-bottom: 1px solid #d9dde5;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#view-profile .plaza-profile-section:last-child {
  border-bottom: 0;
}

#view-profile .plaza-profile-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}

#view-profile .plaza-profile-section-head h2 {
  margin: 0;
  color: #202630;
  font-size: 21px;
  font-weight: 690;
  letter-spacing: -0.015em;
}

#view-profile .plaza-profile-section-head > p {
  max-width: 520px;
  margin: 0;
  color: #8a92a0;
  font-size: 12.5px;
  line-height: 1.55;
  text-align: right;
}

#view-profile .plaza-profile-kicker {
  margin: 0 0 5px;
  color: #9199a8;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .16em;
}

#view-profile .profile-edit-grid.plaza-profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 24px;
  max-width: 940px;
}

#view-profile .plaza-profile-field {
  min-width: 0;
  color: #343b49;
  font-size: 14px;
  font-weight: 640;
}

#view-profile .plaza-profile-field input,
#view-profile .plaza-profile-field textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #d5dae3;
  border-radius: 9px;
  color: #252b36;
  background: #fff;
  box-shadow: none;
}

#view-profile .plaza-profile-field input {
  min-height: 42px;
}

#view-profile .plaza-profile-field textarea {
  min-height: 124px;
  resize: vertical;
  line-height: 1.65;
}

#view-profile .plaza-profile-field input:focus,
#view-profile .plaza-profile-field textarea:focus {
  border-color: #7a82e8;
  outline: 2px solid rgba(92, 100, 224, .10);
  outline-offset: 0;
}

#view-profile .plaza-profile-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

#view-profile .plaza-profile-save-row .btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  box-shadow: none;
}

#view-profile .plaza-profile-qualification-list {
  max-width: 940px;
}

#view-profile .plaza-profile-qualification-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid #e2e5eb;
}

#view-profile .plaza-profile-qualification-row:first-child {
  border-top: 0;
  padding-top: 0;
}

#view-profile .plaza-profile-qualification-row:last-child {
  padding-bottom: 0;
}

#view-profile .plaza-profile-qualification-row > div {
  min-width: 0;
}

#view-profile .plaza-profile-row-label {
  display: block;
  margin-bottom: 4px;
  color: #8e96a5;
  font-size: 11px;
  font-weight: 650;
}

#view-profile .plaza-profile-qualification-row strong {
  display: block;
  color: #252c38;
  font-size: 16px;
  font-weight: 680;
}

#view-profile .plaza-profile-qualification-row small {
  display: block;
  margin-top: 6px;
  color: #727b8b;
  font-size: 13px;
  line-height: 1.55;
}

#view-profile .plaza-profile-row-status {
  flex: 0 0 auto;
  color: #7a8291;
  font-size: 12px;
  font-weight: 660;
}

#view-profile .plaza-profile-row-status.is-current,
#view-profile .creator-banner.is-active .plaza-profile-row-status,
#view-profile .creator-banner.is-ready .plaza-profile-row-status {
  color: #575fd8;
}

#view-profile .plaza-profile-badge-head > p strong {
  color: #333b49;
  font-size: 14px;
}

#view-profile .identity-grid.plaza-profile-badge-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #dfe3ea;
  border-left: 1px solid #dfe3ea;
}

#view-profile .identity-card.plaza-badge-item {
  display: flex;
  min-width: 0;
  min-height: 154px;
  margin: 0;
  padding: 23px 16px 18px;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  border: 0;
  border-right: 1px solid #dfe3ea;
  border-bottom: 1px solid #dfe3ea;
  border-radius: 0;
  color: #a2a8b3;
  background: #fff;
  box-shadow: none;
  text-align: left;
  transition: background 150ms ease;
}

#view-profile .identity-card.plaza-badge-item:hover {
  transform: none;
  background: #fbfbfd;
  box-shadow: none;
}

#view-profile .identity-card.plaza-badge-item.owned {
  color: #5962d9;
}

#view-profile .identity-card.plaza-badge-item.is-special.owned {
  color: #a06c1d;
}

#view-profile .plaza-badge-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 0 15px;
  border: 0;
  color: currentColor;
  background: transparent;
  font-size: 0;
}

#view-profile .plaza-badge-icon svg {
  display: block;
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#view-profile .plaza-badge-icon svg .fill {
  fill: currentColor;
  stroke: none;
}

#view-profile .identity-card.plaza-badge-item strong {
  display: block;
  max-width: 100%;
  color: #343b48;
  font-size: 14px;
  font-weight: 670;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#view-profile .identity-card.plaza-badge-item.empty strong {
  color: #7f8794;
}

#view-profile .identity-card.plaza-badge-item small {
  display: block;
  margin-top: 6px;
  color: #959ca8;
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#view-profile .identity-card.plaza-badge-item.owned small {
  color: #747d8c;
}

#view-profile .plaza-profile-unlocked {
  margin-top: 28px;
}

#view-profile .plaza-profile-unlocked h3 {
  margin: 0 0 12px;
  color: #666f7e;
  font-size: 13px;
  font-weight: 660;
}

#view-profile .plaza-profile-unlocked-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

#view-profile .plaza-profile-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #e0e3e8;
  border-radius: 7px;
  color: #939aa6;
  background: #fff;
  font-size: 12px;
}

#view-profile .plaza-profile-locked-badge svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

#view-profile .ability-meter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  max-width: 940px;
  border-top: 1px solid #e0e3e9;
  border-left: 1px solid #e0e3e9;
}

#view-profile .ability-meter-card {
  min-width: 0;
  min-height: 92px;
  padding: 16px;
  border: 0;
  border-right: 1px solid #e0e3e9;
  border-bottom: 1px solid #e0e3e9;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

#view-profile .ability-meter-card small,
#view-profile .ability-meter-card span {
  color: #87909f;
}

#view-profile .ability-meter-card strong {
  color: #343b48;
  font-size: 18px;
}

#view-profile .plaza-profile-section-head-inline {
  align-items: center;
}

#view-profile #profile-invites-list > * {
  border-radius: 0;
  box-shadow: none;
}

#view-profile .plaza-profile-link-list {
  max-width: 940px;
  border-top: 1px solid #e0e3e9;
}

#view-profile .plaza-profile-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid #e0e3e9;
}

#view-profile .plaza-profile-link-row > div {
  min-width: 0;
}

#view-profile .plaza-profile-link-row strong {
  display: block;
  color: #303744;
  font-size: 14px;
}

#view-profile .plaza-profile-link-row small {
  display: block;
  margin-top: 4px;
  color: #89919f;
  font-size: 12px;
}

#view-profile .plaza-profile-publish-preview {
  padding: 0 0 15px;
  border-bottom: 1px solid #e0e3e9;
}

#view-profile #profile-my-publish-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 14px 0 0;
}

#view-profile #profile-my-publish-list li {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 1700px) {
  #view-profile .identity-grid.plaza-profile-badge-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1440px) {
  #view-profile.plaza-profile {
    width: min(calc(100% - 48px), 1280px);
  }

  #view-profile .identity-grid.plaza-profile-badge-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  #view-profile.plaza-profile {
    width: min(calc(100% - 36px), 920px);
  }

  #view-profile .plaza-profile-summary {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 22px;
    padding-top: 38px;
  }

  #view-profile .plaza-profile-avatar-shell {
    width: 92px;
    height: 92px;
  }

  #view-profile #profile-avatar.big-avatar {
    width: 84px;
    height: 84px;
  }

  #view-profile .profile-edit-grid.plaza-profile-form-grid {
    grid-template-columns: 1fr;
  }

  #view-profile .profile-edit-grid.plaza-profile-form-grid .span-2 {
    grid-column: auto;
  }

  #view-profile .ability-meter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  #view-profile.plaza-profile {
    width: min(calc(100% - 28px), 680px);
  }

  #view-profile .plaza-profile-summary {
    grid-template-columns: 1fr;
    align-items: start;
  }

  #view-profile .plaza-profile-section-head {
    display: block;
  }

  #view-profile .plaza-profile-section-head > p {
    margin-top: 8px;
    text-align: left;
  }

  #view-profile .identity-grid.plaza-profile-badge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-profile .plaza-profile-qualification-row,
  #view-profile .plaza-profile-link-row {
    align-items: flex-start;
  }

  #view-profile #profile-my-publish-list {
    grid-template-columns: 1fr;
  }
}

#view-profile .creator-banner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  margin-bottom: 0;
  background: transparent;
  border-color: #e2e5eb;
}

/* ---------- Profile visual refresh：卡片化、收紧留白 ---------- */
body:has(#view-profile.active),
body:has(#view-profile.active) #app {
  background: #f4f6fb !important;
}

#view-profile.plaza-profile {
  width: min(calc(100% - 40px), 1320px);
  padding: 20px 0 56px;
}

#view-profile .plaza-profile-summary {
  position: relative;
  overflow: hidden;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 22px;
  margin: 0 0 18px;
  padding: 28px 28px 24px;
  border: 1px solid #e4e8f0;
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(99, 108, 232, 0.12), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 10px 28px rgba(31, 41, 55, 0.05);
}

#view-profile .plaza-profile-summary::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  content: '';
  background: linear-gradient(90deg, #6b74ef, #8b9cff 55%, #c7d0ff);
}

#view-profile .plaza-profile-avatar-shell {
  width: 96px;
  height: 96px;
  border: 0;
  background: linear-gradient(145deg, #eceffe, #fff);
  box-shadow: 0 0 0 1px #d9def0 inset, 0 8px 18px rgba(83, 93, 217, 0.12);
}

#view-profile #profile-avatar.big-avatar {
  width: 90px;
  height: 90px;
  font-size: 30px;
  background: linear-gradient(145deg, #7b84f0, #5c66df);
  color: #fff;
}

#view-profile .plaza-profile-name-row h1 {
  font-size: clamp(24px, 2vw, 30px);
}

#view-profile #profile-role-text {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid #d7dcf5;
  border-radius: 999px;
  color: #4f58d4;
  background: #f5f6ff;
  font-size: 12px;
  font-weight: 680;
}

#view-profile .plaza-profile-section {
  margin: 0 0 16px;
  padding: 22px 24px 24px;
  border: 1px solid #e4e8f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.04);
}

#view-profile .plaza-profile-section:last-child {
  margin-bottom: 0;
}

#view-profile .plaza-profile-section-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

#view-profile .plaza-profile-section-head h2 {
  font-size: 18px;
}

#view-profile .plaza-profile-section-head > p {
  max-width: 360px;
  color: #8b93a3;
  text-align: right;
}

#view-profile .profile-edit-grid.plaza-profile-form-grid {
  max-width: 720px;
  gap: 16px 18px;
}

#view-profile .plaza-profile-field input,
#view-profile .plaza-profile-field textarea {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fc;
  border-color: #dde2ec;
}

#view-profile .plaza-profile-field input:focus,
#view-profile .plaza-profile-field textarea:focus {
  background: #fff;
}

#view-profile .plaza-profile-qualification-list {
  max-width: none;
  display: grid;
  gap: 12px;
}

#view-profile .plaza-profile-qualification-row {
  padding: 16px 18px;
  border: 1px solid #e7ebf3;
  border-radius: 14px;
  background: #fafbfe;
}

#view-profile .plaza-profile-qualification-row.is-active,
#view-profile .creator-banner.is-active {
  border-color: #cfd6ff;
  background: linear-gradient(180deg, #f7f8ff, #fff);
}

#view-profile .plaza-profile-row-status {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d9dee9;
  background: #fff;
  color: #6b7384;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
}

#view-profile .plaza-profile-row-status.is-current {
  color: #4f58d4;
  border-color: #cfd6ff;
  background: #f0f2ff;
}

#view-profile .identity-grid.plaza-profile-badge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#view-profile .identity-card.plaza-badge-item {
  min-height: 118px;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid #e7ebf3;
  background: #fafbfe;
  box-shadow: none;
}

#view-profile .identity-card.plaza-badge-item:not(.empty) {
  border-color: #cfd6ff;
  background: #fff;
  box-shadow: 0 6px 16px rgba(83, 93, 217, 0.08);
}

#view-profile .plaza-profile-link-list {
  display: grid;
  gap: 10px;
}

#view-profile .plaza-profile-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #e7ebf3;
  border-radius: 14px;
  background: #fafbfe;
}

#view-profile .plaza-profile-link-row small {
  display: block;
  margin-top: 4px;
  color: #8b93a3;
}

#view-profile .plaza-profile-save-row .btn-primary {
  min-width: 112px;
  border: 0;
  background: linear-gradient(135deg, #6b74ef, #535dd9);
}

@media (max-width: 900px) {
  #view-profile .identity-grid.plaza-profile-badge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-profile .plaza-profile-summary {
    grid-template-columns: 80px minmax(0, 1fr);
    padding: 22px 18px;
  }

  #view-profile .plaza-profile-section {
    padding: 18px 16px 20px;
  }

  #view-profile .plaza-profile-section-head {
    flex-direction: column;
    gap: 8px;
  }

  #view-profile .plaza-profile-section-head > p {
    text-align: left;
    max-width: none;
  }
}
