.profile-shell {
  display: grid;
  gap: 30px;
}

.profile-hero {
  width: min(100%, 1160px);
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  border: 1px solid #b7c0cc;
  background: rgba(236, 239, 242, 0.58);
  padding: 24px;
  --cut: 24px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 150px;
  aspect-ratio: 1;
  border: 1px solid #aeb8c5;
  background: #e8eaed;
  color: var(--ink);
  font-size: 78px;
  font-weight: 950;
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}

.profile-name {
  display: inline-block;
  margin: 0;
  background: #e8eaed;
  padding: 4px 16px 8px;
  color: var(--ink);
  font-size: 70px;
  font-style: italic;
  line-height: 0.9;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  margin-top: 13px;
  color: #4e5866;
  font-size: 12px;
  font-weight: 850;
}

.profile-bio {
  max-width: 620px;
  margin: 10px 0 0;
  color: #717b88;
  font-size: 13px;
  font-weight: 750;
}

.profile-mini-stats,
.profile-tags,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.profile-mini-stats {
  margin-top: 18px;
}

.profile-mini-stats span,
.profile-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #aeb8c5;
  background: #eef1f4;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

.profile-mini-stats strong {
  margin-right: 5px;
  font-size: 13px;
}

.profile-tags {
  margin-top: 12px;
}

.profile-actions {
  justify-content: flex-end;
}

.profile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line-dark);
  padding: 0 15px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.profile-action.secondary {
  background: #f5f6f7;
  color: var(--ink);
}

.profile-action.primary {
  background: var(--red);
  color: #fff;
}

.profile-tabs {
  width: min(100%, 1160px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid #b7c0cc;
  border-bottom: 1px solid #b7c0cc;
  padding: 14px 0;
}

.profile-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #607083;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-tab .ui-icon {
  width: 17px;
  height: 17px;
}

.profile-tab.is-active {
  background: var(--red);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}

.tab-blue {
  color: var(--blue);
}

.tab-red {
  color: var(--red);
}

.tab-yellow {
  color: #c99a12;
}

.profile-tab.is-active .tab-blue,
.profile-tab.is-active .tab-red,
.profile-tab.is-active .tab-yellow {
  color: #fff;
}

.profile-content {
  width: min(100%, 1320px);
  margin: 0 auto;
}

.profile-pane {
  display: none;
}

.profile-pane.is-active {
  display: block;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 28px;
  align-items: start;
}

.profile-main-column {
  display: grid;
  gap: 32px;
}

.profile-section,
.profile-side-panel,
.single-tab-panel {
  border: 1px solid #aeb8c5;
  background: rgba(236, 239, 242, 0.42);
  padding: 20px;
  --cut: 20px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 25px;
  font-style: italic;
  line-height: 1;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
}

.profile-section-title .ui-icon {
  color: var(--blue);
}

.profile-arrows {
  display: flex;
  gap: 8px;
}

.profile-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #aeb8c5;
  background: #eef1f4;
  color: var(--ink);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.profile-card-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.profile-card-row.one-card {
  grid-template-columns: minmax(180px, 260px);
}

.profile-card {
  overflow: hidden;
  border: 1px solid var(--line-dark);
  background: #eef1f4;
  --cut: 16px;
}

.profile-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--line-dark);
}

.profile-card-body {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 12px;
}

.profile-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
}

.profile-card p {
  margin: 0;
  color: #5f6976;
  font-size: 11px;
  font-weight: 800;
}

.profile-card p a {
  color: var(--blue);
  font-weight: 950;
}

