/* 牛马文件柜 · 全站样式 */
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
  background:#f0f2f5; color:#1f2329; font-size:15px;
}
a { color:inherit; }

/* 顶栏 */
.topbar {
  background:#185fa5; color:#fff;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; position:sticky; top:0; z-index:10;
}
.topbar .brand { font-size:16px; font-weight:600; white-space:nowrap; }
.topbar-left { display:flex; align-items:center; gap:10px; min-width:0; }
.topbar .hall-link {
  font-size:13px; text-decoration:none; white-space:nowrap;
  background:rgba(255,255,255,.2); border-radius:14px; padding:4px 10px;
}
.topbar .hall-link:hover { background:rgba(255,255,255,.34); }
.topbar .chip {
  font-size:12px; background:rgba(255,255,255,.18);
  border-radius:14px; padding:3px 10px; white-space:nowrap;
}
.topbar a.plain { text-decoration:none; font-size:13px; white-space:nowrap; }
.topbar-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.topbar .me-link { font-size:13px; max-width:104px; overflow:hidden; text-overflow:ellipsis; }
.topbar .admin-link { font-size:12px; opacity:.92; }
@media (max-width: 420px) {
  .topbar { padding:10px 10px; }
  .topbar-left { gap:7px; }
  .topbar .brand { font-size:14px; }
  .topbar .hall-link { font-size:12px; padding:4px 8px; }
  .topbar-right { gap:6px; }
  .topbar .me-link { max-width:80px; }
}
.container { max-width:640px; margin:0 auto; padding:14px 14px 128px; }

/* 标题输入 */
#titleInput {
  width:100%; border:none; outline:none; background:transparent;
  font-size:17px; font-weight:600; padding:6px 2px;
  border-bottom:1px solid #e5e6eb; margin-bottom:10px;
}

