/* ===== 故事接龙 · Story Relay —— 沿用 OP文学社 主站视觉语言 ===== */
:root {
  --bg: #F4F2EC;
  --bg-soft: #FCFBF7;
  --surface: #FFFFFF;
  --surface-2: #F7F5EF;
  --ink: #23292E;
  --ink-2: #4A5158;
  --ink-3: #8A9099;
  --line: #E3DFD4;
  --line-strong: #CFC9BA;
  --accent: #5B7A99;      /* 雪原冷蓝 */
  --accent-soft: #A9BFD3;
  --gold: #B08A4A;
  --danger: #C0392B;
  --shadow: 0 8px 40px rgba(91,122,153,0.10);
  --shadow-lg: 0 20px 60px rgba(35,41,46,0.14);
  --wire: #B9C6D2;
  --serif: "Noto Serif SC","Songti SC",STSong,"Source Han Serif SC",serif;
  --sans: "Inter","PingFang SC","Microsoft YaHei",sans-serif;
  --radius: 16px;
}
:root[data-theme="dark"] {
  --bg: #0E141B; --bg-soft: #131A22; --surface: #18212B; --surface-2: #1E2833;
  --ink: #E6EAF0; --ink-2: #B4BDC8; --ink-3: #6E7A88;
  --line: #26313D; --line-strong: #33404E;
  --accent: #7FA6CC; --accent-soft: #3C556E; --gold: #C9A45E; --danger: #E0574B;
  --wire: #3A4B5C;
  --shadow: 0 8px 40px rgba(0,0,0,0.35); --shadow-lg: 0 24px 70px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans); background: var(--bg); color: var(--ink);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
  transition: background .5s ease, color .5s ease; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--ink); }
button { font-family: var(--sans); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center;
  justify-content: space-between; padding: 16px 40px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand .crest { width: 30px; height: 30px; }
.brand .crest path, .brand .crest circle, .brand .crest line { stroke: var(--accent); }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: 3px; }
.brand .name em { font-style: normal; color: var(--accent); }
.brand .tag { font-size: 12px; letter-spacing: 2px; color: var(--ink-3); padding-left: 12px;
  margin-left: 4px; border-left: 1px solid var(--line-strong); align-self: center; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
  color: var(--ink-2); transition: all .25s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.icon-btn svg { width: 20px; height: 20px; }
.btn {
  font-family: var(--sans); font-size: 14px; letter-spacing: 1px; cursor: pointer;
  border-radius: 40px; padding: 11px 26px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); transition: all .25s ease; display: inline-flex;
  align-items: center; gap: 8px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0E141B; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.sm { padding: 7px 16px; font-size: 13px; }

/* ---------- 容器 / 视图 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 40px; }
.view { display: none; animation: fadeUp .5s ease; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px);} to { opacity:1; transform: none; } }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 36px; text-align: center; }
.hero .eyebrow { font-size: 13px; letter-spacing: 6px; color: var(--ink-3); text-transform: uppercase; margin-bottom: 16px; }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(36px, 6vw, 60px); letter-spacing: 5px; }
.hero .sub { color: var(--ink-2); font-size: 16px; letter-spacing: 1px; margin-top: 14px; }
.hero .divider { width: 60px; height: 2px; background: var(--accent); margin: 26px auto 0; }

/* ---------- 筛选条 ---------- */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  margin: 8px 0 30px; padding: 16px 22px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.filterbar .seg { display: flex; gap: 6px; }
.seg button {
  padding: 8px 16px; border: 1px solid var(--line-strong); background: var(--surface-2);
  border-radius: 20px; cursor: pointer; color: var(--ink-2); font-size: 13px; transition: all .2s ease;
}
.seg button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .seg button.active { color: #0E141B; }
.search-input {
  flex: 1; min-width: 180px; padding: 10px 16px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--ink);
  font-family: var(--sans); font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--accent); }

