/* comment.css · nocturne_pc 评论区（金色深色统一风格） §25 */

/* ============ 评论区整体 ============ */
.nc-comments { width: 100%; }

.nc-comment-box {
    background: var(--nc-surface);
    border: 1px solid var(--nc-line);
    border-radius: 16px;
    padding: 18px 20px 16px;
    margin-bottom: 22px;
    box-shadow: 0 10px 30px -20px rgba(0,0,0,.7);
}
.nc-comment-top {
    display: flex; align-items: baseline; gap: 12px;
    margin-bottom: 14px;
}
.nc-comment-title {
    font-size: 17px; font-weight: 700; color: var(--nc-text);
    position: relative; padding-left: 12px;
}
.nc-comment-title::before {
    content: ""; position: absolute; left: 0; top: 50%;
    width: 4px; height: 16px; border-radius: 4px;
    background: linear-gradient(180deg, var(--nc-gold), var(--nc-gold-soft));
    transform: translateY(-50%);
}
.nc-comment-tip { font-size: 12px; color: var(--nc-muted); }

.nc-comment-edit { display: block; }
.nc-comment-textarea {
    width: 100%; min-height: 86px; box-sizing: border-box;
    padding: 12px 14px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--nc-line);
    border-radius: 12px;
    color: var(--nc-text);
    font-size: 14px; line-height: 1.7;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.nc-comment-textarea::placeholder { color: var(--nc-muted); }
.nc-comment-textarea:focus {
    outline: none;
    border-color: var(--nc-gold);
    background: rgba(217,164,65,.06);
    box-shadow: 0 0 0 3px rgba(217,164,65,.12);
}

.nc-comment-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.nc-comment-flex { flex: 1 1 auto; }

.nc-emoji-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border: 1px solid var(--nc-line);
    background: transparent; color: var(--nc-muted);
    border-radius: 18px; cursor: pointer;
    font-size: 13px; transition: all .2s;
}
.nc-emoji-trigger:hover { border-color: var(--nc-gold); color: var(--nc-gold); }
.nc-emoji-trigger svg { display: block; }

.nc-comment-send {
    height: 36px; padding: 0 24px; border: none;
    border-radius: 18px; cursor: pointer;
    background: linear-gradient(135deg, var(--nc-gold), var(--nc-gold-soft));
    color: #1a140a; font-size: 14px; font-weight: 600;
    transition: filter .2s, transform .1s;
}
.nc-comment-send:hover { filter: brightness(1.08); }
.nc-comment-send:active { transform: translateY(1px); }

