:root {
  --profile-accent: #7052ca;
  --profile-on-accent: #fff;
  --profile-canvas: #f9f7fc;
  --wallet-start: #eee8ff;
  --wallet-end: #f8f3ff;
  --wallet-ink: #3a2869;
  --wallet-border: #e5dcfa;
  --profile-card-start: #fff;
  --profile-card-end: #f4effe;
  --profile-edit-fill: #e9dfff;
}
:root[data-appearance=dark] {
  --profile-accent: #b59cfa;
  --profile-on-accent: #271b43;
  --profile-canvas: #1b1923;
  --wallet-start: #34284d;
  --wallet-end: #292338;
  --wallet-ink: #efe7ff;
  --wallet-border: #47395e;
  --profile-card-start: #24202f;
  --profile-card-end: #30263e;
  --profile-edit-fill: #3a2f51;
}

.profile-view {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--profile-canvas);
}
.profile-view-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px clamp(20px, 3.4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.profile-view-header h1 {
  font-size: clamp(24px, 2.8vw, 30px);
  font-weight: 750;
  letter-spacing: -.035em;
}
#profile-settings-shortcut { margin-inline-start: auto; min-height: 44px; text-align: end; }
#profile-back { display: grid; margin-inline-start: -8px; color: var(--profile-accent); }
.profile-scroll { overflow: auto; overscroll-behavior: contain; }
.profile-content {
  display: grid;
  gap: 16px;
  width: min(100%, 680px);
  margin-inline: auto;
  padding: 24px clamp(16px, 3.6vw, 32px) 28px;
}
.profile-content:has(.shop-wallet) { width: min(100%, 1000px); gap: 24px; }
.profile-content h2, .profile-content h3 { margin: 0; }
#profile-status {
  position: sticky;
  bottom: 8px;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 0 auto 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  z-index: 1;
}
#profile-navigation { display: none; }

.profile-card {
  min-height: 146px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
  padding: clamp(18px, 3.2vw, 26px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(128deg, var(--profile-card-start) 30%, var(--profile-card-end));
}
.profile-card-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 230px;
  gap: 16px;
}
.profile-card-avatar.avatar {
  width: clamp(76px, 12vw, 96px);
  height: clamp(76px, 12vw, 96px);
  flex: none;
  font-size: clamp(28px, 4vw, 36px);
}
.profile-card-copy, .aura-context-copy { min-width: 0; display: grid; justify-items: start; gap: 4px; }
.profile-card-copy h2 {
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: clamp(23px, 3.2vw, 29px);
  line-height: 1.15;
  letter-spacing: -.032em;
}
.profile-card-copy p { overflow-wrap: anywhere; color: var(--muted); font-size: 15px; }
.profile-card-copy .founder-badge { margin-top: 6px; }