/* ---------- 接龙卡片网格 ---------- */
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; padding-bottom: 90px; }
.story-card {
  cursor: pointer; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s ease, border-color .35s ease;
  display: flex; flex-direction: column;
}
.story-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.story-card .sc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sc-crest { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(155deg,#DCE4EC,#AAB9C8);
  display: grid; place-items: center; flex: 0 0 auto; }
:root[data-theme="dark"] .sc-crest { background: linear-gradient(155deg,#26333F,#12191F); }
.sc-crest svg { width: 22px; height: 22px; }
.sc-crest svg path, .sc-crest svg circle, .sc-crest svg line { stroke: var(--accent); }
.story-card .sc-meta { min-width: 0; }
.story-card .sc-creator { font-size: 12px; color: var(--ink-3); }
.story-card h3 { font-family: var(--serif); font-size: 21px; letter-spacing: 2px; margin: 2px 0 8px; color: var(--ink); }
.story-card .sc-intro { font-size: 14px; color: var(--ink-2); line-height: 1.7; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story-card .sc-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tag { font-size: 11px; letter-spacing: 1px; color: var(--accent); border: 1px solid var(--accent-soft);
  border-radius: 20px; padding: 3px 11px; }
.status-badge { font-size: 11px; letter-spacing: 1px; border-radius: 20px; padding: 3px 11px; }
.status-badge.ongoing { color: var(--accent); background: rgba(91,122,153,.12); border: 1px solid rgba(91,122,153,.3); }
.status-badge.finished { color: var(--gold); background: rgba(176,138,74,.12); border: 1px solid rgba(176,138,74,.3); }
.sc-foot { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--ink-3);
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.sc-foot b { color: var(--ink-2); font-weight: 600; }
.add-card {
  cursor: pointer; border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 200px; transition: all .3s ease; color: var(--ink-3);
}
.add-card:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-4px); box-shadow: var(--shadow); color: var(--accent); }
.add-card .plus { font-size: 44px; line-height: 1; color: var(--accent-soft); }
.add-card:hover .plus { color: var(--accent); }
.add-card .t { margin-top: 10px; font-family: var(--serif); font-size: 16px; letter-spacing: 2px; }

/* ---------- 详情 / 阅读页 ---------- */
.detail-hero { display: grid; grid-template-columns: 320px 1fr; gap: 48px; padding: 48px 0 36px; align-items: start; }
.cover-art { aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
  background: linear-gradient(155deg,#DCE4EC 0%,#C4D0DC 45%,#AAB9C8 100%); position: relative; }
:root[data-theme="dark"] .cover-art { background: linear-gradient(155deg,#26333F,#12191F); }
.cover-art .cv-inner { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; text-align: center; }
.cover-art .cv-crest { width: 46px; height: 26px; margin-bottom: 18px; opacity: .8; }
.cover-art .cv-crest path,.cover-art .cv-crest circle,.cover-art .cv-crest line { stroke: var(--reader-ink, var(--ink)); }
.cover-art .cv-title { font-family: var(--serif); font-weight: 700; font-size: 30px; letter-spacing: 3px;
  color: var(--ink); line-height: 1.4; }
.cover-art .cv-line { position: absolute; inset: 14px; border: 1px solid var(--ink-3); border-radius: 4px; opacity: .25; }
.cover-art.has-img { background: var(--surface-2); }
.cover-art .cv-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sc-crest.has-img { overflow: hidden; background: var(--surface-2); }
.sc-crest.has-img img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 编辑接龙 ---------- */
.edit-page { padding: 24px 0 80px; }
.edit-grid { display: grid; grid-template-columns: 300px 1fr; gap: 34px; align-items: start; }
.edit-cover { position: relative; aspect-ratio: 3/4; border-radius: 14px; overflow: hidden;
  border: 1px dashed var(--line-strong); background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center; transition: border-color .2s ease, background .2s ease; }
.edit-cover:hover, .edit-cover.drag { border-color: var(--accent); background: var(--surface); }
.edit-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.edit-cover .ec-empty { text-align: center; color: var(--ink-3); font-size: 13px; line-height: 1.9; padding: 20px; }
.edit-cover .ec-empty svg { margin: 0 auto 8px; opacity: .55; }
.edit-cover .ec-ops { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px;
  justify-content: center; padding: 10px; background: linear-gradient(180deg, transparent, rgba(10,14,18,.62)); }
.edit-cover .ec-ops .btn { padding: 5px 12px; font-size: 12px; }
.edit-cover.has-img .ec-empty { display: none; }
.edit-cover:not(.has-img) .ec-ops { display: none; }
.edit-side .hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin-top: 6px; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: 1fr; gap: 22px; } .edit-cover { max-width: 240px; } }
.detail-meta .kicker { font-size: 13px; letter-spacing: 5px; color: var(--ink-3); text-transform: uppercase; }
.detail-meta h2 { font-family: var(--serif); font-weight: 700; font-size: 44px; letter-spacing: 4px; margin: 12px 0 8px; }
.detail-meta .by { color: var(--ink-2); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.detail-meta .desc { font-family: var(--serif); font-size: 17px; line-height: 1.95; color: var(--ink-2); margin: 18px 0; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.detail-stats { display: flex; gap: 22px; margin: 18px 0; flex-wrap: wrap; }
.detail-stats .stat { font-size: 13px; color: var(--ink-3); }
.detail-stats .stat b { color: var(--ink); font-size: 18px; font-family: var(--serif); display: block; }

/* 参与者 */
.section { margin: 16px 0 60px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.section-head span { font-family: var(--serif); font-size: 22px; letter-spacing: 3px; }
.section-head .rule { flex: 1; height: 1px; background: var(--line); }
.participants { display: flex; flex-wrap: wrap; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-family: var(--serif); font-weight: 700; font-size: 15px; flex: 0 0 auto;
  box-shadow: var(--shadow); }
.pchip { display: inline-flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; cursor: pointer;
  transition: all .2s ease; }
.pchip:hover { border-color: var(--accent); transform: translateY(-2px); }
.pchip .pname { font-size: 14px; color: var(--ink); }
.pchip .pcount { font-size: 11px; color: var(--ink-3); }
.pchip .badge-creator { font-size: 10px; color: var(--gold); border: 1px solid var(--gold); border-radius: 10px; padding: 1px 7px; }

/* ---------- 分支网络图（网状结构） ---------- */
.intro-box { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.intro-box .ib-label { font-size: 12px; letter-spacing: 2px; color: var(--gold); margin-bottom: 8px; }
.intro-box .ib-text { font-family: var(--serif); font-size: 16px; line-height: 1.9; color: var(--ink-2); }

.net-map {
  position: relative; overflow: auto; max-height: 74vh; padding: 10px 12px 20px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft);
  scrollbar-width: thin;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink-3) 16%, transparent) 1px, transparent 0);
  background-size: 24px 24px;
}
.net-map::-webkit-scrollbar { width: 8px; height: 8px; }
.net-map::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
.net-map::-webkit-scrollbar-thumb:hover { background: var(--accent-soft); }
.net-map::-webkit-scrollbar-track { background: transparent; }

.net-canvas { position: relative; }
.net-wires { position: absolute; left: 0; top: 0; pointer-events: none; }
.net-wires path { fill: none; stroke: var(--wire); stroke-width: 1.5; }
.net-wires path.hot { stroke: var(--accent); stroke-width: 2.1; }

.net-dot {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  transform: translate(-50%, -50%); display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 12px; color: #fff;
  cursor: pointer; z-index: 3; box-shadow: 0 2px 8px rgba(0,0,0,.16);
  border: 2px solid var(--bg-soft);
  transition: transform .16s ease, box-shadow .16s ease;
}
.net-dot:hover { transform: translate(-50%, -50%) scale(1.16); z-index: 6; }
.net-dot.pinned { z-index: 7; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 42%, transparent), 0 6px 16px rgba(0,0,0,.2); }
.net-dot.is-root { width: 40px; height: 40px; font-size: 15px; border-width: 3px;
  border-color: color-mix(in srgb, var(--gold) 55%, var(--bg-soft)); }
.net-dot.is-more {
  width: 24px; height: 24px; font-family: var(--sans); font-size: 10px; font-weight: 600;
  background: var(--surface); color: var(--ink-3); border: 1px dashed var(--line-strong);
  box-shadow: none;
}
.net-dot.is-more:hover { color: var(--accent); border-color: var(--accent); }

.net-pop {
  position: absolute; width: 324px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px 16px 13px;
  z-index: 30; animation: popIn .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.net-pop::before {
  content: ''; position: absolute; left: -6px; top: var(--arrow-y, 50%);
  width: 10px; height: 10px; background: var(--surface);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}
.net-pop.is-left::before { left: auto; right: -6px; transform: translateY(-50%) rotate(-135deg); }
.net-pop-head { display: flex; align-items: center; gap: 9px; }
.net-pop-head .np-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.net-pop-head .np-time { font-size: 11px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.net-pop-meta { font-size: 11px; letter-spacing: 1px; color: var(--gold); margin: 8px 0 6px; }
.net-pop-body {
  font-family: var(--serif); font-size: 14.5px; line-height: 1.82; color: var(--ink-2);
  max-height: 232px; overflow-y: auto; word-break: break-word; padding-right: 4px;
}
.net-pop-body p { margin-bottom: .55em; }
.net-pop-body h2, .net-pop-body h3 { font-size: 16px; margin: .4em 0; color: var(--ink); }
.net-pop-body::-webkit-scrollbar { width: 6px; }
.net-pop-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
.net-pop-foot { display: flex; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.mini { font-size: 12px; padding: 4px 12px; border-radius: 18px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2);
  transition: all .2s ease; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.liked { border-color: var(--danger); color: var(--danger); }
.mini svg, .btn svg { flex: 0 0 auto; }

.branch-empty { color: var(--ink-3); font-size: 14px; padding: 26px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- 写作页（编辑器上移 · 紧凑布局） ---------- */
.write-page { padding: 18px 0 70px; }
.write-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.write-head h2 { font-family: var(--serif); font-size: 23px; letter-spacing: 2px; margin: 0; line-height: 1.3; }
.write-head .ws-sub { color: var(--ink-3); font-size: 13px; letter-spacing: 1px; }

.branch-pick { background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.bp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px;
  letter-spacing: 1px; color: var(--ink-3); }
.bp-head .bp-now { color: var(--accent); }
.bp-row { display: flex; flex-wrap: wrap; gap: 8px; max-height: 124px; overflow-y: auto; }
.bp-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--bg-soft); cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; font-size: 13px;
  max-width: 300px; }
.bp-chip:hover { border-color: var(--accent-soft); }
.bp-chip.active { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.bp-chip .pname { color: var(--ink); white-space: nowrap; }
.bp-chip .bp-prev { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 150px; }
.bp-chip .bp-depth { font-size: 10px; color: var(--ink-3); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 0 5px; }
.write-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* ---------- 富文本编辑器 ---------- */
.editor-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: relative; z-index: 5; }
.rte-toolbar button { width: 36px; height: 34px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; font-size: 14px; transition: all .15s ease;
  display: grid; place-items: center; }
.rte-toolbar button:hover { background: var(--surface); border-color: var(--line-strong); color: var(--accent); }
.rte-toolbar button.wide { width: auto; min-width: 56px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
.rte-toolbar button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rte-toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 6px; }
.rte-toolbar .tc { width: 30px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; }
.rte-content { min-height: 240px; max-height: 58vh; overflow-y: auto; padding: 20px 22px; outline: none; }
.rte-content:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.rte-content p { font-family: var(--serif); font-size: 17px; line-height: 1.95; color: var(--ink); margin-bottom: 1em; text-align: justify; }
.rte-content h2 { font-family: var(--serif); font-size: 24px; margin: .6em 0 .4em; }
.rte-content h3 { font-family: var(--serif); font-size: 20px; margin: .6em 0 .4em; }
.rte-content blockquote { border-left: 3px solid var(--accent-soft); padding-left: 14px; color: var(--ink-2);
  font-style: italic; margin: 1em 0; }
.rte-content a { color: var(--accent); text-decoration: underline; }
.rte-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: 1px; }
.input, textarea.input, select.input {
  width: 100%; font-family: var(--sans); font-size: 15px; padding: 12px 14px; color: var(--ink);
  background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: 10px; outline: none;
  transition: border-color .2s ease; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.7; }
.modal-err { min-height: 18px; margin-top: 8px; font-size: 12px; color: var(--danger); text-align: center; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 200; background: rgba(20,26,32,.45);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.modal { width: min(460px, 92vw); background: var(--surface); border-radius: var(--radius);
  padding: 30px 28px 24px; box-shadow: var(--shadow-lg); animation: fadeUp .35s ease; }
.modal.wide { width: min(720px, 94vw); }
.modal-title { font-family: var(--serif); font-size: 22px; letter-spacing: 2px; }
.modal-sub { font-size: 13px; color: var(--ink-3); margin: 8px 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.seg.auth-seg { display: flex; gap: 8px; margin-bottom: 16px; }

/* ---------- 评论区 ---------- */
.comment-section { margin: 30px auto 0; max-width: 860px; }
.cmt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cmt-head > span { font-family: var(--serif); font-size: 20px; letter-spacing: 2px; }
.cmt-head .rule { flex: 1; height: 1px; background: var(--line); }
.cmt-list { display: flex; flex-direction: column; gap: 12px; }
.cmt-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); }
.cmt-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cmt-user { font-size: 13px; font-weight: 600; color: var(--ink); }
.cmt-ts { font-size: 11px; color: var(--ink-3); }
.cmt-text { font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.cmt-form { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }

/* ---------- 私信 ---------- */
.dm-layout { display: grid; grid-template-columns: 300px 1fr; gap: 24px; min-height: 60vh; padding-bottom: 60px; }
.dm-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; }
.dm-list-head { padding: 16px 18px; border-bottom: 1px solid var(--line); font-family: var(--serif);
  font-size: 17px; letter-spacing: 2px; }
.dm-peer { display: flex; align-items: center; gap: 11px; padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background .15s ease; }
.dm-peer:hover { background: var(--surface-2); }
.dm-peer.active { background: var(--surface-2); }
.dm-peer .dp-name { font-size: 14px; color: var(--ink); flex: 1; }
.dm-peer .dp-last { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.dm-peer .dp-unread { background: var(--accent); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; }
.dm-thread { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; }
.dm-thread-head { padding: 16px 18px; border-bottom: 1px solid var(--line); font-family: var(--serif);
  font-size: 16px; letter-spacing: 2px; display: flex; align-items: center; gap: 10px; }
.dm-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-height: 300px; }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.65; word-break: break-word; }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 4px; }
.dm-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.dm-empty { display: grid; place-items: center; color: var(--ink-3); font-size: 14px; height: 100%; text-align: center; }

/* ---------- 个人主页 ---------- */
.profile-head { display: flex; align-items: center; gap: 22px; padding: 36px 0; }
.profile-head .avatar { width: 76px; height: 76px; font-size: 30px; }
.profile-head h2 { font-family: var(--serif); font-size: 30px; letter-spacing: 2px; }
.profile-head .pbio { color: var(--ink-2); font-size: 14px; margin-top: 4px; }

/* ---------- 阅读（拼接）视图 ---------- */
.reader-shell { max-width: 720px; margin: 0 auto; padding: 40px 24px 120px; }
.reader-chapter { margin-bottom: 36px; }
.reader-chapter .rc-by { font-size: 12px; letter-spacing: 2px; color: var(--gold); margin-bottom: 8px; }
.reader-chapter .rc-text { font-family: var(--serif); font-size: 19px; line-height: 2.05; color: var(--ink); text-align: justify; }
.reader-chapter .rc-text p { margin-bottom: 1.3em; }
.reader-ornament { display: flex; justify-content: center; margin: 30px 0; }
.reader-ornament svg { width: 90px; height: 20px; }
.reader-ornament path, .reader-ornament circle { stroke: var(--accent-soft); }

.footer { text-align: center; padding: 40px; color: var(--ink-3); font-size: 12px; letter-spacing: 2px; border-top: 1px solid var(--line); margin-top: 40px; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg-soft); padding: 12px 24px; border-radius: 30px; font-size: 14px;
  z-index: 300; opacity: 0; transition: all .3s ease; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .detail-hero { grid-template-columns: 1fr; gap: 24px; }
  .cover-art { max-width: 240px; }
  .dm-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; }
  .wrap { padding: 0 16px; }
  .brand .tag { display: none; }
  .brand .name { font-size: 16px; }
  .hero { padding: 40px 0 24px; }
  .detail-meta h2 { font-size: 30px; }
  .shelf-grid { grid-template-columns: 1fr; gap: 18px; }
}

