/* Profile + member cards + share + overflow safety */
html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
  max-width: 100vw;
}
.wrap, .header-inner, .site-nav, main, .page-block {
  max-width: 100%;
}
.break-all, .share-dialog .meta { overflow-wrap: anywhere; word-break: break-word; }
a, .post-body, .topic-list a { overflow-wrap: anywhere; }

/* Cover + avatar */
.profile-shell { margin: 0; padding: 0; }
.profile-cover {
  width: 100%;
  max-width: 100vw;
  height: clamp(120px, 28vw, 220px);
  overflow: hidden;
  background: linear-gradient(135deg, #0f3d2e 0%, #1a2e22 45%, rgba(212,175,55,0.35) 100%);
}
.profile-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-cover-fallback { width: 100%; height: 100%; }
.profile-pro { padding-top: 0; margin-top: -2.5rem; position: relative; z-index: 1; }
.profile-head {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.profile-avatar, .profile-avatar-fallback {
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--paper);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  background: #1a2e22;
}
.profile-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 2.2rem;
  font-weight: 700;
}
.profile-head-text { flex: 1; min-width: 0; padding-bottom: 0.2rem; }
.profile-head-text h1 {
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  margin: 0 0 0.15rem;
  overflow-wrap: anywhere;
}
.profile-handle { margin: 0; direction: ltr; unicode-bidi: isolate; text-align: start; }
.profile-bio { max-width: 42rem; overflow-wrap: anywhere; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.9rem 0 1rem;
}
.profile-stats a,
.profile-stats > span,
.profile-stats .stat-tab {
  display: grid;
  justify-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0.35rem;
  min-width: 0;
  cursor: pointer;
  font: inherit;
}
.profile-stats strong { font-size: 1.1rem; display: block; }
.profile-stats span { font-size: 0.78rem; color: var(--muted); }
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.profile-actions .btn { min-height: 42px; }
.profile-more { position: relative; }
.profile-more > summary { list-style: none; }
.profile-more > summary::-webkit-details-marker { display: none; }
.profile-more-panel {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
  display: grid;
  gap: 0.4rem;
  min-width: min(16rem, 90vw);
  padding: 0.65rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.profile-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding: 0.35rem 0 0.6rem;
  margin: 0.4rem 0 0.8rem;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.profile-tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-bottom: 2px solid transparent;
  min-height: 40px;
}
.profile-tabs button.is-active {
  color: var(--ink-strong);
  border-color: var(--gold);
}
.profile-panel[hidden] { display: none !important; }

/* Member cards */
.member-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0.2rem;
  border-bottom: 1px solid var(--line);
  max-width: 100%;
}
.member-card.is-compact { padding: 0.55rem 0; }
.mc-avatar, .mc-fallback {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #1a2e22;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.25rem;
}
.mc-body { min-width: 0; }
.mc-id { display: flex; flex-wrap: wrap; gap: 0.3rem 0.45rem; align-items: center; }
.mc-name {
  font-weight: 700;
  color: var(--ink-strong);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.mc-user { color: var(--muted); font-size: 0.88rem; direction: ltr; unicode-bidi: isolate; }
.mc-bio { margin: 0.25rem 0 0.45rem; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.mc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.btn-sm { min-height: 36px; padding: 0.3rem 0.7rem; font-size: 0.88rem; }
.member-grid { display: grid; gap: 0.15rem; }
.inline-form { display: inline; margin: 0; }

/* Share dialog */
.share-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: min(24rem, calc(100vw - 1.5rem));
  width: 100%;
  background: var(--paper);
  color: var(--ink);
}
.share-dialog::backdrop { background: rgba(10, 16, 14, 0.55); }
.share-dialog-inner { padding: 1.1rem 1.15rem 1.25rem; margin: 0; }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.85rem 0; }
.profile-qr-box { text-align: center; margin-top: 0.5rem; }
.profile-qr-box img { margin: 0.5rem auto; background: #fff; padding: 0.5rem; border-radius: 10px; }

.social-toast {
  position: fixed;
  inset-inline: 1rem;
  bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--charcoal);
  color: var(--ivory);
  border: 1px solid rgba(212,175,55,0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: min(24rem, calc(100vw - 2rem));
  margin-inline: auto;
}
.social-toast.is-on { opacity: 1; transform: none; }
.social-toast.is-err { border-color: rgba(200,80,80,0.7); }

.discover-sections { display: grid; gap: 1.5rem; }
.discover-sections h2 { margin-top: 0.4rem; }

@media (max-width: 420px) {
  .profile-avatar, .profile-avatar-fallback { width: 80px; height: 80px; min-width: 80px; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-pro { margin-top: -2rem; }
}
@media (max-width: 860px) {
  body { padding-bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); }
  .mobile-social-nav {
    width: 100%;
    max-width: 100vw;
    inset-inline: 0;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }
  .site-header { width: 100%; max-width: 100vw; }
  .site-nav { max-width: 100%; }
}

/* Kill classic overflow triggers */
.clips-reel-full {
  width: 100%;
  max-width: 100vw;
  margin-inline: 0;
}
@media (max-width: 720px) {
  .clips-reel-full {
    width: 100%;
    max-width: 100vw;
    margin-inline: 0;
  }
}
