:root {
  /* 明亮且专业的浅色学术主题 */
  --bg: #f5f7fa;          /* 页面浅灰蓝背景 */
  --panel: #ffffff;       /* 卡片纯白背景 */
  --panel2: #f8f9fc;      /* 输入框/内部次级区块背景 */
  --border: #e2e8f0;      /* 柔和的边框颜色 */
  --text: #2d3748;        /* 深灰主文本，降低纯黑对比度，护眼 */
  --muted: #718096;       /* 次要文本/辅助说明 */
  --accent: #3182ce;      /* 品牌主色：沉稳的学术蓝 */
  --green: #38a169;       /* 成功/通过/解析 */
  --red: #e53e3e;         /* 错误/停止/扣分 */
  --yellow: #dd6b20;      /* 警告/高亮/分数（偏橙，浅色下更清晰） */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", system-ui, sans-serif; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
header { padding: 12px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
header h1 { font-size: 18px; font-weight: 600; }
header .badge { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.layout { display: grid; grid-template-columns: 320px 1.25fr 1fr; gap: 14px; padding: 10px 24px 14px; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; min-height: 0; }
.card h2 { font-size: 14px; margin-bottom: 10px; color: var(--text); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card h2 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
label { font-size: 12px; color: var(--muted); display: block; margin: 8px 0 4px; flex-shrink: 0; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 13px; outline: none; flex-shrink: 0;
}
input:focus, select:focus { border-color: var(--accent); }
select { cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
button {
  background: var(--accent); border: none; color: #fff; border-radius: 8px; padding: 9px 14px;
  font-size: 13px; cursor: pointer; transition: opacity .15s;
}
button:hover { opacity: .88; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.secondary { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }
.row { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.status { font-size: 12px; margin-top: 8px; min-height: 18px; flex-shrink: 0; }
.status.ok { color: var(--green); }
.status.err { color: var(--red); }
.status.busy { color: var(--yellow); }
.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 22px; text-align: center;
  color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color .15s;
  flex-shrink: 0;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--text); }
/* 卡密门禁：未验证时上传区锁定态 */
.dropzone.locked { cursor: not-allowed; opacity: .55; border-style: dashed; }
.dropzone.locked:hover { border-color: var(--red); color: var(--muted); }
/* PDF 上传提示 */
.pdf-tips {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: #fffaf0; border: 1px solid #fbd38d;
  color: #975a16; font-size: 12px; line-height: 1.7; flex-shrink: 0;
}
.pages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 10px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  align-content: start;
}
.page-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  aspect-ratio: 3 / 4;
}
.page-thumb:hover { border-color: var(--accent); transform: translateY(-1px); }
.page-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(49,130,206,.25); }
.page-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-thumb .num { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.page-thumb .state { position: absolute; right: 4px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); border: 1px solid #fff; }
.page-thumb .state.pending { background: var(--muted); }
.page-thumb .state.working { background: var(--yellow); animation: blink 1s infinite; }
.page-thumb .state.done { background: var(--green); }
.page-thumb .state.error { background: var(--red); }
/* 切片删除按钮：悬停缩略图时显示 */
.page-thumb .del-thumb {
  position: absolute; right: 4px; bottom: 4px;
  width: 20px; height: 20px; padding: 0; border: none; border-radius: 50%;
  background: rgba(229,62,62,.9); color: #fff;
  font-size: 14px; line-height: 20px; text-align: center; cursor: pointer;
  opacity: 0; transition: opacity .15s, transform .15s;
  display: flex; align-items: center; justify-content: center;
}
.page-thumb:hover .del-thumb { opacity: 1; }
.page-thumb .del-thumb:hover { background: var(--red); transform: scale(1.15); }
@keyframes blink { 50% { opacity: .3; } }
.scroll { overflow-y: auto; flex: 1; min-height: 0; }
/* 知识图谱树 */
.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--border); margin-left: 7px; }
.tree > ul { border-left: none; padding-left: 0; margin-left: 0; }
.tree li { margin: 4px 0; }
.node { display: block; padding: 5px 10px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.7; overflow-wrap: break-word; word-break: break-word; white-space: normal; }
.node .tag { display: inline; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; margin-right: 6px; white-space: nowrap; }
.tag.content { background: #ebf8ff; color: #3182ce; border: 1px solid #90cdf4; }
.tag.formula { background: #fffff0; color: #dd6b20; border: 1px solid #fbd38d; }
.tag.layout { background: #f0fff4; color: #38a169; border: 1px solid #9ae6b4; }
.tag.figure { background: #faf5ff; color: #805ad5; border: 1px solid #d6bcfa; }
.tag.table { background: #fff5f5; color: #e53e3e; border: 1px solid #feb2b2; }
.tag.other { background: #edf2f7; color: #718096; border: 1px solid #e2e8f0; }
.node .detail { display: block; margin: 2px 0 0; color: var(--muted); text-align: justify; }
.node b { color: var(--text); font-weight: 600; }
.page-block { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.page-block > .ptitle { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 8px; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.page-img-wrap { position: relative; width: 100%; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; cursor: zoom-in; }
.page-img-wrap img { width: 100%; display: block; }
.page-anal { margin-top: 10px; padding: 8px 10px; background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: 6px; }
.page-anal .an-title { font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 6px; }
.page-anal .continuity { font-size: 12px; color: var(--muted); background: #f7fafc; border-left: 3px solid var(--green); padding: 6px 8px; margin-bottom: 6px; border-radius: 0 4px 4px 0; }
.page-anal .lang-check { font-size: 12px; color: var(--muted); background: #f7fafc; border-left: 3px solid var(--accent); padding: 6px 8px; margin-bottom: 6px; border-radius: 0 4px 4px 0; }
.page-anal .lang-check.ai { border-left-color: var(--yellow); }
.page-anal .tree { max-height: 260px; overflow-y: auto; }
.no-parse { font-size: 12px; color: var(--muted); padding: 8px; }
/* 灯箱 */
#lightbox { position: fixed; inset: 0; background: rgba(255,255,255,.9); display: none; align-items: center; justify-content: center; z-index: 999; cursor: zoom-out; }
#lightbox.show { display: flex; }
#lightbox img { max-width: 90%; max-height: 90%; border-radius: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); }
#lightbox .lb-close { position: absolute; top: 16px; right: 24px; color: #333; font-size: 34px; cursor: pointer; }
/* 点评 */
.review-md { font-size: 13.5px; line-height: 1.8; }
.review-md h1, .review-md h2, .review-md h3 { margin: 14px 0 8px; color: var(--accent); font-size: 15px; page-break-inside: avoid; break-inside: avoid; page-break-after: avoid; }
.review-md ul, .review-md ol { padding-left: 22px; margin: 6px 0; }
.review-md li { page-break-inside: avoid; break-inside: avoid; }
.review-md p { margin: 6px 0; page-break-inside: avoid; break-inside: avoid; }
.review-md strong { color: var(--yellow); }
.review-md table { border-collapse: collapse; margin: 8px 0; }
.review-md td, .review-md th { border: 1px solid var(--border); padding: 4px 10px; font-size: 12.5px; }
.review-md tr { page-break-inside: avoid; break-inside: avoid; }
.review-md img { page-break-inside: avoid; break-inside: avoid; max-width: 100%; }
.review-md code { background: #edf2f7; padding: 1px 5px; border-radius: 4px; color: #e53e3e; }
.score-banner { display: none; background: linear-gradient(135deg, #ebf8ff, #e6fffa); border: 1px solid var(--accent); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; font-size: 14px; box-shadow: 0 4px 6px rgba(49, 130, 206, 0.05); }
.score-banner .score { font-size: 30px; font-weight: 700; color: var(--yellow); }
.progress-bar { height: 6px; background: var(--panel2); border-radius: 999px; overflow: hidden; margin-top: 8px; flex-shrink: 0; }
.progress-bar > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.empty-hint { color: var(--muted); font-size: 12.5px; text-align: center; padding: 30px 10px; }
.phase { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.phase.active { border-color: var(--accent); color: var(--accent); }
.follow-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; }
.follow-toggle input { width: auto; margin: 0; accent-color: var(--accent); }

/* 提示弹窗 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-content { background: var(--panel); width: 420px; max-width: 90%; border-radius: 12px; padding: 24px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); text-align: center; }
.modal-content h3 { font-size: 18px; margin-bottom: 12px; color: var(--text); font-weight: 600; }
.modal-content p { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; text-align: justify; }
.modal-content button { width: 100%; font-size: 14px; padding: 10px 0; }

/* 弹窗/顶栏跳转按钮 */
.modal-links { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.kapi-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #fdf3d8; flex-shrink: 0; }
.link-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px 0; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: filter .15s, transform .1s; }
.link-btn:hover { filter: brightness(1.06); }
.link-btn:active { transform: scale(0.98); }
.coze-link { background: linear-gradient(135deg, #3182ce, #2b6cb0); color: #fff; box-shadow: 0 2px 6px rgba(49,130,206,.3); }
.kapi-link { background: #fdf6e3; border-color: #ecd9a0; color: #8a6d1f; }
.kapi-header-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 5px; border: 1px solid #ecd9a0; background: #fdf6e3; color: #8a6d1f; border-radius: 999px; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: filter .15s; }
.kapi-header-btn:hover { filter: brightness(1.04); }
.kapi-header-btn .kapi-avatar { width: 20px; height: 20px; }

/* 人机验证弹窗 */
.captcha-overlay { z-index: 3000; background: rgba(0,0,0,0.55); }
.captcha-box { width: 360px; padding: 28px 24px; }
.captcha-box h3 { margin-bottom: 8px; }
.captcha-box > p { text-align: center; margin-bottom: 20px; color: var(--muted); }
.captcha-check {
  display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
  background: var(--panel2); transition: border-color .2s, background .2s;
  margin: 0;
}
.captcha-check:hover { border-color: var(--accent); }
.captcha-check.checked { border-color: var(--green); background: #f0fff4; }
.captcha-check.verified { border-color: var(--green); background: #f0fff4; cursor: default; }
.captcha-check input[type=checkbox] { display: none; }
.captcha-box-icon {
  width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: #fff; transition: all .2s; position: relative;
}
.captcha-check.checked .captcha-box-icon,
.captcha-check.verified .captcha-box-icon {
  border-color: var(--green); background: var(--green);
}
.captcha-check.checked .captcha-box-icon::after,
.captcha-check.verified .captcha-box-icon::after {
  content: ""; display: block; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.captcha-check.loading .captcha-box-icon {
  border-color: var(--accent); background: #fff;
  animation: captcha-spin 0.8s linear infinite;
}
.captcha-check.loading .captcha-box-icon::after {
  content: ""; display: block; width: 18px; height: 18px; border: none;
  border-top: 2px solid var(--accent); border-right: 2px solid transparent;
  border-radius: 50%; position: absolute; transform: none; background: transparent;
}
@keyframes captcha-spin { to { transform: rotate(360deg); } }
.captcha-label-text { font-size: 14px; color: var(--text); }
.captcha-check.verified .captcha-label-text { color: var(--green); }
/* 卡密模块 */
.kami-box { animation: kamiSlideDown .25s ease-out; overflow: hidden; }
@keyframes kamiSlideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-6px); }
  to { opacity: 1; max-height: 200px; transform: translateY(0); }
}
.kami-info {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: #f0fff4; border: 1px solid #9ae6b4; border-radius: 8px;
}

/* 自填 API 模块 */
.custom-api-box {
  margin-top: 12px; padding: 10px;
  background: var(--panel2); border: 1px dashed var(--border); border-radius: 8px;
}
.custom-api-title {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.custom-api-tag {
  font-size: 10.5px; font-weight: 500; color: var(--green);
  background: #f0fff4; border: 1px solid #9ae6b4; border-radius: 999px; padding: 1px 8px;
}
.custom-api-hint { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.custom-api-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--muted); margin: 8px 0 4px;
}
.custom-api-link {
  font-size: 11px; color: var(--accent, #3182ce); text-decoration: none; white-space: nowrap;
}
.custom-api-link:hover { text-decoration: underline; }
.custom-api-tip { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* 解析页统计 */
.parse-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.parse-stats b { font-weight: 600; font-size: 13px; margin: 0 2px; }
.parse-stats .stat-sep { color: var(--border); }
.stat-success b { color: var(--green); }
.stat-fail b { color: var(--red); }
.stat-pending b { color: var(--yellow); }
.stat-total b { color: var(--accent); }

/* 扣费规则醒目提示条 */
.fee-notice {
  margin: 10px 20px 0;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1.5px solid #fb923c;
  box-shadow: 0 2px 10px rgba(251, 146, 60, 0.15);
  flex-shrink: 0;
}
.fee-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.fee-toggle:hover { background: rgba(251, 146, 60, 0.08); }
.fee-badge {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
  animation: feePulse 2s ease-in-out infinite;
}
@keyframes feePulse {
  0%, 100% { box-shadow: 0 2px 4px rgba(249,115,22,0.3); }
  50% { box-shadow: 0 2px 10px rgba(249,115,22,0.6); }
}
.fee-summary {
  flex: 1;
  font-size: 13px;
  color: #9a3412;
  font-weight: 500;
}
.fee-arrow {
  font-size: 10px;
  color: #c2410c;
  transition: transform 0.25s ease;
}
.fee-notice.open .fee-arrow { transform: rotate(180deg); }
.fee-detail {
  padding: 0 14px 12px;
  border-top: 1px dashed #fb923c;
  background: rgba(255,255,255,0.5);
  animation: feeSlideDown 0.25s ease;
  max-height: 30vh;
  overflow-y: auto;
}
@keyframes feeSlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fee-rules { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.fee-rule { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.6; color: #7c2d12; }
.fee-rule b { color: #9a3412; }
.fee-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  margin-top: 1px;
}
.fee-icon.ok { background: #16a34a; color: #fff; }
.fee-icon.info { background: #0284c7; color: #fff; font-size: 13px; font-style: italic; }

/* 模型选择面板（折叠下拉样式） */
#modelPanelHeader {
  cursor: pointer;
  user-select: none;
}
#modelPanelHeader:hover .model-arrow {
  color: var(--accent);
}
.model-current-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.model-arrow {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s ease;
  display: inline-block;
}
.model-panel-body {
  animation: modelSlideDown 0.25s ease-out;
  overflow: hidden;
}
@keyframes modelSlideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-6px); }
  to { opacity: 1; max-height: 800px; transform: translateY(0); }
}
