/* ==========================================================
   静庐 · 个人知识库  ——  安静 / 专注 / 有序 / 书卷气
   暖白 #FAFAF9 · 暖黑 #1C1917 · 蓝 #2563EB
   无渐变 · 无大阴影 · 克制圆角 · 单色图标
   ========================================================== */

:root {
  --bg: #FAFAF9;
  --bg-sidebar: #F5F4F1;
  --bg-hover: #EFEEEA;
  --bg-active: #E9E7E2;
  --ink: #1C1917;
  --ink-2: #57534E;
  --ink-3: #A8A29E;
  --line: #E7E5E4;
  --line-2: #D6D3D1;
  --accent: #2563EB;
  --accent-soft: #EFF4FE;
  --code-bg: #F3F2EF;
  --radius: 4px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 保证 hidden 属性不被 display 规则覆盖 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局骨架 ---------- */
#app {
  display: flex;
  height: 100vh;
}

/* ---------- 左侧边栏 260px ---------- */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}
#app.sidebar-collapsed #sidebar { margin-left: -260px; }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--ink);
}
.brand svg { color: var(--ink-2); }

#btn-collapse, #btn-expand {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--ink-2);
}
#btn-collapse:hover, #btn-expand:hover { background: var(--bg-hover); color: var(--ink); }

#btn-expand {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 30;
  border: 1px solid var(--line);
  background: var(--bg-sidebar);
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 10px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.btn-primary:hover { background: #1D55D1; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------- 文档树 ---------- */
#tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 20px;
}

.tree-node { user-select: none; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-2);
  white-space: nowrap;
}
.tree-row:hover { background: var(--bg-hover); }
.tree-row.active { background: var(--bg-active); color: var(--ink); }
.tree-row.drag-over { outline: 1px solid var(--accent); outline-offset: -1px; }
.tree-row.dragging { opacity: .4; }

.tree-caret {
  width: 16px; height: 16px;
  min-width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}
.tree-caret svg { transition: transform .15s ease; }
.tree-caret.open svg { transform: rotate(90deg); }
.tree-caret.leaf { visibility: hidden; }

.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
}
.tree-shared {
  color: var(--accent);
  font-size: 11px;
  display: inline-flex;
}
.tree-protect {
  color: #B45309;
  font-size: 11px;
  display: inline-flex;
  margin-left: 4px;
}
.tree-auth {
  color: #2563EB;
  font-size: 11px;
  display: inline-flex;
  margin-left: 4px;
}

.tree-children { padding-left: 16px; }
.tree-children.closed { display: none; }

.tree-empty {
  padding: 24px 12px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  line-height: 1.8;
}

.sidebar-foot {
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.sidebar-foot .foot-tip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sidebar-foot .foot-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.sidebar-foot #btn-logout,
.sidebar-foot #btn-chpwd,
.sidebar-foot #btn-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--ink-3);
  text-decoration: none;
  border-radius: 6px;
}
.sidebar-foot #btn-logout:hover,
.sidebar-foot #btn-chpwd:hover,
.sidebar-foot #btn-settings:hover { background: var(--bg-hover); color: var(--ink); }

/* ---------- 中间编辑区 ---------- */
#main {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#editor-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-3);
}
.empty-icon { color: var(--line-2); margin-bottom: 8px; }
#editor-empty p { font-size: 14px; }
.empty-tip { font-size: 12.5px !important; color: var(--ink-3); }

#editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#editor-scroll {
  flex: 1;
  overflow-y: auto;
}

#editor-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 56px 120px;
}

/* 标题输入 */
#doc-title {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 8px;
}
#doc-title::placeholder { color: var(--ink-3); }

/* 工具栏 */
#toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 4px;
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
#toolbar button {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
#toolbar button:hover { background: var(--bg-hover); color: var(--ink); }
#toolbar button.on { color: var(--accent); background: var(--accent-soft); }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; }

/* ---------- 富文本正文（衬线体） ---------- */
#editor, .doc-content {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--ink);
  outline: none;
  min-height: 300px;
  word-break: break-word;
}
#editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
}

#editor h1, .doc-content h1,
#editor h2, .doc-content h2,
#editor h3, .doc-content h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.5;
  margin: 1.9em 0 .9em;
  scroll-margin-top: 60px;
  letter-spacing: .3px;
}
#editor h1, .doc-content h1 { font-size: 28px; }
#editor h2, .doc-content h2 { font-size: 23px; }
#editor h3, .doc-content h3 { font-size: 19px; }
#editor > :first-child, .doc-content > :first-child { margin-top: 0; }

#editor p, .doc-content p { margin: .9em 0; }

#editor a, .doc-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
#editor a:hover, .doc-content a:hover { border-bottom-color: var(--accent); }

#editor blockquote, .doc-content blockquote {
  margin: 1.1em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--line-2);
  border-radius: 0 6px 6px 0;
  background: #F5F4F0;
  color: var(--ink-2);
}
#editor blockquote p, .doc-content blockquote p { margin: .4em 0; }

