/* ── Comments Panel ─────────────────────────────────────────────────────── */
.cp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 619;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(10px) brightness(0.75);
  -webkit-backdrop-filter: blur(10px) brightness(0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.32,0.72,0,1);
}
.cp-backdrop.cp-open {
  opacity: 1;
  pointer-events: auto;
}
.cp-panel {
  position: fixed;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 620;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1),
              visibility 0s linear 0.32s;
  will-change: transform;
}
.cp-panel.cp-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.32s cubic-bezier(0.32,0.72,0,1),
              visibility 0s linear 0s;
}
.cp-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px 10px;
  border-bottom: 1.5px solid #d0d0d0;
  background: #ffffff;
  flex-shrink: 0;
  min-height: 52px;
}
.cp-title {
  font-size: 19px;
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.cp-count-badge {
  font-size: 19px;
  font-weight: 600;
  color: #1a1a1a;
}
.cp-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #666;
  border-radius: 50%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.cp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  -webkit-overflow-scrolling: touch;
}
.cp-loading {
  text-align: center;
  color: #999;
  padding: 32px 16px;
  font-size: 14px;
}
.cp-msg {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 90%;
  position: relative;
}
.cp-msg-own {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cp-msg-other {
  align-self: flex-start;
}
.cp-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  background: #ccc;
}
.cp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cp-bubble {
  background: var(--cp-bubble-other, #fdf7f6);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 3px 2px rgba(0,0,0,0.13);
  padding: 0px 5px 7px 0px;
  max-width: 100%;
  position: relative;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1;
  transition: transform 0.15s ease;
  min-width: 100px;
}
.cp-bubble-pressed {
  transform: scale(0.90) translateY(-5px) !important;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  z-index: 997 !important;
  position: relative;
}
.cp-msg-own .cp-bubble {
  background: var(--cp-bubble-own, #e9e4f7);
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 3px 2px rgba(0,0,0,0.13);
  padding: 0px 0px 7px 0px;
  min-width: 100px;
}
.cp-meta {
  margin-bottom: 2px;
  padding: 4px 10px 0px 0px;
}
.cp-author-name {
  font-size: 15px;
  font-weight: 600;
  color: #4caf50;
  padding-left: 10px;
}
.cp-reply-quote {
  background: rgba(0,0,0,0.05);
  border-left: 3px solid #4caf50;
  border-radius: 4px;
  padding: 4px 8px;
  margin: 10px;
  font-size: 12px;
  color: #555;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cp-reply-name {
  font-weight: 600;
  color: #4caf50;
  font-size: 11px;
}
.cp-reply-preview {
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: block;
}
.cp-media-viewer {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cp-mv-back, .cp-mv-more, .cp-mv-share {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: none;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  color: #111;
}
.cp-mv-back:active, .cp-mv-more:active, .cp-mv-share:active { background: rgba(255,255,255,0.90); }
.cp-mv-back { top: 105px; left: 5px; }
.cp-mv-back svg { width: 35px; height: 35px; stroke: #000; stroke-width: 1.5; transform: translateX(-2px); }
.cp-mv-more { top: 105px; right: 5px; }
.cp-mv-share { bottom: 105px; left: 5px; }
.cp-mv-more-menu {
  position: absolute;
  top: 168px;
  right: 10px;
  min-width: 220px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  z-index: 20;
  display: none;
  flex-direction: column;
}
.cp-mv-more-menu.cp-mv-menu-open { display: flex; }
.cp-mv-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: none;
  border: none;
  font-size: 15px;
  font-family: inherit;
  color: #111;
  text-align: left;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.cp-mv-menu-item:active { background: rgba(0,0,0,0.06); }
.cp-mv-menu-item svg { stroke: #444; flex-shrink: 0; }
.cp-mv-menu-danger, .cp-mv-menu-danger svg { color: #e60023; stroke: #e60023; }
.cp-mv-menu-divider { height: 1px; background: rgba(0,0,0,0.10); }
.cp-mv-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.cp-mv-confirm-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  min-width: 260px;
  text-align: center;
}
.cp-mv-confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 18px; color: #111; }
.cp-mv-confirm-btns { display: flex; gap: 10px; justify-content: center; }
.cp-mv-confirm-cancel { flex: 1; padding: 11px; border: 1px solid #ddd; border-radius: 10px; background: #f5f5f5; font-size: 15px; cursor: pointer; }
.cp-mv-confirm-ok { flex: 1; padding: 11px; border: none; border-radius: 10px; background: #e60023; color: #fff; font-size: 15px; cursor: pointer; font-weight: 600; }
.cp-mv-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cp-mv-img {
  width: 100%;
  max-height: 100vh;
  object-fit: contain;
  display: block;
}
.cp-mv-video {
  width: 100%;
  max-height: 100vh;
  display: block;
}
/* ── Media viewer: lazy-load video overlay ────────────────────────────────── */
.cp-mv-vid-wrap {
  position: relative;
  width: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.cp-mv-vid-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.55;
  cursor: pointer;
  pointer-events: auto;
}
.cp-mv-vid-play {
  position: relative;
  z-index: 2;
  cursor: pointer;
  -webkit-touch-callout: none;
}
.cp-mv-vid-play svg {
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  transition: transform 0.15s ease;
}
.cp-mv-vid-play:active svg {
  transform: scale(0.88);
}
/* ── Video poster + lazy-load play button ──────────────────────────────────── */
.cp-vid-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  cursor: pointer;
  -webkit-touch-callout: none;
}
.cp-vid-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(14px);
  transform: scale(1.1);
  pointer-events: none;
}
.cp-vid-play-btn {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}
.cp-vid-play-btn svg {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  transition: transform 0.15s ease;
}
.cp-vid-play-btn:active svg {
  transform: scale(0.88);
}
.cp-media-caption {
  padding: 6px 0px 0px;
}
.cp-media-caption .cp-text {
  margin-bottom: -8px;
}
.cp-media-caption .cp-time {
  margin-top: 1px;
}
.cp-media-time-pill {
  position: absolute;
  bottom: 6px;
  right: 8px;
  z-index: 2;
  background: rgba(0,0,0,0.40);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 2px 7px;
  font-size: 12px;
  color: #ffffff;
  pointer-events: none;
  line-height: 1.5;
}
.cp-attach-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  display: block;
  cursor: pointer;
  margin-bottom: 4px;
}
.cp-attach-video {
  max-width: 200px;
  border-radius: 10px;
  display: block;
  margin-bottom: 4px;
}
.cp-attach-file {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 0;
}
.cp-file-link {
  color: #4caf50;
  text-decoration: none;
  font-size: 12px;
  word-break: break-all;
}
.cp-text {
  font-size: 18px;
  line-height: 1.45;
  color: #1a1a1a;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 6px 25px 0px 15px;
}
.cp-time {
  font-size: 11px;
  color: #999;
  text-align: right;
  margin-top: -9px;
  padding: 7px;
  margin-bottom: -5px;
}
/* ── Scroll-to-bottom button (Telegram style) ── */
.scroll-to-bottom-btn {
  position: absolute;
  right: 16px;
  bottom: 80px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.13);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  color: #555;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.scroll-to-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.cp-footer-row {
  display: flex;
  align-items: flex-end;
  margin-top: 4px;
}
.cp-footer-row .cp-reactions {
  flex: 1;
  margin-top: 0;
}
.cp-footer-row .cp-time {
  margin-left: auto;
  margin-top: 0;
  padding-left: 8px;
  flex-shrink: 0;
}
.cp-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 5px 10px 3px 10px;
}
.cp-reactions-break {
  width: 100%;
  height: 0;
  flex-basis: 100%;
}
.cp-reaction-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--cp-react-other, #ffe8ec);
  border: none;
  border-radius: 999px;
  padding: 6px 7px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
}
.cp-reaction-badge.cp-reaction-mine {
  background: var(--cp-react-mine, #e60023);
  border: none;
}
.cp-reaction-badge.cp-reaction-mine .cp-react-count {
  color: var(--cp-react-mine-text, #fff);
}
.cp-react-count {
  font-size: 14px;
  color: var(--cp-react-other-text, #555);
}
.cp-react-mini-av {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  margin: -6px -4px -6px 0;
}
.cp-react-mini-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cp-react-av-stack {
  display: flex;
  align-items: center;
  margin: -5px -4px -5px 0;
}
.cp-react-av-stack .cp-react-mini-av {
  margin: 0;
  position: relative;
  box-shadow: 0 0 0 1px var(--cp-react-other);
}
.cp-react-av-stack .cp-react-mini-av + .cp-react-mini-av {
  margin-left: -5px;
}
.cp-reaction-mine .cp-react-av-stack .cp-react-mini-av {
  box-shadow: 0 0 0 1px var(--cp-react-mine);
}
/* ── Compose ── */
.cp-compose {
  background: transparent;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.cp-ctx-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 10px 7px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.cp-ctx-accent {
  width: 3px;
  align-self: stretch;
  background: #40a7e3;
  border-radius: 2px;
  flex-shrink: 0;
  margin-right: 10px;
}
.cp-ctx-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cp-ctx-label {
  font-size: 13px;
  font-weight: 600;
  color: #40a7e3;
  line-height: 1.3;
}
.cp-ctx-preview {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.cp-ctx-cancel {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
}
.cp-media-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 2px;
}
.cp-media-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #666;
  flex-shrink: 0;
}
.cp-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cp-thumb-loading {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #e8e8e8 25%, #f2f2f2 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: cp-thumb-shimmer 1.4s infinite;
}
@keyframes cp-thumb-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.cp-media-remove {
  background: rgba(0,0,0,0.12);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  flex-shrink: 0;
}
.cp-compose-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 30px 15px;
  background: #ffffff;
  border-top: 1.5px solid #d0d0d0;
}

html[data-android="1"][data-env="tg"] .cp-compose-row,
html[data-android="1"][data-env="web"] .cp-compose-row {
  padding: 60px 15px;
}

.cp-attach-btn {
  margin-left: -4px;
  background: #f0f0f0;
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
}
.cp-attach-btn, .cp-emoji-btn {
  border: none;
  cursor: pointer;
  color: #888;
  border-radius: 50%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.cp-attach-btn:hover, .cp-emoji-btn:hover { color: #4caf50; }
.cp-emoji-btn { padding: 4px; background: none; }
.cp-input-wrap {
  flex: 1;
  background: #f0f0f0;
  border-radius: 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 4px 8px 4px 14px;
  gap: 4px;
  overflow: hidden;
  min-height: 40px;
}
.cp-input-row {
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 14px;
  gap: 4px;
}
.cp-input {
  flex: 1;
  outline: none;
  border: none;
  background: none;
  font-size: 15px;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
  word-break: break-word;
  color: #1a1a1a;
}
.cp-input:empty::before {
  content: attr(data-placeholder);
  color: #aaa;
  pointer-events: none;
}
.cp-send-btn {
  background: #40a7e3;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.cp-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cp-send-btn:not(:disabled):hover { background: #43a047; }
/* ── Emoji picker ── */
.cp-emoji-picker {
  background: #fff;
  border-top: 1px solid #f0f0f0;
  padding: 8px;
}
.cp-emoji-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cp-emoji-item {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.1s;
}
.cp-emoji-item:hover { background: #f0f0f0; }
/* ── Context menu ── */
.cp-ctx-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.18);
  z-index: 995;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes cp-ctx-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.cp-ctx-menu {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 90%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  z-index: 999;
  overflow: hidden;
}
.cp-ctx-menu.cp-ctx-animating {
  animation: cp-ctx-in 0.28s ease forwards;
}
/* Swipe-to-reply arrow — sits behind bubble (z-index:0 < bubble z-index:1)    */
/* and reveals itself as the bubble translates left.                            */
.dm-swipe-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #555;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}
.cp-ctx-reactions {
  display: flex;
  justify-content: space-around;
  padding: 12px 8px;
  border-bottom: 1px solid #f0f0f0;
}
.cp-ctx-emoji {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.1s, transform 0.1s;
}
.cp-ctx-emoji:hover { background: #f0f0f0; transform: scale(1.2); }
.cp-ctx-expand { font-size: 16px; letter-spacing: 1px; color: #888; }
img.emoji {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  display: inline-block;
  pointer-events: none;
}
.cp-clickable { cursor: pointer; }
.cp-clickable:hover { opacity: 0.75; }
.cp-ctx-actions {
  display: flex;
  flex-direction: column;
}
.cp-ctx-btn {
  background: none;
  border: none;
  text-align: left;
  padding: 14px 20px;
  font-size: 15px;
  cursor: pointer;
  color: #1a1a1a;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.1s;
}
.cp-ctx-btn:last-child { border-bottom: none; }
.cp-ctx-btn:hover { background: #f7f7f7; }
.cp-ctx-danger { color: #e53935; }
/* ── Comments button count badge ── */
.pc-comments-count {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  position: relative;
  top: -1px;
}
/* ── User card overlay ── */
.cp-user-card {
  position: fixed;
  inset: 0;
  z-index: 640;
}
.cp-user-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}
.cp-user-card-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cp-user-card-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  color: #aaa;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}
.cp-user-card-av {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.cp-user-card-av img { width: 100%; height: 100%; object-fit: cover; }
.cp-user-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
  text-align: center;
}
.cp-user-card-bio {
  font-size: 14px;
  color: #777;
  text-align: center;
  margin-bottom: 22px;
  max-width: 280px;
  min-height: 18px;
}
.cp-user-card-link {
  display: block;
  width: 100%;
  background: var(--accent, #4caf50);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  padding: 13px 0;
  border-radius: 24px;
  text-decoration: none;
  cursor: pointer;
}

/* ── Comments compose: floats over messages (same as DM) ── */
#cp-messages.cp-messages {
  padding-bottom: 90px;
}

#cp-compose {
  position: absolute;
  bottom: var(--keyboard-height, 0px);
  left: 0;
  right: 0;
  z-index: 10;
}

#cp-compose.cp-compose {
  border-top: none;
  background: transparent;
  padding-bottom: 0;
}

#cp-compose .cp-compose-row {
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 100%) !important;
  border-top: none !important;
}

#cp-compose .cp-attach-btn {
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.14);
  color: #555;
}

#cp-compose .cp-input-wrap {
  background: rgba(255, 255, 255, 0.60);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.14);
}

#cp-compose .cp-send-btn {
  background: rgba(64, 167, 227, 0.88);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.18);
}

