.social-page {
  padding: 1.5rem 0 3rem;
}

.social-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.social-head h1,
.social-page > h1 {
  margin: 0 0 0.5rem;
}

.social-lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.social-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.social-actions .auth-submit {
  margin: 0;
  padding: 0.5rem 0.9rem;
}

.notif-list,
.feed-list {
  display: grid;
  gap: 0.65rem;
}

.notif-item,
.feed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.notif-item.is-unread {
  border-color: rgba(77, 107, 254, 0.55);
  background: rgba(77, 107, 254, 0.08);
}

.notif-item h3,
.feed-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.notif-item p,
.feed-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.notif-item .meta,
.feed-item .meta {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: #6f7588;
}

.notif-item {
  cursor: pointer;
}

.notif-item.is-clickable:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.notif-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.notif-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(77, 107, 254, 0.4);
  background: rgba(77, 107, 254, 0.16);
  color: #8ea2ff;
  font-weight: 600;
  text-decoration: none;
}

.notif-open--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.notif-open:hover {
  background: rgba(77, 107, 254, 0.26);
  color: #fff;
}

.notif-open--ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(77, 107, 254, 0.12);
}

.public-profile {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.public-profile img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.public-profile h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.public-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.following-box {
  margin-top: 2rem;
}

.following-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.following-list a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.following-list img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.following-empty {
  display: grid;
  gap: 0.65rem;
  justify-items: start;
  color: var(--muted);
  font-size: 0.95rem;
}

.following-empty p {
  margin: 0;
}

.page-loading,
.dm-loading {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  padding: 1.75rem 1rem;
  margin: 0 0 1rem;
  min-height: 220px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  text-align: center;
  box-sizing: border-box;
  align-content: center;
}

.empty-state {
  min-height: 220px;
  align-content: center;
  box-sizing: border-box;
}

.page-loading[hidden],
.page-loading.hidden,
.dm-loading[hidden],
.dm-loading.hidden {
  display: none;
}

.page-loading p,
.dm-loading p {
  margin: 0;
  font-size: 0.95rem;
}

.page-loading__spinner,
.dm-loading__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #8ea2ff;
  border-radius: 50%;
  animation: dm-spin 0.8s linear infinite;
}

.page-skeleton,
.dm-skeleton {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  max-width: 22rem;
}

.page-skeleton__row,
.dm-skeleton__row {
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: dm-shimmer 1.2s ease-in-out infinite;
}

@keyframes dm-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dm-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.dm-empty__hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.dm-empty--gate {
  display: grid;
  gap: 0.65rem;
  justify-items: start;
  padding: 1rem 0.25rem;
}

.dm-empty--gate p {
  margin: 0;
}

.dm-pending-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  width: 100%;
}

.dm-pending-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.dm-pending-list li a:first-child {
  color: var(--accent);
  font-weight: 600;
}

.dm-pending-list li span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-pending-open {
  color: var(--accent);
  font-size: 0.85rem;
}

.friend-card__ph--letter {
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 700;
  color: #4d6bfe;
  background: #1c1c22;
  line-height: 1;
  user-select: none;
}

.header-bell {
  position: relative;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  text-decoration: none;
}

.header-bell .badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff5a5a;
  color: #fff;
  font-size: 0.7rem;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.friends-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 0 0 1.25rem;
}

.friends-toolbar .search {
  flex: 1;
  min-width: 220px;
}

.friends-toolbar .auth-submit {
  margin: 0;
  padding: 0.75rem 1.1rem;
}

.friends-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.friend-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.friend-card img,
.friend-card__ph {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.friend-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.friend-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.friend-card h2 a:hover {
  color: var(--accent);
}

.friend-card__name,
.friend-card__bio {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.friend-card__genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.friend-chip.is-match {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(77, 107, 254, 0.18);
}

.friend-card__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.friend-card__actions .auth-submit,
.friend-card__actions .header__logout {
  margin: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
}

.social-lead a {
  color: var(--accent);
}

@media (max-width: 720px) {
  .friends-toolbar .auth-submit {
    width: 100%;
  }
}

.reco-section {
  margin: 0 0 1.5rem;
}

.reco-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.reco-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 180px);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.reco-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}

.reco-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: #12141c;
}

.reco-card__body {
  padding: 0.55rem 0.65rem 0.7rem;
}

.reco-card__body h3 {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  line-height: 1.25;
}

.reco-card__body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
}

.score-row button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.score-row button.is-active {
  border-color: var(--accent);
  background: rgba(77, 107, 254, 0.25);
}

@media (max-width: 720px) {
  .public-profile {
    grid-template-columns: 72px 1fr;
  }
  .public-profile .profile-follow {
    grid-column: 1 / -1;
  }
}

.dm-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.75rem;
  min-height: 62vh;
  align-items: stretch;
}

.dm-list,
.dm-chat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 0;
}

.dm-list {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.55rem;
}

.dm-list-empty,
.dm-empty {
  color: var(--muted);
  padding: 1.25rem;
  line-height: 1.45;
  background: transparent;
  border: 0;
}

.dm-layout.hidden,
.dm-layout[hidden] {
  display: none !important;
}

#dmEmptyState:not(.hidden):not([hidden]) {
  display: grid;
}

.dm-person {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 10px;
  padding: 0.45rem;
  cursor: pointer;
}

.dm-person.is-active,
.dm-person:hover {
  background: rgba(77, 107, 254, 0.16);
}

.dm-person img,
.dm-ph {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
}

.dm-person strong,
.dm-person small {
  display: block;
}

.dm-person small {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

.dm-person em {
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
  padding: 0 0.3rem;
}

.dm-chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.dm-chat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.dm-chat-head a {
  color: #fff;
  font-weight: 600;
}

.dm-thread {
  overflow: auto;
  padding: 0.85rem;
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.dm-bubble {
  max-width: min(80%, 34rem);
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: #1c1c22;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dm-bubble.is-mine {
  justify-self: end;
  background: rgba(77, 107, 254, 0.28);
}

.dm-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--border);
}

.dm-form input {
  width: 100%;
  border: 1px solid var(--border);
  background: #101014;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  color: inherit;
}

.dm-form .auth-submit {
  margin: 0;
}

.friend-card__hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .dm-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .dm-layout:not(.hidden):not([hidden]) {
    min-height: 50vh;
  }
  .dm-layout.is-chat .dm-list { display: none; }
  .dm-layout:not(.is-chat) .dm-chat { display: none; }
}