/* 原文输入框 */
#editor {
  background:#fff; border:1px solid #e5e6eb; border-radius:12px;
  min-height:46vh; padding:24px; outline:none;
  font-size:16px; line-height:1.8; color:#333; overflow-wrap:break-word;
  overflow-x:auto;
}
#editor:empty::before { content:attr(data-ph); color:#a9aeb8; font-size:15px; }
#editor p { margin:0 0 16px; text-align:justify; }
#editor h1 { font-size:24px; font-weight:600; line-height:1.4; color:#222; margin:24px 0 16px; }
#editor h2 { font-size:20px; font-weight:600; line-height:1.4; color:#222; margin:24px 0 12px; }
#editor h3, #editor h4 { font-size:18px; font-weight:600; line-height:1.5; color:#222; margin:20px 0 12px; }
#editor strong, #editor b { color:#111; }
#editor img { max-width:100%; height:auto; max-height:340px; display:block; margin:24px auto; border-radius:8px; }
#editor table {
  border-collapse:collapse; width:max-content; min-width:100%; margin:24px 0; font-size:14px;
  table-layout:auto !important; word-break:normal !important; overflow-wrap:break-word !important;
}
#editor td, #editor th {
  border:1px solid #e0e0e0; padding:8px 10px; line-height:1.5; text-align:left;
  word-break:normal; overflow-wrap:break-word;
}
#editor th { background:#f7f8fa; font-weight:600; color:#111; }
#editor ul, #editor ol {
  list-style:none; padding-left:0; margin:0 0 16px;
  font-size:16px; line-height:1.8;
}
#editor li { position:relative; padding-left:28px; margin-bottom:8px; }
#editor ol { counter-reset:ednum; }
#editor ol > li { counter-increment:ednum; }
#editor ol > li::before {
  content:counter(ednum) "."; position:absolute; left:0; top:0;
  font-weight:600; color:#1a73e8;
}
#editor ul > li::before {
  content:""; position:absolute; left:3px; top:11px;
  width:6px; height:6px; border-radius:50%; background:#1a73e8;
}
#editor blockquote {
  border-left:4px solid #4a90e2; background:#f8f9fa;
  padding:12px 16px; margin:16px 0; color:#666; font-size:15px;
}
.table-wrap {
  overflow-x:auto; margin:28px 0;
  -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain;
  border:1px solid #e6ebf1; border-radius:12px;
  box-shadow:0 2px 12px rgba(16,42,67,.045);
}
.table-wrap table { margin:0; }
/* 只有真正需要横滑时才标 can-scroll（表格用 max-content 铺开，放不进栏才滑） */
.table-wrap.can-scroll { border-color:#eceef2; }
/* 极端超宽（长图 > 1800px）的兜底：退回等分列，避免生成几万像素的图 */
table.tbl-cap {
  table-layout:fixed !important; width:100%; max-width:100%;
  word-break:break-word !important; overflow-wrap:break-word !important;
}
@media (max-width:600px) {
  #editor { padding:16px; }
}

/* 原文 / 成品：手机上下，电脑左右 */
.split { display:flex; flex-direction:column; gap:14px; }
.pane { min-width:0; }
.pane-out[hidden] { display:none; }
/* 成品纸张随宽表撑宽后，整张纸横向滚动查看，不挤压表格 */
#outPane { overflow-x:auto; }
.pane-hd { font-size:12px; color:#8a919c; margin:0 0 8px 2px; }
@media (min-width:900px) {
  .editor-page { max-width:1180px; }
  .editor-page > #viewEditor > *:not(.split) { max-width:780px; margin-left:auto; margin-right:auto; }
  .split { flex-direction:row; align-items:flex-start; gap:16px; }
  .split .pane { flex:1 1 0; }
  #editor, .preview { min-height:62vh; }
}

/* 未登录拦截 */
.gate {
  background:#fff; border:1px solid #e5e6eb; border-radius:12px;
  padding:40px 20px; text-align:center; margin-top:20px;
}
.gate-t { font-size:15px; color:#5f6672; margin-bottom:18px; }

/* 快捷键标注 */
.kbd-line { text-align:right; font-size:11px; color:#a9aeb8; margin:6px 2px 0; }
.privacy-line { text-align:right; font-size:11.5px; color:#a06a2c; margin:2px 2px 0; }

/* 润色三维选择 */
.pl-card { max-height:82vh; overflow-y:auto; text-align:left; }
.pl-label { font-size:12px; color:#8a919c; margin:12px 0 6px; }
.pl-label:first-of-type { margin-top:10px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip2 {
  border:1px solid #dcdfe4; background:#fff; border-radius:14px;
  padding:5px 12px; font-size:13px; color:#1f2329;
}
.chip2.on { background:#185fa5; border-color:#185fa5; color:#fff; }

/* 润色对比：左＝排版，右＝润色后 */
.df-card { max-width:680px; max-height:82vh; overflow-y:auto; text-align:left; }
.df-cols { display:flex; gap:10px; align-items:stretch; margin:6px 0 12px; }
.df-pane { flex:1; min-width:0; display:flex; flex-direction:column; }
.df-hd { font-size:12px; font-weight:600; color:#8a919c; margin:0 0 6px; }
.df-txt {
  flex:1; overflow-y:auto; max-height:46vh;
  background:#faf9f5; border:1px solid #eee7d9; border-radius:10px;
  padding:10px 12px; font-size:14px; line-height:1.9;
}
.df-txt .df-seg { margin:0 0 10px; overflow-wrap:break-word; }
.df-txt del { color:#a32d2d; background:#fdeaea; text-decoration:line-through; }
.df-txt ins { color:#1d6b2f; background:#e0f2e5; text-decoration:none; }
@media (max-width:560px) { .df-cols { flex-direction:column; } .df-txt { max-height:30vh; } }

/* 工具条 */
#tools { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
#tools button {
  border:1px solid #dcdfe4; background:#fff; border-radius:16px;
  padding:6px 13px; font-size:13px; color:#1f2329;
}
#tools button:active { background:#f0f2f5; }
#tools button.amber {
  background:#faeeda; border-color:#fac775; color:#854f0b;
}
#tools button[disabled] { opacity:.45; }

/* 主按钮 */
.btn-main {
  width:100%; border:none; border-radius:12px; background:#185fa5;
  color:#fff; font-size:15px; padding:13px 0; font-weight:600;
}
.btn-main:active { background:#124a83; }
.save-row { display:flex; gap:10px; }
.save-row .btn-main { flex:1; }
.quota-line { text-align:center; font-size:12px; color:#8a919c; margin-top:10px; }

/* 文件柜列表 */
.docrow {
  display:flex; justify-content:space-between; align-items:center;
  background:#fff; border:1px solid #e5e6eb; border-radius:12px;
  padding:13px 14px; margin-bottom:10px;
}
.docrow .t { font-size:15px; font-weight:600; }
.docrow .s { font-size:12px; color:#8a919c; margin-top:3px; }
.docrow .s .warn { color:#a32d2d; }
.docrow .acts { display:flex; gap:6px; flex-shrink:0; margin-left:8px; }
.docrow .acts button {
  border:1px solid #b5d4f4; color:#185fa5; background:#fff;
  border-radius:13px; font-size:12px; padding:4px 10px;
}
.docrow .acts button.del { border-color:#f09595; color:#a32d2d; }
.btn-new {
  width:100%; border:1px dashed #c2c7d0; background:none; border-radius:12px;
  padding:13px 0; font-size:14px; color:#5f6672; margin-top:4px;
}

/* 二维码弹层 */
.mask {
  position:fixed; inset:0; background:rgba(0,0,0,.45);
  display:flex; align-items:center; justify-content:center; z-index:50; padding:20px;
}
.mask[hidden] { display:none; }
.qr-card {
  background:#fff; border-radius:16px; width:100%; max-width:320px;
  padding:20px 18px; text-align:center;
}
.qr-card h3 { font-size:16px; margin-bottom:4px; }
.qr-card .sub { font-size:12px; color:#8a919c; margin-bottom:14px; }
#qrBox { display:flex; justify-content:center; }
#qrBox img, #qrBox canvas { width:200px; height:200px; }
.qr-card .link {
  font-size:12px; color:#5f6672; word-break:break-all; margin:12px 0;
}
.qr-card .row { display:flex; gap:8px; }
.qr-card .row button {
  flex:1; border-radius:10px; padding:9px 0; font-size:13px;
  border:1px solid #dcdfe4; background:#fff;
}
.qr-card .row button.solid {
  background:#185fa5; border-color:#185fa5; color:#fff;
}
.qr-card .close {
  margin-top:12px; font-size:13px; color:#8a919c; background:none; border:none;
}

/* 长图弹层 */
.img-card { max-width:560px; max-height:88vh; overflow-y:auto; }
.img-hold { margin:6px 0 14px; }
.img-hold img { width:100%; display:block; border-radius:6px; box-shadow:0 1px 6px rgba(0,0,0,.08); }

/* 长图本体：默认 720 宽的一页纸，有宽表格时按表格撑开，落款在右下角 */
.paper-shot { width:720px; background:#fdfdfc; }
.paper-shot .table-wrap { overflow:visible; }
.paper-shot .preview {
  width:100%; max-width:none; margin:0; min-height:0;
  box-shadow:none; border-radius:0; padding:52px 56px 40px;
}
.paper-shot #previewBody { min-height:0; }
.shot-foot {
  display:flex; align-items:center; justify-content:flex-end; gap:12px;
  padding:16px 40px 30px;
}
.shot-foot span { font-size:12px; color:#8a8a86; letter-spacing:.02em; }
.shot-qr { width:66px; height:66px; display:block; background:#fff; }

/* 注册弹层 */
.join-card.pop {
  width:100%; max-width:340px; max-height:88vh; overflow-y:auto;
  text-align:left; position:relative;
}
.join-card.pop .join-title { text-align:center; margin-bottom:4px; }
.join-card.pop .close {
  position:absolute; top:10px; right:12px; background:none; border:none;
  font-size:12.5px; color:#a9aeb8;
}

/* 文档落款：右下角的引流入口 */
.gen-sign {
  text-align:right; margin:34px 0 0; font-size:12px; letter-spacing:.02em;
}
.gen-sign a { color:#a8a29a; text-decoration:none; }
.gen-sign a:active { color:#a08a3c; }
/* 工具名：换色加粗，让人一眼认出这是站点名而不是正文 */
.sign-brand {
  color:#185fa5; font-weight:700; font-size:13px;
  letter-spacing:0; margin:0 3px; vertical-align:baseline;
}

/* 起名 / 覆盖弹层 */
.name-input {
  width:100%; border:1px solid #dcdfe4; border-radius:10px;
  padding:10px 12px; font-size:15px; outline:none; margin:14px 0 4px;
}
.name-input:focus { border-color:#185fa5; }
.ov-card { max-width:360px; text-align:left; }
.ov-card h3, .ov-card .sub { text-align:center; }
.ov-list { max-height:52vh; overflow-y:auto; margin:8px 0 4px; }
.ov-row {
  display:block; width:100%; text-align:left; background:#f7f8fa;
  border:1px solid #e5e6eb; border-radius:10px; padding:9px 11px; margin-bottom:8px;
}
.ov-row:active { background:#eaf2fb; border-color:#b5d4f4; }
.ov-row b {
  display:block; font-size:14px; font-weight:600;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.ov-row span { display:block; font-size:11.5px; color:#8a919c; margin-top:3px; }

/* 阅读页：灰底里的一张纸（暖白纸面 + 极柔和阴影，像一本画册） */
body.read-page { background:#f2f3f5; }
.read-container { max-width:744px; padding:20px 16px 128px; overflow-x:auto; }
.preview, .doc-card {
  background:#fdfdfc; border-radius:4px;
  box-shadow:0 4px 20px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.04);
  padding:48px; color:#2c2c2c; max-width:680px; margin:0 auto;
  font-family:"Source Han Serif SC","Noto Serif SC","Songti SC",STSong,SimSun,serif;
}
.preview { min-height:46vh; }
.preview-title, .doc-card .doc-title {
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size:26px; font-weight:700; line-height:1.4; color:#111;
  margin:0 0 6px; word-break:break-all;
}
.preview-title {
  padding-bottom:20px; border-bottom:2px solid #f0f0f0; margin-bottom:32px;
}
.preview-title[hidden], .doc-card .doc-title[hidden] { display:none; }
.doc-card .doc-sub {
  font-size:12px; color:#8a919c; margin:0 0 32px;
  padding-bottom:20px; border-bottom:2px solid #f0f0f0;
}
#previewBody { line-height:1.8; min-height:20vh; overflow-wrap:anywhere; }
#docBody { line-height:1.8; min-height:40vh; }
#previewBody p, #docBody p {
  font-size:16px; line-height:1.8; color:#2c2c2c; margin:0 0 14px; text-align:justify;
}
/* 首行缩进两字符：中国纸媒的经典排版，缩进已区分段落，段距可以收紧 */
#previewBody > p, #docBody > p { text-indent:2em; }
#previewBody h1, #docBody h1 {
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size:24px; font-weight:700; line-height:1.4; color:#111; margin:24px 0 16px; word-break:break-all;
}
/* 小标题：黑体和衬线正文拉开对比，暗金色竖线呼应引用 */
#previewBody h2, #docBody h2 {
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size:18px; font-weight:700; line-height:1.5; color:#111;
  margin:32px 0 14px; padding-left:12px; border-left:4px solid #c5b358;
  word-break:break-all;
}
#previewBody h3, #previewBody h4, #docBody h3, #docBody h4 {
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  font-size:17px; font-weight:700; line-height:1.5; color:#111; margin:24px 0 12px;
}
#previewBody strong, #previewBody b, #docBody strong, #docBody b { color:#111; }
/* 行内代码：聊天/文档里复制来的路径、命令 */
#previewBody code, #docBody code {
  background:#f4f1ea; color:#7a5c1e; border-radius:4px;
  padding:1px 5px; margin:0 1px;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.9em; word-break:break-all;
}
#previewBody img, #docBody img { max-width:100%; height:auto; display:block; margin:28px auto; border-radius:4px; }
/* 表格：无底色填充，表头一条粗黑线、数据行极细灰线，纸媒的无框线极简设计。
   列宽按内容分配；英文长词整词保留（break-word 不参与 min-content 计算），
   多列表格由 wrapTables 给 min-width + 外层横向滚动，绝不逐字母竖排 */
#previewBody table, #docBody table {
  border-collapse:separate; border-spacing:0; width:max-content; min-width:100%; margin:0; font-size:15px;
  table-layout:auto !important; word-break:normal !important; overflow-wrap:break-word !important;
}
#previewBody th, #docBody th {
  background:transparent; color:#111; font-weight:700; text-align:left;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  padding:9px 8px; line-height:1.5; border-bottom:2px solid #333;
  white-space:normal; word-break:normal; overflow-wrap:break-word;
}
#previewBody td, #docBody td {
  padding:9px 8px; line-height:1.6; color:#444; border-bottom:1px solid #eee;
  white-space:normal; word-break:normal; overflow-wrap:break-word;
}
#previewBody tr:last-child td, #docBody tr:last-child td { border-bottom:none; }
/* AI 联网搜索的引用标记：绝不显示（前端已清理，这里兜底防漏网） */
#editor [data-citation-group], #previewBody [data-citation-group],
#docBody [data-citation-group], #preview [data-citation-group] { display:none !important; }
/* 列表：整组装进暖纸色圆角卡，圆点/编号用暗金，不抢正文 */
#previewBody ul, #previewBody ol, #docBody ul, #docBody ol {
  list-style:none; margin:0 0 24px;
  padding:18px 20px 18px 46px;
  background:#faf9f5; border:1px solid #efe9dc; border-radius:6px;
}
#previewBody li, #docBody li {
  position:relative; padding-left:0; margin-bottom:12px;
  font-size:15.5px; line-height:1.8; color:#2c2c2c;
}
#previewBody li:last-child, #docBody li:last-child { margin-bottom:0; }
#previewBody ol, #docBody ol { counter-reset:docnum; }
#previewBody ol > li, #docBody ol > li { counter-increment:docnum; }
#previewBody ol > li::before, #docBody ol > li::before {
  content:counter(docnum) "."; position:absolute; left:-28px; top:0;
  font-weight:700; color:#a08a3c;
}
#previewBody ul > li::before, #docBody ul > li::before {
  content:""; position:absolute; left:-24px; top:11px;
  width:6px; height:6px; border-radius:50%; background:#a08a3c;
}
/* 没编号的收尾句：留在卡片里但不抢圆点 */
#previewBody .li-plain, #docBody .li-plain { color:#6b7280; font-size:14.5px; }
#previewBody .li-plain::before, #docBody .li-plain::before { content:none; }
#previewBody blockquote, #docBody blockquote {
  border-left:4px solid #c5b358; background:#f9f9f9;
  padding:14px 18px; margin:24px 0; color:#666; font-size:15px; line-height:1.8;
  font-style:italic;
}
@media (max-width:600px) {
  .read-container { padding:12px 12px 128px; }
  .doc-card, .preview { padding:24px; }
  /* 手机同样走「先压缩、再横滑」，不能用等宽列 + 任意断词把字挤成竖排 */
  .table-wrap { margin:20px 0; }
  #previewBody ul, #previewBody ol, #docBody ul, #docBody ol { padding:16px 14px 16px 36px; }
  #previewBody ol > li::before, #docBody ol > li::before { left:-24px; }
  #previewBody ul > li::before, #docBody ul > li::before { left:-21px; }
}

/* 底部悬浮操作 */
.bottombar {
  position:fixed; left:0; right:0; bottom:0; background:#fff;
  border-top:1px solid #e5e6eb; padding:10px 14px calc(12px + env(safe-area-inset-bottom));
  z-index:10;
}
.btn-row { display:flex; gap:10px; max-width:640px; margin:0 auto; }
.btn-row[hidden], .guest-cta[hidden], .btn-row button[hidden] { display:none; }
.btn-row button {
  flex:1; border-radius:12px; padding:12px 0; font-size:14px; font-weight:600;
  border:1px solid #dcdfe4; background:#fff; color:#1f2329;
}
.btn-row button.solid { background:#185fa5; border-color:#185fa5; color:#fff; }
.btn-row button:disabled { opacity:.62; }
.guest-cta {
  display:block; text-align:center; margin-top:10px;
  font-size:12.5px; color:#8a919c; text-decoration:none;
}
.guest-cta:active { color:#185fa5; }

/* 提示浮层 */
#toast {
  position:fixed; left:50%; bottom:16%; transform:translateX(-50%);
  background:rgba(31,35,41,.88); color:#fff; font-size:13px;
  padding:9px 16px; border-radius:20px; z-index:99; max-width:80vw;
  text-align:center; display:none;
}

/* 文件柜注册页 */
.join-wrap { max-width:420px; margin:0 auto; padding:22px 14px 40px; }
.join-card {
  background:#fff; border:1px solid #e5e6eb; border-radius:16px;
  padding:26px 20px 24px; text-align:center;
}
.join-logo {
  width:56px; height:56px; border-radius:14px; background:#185fa5;
  display:flex; align-items:center; justify-content:center; margin:0 auto 14px;
}
.join-title { font-size:19px; font-weight:600; }
.join-lead { font-size:13px; color:#8a919c; margin-top:6px; line-height:1.7; }
.join-tabs { display:flex; gap:8px; margin:20px 0 16px; }
.join-tabs button {
  flex:1; padding:8px 0; font-size:13px; border-radius:10px;
  border:1px solid #dcdfe4; background:#fff; color:#5f6672;
}
.join-tabs button.on { background:#185fa5; border-color:#185fa5; color:#fff; font-weight:600; }
.join-field { display:block; text-align:left; margin-bottom:12px; }
.join-field[hidden] { display:none; }
.join-field span { display:block; font-size:12px; color:#5f6672; margin-bottom:5px; }
.join-field input {
  width:100%; border:1px solid #dcdfe4; border-radius:10px;
  padding:11px 12px; font-size:15px; outline:none; background:#fff;
}
.join-field input:focus { border-color:#185fa5; }
.join-submit {
  width:100%; margin-top:6px; padding:12px 0; border-radius:12px;
  border:1px solid #185fa5; background:#185fa5; color:#fff;
  font-size:15px; font-weight:600;
}
.join-submit:disabled { opacity:.62; }
.join-msg { min-height:20px; margin-top:10px; font-size:12.5px; color:#c0392b; }
.join-msg.ok { color:#18794e; }
.join-back { display:block; text-align:center; margin-top:18px; font-size:12.5px; color:#8a919c; text-decoration:none; }
.adm-more {
  margin-top:2px; font-size:12.5px; color:#8a919c;
  background:none; border:none; text-decoration:underline;
}
#admAdv { margin-top:14px; }
#admAdv[hidden] { display:none; }
.adm-actions { display:flex; gap:10px; }
.adm-actions .join-submit { flex:1; width:auto; }
.join-submit.ghost { background:#fff; color:#185fa5; }
.adm-test-out {
  margin-top:12px; padding:11px 12px; border-radius:10px;
  background:#f4f8fd; border:1px solid #dbe8f7;
  font-size:12.5px; line-height:1.75; color:#33465c; text-align:left;
  white-space:pre-line; word-break:break-all;
}
.adm-test-out[hidden] { display:none; }
.adm-test-out.bad { background:#fff5f4; border-color:#f3d5d0; color:#a6382b; }
