/* v5 social hub */
.social-page .social-shell { max-width: 1100px; margin: 0 auto; padding: 16px 18px 48px; width: 100%; box-sizing: border-box; }
.global-playing-list .global-playing-card {
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .social-page .social-shell { padding: 12px 12px 40px; }
}
.social-head { margin-bottom: 12px; }
.social-title { font-size: 1.5rem; margin: 0 0 4px; }
.social-sub { margin: 0; max-width: 56ch; }

/* Tab strip only under /social (.social-page) — avoids styled “Rules” pills on library/game/etc. */
.social-page .social-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08)); padding-bottom: 8px;
}
.social-page .social-tab {
  background: transparent; border: 1px solid var(--border, rgba(255,255,255,.12));
  color: var(--text, #ddd); padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 0.85rem;
}
.social-page .social-tab:hover { border-color: var(--border-hover, rgba(255,255,255,.25)); }
.social-page .social-tab.is-active {
  border-color: var(--accent, #6c9fff);
  color: var(--accent-bright, #9ab8ff);
  background: var(--accent-soft, rgba(108,159,255,.08));
}
.social-activity-filters .activity-filter-btn.is-active {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.social-page .social-pane[hidden] { display: none !important; }
.social-page .social-pane.is-visible { display: block; }

.social-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.social-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .social-columns { grid-template-columns: 1fr; } }

.social-list { display: flex; flex-direction: column; gap: 8px; }
.social-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: var(--bg-card, rgba(0,0,0,.2));
}
.social-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.social-feed { display: flex; flex-direction: column; gap: 8px; }
.social-feed-item {
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,.08)); font-size: 0.88rem;
  background: var(--bg-panel, transparent);
}
.social-feed-item time { font-size: 0.75rem; color: var(--text-dim, #888); }

/* Messages */
.msg-layout {
  display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 12px; min-height: 420px;
}
@media (max-width: 800px) {
  .msg-layout { grid-template-columns: 1fr; }
}
.msg-threads {
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 10px; overflow: hidden;
  max-height: 520px; overflow-y: auto;
  background: var(--bg-panel, transparent);
}
.msg-thread-row {
  padding: 10px 12px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
  cursor: pointer; text-align: left; width: 100%; background: transparent; color: inherit;
  font: inherit; display: block; box-sizing: border-box;
}
.msg-thread-row .msg-thread-row-inner { width: 100%; }
.msg-thread-row:hover { background: var(--bg-hover, rgba(255,255,255,.04)); }
.msg-thread-row.is-active { background: var(--accent-soft, rgba(108,159,255,.12)); }
.msg-thread-row .snippet { font-size: 0.78rem; color: var(--text-dim, #999); }
.msg-unread { display: inline-block; min-width: 1.2em; background: var(--accent, #6c9fff); color: #111; border-radius: 6px; padding: 0 6px; font-size: 0.72rem; }

.msg-thread {
  display: flex; flex-direction: column; border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 10px; min-height: 360px;
  background: var(--bg-panel, transparent);
}
.msg-thread-header {
  padding: 10px 12px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px;
}
.msg-thread-header-main {
  display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0;
}
.msg-thread-header-text { flex: 1; min-width: 0; }
.msg-thread-presence { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-dim, #999); }
.msg-thread-title { display: block; }
.msg-thread-actions {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 12px 8px; border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}
.msg-timeline {
  flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.msg-bubble {
  align-self: flex-start; max-width: 85%; padding: 8px 12px; border-radius: 12px;
  background: var(--tab-inactive-bg, rgba(255,255,255,.06)); font-size: 0.9rem;
  display: flex; flex-direction: column; gap: 4px;
}
.msg-bubble-body { white-space: pre-wrap; word-break: break-word; }
.msg-bubble-time {
  font-size: 0.68rem; color: var(--text-dim, #888); align-self: flex-end;
}
.msg-bubble.me { align-self: flex-end; background: var(--accent-soft-strong, rgba(108,159,255,.2)); }

.friend-notes-label { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; max-width: 100%; }
.friend-notes-input { resize: vertical; min-height: 44px; }

.msg-composer {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border, rgba(255,255,255,.08));
  align-items: flex-end;
}
.msg-composer textarea {
  flex: 1; resize: vertical; min-height: 44px; max-height: 160px;
  background: var(--search-bg, rgba(0,0,0,.35)); border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 8px; color: inherit; padding: 8px 10px; font: inherit;
}

.social-settings { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.social-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.social-settings select {
  background: var(--search-bg, rgba(0,0,0,.35)); border: 1px solid var(--border, rgba(255,255,255,.12));
  color: inherit; padding: 8px; border-radius: 8px;
}
.social-settings .check { flex-direction: row; align-items: center; gap: 8px; }

/* Header bell */
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border, rgba(255,255,255,.12));
  background: transparent; color: inherit; cursor: pointer;
}
.notif-bell-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #e74c3c; color: #fff; font-size: 10px; line-height: 16px;
  text-align: center; display: none;
}
.notif-bell-badge[data-count]:not([data-count="0"]) { display: inline-block; }
.notif-dropdown {
  position: absolute; right: 0; top: 100%; margin-top: 6px; width: min(340px, 92vw);
  background: var(--panel-bg, #1a1a22); border: 1px solid var(--border, rgba(255,255,255,.12));
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.45); z-index: 200;
  max-height: 360px; overflow-y: auto; display: none;
}
.notif-dropdown.is-open { display: block; }

/* Mobile: keep panel in viewport (avoids clip under body overflow-x + wide absolute panel) */
@media (max-width: 768px) {
  .notif-dropdown.notif-dropdown--viewport {
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left, 0px)) !important;
    right: max(12px, env(safe-area-inset-right, 0px)) !important;
    top: var(--v5-notif-top, 100px) !important;
    width: auto !important;
    max-width: none !important;
    margin-top: 0 !important;
    max-height: min(360px, calc(100vh - var(--v5-notif-top, 100px) - 16px)) !important;
  }
}
.notif-dd-item {
  display: block; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.06);
  color: inherit; text-decoration: none; font-size: 0.85rem;
}
.notif-dd-item:hover { background: rgba(255,255,255,.05); }
.notif-dd-markall {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.notif-dd-footer { font-weight: 600; }
.social-feed-item.notif-unread { border-left: 3px solid var(--accent-bright, #6cf); padding-left: 10px; }

/* Game page — friends-who-played modal (FRIENDS_ENGINEERING §11.2) */
.game-soc-avatar-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.game-soc-badges {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px;
}
.game-soc-badge {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 6px;
  background: rgba(108, 92, 231, 0.15); color: var(--accent-bright, #a29bfe);
  border: 1px solid rgba(162, 155, 254, 0.35);
}
.game-soc-last-activity { font-size: 0.78rem; }

.game-soc-modal[hidden] { display: none !important; }
.game-soc-modal {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box;
}
.game-soc-modal-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); cursor: pointer;
}
.game-soc-modal-panel {
  position: relative; z-index: 1; max-width: 440px; width: 100%; max-height: 75vh; overflow: auto;
}
.game-soc-modal-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.game-soc-modal-row:last-child { border-bottom: none; }

.game-share-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.88rem; }
.game-share-select,
.game-share-note {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--search-bg, rgba(0, 0, 0, 0.35)); color: inherit; font: inherit;
}
.game-share-note { resize: vertical; min-height: 44px; }

/* Initials avatars (social lists) */
.social-card-main {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0; flex: 1;
}
.social-card-text { min-width: 0; flex: 1; }
.v5-user-avatar {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem; font-weight: 700;
  background: hsl(var(--v5-avatar-hue, 210), 42%, 32%);
  color: hsl(var(--v5-avatar-hue, 210), 10%, 96%);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
}
.msg-thread-row-inner { display: flex; align-items: flex-start; gap: 10px; text-align: left; width: 100%; }

.activity-react-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.activity-react-bar button {
  font-size: 1rem; line-height: 1; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12)); background: transparent; color: inherit; cursor: pointer;
}
.activity-react-bar button.is-mine { border-color: var(--accent, #6c9fff); background: var(--accent-soft, rgba(108, 159, 255, 0.12)); }
.activity-react-counts { font-size: 0.78rem; color: var(--text-dim, #888); margin-left: 4px; }

/* Messages — mobile thread focus (§10.F) */
.msg-back-chats { display: none; width: 100%; margin-bottom: 0; text-align: left; }
@media (max-width: 800px) {
  .msg-back-chats.is-visible { display: inline-flex; }
  .msg-layout.msg-thread-focus .msg-threads { display: none; }
  .msg-layout.msg-thread-focus .msg-thread { min-height: 55vh; }
}

.social-dash-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
  margin-top: 10px;
}
.social-dash-stat {
  padding: 10px; border-radius: 10px; border: 1px solid var(--border, rgba(255,255,255,.1));
  background: var(--bg-card, rgba(0,0,0,.2)); text-align: center;
}
.social-dash-stat .val { font-size: 1.2rem; font-weight: 600; }
.social-dash-stat .lbl { font-size: 0.72rem; color: var(--text-dim, #999); text-transform: uppercase; }

/* Insights dashboard */
.insight-cards { margin-top: 4px; }
.insight-toolbar-result {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: var(--bg-card, rgba(0, 0, 0, 0.22));
}
.insight-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px;
}
.insight-card {
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: var(--bg-panel, rgba(0, 0, 0, 0.15));
}
.insight-card-wide { grid-column: 1 / -1; }
.insight-card-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim, #999); }
.insight-card-value { font-size: 1.35rem; font-weight: 600; margin: 4px 0; }
.insight-card-hint { font-size: 0.8rem; color: var(--text-dim, #888); }
.insight-h3 { font-size: 1rem; margin: 0 0 8px; }
.insight-list { margin: 0; padding-left: 1.2em; font-size: 0.88rem; }
.insight-panel { margin-top: 14px; }
.insight-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.insight-table th, .insight-table td {
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.insight-subpanel {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px dashed var(--border, rgba(255, 255, 255, 0.15));
  background: var(--bg-card, rgba(0, 0, 0, 0.12));
}

/* Global message search */
.msg-search-hits {
  margin-bottom: 10px; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1)); border-radius: 10px;
  padding: 6px; background: var(--bg-panel, rgba(0, 0, 0, 0.2));
}
.msg-search-hit {
  display: block; width: 100%; text-align: left; padding: 8px 10px; margin: 0 0 4px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: inherit;
  font: inherit; cursor: pointer; box-sizing: border-box;
}
.msg-search-hit:hover { background: var(--bg-hover, rgba(255, 255, 255, 0.06)); border-color: var(--border, rgba(255, 255, 255, 0.1)); }
.msg-search-hit-meta { display: block; font-size: 0.72rem; margin-bottom: 4px; }
.msg-search-hit-body { font-size: 0.85rem; word-break: break-word; }

/* Activity comments */
.activity-comments-panel {
  margin-top: 8px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: var(--bg-card, rgba(0, 0, 0, 0.18));
}
.activity-comments-compose {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center;
}
.activity-comments-compose .activity-comment-input { flex: 1; min-width: 140px; }
.activity-comment-item { padding: 8px 0; border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06)); font-size: 0.85rem; }
.activity-comment-item:last-child { border-bottom: none; }
.activity-comment-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }

.msg-bubble.msg-bubble-focus {
  outline: 2px solid var(--accent, #6c9fff); outline-offset: 2px;
}

/* Callout under Social title — links to Rules tab */
.social-rules-callout {
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--accent-soft, rgba(108, 159, 255, 0.07));
}
.social-rules-callout-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 14px 16px;
}
.social-rules-callout-copy .eyebrow {
  margin: 0 0 4px;
}
.social-rules-callout-text {
  margin: 0;
  max-width: 48rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.social-rules-callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.social-rules-pane-intro {
  margin: 0 0 12px;
  max-width: 44rem;
  font-size: 0.8rem;
}
.social-rules-pane-frame {
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  overflow: hidden;
  background: var(--bg-card, rgba(0, 0, 0, 0.12));
}

/* Rules tab — iframe loads /rules?embed=1 */
.social-rules-frame {
  width: 100%;
  min-height: min(70vh, 560px);
  border: 0;
  border-radius: 0;
  background: transparent;
  display: block;
  box-sizing: border-box;
}
