/* ===== Comments ===== */
.comments-section { padding: 4px 16px 14px; }
.comments-section > * { transition: filter 120ms ease-out; }
.comments-title { font-size: calc(1rem * var(--content-font-scale, 1)); margin: 0 -16px 6px; padding: 0 16px 4px; border-bottom: 1px solid var(--border-gray); display: flex; align-items: center; gap: 6px; }
.comments-title .btn-comments-refresh { margin-left: 3px; background: transparent; border: none; color: var(--text-gray); display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 1; width: auto; height: auto; border-radius: 6px; cursor: pointer; }
.comments-title .btn-comments-refresh:hover { background: var(--purple-hover); }
.comments-title .btn-comments-refresh i { font-size: 1em; line-height: 1; }
@keyframes comments-refresh-rotate-once { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.comments-title .btn-comments-refresh .spin-once { animation: comments-refresh-rotate-once 600ms ease-in-out; }
.comments-list { max-height: none; overflow: visible; padding-right: 2px; -ms-overflow-style: none; scrollbar-width: none; }
.comments-list::-webkit-scrollbar { width: 0; height: 0; }
.comments-empty { color: var(--text-gray); font-size: calc(0.9rem * var(--content-font-scale, 1)); padding: 8px 2px; }
.comment-item { 
  margin: 0 -16px; 
  padding: 12px 16px; 
  border-bottom: 1px solid var(--border-gray); 
  min-height: 70px; 
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.comment-item.is-deleted .comment-content { color: var(--text-gray); font-style: italic; }
.comments-list > .comment-item:last-child { border-bottom: none; }
.comments-list > .comment-children:last-child > .comment-item:last-child { border-bottom: none; }
.comment-item.root-comment { cursor: pointer; border-radius: 0; }
.comment-item.root-comment:hover { background: var(--purple-hover); }
.comments-list > .comment-item.root-comment:first-child { 
  margin-top: -6px; 
  padding-top: 18px; 
  padding-bottom: 12px; 
  min-height: 76px;
}
.comment-item.depth-1 { padding-left: 34px; position: relative; }
.comment-item.depth-2 { padding-left: 48px; position: relative; }
.comment-item.depth-1::before,
.comment-item.depth-2::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-left: 1px solid #999;
  border-bottom: 1px solid #999;
  opacity: 0.8;
}
.comment-item.depth-2::before {
  left: 36px;
}
.comment-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: calc(0.85rem * var(--content-font-scale, 1)); color: var(--text-gray); }
.comment-meta { display: flex; align-items: center; gap: 8px; }
.comment-author { color: var(--text-primary); font-weight: 600; font-size: calc(0.9rem * var(--content-font-scale, 1)); }
.comment-time { font-size: calc(0.8rem * var(--content-font-scale, 1)); color: var(--text-gray); display: inline-flex; align-items: center; }
.comment-time i { margin-right: 4px; font-size: 0.95em; }
.btn-comment-delete { color: var(--text-gray); }
body.dark-mode .btn-comment-delete { color: #fff; }
.comment-content { margin-top: 4px; line-height: 1.4; white-space: pre-wrap; font-size: calc(1rem * var(--content-font-scale, 1)); }
.comment-children { margin-top: 6px; }
.comments-editor { margin-top: 12px; }
.reply-indicator { display: inline-flex; align-items: center; gap: 8px; font-size: calc(0.8rem * var(--content-font-scale, 1)); color: var(--text-gray); }
.reply-indicator i { font-size: 0.9rem; color: var(--main-purple); }
.reply-indicator .reply-cancel { background: none; border: none; color: var(--main-purple); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.comment-form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.comment-input-wrap { position: relative; flex: 1; }
.comment-row { display: flex; align-items: flex-start; gap: 8px; }
.comment-password-side { display: inline-flex; align-items: center; gap: 6px; }
.comment-password-side .comment-anon-password { color: var(--text-primary); background: var(--background-white); border: 1px solid var(--border-gray); border-radius: 6px; }
.comment-password-side .comment-anon-password::placeholder { color: var(--text-gray); }
.comment-password-side .comment-pin { display: inline-flex; align-items: center; gap: 6px; }
.comment-password-side .comment-pin .pin-digit {
  width: 28px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--border-gray);
  border-radius: 6px;
  background: var(--background-white);
  color: var(--text-primary);
  font-size: 16px;
  padding: 0;
}
body.dark-mode .comment-password-side .comment-pin .pin-digit {
  background: var(--background-white);
}
.reply-icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--main-purple); font-size: 14px; display: none; pointer-events: none; }
.comment-form.reply-mode .reply-icon { display: inline-block; }
.comment-form.reply-mode .comment-input { padding-left: 28px; }
.comment-input { width: 100%; resize: none; padding: 8px 44px 8px 10px; border: none; box-shadow: inset 0 0 0 1px var(--border-gray); border-radius: 6px; background: transparent; color: var(--text-primary); line-height: 34px; height: 50px; overflow: auto; -ms-overflow-style: none; scrollbar-width: none; font-size: 16px; }
.comment-form.has-text .comment-input { padding-right: 88px; }
.comment-input::-webkit-scrollbar { width: 0; height: 0; }
.comment-auth-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--text-gray);
    font-size: 0.85rem;
}
.comment-auth-indicator.show { display: flex; }
.comment-auth-indicator .status-icon { font-size: 14px; }
.comment-auth-indicator .status-anon { color: var(--text-gray); }
.comment-auth-indicator .reply-chip { margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.comment-auth-indicator .reply-cancel { pointer-events: auto; background: none; border: none; color: var(--main-purple); cursor: pointer; padding: 0 4px; border-radius: 6px; }
.comment-auth-indicator.floating {
    position: absolute;
    bottom: calc(100% + 6px);
    left: -1px;
    background: var(--background-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    z-index: 3;
    pointer-events: auto;
    white-space: nowrap;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
}
.comment-pin-pill {
    position: absolute;
    bottom: calc(100% + 6px);
    right: -1px;
    display: none;
    align-items: center;
    gap: 6px;
    background: var(--background-white);
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    z-index: 3;
}
.comment-pin-pill .pin-digit {
    width: 26px;
    height: 32px;
    text-align: center;
    border: 1px solid var(--border-gray);
    border-radius: 6px;
    background: var(--background-white);
    color: var(--text-primary);
    font-size: 16px;
    padding: 0;
}
@media (max-width: 420px) {
  .comment-pin-pill { transform: scale(0.92); transform-origin: right bottom; right: -1px; }
}
.comment-anon-row { width: 100%; }
.comment-anon-row .comment-anon-password {
  width: 100%;
  height: 40px;
  padding: 8px 10px;
  border: none;
  box-shadow: inset 0 0 0 1px var(--border-gray);
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
}