/* ============ 评论列表 ============ */
.nc-comment-list { display: block; }
.comment-item {
    background: var(--nc-surface);
    border: 1px solid var(--nc-line);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 14px;
    transition: border-color .2s;
}
.comment-item:hover { border-color: rgba(217,164,65,.35); }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author { font-size: 14px; font-weight: 700; color: var(--nc-gold); }
.comment-time { font-size: 12px; color: var(--nc-muted); }
.comment-content {
    font-size: 14px; line-height: 1.85; color: var(--nc-text-2, #cbc7bf);
    word-break: break-word; overflow-wrap: anywhere;
}
.comment-content img.nc-emoji-inline { display: inline-block; width: 22px; height: 22px; vertical-align: -4px; margin: 0 1px; }

.comment-actions { display: flex; gap: 10px; margin-top: 12px; }
.comment-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 16px;
    font-size: 13px; cursor: pointer;
    border: 1px solid var(--nc-line);
    background: transparent; color: var(--nc-muted);
    transition: all .2s;
}
.comment-btn:hover { color: var(--nc-text); border-color: rgba(255,255,255,.18); }
.comment-btn .icon { width: 15px; height: 15px; }
.like-btn { border-color: rgba(217,164,65,.4); color: var(--nc-gold); }
.like-btn:hover { background: rgba(217,164,65,.12); }
.like-btn.active { background: var(--nc-gold); color: #1a140a; }

/* ============ 回复 ============ */
.reply-list { margin: 12px 0 0; padding-left: 14px; border-left: 2px solid var(--nc-line); }
.reply-item, .nested-reply {
    background: rgba(255,255,255,.02);
    border: 1px solid var(--nc-line);
    border-radius: 12px;
    padding: 12px 14px; margin-top: 10px;
}
.reply-to { color: var(--nc-muted); font-size: 12px; margin-left: 6px; }

/* ============ 分页 ============ */
.pagination { margin: 4px 0 20px; text-align: center; }
.pagination-btn {
    display: inline-block; min-width: 34px; padding: 6px 10px; margin: 0 3px;
    font-size: 13px; line-height: 1.4; border-radius: 8px;
    border: 1px solid var(--nc-line);
    background: var(--nc-surface); color: var(--nc-text-2, #cbc7bf);
    cursor: pointer; transition: all .2s;
}
.pagination-btn:hover:not(:disabled) { border-color: var(--nc-gold); color: var(--nc-gold); }
.pagination-btn:disabled { opacity: .5; cursor: not-allowed; }
.pagination-active { background: var(--nc-gold); color: #1a140a; border-color: var(--nc-gold); font-weight: 600; }
.pagination-prev, .pagination-next { min-width: 64px; }

/* ============ 表情面板（被 comments.js 克隆进弹窗） ============ */
.nc-emoji-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 4px;
    max-height: 330px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--nc-surface);
    border: 1px solid var(--nc-line);
    border-radius: 12px;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(217,164,65,.45) transparent;
}
.nc-emoji-panel::-webkit-scrollbar { width: 8px; }
.nc-emoji-panel::-webkit-scrollbar-track { background: transparent; }
.nc-emoji-panel::-webkit-scrollbar-thumb { background: rgba(217,164,65,.45); border-radius: 4px; }
.emoji-item {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: 4px; border-radius: 10px; cursor: pointer;
    background: rgba(255,255,255,.02);
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, transform .12s;
}
.emoji-item:hover {
    background: rgba(217,164,65,.10);
    border-color: rgba(217,164,65,.5);
    transform: translateY(-2px);
}
.nc-em-gif { width: 32px; height: 32px; display: block; pointer-events: none; }
.nc-em-token { display: none !important; }

/* 鼠标悬停显示表情名字 */
.nc-emoji-panel .emoji-item::after {
    content: attr(data-name);
    position: absolute; left: 50%; bottom: calc(100% + 6px);
    transform: translateX(-50%) translateY(4px);
    background: #14110b; color: var(--nc-gold);
    border: 1px solid rgba(217,164,65,.5);
    padding: 3px 9px; border-radius: 7px;
    font-size: 12px; line-height: 1; white-space: nowrap;
    opacity: 0; pointer-events: none; z-index: 30;
    transition: opacity .15s, transform .15s;
}
.nc-emoji-panel .emoji-item:hover::after {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .nc-emoji-panel { grid-template-columns: repeat(5, 1fr); max-height: 300px; }
    .nc-comment-box { padding: 14px; }
}

/* ============ 富文本评论输入框（contenteditable） ============ */
.nc-editor {
    display: block;
    outline: none;
    overflow-y: auto;
    max-height: 220px;
    white-space: pre-wrap;
    word-break: break-word;
}
.nc-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--nc-muted);
    pointer-events: none;
}
.nc-editor img.nc-emoji-inline {
    width: 22px; height: 22px;
    vertical-align: -4px;
    margin: 0 1px;
    display: inline-block;
    cursor: default;
    user-select: none;
}
.nc-emoji-trigger .nc-emoji-trigger-ico {
    width: 20px; height: 20px;
    display: block;
    border-radius: 50%;
}