#editor code, .doc-content code {
  font-family: var(--mono);
  font-size: .85em;
  background: #F1EFEA;
  border-radius: 4px;
  padding: 2.5px 6px;
  color: #44403C;
}

#editor pre, .doc-content pre {
  position: relative;
  background: #F5F3EF;
  border-radius: 8px;
  padding: 18px 20px;
  margin: 1.2em 0;
  overflow-x: auto;
}
#editor pre code, .doc-content pre code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.8;
}

/* 语法高亮配色（柔和书卷风） */
.tk-c { color: #A8A29E; font-style: italic; }  /* 注释 */
.tk-s { color: #4E8A53; }                      /* 字符串 */
.tk-k { color: #8250DF; font-weight: 500; }    /* 关键字 */
.tk-b { color: #2563EB; }                      /* 内置/属性 */
.tk-n { color: #B45309; }                      /* 数字 */
.tk-v { color: #0E7490; }                      /* 变量 $x */
.tk-t { color: #2563EB; }                      /* HTML 标签 */
.tk-a { color: #B45309; }                      /* HTML 属性名 */

/* 标题折叠按钮（真实元素，大热区，点击折叠整节） */
#editor h1, #editor h2, #editor h3,
.doc-content h1, .doc-content h2, .doc-content h3 { position: relative; }
.h-fold-btn {
  position: absolute;
  left: -44px;
  top: 2px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #44403C;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.h-fold-btn svg {
  width: 22px;
  height: 22px;
  transition: transform .15s ease;
}
.h-fold-btn:hover { background: var(--bg-hover); }
.h-foldable:hover .h-fold-btn { opacity: 1; }
.h-foldable.h-collapsed .h-fold-btn { opacity: 1; }
.h-foldable.h-collapsed .h-fold-btn svg { transform: rotate(-90deg); }

/* 编辑器：折叠箭头用伪元素呈现（不修改文档 DOM，编辑时不会错位），对齐首行 */
#editor h1.h-foldable::before {
  content: '';
  position: absolute;
  left: -40px;
  top: 6px;
  width: 26px;
  height: 26px;
  background: center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2344403C' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  cursor: pointer;
}
#editor h1.h-foldable:hover::before { opacity: 1; }
#editor h1.h-collapsed::before { opacity: 1; transform: rotate(-90deg); }
.sec-hidden { display: none !important; }

/* 代码块悬停复制按钮（飞书同款） */
.pre-copy {
  position: absolute;
  top: 10px; right: 12px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}
.doc-content pre:hover .pre-copy { opacity: 1; }
.pre-copy:hover { color: var(--ink); border-color: var(--ink-3); }

#editor ul, .doc-content ul,
#editor ol, .doc-content ol { padding-left: 1.6em; margin: .8em 0; }
#editor li, .doc-content li { margin: .55em 0; line-height: 1.85; }
#editor li > p, .doc-content li > p { margin: .3em 0; }

/* 任务列表 */
#editor ul.task-list, .doc-content ul.task-list { list-style: none; padding-left: .4em; }
#editor li.task-item, .doc-content li.task-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
#editor li.task-item input[type="checkbox"],
.doc-content li.task-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  margin: 0;
  cursor: pointer;
  position: relative;
  top: 2px;
}
#editor li.task-item.done, .doc-content li.task-item.done { color: var(--ink-3); text-decoration: line-through; }

#editor img, .doc-content img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: .4em 0;
}

#editor hr, .doc-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.2em 0;
}

/* 表格（飞书风格：细边框 + 表头浅底） */
#editor table, .doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: .95em;
}
#editor th, .doc-content th,
#editor td, .doc-content td {
  border: 1px solid var(--line);
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
}
#editor th, .doc-content th {
  background: #F5F3EF;
  font-weight: 600;
}

/* 状态栏 */
#statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  background: var(--bg);
}
#save-status.saving { color: var(--accent); }
#save-status.dirty { color: #B45309; }

/* ---------- 右侧目录 224px ---------- */
#toc-panel {
  width: 224px;
  min-width: 224px;
  border-left: 1px solid var(--line);
  padding: 20px 0;
  overflow-y: auto;
  background: var(--bg);
}
.toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 10px 20px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ink-3);
}
#toc { display: flex; flex-direction: column; }
.toc-item {
  display: block;
  padding: 5px 20px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-item:hover { color: var(--ink); background: var(--bg-hover); }
.toc-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }
.toc-empty { padding: 4px 20px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- 拖拽导入遮罩 ---------- */
#drop-mask {
  position: absolute;
  inset: 8px;
  z-index: 50;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(250, 250, 249, .94);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-inner {
  font-size: 16px;
  color: var(--accent);
  font-family: var(--serif);
}

/* ---------- 右键菜单 ---------- */
#ctx-menu {
  position: fixed;
  z-index: 100;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 2px 6px rgba(28, 25, 23, .08);
}
#ctx-menu div {
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 3px;
  cursor: pointer;
}
#ctx-menu div:hover { background: var(--bg-hover); color: var(--ink); }
#ctx-menu div[data-act="delete"]:hover { color: #B91C1C; }