.profile-icon-symbol {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-icon-sparks { fill: currentColor; stroke: none; }
.sparks-amount {
  display: inline-flex;
  align-items: center;
  gap: .28em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.sparks-amount svg { width: .74em; height: .74em; color: var(--profile-accent); }

.sparks-balance {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 20px 24px;
  border: 1px solid var(--wallet-border);
  border-radius: 20px;
  color: var(--wallet-ink);
  background: linear-gradient(120deg, var(--wallet-start), var(--wallet-end));
}
.sparks-balance::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -38px -62px auto;
  width: 200px;
  height: 110px;
  transform: rotate(-24deg);
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -12px 0 -1px var(--wallet-end), 0 -13px 0 currentColor, 0 -25px 0 -1px var(--wallet-end), 0 -26px 0 currentColor;
  opacity: .14;
}
.sparks-balance h2 { font-size: 14px; font-weight: 650; }
.sparks-balance .sparks-amount {
  margin-top: 6px;
  font-size: clamp(29px, 5vw, 38px);
  letter-spacing: -.04em;
}
.profile-wallet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.profile-wallet::before {
  inset: -27px -50px auto auto;
  transform: rotate(-24deg);
  opacity: .20;
}
.wallet-prompt {
  grid-column: 1 / -1;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
}
.wallet-auras {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.profile-action.wallet-aura {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  justify-content: stretch;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border-color: var(--wallet-border);
  color: var(--wallet-ink);
  font-size: 13px;
  line-height: 1.25;
}
.wallet-aura:hover { border-color: var(--profile-accent); }
.wallet-aura .shop-art { min-height: 58px; aspect-ratio: auto; }
.wallet-aura .shop-card-avatar.avatar { width: 36px; height: 36px; font-size: 14px; }
.wallet-aura-name { padding: 5px 3px; overflow-wrap: anywhere; }
.wallet-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
}
.wallet-header .profile-open-shop { padding-inline: 10px; gap: 5px; }
.sparks-balance .large-balance { font-size: clamp(20px, 4vw, 29px); }
.large-balance > span { white-space: normal; overflow-wrap: anywhere; }
.wallet-header > div, .wallet-header .sparks-amount { max-width: 100%; }

.profile-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--profile-accent);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.profile-action:hover { background: var(--soft); }
.profile-action.danger { color: var(--error); }
.profile-open-shop {
  padding-inline: 14px 12px;
  border-color: transparent;
  background: var(--profile-accent);
  color: var(--profile-on-accent);
}
.profile-open-shop:hover { background: color-mix(in srgb, var(--profile-accent) 87%, var(--profile-on-accent)); }
.profile-open-shop svg, .profile-edit svg, .shop-tools svg { width: 18px; height: 18px; }
.profile-edit {
  min-height: 48px;
  border-color: transparent;
  background: var(--profile-edit-fill);
}
.profile-edit:hover {
  background: color-mix(in srgb, var(--profile-edit-fill) 90%, var(--profile-accent));
}
.profile-section { display: grid; min-width: 0; gap: 7px; }
.profile-section-title { padding-inline: 3px; font-size: 16px; }

.profile-settings {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}
.profile-group {
  min-width: 0;
  border-radius: 17px;
}
.profile-group + .profile-group { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.profile-group:has(+ .profile-group) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.profile-group > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 16px;
  border-radius: inherit;
  list-style: none;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}
