/* 后端杂记 —— 中文个人技术博客样式（零外链、单栏、朴素风） */
:root {
  --bg: #fafafa;
  --fg: #2b2b2b;
  --muted: #777;
  --line: #e4e4e4;
  --link: #1a66b3;
  --code-bg: #282c34;
  --code-fg: #abb2bf;
  --card: #ffffff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.85 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.site-head { border-bottom: 1px solid var(--line); background: var(--card); }
.head-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.logo { color: var(--fg); font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-sub { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 10px; }
.search-area { display: flex; align-items: center; gap: 10px; }
.search-area input {
  width: 200px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; outline: none; background: var(--bg); color: var(--fg);
}
.search-area input:focus { border-color: #9cc3e8; }
.search-area a { color: var(--muted); font-size: 13px; white-space: nowrap; }
.search-area a:hover { color: var(--link); }

/* 首页列表 */
main.wrap { padding: 28px 20px 60px; }
.list .card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 22px; margin-bottom: 16px;
}
.card-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.card-meta .cat, .tag {
  background: #eef4ee; color: #3c7a54; border-radius: 4px; padding: 1px 8px; font-size: 12px;
}
.card h2 { font-size: 17.5px; line-height: 1.5; }
.card h2 a { color: var(--fg); }
.card h2 a:hover { color: var(--link); }
.card-ex { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

/* 文章页 */
.post { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 30px 34px; }
.post h1 { font-size: 23px; line-height: 1.5; margin: 4px 0 18px; }
.post .tag { margin-left: 4px; }
.post p, .post li { margin: 12px 0; font-size: 15.5px; }
.post h2 { font-size: 18px; margin: 26px 0 8px; }
.post blockquote {
  border-left: 3px solid #7fb08a; background: #f3f7f3; color: #3d4a42;
  padding: 10px 16px; margin: 16px 0; border-radius: 0 6px 6px 0;
}
.post table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 14px; }
.post th, .post td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.post th { background: #f0f2f5; font-weight: 600; }
.post tr:nth-child(even) td { background: #fafbfc; }
.post figure { margin: 20px 0; text-align: center; }
.post figure img {
  max-width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.post figcaption { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.post hr { border: none; border-top: 1px dashed var(--line); margin: 24px 0; }
.post ul, .post ol { padding-left: 24px; }
.post li { margin: 6px 0; }
.post pre {
  background: var(--code-bg); color: var(--code-fg); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; margin: 16px 0;
  font: 13px/1.7 Consolas, "JetBrains Mono", Menlo, monospace;
}
.post code {
  font-family: Consolas, Menlo, monospace; font-size: 13px;
  background: #f0f1f3; border-radius: 4px; padding: 1px 6px;
}
.post pre code { background: none; padding: 0; font-size: 13px; }
.post blockquote { border-left: 3px solid var(--line); color: var(--muted); padding-left: 14px; margin: 14px 0; }
.post-nav { border-top: 1px dashed var(--line); margin-top: 28px; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.post-nav .pn { font-size: 13.5px; color: var(--muted); }
.post-nav .pn.right { text-align: right; }
.post-nav .pn:hover { color: var(--link); }

/* 悬浮搜索层 */
.adv-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 900;
  display: none; align-items: flex-start; justify-content: center;
}
.adv-mask.show { display: flex; }
.adv-panel {
  background: var(--card); border-radius: 10px; margin-top: 8vh; width: min(560px, 92vw);
  box-shadow: 0 10px 40px rgba(0,0,0,.18); overflow: hidden;
}
.adv-head { padding: 14px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.adv-body { padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.adv-field { display: flex; flex-direction: column; gap: 4px; }
.adv-field.wide { grid-column: 1 / -1; }
.adv-field label { font-size: 12.5px; color: var(--muted); }
.adv-field input, .adv-field select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13.5px;
  outline: none; background: var(--bg); color: var(--fg); font-family: inherit;
}
.adv-field input:focus, .adv-field select:focus { border-color: #9cc3e8; }
.adv-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.adv-foot .hint { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 6px; padding: 7px 16px; font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: #9cc3e8; }
.btn.primary { background: #2f7d54; border-color: #2f7d54; color: #fff; }
.btn.primary:hover { background: #286b47; }

/* 检索结果 */
.search-out { margin-top: 10px; }
.search-out .hit { padding: 10px 12px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.search-out .hit .t { font-weight: 600; }
.search-out .hit .m { color: var(--muted); font-size: 12px; margin-left: 8px; }
.search-out .hit p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* 顶部快速检索建议 */
.q-drop {
  display: none; position: absolute; z-index: 800; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 240px; overflow: hidden;
}
.search-area { position: relative; }
.q-hit { display: block; padding: 8px 12px; font-size: 13px; color: var(--fg); border-bottom: 1px dashed var(--line); }
.q-hit:last-child { border-bottom: none; }
.q-hit:hover { background: #f2f6f2; text-decoration: none; }

/* 资料区（突破正文列宽，自适应整个屏幕） */
#shelf { margin-top: 28px; width: calc(100vw - 48px); margin-left: calc((100% - (100vw - 48px)) / 2); }
.shelf-title { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.shelf-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.vtab {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 6px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.vtab.on { background: #2f7d54; border-color: #2f7d54; color: #fff; }
.shelf-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 12px; min-height: 60px; }
.vlist { display: flex; flex-direction: column; gap: 6px; }
.vitem {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--card); border-radius: 6px;
  padding: 8px 12px; font-size: 13.5px; cursor: pointer; text-align: left; font-family: inherit; color: var(--fg);
}
.vitem:hover { border-color: #9cc3e8; }
.vsize { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vback { margin-bottom: 10px; }
.vtip { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.vstage { max-height: 78vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.vtools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.vpageinfo { color: var(--muted); font-size: 12.5px; }
.pdf-pages { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.pdf-c { max-width: 100%; height: auto; box-shadow: 0 2px 8px rgba(0,0,0,.12); background: #fff; }

/* PDF 标注层（画笔/高亮/橡皮） */
.vhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.vhead .vtools, .vhead .ann-bar { margin-bottom: 0; }
.vhead .ann-bar { margin-left: auto; }
.pdf-page-wrap { position: relative; }
.pdf-page-wrap .pdf-c { display: block; width: 100%; }
.ann-c { position: absolute; top: 0; left: 0; width: 100%; height: 100%; touch-action: none; }
.ann-c.on { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M3 21l2.5-.7L20 5.8 18.2 4 3.7 18.5z' fill='%23fff' stroke='%23333' stroke-width='1.6' stroke-linejoin='round'/><path d='M3 21l2.5-.7-.8-.8z' fill='%23333'/></svg>") 2 22, crosshair; }
.ann-c.on.hl { cursor: crosshair; }
.ann-c.on.eraser { cursor: pointer; }
.ann-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ann-bar .btn.on { background: #2f7d54; border-color: #2f7d54; color: #fff; }
.ann-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; outline: 1px solid var(--line); cursor: pointer; padding: 0; }
.ann-dot.on { outline: 2px solid var(--fg); }
.ann-dot.red { background: #e03e3e; }
.ann-dot.yellow { background: #f5c518; }
.ann-dot.blue { background: #2f6fd6; }
.vimg { max-width: 100%; height: auto; cursor: zoom-in; display: block; }
.img-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 950;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.img-mask img { max-width: 96vw; max-height: 96vh; }
.vframe { width: 100%; height: 72vh; border: none; background: #fff; }
.shelf-info { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* 页脚 */
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; padding: 18px 0 30px; margin-top: 20px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--link); }

@media (max-width: 620px) {
  .adv-body { grid-template-columns: 1fr; }
  .post { padding: 22px 18px; }
  .search-area input { width: 130px; }
}
