/* ============================================================
   CTOComment - 纯自主评论系统，无第三方版权
   现代化样式 · 支持通过 .cto-comment-wrap 上的 CSS 变量快速换肤
   ============================================================ */
.cto-comment-wrap{
  --cto-accent:#4a7dfc;          /* 主题色 */
  --cto-accent-weak:#eef3ff;     /* 主题色浅底 */
  --cto-text:#2b2f36;            /* 主文字 */
  --cto-text-2:#5b6472;          /* 次要文字 */
  --cto-muted:#9aa3b0;           /* 弱文字 */
  --cto-border:#e8ebf0;          /* 边框 */
  --cto-bg-soft:#f7f8fa;         /* 浅背景 */
  --cto-radius:10px;             /* 圆角 */
  font-size:14px;color:var(--cto-text);line-height:1.65;
  -webkit-font-smoothing:antialiased;
}
.cto-comment-wrap *{box-sizing:border-box}
.cto-comment-wrap .cto-clearfix{clear:both}
.cto-comment-wrap .cto-hidden{display:none!important}
.cto-comment-wrap a{text-decoration:none}

/* ---------- 标题 ---------- */
.cto-comment-wrap .cto-header{display:flex;align-items:baseline;gap:10px;margin-bottom:14px}
.cto-comment-wrap .cto-header h3{margin:0;font-size:17px;font-weight:600;color:var(--cto-text)}
.cto-comment-wrap .cto-header .cto-count{color:var(--cto-muted);font-size:13px}

