/* ============================================================
   profile page
   ============================================================ */

.profile-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 24px 60px;
  min-height: 80vh;
}

/* loading state */
.profile-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 400px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profile-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: profileSpin 0.8s linear infinite;
}

@keyframes profileSpin {
  to {
    transform: rotate(360deg);
  }
}

/* auth required */
.profile-auth-required {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  min-height: 400px;
  padding: 40px;
}

.profile-auth-required h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-auth-required p {
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.6;
}

/* profile header */
.profile-header-section {
  margin-bottom: 32px;
}

.profile-header-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(16,185,129, 0.15);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-avatar-lg--image {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: transparent;
  overflow: hidden;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.profile-header-info {
  flex: 1;
  min-width: 0;
}

.profile-display-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.profile-display-name--empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

.profile-username {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.profile-username--empty {
  color: var(--text-muted);
  font-style: italic;
}

.profile-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

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

.profile-member-since {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.profile-tier-badge--free {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-tier-badge--individual {
  background: rgba(16,185,129, 0.12);
  color: var(--accent);
  border: 1px solid rgba(16,185,129, 0.25);
}

.profile-tier-badge--explorer {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.profile-tier-badge--full {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

/* academy plan subscriber */
.profile-tier-badge--academy {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 102, 0.18));
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

[data-theme="dark"] .profile-tier-badge--academy {
  color: rgb(110, 231, 191);
  border-color: rgba(110, 231, 191, 0.45);
}

/* founding member: restrained gold treatment */
.profile-tier-badge--founding {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px 3px 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.28));
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.45);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 4px 14px -6px rgba(245, 158, 11, 0.35);
}

.profile-tier-badge--founding::before {
  content: "★";
  font-size: 0.9rem;
  line-height: 1;
}

/* matheus 2026-05-19: park the founding-member pill in the top-right
   of the header card so it stamps the card as deliberate status (where
   the old FOUNDER #N gold ribbon used to live). desktop only; on mobile
   it stays inline in the meta row so the compact card layout reads cleanly. */
.profile-header-card[data-membership="founding"] .profile-tier-badge--founding {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
}

@media (max-width: 600px) {
  .profile-header-card[data-membership="founding"] .profile-tier-badge--founding {
    position: static;
  }
}

.profile-tier-badge--alumni {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.16), rgba(251, 191, 36, 0.12));
  color: #cbd5e1;
  border: 1px solid rgba(203, 213, 225, 0.28);
  font-weight: 700;
}

[data-theme="light"] .profile-tier-badge--alumni {
  color: #475569;
  border-color: rgba(71, 85, 105, 0.22);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.18), rgba(245, 158, 11, 0.12));
}

/* prominent founder card treatment: thick gold border, soft outer glow,
   gradient wash on the surface, and a top-edge highlight line */
.profile-header-card[data-membership="founding"] {
  position: relative;
  border: 2px solid rgba(251, 191, 36, 0.7);
  background:
    linear-gradient(135deg,
      rgba(251, 191, 36, 0.12) 0%,
      rgba(251, 191, 36, 0.04) 40%,
      rgba(251, 191, 36, 0.08) 100%),
    var(--glass-bg);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.25),
    0 24px 64px rgba(0, 0, 0, 0.28),
    0 0 38px -10px rgba(251, 191, 36, 0.55),
    inset 0 1px 0 rgba(252, 211, 77, 0.45),
    inset 0 0 24px rgba(251, 191, 36, 0.06);
}