.profile-group > summary:hover, .profile-advanced > summary:hover { background: var(--profile-canvas); }
.profile-group > summary::-webkit-details-marker { display: none; }
.profile-group > summary .profile-icon-symbol { color: var(--profile-accent); }
.profile-group > summary .profile-icon-chevron { width: 16px; height: 16px; color: var(--muted); }
.profile-group[open] > summary .profile-icon-chevron { transform: rotate(90deg); }
.profile-group-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 16px 16px;
}
.profile-group-body > :is(h3, p, fieldset, .profile-advanced, .profile-session-list) { flex: 0 0 100%; }
.profile-group-body > h3, .profile-advanced > h3 { font-size: 14px; font-weight: 700; }
.profile-note { color: var(--muted); font-size: 14px; line-height: 1.4; }
.profile-note + .profile-action { justify-self: start; }
.profile-advanced { padding-top: 4px; }
.profile-advanced > summary {
  width: fit-content;
  min-height: 44px;
  padding: 12px 8px;
  margin-inline-start: -8px;
  border-radius: 8px;
  color: var(--profile-accent);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.profile-advanced > h3 { margin-bottom: 6px; }

.shop-wallet {
  display: grid;
  gap: 16px;
  padding: 24px clamp(20px, 4vw, 32px);
}
.shop-wallet .sparks-amount { font-size: clamp(36px, 6vw, 50px); }
.shop-wallet p { margin-top: 8px; font-size: 14px; }
.shop-wallet-mark.profile-icon-symbol {
  position: absolute;
  z-index: -1;
  inset: 18px 26px auto auto;
  width: clamp(63px, 16vw, 120px);
  height: clamp(63px, 16vw, 120px);
  transform: rotate(-11deg);
  color: var(--profile-accent);
  opacity: .17;
}
.shop-catalog h2 { margin-bottom: 12px; font-size: 21px; letter-spacing: -.028em; }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shop-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}
.shop-art {
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  min-height: 128px;
  aspect-ratio: 1.7;
  background: var(--soft);
}
:is(.shop-card, .wallet-aura)[data-sku=aurora] .shop-art {
  background: radial-gradient(ellipse at 32% 70%, #527d84 0%, transparent 58%),
    linear-gradient(150deg, #244940, #262a54 66%, #4f3d71);
}
:is(.shop-card, .wallet-aura)[data-sku=solar] .shop-art {
  background: radial-gradient(ellipse at 52% 56%, #aa6546 0%, transparent 55%),
    linear-gradient(152deg, #673c3b, #34263a 72%, #57425a);
}
:is(.shop-card, .wallet-aura)[data-sku=cosmos] .shop-art {
  background: radial-gradient(ellipse at 64% 38%, #755391 0%, transparent 55%),
    linear-gradient(148deg, #313158, #241e4a 70%, #493569);
}
:root:not([data-appearance=dark]) .wallet-aura[data-sku=aurora] .shop-art { background: linear-gradient(135deg, #e4f8ef, #ecedf9); }
:root:not([data-appearance=dark]) .wallet-aura[data-sku=solar] .shop-art { background: linear-gradient(135deg, #fff2d7, #f9e3dc); }
:root:not([data-appearance=dark]) .wallet-aura[data-sku=cosmos] .shop-art { background: linear-gradient(135deg, #eee8ff, #f5e5f4); }
.shop-card-avatar.avatar {
  display: grid;
  width: clamp(52px, 6vw, 74px);
  height: clamp(52px, 6vw, 74px);
  font-size: clamp(19px, 2.7vw, 28px);
}

/* The 100-unit artwork fits inside the avatar slot at every size, as on Android. */
.avatar:is([data-aura=aurora], [data-aura=solar], [data-aura=cosmos]) {
  position: relative;
  isolation: isolate;
  border: none;
  background: transparent;
  box-shadow: none;
}
.avatar:is([data-aura=aurora], [data-aura=solar], [data-aura=cosmos])::before,
.avatar:is([data-aura=aurora], [data-aura=solar], [data-aura=cosmos])::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}
.avatar:is([data-aura=aurora], [data-aura=solar], [data-aura=cosmos])::after {
  inset: 12%;
  border-radius: 50%;
  background: var(--aura-background);
}
.avatar:is([data-aura=aurora], [data-aura=solar], [data-aura=cosmos])::before {
  inset: 0;
  background: var(--aura-rim);
  mask: var(--aura-shape) center / contain no-repeat;
}
.avatar[data-aura=aurora] {
  --aura-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='black' stroke-linecap='round'%3E%3Cpath d='M7 54C3 35 18 19 38 13C61 6 79 24 84 38C91 61 84 82 62 87C41 96 19 86 13 69' stroke-width='3.2'/%3E%3Cpath d='M82.45 21.79A43 43 0 0 1 81.45 79.33' stroke-width='1.7'/%3E%3C/svg%3E");
}
.avatar[data-aura=solar] {
  --aura-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='black' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='39' stroke-width='3.2'/%3E%3Cpath stroke-width='2.9' d='M50 1.5V7m0 86v5.5M1.5 50H7m86 0h5.5M26.75 9.73l1.75 3.03m43 74.48 1.75 3.03M9.73 26.75l3.03 1.75m74.48 43 3.03 1.75M73.25 9.73l-1.75 3.03m-43 74.48-1.75 3.03M9.73 73.25l3.03-1.75m74.48-43 3.03-1.75'/%3E%3C/svg%3E");
}
.avatar[data-aura=cosmos] {
  --aura-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='black' stroke-linecap='round'%3E%3Ccircle cx='50' cy='50' r='39' stroke-width='3.2'/%3E%3Cpath transform='rotate(-29 50 50)' d='M95.1 44.2A48 17 0 1 1 3.4 45.9' stroke-width='2.4'/%3E%3C/g%3E%3Cpath d='M85 8.5Q85.8 15.2 92.5 16Q85.8 16.8 85 23.5Q84.2 16.8 77.5 16Q84.2 15.2 85 8.5ZM13 75.5Q13.5 79.5 17.5 80Q13.5 80.5 13 84.5Q12.5 80.5 8.5 80Q12.5 79.5 13 75.5Z'/%3E%3C/svg%3E");
}

.shop-card-copy {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  gap: 4px;
  padding: 12px;
}
.shop-card-copy h3 { overflow-wrap: anywhere; font-size: 16px; line-height: 1.25; }
.shop-card-copy p { font-size: 13px; }
.shop-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.shop-price, .shop-owned {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--soft);
  font-size: 13px;
}
.shop-owned { color: var(--muted); font-weight: 650; }
.shop-fit { min-height: 44px; margin-inline-start: auto; }
.shop-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-history { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.shop-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
}
.shop-history li + li { border-top: 1px solid var(--line); }
.shop-history small { display: block; margin-top: 4px; color: var(--muted); }

#dialog.aura-dialog { width: min(520px, calc(100% - 24px)); }
.aura-preview { display: grid; gap: 12px; }
.aura-context-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.aura-context-options button {
  min-height: 44px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.aura-context-options button[aria-pressed=true] {
  border-color: var(--profile-accent);
  background: var(--soft);
  color: var(--profile-accent);
}
.aura-context {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 135px;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--profile-canvas);
}
.aura-context-profile { justify-content: center; padding-inline: 18px; background: linear-gradient(128deg, var(--profile-card-start), var(--profile-card-end)); }
.aura-context .avatar:not(.profile-card-avatar) { height: 48px; flex-basis: 48px; }
.aura-context-copy { flex: 1; }
.aura-context-copy > :is(strong,small) { max-width: 100%; overflow-wrap: anywhere; }
.aura-context-copy small, .aura-context time { color: var(--muted); font-size: 13px; }
.aura-context-list { min-height: 74px; }
.aura-context-chat { display: grid; align-content: start; background: var(--canvas); }
.aura-context-head { display: flex; align-items: center; gap: 10px; }
.aura-context-message {
  justify-self: start;
  padding: 8px 12px;
  border-radius: 16px;
  background: var(--incoming);
  color: var(--ink);
  font-size: 14px;
}
.aura-context-outgoing { justify-self: end; background: var(--outgoing); color: var(--outgoing-ink); }
.aura-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.aura-offer > .primary { flex: 1 1 auto; }
.aura-offer > .profile-note { flex-basis: 100%; }
.aura-confirmation { display: grid; gap: 10px; }
.aura-purchase-heading { display: flex; align-items: center; gap: 12px; }
.aura-purchase-heading .avatar { flex: 0 0 44px; height: 44px; }
.aura-purchase-heading h3 { margin: 0; line-height: 1.2; }
.aura-confirmation dl {
  display: grid;
  gap: 10px;
  margin: 0 0 4px;
  padding: 14px;
  border-radius: 14px;
  background: var(--soft);
}
.aura-confirmation dl > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.aura-confirmation dt { color: var(--muted); }
.aura-confirmation dd { margin: 0 0 0 auto; }
.aura-confirmation dl > :last-child { border-top: 1px solid var(--line); padding-top: 10px; }
.aura-confirmation dl > :last-child dt { color: var(--ink); font-weight: 650; }
.aura-dialog :is(.aura-offer, .aura-confirmation) .primary { margin-top: 0; justify-content: center; }

@media (max-width: 690px) {
  .messenger.has-profile-view > .sidebar { display: none; }
  .profile-view { grid-template-rows: auto minmax(0, 1fr) auto; }
  .profile-view-header { min-height: 58px; padding: 6px 16px; }
  .profile-content, .profile-content:has(.shop-wallet) { gap: 14px; padding-top: 14px; }
  #profile-navigation { display: grid; }
  .profile-card { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 16px; text-align: center; }
  .profile-card-identity { flex: auto; flex-direction: column; gap: 5px; }
  .profile-card-copy { justify-items: center; }
  .sparks-balance { padding: 14px 16px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .shop-art { min-height: 92px; aspect-ratio: 1.65; }
  .shop-card-copy { padding: 8px 10px; }
  .shop-card-actions { align-items: flex-start; flex-direction: column; margin-top: 2px; }
  .shop-fit { width: 100%; margin-top: 5px; }
}

@media (max-width: 340px) {
  .profile-card { padding-inline: 14px; }
  .shop-card-copy h3 { font-size: 15px; }
  .shop-card-actions { gap: 3px; }
  .shop-fit { padding-inline: 7px; }
}