/* ============ 微信风格表情面板（底部弹层 + 分页） ============ */
body.nc-emoji-lock { overflow: hidden; }
.nc-emoji-mask {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(0,0,0,.5);
    opacity: 0; visibility: hidden;
    transition: opacity .2s;
}
.nc-emoji-mask.on { opacity: 1; visibility: visible; }
.nc-emoji-sheet {
    position: fixed; left: 50%; bottom: 0; z-index: 1201;
    width: min(720px, calc(100vw - 24px));
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--nc-surface, #15181e);
    border: 1px solid var(--nc-line, #2a2f38);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 48px -12px rgba(0,0,0,.75);
    transform: translate(-50%, 105%);
    transition: transform .28s cubic-bezier(.22,.61,.36,1);
    box-sizing: border-box;
}
.nc-emoji-sheet.on { transform: translate(-50%, 0); }
.nc-emoji-sheet-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 4px 8px;
}
.nc-emoji-sheet-title { font-size: 13px; color: var(--nc-muted); letter-spacing: .5px; }
.nc-emoji-sheet-done { font-size: 14px; color: var(--nc-gold); text-decoration: none; }
.nc-emoji-viewport { overflow: hidden; }
.nc-emoji-track { display: flex; transition: transform .25s ease; }
.nc-emoji-page {
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.nc-emoji-cell {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: 9px 0;
    border: 1px solid transparent; border-radius: 10px;
    background: transparent; cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
}
.nc-emoji-cell:hover {
    background: rgba(217,164,65,.12);
    border-color: rgba(217,164,65,.45);
    transform: translateY(-1px);
    z-index: 10;            /* 抬起当前格，保证名字气泡不被后一行的格子盖住 */
}
.nc-emoji-cell img { width: 38px; height: 38px; display: block; }
.nc-emoji-name {
    position: absolute; left: 50%; bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(3px);
    padding: 2px 8px; border-radius: 6px;
    background: #14110b; color: var(--nc-gold);
    border: 1px solid rgba(217,164,65,.5);
    font-size: 12px; line-height: 1.3; white-space: nowrap;
    opacity: 0; pointer-events: none; z-index: 5;
    transition: opacity .15s, transform .15s;
}
.nc-emoji-cell:hover .nc-emoji-name { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 第一排的名字气泡改到下方显示，否则会被 .nc-emoji-viewport 的 overflow 裁掉 */
.nc-emoji-page .nc-emoji-cell:nth-child(-n+8) .nc-emoji-name {
    bottom: auto;
    top: calc(100% + 4px);
    transform: translateX(-50%) translateY(-3px);
}
.nc-emoji-page .nc-emoji-cell:nth-child(-n+8):hover .nc-emoji-name {
    transform: translateX(-50%) translateY(0);
}

.nc-emoji-dots { display: flex; justify-content: center; gap: 6px; padding-top: 8px; }
.nc-emoji-dot {
    width: 6px; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,.22);
    cursor: pointer; transition: all .2s;
}
.nc-emoji-dot.on { width: 16px; background: var(--nc-gold); }

/* ============ 回复弹窗（dialog.js 只给了定位，没有卡片样式） ============ */
.dialog-modal.nc-reply-modal {
    width: min(520px, calc(100vw - 32px));
    max-height: min(84vh, 680px);
    max-height: min(84dvh, 680px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--nc-line-2) transparent;
    padding: 18px 20px 16px;
    background: var(--nc-surface, #15181e);
    border: 1px solid var(--nc-line, #2a2f38);
    border-radius: 16px;
    box-shadow: 0 30px 70px -20px rgba(0,0,0,.85);
    color: var(--nc-text, #e9edf4);
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}
.dialog-modal.nc-reply-modal::-webkit-scrollbar { width: 6px; }
.dialog-modal.nc-reply-modal::-webkit-scrollbar-track { background: transparent; }
.dialog-modal.nc-reply-modal::-webkit-scrollbar-thumb {
    background: var(--nc-line-2);
    border-radius: 3px;
}
.nc-reply-modal .dialog-close {
    position: absolute; right: 14px; top: 8px;
    color: var(--nc-muted); font-size: 22px; line-height: 1;
    text-decoration: none; cursor: pointer;
}
.nc-reply-modal > div:nth-child(2) {
    font-size: 15px !important; text-align: left !important;
    color: var(--nc-text); padding-right: 24px;
}
.nc-reply-modal p { text-align: left !important; margin: 12px 0 0; font-size: 14px !important; }
.reply-form-container { padding: 0; }
.reply-form-container .reply-textarea {
    display: block; width: 100%; min-height: 84px;
    max-height: min(42vh, 280px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--nc-line-2) transparent;
    box-sizing: border-box; padding: 10px 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--nc-line); border-radius: 10px;
    color: var(--nc-text); font-size: 14px; line-height: 1.7;
    outline: none;
    -webkit-overflow-scrolling: touch;
}
.reply-form-container .reply-textarea::-webkit-scrollbar { width: 6px; }
.reply-form-container .reply-textarea::-webkit-scrollbar-track { background: transparent; }
.reply-form-container .reply-textarea::-webkit-scrollbar-thumb {
    background: var(--nc-line-2);
    border-radius: 3px;
}
.reply-form-container .reply-textarea:focus { border-color: var(--nc-gold); }
.reply-form-container .reply-textarea:empty::before {
    content: attr(data-placeholder); color: var(--nc-muted);
}
.reply-form-container .reply-actions {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px;
}
.nc-reply-modal .reply-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.nc-reply-modal .reply-actions .emoji-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 16px;
    background: rgba(255,255,255,.05) !important;
    color: var(--nc-text-2, #cbc7bf) !important;
    border: 1px solid var(--nc-line) !important;
    border-radius: 17px; font-size: 13px; font-weight: 400;
    cursor: pointer; transition: all .2s;
}
.nc-reply-modal .reply-actions .emoji-btn:hover {
    border-color: var(--nc-gold) !important; color: var(--nc-gold) !important;
}
.nc-reply-modal .reply-actions .emoji-btn .emoji-btn-ico { width: 18px; height: 18px; display: block; }
.nc-reply-modal .reply-actions .submit-btn {
    height: 34px; padding: 0 24px;
    background: linear-gradient(135deg, var(--nc-gold), var(--nc-gold-soft)) !important;
    color: #1a140a !important;
    font-size: 13px; font-weight: 700;
    border: none !important; border-radius: 17px; cursor: pointer;
}

/* ============ 表情面板拖动翻页 ============ */
.nc-emoji-viewport { cursor: grab; }
body.nc-emoji-dragging .nc-emoji-viewport { cursor: grabbing; }
.nc-emoji-cell { -webkit-user-select: none; user-select: none; }
.nc-emoji-cell img { -webkit-user-drag: none; user-drag: none; }
@media (max-width: 520px) {
    .nc-emoji-sheet { padding-left: 12px; padding-right: 12px; }
    .nc-emoji-page { gap: 2px; }
    .nc-emoji-cell { padding: 6px 0; }
    .nc-emoji-cell img { width: 32px; height: 32px; }
    .dialog-modal.nc-reply-modal {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 16px;
    }
    .reply-form-container .reply-textarea {
        min-height: 96px;
        max-height: 34vh;
        max-height: 34dvh;
    }
}

/* ============ 书籍页评论区：单层卡片，不再有自带标题 ============ */
#comments .nc-comment-box {
    margin-bottom: 4px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
#comments .nc-comment-top { margin-bottom: 10px; }