[data-theme="light"] .profile-header-card[data-membership="founding"] {
  border-color: rgba(217, 119, 6, 0.55);
  background:
    linear-gradient(135deg,
      rgba(251, 191, 36, 0.18) 0%,
      rgba(251, 191, 36, 0.06) 40%,
      rgba(251, 191, 36, 0.12) 100%),
    rgba(255, 255, 255, 0.6);
  box-shadow:
    0 0 0 1px rgba(217, 119, 6, 0.18),
    0 18px 48px rgba(217, 119, 6, 0.14),
    0 0 32px -10px rgba(251, 191, 36, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

[data-membership="founding"] .profile-display-name {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 25%, #fcd34d 50%, #fbbf24 75%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.45));
}

[data-membership="alumni"] .profile-display-name {
  color: #cbd5e1;
}

[data-membership="founding"] .profile-avatar-lg {
  box-shadow:
    0 0 0 3px rgba(245, 158, 11, 0.85),
    0 0 0 5px rgba(252, 211, 77, 0.35),
    0 0 36px -6px rgba(251, 191, 36, 0.75);
}

/* stats grid */
.profile-stats-section {
  margin-bottom: 32px;
}

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

/* matheus 2026-05-19: certificate shelf -- a row of cert "trophies" with
   the course badge artwork. hover lifts the card on desktop; click opens
   the full certificate via the existing generateXxxCertificate flow. */
.profile-cert-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.profile-cert-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.07) 0%,
      rgba(255, 255, 255, 0.02) 50%,
      rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

@media (hover: hover) {
  .profile-cert-card:hover {
    transform: translateY(-3px);
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 18px 36px -16px rgba(251, 191, 36, 0.35);
  }
}

.profile-cert-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.profile-cert-card-art {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
}

.profile-cert-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-cert-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.profile-cert-card-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.92rem;
}

.profile-cert-card-date {
  color: var(--text-muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

[data-theme="light"] .profile-cert-card {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(0, 0, 0, 0.08);
}

/* stat cards -- carries the new landing's design language (hero-product-mockup.css):
   a hairline-bordered light/glass card with a single mountain-meadow green
   accent, a left-aligned icon+label header, a big value, and a green-glow
   hover lift with a diagonal shine sweep (mirrors .hero-proof-card). the old
   centered, rainbow-icon dashboard look is replaced so the profile reads as
   the same product as the landing. */
.profile-stat-card {
  --stat-accent: #10b981;
  --stat-accent-dark: #059669;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 132px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background:
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.06), transparent 42%),
    rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.2s ease;
}

/* diagonal shine sweep on hover, lifted straight from .hero-proof-card */
.profile-stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
      transparent 0 34%,
      rgba(16, 185, 129, 0.08) 45%,
      transparent 58% 100%);
  opacity: 0;
  transform: translateX(-42%);
  transition: opacity 0.22s ease, transform 0.45s cubic-bezier(0.33, 1, 0.68, 1);
  pointer-events: none;
}

@media (hover: hover) {
  .profile-stat-card:hover {
    border-color: rgba(16, 185, 129, 0.24);
    background:
      radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.08), transparent 42%),
      rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
  }

  .profile-stat-card:hover::after {
    opacity: 1;
    transform: translateX(42%);
  }

  .profile-stat-card:hover .profile-stat-icon {
    color: var(--stat-accent-dark);
    transform: scale(1.06);
  }
}

[data-theme="dark"] .profile-stat-card {
  border-color: rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.07), transparent 42%),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .profile-stat-card::after {
  background: linear-gradient(120deg,
      transparent 0 34%,
      rgba(16, 185, 129, 0.12) 45%,
      transparent 58% 100%);
}

@media (hover: hover) {
  [data-theme="dark"] .profile-stat-card:hover {
    border-color: rgba(16, 185, 129, 0.3);
    background:
      radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.1), transparent 42%),
      rgba(255, 255, 255, 0.07);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.25);
  }
}

/* header row: icon + label sit together at the top, value drops below.
   reads like the landing's proof cards rather than a centered tile. */
.profile-stat-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.profile-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  /* single green accent for every stat -- matches the landing's one-color
     authority palette instead of the old per-card pastel chips */
  color: var(--stat-accent);
  background: none;
  transition: color 0.2s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.profile-stat-icon svg {
  width: 26px;
  height: 26px;
}

/* the icon tint hooks are kept (markup still carries them) but all resolve to
   the same mountain-meadow green so the section reads as one cohesive system */
.profile-stat-icon--xp,
.profile-stat-icon--streak,
.profile-stat-icon--progress,
.profile-stat-icon--quests,
.profile-stat-icon--blogs,
.profile-stat-icon--credits {
  color: var(--stat-accent);
}

