.qp-profile-page-body {
  background: #f4f6fb;
}

.qp-profile-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
  color: #111827;
}

.qp-profile-loading,
.qp-profile-error {
  min-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #64748b;
}

.qp-profile-loading span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6d28d9;
  animation: qp-profile-loading 900ms ease-in-out infinite alternate;
}

.qp-profile-loading span:nth-child(2) { animation-delay: 150ms; }
.qp-profile-loading span:nth-child(3) { animation-delay: 300ms; }
.qp-profile-loading b { margin-left: 6px; }

@keyframes qp-profile-loading {
  to { transform: translateY(-7px); opacity: .45; }
}

.qp-profile-hero {
  --qp-text: #fff;
  --qp-muted: #c7d0df;
  min-height: 300px;
  display: grid;
  grid-template-columns: 164px minmax(300px, 1fr) 360px;
  align-items: center;
  gap: 34px;
  padding: 36px;
  border: 1px solid #263249;
  border-radius: 8px;
  color: #fff;
  background: #151e2f;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .16);
  position: relative;
  overflow: hidden;
}

.qp-profile-avatar-wrap {
  width: 164px;
  height: 164px;
  position: relative;
}

.qp-profile-avatar-visual {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #ede9fe;
  color: #1f2937;
  font-size: 76px;
  box-shadow: 0 12px 28px rgba(17, 24, 39, .24);
  overflow: hidden;
}

.qp-profile-avatar-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qp-profile-avatar-visual.is-editable {
  cursor: pointer;
}

.qp-profile-avatar-visual.is-editable i {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 17px;
  font-style: normal;
  transition: transform 160ms ease, background 160ms ease;
}

.qp-profile-avatar-visual.is-editable:hover i {
  transform: scale(1.08);
  background: #0f766e;
}

.qp-profile-presence {
  position: absolute;
  right: 5px;
  top: 12px;
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #94a3b8;
}

.qp-profile-presence.online { background: #22c55e; }

.qp-profile-photo-reset {
  position: absolute;
  left: 5px;
  bottom: 7px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.75);
  border-radius: 50%;
  background: #312e81;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
}

.qp-profile-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.qp-profile-name-line h2 {
  margin: 0;
  color: #fff;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.qp-profile-level {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #2b3b5b;
  color: #e0e7ff;
  font-size: 12px;
  font-weight: 900;
}

.qp-user-profile-identity {
  min-width: 0;
}

.qp-user-profile-handle {
  margin: 8px 0 14px;
  color: #aebbd1;
  font-weight: 700;
}

.qp-profile-hero .qp-user-profile-handle { color: #aebbd1; }

.qp-profile-bio {
  max-width: 670px;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  line-height: 1.5;
}

.qp-profile-bio > span { white-space: pre-line; }

.qp-profile-bio > button,
.qp-profile-bio > div button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  cursor: pointer;
}

.qp-profile-bio textarea {
  width: min(620px, 100%);
  min-height: 84px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  color: #111827;
  font: inherit;
  resize: vertical;
}

.qp-profile-bio > div { display: grid; gap: 7px; }

