@import url('../news/style.css');

.is-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-moment .post-badge.moment {
  background: rgba(255, 46, 147, 0.12);
  color: var(--cortis-pink);
  border: 1px solid rgba(255, 46, 147, 0.3);
}

.page-moment .news-hero h1 .highlight {
  color: var(--cortis-pink);
}

.moment-hero-compact {
  margin-bottom: 16px;
}

.moment-hero-compact h1 {
  font-size: clamp(24px, 4vw, 32px);
  margin-top: 8px;
}

.moment-hero-compact p {
  display: none;
}

/* Facebook-style compose bar */
.moment-compose-bar {
  max-width: 680px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.moment-compose-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.moment-compose-avatar,
.moment-compose-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
}

.moment-compose-avatar img,
.moment-compose-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.moment-compose-avatar.has-photo,
.moment-compose-user-avatar.has-photo {
  color: transparent;
}

.moment-compose-avatar.has-photo img,
.moment-compose-user-avatar.has-photo img {
  display: block;
}

.author-avatar {
  overflow: hidden;
  flex-shrink: 0;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.author-avatar.has-photo img {
  display: block;
}

.author-avatar-fallback {
  display: block;
}

.author-avatar.has-photo .author-avatar-fallback {
  display: none;
}

.moment-compose-placeholder {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.moment-compose-quick {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.moment-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  pointer-events: none;
}

.moment-quick-btn .ico {
  width: 24px;
  height: 24px;
  stroke-width: 1.75;
}

.moment-quick-btn.is-video .ico { color: #f3425f; }
.moment-quick-btn.is-photo .ico { color: #45bd62; }
.moment-quick-btn.is-feeling { color: #f7b928; }

/* Compose modal */
.moment-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 24px;
  background: rgba(0, 0, 0, 0.65);
  overflow-y: auto;
}

.moment-compose-overlay[hidden] {
  display: none !important;
}

body.moment-compose-open {
  overflow: hidden;
}

.moment-compose-modal {
  width: min(100%, 500px);
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}

.moment-compose-modal-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 48px;
  border-bottom: 1px solid var(--border);
}

.moment-compose-modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.moment-compose-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.moment-compose-close:hover {
  background: var(--border);
  color: var(--text-main);
}

.moment-compose-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 0;
}

.moment-compose-user-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.moment-compose-user-meta strong {
  font-size: 15px;
  font-weight: 800;
}

.moment-compose-audience {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.moment-compose-editor-wrap {
  padding: 12px 16px 0;
}

.moment-compose-body {
  min-height: 120px;
  max-height: min(40vh, 280px);
  overflow-y: auto;
  padding: 4px 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 400;
  outline: none;
}

.moment-compose-body.is-empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.moment-compose-body:focus {
  outline: none;
}

.moment-compose-preview {
  padding: 0 16px 12px;
}

.moment-compose-preview[hidden] {
  display: none !important;
}

.moment-compose-preview.is-drag {
  outline: 2px dashed var(--cortis-blue);
  outline-offset: 4px;
  border-radius: 8px;
}

.moment-photo-add-more {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.moment-photo-add-more:hover {
  border-color: var(--cortis-green);
  color: var(--cortis-green);
}

.moment-photo-grid {
  display: grid;
  gap: 3px;
  overflow: hidden;
  background: #000;
  text-decoration: none;
  color: inherit;
}

.moment-compose-photo-grid {
  border-radius: 8px;
}

.moment-photo-grid.is-1 { grid-template-columns: 1fr; }
.moment-photo-grid.is-2 { grid-template-columns: repeat(2, 1fr); }

.moment-photo-grid.is-3 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(2, 1fr);
}

.moment-photo-grid.is-3 .moment-photo-cell:first-child {
  grid-row: 1 / span 2;
}

.moment-photo-grid.is-4,
.moment-photo-grid.is-many {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.moment-photo-cell {
  position: relative;
  min-height: 120px;
  background: #111;
}

.moment-compose-photo-grid .moment-photo-cell {
  min-height: 100px;
}

.moment-photo-cell img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  display: block;
}

.moment-photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.moment-photo-remove .ico {
  width: 14px;
  height: 14px;
}

.moment-photo-more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  pointer-events: none;
}

.moment-feed-card .moment-photo-grid {
  margin: 0 -16px 12px;
  border-radius: 0;
}

.moment-feed-card .moment-photo-grid .moment-photo-cell {
  min-height: 180px;
}

.page-moment-single .moment-photo-grid {
  border-radius: 12px;
  margin-bottom: 12px;
}

.moment-cover-drop {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  min-height: 0;
}

.moment-cover-drop.has-image {
  min-height: 180px;
}

.moment-cover-drop img {
  width: 100%;
  max-height: min(50vh, 360px);
  object-fit: contain;
  display: block;
}

.moment-cover-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.moment-compose-add {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}

.moment-compose-add-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.moment-compose-add-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.moment-add-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.moment-add-btn:hover {
  background: var(--surface-muted);
}

.moment-add-btn .ico {
  width: 24px;
  height: 24px;
}

.moment-add-btn.is-photo .ico { color: #45bd62; stroke: #45bd62; }
.moment-add-btn.is-video .ico { color: #f3425f; stroke: #f3425f; }
.moment-add-btn.is-feeling { color: #f7b928; }

.moment-compose-foot {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.moment-compose-foot .link-btn {
  text-align: center;
  font-size: 13px;
}

.moment-compose-post {
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--cortis-blue);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.moment-compose-post:disabled {
  background: color-mix(in srgb, var(--text-muted) 35%, var(--border));
  color: color-mix(in srgb, var(--text-muted) 80%, transparent);
  cursor: not-allowed;
}

.moment-compose-post:not(:disabled):hover {
  filter: brightness(1.08);
}

.page-moment-create .editor-body {
  min-height: 320px;
}

.moment-compose-body .media-file-wrap,
.moment-compose-body .editor-image-wrap {
  margin: 8px 0;
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 640px) {
  .moment-compose-overlay {
    padding: 0;
    align-items: stretch;
  }

  .moment-compose-modal {
    width: 100%;
    min-height: 100%;
    border-radius: 0;
  }

  .moment-compose-quick {
    gap: 0;
  }

  .moment-quick-btn {
    width: 32px;
    height: 32px;
  }

  .moment-compose-placeholder {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Facebook-style moment feed */
.moment-feed {
  max-width: 680px;
  margin: 0 auto;
}

.moment-feed-card {
  padding: 16px 16px 12px;
}

.moment-feed-card .feed-post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.moment-feed-card .feed-post-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-post-head-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.feed-post-author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.feed-post-author-name {
  min-width: 0;
}

.feed-post-author-link {
  color: inherit;
  text-decoration: none;
}

.feed-post-author-link:hover .feed-post-author-name {
  color: var(--cortis-green);
}

.feed-post-author-link .author-avatar {
  transition: transform 0.2s ease;
}

.feed-post-author-link:hover .author-avatar {
  transform: scale(1.04);
}

.author-follower-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.post-author-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.post-author-meta .author-follower-count {
  font-size: 12px;
}

.moment-feed-card .post-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.moment-feed-card .feed-post-header .post-badge.pinned {
  margin-left: 0;
}

.moment-feed-card .feed-post-meta strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.moment-feed-card .feed-post-meta time {
  font-size: 11px;
  color: var(--text-subtle);
}

.moment-feed-card .feed-post-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.moment-feed-card .feed-post-body {
  margin-bottom: 0;
  color: var(--text-primary);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.moment-feed-card .feed-post-body:not(.is-expanded) {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.moment-feed-card .feed-post-body.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.moment-feed-card .feed-post-wrap {
  margin-bottom: 12px;
}

.moment-feed-card .feed-post-more {
  display: inline-flex;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cortis-green);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.moment-feed-card .feed-post-more:hover {
  text-decoration: underline;
}

.moment-feed-card .feed-post-body.post-content img {
  margin: 8px 0;
}

.moment-feed-card .feed-media {
  margin: 0 -16px 12px;
  border-radius: 0;
}

.moment-feed-card .feed-media .feed-cover {
  border-radius: 0;
  max-height: min(70vh, 520px);
}

.moment-feed-card .post-actions {
  margin-top: 4px;
  justify-content: space-around;
}

.moment-feed-card .post-actions .action-btn {
  flex: 1;
  justify-content: center;
  border: none;
  background: transparent;
}

.moment-feed-card .post-actions .action-btn:hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.moment-feed-card .feed-comments {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.moment-feed-card .feed-comments:not(.is-open) .inline-comments-list {
  display: none;
}

.moment-feed-card .inline-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.moment-feed-card .inline-comment-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 14px;
  resize: none;
  min-height: 40px;
}

.moment-feed-card .inline-comment-form .btn-sm {
  align-self: flex-end;
  padding: 8px 16px;
  font-size: 13px;
}

.moment-feed-card .inline-comments-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.moment-feed-card .inline-comments-list .comment-item {
  font-size: 13px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 12px;
}

.moment-feed-card .inline-comments-list .comment-item strong {
  color: var(--text-primary);
  margin-right: 6px;
}

.moment-feed-card .inline-comments-list .comment-item time {
  font-size: 11px;
  color: var(--text-subtle);
}

.moment-feed-card .inline-comments-list .comment-item p {
  margin: 4px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.moment-feed-card .feed-inline-media {
  margin: 10px -16px;
  overflow: hidden;
  background: #000;
}

.moment-feed-card .feed-inline-image img,
.moment-feed-card .feed-inline-video video,
.moment-feed-card video.feed-inline-video {
  width: 100%;
  max-height: min(70vh, 520px);
  object-fit: contain;
  display: block;
  margin: 0;
  border-radius: 0;
  background: #000;
}

.page-moment-single .feed-inline-media {
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.page-moment-single .feed-inline-image img,
.page-moment-single .feed-inline-video video {
  width: 100%;
  max-height: min(70vh, 560px);
  display: block;
  margin: 0;
}

.moment-feed-card .post-content iframe {
  margin: 8px -16px;
  width: calc(100% + 32px);
  max-width: none;
  border-radius: 0;
}

/* Stories — หมดอายุใน 24 ชม. */
.moment-stories {
  max-width: 680px;
  margin: 0 auto 16px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.moment-stories-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.story-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  max-width: 72px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.story-ring-avatar {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  color: var(--text-muted);
  overflow: hidden;
  flex-shrink: 0;
}

.story-ring-avatar.has-story {
  padding: 3px;
  background: linear-gradient(135deg, #ff2e93, #ffb347, #94b091);
}

.story-ring-avatar.has-story::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg-card);
  z-index: 0;
}

.story-ring-avatar img,
.story-ring-initial {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}

.story-ring-placeholder {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  color: var(--cortis-pink);
}

.story-ring-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.story-viewer[hidden] {
  display: none !important;
}

body.story-viewer-open {
  overflow: hidden;
}

.story-viewer-frame {
  position: relative;
  width: min(420px, 100%);
  height: min(760px, calc(100vh - 32px));
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.story-viewer-progress {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  gap: 4px;
}

.story-progress-segment {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.story-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: #fff;
  border-radius: inherit;
}

.story-progress-segment.is-done .story-progress-fill {
  width: 100%;
}

.story-progress-segment.is-active .story-progress-fill {
  animation: story-progress-fill 5s linear forwards;
}

@keyframes story-progress-fill {
  from { width: 0; }
  to { width: 100%; }
}

.story-viewer-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 12px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.story-viewer-author {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.story-viewer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}

.story-viewer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-viewer-author-meta {
  min-width: 0;
  color: #fff;
}

.story-viewer-author-meta strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.story-viewer-author-meta time {
  display: block;
  font-size: 11px;
  opacity: 0.8;
}

.story-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.story-viewer-delete {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.story-viewer-delete:hover {
  background: rgba(255, 77, 77, 0.85);
}

.story-viewer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.story-viewer-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.story-viewer-media img,
.story-viewer-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.story-viewer-nav {
  position: absolute;
  top: 72px;
  bottom: 0;
  width: 34%;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.story-viewer-prev {
  left: 0;
}

.story-viewer-next {
  right: 0;
}

/* ── Moment + member sidebar ── */
.page-moment-has-sidebar {
  overflow: hidden;
}

.moment-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100dvh - var(--nav-height));
  max-height: calc(100dvh - var(--nav-height));
  overflow: hidden;
  background: var(--bg-main);
}

.moment-shell .messages-desktop-sidebar,
.moment-shell .dm-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.moment-shell .dm-user-scroll,
.moment-shell #messagesBody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.moment-shell .dm-user-scroll::-webkit-scrollbar,
.moment-shell #messagesBody::-webkit-scrollbar {
  width: 6px;
}

.moment-shell .dm-user-scroll::-webkit-scrollbar-thumb,
.moment-shell #messagesBody::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
}

html[data-theme="light"] .moment-shell .dm-user-scroll,
html[data-theme="light"] .moment-shell #messagesBody {
  scrollbar-color: rgba(0, 0, 0, 0.24) transparent;
}

html[data-theme="light"] .moment-shell .dm-user-scroll::-webkit-scrollbar-thumb,
html[data-theme="light"] .moment-shell #messagesBody::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.24);
}

.moment-shell-feed {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  height: calc(100dvh - var(--nav-height));
}

.moment-shell-feed .moment-page {
  max-width: 620px;
  margin: 0 auto;
  padding: 12px 16px 48px;
}

.moment-shell-feed .moment-hero-compact {
  margin-bottom: 12px;
}

.moment-hero-top {
  display: block;
}

.moment-members-toggle {
  display: none;
}

.moment-shell-feed .moment-compose-bar {
  margin-bottom: 12px;
}

.dm-sidebar-all-users .dm-user-preview {
  color: var(--cortis-green);
  font-weight: 600;
}

.dm-user-row-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 6px;
}

.dm-user-row-wrap .dm-user-row {
  flex: 1;
  min-width: 0;
}

.dm-sidebar-follow {
  flex-shrink: 0;
  padding: 5px 9px;
  font-size: 10px;
  line-height: 1.2;
}

.dm-sidebar-follow.is-following {
  padding: 5px 8px;
}

@media (max-width: 900px) {
  .moment-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .page-moment-has-sidebar {
    overflow: auto;
  }

  .page-moment-has-sidebar.moment-sidebar-open,
  body.moment-sidebar-open.page-moment-has-sidebar {
    overflow: hidden;
  }

  .page-moment-has-sidebar .moment-shell {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .page-moment-has-sidebar .moment-shell .messages-desktop-sidebar,
  .page-moment-has-sidebar .moment-shell .dm-sidebar {
    display: flex;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    height: auto;
    max-height: none;
    z-index: 410;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: none;
    border-right: 1px solid var(--border);
  }

  .page-moment-has-sidebar .moment-shell.moment-sidebar-open .dm-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.38);
  }

  .page-moment-has-sidebar .moment-shell.moment-sidebar-open::before {
    content: '';
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    background: rgba(0, 0, 0, 0.48);
    z-index: 405;
  }

  .page-moment-has-sidebar .moment-shell-feed {
    height: auto;
    min-height: calc(100dvh - var(--nav-height));
  }

  .moment-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .moment-hero-copy {
    flex: 1;
    min-width: 0;
  }

  .moment-members-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: 4px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-main);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .moment-members-toggle-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    line-height: 1.1;
  }

  .moment-members-toggle-text strong {
    font-size: 12px;
    font-weight: 800;
  }

  .moment-members-toggle-text small {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
  }

  .moment-members-toggle .ico {
    width: 16px;
    height: 16px;
  }

  .dm-sidebar-follow {
    padding: 7px 10px;
    font-size: 11px;
    min-height: 34px;
  }

  .dm-user-row {
    min-height: 56px;
    padding: 10px 12px;
  }

  .moment-user-action-sheet {
    padding: 0 0 max(16px, env(safe-area-inset-bottom));
  }

  .moment-user-action-sheet-panel {
    width: 100%;
    border-radius: 16px 16px 0 0;
    margin-bottom: 0;
  }

  .moment-user-action-btn {
    min-height: 52px;
    padding: 16px 18px;
  }

  .moment-user-action-cancel {
    min-height: 48px;
    margin-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .page-moment-has-sidebar .messages-float-trigger {
    bottom: max(20px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
  }

  .page-moment-has-sidebar .messages-float {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right));
  }
}

@media (min-width: 768px) {
  .moment-members-toggle {
    display: none;
  }
}

.feed-post-author-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.btn-message-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 176, 145, 0.45);
  background: rgba(148, 176, 145, 0.12);
  color: var(--cortis-green);
  font-size: 11px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-message-sm .ico {
  width: 13px;
  height: 13px;
}

.btn-message-sm:hover {
  background: rgba(148, 176, 145, 0.22);
  border-color: var(--cortis-green);
}

/* ── Sidebar user action sheet ── */
.moment-user-action-sheet {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.moment-user-action-sheet[hidden] {
  display: none !important;
}

.moment-user-action-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.52);
  cursor: pointer;
}

.moment-user-action-sheet-panel {
  position: relative;
  width: min(360px, 100%);
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: momentUserSheetIn 0.22s ease;
}

@keyframes momentUserSheetIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.moment-user-action-sheet-title {
  margin: 0;
  padding: 16px 18px 10px;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}

.moment-user-action-sheet-actions {
  display: flex;
  flex-direction: column;
}

.moment-user-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}

.moment-user-action-btn:last-child {
  border-bottom: none;
}

.moment-user-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.moment-user-action-btn[data-action="chat"] {
  color: var(--cortis-green);
}

.moment-user-action-cancel {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.moment-user-action-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.moment-user-action-open {
  overflow: hidden;
}

@media (min-width: 768px) {
  .moment-user-action-sheet {
    align-items: center;
  }
}