.profile-stat-label {
  position: relative;
  z-index: 1;
  font-size: 0.86rem;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: -0.015em;
  font-weight: 650;
  line-height: 1.15;
}

.profile-stat-value {
  position: relative;
  z-index: 1;
  margin-top: auto;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.profile-stat-detail {
  position: relative;
  z-index: 1;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

.profile-stat-bar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 8px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .profile-stat-bar {
  background: rgba(255, 255, 255, 0.08);
}

.profile-stat-bar-fill {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: var(--stat-accent);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.26);
  transition: width 0.6s ease;
}

/* progress glint -- the same animated shine the landing runs on its
   .lesson-progress fill */
.profile-stat-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -36px;
  width: 32px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: translateX(-100%);
  animation: profileStatGlint 4.8s ease-in-out infinite;
}

@keyframes profileStatGlint {
  to {
    transform: translateX(360px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-stat-bar-fill::after {
    animation: none;
  }
}

/* section headers */
.profile-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.profile-section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.036em;
  color: var(--text-primary);
}

.profile-section-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* stats refresh control -- re-runs the full supabase sync (credits + xp +
   streak + progress + achievements). subtle liquid-glass icon button that
   sits in the stats section header, before the collapse chevron. */
.profile-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  margin-right: 8px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] .profile-refresh-btn {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* when a count badge is present in the same header it already pushes itself
   to the right with margin-left:auto, so drop ours to avoid double-spacing */
.profile-section-header .profile-section-count + .profile-refresh-btn {
  margin-left: 0;
}

.profile-refresh-btn:hover:not(:disabled) {
  color: #059669;
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

[data-theme="dark"] .profile-refresh-btn:hover:not(:disabled) {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.45);
}

.profile-refresh-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.profile-refresh-btn:disabled {
  cursor: default;
}

.profile-refresh-icon {
  display: block;
}

.profile-refresh-btn--spinning {
  color: var(--accent);
}

.profile-refresh-btn--spinning .profile-refresh-icon {
  animation: profileRefreshSpin 0.7s linear infinite;
}

.profile-refresh-btn--success {
  color: var(--success, #22c55e);
  border-color: var(--success, #22c55e);
}

.profile-refresh-btn--error {
  color: var(--danger, #ef4444);
  border-color: var(--danger, #ef4444);
}

@keyframes profileRefreshSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-refresh-btn--spinning .profile-refresh-icon {
    animation: none;
  }
}

/* collapsible sections — the header acts as a click target with a
   rotating chevron on the right. body uses max-height + opacity for a
   smooth collapse transition. */
.profile-section-header--collapsible {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 8px;
  outline: none;
  transition: color 0.2s ease;
}

.profile-section-header--collapsible h2 {
  transition: color 0.2s ease;
}

.profile-section-header--collapsible:hover h2 {
  color: var(--accent);
}

.profile-section-header--collapsible:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

/* keep the badge + chevron grouped on the right side of the header.
   when a count badge is present the layout becomes [h2 | badge chevron]
   instead of [h2 | badge | chevron] which justify-content: space-between
   would otherwise spread out. */
.profile-section-header--collapsible .profile-section-count {
  margin-left: auto;
  margin-right: 10px;
}

.profile-section-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  transition: transform 0.3s ease, color 0.2s ease;
  flex-shrink: 0;
}

.profile-section-header--collapsible:hover .profile-section-chevron {
  color: var(--accent);
}

.profile-section-chevron-icon {
  display: block;
}

/* chevron rotates to point right when collapsed */
.profile-section-header--collapsible[aria-expanded="false"] .profile-section-chevron {
  transform: rotate(-90deg);
}

.profile-section-body {
  max-height: 5000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.25s ease, margin-top 0.25s ease, padding 0.25s ease;
}

.profile-section-body.is-collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .profile-section-body,
  .profile-section-chevron,
  .profile-section-header--collapsible,
  .profile-section-header--collapsible h2 {
    transition: none;
  }
}

/* achievements grid */
.profile-achievements-section {
  margin-bottom: 32px;
}

.profile-certificates-section {
  margin-bottom: 32px;
}

.profile-achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.profile-achievement-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  opacity: 1;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.2s, border-color 0.3s, box-shadow 0.3s;
}

.profile-achievement-card:hover {
  transform: translateY(-2px);
}

.profile-achievement-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-achievement-card--unlocked {
  opacity: 1;
  border-color: rgba(16,185,129, 0.2);
  box-shadow: 0 0 20px rgba(16,185,129, 0.06);
}

.profile-achievement-image {
  flex-shrink: 0;
  display: block;
  width: 56px;
  height: 56px;
}

.profile-achievement-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
}