/* ---------- 分享对话框 ---------- */
#share-dialog, #pwd-dialog, #settings-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(28, 25, 23, .3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-box {
  width: 460px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.dialog-desc { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.share-link-row { display: flex; gap: 8px; margin-bottom: 18px; }
.share-link-row input {
  flex: 1;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-2);
  outline: none;
  font-family: var(--mono);
}
.share-link-row input:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 修改密码弹窗 */
.pwd-field {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 12px;
}
.pwd-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s ease;
}
.pwd-field input:focus { border-color: var(--accent); }
#pwd-dialog .dialog-actions { margin-top: 16px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  padding: 8px 18px;
  border-radius: var(--radius);
}

/* ---------- 分享页 ---------- */
.share-body { overflow: auto; }
#share-layout { display: flex; min-height: 100vh; }
#share-main { flex: 1; min-width: 0; overflow-y: visible; }
#share-layout #toc-panel { position: sticky; top: 0; height: 100vh; }

/* 分享页左侧子文档导航 */
#share-nav {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  padding: 14px 8px 30px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.snav-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--ink-2);
}

/* 面板收起/展开按钮 */
.panel-toggle {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.panel-toggle:hover { background: var(--bg-hover); color: var(--ink); }

.panel-reopen {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 80;
  width: 32px;
  height: 56px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(28, 25, 23, .08);
}
.panel-reopen:hover { color: var(--ink); background: var(--bg-hover); }
.panel-reopen.left { left: 8px; }
.panel-reopen.right { right: 8px; }

/* 收起状态（不持久化，刷新恢复展开） */
body.nav-collapsed #share-nav { display: none; }
body.nav-collapsed #nav-expand { display: inline-flex; }
body.toc-collapsed #toc-panel { display: none; }
body.toc-collapsed #toc-expand { display: inline-flex; }

/* 分享页子文档树（与编辑页 #tree 视觉一致） */
.stree { padding: 0 4px; }
.stree-node { user-select: none; }
.stree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.stree-row:hover { background: var(--bg-hover); }
.stree-row.active { background: var(--bg-active); color: var(--ink); }
.stree-caret {
  width: 16px; height: 16px;
  min-width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  cursor: pointer;
}
.stree-caret svg { transition: transform .15s ease; }
.stree-caret.open svg { transform: rotate(90deg); }
.stree-caret.leaf { visibility: hidden; cursor: default; }
.stree-ico {
  display: inline-flex;
  color: var(--ink-3);
  min-width: 14px;
}
.stree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
}
.stree-children { padding-left: 16px; }
.stree-node.closed > .stree-children { display: none; }

.share-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}
.share-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.share-404 {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-3);
}
.share-404 a { color: var(--accent); text-decoration: none; font-size: 13.5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  #toc-panel { display: none; }
  #toc-expand { display: none !important; }
}
@media (max-width: 760px) {
  #sidebar { position: fixed; z-index: 60; height: 100vh; }
  #editor-page { padding: 24px 20px 80px; }
  #share-nav { display: none; }
  #nav-expand { display: none !important; }
  /* 标题折叠按钮：移动端内边距只有 20px，按钮收窄到边距内；
     触屏无 hover，默认半透明常显，热区 32x40 方便手指点击 */
  .h-fold-btn {
    left: -26px;
    top: 0;
    width: 32px;
    height: 40px;
    opacity: .55;
  }
  .h-fold-btn svg { width: 18px; height: 18px; }
  .h-foldable.h-collapsed .h-fold-btn { opacity: 1; }
  /* 编辑器折叠箭头移动端：常显半透明 */
  #editor h1.h-foldable::before {
    left: -20px;
    width: 20px;
    height: 20px;
    background-size: 16px;
    opacity: .55;
  }
  #editor h1.h-collapsed::before { opacity: 1; }
}

/* ---------- 防盗保护 ---------- */
.protect-badge { color: #B45309; font-weight: 600; }

body.protected #share-main,
body.protected #share-title {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
body.protected img { pointer-events: none; } /* 禁止图片另存/拖拽 */

/* 水印层 */
#wm-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-repeat: repeat;
}

/* 防盗提示 toast */
#protect-tip {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #FAFAF9;
  font-size: 13.5px;
  padding: 10px 20px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10000;
  white-space: nowrap;
}
#protect-tip.show { opacity: .96; transform: translateX(-50%) translateY(0); }

/* ---------- 登录页 ---------- */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 36px 36px;
  box-shadow: 0 12px 40px rgba(28, 25, 23, .08);
  text-align: center;
}
.login-logo {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.login-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}
.login-sub { font-size: 13px; color: var(--ink-3); margin: 0 0 22px; }
.login-tip {
  font-size: 12px;
  color: var(--ink-3);
  margin: 14px 0 0;
  text-align: center;
}
.login-error {
  background: #FEF2F2;
  color: #B91C1C;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.login-field {
  display: block;
  text-align: left;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.login-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s ease;
}
.login-field input:focus { border-color: var(--ink-2); }
.login-btn {
  width: 100%;
  margin-top: 6px;
  padding: 11px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 4px;
}
.login-btn:hover { background: var(--ink-2); }