/* ===== 站点菜单（与主站一致的站点导航） ===== */
.site-nav { position: relative; display: flex; align-items: center; }
.site-nav-btn { flex: 0 0 auto; }
.site-nav-menu {
  position: absolute; top: calc(100% + 12px); left: 0;
  min-width: 172px; padding: 8px;
  display: none; flex-direction: column; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
}
.site-nav.open .site-nav-menu { display: flex; animation: siteNavIn .18s ease; }
@keyframes siteNavIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.site-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-family: var(--sans); font-size: 14px; letter-spacing: 1px;
  color: var(--ink-2); cursor: pointer; transition: all .2s ease;
}
.site-nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.site-nav-item:hover { background: var(--surface-2); color: var(--accent); }
.site-nav-item:active { transform: scale(.98); }
.site-nav-item.is-active { color: var(--accent); background: var(--surface-2); font-weight: 600; }

/* ===== 登录弹窗增强（主站账号同步 + 交互修复） ===== */
.modal { position: relative; }
.modal-close {
  position: absolute; top: 12px; right: 14px; width: 32px; height: 32px;
  border: none; background: none; color: var(--ink-3); font-size: 22px; line-height: 1;
  cursor: pointer; border-radius: 8px; transition: all .2s ease;
}
.modal-close:hover { color: var(--ink); background: var(--surface-2); }
.pwd-field { position: relative; }
.pwd-field .input { padding-right: 60px; }
.pwd-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  padding: 5px 10px; border: none; background: none; color: var(--ink-3);
  font-family: var(--sans); font-size: 12px; cursor: pointer; border-radius: 8px;
  transition: all .2s ease;
}
.pwd-eye:hover { color: var(--accent); background: var(--surface-2); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--ink-3); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-main-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
}
.auth-main-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-main-btn.loading { opacity: .6; }
.auth-goto { display: block; margin-top: 10px; text-align: center; font-size: 13px; color: var(--accent); text-decoration: none; }
.auth-goto:hover { text-decoration: underline; }
.auth-main-tip { margin-top: 8px; font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.6; }

/* ===== 顶栏布局修正：品牌「故事接龙」左移，紧跟 ☰ 菜单按钮（原 space-between 三段导致品牌居中） ===== */
.topbar { justify-content: flex-start; gap: 14px; }
.top-actions { margin-left: auto; }

/* ===== 分支编辑页（独立页面） ===== */
.ne-meta { font-size: 13px; color: var(--ink-3); letter-spacing: .5px; }
.ne-meta .ne-edited { color: var(--accent); font-weight: 600; }
.ne-tip { margin-top: 14px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.btn.danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.btn.danger:hover { filter: brightness(1.08); }
.btn.danger:disabled { opacity: .55; cursor: not-allowed; }