[data-theme="dark"] .profile-achievement-image img {
  background: rgba(255, 255, 255, 0.94);
}

.profile-achievement-info {
  flex: 1;
  min-width: 0;
}

.profile-achievement-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.profile-achievement-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.profile-achievement-date {
  font-size: 0.68rem;
  color: var(--accent);
  margin-top: 3px;
  opacity: 0.8;
}

/* locked badges stay collectible: greyscaled art + muted copy, not a dead
   50%-opacity card. unlocked badges keep the green accent + glow above. */
.profile-achievement-card:not(.profile-achievement-card--unlocked) .profile-achievement-image img {
  filter: grayscale(0.85);
  opacity: 0.72;
}

.profile-achievement-card:not(.profile-achievement-card--unlocked) .profile-achievement-name {
  color: var(--text-muted);
}

/* progress-to-next bar on locked cards with a measurable path */
.profile-achievement-progress {
  margin-top: 6px;
}

.profile-achievement-progress-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  overflow: hidden;
}

.profile-achievement-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #10b981);
  transition: width 0.5s ease;
}

.profile-achievement-progress-text {
  font-size: 0.64rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* achievement category filter chips */
.profile-achievement-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.profile-achievement-chip {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.profile-achievement-chip:hover {
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.4);
}

.profile-achievement-chip.active {
  color: #fff;
  background: var(--accent, #10b981);
  border-color: var(--accent, #10b981);
}

.profile-achievement-chip-count {
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* "closest badges" goal-gradient strip */
.profile-closest {
  margin-bottom: 18px;
}

.profile-closest-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.profile-closest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.profile-closest-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.profile-closest-art {
  flex-shrink: 0;
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.profile-closest-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.profile-closest-info {
  flex: 1;
  min-width: 0;
}

.profile-closest-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.profile-closest-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  overflow: hidden;
}

.profile-closest-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #10b981);
  transition: width 0.6s ease;
}

.profile-closest-text {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

[data-theme="light"] .profile-closest-card {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
  border-color: rgba(0, 0, 0, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  .profile-achievement-progress-fill,
  .profile-closest-fill {
    transition: none;
  }
}

/* learning progress */
.profile-progress-section {
  margin-bottom: 32px;
}

.profile-progress-group {
  margin-bottom: 20px;
}

.profile-progress-group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.profile-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.profile-module-card {
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.profile-module-card:hover {
  border-color: rgba(16,185,129, 0.3);
  transform: translateY(-1px);
}

.profile-module-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.profile-module-status {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.profile-module-status--not-started {
  color: var(--text-muted);
  opacity: 0.6;
}

.profile-module-status--in-progress {
  color: #f59e0b;
}

.profile-module-status--complete {
  color: var(--accent);
}

.profile-module-score {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.profile-peptides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.profile-peptide-card {
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.profile-peptide-card:hover {
  border-color: rgba(16,185,129, 0.3);
  transform: translateY(-1px);
}

.profile-peptide-card--locked {
  opacity: 0.65;
  cursor: pointer;
}

.profile-peptide-card--locked:hover {
  border-color: rgba(239, 68, 68, 0.35);
}

.profile-peptide-card--unlockable {
  border-style: dashed;
  border-color: rgba(16,185,129, 0.45);
  background: linear-gradient(135deg, rgba(16,185,129, 0.08) 0%, rgba(16,185,129, 0.02) 100%);
}

.profile-peptide-card--unlockable:hover {
  border-color: rgba(16,185,129, 0.75);
}

.profile-peptide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.profile-peptide-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-peptide-lock {
  color: var(--text-muted);
  flex-shrink: 0;
}

.profile-peptide-check {
  color: var(--accent);
  flex-shrink: 0;
}

.profile-peptide-unlock {
  color: var(--accent);
  flex-shrink: 0;
}

.profile-peptide-action {
  margin-top: 4px;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-weight: 600;
}

.profile-peptide-action--unlockable {
  color: var(--accent);
}

.profile-peptide-action--locked {
  color: #f87171;
}

.profile-peptide-card--coming-soon {
  opacity: 0.45;
  filter: grayscale(1);
  pointer-events: none;
  cursor: default;
}

.profile-peptide-action--coming-soon {
  color: var(--text-muted);
}

.profile-peptide-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.profile-peptide-progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

[data-theme="light"] .profile-peptide-progress-bar {
  background: rgba(0, 0, 0, 0.08);
}

.profile-peptide-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.profile-peptide-progress-text {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.profile-peptide-score {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* recent activity */
.profile-activity-section {
  margin-bottom: 32px;
}

.profile-activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-activity-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px 0;
  text-align: center;
}

.profile-activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.profile-activity-xp {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  min-width: 60px;
}

.profile-activity-reason {
  font-size: 0.82rem;
  color: var(--text-primary);
  flex: 1;
}

.profile-activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* referrals */
.profile-referrals-section {
  margin-bottom: 32px;
}

/* canonical referral-rewards card is rendered into #profileReferralPromo by
   mountReferralPromo (js/referrals.js) -- shares styles with pricing.html.
   the list card below shows per-invitee invite status, profile-only. */
.profile-referrals-section > #profileReferralPromo {
  margin-bottom: 24px;
}

/* the promo renders with .glass-panel by default (to match pricing.html), but
   on the profile that reads as a grey box behind the content -- strip the glass
   fill/border/sheen so the promo blends into the section. layout unchanged. */
.profile-referrals-section > #profileReferralPromo .referral-promo-card {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

.profile-referrals-section > #profileReferralPromo .referral-promo-card::before {
  display: none;
}

.profile-referrals-card {
  padding: 24px;
}

.profile-referral-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-referral-list-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.profile-referral-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-referral-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.profile-referral-item-info {
  flex: 1;
  min-width: 0;
}

.profile-referral-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 3px;
}

.profile-referral-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.profile-referral-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  white-space: nowrap;
}

.profile-referral-status-badge--signed-up {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.profile-referral-status-badge--qualified {
  background: rgba(16,185,129, 0.12);
  color: var(--accent);
  border: 1px solid rgba(16,185,129, 0.2);
}

.profile-referral-status-badge--rewarded {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.profile-referral-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 18px 12px;
}

/* gift credits */
.profile-gift-section {
  margin-bottom: 32px;
}

.profile-gift-card {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-gift-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-gift-copy strong {
  font-size: 0.98rem;
  color: var(--text-primary);
}

.profile-gift-copy span {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.profile-gift-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.profile-gift-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* manage subscription */
.profile-subscription-section {
  margin-bottom: 32px;
}

.profile-subscription-card {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-subscription-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-subscription-plan {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-subscription-plan strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.profile-subscription-plan span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.profile-subscription-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-subscription-meta span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.profile-subscription-meta .profile-subscription-founder {
  color: var(--accent);
  font-weight: 600;
}

.profile-subscription-actions {
  display: flex;
  gap: 10px;
}

.profile-subscription-cancel-btn {
  padding: 10px 18px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.profile-subscription-cancel-btn:hover {
  background: var(--danger);
  color: #fff;
}

.profile-subscription-cancel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-subscription-reactivate-btn {
  padding: 10px 18px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.profile-subscription-reactivate-btn:hover {
  opacity: 0.85;
}

.profile-subscription-reactivate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-subscription-confirm {
  padding: 22px 24px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--danger);
}

.profile-subscription-confirm-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-subscription-confirm-copy strong {
  font-size: 0.96rem;
  color: var(--danger);
}

.profile-subscription-confirm-copy span {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.profile-subscription-confirm-actions {
  display: flex;
  gap: 10px;
}

.profile-subscription-confirm-cancel-btn {
  padding: 10px 18px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.profile-subscription-confirm-cancel-btn:hover {
  opacity: 0.85;
}

.profile-subscription-confirm-cancel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-subscription-canceling {
  border-color: var(--warning, #f59e0b);
}

.profile-subscription-canceling .profile-subscription-plan strong {
  color: var(--warning, #f59e0b);
}

/* member perks */
/* academy section: one wrapper around member perks + gift credit + manage
   subscription so the profile keeps fewer top-level sections */
.profile-academy-section {
  margin-bottom: 32px;
}

/* sub-block headers inside the academy section -- lighter than a top-level
   section h2 so the single "academy" heading stays dominant */
.profile-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.profile-subsection-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.profile-academy-section .profile-perks-section,
.profile-academy-section .profile-gift-section,
.profile-academy-section .profile-subscription-section {
  margin-bottom: 24px;
}

.profile-academy-section > .profile-section-body > section:last-child {
  margin-bottom: 0;
}

.profile-perks-section {
  margin-bottom: 32px;
}

.profile-perks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.profile-perk-card {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-perk-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-perk-copy strong {
  font-size: 0.98rem;
  color: var(--text-primary);
}

.profile-perk-copy span {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.profile-perk-actions {
  display: grid;
  grid-template-columns: minmax(112px, 0.5fr) minmax(0, 1fr) auto;
  gap: 8px;
}

.profile-perk-select {
  min-width: 0;
}

/* friends section */
.profile-friends-section {
  margin-bottom: 32px;
}

.profile-friend-requests {
  margin-bottom: 16px;
}

.profile-friend-requests h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.profile-friend-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 8px;
}

.profile-friend-request-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-friend-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16,185,129, 0.12);
  border: 1px solid rgba(16,185,129, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-friend-avatar-sm--image {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: transparent;
  overflow: hidden;
}

.profile-friend-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-friend-username {
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.8;
}

.profile-friend-request-actions {
  display: flex;
  gap: 8px;
}

.profile-friend-accept-btn,
.profile-friend-decline-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.profile-friend-accept-btn {
  background: var(--accent);
  color: #000;
}

.profile-friend-decline-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-friend-accept-btn:hover,
.profile-friend-decline-btn:hover {
  opacity: 0.85;
}

/* friend search */
.profile-friend-search {
  margin-bottom: 16px;
}

.profile-search-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.profile-search-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.profile-search-input:focus {
  border-color: var(--accent);
}

.profile-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.profile-search-btn {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

.profile-search-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-search-loading,
.profile-search-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.profile-search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.profile-search-result-info {
  flex: 1;
  min-width: 0;
}

.profile-friend-add-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #000;
  border: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.profile-friend-add-btn:hover {
  opacity: 0.85;
}

.profile-friend-add-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* friends list */
.profile-friends-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.profile-friends-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  grid-column: 1 / -1;
}

.profile-friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.profile-friend-card-info {
  flex: 1;
  min-width: 0;
}

.profile-friend-stats {
  display: flex;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.profile-friend-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-friend-view-btn,
.profile-friend-remove-btn {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.profile-friend-view-btn {
  background: rgba(16,185,129, 0.15);
  color: var(--accent);
}

.profile-friend-remove-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.profile-friend-view-btn:hover,
.profile-friend-remove-btn:hover {
  opacity: 0.75;
}

/* settings */
.profile-settings-section {
  margin-bottom: 40px;
}

.profile-settings-grid {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-setting-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.profile-setting-input-wrap {
  display: flex;
  gap: 8px;
}

.profile-setting-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.profile-setting-input:focus {
  border-color: var(--accent);
}

.profile-setting-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.profile-setting-input--locked,
.profile-setting-input[readonly] {
  opacity: 0.65;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.04);
}

.profile-setting-support-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: underline;
}

.profile-setting-save {
  padding: 10px 18px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.profile-setting-save:hover {
  opacity: 0.85;
}

.profile-setting-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.4;
}

.profile-setting-hint--error {
  color: #fb7185;
  opacity: 1;
}

.profile-setting-hint--success {
  color: var(--accent);
  opacity: 1;
}

.profile-setting-hint--warning {
  color: var(--warning, #f59e0b);
  opacity: 1;
}

.profile-discord-invite-link {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 4px;
  border-radius: 6px;
  background: rgba(88, 101, 242, 0.14);
  border: 1px solid rgba(88, 101, 242, 0.32);
  color: #818cf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  text-decoration: none;
  word-break: break-all;
}

.profile-discord-invite-link:hover {
  background: rgba(88, 101, 242, 0.22);
  border-color: rgba(88, 101, 242, 0.55);
  color: #a5b4fc;
}

[data-theme="light"] .profile-discord-invite-link {
  background: rgba(88, 101, 242, 0.10);
  border-color: rgba(88, 101, 242, 0.4);
  color: #4f46e5;
}

[data-theme="light"] .profile-discord-invite-link:hover {
  background: rgba(88, 101, 242, 0.18);
  color: #4338ca;
}

.profile-setting-toggle-wrap {
  display: flex;
}

.profile-setting-toggle {
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s;
  font-family: inherit;
}

.profile-setting-toggle:hover {
  border-color: var(--accent);
}

/* public profile */
.profile-public-back {
  margin-bottom: 20px;
}

.profile-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.profile-back-link:hover {
  opacity: 0.8;
}

.profile-public-error {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 60px 20px;
}

.profile-friend-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 8px;
}

.profile-friend-action-btn:hover {
  opacity: 0.85;
}

.profile-friend-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.profile-friend-action-btn--friends {
  background: rgba(16,185,129, 0.15);
  color: var(--accent);
}

/* stranger notice (shown to non-friends on public profiles) */
.profile-stranger-notice {
  margin-top: 32px;
}

.profile-stranger-notice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.profile-stranger-notice-card svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.profile-stranger-notice-card p {
  margin: 0;
}

/* friend-only sections container */
.profile-friend-only {
  margin-top: 8px;
}

/* responsive */
@media (max-width: 768px) {
  .profile-main {
    padding: 80px 16px 40px;
  }

  .profile-gift-input-wrap {
    grid-template-columns: 1fr;
  }

  .profile-perk-actions {
    grid-template-columns: 1fr;
  }

  .profile-referral-item {
    align-items: flex-start;
  }

  .profile-referral-status {
    justify-content: flex-start;
  }

  /* matheus 2026-05-19: keep avatar on the same row as the username so
     the header card stays compact on mobile instead of stacking the
     avatar above everything. */
  .profile-header-card {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 20px;
  }

  .profile-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }

  .profile-display-name {
    font-size: 1.2rem;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-stat-card {
    min-height: 118px;
    padding: 16px 16px 14px;
  }

  .profile-stat-value {
    font-size: 1.7rem;
  }

  .profile-achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .profile-modules-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .profile-peptides-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .profile-friend-request-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .profile-friends-list {
    grid-template-columns: 1fr;
  }

  .profile-friend-card {
    flex-wrap: wrap;
  }

  .profile-friend-card-actions {
    flex-direction: row;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .profile-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* mobile: 3 per row, vertical stack inside each card */
  .profile-achievements-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .profile-achievement-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 10px 6px;
  }

  .profile-achievement-image {
    width: 56px;
    height: 56px;
  }

  .profile-achievement-name {
    font-size: 0.72rem;
    line-height: 1.2;
    margin-bottom: 0;
  }

  /* mobile: hide description, date, and progress by default; reveal on tap */
  .profile-achievement-card .profile-achievement-desc,
  .profile-achievement-card .profile-achievement-date,
  .profile-achievement-card .profile-achievement-progress {
    display: none;
  }

  .profile-achievement-card[aria-expanded="true"] {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 12px 14px;
    gap: 12px;
  }

  .profile-achievement-card[aria-expanded="true"] .profile-achievement-name {
    font-size: 0.85rem;
    margin-bottom: 2px;
  }

  .profile-achievement-card[aria-expanded="true"] .profile-achievement-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
  }

  .profile-achievement-card[aria-expanded="true"] .profile-achievement-date {
    display: block;
  }

  .profile-achievement-card[aria-expanded="true"] .profile-achievement-progress {
    display: block;
    width: 100%;
  }

  .profile-activity-item {
    flex-wrap: wrap;
    gap: 6px;
  }

  .profile-activity-time {
    width: 100%;
  }
}

/* light theme overrides */
[data-theme="light"] .profile-achievement-card {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.01) 100%);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .profile-achievement-card--unlocked {
  background: #ffffff;
  border-color: rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.06);
}

[data-theme="light"] .profile-activity-item,
[data-theme="light"] .profile-friend-request-item,
[data-theme="light"] .profile-search-result-item {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.01) 100%);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .profile-search-input,
[data-theme="light"] .profile-setting-input {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .profile-search-btn,
[data-theme="light"] .profile-setting-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .profile-friend-decline-btn,
[data-theme="light"] .profile-friend-remove-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .profile-tier-badge--free {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .profile-loading-spinner {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
}

[data-theme="light"] .profile-stranger-notice-card {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.01) 100%);
  border-color: rgba(0, 0, 0, 0.08);
}

/* ============================================================
   themed modal (replaces window.alert / window.confirm)
   ============================================================ */

.pa-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.pa-modal-overlay--visible {
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .pa-modal-overlay {
  background: rgba(0, 0, 0, 0.25);
}

.pa-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 20px;
  padding: 32px 28px 24px;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: var(--radius-xl);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(8px) scale(0.97);
  transition: transform var(--transition-fast);
  text-align: center;
}

.pa-modal-overlay--visible .pa-modal {
  transform: translateY(0) scale(1);
}

[data-theme="light"] .pa-modal {
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.85) 0%,
      rgba(255, 255, 255, 0.65) 100%);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pa-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
}

.pa-modal-message {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 24px;
}

.pa-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.pa-modal-btn {
  flex: 1;
  max-width: 140px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-transform: lowercase;
}

.pa-modal-btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pa-modal-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.pa-modal-btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

.pa-modal-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

[data-theme="light"] .pa-modal-btn--secondary {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-secondary);
}

[data-theme="light"] .pa-modal-btn--secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* edit profile modal */
.pa-modal--edit-profile {
  max-width: 420px;
  text-align: left;
  padding: 28px 28px 24px;
}

.pa-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pa-modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .pa-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

.pa-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.pa-modal-avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16,185,129, 0.15);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 auto 20px;
}

.pa-modal-avatar-preview--image {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: transparent;
  overflow: hidden;
}

.pa-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.pa-modal-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.pa-modal--edit-profile .pa-modal-actions {
  margin-top: 8px;
}

/* clickable header elements */
.profile-header-card--editable .profile-avatar-lg,
.profile-header-card--editable .profile-display-name,
.profile-header-card--editable .profile-username {
  cursor: pointer;
  transition: opacity 0.2s;
}

.profile-header-card--editable .profile-avatar-lg:hover,
.profile-header-card--editable .profile-display-name:hover,
.profile-header-card--editable .profile-username:hover {
  opacity: 0.7;
}

.profile-edit-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s;
  margin-top: 4px;
}

.profile-header-card--editable:hover .profile-edit-hint {
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {

  .pa-modal-overlay,
  .pa-modal {
    transition: none;
  }
}

/* settings gear next to a profile section h2 (e.g. Academy → cancel modal) */
.profile-section-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 7px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.profile-section-settings-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}
[data-theme="light"] .profile-section-settings-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* manage-subscription modal copy */
.pa-modal--manage-subscription {
  max-width: 440px;
  text-align: left;
  padding: 28px 28px 24px;
}
.profile-modal-copy {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 18px;
}

/* destructive variant of pa-modal-btn (cancel subscription confirmation) */
.pa-modal-btn--danger {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.pa-modal-btn--danger:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.55);
}
[data-theme="light"] .pa-modal-btn--danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
}
