/* 留言 (comments-view.js). 版面 A: on a computer a list on the left and the reply on the right; at the shell's phone width (860 px, where the
   sidebar moves to the top) cards you can answer from, and a page of its own for changing the words. All colours are the desk's tokens. */
.comments-page { --comment-surface: rgba(255, 255, 255, .92); --comment-soft: #f4f9ff; }
:root[data-theme="dark"] .comments-page { --comment-surface: var(--theme-surface); --comment-soft: var(--theme-soft); }

/* The current page's number reads on its blue, whatever it says on the other pages. */
.topbar .tab.active .tab-count { background: #fff; color: #1450f5; }
:root[data-theme="dark"] .comments-page .tag.platform { background: #30445c; color: #e1ebf8; }

.comments-chrome > :empty, .comments-notices:empty { display: none; }
.comments-update { flex-wrap: nowrap; gap: 12px; }
.comments-updated { white-space: nowrap; }
.comments-filters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.comments-filters-group { flex-wrap: wrap; }
.comment-notice { display: grid; gap: 8px; }
.comment-notice-info { background: #e3ebff; color: var(--blue-dark); }
:root[data-theme="dark"] .comment-notice-info { background: #263f66; color: #d5e3ff; }
.comments-home-line { margin: 0; font-weight: 700; }

.comments-split { display: grid; grid-template-columns: minmax(290px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.comments-list-column { display: grid; gap: 10px; min-width: 0; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--comment-surface); box-shadow: var(--lift); }
.comment-list { display: grid; margin: 0; padding: 0; list-style: none; }
.comment-more { display: grid; justify-content: center; padding-bottom: 6px; }
.comment-more:empty { display: none; }
.comment-empty { display: grid; gap: 12px; justify-items: start; padding: 22px 16px; }
.comment-empty p { margin: 0; }

.comment-card { position: relative; min-width: 0; border-top: 1px solid var(--line); }
.comment-card:first-child { border-top: 0; }
.comment-card.is-selected { border-radius: 14px; background: var(--comment-soft); border-top-color: transparent; }
.comment-card.is-selected::before { content: ""; position: absolute; z-index: 1; top: 8px; bottom: 8px; left: 0; width: 4px; border-radius: 4px; background: var(--blue); pointer-events: none; }
.comment-card.is-selected + .comment-card { border-top-color: transparent; }
.comment-card-open { display: grid; gap: 6px; width: 100%; min-width: 0; padding: 14px 14px 12px; border-radius: 14px; background: none; color: inherit; text-align: left; }
.comment-card-open:hover { background: var(--comment-soft); }
.comment-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.comment-author { min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.comment-time { flex: none; margin-left: auto; color: var(--muted); font-size: 14px; }
.comment-card-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.comment-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.comment-card-tags:empty { display: none; }
.comment-tag-draft { background: #e3ebff; color: var(--blue-dark); }
:root[data-theme="dark"] .tag.comment-tag-draft { background: #263f66; color: #d5e3ff; }
/* What only the phone's cards carry. */
.comment-card-post, .comment-card-draft, .comment-card-actions, .comment-card-status { display: none; }

.comments-pane { position: sticky; top: 18px; min-width: 0; }
.comment-viewer-line { display: none; }
.comments-pane-inner { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--comment-surface); box-shadow: var(--lift); }
.comments-pane-empty { padding: 22px; }
.comment-reply-top { display: none; }
.comment-post { display: flex; align-items: center; gap: 14px; min-width: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.comment-post-image { flex: none; width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--comment-soft); }
.comment-post-blank { display: grid; place-items: center; color: var(--muted); font-size: 14px; font-weight: 700; }
.comment-post-words { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.comment-post-words .hint { overflow-wrap: anywhere; }
h2.comment-post-title { margin: 0; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.comment-post-link { flex: none; font-size: 14px; font-weight: 700; }
.comment-quote { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--comment-soft); }
.comment-quote p { margin: 0; }
.comment-quote-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.comment-sent-text { display: grid; gap: 2px; }
.comment-sent-text p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment-reply-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; }
.comment-save-note { margin-left: auto; font-weight: 400; }
.comment-reply-box { width: 100%; min-height: 128px; resize: vertical; }
.comments-pane-inner > .hint { margin: 0; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 復原: the five seconds after 送出. Fixed to the bottom, above a phone's action bar and keyboard. */
.comment-undo { position: fixed; z-index: 30; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px) + var(--comment-keyboard, 0px)); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); transform: translateX(-50%); }
.comment-undo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 4px 8px 4px 18px; border: 1px solid var(--line-strong); border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 18px 40px -18px rgba(13, 61, 189, .55); font-weight: 600; overflow-wrap: anywhere; }
:root[data-theme="dark"] .comment-undo-row { background: #23364e; box-shadow: 0 18px 40px -18px #000; }
.comment-undo-action { flex: none; font-weight: 800; }
@media (prefers-reduced-motion: no-preference) {
  .comment-undo-row { animation: comment-undo-in .16s ease-out; }
  @keyframes comment-undo-in { from { opacity: 0; transform: translateY(8px); } }
}

@media (max-width: 860px) {
  .comments-split { grid-template-columns: minmax(0, 1fr); }
  .comments-filters { flex-direction: column; }
  .comments-filters-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .comments-filters-group .filter { flex: 1 0 auto; }
  .comments-list-column { padding: 0; border: 0; background: none; box-shadow: none; }
  .comment-list { gap: 12px; }
  .comments-pane { position: static; display: none; }
  .comment-viewer-line { display: block; }

  /* The cards: read and answer without leaving the list. */
  .comment-card.is-selected::before { display: none; }
  .comment-card, .comment-card.is-selected { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--comment-surface); box-shadow: none; }
  .comment-card-open { padding: 0; }
  .comment-card-open:hover { background: none; }
  .comment-time { margin-left: 0; padding-left: 10px; border-left: 1px solid var(--line-strong); }
  .comment-card-post { display: block; }
  .comment-card-text { font-size: 17px; font-weight: 700; -webkit-line-clamp: 4; line-clamp: 4; }
  .comment-card-draft { display: grid; gap: 6px; justify-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--comment-soft); }
  .comment-card-draft p { margin: 0; overflow-wrap: anywhere; }
  .comment-card-tags { display: none; }
  .comment-card-status { display: block; margin: 0; }
  .comment-card-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .comment-card-actions .button { width: 100%; }
  .comment-card-actions .button.link, :root[data-theme="dark"] .comment-card-actions .button.link { color: var(--ink); }

  /* The reply's own page: the sidebar and the list step aside; the buttons stay at the bottom, above the keyboard. */
  .comments-page[data-pane="reply"] > .comments-chrome, .comments-page[data-pane="reply"] .comments-list-column { display: none; }
  .comments-page[data-pane="reply"] .comments-pane { display: block; }
  .comment-reply-open .topbar, .comment-reply-open #reminder-slot, .comment-reply-open .legal-footer { display: none; }
  .comments-page[data-pane="reply"] .comments-pane-inner { padding: 0 0 calc(148px + var(--comment-keyboard, 0px)); border: 0; background: none; box-shadow: none; }
  .comment-reply-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .comment-back.button.link, :root[data-theme="dark"] .comment-back.button.link { padding-left: 0; color: var(--ink); font-size: 19px; }
  .comment-post { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--comment-surface); }
  .comment-post-image { width: 56px; height: 56px; border-radius: 10px; }
  .comment-quote-text { font-size: 17px; font-weight: 700; }
  .comment-reply-box { min-height: 112px; font-size: 17px; }
  .comment-actions {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: var(--comment-keyboard, 0px);
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line); background: var(--canvas);
  }
  .comment-actions .button { width: 100%; }
  .comment-actions .comment-send { grid-column: 1 / -1; }
  .comments-page[data-pane="reply"] .comment-undo { bottom: calc(148px + var(--comment-keyboard, 0px)); }
}
@media (max-width: 360px) {
  .comment-card-actions { grid-template-columns: 1fr 1fr; }
}
