.profile-screen {
  min-height: calc(100vh - var(--header-height));
  color: #eceae4;
  background:
    radial-gradient(circle at 77% 14%, rgba(51, 101, 112, 0.13), transparent 31%),
    linear-gradient(rgba(24, 24, 22, 0.26), rgba(27, 27, 24, 0.52));
}

.profile-shell {
  width: min(1540px, calc(100% - (2 * var(--page-gutter))));
  margin: 0 auto;
  padding: 30px 0 72px;
}

.profile-page-header {
  min-height: 78px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-kicker {
  color: rgba(158, 196, 205, 0.72);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.profile-page-header h1 {
  margin: 1px 0 0;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 0.065em;
}

.profile-page-header p {
  margin: 3px 0 0;
  color: rgba(236, 234, 227, 0.4);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.profile-search {
  width: min(330px, 36vw);
  height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 18, 17, 0.72);
}

.profile-search img {
  width: 15px;
  margin: 0 10px;
  opacity: 0.55;
}

.profile-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.profile-search button {
  align-self: stretch;
  padding: 0 15px;
  background: rgba(94, 133, 52, 0.9);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.profile-search-results {
  position: relative;
  z-index: 3;
  width: min(520px, 100%);
  display: grid;
  gap: 2px;
  margin: 8px 0 0 auto;
  padding: 5px;
  background: rgba(22, 23, 21, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.profile-search-result {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
}

.profile-search-result:hover { background: rgba(94, 145, 160, 0.18); }
.profile-result-copy { min-width: 0; display: grid; }
.profile-result-copy strong { font-size: 12px; }
.profile-result-copy small { color: rgba(236, 234, 227, 0.42); font-size: 8px; letter-spacing: 0.06em; }

.player-profile-header {
  min-height: 178px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-top: 18px;
  padding: 20px 24px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-top-color: rgba(125, 185, 202, 0.4);
  background: linear-gradient(120deg, rgba(48, 52, 50, 0.91), rgba(27, 29, 28, 0.9));
}

.profile-avatar-button {
  position: relative;
  width: 126px;
  height: 126px;
  padding: 0;
  background: rgba(8, 9, 9, 0.35);
}

.profile-avatar-button.is-editable { cursor: pointer; }
.profile-avatar-button.is-editable:hover .profile-avatar-edit { opacity: 1; }

.profile-avatar,
.profile-result-avatar,
.friend-avatar,
.player-account-avatar {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  background: linear-gradient(145deg, #536066, #252927);
  color: rgba(237, 241, 240, 0.74);
}

.profile-avatar { width: 100%; height: 100%; }
.profile-result-avatar,
.friend-avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.player-account-avatar { width: 31px; height: 31px; }

.profile-avatar.is-online,
.profile-result-avatar.is-online,
.friend-avatar.is-online,
.player-account-avatar.is-online {
  box-shadow: 0 0 0 3px #63b85f;
}

.profile-avatar.is-offline,
.profile-result-avatar.is-offline,
.friend-avatar.is-offline,
.player-account-avatar.is-offline {
  box-shadow: 0 0 0 3px #70736f;
}

.profile-result-avatar.is-online,
.friend-avatar.is-online,
.player-account-avatar.is-online,
.profile-result-avatar.is-offline,
.friend-avatar.is-offline,
.player-account-avatar.is-offline {
  box-shadow: 0 0 0 2px currentColor;
}

.profile-result-avatar.is-online,
.friend-avatar.is-online,
.player-account-avatar.is-online { color: #63b85f; }
.profile-result-avatar.is-offline,
.friend-avatar.is-offline,
.player-account-avatar.is-offline { color: #70736f; }

.profile-avatar img,
.profile-result-avatar img,
.friend-avatar img,
.player-account-avatar img {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-fallback {
  position: relative;
  z-index: 1;
  font-size: 38px;
  font-weight: 300;
}

.profile-result-avatar .profile-avatar-fallback,
.friend-avatar .profile-avatar-fallback,
.player-account-avatar .profile-avatar-fallback { font-size: 16px; }

.profile-avatar-edit {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 3px;
  left: 0;
  padding: 7px 0 5px;
  opacity: 0;
  background: rgba(11, 12, 11, 0.82);
  font-size: 9px;
  letter-spacing: 0.1em;
  transition: opacity 100ms ease;
}

.profile-identity { min-width: 0; }
.profile-identity h2 { margin: 0; overflow: hidden; font-size: 30px; font-weight: 400; letter-spacing: 0.035em; text-overflow: ellipsis; }
.profile-identity p { min-height: 17px; margin: 4px 0 4px; color: rgba(237, 235, 228, 0.52); font-size: 11px; }
.profile-last-online { display: block; margin-bottom: 13px; color: rgba(237, 235, 228, 0.34); font-size: 8px; letter-spacing: 0.045em; }
.profile-stats { display: flex; gap: 22px; }
.profile-stats > span { display: grid; color: rgba(237, 235, 228, 0.4); font-size: 8px; letter-spacing: 0.09em; }
.profile-stats strong { color: #e9e8e1; font-size: 17px; font-weight: 500; line-height: 18px; }
.profile-actions { display: flex; align-self: flex-end; gap: 7px; padding-bottom: 2px; }

.profile-primary,
.profile-secondary,
.friend-action,
.profile-item-action,
.username-submit,
.quick-sell-confirm,
.quick-sell-cancel {
  min-height: 35px;
  padding: 0 17px;
  background: #658d35;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.profile-secondary,
.quick-sell-cancel { background: #3a3b38; color: rgba(243, 241, 234, 0.72); }

.profile-editor {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 0;
  background: rgba(25, 26, 24, 0.92);
}

.profile-editor label { display: grid; gap: 4px; }
.profile-editor label span { color: rgba(237, 235, 228, 0.42); font-size: 8px; letter-spacing: 0.09em; }
.profile-editor input { height: 34px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.11); outline: 0; background: rgba(0, 0, 0, 0.2); font-size: 11px; }

.profile-section {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(28, 29, 27, 0.83);
}

.profile-section-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  background: rgba(14, 15, 14, 0.24);
}

.profile-section-heading h2 { margin: 0; font-size: 15px; letter-spacing: 0.055em; }
.profile-section-heading span { color: rgba(236, 234, 227, 0.38); font-size: 8px; letter-spacing: 0.09em; }
.profile-showcase-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 8px; }

.profile-item-card,
.profile-showcase-empty {
  position: relative;
  min-width: 0;
  min-height: 166px;
  display: grid;
  overflow: hidden;
  grid-template-rows: 112px 1fr;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-bottom: 3px solid var(--profile-rarity, rgba(255, 255, 255, 0.08));
  background: linear-gradient(145deg, rgba(111, 112, 108, 0.72), rgba(62, 63, 60, 0.8));
}

.profile-item-card { cursor: context-menu; outline: 0; }
.profile-item-card:hover,
.profile-item-card:focus-visible { filter: brightness(1.07); }
.profile-item-card > img { width: 100%; height: 112px; padding: 7px; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.34)); }
.profile-item-card > div { min-width: 0; display: grid; align-content: start; padding: 7px 8px 5px; background: rgba(18, 19, 18, 0.34); }
.profile-item-card strong,
.profile-item-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-item-card strong { font-size: 11px; }
.profile-item-card span { color: rgba(238, 236, 229, 0.55); font-size: 9px; }
.profile-item-action { position: absolute; right: 5px; bottom: 5px; min-height: 23px; padding: 0 8px; opacity: 0; font-size: 7px; }
.profile-item-card:hover .profile-item-action,
.profile-item-action:focus-visible { opacity: 1; }

.profile-showcase-empty { place-items: center; align-content: center; grid-template-rows: auto auto; border-bottom-color: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.025); text-align: center; }
.profile-showcase-empty span { color: rgba(238, 236, 229, 0.36); font-size: 10px; letter-spacing: 0.09em; }
.profile-showcase-empty small { max-width: 130px; margin-top: 5px; color: rgba(238, 236, 229, 0.2); font-size: 7px; line-height: 9px; letter-spacing: 0.05em; }
.profile-empty,
.profile-loading { padding: 58px 16px; color: rgba(238, 236, 229, 0.38); font-size: 10px; text-align: center; letter-spacing: 0.09em; }

.friend-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px; }
.friend-group { min-width: 0; padding: 9px; background: rgba(255, 255, 255, 0.025); }
.friend-group h3 { margin: 0 0 7px; color: rgba(236, 234, 227, 0.55); font-size: 9px; letter-spacing: 0.1em; }
.friend-group > p { margin: 18px 0; color: rgba(236, 234, 227, 0.24); font-size: 8px; text-align: center; }
.friend-row { min-height: 47px; display: flex; align-items: center; gap: 4px; margin-top: 3px; background: rgba(255, 255, 255, 0.035); }
.friend-view { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px; text-align: left; background: transparent; }
.friend-view > span:last-child { min-width: 0; display: grid; }
.friend-view strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.friend-view small { color: rgba(236, 234, 227, 0.35); font-size: 7px; }
.friend-action { min-height: 27px; padding: 0 8px; margin-right: 4px; font-size: 7px; }

.username-root[hidden],
.username-root:empty,
#progression-root:empty,
#quick-sell-root:empty { display: none; }

body.username-gated { overflow: hidden; }
body.username-gated .app-shell { pointer-events: none; filter: blur(2px); }

.username-gate,
.progression-shade,
.quick-sell-shade {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: grid;
  place-items: center;
  background: rgba(12, 13, 12, 0.73);
  backdrop-filter: blur(6px);
}

.username-panel,
.quick-sell-panel {
  width: min(460px, calc(100vw - 40px));
  padding: 27px 29px 25px;
  border-top: 2px solid #86c3d6;
  background: rgba(31, 32, 30, 0.98);
  box-shadow: 0 20px 66px rgba(0, 0, 0, 0.42);
}

.username-panel h1,
.quick-sell-panel h2 { margin: 3px 0 9px; font-size: 25px; font-weight: 400; letter-spacing: 0.04em; }
.username-panel > p,
.quick-sell-panel > p { margin: 0 0 17px; color: rgba(237, 235, 228, 0.58); font-size: 10px; line-height: 14px; letter-spacing: 0.04em; }
.username-field { display: grid; gap: 4px; }
.username-field span { color: rgba(237, 235, 228, 0.43); font-size: 8px; letter-spacing: 0.09em; }
.username-field input { height: 42px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.15); outline: 0; background: rgba(0, 0, 0, 0.22); font-size: 16px; letter-spacing: 0.04em; }
.username-rules { display: block; margin-top: 7px; color: rgba(237, 235, 228, 0.34); font-size: 7px; line-height: 11px; letter-spacing: 0.06em; }
.username-error { margin-top: 10px; padding: 8px 10px; border-left: 2px solid #d66d61; background: rgba(86, 27, 23, 0.22); color: #e9b0a9; font-size: 9px; }
.username-submit { width: 100%; margin-top: 18px; }
.username-signout { width: 100%; margin-top: 8px; color: rgba(238, 236, 229, 0.42); background: transparent; font-size: 8px; letter-spacing: 0.09em; }

.progression-shade { z-index: 5000; padding: 32px; }
.progression-panel { width: min(900px, calc(100vw - 50px)); max-height: calc(100vh - 50px); display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; border-top: 2px solid #7ab8cd; background: #252623; box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5); }
.progression-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.progression-header h1 { margin: 1px 0 0; font-size: 23px; font-weight: 400; letter-spacing: 0.05em; }
.progression-header p { margin: 2px 0 0; color: rgba(237, 235, 228, 0.39); font-size: 8px; letter-spacing: 0.07em; }
.progression-close { color: rgba(237, 235, 228, 0.6); background: transparent; font-size: 9px; letter-spacing: 0.09em; }
.progression-summary { min-height: 55px; display: grid; grid-template-columns: 78px minmax(120px, 1fr) 90px; align-items: center; gap: 13px; padding: 0 22px; background: rgba(10, 11, 10, 0.22); }
.progression-summary strong { font-size: 12px; }
.progression-summary > span:last-child { color: rgba(237, 235, 228, 0.42); font-size: 8px; text-align: right; }
.progression-summary-track { height: 4px; background: rgba(255, 255, 255, 0.12); }
.progression-summary-track i { display: block; height: 100%; background: #77b54a; }
.progression-levels { overflow-y: auto; padding: 8px; scrollbar-width: none; }
.progression-levels::-webkit-scrollbar { display: none; }
.progression-level { min-height: 62px; display: grid; grid-template-columns: 64px minmax(0, 1fr) 105px; align-items: center; gap: 12px; margin-bottom: 3px; padding: 6px 12px; border-left: 2px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.025); }
.progression-level.is-reached { border-left-color: #77b54a; background: rgba(91, 133, 53, 0.09); }
.progression-level-number { display: grid; }
.progression-level-number span { color: rgba(237, 235, 228, 0.35); font-size: 7px; letter-spacing: 0.08em; }
.progression-level-number strong { font-size: 20px; line-height: 20px; }
.progression-level-details { min-width: 0; display: grid; gap: 5px; }
.progression-level-details small,
.progression-total-xp { color: rgba(237, 235, 228, 0.34); font-size: 7px; letter-spacing: 0.07em; }
.progression-total-xp { text-align: right; }
.progression-rewards { display: flex; flex-wrap: wrap; gap: 5px; }
.progression-reward { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px 3px; background: rgba(105, 144, 61, 0.23); color: #d9e8ca; font-size: 8px; letter-spacing: 0.05em; }
.progression-reward img { width: 10px; height: 10px; filter: brightness(0) saturate(100%) invert(68%) sepia(54%) saturate(643%) hue-rotate(87deg) brightness(94%); }
.progression-loading { padding: 80px 20px; color: rgba(237, 235, 228, 0.4); text-align: center; font-size: 10px; letter-spacing: 0.08em; }

.quick-sell-shade { z-index: 5050; }
.quick-sell-visual { min-height: 150px; display: grid; grid-template-columns: 1fr 145px; align-items: center; margin: 15px 0; background: linear-gradient(145deg, #646561, #8b8b85); }
.quick-sell-visual img { width: 100%; height: 150px; padding: 10px; object-fit: contain; filter: drop-shadow(0 9px 7px rgba(0, 0, 0, 0.35)); }
.quick-sell-value { height: 100%; display: grid; align-content: center; padding: 16px; background: rgba(20, 21, 20, 0.72); }
.quick-sell-value span { color: rgba(237, 235, 228, 0.42); font-size: 8px; letter-spacing: 0.09em; }
.quick-sell-value strong { color: #cfe2bd; font-size: 23px; font-weight: 500; }
.quick-sell-actions { display: flex; justify-content: flex-end; gap: 7px; }

@media (max-width: 1366px) {
  .profile-shell { width: calc(100% - 44px); }
  .profile-showcase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-item-card,
  .profile-showcase-empty { min-height: 145px; grid-template-rows: 96px 1fr; }
  .profile-item-card > img { height: 96px; }
  .friend-groups { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  .profile-page-header { align-items: stretch; flex-direction: column; }
  .profile-search { width: 100%; }
  .player-profile-header { grid-template-columns: 105px minmax(0, 1fr); }
  .profile-avatar-button { width: 100px; height: 100px; }
  .profile-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .profile-editor { grid-template-columns: 1fr; }
}

/* Rank identity */
.profile-rank {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 7px 0 12px;
}
.profile-rank > img { width: 88px; height: 38px; object-fit: contain; }
.profile-rank > span { display: grid; gap: 1px; }
.profile-rank strong { font-size: 11px; font-weight: 500; letter-spacing: 0.05em; }
.profile-rank small { color: rgba(237, 235, 228, 0.38); font-size: 7px; letter-spacing: 0.07em; }
.profile-result-meta,
.friend-rank { display: inline-flex; align-items: center; gap: 5px; }
.profile-result-meta img { width: 39px; height: 17px; object-fit: contain; }
.friend-rank img { width: 34px; height: 15px; object-fit: contain; }

.progression-rank-summary { grid-template-columns: minmax(220px, 1.1fr) minmax(120px, 1fr) 130px; }
.progression-current-rank { min-width: 0; display: flex; align-items: center; gap: 9px; }
.progression-current-rank > img { width: 70px; height: 30px; object-fit: contain; }
.progression-current-rank > span { display: grid; gap: 2px; }
.progression-current-rank strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progression-current-rank small { color: rgba(237, 235, 228, 0.37); font-size: 7px; letter-spacing: 0.06em; }
.progression-level { grid-template-columns: 94px minmax(0, 1fr) 105px; }
.progression-rank-badge { display: grid; place-items: center; }
.progression-rank-badge img { width: 82px; height: 35px; object-fit: contain; }
.progression-rank-name { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; }

.profile-item-card.is-storage-unit { cursor: pointer; }
.profile-item-card.is-storage-unit:hover { background: rgba(255, 255, 255, 0.035); }
