/* ===== Avatar ===== */
img.emoji {
    max-width: 100%!important;
}

.avatar-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  border-radius: 50%;
  border: 1px solid #ccc;
}

.avatar-frame {
  width: 48px;
  height: 48px;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}

.avatar-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
}

/* ===== Badge ===== */
.rank-background {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 12px;
  background-size: cover;
  background-repeat: no-repeat;
  color: #fff;
  max-width: 100%;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ===== Comment content ===== */
.comment-content {
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
}

.comment-item {
  margin-bottom: 1.5rem;
}

/* ===== Comment actions ===== */
.comment-actions {
  font-size: 13px;
  gap: 1rem;
  flex-wrap: wrap;
}

.vote-wrap {
  cursor: pointer;
}

.vote-wrap:hover .vote-btn {
  text-decoration: underline;
}

.vote-count {
  font-weight: 600;
  color: #0073aa;
}

/* ===== Reply form ===== */
.reply-form textarea {
  font-size: 14px;
  resize: vertical;
}

/* ===== Emoji buttons ===== */
.emoji-box {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.emoji-btn {
  font-size: 18px;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.emoji-btn.active-emoji {
  background-color: #e0f7ff;
  border-color: #00aaff;
  box-shadow: 0 0 0 2px rgba(0,170,255,0.2);
}

.emoji-btn.animate-react {
  animation: pop-react 0.3s ease;
}

@keyframes pop-react {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ===== Emoji summary ===== */
.emoji-summary span {
  display: inline-block;
  margin-right: 10px;
  font-size: 15px;
}

/* ===== Comment sorting UI ===== */
#sort-comments {
  min-width: 140px;
}

/* ===== Load more button ===== */
#load-more-btn {
  padding: 6px 16px;
}

/* ===== Highlight new comment ===== */
.comment-item.new-comment {
  animation: highlightFade 2s ease-in-out;
  background: #e6f7ff;
  border-left: 3px solid #0073aa;
  padding-left: 10px;
}

@keyframes highlightFade {
  0%   { background-color: #dff6fd; }
  100% { background-color: transparent; }
}

/* ===== Comment count bar ===== */
.comment-count-bar {
  width: 100%;
  height: 4px;
  background: #eee;
  border-radius: 4px;
  margin-top: 4px;
}

.comment-count-bar-inner {
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, #00c6ff, #0072ff);
  animation: loadbar 3s infinite linear;
  border-radius: 4px;
}

@keyframes loadbar {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===== Responsive tweaks ===== */
@media (max-width: 576px) {
  .avatar-wrapper {
    width: 40px;
    height: 40px;
  }

  .avatar-img,
  .avatar-frame {
    width: 40px;
    height: 40px;
  }

  .comment-content {
    font-size: 14px;
  }

  .emoji-btn {
    font-size: 16px;
  }

  .comment-actions {
    font-size: 12px;
  }

  .rank-background {
    font-size: 11px;
  }
}