.profile-card-stats {
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-side-panel {
  display: grid;
  gap: 26px;
}

.side-block {
  display: grid;
  gap: 14px;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.side-title h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 22px;
  font-style: italic;
  line-height: 1;
  font-weight: 950;
}

.side-title a,
.side-label {
  color: var(--red);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.category-bars,
.profile-facts,
.analysis-list {
  display: grid;
  gap: 10px;
}

.category-bar {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.bar-track {
  height: 8px;
  background: #d4dae2;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--bar, var(--blue));
}

.fact-row,
.analysis-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid #c2cad5;
  background: #e8ecf1;
  padding: 8px 10px;
  color: #5f6976;
  font-size: 12px;
  font-weight: 800;
}

.fact-row .ui-icon {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

.analysis-list {
  border-top: 2px solid var(--blue);
  padding-top: 14px;
}

.single-tab-panel {
  min-height: 520px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-tile {
  display: grid;
  gap: 8px;
  min-height: 116px;
  border: 1px solid #aeb8c5;
  background: #eef1f4;
  padding: 15px;
  --cut: 14px;
}

.stat-tile .ui-icon {
  color: var(--stat, var(--blue));
}

.stat-tile strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.stat-tile span {
  color: #5f6976;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.wide-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
}

.friend-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.friend-line {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid #b7c0cc;
  background: #e6ecf4;
  padding: 14px;
  --cut: 16px;
}

.friend-line .friend-avatar {
  width: 54px;
  height: 54px;
}

.friend-line h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 950;
  text-transform: uppercase;
}

.friend-line p,
.social-status {
  margin: 5px 0 0;
  color: #5f6976;
  font-size: 12px;
  font-weight: 850;
}

.social-status {
  margin-top: 24px;
  text-align: center;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.quest-card {
  display: grid;
  gap: 12px;
  min-height: 238px;
  border: 1px solid #aeb8c5;
  background: #eef1f4;
  padding: 15px;
  --cut: 16px;
}

.quest-top,
.quest-progress,
.quest-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quest-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #e2e7ee;
  color: var(--blue);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.quest-badge {
  border: 1px solid currentColor;
  background: #f7f8fa;
  padding: 4px 8px;
  color: var(--quest, var(--red));
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.quest-card h3 {
  margin: 0;
  font-size: 18px;
  font-style: italic;
  line-height: 1.1;
  font-weight: 950;
}

.quest-card p {
  margin: 0;
  color: #4e5866;
  font-size: 12px;
  font-weight: 750;
}

.quest-progress {
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.quest-track {
  height: 8px;
  background: #d4dae2;
}

.quest-fill {
  display: block;
  width: var(--progress);
  height: 100%;
  background: var(--quest, var(--red));
}

.quest-foot {
  align-self: end;
  color: #5f6976;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 1320px) {
  .profile-card-row,
  .quest-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 1120px) {
  .profile-hero {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .profile-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .profile-avatar {
    width: 128px;
  }

  .profile-name {
    font-size: 56px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .profile-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .profile-actions {
    grid-column: auto;
  }

  .profile-name {
    font-size: 44px;
  }

  .profile-card-row,
  .quest-grid,
  .wide-bars,
  .friend-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .profile-shell {
    gap: 22px;
  }

  .profile-hero {
    padding: 18px;
  }

  .profile-avatar {
    width: 108px;
    font-size: 58px;
  }

  .profile-name {
    font-size: 34px;
  }

  .profile-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .profile-tabs::-webkit-scrollbar {
    display: none;
  }

  .profile-tab {
    flex: 0 0 auto;
  }

  .profile-card-row,
  .profile-card-row.one-card,
  .stats-grid,
  .quest-grid,
  .wide-bars,
  .friend-metrics {
    grid-template-columns: 1fr;
  }

  .category-bar {
    grid-template-columns: 80px minmax(0, 1fr) 34px;
  }
}

/* Profile hero full-bleed, content kept aligned with the existing inner grid. */
.profile-shell {
  --profile-shell-pad: 48px;
}

.profile-hero {
  width: calc(100% + var(--sidebar-width) + (var(--profile-shell-pad) * 2));
  max-width: none;
  margin: 0 calc(-1 * var(--profile-shell-pad)) 0 calc(-1 * (var(--sidebar-width) + var(--profile-shell-pad)));
  padding-left: calc(var(--sidebar-width) + var(--profile-shell-pad) + 24px);
}

.profile-tab {
  border: 1px solid #aeb8c5;
  background: rgba(238, 241, 244, 0.48);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%, 0 9px);
}

.profile-tab.is-active {
  border-color: var(--line-dark);
  background: var(--red);
  color: #fff;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%, 0 12px);
}

@media (max-width: 1320px) {
  .profile-shell {
    --profile-shell-pad: 32px;
  }
}

@media (max-width: 1120px) {
  .profile-hero {
    width: calc(100% + (var(--profile-shell-pad) * 2));
    margin-left: calc(-1 * var(--profile-shell-pad));
    margin-right: calc(-1 * var(--profile-shell-pad));
    padding-left: calc(var(--profile-shell-pad) + 24px);
  }
}

@media (max-width: 820px) {
  .profile-shell {
    --profile-shell-pad: 18px;
  }

  .profile-hero {
    padding-left: calc(var(--profile-shell-pad) + 18px);
  }
}


.content-shell.profile-shell {
  padding-top: 0;
}

.profile-avatar.has-image {
  background-position: center;
  background-size: cover;
  color: transparent;
  text-shadow: none;
}

.profile-edit-shell {
  min-height: calc(100vh - var(--topbar-height));
  display: grid;
  align-items: start;
  padding-top: 0;
}

.profile-edit-panel {
  width: min(100%, 760px);
  margin: 0 auto 44px;
  border: 1px solid #aeb8c5;
  background: rgba(236, 239, 242, 0.88);
  padding: clamp(20px, 4vw, 34px);
  --cut: 24px;
}

.profile-edit-head {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.profile-edit-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-edit-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.profile-edit-form {
  display: grid;
  gap: 16px;
}

.profile-edit-form label {
  display: grid;
  gap: 7px;
  color: #586273;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-edit-form input,
.profile-edit-form textarea {
  width: 100%;
  border: 1px solid #aeb8c5;
  background: #f8f9fb;
  color: var(--ink);
  padding: 14px 15px;
  font-size: 15px;
  font-weight: 750;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

.profile-edit-form textarea {
  min-height: 128px;
  resize: vertical;
}

.profile-edit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.profile-edit-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

/* Profile share modal. */
.profile-share-modal {
  position: fixed;
  z-index: 160;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
}

body.profile-share-open {
  overflow: hidden;
}

body.profile-share-open .profile-share-modal {
  display: grid;
}

.profile-share-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 12, 18, 0.68);
}

.profile-share-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  border: 1px solid #aeaeae;
  background: #f5f6f7;
  padding: 30px;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.profile-share-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.profile-share-kicker,
.profile-share-panel h2,
.profile-share-url {
  margin: 0;
}

.profile-share-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-share-panel h2 {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-share-url {
  margin-top: 12px;
  color: #626d7d;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.profile-share-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.profile-share-grid a,
.profile-copy-link,
.profile-share-qr button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #aeaeae;
  background: #eceff2;
  color: var(--ink);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

.profile-share-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 22px;
}

.profile-share-qr img {
  width: 180px;
  height: 180px;
  border: 1px solid #aeaeae;
  background: #fff;
  padding: 10px;
}

.profile-copy-link {
  width: 100%;
  margin-top: 18px;
  background: var(--blue);
  color: #fff;
}

/* Goal profile hero top alignment pass. */
.content-shell.profile-shell {
  padding-top: 0;
}

.profile-hero {
  margin-top: 0;
}
/* Goal profile edit modal and dynamic cards pass. */
.profile-edit-modal {
  position: fixed;
  z-index: 165;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
}

body.profile-edit-open {
  overflow: hidden;
}

body.profile-edit-open .profile-edit-modal {
  display: grid;
}

.profile-edit-modal .profile-edit-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  max-height: min(92vh, 900px);
  overflow: auto;
  margin: 0;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

.profile-action.primary[type="button"] {
  cursor: pointer;
}

.profile-card p a,
.profile-card .creator-link {
  color: var(--red) !important;
}
.profile-hero {
  background: var(--profile-hero-bg, #f5f6f7);
  color: var(--profile-hero-text, var(--ink));
}

.profile-hero .profile-name,
.profile-hero .profile-meta,
.profile-hero .profile-bio,
.profile-hero .profile-mini-stats,
.profile-hero .profile-tags,
.profile-hero .profile-tags span {
  color: var(--profile-hero-text, var(--ink));
}

.profile-card-row,
.profile-card-row.one-card {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 8px;
}

.profile-card-row > * {
  scroll-snap-align: start;
}

/* Current goal centered profile layout pass. */
.profile-content,
.profile-tabs,
.single-tab-panel {
  width: min(100%, 1160px);
  margin-left: auto;
  margin-right: auto;
}

.overview-grid {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 28px;
}

.profile-main-column,
.profile-side-panel {
  min-width: 0;
}

.profile-avatar,
.profile-avatar.has-image {
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

@media (max-width: 1120px) {
  .profile-content,
  .profile-tabs,
  .single-tab-panel {
    width: min(100%, 860px);
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .profile-tabs {
    justify-content: center;
  }
}

/* Current goal profile overview containment and tab grid pass. */
.profile-content,
.profile-pane,
.overview-grid,
.profile-main-column,
.profile-side-panel,
.profile-section,
.single-tab-panel {
  min-width: 0;
  max-width: 100%;
}

.profile-pane[data-profile-pane="overview"] .overview-grid {
  grid-template-columns: minmax(0, 1fr) clamp(280px, 28vw, 360px);
  align-items: start;
  overflow: hidden;
}

.profile-pane[data-profile-pane="overview"] .profile-main-column,
.profile-pane[data-profile-pane="overview"] .profile-section {
  overflow: hidden;
}

.profile-pane[data-profile-pane="overview"] .profile-card-row,
.profile-pane[data-profile-pane="overview"] .profile-card-row.one-card {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 32px) / 3);
  gap: 16px;
  overflow-x: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 0;
}

.profile-pane[data-profile-pane="overview"] .profile-card-row::-webkit-scrollbar {
  display: none;
}

.profile-pane[data-profile-pane="overview"] .profile-card-row > * {
  min-width: 0;
  scroll-snap-align: start;
}

.profile-pane:not([data-profile-pane="overview"]) .profile-arrows {
  display: none !important;
}

.profile-pane:not([data-profile-pane="overview"]) .profile-card-row,
.profile-pane:not([data-profile-pane="overview"]) .profile-card-row.one-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: initial;
  gap: 16px;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 0;
}

.profile-pane:not([data-profile-pane="overview"]) .profile-card-row > * {
  min-width: 0;
  scroll-snap-align: none;
}

@media (max-width: 1320px) {
  .profile-pane[data-profile-pane="overview"] .profile-card-row,
  .profile-pane[data-profile-pane="overview"] .profile-card-row.one-card {
    grid-auto-columns: calc((100% - 16px) / 2);
  }
}

@media (max-width: 1120px) {
  .profile-pane[data-profile-pane="overview"] .overview-grid {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .profile-pane[data-profile-pane="overview"] .profile-card-row,
  .profile-pane[data-profile-pane="overview"] .profile-card-row.one-card {
    grid-auto-columns: 100%;
  }

  .profile-pane:not([data-profile-pane="overview"]) .profile-card-row,
  .profile-pane:not([data-profile-pane="overview"]) .profile-card-row.one-card {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Current pass: hard containment for profile overview carousel. */
.profile-pane[data-profile-pane="overview"] .overview-grid {
  grid-template-columns: minmax(0, calc(100% - clamp(280px, 28vw, 360px) - 28px)) clamp(280px, 28vw, 360px);
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.profile-pane[data-profile-pane="overview"] .profile-main-column,
.profile-pane[data-profile-pane="overview"] .profile-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: clip;
  contain: paint;
}

.profile-pane[data-profile-pane="overview"] .profile-card-row,
.profile-pane[data-profile-pane="overview"] .profile-card-row.one-card {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}

.profile-pane[data-profile-pane="overview"] .profile-card {
  width: 100%;
  min-width: 0;
}

.profile-side-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 1120px) {
  .profile-pane[data-profile-pane="overview"] .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Current goal: profile panels should be plain, without borders or bevels. */
.profile-section,
.profile-side-panel,
.single-tab-panel {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  --cut: 0 !important;
  clip-path: none !important;
}

.profile-section::before,
.profile-side-panel::before,
.single-tab-panel::before {
  display: none !important;
  content: none !important;
}

.profile-section.cut-corners,
.profile-side-panel.cut-corners,
.single-tab-panel.cut-corners {
  clip-path: none !important;
}

.profile-tabs {
  gap: 10px;
}

.profile-tab {
  border: 1px solid #c4ccd6;
  background: rgba(238, 241, 244, 0.72);
  color: var(--ink);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.profile-tab:hover,
.profile-tab:focus-visible {
  border-color: var(--red);
  background: #f7f8fa;
}

.profile-arrow {
  border: 1px solid #c4ccd6;
  background: #f7f8fa;
  color: var(--ink);
  font-weight: 950;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.profile-arrow:hover,
.profile-arrow:focus-visible {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

body.site-dark-mode .profile-tabs {
  background: transparent !important;
}

body.site-dark-mode .profile-tab {
  border-color: var(--line-soft) !important;
  background: #151515 !important;
  color: var(--ink) !important;
}

body.site-dark-mode .profile-tab .ui-icon {
  color: currentColor !important;
}

body.site-dark-mode .profile-tab:hover,
body.site-dark-mode .profile-tab:focus-visible {
  border-color: #4b5563 !important;
  background: #1c1c1c !important;
}

body.site-dark-mode .profile-tab.is-active {
  border-color: var(--red) !important;
  background: var(--red) !important;
  color: #fff !important;
}

body.site-dark-mode .profile-arrow {
  border-color: var(--line-soft) !important;
  background: #151515 !important;
  color: var(--ink) !important;
}

body.site-dark-mode .profile-arrow:hover,
body.site-dark-mode .profile-arrow:focus-visible {
  border-color: var(--red) !important;
  background: var(--red) !important;
  color: #fff !important;
}

body.site-dark-mode .stat-tile,
body.site-dark-mode .quest-card,
body.site-dark-mode .friend-line,
body.site-dark-mode .category-bar,
body.site-dark-mode .analysis-note,
body.site-dark-mode .fact-row,
body.site-dark-mode .profile-empty-card {
  border-color: var(--line-soft) !important;
  background: #151515 !important;
  color: var(--ink) !important;
}

body.site-dark-mode .stat-tile span,
body.site-dark-mode .quest-card p,
body.site-dark-mode .quest-foot,
body.site-dark-mode .friend-line p,
body.site-dark-mode .social-status,
body.site-dark-mode .category-bar span,
body.site-dark-mode .side-label {
  color: var(--muted) !important;
}

body.site-dark-mode .stat-tile strong,
body.site-dark-mode .quest-card h3,
body.site-dark-mode .friend-line h3,
body.site-dark-mode .profile-section-title,
body.site-dark-mode .side-title h3,
body.site-dark-mode .category-bar strong,
body.site-dark-mode .quest-progress {
  color: var(--ink) !important;
}

body.site-dark-mode .quest-icon,
body.site-dark-mode .quest-badge,
body.site-dark-mode .quest-track,
body.site-dark-mode .bar-track,
body.site-dark-mode .friend-avatar {
  background: #202020 !important;
  color: var(--ink) !important;
}

body.site-dark-mode .quest-track,
body.site-dark-mode .bar-track {
  border: 1px solid var(--line-soft) !important;
}

body.site-dark-mode .analysis-list {
  border-top-color: var(--line-soft) !important;
}

/* Profile share and quests polish. */


body.site-dark-mode .profile-share-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

body.site-dark-mode .profile-share-panel {
  background: var(--panel) !important;
  color: var(--ink) !important;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

body.site-dark-mode .profile-share-close {
  color: var(--ink);
}

body.site-dark-mode .profile-share-kicker {
  color: var(--red);
}

body.site-dark-mode .profile-share-url {
  color: var(--muted);
}

body.site-dark-mode .profile-share-grid a,
body.site-dark-mode .profile-share-qr button {
  background: var(--panel-strong) !important;
  color: var(--ink) !important;
}

body.site-dark-mode .profile-copy-link {
  background: var(--red) !important;
  color: #fff !important;
}

body.site-dark-mode .profile-share-qr img {
  border-color: var(--line-soft) !important;
  background: #fff;
}

.quest-card.is-complete .quest-badge {
  background: color-mix(in srgb, var(--quest, var(--red)) 12%, #fff);
}

body.site-dark-mode .quest-card.is-complete .quest-badge {
  background: color-mix(in srgb, var(--quest, var(--red)) 22%, var(--panel-strong));
}

.profile-pane[data-profile-pane="overview"] .profile-card-row {
  cursor: grab;
  user-select: none;
}

.profile-pane[data-profile-pane="overview"] .profile-card-row.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

/* Current profile tab selected color map. */
.profile-tab[data-profile-tab="overview"] { --profile-tab-accent: var(--red); }
.profile-tab[data-profile-tab="history"] { --profile-tab-accent: #ff8a00; }
.profile-tab[data-profile-tab="list"] { --profile-tab-accent: var(--blue); }
.profile-tab[data-profile-tab="favorites"] { --profile-tab-accent: #ff3b5c; }
.profile-tab[data-profile-tab="stats"] { --profile-tab-accent: #ffd100; }
.profile-tab[data-profile-tab="quests"] { --profile-tab-accent: #ffd43b; }
.profile-tab[data-profile-tab="friends"] { --profile-tab-accent: #ff3d41; }

.profile-tab.is-active,
body.site-dark-mode .profile-tab.is-active {
  border-color: var(--profile-tab-accent, var(--red)) !important;
  background: var(--profile-tab-accent, var(--red)) !important;
  color: #fff !important;
}

.profile-tab.is-active .ui-icon,
body.site-dark-mode .profile-tab.is-active .ui-icon {
  color: #fff !important;
}

/* Current fix: keep profile avatar visually higher in the hero. */
.profile-hero {
  align-items: start !important;
}

.profile-avatar {
  align-self: start !important;
  margin-top: -14px !important;
}

@media (max-width: 640px) {
  .profile-avatar {
    margin-top: 0 !important;
  }
}

/* Profile hero layout: banner image/color, avatar anchored on the lower edge, content below. */
.profile-tags {
  display: none !important;
}

.profile-hero {
  --profile-banner-height: 180px;
  position: relative;
  grid-template-columns: 170px minmax(0, 1fr) auto !important;
  align-items: start !important;
  min-height: 350px;
  padding: 0 24px 24px !important;
  overflow: visible;
  border: 0 !important;
  background: transparent !important;
}

.profile-hero::before {
  position: absolute;
  inset: 0 0 auto;
  height: var(--profile-banner-height);
  border: 1px solid var(--line-soft, #b7c0cc);
  background-color: var(--profile-hero-bg, #f5f6f7);
  background-image: linear-gradient(90deg, rgb(0 0 0 / 24%), rgb(0 0 0 / 4%)), var(--profile-hero-image, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  content: "";
  z-index: 0;
}

.profile-hero > * {
  position: relative;
  z-index: 1;
}

.profile-avatar {
  position: absolute !important;
  left: 24px;
  top: calc(var(--profile-banner-height) - 75px);
  z-index: 2;
}

.profile-hero > div:nth-of-type(2) {
  grid-column: 2 / 3;
  margin-top: calc(var(--profile-banner-height) + 22px);
  align-self: start;
}

.profile-actions {
  position: absolute !important;
  right: 24px;
  bottom: 24px;
  z-index: 3;
  justify-content: flex-end;
}

.profile-hero.has-hero-image .profile-name,
.profile-hero.has-hero-image .profile-meta,
.profile-hero.has-hero-image .profile-bio,
.profile-hero.has-hero-image .profile-mini-stats {
  color: var(--ink);
}

.profile-badge-row {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .profile-hero {
    --profile-banner-height: 145px;
    grid-template-columns: 132px minmax(0, 1fr) !important;
    min-height: 390px;
    padding: 0 16px 72px !important;
  }

  .profile-avatar {
    left: 16px;
    top: calc(var(--profile-banner-height) - 56px);
    width: 112px;
  }

  .profile-hero > div:nth-of-type(2) {
    grid-column: 2 / 3;
    margin-top: calc(var(--profile-banner-height) + 18px);
  }

  .profile-actions {
    right: 16px;
    bottom: 18px;
  }
}


/* Keep profile identity clear of the desktop sidebar while preserving the banner width. */
@media (min-width: 721px) {
  .profile-hero {
    --profile-content-offset: clamp(260px, 24vw, 390px);
    grid-template-columns: var(--profile-content-offset) minmax(0, 1fr) auto !important;
  }

  .profile-avatar {
    left: clamp(96px, 10vw, 170px);
  }

  .profile-hero > div:nth-of-type(2) {
    max-width: 760px;
  }
}


/* Real media layer for custom profile hero images. */
.profile-hero-media {
  position: absolute !important;
  inset: 0 0 auto !important;
  height: var(--profile-banner-height) !important;
  border: 1px solid var(--line-soft, #b7c0cc);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  pointer-events: none;
  z-index: 0 !important;
}

.profile-hero:has(.profile-hero-media)::before {
  opacity: 0;
}

.profile-hero > *:not(.profile-hero-media) {
  position: relative;
  z-index: 1;
}

@media (min-width: 721px) {
  .profile-hero {
    --profile-content-offset: clamp(340px, 32vw, 520px);
    grid-template-columns: var(--profile-content-offset) minmax(0, 1fr) auto !important;
    min-height: 365px;
  }

  .profile-avatar {
    left: clamp(180px, 19vw, 310px);
  }

  .profile-hero > div:nth-of-type(2) {
    max-width: 800px;
  }
}

@media (min-width: 721px) and (max-width: 1120px) {
  .profile-hero {
    --profile-content-offset: clamp(240px, 30vw, 340px);
  }

  .profile-avatar {
    left: clamp(80px, 13vw, 160px);
  }
}


/* Final stable profile identity layout: media layer no longer changes content targeting. */
.profile-hero {
  --profile-avatar-size: 150px;
  --profile-avatar-half: 75px;
  --profile-avatar-left: clamp(300px, 24vw, 420px);
  --profile-copy-gap: 32px;
  --profile-copy-left: calc(var(--profile-avatar-left) + var(--profile-avatar-size) + var(--profile-copy-gap));
  min-height: 430px !important;
}

.profile-avatar {
  width: var(--profile-avatar-size) !important;
  left: var(--profile-avatar-left) !important;
  top: calc(var(--profile-banner-height) - var(--profile-avatar-half)) !important;
  z-index: 3 !important;
}

.profile-hero > .profile-avatar + div {
  position: absolute !important;
  left: var(--profile-copy-left) !important;
  top: calc(var(--profile-banner-height) + 26px) !important;
  width: min(760px, calc(100% - var(--profile-copy-left) - 230px)) !important;
  max-width: none !important;
  margin: 0 !important;
  grid-column: auto !important;
  z-index: 2 !important;
}

.profile-hero > .profile-avatar + div .profile-name {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (min-width: 721px) and (max-width: 1120px) {
  .profile-hero {
    --profile-avatar-left: clamp(120px, 17vw, 190px);
    --profile-copy-gap: 24px;
    min-height: 420px !important;
  }

  .profile-hero > .profile-avatar + div {
    width: min(620px, calc(100% - var(--profile-copy-left) - 170px)) !important;
  }
}

@media (max-width: 720px) {
  .profile-hero {
    --profile-avatar-size: 112px;
    --profile-avatar-half: 56px;
    --profile-avatar-left: 16px;
    --profile-copy-gap: 0px;
    --profile-copy-left: 16px;
    min-height: 500px !important;
  }

  .profile-avatar {
    left: var(--profile-avatar-left) !important;
    top: calc(var(--profile-banner-height) - var(--profile-avatar-half)) !important;
  }

  .profile-hero > .profile-avatar + div {
    left: 16px !important;
    right: 16px !important;
    top: calc(var(--profile-banner-height) + 78px) !important;
    width: auto !important;
  }
}


/* Stable hydrated profile identity placement. */
.profile-hero {
  --profile-avatar-left: clamp(180px, 15vw, 280px);
  --profile-copy-gap: 30px;
  --profile-copy-left: calc(var(--profile-avatar-left) + var(--profile-avatar-size) + var(--profile-copy-gap));
}

.profile-hero > .profile-identity {
  position: absolute !important;
  left: var(--profile-copy-left) !important;
  top: calc(var(--profile-banner-height) + 34px) !important;
  width: min(760px, calc(100% - var(--profile-copy-left) - 210px)) !important;
  max-width: none !important;
  margin: 0 !important;
  grid-column: auto !important;
  z-index: 2 !important;
}

@media (min-width: 721px) and (max-width: 1120px) {
  .profile-hero {
    --profile-avatar-left: clamp(92px, 13vw, 150px);
    --profile-copy-gap: 22px;
  }

  .profile-hero > .profile-identity {
    width: min(620px, calc(100% - var(--profile-copy-left) - 150px)) !important;
  }
}

@media (max-width: 720px) {
  .profile-hero > .profile-identity {
    left: 16px !important;
    right: 16px !important;
    top: calc(var(--profile-banner-height) + 78px) !important;
    width: auto !important;
  }
}

body.site-dark-mode .profile-hero .profile-name,
body.site-dark-mode .profile-hero .profile-mini-stats span {
  background: transparent !important;
  background-color: transparent !important;
}
.profile-name {
  padding: 0 !important;
}

.profile-hero > .profile-identity {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.profile-identity .profile-name {
  flex: 0 1 auto;
}

.profile-identity .profile-actions {
  position: static !important;
  display: inline-flex;
  margin-left: 0;
  justify-content: flex-start;
}

.profile-identity .profile-meta,
.profile-identity .profile-bio,
.profile-identity .profile-mini-stats,
.profile-identity .profile-badge-row {
  flex: 0 0 100%;
}

body.site-dark-mode .profile-identity,
body.site-dark-mode .profile-identity .profile-name,
body.site-dark-mode .profile-identity .profile-meta,
body.site-dark-mode .profile-identity .profile-meta span,
body.site-dark-mode .profile-identity .profile-bio,
body.site-dark-mode .profile-identity .profile-mini-stats,
body.site-dark-mode .profile-identity .profile-mini-stats span {
  color: #fff !important;
}

@media (max-width: 720px) {
  .profile-identity .profile-actions {
    flex-basis: 100%;
  }
}