/* ---------- 排序栏 ---------- */
.cto-comment-wrap .cto-sort-bar{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;font-size:13px;color:var(--cto-muted)}
.cto-comment-wrap .cto-sort-bar .cto-sort{display:inline-flex;align-items:center;gap:2px;background:var(--cto-bg-soft);border-radius:999px;padding:3px}
.cto-comment-wrap .cto-sort-bar .cto-sort .cto-sort-label{padding:0 8px 0 10px;font-size:12px;color:var(--cto-muted)}
.cto-comment-wrap .cto-sort-bar .cto-sort a{padding:3px 12px;border-radius:999px;cursor:pointer;color:var(--cto-text-2);transition:all .15s}
.cto-comment-wrap .cto-sort-bar .cto-sort a:hover{color:var(--cto-text)}
.cto-comment-wrap .cto-sort-bar .cto-sort a.active{background:#fff;color:var(--cto-text);font-weight:500;box-shadow:0 1px 3px rgba(0,0,0,.08)}

/* ---------- 输入区 ---------- */
.cto-comment-wrap .cto-input-area{margin-bottom:22px;border:1px solid var(--cto-border);border-radius:var(--cto-radius);background:#fff;transition:border-color .2s,box-shadow .2s}
.cto-comment-wrap .cto-input-area:focus-within{border-color:var(--cto-accent);box-shadow:0 0 0 3px rgba(74,125,252,.1)}
.cto-comment-wrap .cto-input-area .cto-tabs{display:flex;gap:2px;padding:6px 8px 0;background:var(--cto-bg-soft);border-bottom:1px solid var(--cto-border);border-radius:var(--cto-radius) var(--cto-radius) 0 0}
.cto-comment-wrap .cto-input-area .cto-tabs .cto-tab{padding:6px 14px;cursor:pointer;font-size:13px;color:var(--cto-text-2);border-radius:8px 8px 0 0;border:1px solid transparent;border-bottom:none;margin-bottom:-1px;transition:all .15s}
.cto-comment-wrap .cto-input-area .cto-tabs .cto-tab:hover{color:var(--cto-text)}
.cto-comment-wrap .cto-input-area .cto-tabs .cto-tab.active{background:#fff;color:var(--cto-accent);font-weight:500;border-color:var(--cto-border)}
.cto-comment-wrap .cto-input-area .cto-editor-wrap{position:relative}
.cto-comment-wrap .cto-input-area textarea.cto-editor{display:block;width:100%;min-height:110px;padding:12px 14px;border:none;resize:vertical;font-size:14px;line-height:1.6;font-family:inherit;color:var(--cto-text);outline:none;background:#fff}
.cto-comment-wrap .cto-input-area textarea.cto-editor::placeholder{color:var(--cto-muted)}
.cto-comment-wrap .cto-input-area .cto-preview{width:100%;min-height:110px;padding:12px 14px;display:none;background:#fff;overflow:auto;color:var(--cto-text)}
.cto-comment-wrap .cto-input-area .cto-preview.active{display:block}
.cto-comment-wrap .cto-input-area .cto-preview:empty::after{content:'暂无内容';color:var(--cto-muted);font-size:13px}
.cto-comment-wrap .cto-input-area .cto-footer{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;padding:9px 12px;background:var(--cto-bg-soft);border-top:1px solid var(--cto-border);border-radius:0 0 var(--cto-radius) var(--cto-radius)}
.cto-comment-wrap .cto-input-area .cto-footer .cto-meta-left{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.cto-comment-wrap .cto-input-area .cto-footer .cto-meta-left input[type=text]{padding:5px 10px;border:1px solid var(--cto-border);border-radius:6px;font-size:13px;width:auto;background:#fff;color:var(--cto-text);outline:none;transition:border-color .15s}
.cto-comment-wrap .cto-input-area .cto-footer .cto-meta-left input[type=text]:focus{border-color:var(--cto-accent)}
.cto-comment-wrap .cto-input-area .cto-footer .cto-submit{padding:7px 20px;background:var(--cto-accent);color:#fff;border:none;border-radius:999px;cursor:pointer;font-size:13px;font-weight:500;transition:all .15s;box-shadow:0 2px 6px rgba(74,125,252,.3)}
.cto-comment-wrap .cto-input-area .cto-footer .cto-submit:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 3px 10px rgba(74,125,252,.35)}
.cto-comment-wrap .cto-input-area .cto-footer .cto-submit:active{transform:translateY(0)}
.cto-comment-wrap .cto-input-area .cto-footer .cto-submit:disabled{background:var(--cto-muted);box-shadow:none;cursor:not-allowed}
.cto-comment-wrap .cto-input-area .cto-reply-to{font-size:12px;color:var(--cto-text-2);margin:10px 12px 0;padding:6px 10px;background:var(--cto-accent-weak);border-radius:6px;display:flex;align-items:center;justify-content:space-between}
.cto-comment-wrap .cto-input-area .cto-reply-to b{color:var(--cto-accent)}
.cto-comment-wrap .cto-input-area .cto-reply-to .cto-cancel-reply{cursor:pointer;color:var(--cto-muted)}
.cto-comment-wrap .cto-input-area .cto-reply-to .cto-cancel-reply:hover{color:#e74c3c}

/* ---------- 验证码 ---------- */
.cto-captcha-wrap{display:inline-flex;align-items:center;gap:6px}
.cto-comment-wrap .cto-captcha-wrap .cto-captcha-code{width:72px!important}
.cto-comment-wrap .cto-captcha-wrap .cto-captcha-img{height:32px;border-radius:6px;cursor:pointer;border:1px solid var(--cto-border)}

/* ---------- 评论列表 ---------- */
.cto-comment-wrap .cto-list{margin-bottom:6px}
.cto-comment-wrap .cto-item{padding:16px 4px;border-bottom:1px solid var(--cto-border);animation:cto-fadein .3s ease both}
.cto-comment-wrap .cto-item:last-child{border-bottom:none}
.cto-comment-wrap .cto-item:hover{background:rgba(74,125,252,.02)}
@keyframes cto-fadein{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

/* 头部：头像 昵称 徽章 时间 环境信息 */
.cto-comment-wrap .cto-item .cto-head{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;margin-bottom:8px}
.cto-comment-wrap .cto-item .cto-head .cto-avatar{width:36px;height:36px;border-radius:50%;background:var(--cto-bg-soft);overflow:hidden;flex-shrink:0;box-shadow:0 0 0 2px #fff,0 1px 4px rgba(0,0,0,.08)}
.cto-comment-wrap .cto-item .cto-head .cto-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.cto-comment-wrap .cto-item .cto-head .cto-name{font-weight:600;color:var(--cto-text);margin-right:2px}
.cto-comment-wrap .cto-item .cto-head .cto-label{font-size:11px;line-height:1;padding:3px 7px;color:#fff;border-radius:999px;flex-shrink:0}
.cto-comment-wrap .cto-item .cto-head .cto-label.author{background:linear-gradient(135deg,#ff9a44,#fc6042)}
.cto-comment-wrap .cto-item .cto-head .cto-label.admin{background:linear-gradient(135deg,#34d293,#20b26b)}
.cto-comment-wrap .cto-item .cto-head .cto-info{color:var(--cto-muted);font-size:12px;white-space:nowrap}
.cto-comment-wrap .cto-item .cto-head .cto-info + .cto-info::before{content:'·';margin-right:8px;color:#d3d8e0}
.cto-comment-wrap .cto-item .cto-sticky-badge{background:linear-gradient(135deg,#ff9a44,#fc6042);color:#fff;font-size:11px;line-height:1;padding:3px 7px;border-radius:999px}

/* 内容 */
.cto-comment-wrap .cto-item .cto-body{margin-left:46px}
.cto-comment-wrap .cto-item .cto-body .cto-content{word-break:break-word;color:var(--cto-text)}
.cto-comment-wrap .cto-item .cto-body .cto-content img{max-width:100%;border-radius:6px}
.cto-comment-wrap .cto-item .cto-body .cto-content blockquote{border-left:3px solid var(--cto-accent);padding:6px 12px;margin:6px 0;color:var(--cto-text-2);background:var(--cto-bg-soft);border-radius:0 8px 8px 0;font-size:13px}
.cto-comment-wrap .cto-item .cto-body .cto-content blockquote p{margin:2px 0}
.cto-comment-wrap .cto-item .cto-body .cto-content p{margin:4px 0}
.cto-comment-wrap .cto-item .cto-body .cto-content a{color:var(--cto-accent)}
.cto-comment-wrap .cto-item .cto-body .cto-content a:hover{text-decoration:underline}
.cto-comment-wrap .cto-item .cto-body .cto-content code{background:var(--cto-bg-soft);border:1px solid var(--cto-border);padding:1px 6px;border-radius:4px;font-size:13px;color:#d63384}
.cto-comment-wrap .cto-item .cto-body .cto-content pre{background:#282c34;color:#abb2bf;padding:12px 14px;border-radius:8px;overflow-x:auto;margin:8px 0;font-size:13px}
.cto-comment-wrap .cto-item .cto-body .cto-content pre code{background:none;border:none;padding:0;color:inherit}
.cto-comment-wrap .cto-item .cto-body .cto-content ul,.cto-comment-wrap .cto-item .cto-body .cto-content ol{padding-left:20px;margin:4px 0}
.cto-comment-wrap .cto-item .cto-body .cto-content table{border-collapse:collapse;margin:6px 0;max-width:100%}
.cto-comment-wrap .cto-item .cto-body .cto-content td,.cto-comment-wrap .cto-item .cto-body .cto-content th{border:1px solid var(--cto-border);padding:5px 10px}

/* 引用块（回复可见的父评论摘要） */
.cto-comment-wrap .cto-quote{border-left:3px solid var(--cto-accent);padding:6px 12px;margin:4px 0 8px;color:var(--cto-text-2);background:var(--cto-bg-soft);border-radius:0 8px 8px 0;font-size:13px}

/* 等待审核（临时显示） */
.cto-comment-wrap .cto-waiting-item{opacity:.75;background:var(--cto-bg-soft);border-radius:var(--cto-radius);padding:14px;margin-bottom:8px}
.cto-comment-wrap .cto-waiting-item .cto-waiting-note{color:#e67e22;font-size:12px;margin-top:6px}

/* 等待审核 */
.cto-comment-wrap .cto-item .cto-waiting-note{display:inline-flex;align-items:center;gap:4px;color:#e67e22;font-size:12px;margin-top:4px}
.cto-comment-wrap .cto-item .cto-waiting-note::before{content:'';width:6px;height:6px;border-radius:50%;background:#f0a04b}

/* 操作栏 */
.cto-comment-wrap .cto-item .cto-body .cto-actions{display:flex;align-items:center;gap:4px;margin-top:8px;font-size:12px;color:var(--cto-muted)}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:3px 10px;border-radius:999px;cursor:pointer;transition:all .15s;user-select:none;line-height:1}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action .cto-icon{font-size:13px;line-height:1;display:inline-flex;align-items:center}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action span:last-child{display:inline-flex;align-items:center;line-height:1}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action:hover{background:var(--cto-accent-weak);color:var(--cto-accent)}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action.liked{color:#e74c3c;background:rgba(231,76,60,.08)}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action.liked:hover{background:rgba(231,76,60,.14)}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action.cto-delete{color:var(--cto-muted)}
.cto-comment-wrap .cto-item .cto-body .cto-actions .cto-action.cto-delete:hover{color:#e74c3c;background:rgba(231,76,60,.08)}

/* ---------- 子评论 ---------- */
.cto-comment-wrap .cto-children{margin-top:12px;padding-left:16px;border-left:2px solid var(--cto-border)}
.cto-comment-wrap .cto-children .cto-item{padding:12px 0 10px;border-bottom:none;animation:none}
.cto-comment-wrap .cto-children .cto-item:not(:last-child){border-bottom:1px dashed #f0f2f5}
.cto-comment-wrap .cto-children .cto-item .cto-body{margin-left:44px}
.cto-comment-wrap .cto-children .cto-children{border-left-color:#f0f2f5}

/* ---------- 空状态 / 加载中 ---------- */
.cto-comment-wrap .cto-empty{text-align:center;padding:34px 0;color:var(--cto-muted);font-size:13px}
.cto-comment-wrap .cto-empty::before{content:'💬';display:block;font-size:26px;margin-bottom:8px;opacity:.5}
.cto-comment-wrap .cto-loading{text-align:center;padding:24px;color:var(--cto-muted);font-size:13px}
.cto-comment-wrap .cto-loading .cto-spinner{display:inline-block;width:16px;height:16px;border:2px solid var(--cto-border);border-top-color:var(--cto-accent);border-radius:50%;animation:cto-spin .8s linear infinite;vertical-align:-3px;margin-right:6px}
@keyframes cto-spin{to{transform:rotate(360deg)}}

/* ---------- 分页 ---------- */
.cto-comment-wrap .cto-pagination{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;margin-top:18px;gap:6px}
.cto-comment-wrap .cto-pagination .cto-page-btn{min-width:30px;padding:5px 10px;border:1px solid var(--cto-border);background:#fff;border-radius:8px;cursor:pointer;font-size:13px;color:var(--cto-text-2);transition:all .15s}
.cto-comment-wrap .cto-pagination .cto-page-btn:hover{border-color:var(--cto-accent);color:var(--cto-accent)}
.cto-comment-wrap .cto-pagination .cto-page-btn.active{background:var(--cto-accent);color:#fff;border-color:var(--cto-accent)}
.cto-comment-wrap .cto-pagination .cto-page-btn:disabled{color:#c8cdd5;cursor:not-allowed;background:var(--cto-bg-soft)}
.cto-comment-wrap .cto-pagination .cto-page-info{color:var(--cto-muted);font-size:12px;margin:0 4px}

/* ---------- 回复输入框 ---------- */
.cto-comment-wrap .cto-reply-input{margin-top:10px;border:1px solid var(--cto-border);border-radius:8px;overflow:hidden;background:#fff}
.cto-comment-wrap .cto-reply-input:focus-within{border-color:var(--cto-accent)}
.cto-comment-wrap .cto-reply-input textarea{display:block;width:100%;min-height:60px;padding:10px 12px;border:none;resize:vertical;font-size:13px;outline:none;color:var(--cto-text);font-family:inherit}
.cto-comment-wrap .cto-reply-input .cto-reply-footer{display:flex;justify-content:flex-end;gap:8px;padding:7px 10px;background:var(--cto-bg-soft);border-top:1px solid var(--cto-border)}
.cto-comment-wrap .cto-reply-input .cto-reply-footer .cto-cancel{padding:4px 14px;background:#fff;border:1px solid var(--cto-border);border-radius:999px;cursor:pointer;font-size:12px;color:var(--cto-text-2)}
.cto-comment-wrap .cto-reply-input .cto-reply-footer .cto-cancel:hover{border-color:var(--cto-muted)}
.cto-comment-wrap .cto-reply-input .cto-reply-footer .cto-reply-submit{padding:4px 14px;background:var(--cto-accent);color:#fff;border:none;border-radius:999px;cursor:pointer;font-size:12px}
.cto-comment-wrap .cto-reply-input .cto-reply-footer .cto-reply-submit:hover{filter:brightness(1.08)}

/* ---------- 登录按钮 ---------- */
.cto-comment-wrap .cto-login-area{text-align:center;padding:18px;margin-bottom:15px;border:1px dashed var(--cto-border);border-radius:var(--cto-radius);background:var(--cto-bg-soft);color:var(--cto-text-2);font-size:13px}
.cto-comment-wrap .cto-login-area .cto-login-btn{display:inline-block;margin-top:8px;padding:7px 26px;background:var(--cto-accent);color:#fff;border:none;border-radius:999px;cursor:pointer;font-size:13px;transition:all .15s}
.cto-comment-wrap .cto-login-area .cto-login-btn:hover{filter:brightness(1.08)}

/* ---------- 评论关闭提示 ---------- */
.cto-closed{padding:30px 0;text-align:center;color:var(--cto-muted,#9aa3b0);font-size:14px;background:var(--cto-bg-soft,#f7f8fa);border-radius:10px;margin-top:12px}
.cto-closed::before{content:'🔒';display:block;font-size:22px;margin-bottom:6px;opacity:.6}

/* ---------- 消息提示 ---------- */
.cto-comment-wrap .cto-toast{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);padding:10px 22px;background:rgba(30,35,45,.88);color:#fff;border-radius:999px;z-index:9999;font-size:13px;box-shadow:0 6px 24px rgba(0,0,0,.18);animation:cto-toast-in .2s ease}
.cto-comment-wrap .cto-toast.success{background:rgba(32,178,107,.92)}
.cto-comment-wrap .cto-toast.error{background:rgba(231,76,60,.92)}
.cto-comment-wrap .cto-toast.info{background:rgba(74,125,252,.92)}
@keyframes cto-toast-in{from{opacity:0;transform:translate(-50%,-40%)}to{opacity:1;transform:translate(-50%,-50%)}}

/* ---------- 窄屏适配 ---------- */
@media (max-width:640px){
  .cto-comment-wrap .cto-item .cto-body{margin-left:0}
  .cto-comment-wrap .cto-children{padding-left:10px}
  .cto-comment-wrap .cto-children .cto-item .cto-body{margin-left:0}
  .cto-comment-wrap .cto-header{flex-direction:column;gap:2px}
  .cto-comment-wrap .cto-sort-bar{flex-direction:column;align-items:flex-start;gap:8px}
  .cto-comment-wrap .cto-input-area .cto-footer{flex-direction:column-reverse;align-items:stretch}
  .cto-comment-wrap .cto-input-area .cto-footer .cto-submit{width:100%;padding:9px 0}
}