.qp-profile-messenger header small i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.qp-profile-messenger header small i.online { background: #22c55e; }

.qp-profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.qp-profile-summary-grid article {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid #2c3850;
  border-radius: 6px;
  background: #1e293d;
}

.qp-profile-summary-grid small {
  color: #c7d0df;
  font-size: 14px;
  font-weight: 800;
}

.qp-profile-summary-grid strong {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 27px;
  line-height: 1;
}

.qp-profile-summary-grid strong span { color: #f59e0b; font-size: 22px; }
.qp-profile-summary-grid .completed strong span { color: #38bdf8; }
.qp-profile-summary-grid .badges strong span { color: #c084fc; }
.qp-profile-summary-grid .streak strong span { color: #22c55e; }

.qp-user-profile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.qp-profile-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.46);
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.qp-profile-action.strong { background: #fff; color: #172033; }
.qp-profile-action:hover { transform: translateY(-2px); background: rgba(255,255,255,.2); }
.qp-profile-action.strong:hover { background: #f0fdfa; }

.qp-profile-ranks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.qp-profile-rank-card {
  min-height: 132px;
  display: grid;
  grid-template-columns: 56px minmax(92px, 1fr) 82px;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.qp-profile-rank-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 26px;
}

.qp-profile-rank-card.teachers .qp-profile-rank-icon { background: #dcfce7; color: #15803d; }
.qp-profile-rank-card.students .qp-profile-rank-icon { background: #dbeafe; color: #2563eb; }

.qp-profile-rank-card > div:not(.qp-profile-mini-graph) { display: grid; gap: 3px; }
.qp-profile-rank-card small { color: #64748b; font-weight: 800; }
.qp-profile-rank-card strong { font-size: 25px; }
.qp-profile-rank-card em { color: #6d28d9; font-size: 12px; font-style: normal; font-weight: 900; }
.qp-profile-rank-card.teachers em { color: #15803d; }
.qp-profile-rank-card.students em { color: #2563eb; }

.qp-profile-mini-graph {
  height: 54px;
  display: flex;
  align-items: end;
  gap: 4px;
}

.qp-profile-mini-graph span {
  width: 7px;
  min-height: 6px;
  border-radius: 3px 3px 0 0;
  background: #8b5cf6;
  transition: height 280ms ease;
}

.qp-profile-rank-card.teachers .qp-profile-mini-graph span { background: #22c55e; }
.qp-profile-rank-card.students .qp-profile-mini-graph span { background: #3b82f6; }

.qp-profile-badges-section {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.qp-profile-badges-section > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.qp-profile-badges-section > header span { color: #6d28d9; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.qp-profile-badges-section h2 { margin: 3px 0 0; font-size: 23px; }
.qp-profile-badges-section > header > strong { color: #64748b; }

.qp-profile-badges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.qp-profile-badge {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 10px;
  text-align: center;
}

.qp-profile-badge-shape {
  width: 72px;
  height: 78px;
  display: grid;
  place-items: center;
  background: #6d28d9;
  color: #fff;
  clip-path: polygon(50% 0, 92% 22%, 92% 72%, 50% 100%, 8% 72%, 8% 22%);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.2);
}

.qp-profile-badge:nth-child(2) .qp-profile-badge-shape { background: #2563eb; }
.qp-profile-badge:nth-child(3) .qp-profile-badge-shape { background: #059669; }
.qp-profile-badge:nth-child(4) .qp-profile-badge-shape { background: #d97706; }
.qp-profile-badge-shape span { font-size: 32px; }
.qp-profile-badge small { color: #64748b; }
.qp-profile-badge.locked { opacity: .43; filter: grayscale(.65); }

.qp-profile-next-badge {
  display: grid;
  grid-template-columns: 44px minmax(180px, auto) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.qp-profile-next-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fef3c7;
  color: #b45309;
  font-size: 20px;
  font-weight: 900;
}

.qp-profile-next-badge > div:nth-child(2) { display: grid; }
.qp-profile-next-badge small,
.qp-profile-next-badge em { color: #64748b; font-size: 12px; font-style: normal; }
.qp-profile-next-progress { height: 9px; overflow: hidden; border-radius: 99px; background: #e2e8f0; }
.qp-profile-next-progress span { display: block; height: 100%; border-radius: inherit; background: #14b8a6; }

.qp-profile-messenger {
  position: fixed;
  z-index: 120;
  right: 24px;
  bottom: 24px;
  width: min(370px, calc(100vw - 32px));
  height: min(570px, calc(100dvh - 120px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(30, 15, 66, .28);
  overflow: hidden;
}

.qp-profile-messenger[hidden] { display: none; }
.qp-profile-messenger.minimized { height: 72px; grid-template-rows: 72px; }
.qp-profile-messenger.minimized .qp-profile-message-body,
.qp-profile-messenger.minimized footer { display: none; }

.qp-profile-messenger > header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: #5b21b6;
  color: #fff;
}

.qp-profile-messenger header > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qp-profile-messenger header .qp-profile-avatar-visual { width: 46px; height: 46px; border-width: 2px; font-size: 23px; flex: 0 0 auto; }
.qp-profile-messenger header > div > span { display: grid; min-width: 0; }
.qp-profile-messenger header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-profile-messenger header small { display: flex; align-items: center; gap: 6px; color: #ddd6fe; }
.qp-profile-message-heading { width: 46px; height: 46px; display: grid !important; place-items: center; border-radius: 50%; background: rgba(255,255,255,.14); font-size: 22px; }
.qp-profile-messenger header nav { display: flex; gap: 5px; }
.qp-profile-messenger header button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
.qp-profile-messenger header button:hover { background: rgba(255,255,255,.16); }

.qp-profile-message-body {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  background: #f8fafc;
  position: relative;
}

.qp-profile-message-search { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; margin: 12px 12px 8px; padding: 0 10px; border: 1px solid #dbe3ee; border-radius: 8px; background: #fff; color: #64748b; }
.qp-profile-message-search:focus-within { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.qp-profile-message-search input { min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; color: #111827; font: inherit; }
.qp-profile-message-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.qp-profile-message-placeholder { display: grid; place-items: center; gap: 7px; max-width: 230px; text-align: center; }
.qp-profile-message-content > .qp-profile-message-placeholder { min-height: 100%; margin: auto; padding: 24px; }
.qp-profile-message-placeholder.compact { min-height: 150px; }
.qp-profile-message-placeholder > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: #ede9fe; color: #6d28d9; font-size: 25px; }
.qp-profile-message-placeholder p { margin: 0; color: #64748b; line-height: 1.45; }

.qp-profile-message-user-list { display: grid; gap: 2px; padding: 2px 8px 12px; }
.qp-profile-message-user { width: 100%; min-width: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px; border: 0; border-radius: 8px; background: transparent; color: #111827; text-align: left; cursor: pointer; }
.qp-profile-message-user:hover,
.qp-profile-message-user:focus-visible { background: #ede9fe; outline: 0; }
.qp-profile-message-user-avatar { position: relative; width: 44px; height: 44px; }
.qp-profile-message-user-avatar .qp-profile-avatar-visual { width: 44px; height: 44px; border-width: 1px; font-size: 23px; }
.qp-profile-message-user-avatar > i { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: #94a3b8; }
.qp-profile-message-user-avatar > i.online { background: #22c55e; }
.qp-profile-message-user > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.qp-profile-message-user strong,
.qp-profile-message-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-profile-message-user small { color: #64748b; font-size: 11px; }
.qp-profile-message-user > b { min-width: 24px; padding: 4px 7px; border-radius: 99px; background: #6d28d9; color: #fff; font-size: 10px; text-align: center; }

.qp-profile-message-thread { min-height: 100%; display: flex; flex-direction: column; gap: 8px; padding: 8px 12px 14px; overflow-y: auto; }
.qp-profile-message-bubble { max-width: 82%; display: grid; gap: 4px; align-self: flex-start; padding: 9px 11px 7px; border-radius: 8px 8px 8px 2px; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.1); }
.qp-profile-message-bubble.is-own { align-self: flex-end; border-radius: 8px 8px 2px 8px; background: #6d28d9; color: #fff; }
.qp-profile-message-bubble p { margin: 0; overflow-wrap: anywhere; line-height: 1.38; white-space: normal; }
.qp-profile-message-bubble time { color: #94a3b8; font-size: 9px; text-align: right; }
.qp-profile-message-bubble.is-own time { color: #ddd6fe; }

.qp-profile-messenger > footer { padding: 12px; border-top: 1px solid #e2e8f0; }
.qp-profile-message-input { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.qp-profile-message-input:focus-within { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.qp-profile-message-input textarea { min-width: 0; max-height: 84px; resize: none; padding: 11px 2px; border: 0; outline: 0; background: transparent; color: #111827; font: inherit; line-height: 1.35; }
.qp-profile-message-input button { height: 38px; border: 0; background: transparent; color: #6d28d9; cursor: pointer; font-size: 18px; }
.qp-profile-message-input button:hover { color: #4c1d95; }
.qp-profile-message-input button:disabled { opacity: .4; cursor: wait; }
.qp-profile-message-reactions { display: flex; gap: 5px; margin-top: 8px; }
.qp-profile-message-reactions[hidden] { display: none; }
.qp-profile-message-reactions button { width: 34px; height: 32px; border: 0; border-radius: 6px; background: #f1f5f9; cursor: pointer; }
.qp-profile-message-reactions button:hover { background: #ede9fe; }

.qp-profile-error { flex-direction: column; text-align: center; }
.qp-profile-error > span { font-size: 54px; }
.qp-profile-error h2, .qp-profile-error p { margin: 0; }

.qp-profile-page.is-uploading-photo .qp-profile-avatar-visual { opacity: .5; pointer-events: none; }

@media (max-width: 1040px) {
  .qp-profile-hero { grid-template-columns: 150px 1fr; padding: 28px; }
  .qp-profile-avatar-wrap { width: 140px; height: 140px; }
  .qp-profile-summary-grid { grid-column: 1 / -1; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qp-profile-summary-grid article { min-height: 88px; }
  .qp-profile-rank-card { grid-template-columns: 48px 1fr; }
  .qp-profile-rank-card .qp-profile-mini-graph { grid-column: 1 / -1; height: 32px; }
}

@media (max-width: 700px) {
  .qp-profile-page { padding: 14px 12px 28px; }
  .qp-profile-hero { grid-template-columns: 1fr; justify-items: center; gap: 18px; padding: 24px 18px; text-align: center; }
  .qp-profile-avatar-wrap { width: 132px; height: 132px; }
  .qp-profile-avatar-visual { font-size: 62px; }
  .qp-profile-name-line { justify-content: center; }
  .qp-profile-name-line h2 { font-size: 30px; }
  .qp-profile-bio { justify-content: center; }
  .qp-user-profile-actions { width: 100%; justify-content: center; }
  .qp-profile-action { flex: 1; max-width: 180px; padding-inline: 10px; }
  .qp-profile-summary-grid { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qp-profile-summary-grid article { min-height: 94px; padding: 15px; text-align: left; }
  .qp-profile-summary-grid strong { font-size: 24px; }
  .qp-profile-ranks { grid-template-columns: 1fr; }
  .qp-profile-rank-card { grid-template-columns: 52px 1fr 88px; min-height: 108px; }
  .qp-profile-rank-card .qp-profile-mini-graph { grid-column: auto; height: 48px; }
  .qp-profile-badges-section { padding: 18px 14px; }
  .qp-profile-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qp-profile-next-badge { grid-template-columns: 42px 1fr auto; }
  .qp-profile-next-progress { grid-column: 1 / -1; grid-row: 2; }
  .qp-profile-messenger { right: 10px; bottom: calc(var(--qp-mobile-bottom-nav-height, 78px) + 10px); width: calc(100% - 20px); height: min(560px, calc(100dvh - 174px)); }
}

@media (prefers-reduced-motion: reduce) {
  .qp-profile-loading span,
  .qp-profile-action,
  .qp-profile-avatar-visual.is-editable i,
  .qp-profile-mini-graph span { animation: none; transition: none; }
}

/* ==========================================================================
   Beautiful Accounts.
   Every value below is driven by a custom property the page sets from a
   server-validated payload (two palette stops, an ink colour, an accent and a
   font stack from a fixed list). No rule here interpolates anything a user
   typed, so a decorated profile cannot style anybody else's page.
   ========================================================================== */

.qp-beautiful {
  --bf-from: #7c3aed;
  --bf-to: #22d3ee;
  --bf-ink: #f8fafc;
  --bf-accent: #22d3ee;
  --bf-font: inherit;
  position: relative;
  isolation: isolate;
  border-radius: 22px;
  padding: clamp(12px, 2vw, 20px);
  overflow: hidden;
}

/* The backdrop sits behind everything and never intercepts a click. */
.qp-beautiful::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--bf-from), var(--bf-to));
  opacity: .16;
}

.qp-beautiful[data-bf-background="nebula"]::before {
  background:
    radial-gradient(60% 55% at 18% 20%, var(--bf-from) 0%, transparent 62%),
    radial-gradient(55% 50% at 82% 30%, var(--bf-to) 0%, transparent 60%),
    radial-gradient(70% 60% at 50% 100%, var(--bf-accent) 0%, transparent 65%);
  opacity: .26;
}
.qp-beautiful[data-bf-background="waves"]::before {
  background:
    repeating-linear-gradient(115deg, var(--bf-from) 0 18px, transparent 18px 46px),
    linear-gradient(135deg, var(--bf-to), var(--bf-from));
  opacity: .17;
}
.qp-beautiful[data-bf-background="starfield"]::before {
  background:
    radial-gradient(1.6px 1.6px at 12% 22%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 38% 66%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 68% 18%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 84% 74%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 42%, var(--bf-ink) 50%, transparent 51%),
    linear-gradient(160deg, var(--bf-from), var(--bf-to));
  opacity: .3;
}
.qp-beautiful[data-bf-background="grid"]::before {
  background:
    repeating-linear-gradient(0deg, var(--bf-accent) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, var(--bf-accent) 0 1px, transparent 1px 34px),
    linear-gradient(135deg, var(--bf-from), var(--bf-to));
  opacity: .15;
}
.qp-beautiful[data-bf-background="veil"]::before {
  background: conic-gradient(from 200deg at 50% 50%, var(--bf-from), var(--bf-to), var(--bf-accent), var(--bf-from));
  opacity: .2;
  filter: blur(28px);
}
.qp-beautiful[data-bf-background="plain"]::before { opacity: .1; }

/* -- the name ------------------------------------------------------------- */

.qp-beautiful .qp-profile-name-line h2 {
  font-family: var(--bf-font);
  letter-spacing: .2px;
}
.qp-beautiful[data-bf-name="gradient"] .qp-profile-name-line h2 {
  background: linear-gradient(100deg, var(--bf-from), var(--bf-accent), var(--bf-to));
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.qp-beautiful[data-bf-name="outline"] .qp-profile-name-line h2 {
  color: transparent;
  -webkit-text-stroke: 1.4px var(--bf-accent);
  text-shadow: none;
}
.qp-beautiful[data-bf-name="engraved"] .qp-profile-name-line h2 {
  color: var(--bf-accent);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35), 0 -1px 0 rgba(15, 23, 42, .55);
}
.qp-beautiful[data-bf-name="solid"] .qp-profile-name-line h2 { color: var(--bf-accent); }

.qp-beautiful.bf-glow .qp-profile-name-line h2 {
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--bf-accent) 60%, transparent));
}
.qp-beautiful.bf-glow .qp-profile-avatar-wrap {
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--bf-from) 55%, transparent));
}
.qp-beautiful .qp-user-profile-handle { font-family: var(--bf-font); }

/* -- the badge ------------------------------------------------------------ */

.qp-beautiful-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 7px 13px 7px 10px;
  border: 1px solid color-mix(in srgb, var(--bf-accent) 55%, transparent);
  border-radius: 999px;
  background: linear-gradient(120deg,
    color-mix(in srgb, var(--bf-from) 26%, transparent),
    color-mix(in srgb, var(--bf-to) 26%, transparent));
}
.qp-beautiful-badge-mark { font-size: 16px; color: var(--bf-accent); }
.qp-beautiful-badge-text { display: grid; }
.qp-beautiful-badge-text b { font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.qp-beautiful-badge-text small { font-size: 12px; font-weight: 700; opacity: .82; }

/* -- the resting animation ------------------------------------------------ */

.qp-beautiful[data-bf-animation="float"] .qp-profile-avatar-wrap { animation: bf-float 4.5s ease-in-out infinite; }
.qp-beautiful[data-bf-animation="pulse"] .qp-profile-avatar-wrap { animation: bf-pulse 2.8s ease-in-out infinite; }
.qp-beautiful[data-bf-animation="bounce"] .qp-profile-avatar-wrap { animation: bf-bounce 2.2s cubic-bezier(.3, .7, .4, 1) infinite; }
.qp-beautiful[data-bf-animation="shimmer"][data-bf-name="gradient"] .qp-profile-name-line h2 {
  animation: bf-shimmer 3.4s linear infinite;
}

@keyframes bf-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes bf-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.055); } }
@keyframes bf-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-13px); } 60% { transform: translateY(-4px); } }
@keyframes bf-shimmer { to { background-position: 220% 0; } }

/* Sparkles drifting behind the hero. */
.qp-beautiful .qp-profile-hero { position: relative; isolation: isolate; }
.qp-beautiful.bf-sparkles .qp-profile-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(2px 2px at 14% 26%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 72% 18%, var(--bf-accent) 50%, transparent 51%),
    radial-gradient(2.2px 2.2px at 46% 78%, var(--bf-ink) 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 88% 62%, var(--bf-accent) 50%, transparent 51%);
  animation: bf-twinkle 3.6s ease-in-out infinite;
}
@keyframes bf-twinkle { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }

/* ==========================================================================
   The arrival celebration. Two and a half seconds, then it takes itself off
   the page: it is a greeting, not a permanent decoration.
   ========================================================================== */

.qp-beautiful-celebration {
  position: fixed;
  inset: 0;
  z-index: 2600;
  overflow: hidden;
  pointer-events: none;
  transition: opacity .4s ease;
}
.qp-beautiful-celebration.is-leaving { opacity: 0; }
.qp-beautiful-celebration .bf-layer { position: absolute; inset: 0; }
.qp-beautiful-celebration i { position: absolute; display: block; }

.bf-balloon {
  left: var(--x);
  bottom: -16vh;
  width: 34px;
  height: 43px;
  border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55), var(--tint) 62%);
  animation: bf-rise 2.6s cubic-bezier(.3, .5, .3, 1) var(--delay) forwards;
}
.bf-balloon::after {
  content: "";
  position: absolute;
  top: 43px;
  left: 50%;
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, .5);
}
@keyframes bf-rise {
  from { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  to { transform: translate(var(--drift), -122vh) rotate(9deg); opacity: 0; }
}

.bf-confetto {
  left: var(--x);
  top: -8vh;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  background: var(--tint);
  animation: bf-fall 2.5s cubic-bezier(.25, .6, .4, 1) var(--delay) forwards;
}
.bf-confetto:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
.bf-confetto:nth-child(4n) { width: 13px; height: 5px; }
@keyframes bf-fall {
  from { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  to { transform: translate3d(24px, var(--fall), 0) rotate(var(--spin)); opacity: 0; }
}

.bf-sparkle {
  left: var(--x);
  top: var(--y);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #fff 0 22%, transparent 60%);
  animation: bf-pop 1.5s ease-out var(--delay) forwards;
}
.bf-sparkle::before,
.bf-sparkle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(#fff, #fff) center/100% 2px no-repeat;
}
.bf-sparkle::after { transform: rotate(90deg); }
@keyframes bf-pop {
  from { transform: scale(0) rotate(0deg); opacity: 0; }
  40% { transform: scale(1.15) rotate(45deg); opacity: 1; }
  to { transform: scale(0) rotate(120deg); opacity: 0; }
}

.bf-orb {
  left: var(--x);
  bottom: -10vh;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .85), rgba(255, 255, 255, .06));
  animation: bf-drift 2.6s ease-out var(--delay) forwards;
}
@keyframes bf-drift {
  from { transform: translateY(0) scale(.6); opacity: 0; }
  20% { opacity: .9; }
  to { transform: translateY(-105vh) scale(1.15); opacity: 0; }
}

/* High enough to clear the profile identity underneath: the greeting should
   not spend its two seconds sitting on top of the name it is greeting. */
.bf-welcome {
  position: absolute;
  top: 13%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(88vw, 620px);
  padding: 16px 26px;
  color: #fff;
  background: linear-gradient(120deg, rgba(15, 23, 42, .92), rgba(30, 27, 75, .92));
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  box-shadow: 0 24px 60px rgba(8, 12, 24, .5);
  transform: translate(-50%, -50%);
  animation: bf-welcome 2.6s cubic-bezier(.2, .9, .3, 1) forwards;
}
.bf-welcome span { font-size: 22px; }
.bf-welcome b { font-size: clamp(15px, 3.4vw, 21px); font-weight: 900; }
@keyframes bf-welcome {
  from { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
  24% { transform: translate(-50%, -50%) scale(1); }
  82% { opacity: 1; }
  to { transform: translate(-50%, -62%) scale(.96); opacity: 0; }
}

/* -- the owner's customisation header ------------------------------------- */

.qp-beautiful-editor {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--bf-accent, #7c3aed) 45%, transparent);
  border-radius: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bf-from, #7c3aed) 16%, transparent),
    color-mix(in srgb, var(--bf-to, #22d3ee) 16%, transparent));
}
.qp-beautiful-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.qp-beautiful-editor-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bf-accent, #7c3aed);
}
.qp-beautiful-editor-head h2 { margin: 4px 0 2px; font-size: 20px; font-weight: 900; }
.qp-beautiful-editor-head p { margin: 0; font-size: 12px; font-weight: 700; opacity: .75; }
.qp-beautiful-editor-actions { display: flex; gap: 8px; }

.qp-beautiful-editor-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.qp-beautiful-editor-body[hidden] { display: none; }
.bf-field { display: grid; gap: 7px; align-content: start; }
.bf-field-wide { grid-column: 1 / -1; }
.bf-label { font-size: 11px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; opacity: .72; }
.bf-label em { font-style: normal; font-weight: 700; text-transform: none; letter-spacing: 0; opacity: .7; }

.bf-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--a), var(--b));
  cursor: pointer;
}
.bf-swatch.is-on { border-color: #fff; box-shadow: 0 0 0 2px var(--bf-accent, #7c3aed); }

.bf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-chip {
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
  color: inherit;
  background: rgba(127, 127, 127, .14);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}
.bf-chip.is-on {
  color: #fff;
  background: linear-gradient(120deg, var(--bf-from, #7c3aed), var(--bf-to, #22d3ee));
  border-color: var(--bf-accent, #7c3aed);
}

.bf-accent-row { display: flex; align-items: center; gap: 8px; }
.bf-accent-row input[type="color"] {
  width: 46px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(127, 127, 127, .35);
  border-radius: 9px;
  background: none;
  cursor: pointer;
}
.bf-toggles { display: grid; gap: 6px; }
.bf-toggles label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; cursor: pointer; }
.bf-toggles input { width: 17px; height: 17px; accent-color: var(--bf-accent, #7c3aed); }

.bf-save-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}
.bf-save-state { font-size: 12px; font-weight: 800; opacity: .78; }

@media (prefers-reduced-motion: reduce) {
  .qp-beautiful .qp-profile-avatar-wrap,
  .qp-beautiful .qp-profile-name-line h2,
  .qp-beautiful.bf-sparkles .qp-profile-hero::after { animation: none; }
  .qp-beautiful-celebration { display: none; }
}

/* ==========================================================================
   Beautiful Accounts, second pass: a bigger balloon swarm, party streamers,
   lightning, and the customisation moved into its own profile tab.
   ========================================================================== */

/* -- balloons: a crowd, at three depths ----------------------------------- */

.bf-balloon {
  transform-origin: 50% 100%;
  scale: var(--scale, 1);
}
/* The far layer is smaller, dimmer and slower, so thirty-four balloons read as
   depth rather than as one flat row of the same balloon. */
.bf-depth-0 { opacity: .72; filter: blur(.6px); animation-duration: 2.9s; }
.bf-depth-1 { opacity: .88; animation-duration: 2.6s; }
.bf-depth-2 { opacity: 1; animation-duration: 2.35s; }

@keyframes bf-rise {
  from { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  45% { transform: translate(calc(var(--drift) * .55), -55vh) rotate(calc(var(--sway, 1) * 5deg)); }
  to { transform: translate(var(--drift), -128vh) rotate(calc(var(--sway, 1) * -7deg)); opacity: 0; }
}

/* -- party: streamers from the bottom corners, and poppers ---------------- */

/* A curled ribbon rather than a straight dashed line: one curved edge of a very
   tall ellipse reads as a streamer arcing out of a popper, where a rotated bar
   just read as a laser. */
.bf-streamer {
  bottom: -4vh;
  width: 42px;
  height: var(--reach, 62vh);
  border-left: 5px solid var(--tint);
  border-radius: 60% 0 0 60% / 50% 0 0 50%;
  transform-origin: 50% 100%;
  animation: bf-streamer 2.5s cubic-bezier(.15, .8, .3, 1) var(--delay) forwards;
}
/* The two sides curl opposite ways, so they open outward from the corners. */
.bf-from-right {
  border-left: 0;
  border-right: 5px solid var(--tint);
  border-radius: 0 60% 60% 0 / 0 50% 50% 0;
}
.bf-from-left { left: 2%; --spread: 1; }
.bf-from-right { right: 2%; --spread: -1; }
.bf-streamer { opacity: .9; }
@keyframes bf-streamer {
  from { transform: rotate(calc(var(--spread) * var(--angle))) scaleY(0); opacity: 0; }
  18% { opacity: 1; }
  60% { transform: rotate(calc(var(--spread) * var(--angle) * 1.15)) scaleY(1); opacity: 1; }
  to { transform: rotate(calc(var(--spread) * var(--angle) * 1.35)) scaleY(1) translateY(24vh); opacity: 0; }
}

.bf-popper {
  left: var(--x);
  bottom: -6vh;
  font-size: 26px;
  font-style: normal;
  line-height: 1;
  animation: bf-popper 2.5s cubic-bezier(.2, .7, .35, 1) var(--delay) forwards;
}
@keyframes bf-popper {
  from { transform: translateY(0) rotate(0deg) scale(.5); opacity: 0; }
  16% { opacity: 1; }
  to { transform: translateY(calc(var(--lift) * -1)) rotate(28deg) scale(1.15); opacity: 0; }
}

/* -- lightning: a bolt, and the flash it throws --------------------------- */

.bf-bolt {
  left: var(--x);
  top: -2vh;
  width: 46px;
  height: 52vh;
  background: linear-gradient(180deg, #fff, #e0e7ff 45%, transparent);
  /* Drawn rather than drawn-on: a zigzag clipped out of a soft gradient. */
  clip-path: polygon(52% 0%, 24% 46%, 46% 46%, 18% 100%, 72% 40%, 46% 40%, 78% 0%);
  filter: drop-shadow(0 0 14px rgba(191, 219, 254, .95));
  transform: rotate(var(--tilt, 0deg));
  opacity: 0;
  animation: bf-strike 2.4s steps(1, end) var(--delay) forwards;
}
@keyframes bf-strike {
  0%, 4% { opacity: 0; }
  5% { opacity: 1; }
  8% { opacity: 0; }
  11% { opacity: .95; }
  16% { opacity: 0; }
  100% { opacity: 0; }
}

/* The flash is the light the bolt casts on the room, not a second bolt. */
.bf-flash {
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  opacity: 0;
  animation: bf-flash 2.4s steps(1, end) forwards;
}
@keyframes bf-flash {
  0%, 4% { opacity: 0; }
  5% { opacity: .34; }
  8% { opacity: 0; }
  26% { opacity: 0; }
  27% { opacity: .22; }
  30% { opacity: 0; }
  52% { opacity: 0; }
  53% { opacity: .28; }
  57% { opacity: 0; }
  100% { opacity: 0; }
}

/* -- the customisation tab ------------------------------------------------- */

.qp-profile-tab-beautiful[aria-selected="true"] { color: var(--bf-accent, #7c3aed); }
.qp-profile-tab-beautiful span { margin-right: 4px; }

/* In a tab it is the whole panel, not a bar squeezed above the profile. The
   floating chat launcher sits fixed in the bottom-right corner, which is where
   Save would otherwise land: the panel keeps enough room below the buttons for
   the launcher to float clear of them. */
.qp-profile-tab-panel[data-profile-panel="beautiful"] .qp-beautiful-editor {
  margin-bottom: 0;
  padding-bottom: 84px;
}
.qp-profile-tab-panel[data-profile-panel="beautiful"] .bf-save-row {
  /* And the buttons stop short of the corner rather than running into it. */
  padding-right: clamp(0px, 6vw, 76px);
}

.bf-save-buttons { display: flex; align-items: center; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .bf-balloon,
  .bf-streamer,
  .bf-popper,
  .bf-bolt,
  .bf-flash { animation: none; }
}
