/* social-feed.css — ClassPulse social timeline integrated into the app.
   Scoped to the #view-social section + its modals so it never leaks into
   other views. Uses the app's existing design tokens with safe fallbacks. */

#view-social { max-width: 720px; width: 100%; margin-inline: auto; }

/* Top / Recent ranking toggle in the section header */
.sc-mode-toggle { display: flex; gap: 4px; background: var(--surface2, #f3f4f6); padding: 3px; border-radius: 10px; }
.sc-mode-btn {
  border: none; background: transparent; cursor: pointer; padding: 6px 14px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; color: var(--text2, #6b7280);
}
.sc-mode-btn.active { background: var(--surface, #fff); color: var(--accent, #6366f1); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---- composer ---- */
.sc-composer {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.sc-composer-row { display: flex; gap: 10px; align-items: flex-start; }
.sc-textarea {
  flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 220px;
  border: none; outline: none; background: var(--surface2, #f3f4f6);
  border-radius: 22px; padding: 11px 16px; font-size: .95rem;
  color: var(--text, #111); font-family: inherit;
}
.sc-composer-images { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0 50px; }
.sc-thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border, #e5e7eb); }
.sc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sc-thumb-x {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: none;
  border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 14px; line-height: 1;
}
.sc-composer-actions { display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; gap: 10px; margin-top: 12px; border-top: 1px solid var(--border, #e5e7eb); padding-top: 12px; }
.sc-composer-btn {
  display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; white-space: nowrap;
  color: var(--accent, #6366f1); font-weight: 600; font-size: .85rem; cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
#social-post-btn { margin-left: auto; }
.sc-composer-btn:hover { background: var(--surface2, #f3f4f6); }
.sc-privacy-group {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  background: var(--surface2, #f3f4f6); border: 1px solid var(--border, #e5e7eb);
  padding: 3px; border-radius: 10px;
}
.sc-privacy-opt {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border: none; background: transparent; cursor: pointer; padding: 6px 10px;
  border-radius: 8px; font-size: .8rem; font-weight: 600; color: var(--text2, #6b7280);
  font-family: inherit;
}
.sc-privacy-opt:hover { background: rgba(99,102,241,.10); }
.sc-privacy-opt.active { background: var(--surface, #fff); color: var(--accent, #6366f1); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.sc-privacy-chip { display: inline-flex; align-items: center; gap: 3px; }

/* ---- feed ---- */
#social-feed { display: flex; flex-direction: column; gap: 14px; }
.sc-post {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: box-shadow .18s ease, transform .18s ease;
}
.sc-post:hover { box-shadow: 0 8px 22px rgba(16,24,40,.09); }
.sc-post-head { display: flex; align-items: center; gap: 10px; }
.sc-author-btn { border: none; background: transparent; padding: 0; cursor: pointer; }
.sc-post-meta { flex: 1; min-width: 0; }
.sc-post-name { display: flex; align-items: center; gap: 5px; }
.sc-name-btn { border: none; background: transparent; padding: 0; font-weight: 700; color: var(--text, #111); cursor: pointer; font-size: .95rem; }
.sc-verified { color: #fff; background: var(--accent, #6366f1); border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.sc-verified svg { width: 11px; height: 11px; }
.sc-post-sub { font-size: .76rem; color: var(--text3, #9ca3af); }
.sc-post-menu { display: flex; gap: 4px; }
.sc-icon-btn { border: none; background: transparent; color: var(--text3, #9ca3af); cursor: pointer; padding: 6px; border-radius: 8px; }
.sc-icon-btn:hover { background: var(--surface2, #f3f4f6); color: var(--danger, #ef4444); }

.sc-post-text { margin: 12px 0 0; font-size: .94rem; line-height: 1.55; color: var(--text, #111); word-break: break-word; }
.sc-post-images { display: grid; gap: 3px; margin-top: 12px; border-radius: 12px; overflow: hidden; }
.sc-post-images.sc-1 { grid-template-columns: 1fr; }
.sc-post-images.sc-2 { grid-template-columns: 1fr 1fr; }
.sc-post-images.sc-3, .sc-post-images.sc-4 { grid-template-columns: 1fr 1fr; }
.sc-post-images img { width: 100%; height: 100%; object-fit: cover; max-height: 420px; cursor: pointer; background: var(--surface2, #f3f4f6); }
.sc-1 img { max-height: 520px; }

.sc-stats { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: .8rem; color: var(--text3, #9ca3af); }
.sc-reactions-sum { white-space: nowrap; flex: none; }
.sc-reaction-chips { letter-spacing: -2px; }
.sc-stat-btn { border: none; background: transparent; color: var(--text3, #9ca3af); cursor: pointer; font-size: .8rem; white-space: nowrap; flex: none; }

.sc-actions { display: flex; align-items: center; flex-wrap: wrap; row-gap: 4px; gap: 2px; border-top: 1px solid var(--border, #e5e7eb); margin-top: 8px; padding-top: 6px; }
.sc-react-btn {
  border: none; background: transparent; cursor: pointer; border-radius: 8px;
  padding: 7px 9px; font-size: 1.05rem; line-height: 1; transition: transform .08s, background .12s;
}
.sc-react-btn:hover { background: var(--surface2, #f3f4f6); transform: scale(1.15); }
.sc-react-btn.active { background: var(--surface2, #eef2ff); outline: 2px solid var(--accent, #6366f1); }
.sc-comment-btn { margin-left: auto; font-size: .84rem; font-weight: 600; color: var(--text2, #6b7280); white-space: nowrap; }
.sc-comment-btn svg { vertical-align: -3px; }
.sc-emoji { filter: grayscale(0); }

/* ---- comments ---- */
.sc-comment-area { margin-top: 10px; border-top: 1px dashed var(--border, #e5e7eb); padding-top: 10px; }
.sc-comment-list { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.sc-comments-empty { font-size: .82rem; color: var(--text3, #9ca3af); text-align: center; padding: 8px; }
.sc-comment { display: flex; gap: 8px; }
.sc-comment-bubble { background: var(--surface2, #f3f4f6); border-radius: 14px; padding: 8px 12px; flex: 1; min-width: 0; }
.sc-comment-name { font-weight: 700; font-size: .82rem; color: var(--text, #111); cursor: pointer; }
.sc-comment-text { font-size: .86rem; color: var(--text, #111); word-break: break-word; margin-top: 1px; }
.sc-comment-tools { display: flex; gap: 12px; font-size: .72rem; color: var(--text3, #9ca3af); margin-top: 4px; }
.sc-link-btn { border: none; background: transparent; color: var(--accent, #6366f1); cursor: pointer; font-size: .72rem; padding: 0; }
.sc-comment-input-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.sc-comment-input { flex: 1; min-width: 0; border: 1px solid var(--border, #e5e7eb); background: var(--surface2, #f3f4f6); border-radius: 20px; padding: 9px 14px; font-size: .86rem; color: var(--text, #111); font-family: inherit; outline: none; }

/* ---- avatars ---- */
.sc-avatar { display: inline-flex; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; align-items: center; justify-content: center; flex: none; }
.sc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-avatar-fallback { background: var(--brand-grad, linear-gradient(135deg,#6366f1,#8b5cf6)); color: #fff; font-weight: 700; }
.sc-avatar-sm { width: 40px; height: 40px; }
.sc-avatar-xs { width: 30px; height: 30px; font-size: .8rem; }
.sc-avatar-lg { width: 68px; height: 68px; font-size: 1.4rem; border: 3px solid var(--surface, #fff); }
.sc-avatar-lg img { border-radius: 50%; }

/* ---- loading ---- */
.sc-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text3, #9ca3af); font-size: .88rem; }
.sc-spinner { width: 20px; height: 20px; border: 3px solid var(--border, #e5e7eb); border-top-color: var(--accent, #6366f1); border-radius: 50%; animation: sc-spin .8s linear infinite; }
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* ---- profile modal ---- */
.sc-profile-body { position: relative; }
.sc-profile-cover { height: 96px; background: var(--brand-grad, linear-gradient(135deg,#6366f1,#8b5cf6)); border-radius: 12px 12px 0 0; }
.sc-profile-head { display: flex; gap: 12px; align-items: flex-end; padding: 0 16px; margin-top: -34px; }
.sc-profile-head > div { padding-bottom: 6px; }
.sc-profile-name { font-weight: 800; font-size: 1.1rem; color: #fff; display: flex; align-items: center; gap: 6px; }
.sc-profile-sub { font-size: .82rem; color: var(--text2, #6b7280); }
.sc-profile-stats { display: flex; gap: 24px; padding: 14px 16px; }
.sc-profile-stats div { display: flex; flex-direction: column; }
.sc-profile-stats b { font-size: 1.05rem; color: var(--text, #111); }
.sc-profile-stats span { font-size: .76rem; color: var(--text3, #9ca3af); }
.sc-profile-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border, #e5e7eb); }
.sc-profile-actions .btn { flex: 1; justify-content: center; }
.sc-profile-sub { color: rgba(255,255,255,.9) !important; text-shadow: 0 1px 3px rgba(0,0,0,.35); }

/* ---- clickable user names (feed / friends / leaderboard / community) ---- */
button.fr-name {
  background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left; max-width: 100%;
}
button.fr-name:hover { color: var(--accent, #6366f1); text-decoration: underline; }
.sc-name-btn:hover { text-decoration: underline; }
.lb-user[data-sc-author] { cursor: pointer; }
.lb-user[data-sc-author]:hover .lb-name { color: var(--accent, #6366f1); text-decoration: underline; }
.cc-author[data-sc-author] { cursor: pointer; }
.cc-author[data-sc-author]:hover { text-decoration: underline; color: var(--accent, #6366f1); }

/* ---- image viewer ---- */
#sc-viewer { z-index: 4000; }
#sc-viewer img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
#sc-viewer .sc-viewer-inner { display: flex; align-items: center; justify-content: center; }

/* ============ Mobile / tablet polish ============ */

/* Base spacing below the section header */
.sc-stories { margin-bottom: 12px; }

@media (max-width: 640px) {
  #view-social { padding-inline: 2px; }

  #view-social .section-header { gap: 8px; margin-bottom: 10px; }
  #view-social .section-title { font-size: 1.02rem; }
  .sc-mode-btn { padding: 5px 11px; font-size: .78rem; }

  .sc-post-images.sc-1 img { max-height: 380px; }
  .sc-privacy-opt { padding: 6px 8px; font-size: .74rem; gap: 4px; }

  /* Composer — rounded, tighter, gradient Post pill */
  .sc-composer { padding: 12px; border-radius: 16px; }
  .sc-textarea { padding: 10px 14px; font-size: .92rem; border-radius: 20px; }
  .sc-composer-actions { gap: 6px; }
  .sc-composer-btn { padding: 6px 8px; font-size: .78rem; }
  #social-post-btn {
    padding: 8px 18px; border-radius: 999px; color: #fff; font-weight: 700; font-size: .82rem;
    background: var(--brand-grad, linear-gradient(135deg,#6366f1,#06b6d4));
    box-shadow: 0 4px 14px rgba(99,102,241,.35);
    transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
  }
  #social-post-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,.42); }
  #social-post-btn:active { transform: scale(.94); }

  /* Feed cards — softer, airier */
  .sc-post { padding: 12px 13px; border-radius: 16px; }
  .sc-post-text { font-size: .92rem; margin-top: 10px; }
  .sc-avatar, .sc-avatar-sm { width: 38px; height: 38px; }
  .sc-post-images { margin-top: 10px; border-radius: 13px; }
  .sc-react-btn { padding: 7px 10px; font-size: 1.02rem; }
  .sc-comment-input { font-size: .88rem; padding: 9px 13px; }
  /* Smooth interactions app-wide inside the feed */
  #view-social button, #view-social .sc-post, #view-social .sc-composer {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Keep the feed clear of the fixed right-side FAB column (+ / chat / volume)
   which floats over content on narrower screens. The card spans (almost) the
   full width — only interactive right-edge rows step inward so the FABs
   never cover a tap target. */
@media (max-width: 840px) {
  #view-social { padding-right: 6px; }
  .sc-actions, .sc-stats { padding-right: 46px; }
  .sc-composer-actions { padding-right: 46px; }
  /* FAB rail: slightly smaller, softer, bouncy tap feel */
  .note-fab, .chat-fab, #tts-toggle-fab {
    filter: drop-shadow(0 4px 10px rgba(16,24,40,.25));
    transition: transform .15s ease;
  }
  .note-fab:active, .chat-fab:active, #tts-toggle-fab:active { transform: scale(.92); }
}

/* ---- ClassPulse brand logo (sidebar + section header) ---- */
.nav-item-classpulse {
  background: linear-gradient(135deg, rgba(99,102,241,.14), rgba(6,182,212,.14));
  color: var(--text, #111); font-weight: 700; border-radius: 10px; margin-bottom: 8px;
}
.nav-item-classpulse:hover { background: linear-gradient(135deg, rgba(99,102,241,.22), rgba(6,182,212,.22)); }
.nav-item-classpulse.active { background: var(--brand-grad, linear-gradient(135deg,#6366f1,#06b6d4)); color: #fff; }
.nav-item-classpulse .ico { color: var(--accent, #6366f1); animation: cp-icon-glow 3.6s ease-in-out infinite; transition: transform .2s ease; }
.nav-item-classpulse:hover .ico { transform: scale(1.12); }
.nav-item-classpulse.active .ico { color: #fff; }

#view-social .section-title { display: flex; align-items: center; gap: 8px; }
.sc-brand-logo {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  animation: cp-logo-beat 3.6s ease-in-out infinite;
  filter: drop-shadow(0 2px 7px rgba(37,99,235,.38));
  transition: transform .25s ease;
}
#view-social .section-title:hover .sc-brand-logo { transform: scale(1.14) rotate(-4deg); }

@keyframes cp-logo-beat {
  0%, 72%, 100% { transform: scale(1); }
  76% { transform: scale(1.16); }
  80% { transform: scale(1.02); }
  84% { transform: scale(1.12); }
  88% { transform: scale(1); }
}
@keyframes cp-icon-glow {
  0%, 72%, 100% { filter: drop-shadow(0 0 0 rgba(99,102,241,0)); }
  78% { filter: drop-shadow(0 0 7px rgba(6,182,212,.95)); }
  90% { filter: drop-shadow(0 0 0 rgba(99,102,241,0)); }
}
@media (prefers-reduced-motion: reduce) {
  .sc-brand-logo, .nav-item-classpulse .ico { animation: none !important; }
}

/* ---- ClassPulse shared tab bar: Feed / Friends / Messages / Community ---- */
.cp-tabs {
  display: flex; gap: 4px; margin-bottom: 14px; padding: 5px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow-x: auto;
  scrollbar-width: none;
}
.cp-tabs::-webkit-scrollbar { display: none; }
.cp-tab {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 10px; border: none; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--text2, #6b7280);
  font-size: .84rem; font-weight: 700; white-space: nowrap;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.cp-tab .ico { flex: none; }
.cp-tab:hover { background: rgba(99,102,241,.10); color: var(--text, #111); }
.cp-tab:active { transform: scale(.96); }
.cp-tab.active {
  background: var(--brand-grad, linear-gradient(135deg,#6366f1,#06b6d4));
  color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.28);
}
.cp-tab.active .ico { color: #fff; }
.cp-tab-badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: #ef4444; color: #fff; font-size: .66rem; font-weight: 800;
  display: none; align-items: center; justify-content: center; line-height: 1;
}
.cp-tab-badge.show { display: inline-flex; }
@media (max-width: 760px) {
  .cp-tab { flex-direction: column; gap: 3px; font-size: .68rem; padding: 7px 4px; }
}

/* ---- stories strip ---- */
.sc-stories {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px; padding: 12px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.sc-stories:empty { display: none; }
.sc-stories-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.sc-story-tile {
  position: relative; flex: 0 0 auto; width: 76px; border: none; background: transparent;
  cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 0;
}
.sc-story-tile-media {
  position: relative; width: 76px; height: 104px; border-radius: 12px; overflow: hidden;
  background: var(--surface2, #f3f4f6); border: 2px solid var(--border, #e5e7eb);
  display: flex; align-items: center; justify-content: center;
}
.sc-story-tile-media img { width: 100%; height: 100%; object-fit: cover; }
.sc-story-tile-av { position: absolute; top: 6px; left: 6px; }
.sc-story-tile .sc-avatar { border: 2px solid var(--surface, #fff); }
.sc-story-tile-cap {
  font-size: .72rem; color: var(--text2, #6b7280); max-width: 76px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}
.sc-story-add .sc-story-tile-media { border-style: dashed; }
.sc-story-add-inner { color: var(--accent, #6366f1); }
.sc-story-add-badge {
  position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent, #6366f1); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface, #fff);
}
.sc-story-add-badge svg { width: 14px; height: 14px; }

/* ---- story composer ---- */
.sc-story-card { position: relative; max-width: 400px; padding: 0; overflow: hidden; background: #000; }
.sc-story-preview { display: block; width: 100%; max-height: 68vh; object-fit: contain; background: #000; }
.modal-close.sc-on-dark { position: absolute; top: 8px; right: 12px; color: #fff; font-size: 26px; z-index: 2; }
.sc-story-compose-foot { display: flex; gap: 8px; padding: 10px; background: var(--surface, #fff); align-items: center; }

/* ---- story viewer ---- */
.sc-story-viewer { z-index: 4500; }
.sc-story-viewer-inner {
  position: relative; width: min(92vw, 420px); height: min(88vh, 760px);
  background: #000; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sc-story-img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.sc-story-bars { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.sc-story-bar { flex: 1; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; overflow: hidden; }
.sc-story-bar i { display: block; height: 100%; width: 0; background: #fff; }
.sc-story-bar.done i { width: 100%; }
.sc-story-top { position: absolute; top: 18px; left: 10px; right: 10px; display: flex; align-items: center; gap: 10px; z-index: 3; }
.sc-story-who { flex: 1; min-width: 0; color: #fff; display: flex; flex-direction: column; }
.sc-story-who b { font-size: .9rem; }
.sc-story-who span { font-size: .72rem; opacity: .8; }
.sc-story-avatar .sc-avatar { border: 2px solid rgba(255,255,255,.7); }
.sc-story-x { border: none; background: transparent; color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }
.sc-story-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); font-size: .9rem; z-index: 3;
}
.sc-story-nav { position: absolute; top: 0; bottom: 0; width: 32%; z-index: 2; }
.sc-story-prev { left: 0; }
.sc-story-next { right: 0; }

@media (max-width: 640px) {
  .sc-story-tile, .sc-story-tile-media { width: 66px; }
  .sc-story-tile-media { height: 92px; }
  .sc-story-tile-cap { max-width: 66px; }
  .sc-story-viewer-inner { width: 100vw; height: 100vh; border-radius: 0; }
}

/* ---- watched stories sink down ---- */
.sc-story-seen .sc-story-tile-media { border-color: var(--border, #d1d5db); opacity: .72; }
.sc-story-tile-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand-a, #6366f1), var(--brand-b, #8b5cf6));
}
.sc-story-tile-n {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--accent, #6366f1); color: #fff; font-size: .66rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 1.5px solid #fff;
}

/* ---- text-only story ---- */
.sc-story-text {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px; color: #fff; font-size: 1.3rem; font-weight: 700; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; text-align: center; overflow: auto;
  background: linear-gradient(160deg, #4f46e5, #7c3aed);
}
.sc-story-text[hidden] { display: none; }
.sc-story-text-preview {
  min-height: 300px; display: flex; align-items: center; justify-content: center; padding: 26px;
  background: linear-gradient(160deg, #4f46e5, #7c3aed); color: #fff;
  font-size: 1.2rem; font-weight: 700; text-align: center; white-space: pre-wrap; word-break: break-word;
}
.sc-story-text-preview[hidden] { display: none; }
.sc-story-text-preview-txt.is-placeholder { opacity: .55; font-weight: 600; }
.sc-story-preview[hidden] { display: none; }
#sc-story-photo { flex: none; }
.sc-story-compose-foot .sc-comment-input { flex: 1; min-width: 0; }

/* ---- story owner: কারা দেখেছে ---- */
.sc-story-views-btn {
  border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.35); color: #fff;
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 20px;
  font-size: .74rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.sc-story-views-btn[hidden] { display: none; }
.sc-story-views-btn:hover { background: rgba(0,0,0,.55); }
.sc-story-views-panel {
  position: absolute; left: 10px; right: 10px; top: 60px; z-index: 4;
  background: rgba(17,17,17,.93); border: 1px solid rgba(255,255,255,.15); border-radius: 12px;
  padding: 10px; max-height: 55%; overflow: auto; color: #fff;
}
.sc-story-views-panel[hidden] { display: none; }
.sc-story-views-head { font-weight: 700; font-size: .82rem; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sc-story-viewer-row { display: flex; align-items: center; gap: 8px; font-size: .82rem; padding: 5px 2px; }
.sc-story-viewer-t { margin-left: auto; opacity: .6; font-size: .72rem; }

/* ---- profile: ID + their posts (permission-aware) ---- */
.sc-profile-id {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; cursor: pointer;
  font-size: .76rem; color: rgba(255,255,255,.94); background: rgba(0,0,0,.3);
  padding: 3px 8px; border-radius: 20px; max-width: 100%; border: none; font-family: inherit;
}
.sc-profile-idn { opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.sc-profile-id:hover { background: rgba(0,0,0,.48); }
.sc-profile-posts { border-top: 1px solid var(--border, #e5e7eb); padding: 12px 16px 16px; }
.sc-profile-posts-head {
  display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: .86rem;
  color: var(--text, #111);
}
.sc-profile-posts-count { margin-left: auto; font-weight: 600; color: var(--text3, #9ca3af); font-size: .78rem; }
.sc-profile-posts-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-height: 46vh; overflow: auto; }
.sc-ppost {
  background: var(--surface2, #f9fafb); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: 10px 12px;
}
.sc-ppost-meta { font-size: .72rem; color: var(--text3, #9ca3af); display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.sc-ppost-text { font-size: .86rem; color: var(--text, #111); line-height: 1.45; }
.sc-ppost-imgs { display: flex; gap: 5px; margin-top: 7px; }
.sc-ppost-imgs img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.sc-ppost-stats { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text3, #9ca3af); margin-top: 7px; }
.sc-ppost-empty { font-size: .82rem; color: var(--text3, #9ca3af); display: flex; align-items: center; gap: 7px; padding: 4px 0; }


/* ==== Post background themes (composer picker + themed post cards) ==== */
.sc-theme-row { display: flex; align-items: center; gap: 8px; padding: 8px 2px 2px; flex-wrap: wrap; }
.sc-theme-dot {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.14);
  cursor: pointer; padding: 0; flex: 0 0 auto; transition: transform .12s, box-shadow .12s;
}
.sc-theme-dot:hover { transform: scale(1.12); }
.sc-theme-dot.active { box-shadow: 0 0 0 3px rgba(99,102,241,.45); transform: scale(1.1); }
.sc-theme-plain  { background: #ffffff; }
.sc-theme-sunset { background: linear-gradient(135deg, #ff9a56, #ff6a88, #c86dd7); }
.sc-theme-ocean  { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.sc-theme-forest { background: linear-gradient(135deg, #134e5e, #71b280); }
.sc-theme-night  { background: linear-gradient(135deg, #232526, #414345); }
.sc-theme-candy  { background: linear-gradient(135deg, #fbc2eb, #a6c1ee); }
.sc-theme-mono   { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); }

.sc-theme-card {
  border-radius: 14px; padding: 18px 16px; min-height: 64px;
  display: flex; align-items: center; font-size: 1.02rem; font-weight: 600;
  line-height: 1.5; color: #1f2937; margin: 8px 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  word-break: break-word;
}
.sc-theme-card.sc-theme-sunset { background: linear-gradient(135deg, #ff9a56, #ff6a88, #c86dd7); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.sc-theme-card.sc-theme-ocean  { background: linear-gradient(135deg, #2193b0, #6dd5ed); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.sc-theme-card.sc-theme-forest { background: linear-gradient(135deg, #134e5e, #71b280); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.sc-theme-card.sc-theme-night  { background: linear-gradient(135deg, #232526, #414345); color: #f3f4f6; }
.sc-theme-card.sc-theme-candy  { background: linear-gradient(135deg, #fbc2eb, #a6c1ee); color: #4a2c5a; }
.sc-theme-card.sc-theme-mono   { background: linear-gradient(135deg, #eceff1, #cfd8dc); color: #263238; }

/* Daily post quota hint next to the Post button */
.sc-quota-hint { font-size: .72rem; color: var(--text3, #9ca3af); margin-right: 8px; white-space: nowrap; }
.sc-quota-hint.is-full { color: #dc2626; font-weight: 700; }

/* ==== User-created communities (view-community) ==== */
.cm-tabs { display: flex; gap: 6px; background: var(--surface2, #f3f4f6); border-radius: 12px; padding: 4px; }
.cm-tab {
  border: none; background: transparent; padding: 7px 14px; border-radius: 9px;
  font-weight: 700; font-size: .82rem; color: var(--text3, #6b7280); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
}
.cm-tab.active { background: var(--surface, #fff); color: var(--text, #111827); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.cm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.cm-create {
  background: var(--surface2, #f9fafb); border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px;
}
.cm-create-actions { display: flex; gap: 8px; justify-content: flex-end; }

.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cm-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px; padding: 14px; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.cm-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.cm-card-head { display: flex; gap: 10px; align-items: center; }
.cm-card-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.cm-card-meta { min-width: 0; }
.cm-card-name { font-weight: 800; font-size: .95rem; color: var(--text, #111827); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-card-sub { font-size: .74rem; color: var(--text3, #9ca3af); }
.cm-card-desc { font-size: .82rem; color: var(--text2, #4b5563); margin-top: 8px; line-height: 1.4; }
.cm-card-actions { margin-top: 10px; display: flex; gap: 8px; }

.cm-back {
  border: none; background: transparent; color: var(--primary, #6366f1); font-weight: 700;
  cursor: pointer; font-family: inherit; font-size: .86rem; padding: 6px 2px; margin: 8px 0;
}
.cm-room {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px; padding: 16px;
}
.cm-room-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cm-room-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.cm-room-desc { font-size: .86rem; color: var(--text2, #4b5563); margin-top: 10px; line-height: 1.45; }
.cm-composer { margin-top: 14px; }
#cm-members-panel:not([hidden]) { margin-top: 12px; }
.cm-members { display: flex; flex-direction: column; gap: 8px; background: var(--surface2, #f9fafb); border-radius: 12px; padding: 12px; }
.cm-member { display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.cm-member .badge { font-size: .68rem; }
#cm-posts { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.cm-post { margin: 0; }
