/* MangaNew — коментарі (comments.tpl, addcomments.tpl): сторінка тайтлу, читалка, колекції.
   Рівний список без рамок, відповіді — гілкою з лінією, дії — тихим текстом. */

/* Дерево коментарів DLE */
.comments-tree-list, #dle-comments-list > ol, .comments-list ol { list-style: none; margin: 0; padding: 0; }
.comments-tree-item { margin: 0; padding: 0; }
.comments-tree-item > .comments-tree-list { margin: 2px 0 6px 21px; padding-left: 18px; border-left: 2px solid var(--line-strong); }
.comments-tree-item > .comments-tree-list .cmt { padding-top: 10px; padding-bottom: 10px; }

/* Коментар */
.cmt { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 10px; margin: 0 -10px; border-radius: 10px; transition: background-color var(--t-fast, .22s) ease; }
.cmt:hover { background: var(--surface); }
.comments-tree-list > .comments-tree-item + .comments-tree-item > div > .cmt::before { content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line); }
.cmt__ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.comments-tree-item .comments-tree-item .cmt { grid-template-columns: 32px minmax(0, 1fr); }
.comments-tree-item .comments-tree-item .cmt__ava { width: 32px; height: 32px; }
.cmt__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cmt__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 14px; }
.cmt__author, .cmt__author a { font-weight: 700; color: var(--text); }
.cmt__author a:hover { color: var(--accent); }
.cmt__badge { padding: 1px 7px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; }
.cmt__date { font-size: 12px; color: var(--muted); }
.cmt__news { font-size: 13px; font-weight: 600; color: var(--accent); }
.cmt__text { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; word-break: break-word; }
.cmt__text img { max-width: 100%; height: auto; border-radius: 8px; }
.cmt__text .quote, .cmt__text blockquote { margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.cmt__text .title_quote { font-size: 12px; font-weight: 700; color: var(--muted); }
.cmt__spoiler { font-size: 15px; }
.cmt__spoiler summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.cmt__spoiler summary::-webkit-details-marker { display: none; }
.cmt__spoiler summary:hover { color: var(--text); }
.cmt__spoiler[open] summary { margin-bottom: 6px; }
.cmt__sign { font-size: 12px; color: var(--muted); font-style: italic; }

/* Дії */
.cmt__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 2px; font-size: 13px; color: var(--muted); }
.cmt__foot > a { color: var(--muted); }
.cmt__vote { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 9px; border-radius: 13px; background: var(--surface-2); font-weight: 700; color: var(--muted); transition: background-color var(--t-fast, .22s) ease, color var(--t-fast, .22s) ease; }
.cmt__foot a:has(.cmt__vote) + a:has(.cmt__vote) { margin-left: -8px; }
.cmt__foot a:hover .cmt__vote { background: var(--accent-soft); color: var(--text); }
/* мій голос (app.js, mod=mgcvotes): ▲ — акцентом, ▼ — червоним */
.cmt__foot a.is-up .cmt__vote, .cmt__foot a.is-up:hover .cmt__vote { background: var(--accent); color: var(--accent-ink, #fff); }
.cmt__foot a.is-down .cmt__vote, .cmt__foot a.is-down:hover .cmt__vote { background: var(--danger, #e5484d); color: #fff; }
.cmt__act { font-weight: 600; opacity: 0; transition: opacity var(--t-fast, .22s) ease, color var(--t-fast, .22s) ease; }
.cmt:hover .cmt__act, .cmt:focus-within .cmt__act { opacity: 1; }
.cmt__act--reply { opacity: 1; }    /* «Відповісти» — завжди видно */
.cmt__foot a:hover .cmt__act { color: var(--accent); }
@media (hover: none) { .cmt__act { opacity: 1; } }
.cmt__mass { margin-left: auto; }

/* Форма */
.cmt-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; padding: 14px; border-radius: 12px; background: var(--surface); }
.cmt-form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cmt-form .field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.cmt-form .field input { min-height: 40px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; }
.cmt-form__editor textarea, .cmt-form textarea { display: block; width: 100%; min-height: 64px; height: 64px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; resize: vertical; transition: height var(--t, .38s) var(--ease, ease), border-color var(--t-fast, .22s) ease; }
.cmt-form__editor textarea:focus, .cmt-form textarea:focus, .cmt-form.is-open textarea { height: 140px; outline: 0; border-color: var(--accent); }
.cmt-form__editor textarea::placeholder { color: var(--muted); }
.cmt-form__actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.cmt-form__actions .check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.cmt-form__actions input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
/* панель кнопок BB-редактора DLE (якщо ввімкнена) */
.cmt-form .bb-editor, .cmt-form .bb-pane { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 6px; }
.cmt-form .bb-btn { border-radius: var(--radius-btn); }

/* Відповідь у гілці: DLE вставляє форму під коментар */
.comments-tree-item .cmt-form { margin: 6px 0 10px 52px; }

/* Читалка: бічна панель вужча */
.rd-comments .cmt { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
.rd-comments .cmt__ava { width: 34px; height: 34px; }
.rd-comments .cmt__text { font-size: 14px; }
.rd-comments .comments-tree-item > .comments-tree-list { margin-left: 16px; padding-left: 12px; }
.rd-comments .comments-tree-item .cmt-form { margin-left: 0; }

@media (max-width: 560px) {
  .cmt { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .cmt__ava { width: 32px; height: 32px; }
  .comments-tree-item > .comments-tree-list { margin-left: 14px; padding-left: 12px; }
  .cmt-form__row { grid-template-columns: minmax(0, 1fr); }
  .comments-tree-item .cmt-form { margin-left: 0; }
}

/* ═══ Сторінка «Коментарі» (do=lastcomments, assets/lastcomments.js) ═══ */
.lc-hero { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.lc-hero__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lc-hero__title { margin: 0; font-family: var(--font-head); font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; color: var(--text); }
.lc-hero__title a { color: var(--accent); }
.lc-hero__count { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.lc-who { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; margin-left: auto; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); font-size: 14px; font-weight: 600; color: var(--text); transition: border-color var(--t-fast, .22s) ease, color var(--t-fast, .22s) ease; }
.lc-who:hover { border-color: var(--accent); color: var(--accent); }
.lc-who svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lc-seg { display: inline-flex; align-self: flex-start; gap: 2px; max-width: 100%; padding: 3px; border-radius: 11px; background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.lc-seg::-webkit-scrollbar { display: none; }
.lc-seg a { flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 0 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); transition: background-color var(--t-fast, .22s) ease, color var(--t-fast, .22s) ease; }
.lc-seg a:hover { color: var(--text); }
.lc-seg a.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.lc-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
#dlemasscomments { margin-top: 6px; }

/* коментар: рядок контексту на всю ширину, роздільники між різними обговореннями */
.lc-ctx { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: 2px; }
.lc-ctx__main { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.lc-ctx__cover { flex: none; width: 30px; height: 42px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.lc-ctx__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lc-ctx__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.lc-ctx__text b { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; transition: color var(--t-fast, .22s) ease; }
.lc-ctx__text small { font-size: 12px; color: var(--muted); }
.lc-ctx__main:hover b { color: var(--accent); }
.lc-ctx__home { flex: none; margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); opacity: 0; transition: opacity var(--t-fast, .22s) ease; }
.lc-ctx__home:hover { color: var(--accent); }
.cmt:hover .lc-ctx__home, .lc-ctx__home:focus-visible { opacity: 1; }
@media (hover: none) { .lc-ctx__home { opacity: 1; } }
#dle-comments-list > [id^="comment-id-"] + [id^="comment-id-"] > .cmt:not(.is-same) { margin-top: 6px; }
#dle-comments-list > [id^="comment-id-"] + [id^="comment-id-"] > .cmt:not(.is-same)::before { content: ""; position: absolute; left: 10px; right: 10px; top: -3px; height: 1px; background: var(--line); }
.cmt.is-same { padding-top: 6px; }
.cmt.is-same .lc-ctx { display: none; }
.cmt.lc-fresh { animation: lc-fresh 2.4s ease; }
@keyframes lc-fresh { from { background: var(--accent-soft); } }

/* довгий коментар */
.cmt__text.is-clamped { max-height: 240px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.lc-more { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lc-more:hover { text-decoration: underline; }

/* «N нових коментарів» */
.lc-new { position: sticky; top: 76px; z-index: 6; display: flex; margin: 0 auto 10px; padding: 8px 16px; border: 0; border-radius: 20px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.lc-new[hidden] { display: none; }
.lc-new:hover { filter: brightness(1.08); }

@media (max-width: 560px) {
  .lc-hero__title { font-size: 23px; }
  .lc-who { min-height: 32px; padding: 0 11px; font-size: 13px; }
  .lc-seg { align-self: stretch; }
  .lc-seg a { flex: 1 0 auto; justify-content: center; padding: 0 12px; }
  .lc-ctx__cover { width: 26px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .cmt.lc-fresh { animation: none; } }
.cmt.is-lc { padding-bottom: 8px; }
.cmt.is-lc .cmt__foot:not(:has(.cmt__vote, .cmt__mass input)) { min-height: 0; margin-top: 0; }
/* перехід між сторінками (#comment): лишаємо видимими вкладки, а не ховаємо перший коментар під шапкою */
#dle-comments-list > #comment { scroll-margin-top: 150px; }
@media (max-width: 760px) { #dle-comments-list > #comment { scroll-margin-top: 136px; } }
.lc-ctx__main { padding-left: 2px; }

/* Свій коментар на модерації (бачить лише автор) */
.cmt.is-pending { background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(245, 185, 66, .05) 10px 20px); box-shadow: inset 3px 0 0 #f5b942; }
.cmt.is-pending .cmt__text, .cmt.is-pending .cmt__ava { opacity: .75; }
.cmt__pending { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; background: rgba(245, 185, 66, .16); color: #f5b942; font-size: 11px; font-weight: 800; }
.cmt__pending::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