/* ── Pending send / edit indicators ────────────────────────── */

/* Clock SVG shown while a message is in-flight (new or edit) */
.ch-pending-clock {
  display: inline-block;
  vertical-align: middle;
  color: #999;
  flex-shrink: 0;
}

/* Time-pill on media: clock needs flex layout to center */
.cp-media-time-pill .ch-pending-clock {
  display: block;
  margin: auto;
}

/* Dim bubble while edit is awaiting server confirmation */
[data-pending-edit="1"] .cp-bubble {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

/* Dim wrapper for a new message while it is being uploaded */
.cp-msg[data-pending="1"] .cp-bubble {
  opacity: 0.80;
  transition: opacity 0.15s ease;
}

/* ── Comments bar (channel post → open comments) ────────────────────────── */
.ch-comments-sep {
  height: 1px;
  background: var(--sep-color, rgba(128,128,128,0.22));
  margin: 6px 0px 0;
}
.ch-mode-channel .cp-bubble .ch-comments-sep {
  margin: 4px 0px 0;
}
.ch-comments-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 4px;
  margin: 0 -12px -8px;
  cursor: pointer;
  border-radius: 0 0 16px 16px;
  color: var(--accent, #5b9bd5);
  transition: background 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ch-mode-channel .cp-bubble .ch-comments-bar {
  margin: 0 -4px 3px;
  padding: 0px 18px 0px 12px;
  height: 37px;
  box-sizing: border-box;
}
.ch-comments-bar:active {
  background: rgba(91,155,213,0.12);
}
.ch-comments-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.85;
  padding-right: 12px;
}
.ch-comments-icon svg {
  display: block;
}
.ch-comments-label {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-comments-chevron {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.55;
  padding: 4px 0px 0px 15px;
}
.ch-comments-chevron svg {
  display: block;
}

/* ── Comments skeleton ───────────────────────────────────────────────────── */
.cp-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 4px 8px;
}
.cp-skel-msg {
  pointer-events: none;
}
.cp-skel-bubble {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  max-width: 78%;
  background: #e9e9e9;
  background-image: linear-gradient(100deg, #e9e9e9 30%, #f3f3f3 50%, #e9e9e9 70%);
  background-size: 220% 100%;
  animation: cp-skel-shimmer 1.3s ease-in-out infinite;
}
.cp-skel-line {
  height: 11px;
  border-radius: 6px;
  background: rgba(0,0,0,0.09);
  width: 100%;
}
.cp-skel-line-short {
  width: 52%;
}
.cp-skel-media {
  width: 200px;
  max-width: 60vw;
  height: 160px;
  border-radius: 10px;
  background: rgba(0,0,0,0.08);
}
@keyframes cp-skel-shimmer {
  0%   { background-position: 220% 0; }
  100% { background-position: -220% 0; }
}
@media (prefers-color-scheme: dark) {
  .cp-skel-bubble {
    background: #2a2a2a;
    background-image: linear-gradient(100deg, #2a2a2a 30%, #353535 50%, #2a2a2a 70%);
    background-size: 220% 100%;
  }
  .cp-skel-line { background: rgba(255,255,255,0.08); }
  .cp-skel-media { background: rgba(255,255,255,0.06); }
}

/* ── Stacked commenter avatars inside comment bar ────────────────────────── */
.ch-comments-avatars {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  /* chips overlap by 6px each */
  padding-right: 12px;
}
.ch-comments-avatar-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--bubble-bg, #fff);
  overflow: hidden;
  flex-shrink: 0;
  margin-right: -12px;
  background: var(--avatar-placeholder, #c9ccd0);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ch-comments-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
