/**
 * MWLib 评论系统样式 - Telegram 聊天气泡风格
 * 复刻 macat.vip
 */

/* ========================================
   阿里巴巴普惠体 & 中文字体（本地打包）
   ======================================== */
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC-900.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ========================================
   基础变量与重置
   ======================================== */
:root {
    --tg-bg-primary: #ffffff;
    --tg-bg-secondary: #f6f6f6;
    --tg-bg-bubble-out: #e9e9ea;
    --tg-bg-bubble-in: #e9e9ea;
    --tg-bg-header: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
    --tg-text-primary: #222222;
    --tg-text-secondary: #8e8e93;
    --tg-text-link: #ff9500;
    --tg-border: #d1d1d6;
    --tg-placeholder: #aaa;
    --tg-radius: 18px;
    --tg-radius-small: 12px;
    --tg-shadow: 0 1px 2px rgba(0,0,0,0.05);
    --tg-shadow-hover: 0 2px 8px rgba(0,0,0,0.1);
}

@media (prefers-color-scheme: dark) {
    /* 暗色模式下留言触发按钮 */
    .comment-trigger-btn {
        background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
        box-shadow: 0 4px 16px rgba(255, 149, 0, 0.4);
    }

    :root {
        --tg-bg-primary: #1c1c1e;
        --tg-bg-secondary: #2c2c2e;
        --tg-bg-bubble-out: #2c2c2e;
        --tg-bg-bubble-in: #3a3a3c;
        --tg-text-primary: #ffffff;
        --tg-text-secondary: #8e8e93;
        --tg-text-link: #0a9cff;
        --tg-border: #38383a;
        --tg-placeholder: #888;
    }

    /* 头部 & 弹窗主体 */
    .comment-modal-header { background: #2c2c2e; }
    .comment-modal-body { background: #1c1c1e; }
    /* 容器背景设为深色，防止 header/body 之间的缝隙透出白色 */
    .comment-modal-container { background: #1c1c1e; }
    /* ⚠️ 移除 isolation: isolate，避免创建独立层叠上下文导致置顶胶囊 z-index 被限制 */
    .comment-modal-overlay { /* isolation: isolate; */ }
    .comment-modal-container { /* isolation: isolate; */ }
    .comment-header-row { background: #2c2c2e; }
    .comment-modal-title { color: #ffffff; }
    .comment-modal-title-inner { color: #ffffff; }
    .comment-modal-close { color: #8e8e93; }
    .comment-help-link { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.18); }
    .comment-policy-link { color: #8e8e93; }

    /* 头像 */
    .comment-avatar .avatar-placeholder { background: linear-gradient(135deg, #3a3a3c, #2c2c2e); }

    /* 数量徽章 */
    .comment-count { background: rgba(255, 255, 255, 0.15); }

    /* 空状态 & 加载 */
    .empty-comment-state { color: #8e8e93; }
    .empty-icon { opacity: 0.6; }
    .loading-comments { color: #8e8e93; }

    /* 输入框 */
    .modal-comment-input { color: #ffffff; }
    .modal-comment-input::placeholder { color: #888; }

    /* 回复框 */
    .reply-input { color: #ffffff; }
    .reply-input::placeholder { color: #888; }

    /* 访客输入框 */
    .guest-input { color: #ffffff; }
    .guest-input::placeholder { color: #888; }

    /* 验证码 */
    .captcha-input { color: #ffffff; }
    .captcha-input::placeholder { color: #888; }

    /* 图片上传 */
    .img-upload-area { border-color: #444; }
    .img-upload-area:hover { background: rgba(255, 149, 0, 0.12); border-color: #ff9500; }
    .img-upload-area.uploading { background: rgba(255, 149, 0, 0.12); border-color: #ff9500; }
    .img-upload-area.uploaded { background: rgba(34, 197, 94, 0.12); border-color: #22c55e; }
    .img-upload-text { color: var(--tg-text-primary); }

    /* 图片URL输入 */
    .img-url-input { color: #ffffff; }
    .img-url-input::placeholder { color: #888; }

    /* 滚动条 */
    .comment-modal-body::-webkit-scrollbar-thumb { background: #444; }

    /* 图片提示框暗色适配 */
    .img-url-hint {
        background: linear-gradient(135deg, #2c2200, #2c1f00);
        border-color: #5c4a00;
        color: #d4a017;
    }

    /* 弹窗 & 表情面板暗色阴影 */
    .comment-modal-container {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 4px 20px rgba(255, 149, 0, 0.08);
    }

    .emoji-panel {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }
}

/* ========================================
   留言触发按钮
   ======================================== */
.comment-trigger-btn {
    position: fixed !important;
    bottom: 40px !important;
    right: 60px !important;
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(255, 149, 0, 0.45) !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    /* ⚠️ 不设置 z-index！通过 DOM 顺序决定层叠，
       图片对话框追加到 body 末尾后自动覆盖按钮 */
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
    letter-spacing: 0.3px !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}

.comment-trigger-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(255, 149, 0, 0.5);
}

.comment-trigger-btn:active {
    transform: scale(0.98);
}

.comment-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    min-width: 16px;
    text-align: center;
    transition: background 0.3s;
}

.comment-count.has-comments {
    background: rgba(255, 255, 255, 0.35);
}

/* ========================================
   模态框遮罩
   ======================================== */
.comment-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    /* ⚠️ 设置极高 z-index，确保覆盖网站所有元素（包括底纹和右侧菜单栏） */
    z-index: 9999998;
    animation: tgFadeIn 0.2s ease;
}

.comment-modal-overlay.active {
    display: block;
}

@keyframes tgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   留言模态框容器 - Telegram 风格
   ======================================== */
.comment-modal-container {
    position: fixed;
    right: 20px;
    bottom: -100%;
    width: 90%;
    max-width: 480px;
    height: 70vh; /* 增加高度 */
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    /* ⚠️ container 的 z-index 必须比 overlay 更高 */
    z-index: 9999999;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 20px rgba(255, 149, 0, 0.1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.comment-modal-container.active {
    bottom: 20px;
}

/* 模态框头部 */
.comment-modal-header {
    background: var(--tg-bg-header);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    /* 去掉底部阴影，让 header 和 body 自然衔接无白线 */
    box-shadow: none;
}

/* 顶部帮助链接和标题行 */
.comment-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* 标题靠左 */
.comment-modal-title {
    flex: 1;
    min-width: 0;
}

/* 右侧元素靠右 */
.comment-header-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 顶部帮助链接 - 呼吸灯透明白效果 */
.comment-help-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
    animation: breathe 2.5s ease-in-out infinite;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    letter-spacing: 0.3px;
}

.comment-help-link:hover {
    background: rgba(255, 255, 255, 0.45);
    color: #ffffff;
    animation: none;
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.5);
}

@keyframes breathe {
    0%, 100% { opacity: 0.7; box-shadow: 0 0 0 0 rgba(255,255,255,0); }
    50% { opacity: 1; box-shadow: 0 0 8px 2px rgba(255,255,255,0.2); }
}

.comment-modal-title {
    font-size: 15px;
    font-weight: 700;
    max-width: 180px; /* 限制宽度 */
    overflow: hidden;
    white-space: nowrap;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    position: relative;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 标题跑马灯动画 - 在固定范围内滚动 */
.comment-modal-title-inner {
    display: inline-block;
    padding-right: 30px; /* 为渐变留出空间 */
    animation: marquee 8s linear infinite;
    animation-play-state: paused;
}

.comment-modal-title-inner.playing,
.comment-modal-title:hover .comment-modal-title-inner {
    animation-play-state: running;
}

/* 渐变遮罩 */
.comment-modal-title::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--tg-bg-header));
    pointer-events: none;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.comment-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-policy-link {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    transition: all 0.3s;
    white-space: nowrap;
}

.comment-policy-link:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.comment-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.2s;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    font-weight: 600;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.comment-modal-close:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.1) rotate(90deg);
}

/* ========================================
   模态框主体 - 评论列表
   ======================================== */
.comment-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px 60px 12px;
    background: var(--tg-bg-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    position: relative;
}

.comment-modal-body::-webkit-scrollbar {
    width: 6px;
}

.comment-modal-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* ========================================
   Telegram 风格评论气泡
   ======================================== */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.comment-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border-radius: var(--tg-radius);
    transition: background 0.2s;
    position: relative;
}

.comment-item:hover {
    background: var(--tg-bg-secondary);
}

/* 待审核评论 */
.comment-item.comment-pending {
    opacity: 0.7;
    border-left: 3px solid #ff9500;
    padding-left: 12px;
}

/* ========================================
   主行：头像 + 名字列（横向并排）
   ======================================== */
.comment-main-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* ========================================
   Telegram 头像 - 正圆形
   ======================================== */
.comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--tg-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--tg-text-primary);
    box-shadow: var(--tg-shadow);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    cursor: pointer;
}

.comment-avatar:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 16px rgba(255, 149, 0, 0.35);
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50% !important;
    display: block;
}

.comment-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    border-radius: 50%;
}

/* ========================================
   名字列（头像右侧纵向堆叠区）
   ======================================== */
.comment-name-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* 用户名行：昵称 + 徽章组（横向并排） */
.comment-username-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.comment-username {
    font-size: 14px;
    font-weight: 700;
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 徽章容器（横向一行，在用户名右侧） */
.comment-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* 徽章横向一行 */
.badges-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.comment-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ffd89b 0%, #ffa500 100%);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 用户角色胶囊徽章 - 渐变胶囊，白字加粗 */
/* 站长 - 黑金渐变 */
.user-role-badge.role-admin {
    background: linear-gradient(135deg, #2c2c2c 0%, #555555 40%, #d4af37 100%);
    color: #ffffff;
    font-weight: 700;
}
/* 终身会员 - 铜金渐变 */
.user-role-badge.role-lifetime {
    background: linear-gradient(135deg, #7c3a0e 0%, #b45309 40%, #d4af37 100%);
    color: #ffffff;
    font-weight: 700;
}
/* 年费会员 - 银金渐变 */
.user-role-badge.role-vip {
    background: linear-gradient(135deg, #9ca3af 0%, #d1d5db 40%, #d4af37 100%);
    color: #1a1a1a;
    font-weight: 700;
}
/* 普通用户 - 白金渐变 */
.user-role-badge.role-registered {
    background: linear-gradient(135deg, #e5e7eb 0%, #ffffff 40%, #c0c0c0 100%);
    color: #374151;
    font-weight: 700;
}

/* 通用胶囊样式 */
.user-role-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1.4;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

/* 评论等级标签 - 图片徽章（与用户角色徽章视觉统一高度） */
.comment-level-badge {
    display: inline-block;
    height: 16px;
    width: auto;
    vertical-align: middle;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ========================================
   Telegram 风格 Meta 信息（设备信息，name-col 下方）
   ======================================== */
.comment-meta-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.comment-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--tg-text-secondary);
    padding: 2px 5px;
    border-radius: 6px;
    background: var(--tg-bg-secondary);
}

.comment-meta-item svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.comment-meta-sep {
    color: var(--tg-border);
    font-size: 10px;
}

/* 地理位置 */
.comment-meta-item.location {
    color: #34c759;
}

/* 操作系统 */
.comment-meta-item.os {
    color: #007aff;
}

/* 浏览器 */
.comment-meta-item.browser {
    color: #ff9500;
}

/* ========================================
   Telegram 聊天气泡
   ======================================== */
.comment-bubble {
    background: var(--tg-bg-bubble-out);
    padding: 10px 14px;
    border-radius: var(--tg-radius);
    border-top-left-radius: 4px;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

/* 气泡渐变描边（橘色渐变） */
.comment-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border-top-left-radius: 4px;
    padding: 1px;
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 50%, #ff9500 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.comment-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--tg-text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

a.comment-url-link {
    color: #4da6ff;
    text-decoration: none;
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}
a.comment-url-link:hover {
    color: #1a8cff;
    text-decoration: underline;
}

.comment-content p {
    margin: 0;
}

.comment-content p + p {
    margin-top: 8px;
}

/* 评论图片 - 可点击放大 */
.comment-content img,
.comment-reply-content img {
    cursor: zoom-in;
    border-radius: 8px;
    transition: opacity 0.2s;
}
.comment-content img:hover,
.comment-reply-content img:hover {
    opacity: 0.9;
}

/* 待审核提示 */
.comment-pending-notice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #ff9500;
    margin-bottom: 6px;
    padding: 3px 8px;
    background: rgba(255, 149, 0, 0.1);
    border-radius: 6px;
}

/* ========================================
   评论底部操作栏
   ======================================== */
.comment-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.comment-time {
    font-size: 11px;
    color: var(--tg-text-secondary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 400;
    cursor: default;
    position: relative;
}

/* .comment-time 自身的 ::after tooltip 被滚动容器裁剪，改用 JS 实现 */

.comment-reply-time {
    font-size: 11px;
    color: var(--tg-text-secondary);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: default;
    position: relative;
}

/* .comment-reply-time 自身的 ::after tooltip 被滚动容器裁剪，改用 JS 实现 */

.comment-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.comment-action-btn {
    font-size: 12px;
    color: var(--tg-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.comment-action-btn:hover {
    background: var(--tg-bg-secondary);
    color: var(--tg-text-link);
}

.comment-action-btn.delete:hover {
    color: #ff3b30;
}

/* 二级评论操作栏 */
.reply-actions-bar {
    margin-top: 6px;
}

.comment-reply-content {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* 三级评论 - 跟二级一样的缩进，不做新层级 */
.comment-reply-item .comment-reply-item .comment-reply-avatar {
    width: 22px;
    height: 22px;
    font-size: 9px;
    margin-bottom: 3px;
}

.comment-reply-item .comment-reply-item .comment-reply-user {
    font-size: 12px;
}

.comment-reply-item .comment-reply-item .comment-reply-content {
    font-size: 12px;
}

.comment-reply-item .comment-reply-item .comment-reply-time {
    font-size: 10px;
}

.comment-reply-item .comment-reply-item .reply-form {
    padding-left: 30px;
}

/* ========================================
   点赞粒子爆发动画
   ======================================== */
@keyframes like-particle-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

.like-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: like-particle-fly var(--dur) ease-out forwards;
}

/* 点赞按钮 */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: var(--tg-bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--tg-text-secondary);
    transition: all 0.2s;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.like-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.like-btn.liked {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
}

.like-btn .like-icon {
    font-size: 14px;
}

/* ========================================
   回复区域 - Telegram 对话式
   ======================================== */
.comment-replies {
    margin-top: 10px;
    padding-left: 52px;
    display: block;
}

.comment-reply-item {
    display: block;
    padding: 4px 0;
}

.comment-reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--tg-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--tg-text-primary);
    margin-bottom: 4px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    cursor: pointer;
}

.comment-reply-avatar:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

.comment-reply-bubble {
    background: var(--tg-bg-bubble-out);
    padding: 6px 10px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    max-width: 100%;
    display: block;
    position: relative;
}

.comment-reply-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border-top-left-radius: 4px;
    padding: 1px;
    background: linear-gradient(135deg, #ff9500 0%, #ff6b00 50%, #ff9500 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.comment-reply-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-reply-bubble {
    background: var(--tg-bg-bubble-out);
    padding: 6px 10px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    max-width: 100%;
}

.comment-reply-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.comment-reply-user {
    font-size: 12px;
    font-weight: 700;
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.comment-reply-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 回复表单 */
.reply-form {
    display: none;
    margin-top: 10px;
    padding-left: 52px;
}

.reply-form.active {
    display: block;
    animation: tgFadeIn 0.2s ease;
}

.reply-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius-small);
    font-size: 13px;
    resize: none;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin-bottom: 8px;
    background: var(--tg-bg-primary);
    color: var(--tg-text-primary);
    min-height: 50px;
    transition: border-color 0.2s;
}

.reply-input:focus {
    outline: none;
    border-color: var(--tg-text-link);
}

.reply-input::placeholder {
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.reply-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.reply-submit-btn, .reply-cancel-btn {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.reply-submit-btn {
    background: var(--tg-text-link);
    color: white;
}

.reply-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.reply-cancel-btn {
    background: var(--tg-bg-secondary);
    color: var(--tg-text-secondary);
}

.reply-cancel-btn:hover {
    background: var(--tg-border);
}

/* ========================================
   空状态 & 加载状态
   ======================================== */
.empty-comment-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--tg-text-secondary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.loading-comments {
    text-align: center;
    padding: 50px 20px;
    color: var(--tg-text-secondary);
    font-size: 14px;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 优雅渐变圆环加载动画 */
.loading-comments::before {
    content: '';
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 149, 0, 0.2);
    border-top-color: #ff9500;
    animation: spin 0.7s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
    vertical-align: middle;
    to { transform: rotate(360deg); }

/* 新评论插入高亮 */
@keyframes newCommentSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
        background: rgba(255, 149, 0, 0.15);
    }
    30% {
        background: rgba(255, 149, 0, 0.08);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        background: transparent;
    }
}

.comment-item.newly-inserted {
    animation: newCommentSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========================================
   模态框底部输入区
   ======================================== */
.comment-modal-footer {
    padding: 12px 16px 4px 16px;
    border-top: 1px solid var(--tg-border);
    background: var(--tg-bg-primary);
    flex-shrink: 0;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    position: relative;
    z-index: 5;
    overflow: visible;
}

.comment-input-wrapper {
    margin-bottom: 4px;
    position: relative;
}

.comment-input-box {
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius-small);
    overflow: hidden;
    transition: border-color 0.2s;
    background: var(--tg-bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
}
.comment-input-box:focus-within {
    border-color: var(--tg-text-link);
}

/* ========================================
   图片预览区（横排显示在输入框上方）
   ======================================== */
.comment-preview-area {
    padding: 8px;
    overflow: hidden;
    background: transparent;
    flex-shrink: 0;
}

/* ========================================
   第二行：底部菜单栏（字数 + 工具栏）
   ======================================== */
.comment-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: var(--tg-bg-secondary);
    flex-shrink: 0;
}

/* 字数统计 */
.char-counter {
    font-size: 12px;
    color: var(--tg-text-secondary);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    transition: color 0.2s;
    white-space: nowrap;
    line-height: 1;
}

/* ========================================
   工具栏：图片 | 表情 | 评论（右侧）
   ======================================== */
.input-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none !important;
    border-radius: 6px;
    background: transparent !important;
    color: var(--tg-text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
}
.toolbar-btn:hover {
    background: rgba(255, 149, 0, 0.15);
    color: var(--tg-text-link);
}

/* 评论按钮 */
.toolbar-submit {
    background: linear-gradient(135deg, #ff9500, #ff6b00) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
    width: auto;
    padding: 0 14px;
    height: 34px;
    letter-spacing: 1px;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.4) !important;
    outline: none !important;
    text-shadow: none !important;
    transition: all 0.2s ease !important;
}
.toolbar-submit:hover {
    opacity: 0.9 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.5) !important;
}
.toolbar-submit:hover {
    opacity: 0.85 !important;
    color: #fff !important;
}

.preview-images-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preview-img-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    flex-shrink: 0;
}

.preview-img-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

.preview-img-remove {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s;
}
.preview-img-remove:hover {
    background: rgba(220, 53, 69, 0.85);
}

/* ========================================
   文本输入框
   ======================================== */
.modal-comment-input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    outline: none;
    background: transparent;
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.7;
    resize: none;
    height: 70px;
    min-height: 70px;
    max-height: 160px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* textarea 滚动条：和评论列表一样浅灰 */
.modal-comment-input::-webkit-scrollbar {
    width: 6px;
}

.modal-comment-input::-webkit-scrollbar-track {
    background: transparent;
}

.modal-comment-input::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.modal-comment-input:focus {
    border-color: var(--tg-text-link);
}

.modal-comment-input::placeholder {
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 400;
}

.comment-submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.comment-submit-row .captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-submit-btn {
    background: var(--tg-text-link);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.modal-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.modal-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.char-counter.warn { color: #ff9500; }
.char-counter.over { color: #ff3b30; font-weight: 700; }

/* 底部版权信息 */
.modal-footer-credit {
    text-align: center;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.3);
    padding: 0;
    font-weight: 300;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 底部提示语 */
.comment-hint {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
    text-align: center;
    margin-top: -4px;
    margin-bottom: 4px;
    line-height: 1.6;
    font-weight: 400;
}

/* 游客信息 */
.guest-info-row {
    display: none;
    gap: 10px;
    margin-bottom: 10px;
    opacity: 0;
    animation: slideDown 0.3s ease forwards;
}

.guest-info-row.show {
    display: flex;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.guest-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--tg-border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--tg-bg-secondary);
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.guest-input:focus {
    outline: none;
    border-color: var(--tg-text-link);
}

.guest-input::placeholder {
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.guest-hint {
    display: none;
    font-size: 12px;
    color: #ff9500;
    margin-bottom: 8px;
    padding-left: 4px;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 400;
}

/* ========================================
   表情面板 - 横向滚动 6x8 布局
   ======================================== */

/* ========================================
   多置顶悬浮提示条
   ======================================== */
/* ========================================
   工具栏（评论列表与输入框之间）
   ======================================== */
.comment-toolbar {
    padding: 8px 16px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* 固定在 body 与 footer 之间，紧贴分割线上方 */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    min-height: 36px;
}

/* ========================================
   最新按钮行（绝对定位，骑在 footer 顶边分割线上）
   ======================================== */
.latest-btn-row {
    position: absolute;
    top: -36px;
    right: 16px;
    display: flex;
    align-items: center;
}

/* 最新按钮 */
.latest-btn,
#latestBtnFixed {
    background: #ff9500;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.2s, color 0.2s, transform 0.2s;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.latest-btn:hover,
#latestBtnFixed:hover {
    background: #ff7000;
    color: #fff;
    transform: scale(1.04);
}

/* ========================================
   置顶提示（跟随弹窗顶部位置）
   平时不显示，只在打开聊天窗口时出现
   ======================================== */
#pinnedHeaderHint {
    position: fixed;
    /* ★ JS 动态计算 left 值，居中在弹窗上方 */
    /* CSS 作为 fallback（居中于视口） */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    /* 默认隐藏，只在弹窗打开时加 .visible 类 */
    display: none;
    align-items: center;
    gap: 6px;
    /* ★ 纯玻璃质感：去掉外边框，加大内边距让文字不紧 */
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.8);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* .visible：打开聊天窗口时显示 */
#pinnedHeaderHint.visible {
    display: inline-flex;
}

/* hover 效果（在 .visible 基础上） */
#pinnedHeaderHint.visible:hover {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 149, 0, 0.5);
    transform: translateX(-50%) scale(1.04);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(255, 149, 0, 0.15), inset 0 1px 0 rgba(255,255,255,0.9);
    color: #ff6b00;
}

/* ========================================
   图片上传对话框
   ======================================== */
.img-dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    /* ★ 不遮罩聊天窗口——背景透明，保留弹窗内容不被遮挡 */
    background: transparent;
    /* ★ 必须高于 container 的 9999999，否则被弹窗压在下面 */
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tgFadeIn 0.2s ease;
}

.img-dialog-card {
    background: var(--tg-bg-primary);
    border-radius: 16px;
    padding: 24px;
    width: 340px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: tgFadeIn 0.25s ease;
}

.img-dialog-wide {
    width: 520px;
}

.img-dialog-main {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

/* 上传区 */
.img-upload-area {
    flex: 1;
    min-height: 160px;
    border: 2px dashed var(--tg-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--tg-bg-secondary);
    padding: 16px 12px;
    box-sizing: border-box;
}

.img-upload-area:hover {
    border-color: #ff9500;
    background: #fff8f0;
}

.img-upload-area.uploading {
    border-color: #ff9500;
    background: #fff8f0;
    pointer-events: none;
}

.img-upload-area.uploaded {
    border-color: #22c55e;
    background: #f0fdf4;
}

.img-upload-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 6px;
}

.img-upload-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-text-primary);
    margin-bottom: 2px;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

.img-upload-sub {
    font-size: 11px;
    color: #ff9500;
    font-weight: 600;
    margin-bottom: 4px;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

.img-upload-hint {
    font-size: 10px;
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

/* 进度条 */
.img-upload-progress {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.img-upload-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff9500, #ff6b00);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* 成功状态 */
.img-upload-success {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-top: 8px;
}

.img-upload-ok-icon {
    font-size: 24px;
    line-height: 1;
}

.img-upload-ok-text {
    font-size: 11px;
    color: #22c55e;
    font-weight: 600;
    margin-top: 2px;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

/* 链接区 */
.img-url-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.img-url-hint {
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: #856404;
    margin-bottom: 10px;
    line-height: 1.6;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
.img-url-hint-icon { margin-right: 4px; }
.img-url-link {
    color: #ff9500;
    font-weight: 700;
    text-decoration: none;
}
.img-url-link:hover { text-decoration: underline; }
.img-url-hint-arrow { margin-right: 6px; }

.img-url-section-title {
    font-size: 12px;
    color: var(--tg-text-secondary);
    margin-bottom: 8px;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

.img-dialog-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tg-text-primary);
    margin-bottom: 14px;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

.img-dialog-body {}

.img-dialog-tip {
    background: #fff7e6;
    border: 1px solid #ffd180;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #7a4f00;
    line-height: 1.6;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.img-dialog-tip-icon {
    margin-right: 4px;
}

.img-dialog-tip strong {
    color: #e65100;
}

.img-dialog-link {
    display: inline-block;
    margin-top: 6px;
    color: #ff6b00;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}

.img-dialog-link:hover {
    text-decoration: underline;
}

.img-url-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--tg-border);
    border-radius: 10px;
    font-size: 13px;
    background: var(--tg-bg-primary);
    color: var(--tg-text-primary);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 8px;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.img-url-input::placeholder {
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.img-url-input:focus {
    border-color: #ff9500;
}

.img-preview-box {
    min-height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--tg-bg-secondary);
}

.img-preview-box img {
    max-width: 100%;
    max-height: 120px;
    display: block;
    border-radius: 8px;
}

.img-preview-error {
    padding: 10px 12px;
    font-size: 12px;
    color: #cc3300;
}

.img-dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.img-dialog-cancel {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--tg-border);
    background: transparent;
    border-radius: 10px;
    font-size: 14px;
    color: var(--tg-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.img-dialog-cancel:hover {
    background: var(--tg-bg-secondary);
}

.img-dialog-confirm {
    flex: 1;
    padding: 10px;
    border: none;
    background: linear-gradient(135deg, #ff9500, #ff6b00);
    border-radius: 10px;
    font-size: 14px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.img-dialog-confirm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.emoji-panel {
    position: absolute;
    bottom: 50px;
    right: 10px;
    width: 260px;
    background: var(--tg-bg-primary);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
    overflow: hidden;
    border: 1px solid var(--tg-border);
}

.emoji-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--tg-bg-secondary);
    font-size: 12px;
    color: var(--tg-text-secondary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-weight: 500;
}

.emoji-panel-close {
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--tg-text-secondary);
    padding: 0;
    line-height: 1;
}

/* 横向滚动容器 */
.emoji-scroll-container {
    width: 100%;
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 6列网格布局 */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    padding: 8px;
}

.emoji-item {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    font-size: 22px;
    transition: all 0.15s;
}

.emoji-item:hover {
    background: var(--tg-bg-secondary);
    transform: scale(1.2);
}

/* 滚动条样式 */
.emoji-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.emoji-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* ========================================
   验证码
   ======================================== */
.captcha-input {
    width: 100px;
    padding: 9px 10px;
    border: 1px solid var(--tg-border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--tg-bg-secondary);
    color: var(--tg-text-primary);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.captcha-input:focus {
    outline: none;
    border-color: var(--tg-text-link);
}

.captcha-input::placeholder {
    color: var(--tg-placeholder);
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.captcha-image {
    height: 34px;
    width: 80px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--tg-border);
}

.captcha-image:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.comment-hint {
    color: var(--tg-text-secondary);
    font-size: 11px;
    margin-top: -4px;
    margin-bottom: 4px;
    line-height: 1.6;
    font-family: 'Noto Sans SC', '阿里巴巴普惠体 3.0', 'Alibaba PuHuiTi 3.0', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .comment-trigger-btn {
        bottom: 20px;
        right: 60px;
        padding: 12px 20px;
        font-size: 14px;
    }

    .comment-modal-container {
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 90vh;
        border-radius: 16px;
    }

    .comment-modal-container.active {
        bottom: 10px;
    }

    .comment-modal-header {
        padding: 14px 16px;
    }

    .comment-modal-body {
        padding: 16px 8px 60px 8px;
    }

    .comment-modal-footer {
        padding: 12px;
        position: relative;
        z-index: 5;
    }

    .comment-avatar {
        width: 36px;
        height: 36px;
    }

    .comment-replies {
        padding-left: 46px;
    }

    .reply-form {
        padding-left: 46px;
    }

    .emoji-panel {
        width: calc(100% - 20px);
        right: 10px;
    }

    .comment-submit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-submit-btn {
        width: 100%;
        text-align: center;
    }

    .captcha-row {
        width: 100%;
    }

    .captcha-input {
        flex: 1;
    }

    .captcha-image {
        width: 70px;
        height: 32px;
    }

    .guest-info-row {
        flex-direction: column;
    }
}

/* ========================================
   点赞动画
   ======================================== */
@keyframes likeAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.like-btn.liked {
    animation: likeAnim 0.3s ease;
}

/* ========================================
   动画
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mwlibLbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ========================================
   传统评论区域（页面内非弹窗）
   ======================================== */
.comment-form {
    margin-bottom: 30px;
    background: var(--tg-bg-secondary);
    padding: 20px;
    border-radius: 16px;
}

.comment-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius-small);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 12px;
    background: var(--tg-bg-primary);
    color: var(--tg-text-primary);
    min-height: 80px;
    transition: border-color 0.2s;
}

.comment-input:focus {
    outline: none;
    border-color: var(--tg-text-link);
}

.comment-form-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.comment-submit-btn {
    background: var(--tg-text-link);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.comment-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.comment-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
}

/* ========================================
   Toast 提示
   ======================================== */
.mwlib-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: center;
    max-width: 80%;
}

.mwlib-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
